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
4 changes: 2 additions & 2 deletions docs/adr/0033-collocation-decision-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ the whole `daemon-contracts` zone has moved into `packages/daemon-contracts` —
package derive the zone, so every moved file's `ROOT_MODULE_ZONES` row is gone.
The daemon ⇄ client shared files that remain here (`provider-credential-fingerprint.ts`) trace
to #2559, which relocated the shared contracts **to the process root** so the client stops
importing `packages/daemon/src/` at all; R78 keeps any client→daemon
edge at zero runtime and a five-line recorded type-only residue, and #3288's `daemon-contracts`
importing `packages/daemon/src/` at all; the `daemon-client` logical-module policy bans every edge from `src/daemon-client/` into
`packages/daemon/src/`, and #3288's `daemon-contracts`
zone was the declaration of that shared-below-both ownership — the extraction makes it
physical, with R11 and the package's dependency edges holding the same boundary. Rows on
path-keyed evidence alone (the `platform-runtime-*` seams) say "retain for this batch": a guard's
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import { isMacOs } from '@agent-device/kernel/device';
import { legacyDispatchCapture } from '../legacy-snapshot-capture-fixture.ts';
import { expect, vi, beforeEach } from 'vitest';
Expand Down Expand Up @@ -82,7 +83,7 @@ vi.mock('../../../sessions/materialized-path-registry.ts', async (importOriginal
import * as path from 'node:path';
import { cleanupRetainedMaterializedPathsForSession } from '../../../sessions/materialized-path-registry.ts';
import { SessionStore } from '../../../core/session-store.ts';
import type { DaemonRequest, DaemonResponse } from '../../../core/daemon-request.ts';
import type { DaemonRequest } from '../../../core/daemon-request.ts';
import type { SessionState } from '../../../core/session-state.ts';
import { resolveTargetDevice } from '@agent-device/device-selection/dispatch-resolve';
import { ensureDeviceReady } from '../../../core/device/device-ready.ts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import assert from 'node:assert/strict';
import { test } from 'vitest';
import { iosTargetActivationDisclosure } from '@agent-device/contracts/ios-target-activation';
import type { IosTargetActivation } from '@agent-device/kernel/snapshot';
import { withCaptureDisclosures, withTargetActivationDisclosure } from '../capture-disclosure.ts';
import type { DaemonResponse } from '../daemon-request.ts';

const FACT: IosTargetActivation = {
reason: 'stale_target',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import assert from 'node:assert/strict';
import { test } from 'vitest';
import { AppError } from '@agent-device/kernel/errors';
import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts';
import type { DaemonRequest } from '../daemon-request.ts';
import {
createRequestDispatchLedger,
recordBoundMutations,
Expand Down
2 changes: 1 addition & 1 deletion packages/daemon/src/core/capture-disclosure.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { SnapshotState } from '@agent-device/kernel/snapshot';
import { systemSurfaceDisclosure } from '@agent-device/contracts/android-system-surface-disclosure';
import { iosSystemSurfaceDisclosure } from '@agent-device/contracts/ios-system-surface';
import { iosTargetActivationDisclosure } from '@agent-device/contracts/ios-target-activation';
import { formatPostGestureOutcomeWarning } from '@agent-device/capture-kit/post-gesture-stability';
import type { DaemonResponse } from './daemon-request.ts';

/** The capture provenance a response must be disclosed against (#2438, #2682, gesture outcomes). */
export type CaptureProvenance = Pick<
Expand Down
14 changes: 3 additions & 11 deletions packages/daemon/src/core/daemon-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@ import type { ExecutionPlan } from './execution-plan.ts';
import type { PreresolvedInteractionTarget } from '@agent-device/contracts/interaction';
import type { DeviceLease } from '@agent-device/contracts/device';
import type { ReplayDispatchOptions } from '@agent-device/contracts/replay';
import type {
DaemonArtifact as PublicDaemonArtifact,
DaemonResponse as PublicDaemonResponse,
DaemonResponseData as PublicDaemonResponseData,
} from '@agent-device/kernel/contracts';
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { DaemonWireRequest } from '@agent-device/contracts/command';
import type { RequestDispatchLedger } from './request-dispatch-ledger.ts';
import type { EndedLeaseLedger } from './request-ended-leases.ts';

/**
* The daemon's own request and response vocabulary: the wire shape from `@agent-device/contracts/command` (`DaemonWireRequest`)
* plus what only the daemon may see. A consumer that must stay free of live session state takes
* The daemon's request vocabulary: the wire shape from `@agent-device/contracts/command`
* (`DaemonWireRequest`) plus what only the daemon may see. A consumer that must stay free of live session state takes
* `DaemonWireRequest` directly.
*/

export type DaemonArtifact = PublicDaemonArtifact;
export type DaemonResponseData = PublicDaemonResponseData;

/**
* What only the daemon may see on a request: the replay dispatch options (declared once in
* `@agent-device/contracts/replay`, so the port and the daemon cannot drift), plus the callbacks,
Expand Down Expand Up @@ -78,5 +71,4 @@ export type DaemonRequest = DaemonWireRequest & {
internal?: DaemonRequestInternal;
};

export type DaemonResponse = PublicDaemonResponse;
export type DaemonInvokeFn = (req: DaemonRequest) => Promise<DaemonResponse>;
3 changes: 2 additions & 1 deletion packages/daemon/src/core/generic-leaf-execution.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Shared by the generic dispatcher and its leaves; leaves must not import the dispatcher.

import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { DaemonCommandContext } from './context.ts';
import type { DaemonRequest, DaemonResponse } from './daemon-request.ts';
import type { DaemonRequest } from './daemon-request.ts';
import type { SessionState } from './session-state.ts';

export type GenericPlatformExecutionParams = {
Expand Down
3 changes: 2 additions & 1 deletion packages/daemon/src/core/interaction/internal/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { DaemonPlatformServices } from '../../platform-services.ts';
import type { CommandFlags } from '@agent-device/contracts/command';
import type { CreateDaemonCommandSurface } from '@agent-device/contracts/daemon-command-surface';
Expand All @@ -9,7 +10,7 @@ import type { CommandSessionStore } from '@agent-device/contracts/runtime-contra
import type { DeferredInteractionOutcomeMark } from '../../deferred-interaction-outcome.ts';
import type { RecordActionEntry } from '../../session-action-recorder.ts';
import type { BoundContextFromFlags } from '../../context.ts';
import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../daemon-request.ts';
import type { DaemonInvokeFn, DaemonRequest } from '../../daemon-request.ts';
import type { SessionRef, SessionState } from '../../session-state.ts';
import type { BoundGestureExecutor } from '../../gesture-runtime.ts';
import type { BoundTouchExecutor } from '../../touch-runtime.ts';
Expand Down
3 changes: 2 additions & 1 deletion packages/daemon/src/core/request-dispatch-ledger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from './daemon-request.ts';
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { DaemonInvokeFn, DaemonRequest } from './daemon-request.ts';
import { RUNTIME_OPERATION_EFFECTS } from './runtime-operation-effects.ts';

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/daemon/src/core/request-ended-leases.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { EndedLease } from '@agent-device/contracts/client';
import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from './daemon-request.ts';
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { DaemonInvokeFn, DaemonRequest } from './daemon-request.ts';

/** The session leases one request ended, its nested requests' included. */
export type EndedLeaseLedger = EndedLease[];
Expand Down
3 changes: 2 additions & 1 deletion packages/daemon/src/core/session-runtime-admission.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { DaemonPlatformServices } from './platform-services.ts';
import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations';
import type {
Expand All @@ -9,7 +10,7 @@ import type { DeviceInfo } from '@agent-device/kernel/device';
import { AppError } from '@agent-device/kernel/errors';
import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from './request-runtime-binding.ts';
import type { SessionStore } from './session-store.ts';
import type { DaemonRequest, DaemonResponse } from './daemon-request.ts';
import type { DaemonRequest } from './daemon-request.ts';
import { unsupportedOperationResponse } from './runtime-admission.ts';

export type RuntimeCommandHandlerParams = Readonly<{
Expand Down
3 changes: 2 additions & 1 deletion packages/daemon/src/core/snapshot-runtime-binding.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { DaemonPlatformServices } from './platform-services.ts';
import type { RuntimeOperationFact } from '@agent-device/contracts/platform-runtime';
import type { CreateDaemonCommandSurface } from '@agent-device/contracts/daemon-command-surface';
Expand All @@ -20,7 +21,7 @@ import {
} from './request-runtime-binding.ts';
import type { PlatformResourceCleanup } from './platform-resource-cleanup.ts';
import { SessionStore } from './session-store.ts';
import type { DaemonRequest, DaemonResponse } from './daemon-request.ts';
import type { DaemonRequest } from './daemon-request.ts';
import type { SessionRef, SessionState } from './session-state.ts';
import {
admitRuntimePlan,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import { beforeEach, expect, test, vi } from 'vitest';
import type {
CaptureSnapshotInput,
Expand All @@ -8,7 +9,6 @@ import {
type IosTargetActivation,
type SnapshotState,
} from '@agent-device/kernel/snapshot';
import type { DaemonResponse } from '../../core/daemon-request.ts';
import { type RequestCaptureProof, withCaptureDisclosures } from '../../core/capture-disclosure.ts';
import { makeIosSession } from '../../__tests__/support/session-factories.ts';
import { makeSessionStore } from '../../__tests__/support/store-factory.ts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import { promises as fs } from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import type { DaemonResponse } from '../core/daemon-request.ts';
import type { SessionState } from '../core/session-state.ts';
import { emitDiagnostic } from '@agent-device/host-kit/diagnostics';
import { AppError, normalizeError } from '@agent-device/kernel/errors';
Expand Down
3 changes: 2 additions & 1 deletion packages/daemon/src/execution/generic-settle.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { CommandFlags } from '@agent-device/contracts/command';
import type { CreateDaemonCommandSurface } from '@agent-device/contracts/daemon-command-surface';
import { surfaceScopedNodes } from '@agent-device/capture-kit/snapshot-baseline';
Expand All @@ -20,7 +21,7 @@ import { resolveSettleObservationCapture } from '../core/settle-observation-capt
import { isOutdatedObservation } from '../core/ref-frame.ts';
import { issueSettleRefs } from './session-snapshot.ts';
import type { SessionStore } from '../core/session-store.ts';
import type { DaemonRequest, DaemonResponse } from '../core/daemon-request.ts';
import type { DaemonRequest } from '../core/daemon-request.ts';
import type { SessionRef, SessionState } from '../core/session-state.ts';
import type { SnapshotState } from '@agent-device/kernel/snapshot';

Expand Down
2 changes: 1 addition & 1 deletion packages/daemon/src/execution/handlers/react-native.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import {
createBoundTouchExecutor,
resolveBoundTouchRuntime,
Expand All @@ -14,7 +15,6 @@ import { successText } from '@agent-device/kernel/success-text';

import type { SnapshotQualityVerdict, SnapshotState } from '@agent-device/kernel/snapshot';
import { isSparseSnapshotQualityVerdict } from '@agent-device/capture-kit/snapshot-quality-verdict';
import type { DaemonResponse } from '../../core/daemon-request.ts';
import type { SessionState } from '../../core/session-state.ts';
import {
bindInteractionSession,
Expand Down
8 changes: 6 additions & 2 deletions packages/daemon/src/execution/handlers/session-clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { publicPlatformString, type DeviceInfo } from '@agent-device/kernel/devi
import { AppError } from '@agent-device/kernel/errors';
import { PUBLIC_COMMANDS } from '@agent-device/command-registry/catalog';
import { contextFromFlags, type DaemonCommandContext } from '../../core/context.ts';
import type { DaemonRequest, DaemonResponse } from '../../core/daemon-request.ts';
import type { DaemonRequest } from '../../core/daemon-request.ts';
import type { SessionStore } from '../../core/session-store.ts';
import type {
BindDeviceRuntime,
Expand All @@ -26,7 +26,11 @@ import {
requireSessionOrExplicitSelector,
resolveCommandDevice,
} from '../../resources/session-device-resolution.ts';
import { type DaemonFailureResponse, errorResponse } from '@agent-device/kernel/contracts';
import {
type DaemonFailureResponse,
errorResponse,
type DaemonResponse,
} from '@agent-device/kernel/contracts';

type ClipboardAction = 'read' | 'write';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { DaemonPlatformServices } from '../../core/platform-services.ts';
import { PUBLIC_COMMANDS } from '@agent-device/command-registry/catalog';
import type { DeviceInfo } from '@agent-device/kernel/device';
import type { DaemonRequest, DaemonResponse } from '../../core/daemon-request.ts';
import type { DaemonRequest } from '../../core/daemon-request.ts';
import type { SessionRef, SessionState } from '../../core/session-state.ts';
import type { SessionStore } from '../../core/session-store.ts';
import { contextFromFlags } from '../../core/context.ts';
Expand Down
4 changes: 2 additions & 2 deletions packages/daemon/src/execution/handlers/snapshot-alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@agent-device/contracts/platform-runtime-operations';
import type { DeviceInfo } from '@agent-device/kernel/device';
import { contextFromFlags } from '../../core/context.ts';
import type { DaemonRequest, DaemonResponse } from '../../core/daemon-request.ts';
import type { DaemonRequest } from '../../core/daemon-request.ts';
import type { SessionRef, SessionState } from '../../core/session-state.ts';
import { SessionStore } from '../../core/session-store.ts';
import { recordSessionAction } from '../../core/session-action-recorder.ts';
Expand All @@ -26,7 +26,7 @@ import type {
} from '../../core/request-runtime-binding.ts';
import { admitRuntimeUse, type RuntimeAdmissionBindings } from '../../core/runtime-admission.ts';
import { runtimeExecutionFromContext } from '../../core/snapshot-runtime-capture-input.ts';
import type { DaemonFailureResponse } from '@agent-device/kernel/contracts';
import type { DaemonFailureResponse, DaemonResponse } from '@agent-device/kernel/contracts';

type HandleAlertCommandParams = {
req: DaemonRequest;
Expand Down
8 changes: 6 additions & 2 deletions packages/daemon/src/execution/handlers/snapshot-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
import type { BoundDeviceRuntime } from '@agent-device/contracts/platform-runtime';
import { contextFromFlags } from '../../core/context.ts';
import { SessionStore } from '../../core/session-store.ts';
import type { DaemonRequest, DaemonResponse } from '../../core/daemon-request.ts';
import type { DaemonRequest } from '../../core/daemon-request.ts';
import type { SessionRef, SessionState } from '../../core/session-state.ts';
import { recordSessionAction } from '../../core/session-action-recorder.ts';
import { expireRefFrame } from '../../core/ref-frame.ts';
Expand All @@ -44,7 +44,11 @@ import type {
} from '../../core/request-runtime-binding.ts';
import { admitRuntimeUse } from '../../core/runtime-admission.ts';
import { runtimeExecutionFromContext } from '../../core/snapshot-runtime-capture-input.ts';
import { type DaemonFailureResponse, errorResponse } from '@agent-device/kernel/contracts';
import {
type DaemonFailureResponse,
errorResponse,
type DaemonResponse,
} from '@agent-device/kernel/contracts';

type ParsedSettingsArgs = {
setting: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { SessionStore } from '../../../../core/session-store.ts';
import type { DaemonRequest, DaemonResponse } from '../../../../core/daemon-request.ts';
import type { DaemonRequest } from '../../../../core/daemon-request.ts';
import { handleFindCommands } from '../find.ts';
import { getRuntimeBindings } from '../../../__tests__/interaction-get-runtime-fixture.ts';
import type { CreateDaemonCommandSurface } from '@agent-device/contracts/daemon-command-surface';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import { test, expect, vi, beforeEach } from 'vitest';
import type { DaemonResponse } from '../../../../core/daemon-request.ts';
import { makeSessionStore } from '../../../../__tests__/support/store-factory.ts';
import { makeIosSession } from '../../../../__tests__/support/session-factories.ts';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import { beforeEach, expect, test, vi } from 'vitest';
import type { IosTargetActivation, PostGestureOutcome } from '@agent-device/kernel/snapshot';
import { iosTargetActivationDisclosure } from '@agent-device/contracts/ios-target-activation';
import { makeSessionStore } from '../../../../__tests__/support/store-factory.ts';
import { makeIosSession } from '../../../../__tests__/support/session-factories.ts';
import type { DaemonResponse } from '../../../../core/daemon-request.ts';
import { legacyDispatchCapture } from '../../../../__tests__/support/legacy-snapshot-capture-fixture.ts';
import { getRuntimeBindings } from '../../../__tests__/interaction-get-runtime-fixture.ts';
import { handleFindCommands } from '../../index.ts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import { expect } from 'vitest';
import { legacyDispatchCapture } from '../../../../__tests__/support/legacy-snapshot-capture-fixture.ts';
import { IOS_SIMULATOR } from '@agent-device/test-kit/device-fixtures';
Expand All @@ -10,7 +11,7 @@ import {
} from '../../../__tests__/interaction-get-runtime-fixture.ts';
import { makeSessionStore } from '../../../../__tests__/support/store-factory.ts';
import { makeIosSession as makeSession } from '../../../../__tests__/support/session-factories.ts';
import type { DaemonRequest, DaemonResponse } from '../../../../core/daemon-request.ts';
import type { DaemonRequest } from '../../../../core/daemon-request.ts';
import type { SessionState } from '../../../../core/session-state.ts';
import type { CreateDaemonCommandSurface } from '@agent-device/contracts/daemon-command-surface';
import type { handleFindCommands } from '../find.ts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import {
findBestMatchesByLocator,
type FindLocator,
Expand All @@ -8,7 +9,7 @@ import { SELECTOR_PIPELINE_POLICIES } from '@agent-device/selectors/selector-pip
import type { SnapshotState } from '@agent-device/kernel/snapshot';
import { isRootInteractionContainer } from '@agent-device/selectors/interaction-targeting';
import { preferOnscreenMatches } from './find-match-ranking.ts';
import type { DaemonRequest, DaemonResponse } from '../../../core/daemon-request.ts';
import type { DaemonRequest } from '../../../core/daemon-request.ts';
import type { SessionState } from '../../../core/session-state.ts';
import { buildAmbiguousMatchError } from '../../selector-match-errors.ts';
import { errorResponse } from '@agent-device/kernel/contracts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type { DaemonResponse } from '@agent-device/kernel/contracts';
import type { FindLocator } from '@agent-device/selectors';
import type { BoundSelectorCapture } from '../../selector-capture-binding.ts';
import type { SnapshotQualityVerdict, SnapshotState } from '@agent-device/kernel/snapshot';
import type { CaptureProvenance, RequestCaptureProof } from '../../../core/capture-disclosure.ts';
import { createSelectorCaptureRuntime } from '../../selector-capture-runtime.ts';
import { SessionStore } from '../../../core/session-store.ts';
import type { DaemonRequest, DaemonResponse } from '../../../core/daemon-request.ts';
import type { DaemonRequest } from '../../../core/daemon-request.ts';
import type { SessionRef, SessionState } from '../../../core/session-state.ts';
import { errorResponse } from '@agent-device/kernel/contracts';

Expand Down
Loading
Loading