@autopilot-agent/adapters 0.2.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;
@@ -1,3 +1,10 @@
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;
@@ -0,0 +1,2 @@
1
+ export declare const LOCAL_HUMAN_PRINCIPAL_ID = "web-local-user";
2
+ export declare function createNodeStateRootId(stateRoot: string): string;
@@ -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 {};
@@ -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.2.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.2.0",
45
+ "@autopilot-agent/core": "0.3.0",
46
46
  "js-yaml": "4.3.0",
47
47
  "linkedom": "0.18.12"
48
48
  },