@autopilot-agent/adapters 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import type { NodeChatStorage } from "./create-node-chat-storage";
3
3
  export declare const NODE_CHAT_KNOWLEDGE_SPACE_ID = "chat-knowledge-v1";
4
4
  export interface NodeChatCapabilityLoaderOptions {
5
5
  storage: NodeChatStorage;
6
+ interactiveUi?: boolean;
6
7
  visionAnalyzer?: VisionAnalyzer;
7
8
  loadKnowledge?: (input: ChatCapabilityBinding & {
8
9
  knowledgeRoot: string;
@@ -7,6 +7,7 @@ export interface NodeRuntimePortsOptions extends NodeStoreOptions {
7
7
  cwd?: string;
8
8
  env?: NodeJS.ProcessEnv;
9
9
  userSettingsPath?: string;
10
+ trustRoot?: string;
10
11
  sandboxTempRoot?: string;
11
12
  }
12
13
  export declare function createNodeRuntimePorts(options: NodeRuntimePortsOptions): RuntimePorts;
@@ -0,0 +1,2 @@
1
+ export declare function getNodeFileMutationLockRoot(): string;
2
+ export declare function withNodeFileMutationLocks<T>(canonicalTargets: readonly string[], operation: () => Promise<T>): Promise<T>;
@@ -1,9 +1,18 @@
1
+ export interface FileOperationDiagnostic {
2
+ phase: "lock" | "temporary_write" | "rename" | "cleanup";
3
+ osCode?: string;
4
+ lockWaitMs?: number;
5
+ cleanupFailed?: boolean;
6
+ }
7
+ export declare function getFileOperationDiagnostic(error: unknown): FileOperationDiagnostic | undefined;
1
8
  export interface JsonlCorruptionDiagnostic {
2
9
  code: "DURABLE_JSONL_CORRUPTED";
3
10
  line: number;
4
11
  reason: "INVALID_JSON";
5
12
  }
6
- export declare function withFileLock<T>(filePath: string, operation: () => T | Promise<T>): Promise<T>;
13
+ export declare function withFileLock<T>(filePath: string, operation: () => T | Promise<T>, options?: {
14
+ requireExitedOwner?: boolean;
15
+ }): Promise<T>;
7
16
  export declare function withAsyncFileLock<T>(filePath: string, operation: () => T | Promise<T>): Promise<T>;
8
17
  export declare function ensureParentDirectory(filePath: string): void;
9
18
  export declare function atomicReplace(filePath: string, content: string): void;
@@ -0,0 +1,2 @@
1
+ export declare const LOCAL_HUMAN_PRINCIPAL_ID = "web-local-user";
2
+ export declare function createNodeStateRootId(stateRoot: string): string;
@@ -0,0 +1,7 @@
1
+ import type { HostMutationProtection } from "@autopilot-agent/core";
2
+ export declare function createNodeHostMutationProtection(options: {
3
+ stateRoot: string;
4
+ workspaceRoot?: string;
5
+ trustRoot?: string;
6
+ userSettingsPath?: string;
7
+ }): HostMutationProtection;
@@ -15,10 +15,19 @@ export interface NodeStateRecoveryDiagnostic {
15
15
  backupPath?: string;
16
16
  reasonCode: NodeStateErrorCode | NodeChatErrorCode | AgentErrorCode;
17
17
  }
18
+ export interface NodeStorageDiagnostic {
19
+ operation: "session_save";
20
+ target: "session";
21
+ phase: "prepare" | "identity" | "lock" | "temporary_write" | "rename" | "cleanup";
22
+ osCode?: string;
23
+ lockWaitMs?: number;
24
+ cleanupFailed?: boolean;
25
+ }
18
26
  export declare class NodeStateError extends Error {
19
27
  #private;
20
28
  readonly code: NodeStateErrorCode;
21
- constructor(code: NodeStateErrorCode, recovery?: NodeStateRecoveryDiagnostic);
29
+ constructor(code: NodeStateErrorCode, recovery?: NodeStateRecoveryDiagnostic, storage?: NodeStorageDiagnostic);
30
+ getStorageDiagnostic(): NodeStorageDiagnostic | undefined;
22
31
  getRecoveryDiagnostic(): NodeStateRecoveryDiagnostic | undefined;
23
32
  }
24
33
  export declare class NodeChatError extends Error {
@@ -26,5 +35,5 @@ export declare class NodeChatError extends Error {
26
35
  constructor(code: NodeChatErrorCode);
27
36
  }
28
37
  export declare function createNodeIdentityError(code: NodeIdentityErrorCode): AgentRuntimeError;
29
- export declare function toNodeBoundaryError(error: unknown, fallback: NodeStateErrorCode | NodeChatErrorCode): NodeStateError | NodeChatError | AgentRuntimeError;
38
+ export declare function toNodeBoundaryError(error: unknown, fallback: NodeStateErrorCode | NodeChatErrorCode, storage?: NodeStorageDiagnostic): NodeStateError | NodeChatError | AgentRuntimeError;
30
39
  export {};
@@ -0,0 +1,2 @@
1
+ import { type SandboxPort } from "@autopilot-agent/core";
2
+ export declare function createNodeHostExecutionSandboxPort(): SandboxPort;
@@ -2,8 +2,8 @@ import { type SandboxPort, type SandboxPolicy } from "@autopilot-agent/core";
2
2
  import { type SrtRuntimeSurface } from "./srt-module";
3
3
  export interface NodeSandboxPortOptions {
4
4
  workspaceRoot: string;
5
+ stateRoot?: string;
5
6
  tempRoot?: string;
6
- windowsSrtWinExe?: string;
7
7
  loadModule?: () => Promise<SrtRuntimeSurface>;
8
8
  }
9
9
  export declare function serializePosixCommand(program: string, args: readonly string[], tempRoot?: string): string;
@@ -0,0 +1,12 @@
1
+ import { type ExternalPermissionSnapshot } from "@autopilot-agent/core";
2
+ export interface CreateNodeExternalPermissionProjectorOptions {
3
+ homeDirectory?: string;
4
+ }
5
+ export declare function createNodeExternalPermissionProjector(options?: CreateNodeExternalPermissionProjectorOptions): {
6
+ project(input: {
7
+ workspaceRoot: string;
8
+ rule: string;
9
+ action: "add" | "remove";
10
+ }): Promise<void>;
11
+ read(workspaceRoot: string): Promise<ExternalPermissionSnapshot>;
12
+ };
@@ -28,5 +28,6 @@ export interface NodeUserSettingsLoader {
28
28
  }
29
29
  export declare function resolveNodeUserSettingsPath(homeDirectory?: string | undefined, pathApi?: Pick<typeof path, "join" | "isAbsolute">): string;
30
30
  export declare function resolveNodeSettingsPaths(workspaceRoot: string, homeDirectory?: string, pathApi?: NodePathApi): NodeSettingsPaths;
31
+ export declare function isSafeSettingsFile(filePath: string): boolean;
31
32
  export declare function createNodeSettingsLoader(options?: CreateNodeSettingsLoaderOptions): NodeSettingsLoader & NodeUserSettingsLoader;
32
33
  export {};
@@ -52,6 +52,11 @@ export interface WebSearchSettingsCategoryInput {
52
52
  model: string;
53
53
  apiKey?: string;
54
54
  }
55
+ export interface UserSettingsDiagnostic {
56
+ code: string;
57
+ field?: string;
58
+ scope: string;
59
+ }
55
60
  export interface UserSettingsStatus {
56
61
  revision: string;
57
62
  main: Omit<MainSettingsCategoryInput, "apiKey"> & {
@@ -64,6 +69,7 @@ export interface UserSettingsStatus {
64
69
  rag: Record<RagConnectionRole, RagSettingsCategoryConnectionInput & {
65
70
  configured: boolean;
66
71
  }>;
72
+ diagnostics: UserSettingsDiagnostic[];
67
73
  }
68
74
  export interface MainSettingsCategoryUpdate {
69
75
  main: MainSettingsCategoryInput;
@@ -79,7 +85,8 @@ export interface MainModelCatalogResult {
79
85
  }
80
86
  export declare class NodeUserSettingsError extends Error {
81
87
  readonly code: "SETTINGS_INVALID" | "SETTINGS_CHANGED" | "SETTINGS_INPUT_INVALID" | "SETTINGS_KEY_REQUIRED" | "SETTINGS_MIGRATION_CONFLICT";
82
- constructor(code: "SETTINGS_INVALID" | "SETTINGS_CHANGED" | "SETTINGS_INPUT_INVALID" | "SETTINGS_KEY_REQUIRED" | "SETTINGS_MIGRATION_CONFLICT");
88
+ readonly diagnostic?: UserSettingsDiagnostic | undefined;
89
+ constructor(code: "SETTINGS_INVALID" | "SETTINGS_CHANGED" | "SETTINGS_INPUT_INVALID" | "SETTINGS_KEY_REQUIRED" | "SETTINGS_MIGRATION_CONFLICT", diagnostic?: UserSettingsDiagnostic | undefined);
83
90
  }
84
91
  export declare function createNodeUserSettingsService(options?: {
85
92
  homeDirectory?: string;
@@ -1,6 +1,6 @@
1
1
  import { type NodeStateSchemaDiagnostic } from "./state-schema-manager";
2
2
  import { type JsonlCorruptionDiagnostic } from "./file-utils";
3
- export declare const NODE_STATE_SCHEMA_VERSION = 6;
3
+ export declare const NODE_STATE_SCHEMA_VERSION = 8;
4
4
  export declare const NODE_WORKSPACE_ID_VERSION = 1;
5
5
  export interface NodeStateCorruptionDiagnostic extends JsonlCorruptionDiagnostic {
6
6
  file: string;
@@ -0,0 +1,2 @@
1
+ export declare function upgradeSessionIdentity(root: string, allowLegacyWork: boolean): void;
2
+ export declare function upgradeThreadCreationSources(root: string): void;
@@ -0,0 +1,2 @@
1
+ import { type SessionImageStore } from "@autopilot-agent/core";
2
+ export declare function createNodeSessionImageStore(workspaceRoot: string): SessionImageStore;
@@ -0,0 +1,2 @@
1
+ import type { ThreadStore } from "@autopilot-agent/core";
2
+ export declare function createNodeThreadStore(stateRoot: string): ThreadStore;
@@ -0,0 +1 @@
1
+ export declare function readSessionDirectoryRecord(filePath: string, id: string): Promise<import("@autopilot-agent/core").Session>;
@@ -0,0 +1,5 @@
1
+ import type { ThreadHandoffWriter } from "@autopilot-agent/core";
2
+ export interface CreateNodeThreadHandoffWriterOptions {
3
+ workspaceRoot: string;
4
+ }
5
+ export declare function createNodeThreadHandoffWriter(options: CreateNodeThreadHandoffWriterOptions): ThreadHandoffWriter;
@@ -0,0 +1,53 @@
1
+ import { type ThreadControlIntent } from "@autopilot-agent/core";
2
+ import type { AgentRuntime, RuntimePorts, ThreadActor, ThreadDeliveryService, ThreadHandoffRef, ThreadMessage, ThreadReconcileResult } from "@autopilot-agent/core";
3
+ export interface NodeThreadRunnerPrompt {
4
+ content: string;
5
+ messageId: string;
6
+ from: ThreadActor;
7
+ handoff?: ThreadHandoffRef;
8
+ handoffDisplay?: ThreadMessage["handoffDisplay"];
9
+ }
10
+ export interface NodeThreadRunnerOptions {
11
+ delivery: ThreadDeliveryService;
12
+ runtime: AgentRuntime;
13
+ ports: RuntimePorts;
14
+ pollIntervalMs?: number;
15
+ heartbeatMs?: number;
16
+ staleMs?: number;
17
+ reconcileEveryMs?: number;
18
+ onError?: (error: unknown, continuation?: Pick<ThreadControlIntent, "threadId" | "expectedTurnId" | "controlId" | "approvalId" | "requestId" | "failureDiagnostic">) => void;
19
+ onTurnStarted?: (input: {
20
+ threadId: string;
21
+ turnId: string;
22
+ prompt: NodeThreadRunnerPrompt;
23
+ }) => Promise<void> | void;
24
+ onTurnSettled?: (input: {
25
+ threadId: string;
26
+ turnId: string;
27
+ }) => Promise<void> | void;
28
+ }
29
+ export interface NodeThreadRunnerStopReport {
30
+ stopped: boolean;
31
+ cancelledTurnIds: string[];
32
+ unconfirmedTurnIds: string[];
33
+ releasedMessageIds: string[];
34
+ waitingTurnIds?: string[];
35
+ pendingMessageIds?: string[];
36
+ recoverableTurnIds?: string[];
37
+ }
38
+ export interface NodeThreadRunner {
39
+ start(): Promise<void>;
40
+ stop(): Promise<NodeThreadRunnerStopReport>;
41
+ kick(): void;
42
+ isRunning(): boolean;
43
+ reconcile(): Promise<ThreadReconcileResult>;
44
+ registerExecution(input: {
45
+ threadId: string;
46
+ turnId: string;
47
+ cancel(): void;
48
+ }): {
49
+ activate(): void;
50
+ release(): void;
51
+ };
52
+ }
53
+ export declare function createNodeThreadRunner(options: NodeThreadRunnerOptions): NodeThreadRunner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autopilot-agent/adapters",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@anthropic-ai/sandbox-runtime": "0.0.78",
45
- "@autopilot-agent/core": "0.1.0",
45
+ "@autopilot-agent/core": "0.3.0",
46
46
  "js-yaml": "4.3.0",
47
47
  "linkedom": "0.18.12"
48
48
  },
@@ -1,9 +0,0 @@
1
- export declare function resolveWindowsSandboxRunner(vendored: string, explicit?: string): string;
2
- export declare function resolveWindowsSandboxCommand(program: string, args: readonly string[]): {
3
- exe: string;
4
- args: string[];
5
- };
6
- export declare function finalizeWindowsSandboxArgv(argv: readonly string[], target: {
7
- exe: string;
8
- args: readonly string[];
9
- }, tempRoot?: string): string[];
@@ -1,8 +0,0 @@
1
- import { type SandboxCapabilityReport } from "@autopilot-agent/core";
2
- import { type SrtRuntimeSurface } from "./srt-module";
3
- export interface WindowsSandboxSetupOptions {
4
- srtWinExe?: string;
5
- loadModule?: () => Promise<SrtRuntimeSurface>;
6
- }
7
- export declare function readWindowsSandboxCapability(options?: WindowsSandboxSetupOptions): Promise<SandboxCapabilityReport>;
8
- export declare function runWindowsSandboxSetup(options?: WindowsSandboxSetupOptions): Promise<SandboxCapabilityReport>;