Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ under `contracts/fixtures/`.
## Runtime and diagnostics seams

Diagnostics use `@agent-device/capture-kit/diagnostics`. Request diagnostics belong in the session request log;
session artifact paths come from `src/daemon/session-store.ts`. App/device logs remain in `app.log`;
session artifact paths come from `src/daemon/session-artifact-paths.ts`. App/device logs remain in `app.log`;
Apple runner and xcodebuild output remains in `runner.log`.

Normalize failures with `normalizeError` and preserve `hint`, `diagnosticId`, `logPath`, and typed
Expand Down
2 changes: 1 addition & 1 deletion docs/adr/0016-active-session-script-publication.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ computed from whether `session` still exists in the daemon's own store when the
by re-parsing the script for `close`. This is what lets the real CLI/IPC client (not just the in-process
handler) actually honor "the session stays active": without an explicit signal in the response, the
client's one-shot `replay`/`test` teardown had no way to distinguish a still-active handoff from a
finished one, and tore the owning daemon down regardless (`src/daemon/client/daemon-client-lifecycle.ts`).
finished one, and tore the owning daemon down regardless (`src/daemon-client/daemon-client-lifecycle.ts`).
`sessionActive` is `true` for every close-less run (including a `--from` resume) and `false` once the
script's terminal `close` — or a repair-armed run's deferred equivalent — has executed.

