withHeader('Authorization', 'Bearer '.$key->plainTextKey) ->postJson('/v1/agent/sync/push', [ 'agent_id' => 'charon', 'dispatches' => [[ 'repo' => 'dappco.re/go/agent', 'workspace' => 'core-agent', 'task' => 'Record the sync alias route', 'status' => 'completed', ]], ]); $response ->assertCreated() ->assertJsonPath('data.synced', 1); expect(FleetNode::query()->where('agent_id', 'charon')->exists())->toBeTrue(); }); test('agent sync pull route returns shared context', function (): void { $workspace = createWorkspace(); $key = syncRouteKey($workspace, [AgentApiKey::PERM_SYNC_READ]); FleetNode::create([ 'workspace_id' => $workspace->id, 'agent_id' => 'charon', 'platform' => 'linux', 'status' => FleetNode::STATUS_ONLINE, ]); BrainMemory::create([ 'workspace_id' => $workspace->id, 'agent_id' => 'charon', 'type' => 'observation', 'content' => 'Shared context for the new pull route.', 'tags' => ['sync'], 'confidence' => 0.8, 'source' => 'test', ]); $response = $this ->withHeader('Authorization', 'Bearer '.$key->plainTextKey) ->getJson('/v1/agent/sync/pull?agent_id=charon'); $response ->assertOk() ->assertJsonPath('total', 1) ->assertJsonPath('data.0.agent_id', 'charon') ->assertJsonPath('data.0.content', 'Shared context for the new pull route.'); });