diff --git a/docs/agents/cli-flags.md b/docs/agents/cli-flags.md index 0291f5531c..b06eb28d27 100644 --- a/docs/agents/cli-flags.md +++ b/docs/agents/cli-flags.md @@ -28,7 +28,7 @@ Thread a flag only through the layers that consume it: interface exposes it. 6. `src/client/client-normalizers.ts`: update daemon flag normalization only when the request still needs a public-to-internal translation. -7. `src/daemon/context.ts` and `src/core/dispatch-context.ts`: add the field only when it flows into +7. `src/daemon/context.ts` and `src/daemon/dispatch-context.ts`: add the field only when it flows into platform dispatch. 8. Handler/platform modules: thread the option only after the command surface, grammar, and projection prove it belongs there. diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 8f321131f2..e3e124afc2 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -156,6 +156,10 @@ "types": "./src/daemon-http.ts", "default": "./src/daemon-http.ts" }, + "./deploy-result-target": { + "types": "./src/deploy-result-target.ts", + "default": "./src/deploy-result-target.ts" + }, "./device": { "types": "./src/facades/device.ts", "default": "./src/facades/device.ts" diff --git a/src/core/deploy-result-target.test.ts b/packages/contracts/src/deploy-result-target.test.ts similarity index 100% rename from src/core/deploy-result-target.test.ts rename to packages/contracts/src/deploy-result-target.test.ts diff --git a/src/core/deploy-result-target.ts b/packages/contracts/src/deploy-result-target.ts similarity index 100% rename from src/core/deploy-result-target.ts rename to packages/contracts/src/deploy-result-target.ts diff --git a/packages/host-kit/package.json b/packages/host-kit/package.json index cc448ab6a6..72a6b4f4db 100644 --- a/packages/host-kit/package.json +++ b/packages/host-kit/package.json @@ -40,6 +40,10 @@ "types": "./src/diagnostics.ts", "default": "./src/diagnostics.ts" }, + "./doctor-lines": { + "types": "./src/doctor-lines.ts", + "default": "./src/doctor-lines.ts" + }, "./file": { "types": "./src/file.ts", "default": "./src/file.ts" @@ -48,6 +52,10 @@ "types": "./src/host-file.ts", "default": "./src/host-file.ts" }, + "./interaction-outcome": { + "types": "./src/interaction-outcome.ts", + "default": "./src/interaction-outcome.ts" + }, "./process": { "types": "./src/process.ts", "default": "./src/process.ts" @@ -72,6 +80,10 @@ "types": "./src/session-paths.ts", "default": "./src/session-paths.ts" }, + "./status-markers": { + "types": "./src/status-markers.ts", + "default": "./src/status-markers.ts" + }, "./transport": { "types": "./src/transport.ts", "default": "./src/transport.ts" diff --git a/src/core/doctor-output.ts b/packages/host-kit/src/doctor-lines.ts similarity index 100% rename from src/core/doctor-output.ts rename to packages/host-kit/src/doctor-lines.ts diff --git a/src/core/interaction-outcome.ts b/packages/host-kit/src/interaction-outcome.ts similarity index 100% rename from src/core/interaction-outcome.ts rename to packages/host-kit/src/interaction-outcome.ts diff --git a/src/core/status-markers.ts b/packages/host-kit/src/status-markers.ts similarity index 100% rename from src/core/status-markers.ts rename to packages/host-kit/src/status-markers.ts diff --git a/scripts/layering/contracts-exports.snapshot.json b/scripts/layering/contracts-exports.snapshot.json index c8a8f860cd..267d240055 100644 --- a/scripts/layering/contracts-exports.snapshot.json +++ b/scripts/layering/contracts-exports.snapshot.json @@ -36,6 +36,7 @@ "@agent-device/contracts/command", "@agent-device/contracts/command-platform-execution", "@agent-device/contracts/daemon-http", + "@agent-device/contracts/deploy-result-target", "@agent-device/contracts/device", "@agent-device/contracts/device-boot", "@agent-device/contracts/device-readiness-runtime", diff --git a/scripts/layering/contracts-implementation-policy.test.ts b/scripts/layering/contracts-implementation-policy.test.ts index d6764ebb80..5c9f08713b 100644 --- a/scripts/layering/contracts-implementation-policy.test.ts +++ b/scripts/layering/contracts-implementation-policy.test.ts @@ -78,7 +78,7 @@ test('network traffic vocabulary cannot grow parser implementation inside contra test('contracts rejects mutable interaction-outcome lifecycle', () => { assert.match( messages('const targets = new WeakMap();', 'packages/contracts/src/interaction-outcome.ts')[0]!, - /src\/core/, + /host-kit\/interaction-outcome/, ); }); diff --git a/scripts/layering/contracts-implementation-policy.ts b/scripts/layering/contracts-implementation-policy.ts index 41cb4f72c0..6e6e88a2e8 100644 --- a/scripts/layering/contracts-implementation-policy.ts +++ b/scripts/layering/contracts-implementation-policy.ts @@ -47,7 +47,7 @@ export function contractsImplementationAuthorityViolations( violation( file.path, 1, - 'contracts may not own mutable interaction-outcome lifecycle; that WeakMap identity map belongs in src/core', + 'contracts may not own mutable interaction-outcome lifecycle; that WeakMap identity map lives in @agent-device/host-kit/interaction-outcome', ), ); } diff --git a/scripts/layering/package-boundaries.test.ts b/scripts/layering/package-boundaries.test.ts index 68e25c7ef9..838d35a64e 100644 --- a/scripts/layering/package-boundaries.test.ts +++ b/scripts/layering/package-boundaries.test.ts @@ -558,14 +558,17 @@ test('the real tree parses, declares, and passes R11', () => { '@agent-device/host-kit/code-signature-cache', '@agent-device/host-kit/command', '@agent-device/host-kit/diagnostics', + '@agent-device/host-kit/doctor-lines', '@agent-device/host-kit/file', '@agent-device/host-kit/host-file', + '@agent-device/host-kit/interaction-outcome', '@agent-device/host-kit/process', '@agent-device/host-kit/project-runtime', '@agent-device/host-kit/request', '@agent-device/host-kit/retry', '@agent-device/host-kit/runtime-transport-hints', '@agent-device/host-kit/session-paths', + '@agent-device/host-kit/status-markers', '@agent-device/host-kit/transport', '@agent-device/host-kit/version', ]); diff --git a/src/cli/replay-test/progress.ts b/src/cli/replay-test/progress.ts index fa81d83836..9ef7ebde37 100644 --- a/src/cli/replay-test/progress.ts +++ b/src/cli/replay-test/progress.ts @@ -6,7 +6,7 @@ import type { ReplayTestResult, ReplayTestStep, } from './reporters/types.ts'; -import { formatCliStatusMarker } from '../../core/status-markers.ts'; +import { formatCliStatusMarker } from '@agent-device/host-kit/status-markers'; import { formatDurationSeconds } from './duration-format.ts'; import { colorize, supportsColor } from '../../commands/output/color.ts'; diff --git a/src/commands/interaction/runtime/interactions.ts b/src/commands/interaction/runtime/interactions.ts index 890cc7e603..270cee3231 100644 --- a/src/commands/interaction/runtime/interactions.ts +++ b/src/commands/interaction/runtime/interactions.ts @@ -11,7 +11,7 @@ import { SELECTOR_PIPELINE_POLICIES } from '@agent-device/selectors/selector-pip import type { Point } from '@agent-device/kernel/snapshot'; import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; import { isFillableType } from '@agent-device/contracts/snapshot'; -import { attachResolvedInteractionTarget } from '../../../core/interaction-outcome.ts'; +import { attachResolvedInteractionTarget } from '@agent-device/host-kit/interaction-outcome'; import { toBackendContext } from '../../runtime-common.ts'; import { toBackendResult, type RuntimeCommand } from '../../runtime-types.ts'; import { diff --git a/src/commands/management/output.ts b/src/commands/management/output.ts index 19086385f4..331a4302e0 100644 --- a/src/commands/management/output.ts +++ b/src/commands/management/output.ts @@ -187,7 +187,7 @@ export async function doctorCliOutput( progress?: CommandProgressState, ): Promise { const { formatDoctorCheckDetailLines, formatDoctorCheckSummaryLine } = - await import('../../core/doctor-output.ts'); + await import('@agent-device/host-kit/doctor-lines'); const data = result as Record; const status = typeof data.status === 'string' ? data.status : 'unknown'; const lines = [`Doctor: ${status}`]; diff --git a/src/commands/output/result-serialization.ts b/src/commands/output/result-serialization.ts index 1429fda47d..cff68bad33 100644 --- a/src/commands/output/result-serialization.ts +++ b/src/commands/output/result-serialization.ts @@ -15,7 +15,7 @@ import { successText, withSuccessText } from '@agent-device/kernel/success-text' import { resolveDeployResultTarget, resolveInstallFromSourceResultTarget, -} from '../../core/deploy-result-target.ts'; +} from '@agent-device/contracts/deploy-result-target'; function serializeSessionDevice( device: AgentDeviceSessionDevice, diff --git a/src/daemon/__tests__/snapshot-runtime-fixture.ts b/src/daemon/__tests__/snapshot-runtime-fixture.ts index a24690d839..8e99ba5884 100644 --- a/src/daemon/__tests__/snapshot-runtime-fixture.ts +++ b/src/daemon/__tests__/snapshot-runtime-fixture.ts @@ -35,7 +35,7 @@ import { } from '@agent-device/kernel/device'; import { applePlugin } from '@agent-device/platform-apple'; import { textSizeSettingPayload } from '@agent-device/contracts/settings'; -import { type DispatchContext } from '../../core/dispatch-context.ts'; +import { type DispatchContext } from '../dispatch-context.ts'; import { getRequestSignal } from '@agent-device/host-kit/request'; import { isActiveProviderDevice } from '../provider-device-admission.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; diff --git a/src/daemon/context.ts b/src/daemon/context.ts index 18a2ca53ef..782fce235e 100644 --- a/src/daemon/context.ts +++ b/src/daemon/context.ts @@ -1,5 +1,5 @@ import type { CommandFlags } from '@agent-device/contracts/command'; -import { dispatchContextFlags, type DispatchContext } from '../core/dispatch-context.ts'; +import { dispatchContextFlags, type DispatchContext } from './dispatch-context.ts'; import { resolveClickButton } from '@agent-device/contracts/click-button'; import { screenshotFlagsFromOptions, diff --git a/src/core/dispatch-context.ts b/src/daemon/dispatch-context.ts similarity index 100% rename from src/core/dispatch-context.ts rename to src/daemon/dispatch-context.ts diff --git a/src/daemon/handlers/session-app-deployment.ts b/src/daemon/handlers/session-app-deployment.ts index 51e8d79efc..d1ae923904 100644 --- a/src/daemon/handlers/session-app-deployment.ts +++ b/src/daemon/handlers/session-app-deployment.ts @@ -14,7 +14,7 @@ import type { SessionStore } from '../session-store.ts'; import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import type { SessionRef, SessionState } from '../session-state.ts'; import { resolvePayloadInput } from '../payload-input.ts'; -import { resolveDeployResultTarget } from '../../core/deploy-result-target.ts'; +import { resolveDeployResultTarget } from '@agent-device/contracts/deploy-result-target'; import { withSuccessText } from '@agent-device/kernel/success-text'; import { recordSessionAction } from '../session-action-recorder.ts'; import { diff --git a/src/daemon/handlers/session-app-source-deployment.ts b/src/daemon/handlers/session-app-source-deployment.ts index 013c0bf27a..2507643d83 100644 --- a/src/daemon/handlers/session-app-source-deployment.ts +++ b/src/daemon/handlers/session-app-source-deployment.ts @@ -21,7 +21,7 @@ import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-ru import { SessionStore } from '../session-store.ts'; import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import type { SessionState } from '../session-state.ts'; -import { resolveInstallFromSourceResultTarget } from '../../core/deploy-result-target.ts'; +import { resolveInstallFromSourceResultTarget } from '@agent-device/contracts/deploy-result-target'; import { withSuccessText } from '@agent-device/kernel/success-text'; import { recordSessionAction } from '../session-action-recorder.ts'; import { resolveCommandDevice } from '../session-device-resolution.ts'; diff --git a/src/daemon/handlers/session-doctor-output.ts b/src/daemon/handlers/session-doctor-output.ts index d616af5af4..0ac3f02c12 100644 --- a/src/daemon/handlers/session-doctor-output.ts +++ b/src/daemon/handlers/session-doctor-output.ts @@ -2,7 +2,7 @@ import { emitRequestProgress } from '@agent-device/host-kit/request'; import { formatDoctorCheckDetailLines, formatDoctorCheckSummaryLine, -} from '../../core/doctor-output.ts'; +} from '@agent-device/host-kit/doctor-lines'; import type { DoctorCheck, DoctorStatus } from '@agent-device/contracts/observability'; export function summarizeDoctorStatus(checks: DoctorCheck[]): 'pass' | 'warn' | 'fail' { diff --git a/src/core/__tests__/interaction-response-data-transform.test.ts b/src/daemon/interaction/internal/__tests__/interaction-response-data-transform.test.ts similarity index 100% rename from src/core/__tests__/interaction-response-data-transform.test.ts rename to src/daemon/interaction/internal/__tests__/interaction-response-data-transform.test.ts diff --git a/src/core/interaction-response-data-transform.ts b/src/daemon/interaction/internal/interaction-response-data-transform.ts similarity index 100% rename from src/core/interaction-response-data-transform.ts rename to src/daemon/interaction/internal/interaction-response-data-transform.ts diff --git a/src/daemon/interaction/internal/interaction-touch-response.ts b/src/daemon/interaction/internal/interaction-touch-response.ts index 74fed83a21..741da1b325 100644 --- a/src/daemon/interaction/internal/interaction-touch-response.ts +++ b/src/daemon/interaction/internal/interaction-touch-response.ts @@ -14,7 +14,7 @@ import { stripInternalInteractionDiagnostics, transformInteractionResponseData, type InteractionResponseDataTransformCommand, -} from '../../../core/interaction-response-data-transform.ts'; +} from './interaction-response-data-transform.ts'; import { issueSettleRefs } from '../../session-snapshot.ts'; import type { RecordedTargetCapture } from '@agent-device/selectors/target-evidence'; import type { CaptureSnapshotForSession, InteractionRouteInput } from './types.ts'; diff --git a/src/daemon/interaction/internal/interaction-touch-runtime.ts b/src/daemon/interaction/internal/interaction-touch-runtime.ts index 502fa9aa64..028163a399 100644 --- a/src/daemon/interaction/internal/interaction-touch-runtime.ts +++ b/src/daemon/interaction/internal/interaction-touch-runtime.ts @@ -9,7 +9,7 @@ import type { import type { GestureReferenceFrame } from '@agent-device/contracts/scroll-gesture'; import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { asAppError, normalizeError } from '@agent-device/kernel/errors'; -import { readResolvedInteractionTarget } from '../../../core/interaction-outcome.ts'; +import { readResolvedInteractionTarget } from '@agent-device/host-kit/interaction-outcome'; import { publishAmbiguousMatchCandidateRefs } from '../../session-snapshot.ts'; import { isSessionRecording } from '../../session-script-publication-capability.ts'; import type { DaemonResponse } from '../../daemon-request.ts';