Expand Down
12 changes: 6 additions & 6 deletions fallow-baselines/health.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,25 @@
"count": 1
}
},
"src/daemon/client/daemon-client-lifecycle.ts": {
"src/daemon-client/daemon-client-lifecycle.ts": {
"complexity_high": {
"count": 1
},
"crap_high": {
"count": 1
}
},
"src/daemon/client/daemon-client-metadata.ts": {
"src/daemon-client/daemon-client-metadata.ts": {
"complexity_moderate": {
"count": 1
}
},
"src/daemon/client/daemon-client-rpc.ts": {
"src/daemon-client/daemon-client-rpc.ts": {
"crap_moderate": {
"count": 1
}
},
"src/daemon/client/daemon-client.ts": {
"src/daemon-client/daemon-client.ts": {
"complexity_moderate": {
"count": 1
}
Expand Down Expand Up @@ -533,7 +533,7 @@
},
"runtime_coverage_findings": [],
"target_keys": [
"src/daemon/client/daemon-client.ts:high impact",
"src/daemon-client/daemon-client.ts:high impact",
"src/cli/parser/args.ts:high impact",
"src/daemon/lease-context.ts:high impact",
"src/daemon/replay/internal/session-replay-heal.ts:high impact",
Expand Down Expand Up @@ -584,7 +584,7 @@
"src/daemon/server/http-server.ts:complexity",
"packages/platform-android/src/ui-hierarchy.ts:high impact",
"packages/platform-android/src/sdk.ts:high impact",
"src/daemon/client/daemon-client-lifecycle.ts:complexity",
"src/daemon-client/daemon-client-lifecycle.ts:complexity",
"src/client/client-companion-tunnel-worker.ts:complexity"
]
}
2 changes: 1 addition & 1 deletion oxlint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default defineConfig({
},
{
files: [
'src/daemon/client/daemon-client-rpc.ts',
'src/daemon-client/daemon-client-rpc.ts',
'src/daemon/downloadable-artifact-http.ts',
'src/remote/remote-request-diagnostics.ts',
'src/remote/upload-stream.ts',
Expand Down
2 changes: 1 addition & 1 deletion scripts/ios-snapshot-benchmark/cell-admission.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'node:fs';
import { resolveDaemonPaths } from '../../src/daemon/config.ts';
import { readDaemonInfo } from '../../src/daemon/client/daemon-client-metadata.ts';
import { readDaemonInfo } from '../../src/daemon-client/daemon-client-metadata.ts';
import { isAgentDeviceDaemonProcess } from '../../src/daemon/daemon-process.ts';
import {
openFixture,
Expand Down
9 changes: 8 additions & 1 deletion scripts/layering/daemon-modularity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,14 @@ test('external daemon request/session-state importer membership changes require
REFERENCE,
);
assert.equal(violations.length, 1);
assert.match(violations[0]!.message, /may only shrink from the recorded 2/);
// The recorded list owns its own size (#2342 relocated five client files into it), so the
// message assertion reads it rather than pinning a literal that the baseline would outgrow.
assert.match(
violations[0]!.message,
new RegExp(
`may only shrink from the recorded ${DAEMON_MODULARITY_BASELINE.externalDaemonTypesImporters.length}`,
),
);

const removed = checkDaemonModularityRatchets(
baselineDaemonTypesEdges().slice(1),
Expand Down
12 changes: 12 additions & 0 deletions scripts/layering/daemon-modularity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ import type { LayeringRatchets } from './ratchet-reference.ts';
export const DAEMON_MODULARITY_BASELINE = {
externalDaemonTypesImporters: [
'src/client/client-normalizers.ts',
// #2342 relocated the daemon client to `src/daemon-client/`. These five edges are unchanged
// by that move — the client has always built `DaemonRequest` and read `DaemonResponse`, it
// simply sat inside `src/daemon/` and so fell under the prefix skip below. Naming the files
// is stronger than letting a folder prefix hide them: the set can only shrink, so a new
// `src/daemon-client/` module reaching `session-state.ts` or the daemon-private request half
// still fails this gate. Reducing these five means giving the client a neutral request
// contract, which is a type change, not a relocation.
'src/daemon-client/daemon-client-lifecycle.ts',
'src/daemon-client/daemon-client-progress.ts',
'src/daemon-client/daemon-client-rpc.ts',
'src/daemon-client/daemon-client-transport.ts',
'src/daemon-client/daemon-client.ts',
'src/remote/daemon-artifacts.ts',
],
} as const;
Expand Down
3 changes: 2 additions & 1 deletion scripts/layering/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ export function topFolder(file: string): string {
}

export function targetDagZone(file: string): string {
if (file.startsWith('src/daemon/client/')) return 'daemon-client';
// #2342 relocated the daemon client to its own `src/daemon-client/` folder, so the
// client zone now falls out of the folder itself; `src/daemon/` is server-only.
if (file.startsWith('src/daemon/')) return 'daemon-server';
return topFolder(file);
}
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-agent-cdp-session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
hashRemoteConfigFile,
writeRemoteConnectionState,
} from '../remote/remote-connection-state.ts';
import type { DaemonResponse } from '../daemon/client/daemon-client.ts';
import type { DaemonResponse } from '../daemon-client/daemon-client.ts';

afterEach(() => {
vi.clearAllMocks();
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-capture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
DaemonRequest,
DaemonResponse,
sendToDaemon,
} from '../daemon/client/daemon-client.ts';
} from '../daemon-client/daemon-client.ts';
import { installIsolatedCliTestEnv } from './cli-test-env.ts';
import { mkdtempForTestSync } from './test-utils/tmp-dir.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-diagnostics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test } from 'vitest';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import type { DaemonResponse } from '../daemon/client/daemon-client.ts';
import type { DaemonResponse } from '../daemon-client/daemon-client.ts';
import { resolveDaemonPaths } from '../daemon/config.ts';
import {
runCliCapture as captureCli,
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-diff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { PNG } from '@agent-device/capture-kit/png';
import type { DaemonResponse } from '../daemon/client/daemon-client.ts';
import type { DaemonResponse } from '../daemon-client/daemon-client.ts';
import {
runCliCapture as captureCli,
type CapturedCliRun,
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-exit-paths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { runCli } from '../cli.ts';
import { runWebCommand } from '../cli/commands/web.ts';
import { installIsolatedCliTestEnv } from './cli-test-env.ts';
import { resolveDaemonPaths } from '../daemon/config.ts';
import type { DaemonResponse } from '../daemon/client/daemon-client.ts';
import type { DaemonResponse } from '../daemon-client/daemon-client.ts';

afterEach(() => {
vi.clearAllMocks();
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-react-devtools-session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type {
DaemonRequest,
DaemonResponse,
sendToDaemon as SendToDaemon,
} from '../daemon/client/daemon-client.ts';
} from '../daemon-client/daemon-client.ts';

afterEach(() => {
vi.clearAllMocks();
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-remote-diagnostics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import fs from 'node:fs';
import path from 'node:path';
import { normalizeError, AppError } from '@agent-device/kernel/errors';
import { createDaemonHttpServer } from '../daemon/server/http-server.ts';
import { resolveSessionRequestLogPath } from '../daemon/session-store.ts';
import { resolveSessionRequestLogPath } from '../daemon/session-artifact-paths.ts';
import { safeSessionName } from '../daemon/session-paths.ts';
import type { DaemonRequest, DaemonResponse } from '../daemon/daemon-request.ts';
import { runCliCapture, type CapturedCliRun } from './cli-capture.ts';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ describe('platform-execution coherence across CLI route delegation', () => {

test('wiring the transport into a client transport factory stays allowed', () => {
const wiring = `
import { sendToDaemon } from '../daemon/client/daemon-client.ts';
import { sendToDaemon } from '../daemon-client/daemon-client.ts';
type CliDeps = { sendToDaemon: typeof sendToDaemon };
function build(deps: CliDeps) {
return createCliDaemonTransport({ transport: deps.sendToDaemon });
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/daemon-client-progress.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
import type { Socket } from 'node:net';
import { test } from 'vitest';
import type { DaemonRequest, DaemonResponse } from '../daemon/daemon-request.ts';
import { readDaemonSocketProgressResponse } from '../daemon/client/daemon-client-progress.ts';
import { readDaemonSocketProgressResponse } from '../daemon-client/daemon-client-progress.ts';
import { AppError } from '@agent-device/kernel/errors';

type MockSocket = EventEmitter & {
Expand Down
24 changes: 12 additions & 12 deletions src/__tests__/test-utils/boundary-fault-matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ export const BOUNDARY_FAULT_MATRIX = {
timeout: {
mutation: {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/boundary-fault-transport.test.ts:timeout'],
evidence: ['src/daemon-client/__tests__/boundary-fault-transport.test.ts:timeout'],
invariants: ['bounded-deadline', 'typed-error-identity'],
},
read: {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/daemon-client-timeout-route.test.ts:http timeout'],
evidence: ['src/daemon-client/__tests__/daemon-client-timeout-route.test.ts:http timeout'],
invariants: ['bounded-deadline', 'typed-error-identity'],
},
'artifact-producing': {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/boundary-fault-transport.test.ts:timeout'],
evidence: ['src/daemon-client/__tests__/boundary-fault-transport.test.ts:timeout'],
invariants: ['bounded-deadline', 'typed-error-identity'],
},
'session-lifecycle': {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/boundary-fault-transport.test.ts:timeout'],
evidence: ['src/daemon-client/__tests__/boundary-fault-transport.test.ts:timeout'],
invariants: ['bounded-deadline', 'typed-error-identity'],
},
},
Expand Down Expand Up @@ -100,44 +100,44 @@ export const BOUNDARY_FAULT_MATRIX = {
'response-framing': {
mutation: {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/boundary-fault-transport.test.ts:response framing'],
evidence: ['src/daemon-client/__tests__/boundary-fault-transport.test.ts:response framing'],
invariants: ['typed-error-identity', 'no-mutation-replay'],
},
read: {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/boundary-fault-transport.test.ts:response framing'],
evidence: ['src/daemon-client/__tests__/boundary-fault-transport.test.ts:response framing'],
invariants: ['typed-error-identity'],
},
'artifact-producing': {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/boundary-fault-transport.test.ts:response framing'],
evidence: ['src/daemon-client/__tests__/boundary-fault-transport.test.ts:response framing'],
invariants: ['typed-error-identity'],
},
'session-lifecycle': {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/boundary-fault-transport.test.ts:response framing'],
evidence: ['src/daemon-client/__tests__/boundary-fault-transport.test.ts:response framing'],
invariants: ['typed-error-identity'],
},
},
'process-death': {
mutation: {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/boundary-fault-acceptance.test.ts'],
evidence: ['src/daemon-client/__tests__/boundary-fault-acceptance.test.ts'],
invariants: ['bounded-deadline', 'no-mutation-replay'],
},
read: {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/boundary-fault-acceptance.test.ts'],
evidence: ['src/daemon-client/__tests__/boundary-fault-acceptance.test.ts'],
invariants: ['bounded-deadline'],
},
'artifact-producing': {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/boundary-fault-acceptance.test.ts'],
evidence: ['src/daemon-client/__tests__/boundary-fault-acceptance.test.ts'],
invariants: ['bounded-deadline'],
},
'session-lifecycle': {
kind: 'covered',
evidence: ['src/daemon/client/__tests__/boundary-fault-acceptance.test.ts'],
evidence: ['src/daemon-client/__tests__/boundary-fault-acceptance.test.ts'],
invariants: ['bounded-deadline'],
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/agent-device-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import {
type DaemonCommandName,
} from './commands/command-projection.ts';
import type { CommandResult } from '@agent-device/command-registry/command-result';
import { sendToDaemon } from './daemon/client/daemon-client.ts';
import { sendToDaemon } from './daemon-client/daemon-client.ts';
import { resolveDaemonPaths } from './daemon/config.ts';
import { prepareMetroRuntime, reloadMetro } from './metro/client-metro.ts';
import {
Expand Down
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
throwDaemonError,
type NormalizedError,
} from '@agent-device/kernel/errors';
import { resolveRemoteRequestDiagnosticsPath } from './daemon/session-store.ts';
import { resolveRemoteRequestDiagnosticsPath } from './daemon/session-artifact-paths.ts';
import { exitAfterFlush } from './cli/process-exit.ts';
import { readVersion } from '@agent-device/host-kit/version';
import { pathToFileURL } from 'node:url';
import { sendToDaemon } from './daemon/client/daemon-client.ts';
import { sendToDaemon } from './daemon-client/daemon-client.ts';
import fs from 'node:fs';
import type { BatchStep } from '@agent-device/contracts/client';
import type { ReplayTestReporterRuntime } from './cli/replay-test/reporting.ts';
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { buildDaemonHttpBaseUrl } from '@agent-device/contracts/daemon-http';
import {
ensureDaemon,
resolveClientSettings,
} from '../../daemon/client/daemon-client-lifecycle.ts';
} from '../../daemon-client/daemon-client-lifecycle.ts';
import { AppError } from '@agent-device/kernel/errors';
import { colorize, supportsColor } from '../../commands/output/color.ts';
import type { CliFlags } from '@agent-device/contracts/command';
Expand Down
2 changes: 1 addition & 1 deletion src/cli/injected-daemon-dispatch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DaemonResponse, sendToDaemon } from '../daemon/client/daemon-client.ts';
import type { DaemonResponse, sendToDaemon } from '../daemon-client/daemon-client.ts';
import { INTERNAL_COMMANDS } from '@agent-device/command-registry/catalog';
import type {
DescriptorCliCommandName,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/batch/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test } from 'vitest';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import type { DaemonResponse } from '../../daemon/client/daemon-client.ts';
import type { DaemonResponse } from '../../daemon-client/daemon-client.ts';
import {
runCliCapture as captureCli,
type CapturedCliRun,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import http from 'node:http';
import path from 'node:path';
import { test } from 'vitest';
import { AppError } from '@agent-device/kernel/errors';
import { assertRejectsAppError } from '../../../__tests__/test-utils/app-error.ts';
import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts';
import type { DaemonPaths } from '../../config.ts';
import type { DaemonRequest } from '../../daemon-request.ts';
import { assertRejectsAppError } from '../../__tests__/test-utils/app-error.ts';
import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts';
import type { DaemonPaths } from '../../daemon/config.ts';
import type { DaemonRequest } from '../../daemon/daemon-request.ts';
import { sendRequest } from '../daemon-client-transport.ts';

type ProcessDeathCommand = 'press' | 'fill' | 'snapshot' | 'screenshot' | 'open' | 'close';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
closeLoopbackServer,
listenOnLoopback,
type LoopbackServer,
} from '../../../__tests__/test-utils/loopback.ts';
import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts';
import type { DaemonPaths } from '../../config.ts';
import type { DaemonRequest } from '../../daemon-request.ts';
} from '../../__tests__/test-utils/loopback.ts';
import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts';
import type { DaemonPaths } from '../../daemon/config.ts';
import type { DaemonRequest } from '../../daemon/daemon-request.ts';
import { sendRequest } from '../daemon-client-transport.ts';

const { mockRunCmdSync } = vi.hoisted(() => ({ mockRunCmdSync: vi.fn() }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import http from 'node:http';
import net from 'node:net';
import path from 'node:path';
import { afterEach, test, vi } from 'vitest';
import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts';
import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts';

vi.mock('@agent-device/host-kit/command', async (importOriginal) => ({
...(await importOriginal<typeof import('@agent-device/host-kit/command')>()),
Expand All @@ -18,7 +18,7 @@ vi.mock('@agent-device/host-kit/retry', async (importOriginal) => ({
sleep: vi.fn(async () => {}),
}));

import { resolveDaemonPaths, type DaemonPaths } from '../../config.ts';
import { resolveDaemonPaths, type DaemonPaths } from '../../daemon/config.ts';
import { sendToDaemon, type DaemonRequest, type DaemonResponse } from '../daemon-client.ts';
import { attachActiveSessionAddressHint } from '../daemon-client-lifecycle.ts';
import { computeDaemonCodeSignature } from '@agent-device/host-kit/code-signature';
Expand All @@ -27,7 +27,7 @@ import {
closeLoopbackServer,
listenOnLoopback,
supportsLoopbackBind,
} from '../../../__tests__/test-utils/loopback.ts';
} from '../../__tests__/test-utils/loopback.ts';
import { AppError } from '@agent-device/kernel/errors';
import {
runCmdDetachedMonitored,
Expand Down
Loading
Loading