@autopilot-agent/core 0.2.0 → 0.4.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.
Files changed (99) hide show
  1. package/README.md +10 -4
  2. package/dist/experimental/index.js +159 -59
  3. package/dist/experimental/index.mjs +159 -59
  4. package/dist/failure.d.ts +3 -0
  5. package/dist/failure.js +1 -0
  6. package/dist/failure.mjs +1 -0
  7. package/dist/index.d.ts +30 -5
  8. package/dist/index.js +346 -214
  9. package/dist/index.mjs +346 -214
  10. package/dist/internal/agent-runtime.d.ts +87 -2
  11. package/dist/internal/kernel/model-sampler.d.ts +5 -0
  12. package/dist/internal/kernel/run-context.d.ts +6 -0
  13. package/dist/internal/kernel/session-images.d.ts +21 -0
  14. package/dist/internal/kernel/turn-usage.d.ts +14 -0
  15. package/dist/internal/lib/document-parser.js +2 -2
  16. package/dist/internal/lib/image-normalization.d.ts +16 -0
  17. package/dist/internal/lib/llm.d.ts +7 -1
  18. package/dist/internal/lib/llm.js +3 -3
  19. package/dist/internal/lib/pdf-processor.js +1 -1
  20. package/dist/internal/tools/builtins/browser-tool.d.ts +13 -0
  21. package/dist/internal/tools/builtins/open-preview-tool.d.ts +5 -1
  22. package/dist/internal/tools/builtins/read-output-budget.d.ts +5 -0
  23. package/dist/internal/tools/builtins/render-ui-tool.d.ts +11 -0
  24. package/dist/internal/tools/builtins/static-preview.d.ts +15 -0
  25. package/dist/internal/tools/builtins/thread-tools.d.ts +125 -0
  26. package/dist/internal/tools/builtins/vision-analyze-tool.d.ts +1 -0
  27. package/dist/internal/tools/mcp-images.d.ts +6 -0
  28. package/dist/internal/tools/mcp-runtime.d.ts +4 -0
  29. package/dist/internal/tools/permissions/command-policy.d.ts +2 -0
  30. package/dist/internal/tools/policy-engine.d.ts +1 -0
  31. package/dist/internal/tools/process-utils.d.ts +1 -0
  32. package/dist/internal/tools/thread-observation-display.d.ts +2 -0
  33. package/dist/internal/tools/types.d.ts +21 -0
  34. package/dist/internal/types/agent-message.d.ts +12 -2
  35. package/dist/internal/types/index.d.ts +1 -1
  36. package/dist/runtime/adapters/memory/memory-lease-store.d.ts +6 -0
  37. package/dist/runtime/adapters/memory/memory-session-store.d.ts +14 -0
  38. package/dist/runtime/adapters/memory/memory-thread-store.d.ts +24 -0
  39. package/dist/runtime/adapters/memory/memory-transcript-store.d.ts +9 -0
  40. package/dist/runtime/application/approval-service.d.ts +5 -0
  41. package/dist/runtime/application/input-inbox-service.d.ts +1 -1
  42. package/dist/runtime/application/runtime-facts.d.ts +54 -0
  43. package/dist/runtime/application/session-service.d.ts +9 -0
  44. package/dist/runtime/application/thread-delivery-service.d.ts +97 -0
  45. package/dist/runtime/application/thread-execution-host.d.ts +7 -0
  46. package/dist/runtime/application/thread-service.d.ts +1027 -0
  47. package/dist/runtime/application/thread-task.d.ts +11 -0
  48. package/dist/runtime/application/thread-tool-binding.d.ts +218 -0
  49. package/dist/runtime/application/turn/turn-capability-ceiling.d.ts +2 -0
  50. package/dist/runtime/application/turn/turn-compaction-coordinator.d.ts +2 -1
  51. package/dist/runtime/application/turn/turn-event-recorder.d.ts +1 -0
  52. package/dist/runtime/application/turn/turn-execution-view.d.ts +43 -0
  53. package/dist/runtime/application/turn/turn-recovery-service.d.ts +14 -0
  54. package/dist/runtime/application/turn-service.d.ts +28 -0
  55. package/dist/runtime/application/user-question-service.d.ts +1 -0
  56. package/dist/runtime/bootstrap/runtime-bootstrap-service.d.ts +2 -0
  57. package/dist/runtime/domain/frozen-run-config.d.ts +2 -0
  58. package/dist/runtime/domain/index.d.ts +16 -1
  59. package/dist/runtime/domain/input-inbox.d.ts +16 -0
  60. package/dist/runtime/domain/model-ref.d.ts +1 -1
  61. package/dist/runtime/domain/session-presentation.d.ts +9 -0
  62. package/dist/runtime/domain/thread-collaboration.d.ts +179 -0
  63. package/dist/runtime/domain/turn.d.ts +8 -0
  64. package/dist/runtime/ports/index.d.ts +6 -0
  65. package/dist/runtime/ports/lease-store.d.ts +4 -0
  66. package/dist/runtime/ports/session-image-store.d.ts +26 -0
  67. package/dist/runtime/ports/session-store.d.ts +16 -0
  68. package/dist/runtime/ports/thread-handoff.d.ts +14 -0
  69. package/dist/runtime/ports/thread-store.d.ts +15 -0
  70. package/dist/runtime/ports/transcript-store.d.ts +8 -0
  71. package/dist/runtime/protocol/browser-capability.d.ts +81 -0
  72. package/dist/runtime/protocol/browser-operation.d.ts +89 -0
  73. package/dist/runtime/protocol/chat-capability.d.ts +1 -0
  74. package/dist/runtime/protocol/error-code.d.ts +1 -1
  75. package/dist/runtime/protocol/frozen-run-config-view.d.ts +2 -1
  76. package/dist/runtime/protocol/index.d.ts +2 -1
  77. package/dist/runtime/protocol/recoverable-turn-view.d.ts +3 -0
  78. package/dist/runtime/protocol/run-config.d.ts +13 -0
  79. package/dist/runtime/protocol/threads-capability.d.ts +14 -0
  80. package/dist/runtime/protocol/web-capability.d.ts +5 -1
  81. package/dist/runtime/protocol/work-preview-capability.d.ts +1 -0
  82. package/dist/runtime/provider/anthropic-messages-adapter.d.ts +4 -2
  83. package/dist/runtime/provider/api-protocol.d.ts +16 -2
  84. package/dist/runtime/provider/compatibility-presets.d.ts +19 -0
  85. package/dist/runtime/provider/frozen-provider-config.d.ts +4 -1
  86. package/dist/runtime/provider/index.d.ts +4 -2
  87. package/dist/runtime/provider/model-capability-catalog.d.ts +7 -0
  88. package/dist/runtime/provider/model-sample-resolver.d.ts +3 -2
  89. package/dist/runtime/provider/openai-chat-completions-adapter.d.ts +5 -1
  90. package/dist/runtime/provider/openai-responses-adapter.d.ts +22 -0
  91. package/dist/runtime/provider/provider-failure-guidance.d.ts +4 -0
  92. package/dist/runtime/provider/provider-failure-normalization.d.ts +9 -0
  93. package/dist/runtime/public/agent-runtime.d.ts +5 -0
  94. package/dist/ui/catalog.d.ts +870 -0
  95. package/dist/ui/document.d.ts +580 -0
  96. package/dist/ui/index.d.ts +4 -0
  97. package/dist/ui/index.js +1 -0
  98. package/dist/ui/index.mjs +1 -0
  99. package/package.json +17 -3
@@ -0,0 +1,179 @@
1
+ export type ThreadActor = {
2
+ kind: "human";
3
+ principalId: string;
4
+ } | {
5
+ kind: "thread";
6
+ threadId: string;
7
+ turnId: string;
8
+ };
9
+ export interface ThreadMember {
10
+ executionHost?: string;
11
+ threadId: string;
12
+ groupId: string;
13
+ parentThreadId: string | null;
14
+ title?: string;
15
+ roleLabel?: string;
16
+ createdAt: number;
17
+ }
18
+ export interface ThreadGroup {
19
+ groupId: string;
20
+ workspaceId: string;
21
+ projectId: string;
22
+ rootThreadId: string;
23
+ enabled: boolean;
24
+ createdAt: number;
25
+ createdBy: ThreadActor;
26
+ ownerPrincipalId?: string;
27
+ allowedTools: readonly string[];
28
+ }
29
+ export interface ThreadReceipt {
30
+ actorKey: string;
31
+ operation: string;
32
+ requestId: string;
33
+ payloadDigest: string;
34
+ result: unknown;
35
+ }
36
+ export interface ThreadCreateIntent {
37
+ requestId: string;
38
+ actorKey: string;
39
+ from: ThreadActor;
40
+ payloadDigest: string;
41
+ threadId: string;
42
+ parentThreadId: string;
43
+ title?: string;
44
+ roleLabel?: string;
45
+ modelRef?: import("./model-ref").ModelRef;
46
+ reasoningEffort?: import("./model-ref").ReasoningEffort;
47
+ permissionMode?: import("./session-run-config").SessionRunConfig["permissionMode"];
48
+ executionHost?: string;
49
+ status: "creating" | "created" | "recovery_required";
50
+ }
51
+ export type ThreadDeliveryReason = "target_running" | "target_waiting_approval" | "target_waiting_user_input" | "target_interrupted" | "turn_failed" | "turn_interrupted" | "turn_not_running" | "start_failed" | "host_offline" | "recovery_required";
52
+ export interface ThreadDelivery {
53
+ executionHost?: string;
54
+ messageId: string;
55
+ threadId: string;
56
+ deliverySeq: number;
57
+ mode: "notify" | "run" | "steer";
58
+ status: "pending" | "claimed" | "delivered" | "blocked" | "failed" | "cancelled";
59
+ attempts: number;
60
+ updatedAt: number;
61
+ reservedTurnId?: string;
62
+ inputId?: string;
63
+ turnId?: string;
64
+ ownerId?: string;
65
+ ownerHeartbeatAt?: number;
66
+ reason?: ThreadDeliveryReason;
67
+ }
68
+ export interface ThreadControlIntent {
69
+ controlId: string;
70
+ kind: "interrupt" | "resume" | "continue_interaction";
71
+ approvalId?: string;
72
+ requestId?: string;
73
+ failureCode?: "BOUNDARY_CHANGED" | "CONTINUE_FAILED";
74
+ failureDiagnostic?: {
75
+ stage: "read_decision" | "continue" | "after_started";
76
+ category: "storage" | "runtime" | "os" | "unknown";
77
+ code: string;
78
+ started: boolean;
79
+ filePhase?: "lock" | "temporary_write" | "rename" | "cleanup";
80
+ };
81
+ checkpointDigest?: string;
82
+ pauseSeq?: number;
83
+ threadId: string;
84
+ expectedTurnId: string;
85
+ status: "pending" | "applied" | "rejected" | "claimed" | "executing" | "completed" | "failed";
86
+ createdAt: number;
87
+ updatedAt: number;
88
+ ownerId?: string;
89
+ }
90
+ export type ThreadProgressKind = "progress" | "milestone" | "blocked" | "completed" | "failed";
91
+ export interface ThreadProgressEntry {
92
+ taskId?: string;
93
+ turnId?: string;
94
+ taskProgressSeq?: number;
95
+ threadId: string;
96
+ progressSeq: number;
97
+ kind: ThreadProgressKind;
98
+ summary: string;
99
+ createdAt: number;
100
+ evidence?: {
101
+ turnId?: string;
102
+ messageId?: string;
103
+ };
104
+ }
105
+ export interface ThreadControl {
106
+ group: ThreadGroup;
107
+ revision: number;
108
+ members: ThreadMember[];
109
+ receipts: ThreadReceipt[];
110
+ creates: ThreadCreateIntent[];
111
+ sharedState: Record<string, unknown>;
112
+ stateRevision: number;
113
+ stateUpdatedAt: number;
114
+ stateUpdatedBy: ThreadActor;
115
+ nextGroupSeq: number;
116
+ eventIntents: ThreadEvent[];
117
+ nextDeliverySeq: Record<string, number>;
118
+ messageIntents: Array<{
119
+ actorKey: string;
120
+ payloadDigest: string;
121
+ message: ThreadMessage;
122
+ committed: boolean;
123
+ }>;
124
+ deliveries: ThreadDelivery[];
125
+ controls: ThreadControlIntent[];
126
+ progress?: ThreadProgressEntry[];
127
+ nextProgressSeq?: Record<string, number>;
128
+ }
129
+ export interface ThreadHandoffInput {
130
+ title: string;
131
+ markdown: string;
132
+ }
133
+ export interface ThreadHandoffRef {
134
+ handoffId: string;
135
+ relativePath: string;
136
+ sha256: string;
137
+ }
138
+ export interface ThreadMessage {
139
+ purpose?: {
140
+ kind: "reporting_agreement";
141
+ taskId: string;
142
+ };
143
+ messageId: string;
144
+ requestId: string;
145
+ groupId: string;
146
+ from: ThreadActor;
147
+ toThreadId: string;
148
+ mode: "notify" | "run" | "steer";
149
+ content: string;
150
+ replyTo?: string;
151
+ expectedTurnId?: string;
152
+ handoff?: ThreadHandoffRef;
153
+ handoffDisplay?: {
154
+ title: string;
155
+ instruction: string;
156
+ summary: string;
157
+ };
158
+ createdAt: number;
159
+ deliverySeq: number;
160
+ deliveryStatus: "accepted" | "pending" | "claimed" | "delivered" | "blocked" | "cancelled" | "failed";
161
+ inputId?: string;
162
+ turnId?: string;
163
+ }
164
+ export type ThreadEventActor = ThreadActor | {
165
+ kind: "host";
166
+ hostId: string;
167
+ };
168
+ export interface ThreadEvent {
169
+ groupId: string;
170
+ groupSeq: number;
171
+ actor: ThreadEventActor;
172
+ kind: "member_created" | "group_enabled" | "group_disabled" | "message_accepted" | "message_delivered" | "message_blocked" | "shared_state_changed" | "turn_attention" | "turn_terminal" | "host_offline" | "recovery_required";
173
+ createdAt: number;
174
+ threadId?: string;
175
+ messageId?: string;
176
+ turnId?: string;
177
+ stateRevision?: number;
178
+ }
179
+ export declare function sanitizeContinuationFailure(value: ThreadControlIntent["failureDiagnostic"]): ThreadControlIntent["failureDiagnostic"];
@@ -6,6 +6,14 @@ export interface Turn {
6
6
  sessionId: string;
7
7
  status: TurnStatus;
8
8
  frozenRunConfig: FrozenRunConfig;
9
+ permissionSelectionRevision?: string;
10
+ permissionRevisions?: Array<{
11
+ permissionMode: NonNullable<FrozenRunConfig["permissionMode"]>;
12
+ selectionRevision: string;
13
+ changedAt: number;
14
+ leaseId: string;
15
+ approvalCutoffSeq: number;
16
+ }>;
9
17
  frozenProviderConfig?: FrozenProviderConfig;
10
18
  todoChainId?: string;
11
19
  startedAt: number;
@@ -1,3 +1,4 @@
1
+ import type { ThreadStore } from "./thread-store";
1
2
  import type { SessionStore } from "./session-store";
2
3
  import type { CheckpointStore } from "./checkpoint-store";
3
4
  import type { TranscriptStore } from "./transcript-store";
@@ -14,12 +15,15 @@ import type { JobStore } from "./job-store";
14
15
  import type { JobOwnerProbe } from "./job-owner-probe";
15
16
  import type { FileMutationStore } from "./file-mutation-store";
16
17
  import type { SessionResourceStore } from "./session-resource-store";
18
+ import type { SessionImageStore } from "./session-image-store";
19
+ export type { SessionImageStore, SessionImageRef } from "./session-image-store";
17
20
  import type { UserQuestionStore } from "./user-question-store";
18
21
  import type { SandboxPort } from "./sandbox-port";
19
22
  import type { ExternalPermissionProjector } from "./external-permission-projector";
20
23
  import type { HostMutationProtection } from "./host-mutation-protection";
21
24
  export type { HostMutationProtection, ProtectedMutationTarget } from "./host-mutation-protection";
22
25
  export type { SessionStore, CheckpointStore, TranscriptStore, CredentialStore, ProjectStore, EventSink, Clock, WorkspaceAdapter, WorkspaceInfo, TurnStore, ApprovalStore, InputInbox, LeaseStore, JobStore, JobOwnerProbe, FileMutationStore, SessionResourceStore, UserQuestionStore, ExternalPermissionProjector };
26
+ export type { SessionDirectoryPage, SessionDirectoryQuery, SessionDirectoryEntry } from "./session-store";
23
27
  export type { ExternalPermissionSnapshot } from "./external-permission-projector";
24
28
  export type { JobStoreWriteCondition } from "./job-store";
25
29
  export type { GetUserQuestionInput, SaveUserQuestionAnswerInput, SaveUserQuestionAnswerResult } from "./user-question-store";
@@ -28,6 +32,7 @@ export { SandboxPortError, createUnavailableSandboxPort } from "./sandbox-port";
28
32
  export interface RuntimePorts {
29
33
  hostMutationProtection?: HostMutationProtection;
30
34
  sessionStore: SessionStore;
35
+ threadStore: ThreadStore;
31
36
  checkpointStore: CheckpointStore;
32
37
  transcriptStore: TranscriptStore;
33
38
  credentialStore: CredentialStore;
@@ -43,6 +48,7 @@ export interface RuntimePorts {
43
48
  jobOwnerProbe: JobOwnerProbe;
44
49
  fileMutationStore: FileMutationStore;
45
50
  sessionResourceStore: SessionResourceStore;
51
+ sessionImageStore?: SessionImageStore;
46
52
  userQuestionStore: UserQuestionStore;
47
53
  sandboxPort: SandboxPort;
48
54
  externalPermissionProjector?: ExternalPermissionProjector;
@@ -1,5 +1,9 @@
1
1
  import type { AgentLease } from "../../internal/agent-runtime";
2
2
  export interface LeaseStore {
3
+ readCurrent?(sessionId: string): Promise<{
4
+ turnId: string;
5
+ lease: AgentLease;
6
+ } | null>;
3
7
  acquire(input: {
4
8
  sessionId: string;
5
9
  turnId: string;
@@ -0,0 +1,26 @@
1
+ export interface SessionImageRef {
2
+ id: string;
3
+ name: string;
4
+ mimeType: string;
5
+ relativePath: string;
6
+ sha256: string;
7
+ width: number;
8
+ height: number;
9
+ bytes: number;
10
+ gifFirstFrame: boolean;
11
+ }
12
+ export interface SessionImageStore {
13
+ put(input: {
14
+ sessionId: string;
15
+ name: string;
16
+ mimeType?: string;
17
+ bytes: Uint8Array;
18
+ }): Promise<SessionImageRef>;
19
+ read(input: {
20
+ sessionId: string;
21
+ id: string;
22
+ }): Promise<{
23
+ image: SessionImageRef;
24
+ bytes: Uint8Array;
25
+ }>;
26
+ }
@@ -1,7 +1,23 @@
1
1
  import type { Session } from "../domain";
2
+ export interface SessionDirectoryPage {
3
+ items: Array<{
4
+ id: string;
5
+ title?: string;
6
+ }>;
7
+ nextCursor?: string;
8
+ }
9
+ export interface SessionDirectoryQuery {
10
+ projectId: string;
11
+ limit: number;
12
+ cursor?: string;
13
+ }
14
+ export type SessionDirectoryEntry = Pick<Session, "id" | "title" | "productMode" | "projectId" | "chatRetrievalMode" | "status" | "activeTurnId" | "createdAt" | "updatedAt">;
2
15
  export interface SessionStore {
3
16
  get(id: string): Promise<Session | null>;
4
17
  list(): Promise<Session[]>;
18
+ listDirectoryPage?(query: SessionDirectoryQuery): Promise<SessionDirectoryPage>;
19
+ getDirectoryEntry?(id: string): Promise<SessionDirectoryEntry | null>;
20
+ createIfAbsent(session: Session): Promise<boolean>;
5
21
  save(session: Session): Promise<void>;
6
22
  delete(id: string): Promise<boolean>;
7
23
  }
@@ -0,0 +1,14 @@
1
+ export interface ThreadHandoffDocumentInput {
2
+ workspaceId: string;
3
+ handoffId: string;
4
+ title: string;
5
+ markdown: string;
6
+ }
7
+ export interface ThreadHandoffDocument {
8
+ handoffId: string;
9
+ relativePath: string;
10
+ sha256: string;
11
+ }
12
+ export interface ThreadHandoffWriter {
13
+ write(input: ThreadHandoffDocumentInput): Promise<ThreadHandoffDocument>;
14
+ }
@@ -0,0 +1,15 @@
1
+ import type { ThreadControl, ThreadMessage, ThreadEvent } from "../domain/thread-collaboration";
2
+ export interface ThreadStore {
3
+ verifyRequest(id: string, groupId: string, payloadDigest: string): Promise<void>;
4
+ reserveRequest(id: string, groupId: string, payloadDigest: string): Promise<void>;
5
+ withSessionLock<T>(threadId: string, operation: () => Promise<T>): Promise<T>;
6
+ hasMembership(threadId: string): Promise<boolean>;
7
+ readControl(groupId: string): Promise<ThreadControl | null>;
8
+ writeEvent(event: ThreadEvent): Promise<void>;
9
+ readEvent(groupId: string, seq: number): Promise<ThreadEvent | null>;
10
+ writeMessage(message: ThreadMessage): Promise<void>;
11
+ readMessage(groupId: string, threadId: string, seq: number): Promise<ThreadMessage | null>;
12
+ compareAndSetControl(groupId: string, expectedRevision: number | null, value: ThreadControl): Promise<boolean>;
13
+ listGroups(): Promise<string[]>;
14
+ subscribe?(groupId: string, listener: () => void): () => void;
15
+ }
@@ -2,5 +2,13 @@ import type { AgentEventEnvelope } from "../protocol";
2
2
  export interface TranscriptStore {
3
3
  append(sessionId: string, envelope: AgentEventEnvelope): Promise<void>;
4
4
  getEvents(sessionId: string): Promise<AgentEventEnvelope[]>;
5
+ readPage(sessionId: string, options: {
6
+ cursor?: string;
7
+ limit: number;
8
+ }): Promise<{
9
+ items: AgentEventEnvelope[];
10
+ nextCursor?: string;
11
+ cursor?: string;
12
+ }>;
5
13
  deleteBySession(sessionId: string): Promise<void>;
6
14
  }
@@ -0,0 +1,81 @@
1
+ export type BrowserOperation = {
2
+ type: "list";
3
+ } | {
4
+ type: "downloads";
5
+ pageId: string;
6
+ revision: number;
7
+ } | {
8
+ type: "cancel-download";
9
+ pageId: string;
10
+ revision: number;
11
+ id: string;
12
+ } | {
13
+ type: "wait";
14
+ pageId: string;
15
+ revision: number;
16
+ condition: "load";
17
+ timeout: number;
18
+ } | {
19
+ type: "open";
20
+ url: string;
21
+ } | {
22
+ type: "document";
23
+ path: string;
24
+ } | {
25
+ type: "navigate";
26
+ pageId: string;
27
+ url: string;
28
+ revision: number;
29
+ } | {
30
+ type: "select" | "close" | "release" | "back" | "forward" | "reload" | "snapshot" | "screenshot";
31
+ pageId: string;
32
+ revision: number;
33
+ } | {
34
+ type: "click";
35
+ pageId: string;
36
+ revision: number;
37
+ ref: string;
38
+ } | {
39
+ type: "fill" | "select-option";
40
+ pageId: string;
41
+ revision: number;
42
+ ref: string;
43
+ value: string;
44
+ } | {
45
+ type: "press";
46
+ pageId: string;
47
+ revision: number;
48
+ key: string;
49
+ } | {
50
+ type: "scroll";
51
+ pageId: string;
52
+ revision: number;
53
+ direction: "up" | "down" | "left" | "right";
54
+ amount: number;
55
+ } | {
56
+ type: "check";
57
+ pageId: string;
58
+ revision: number;
59
+ ref: string;
60
+ checked: boolean;
61
+ } | {
62
+ type: "dialog";
63
+ pageId: string;
64
+ revision: number;
65
+ accept: boolean;
66
+ text: string;
67
+ };
68
+ export interface BrowserBinding {
69
+ sessionId: string;
70
+ turnId: string;
71
+ }
72
+ export interface BrowserRequestAuthorization {
73
+ mode: "ask" | "auto_approve" | "full_access";
74
+ approvedOnce?: true;
75
+ }
76
+ export interface BrowserCapability {
77
+ confirmsDocument?: true;
78
+ managesApprovals?: true;
79
+ request(binding: BrowserBinding, callId: string, operation: BrowserOperation, signal?: AbortSignal, authorization?: BrowserRequestAuthorization): Promise<unknown>;
80
+ endTurn(binding: BrowserBinding): Promise<void>;
81
+ }
@@ -0,0 +1,89 @@
1
+ import { z } from "zod";
2
+ import type { BrowserOperation } from "./browser-capability";
3
+ export declare const browserOperationSchema: z.ZodUnion<readonly [z.ZodObject<{
4
+ type: z.ZodLiteral<"list">;
5
+ }, z.core.$strict>, z.ZodObject<{
6
+ type: z.ZodLiteral<"open">;
7
+ url: z.ZodString;
8
+ }, z.core.$strict>, z.ZodObject<{
9
+ type: z.ZodLiteral<"document">;
10
+ path: z.ZodString;
11
+ }, z.core.$strict>, z.ZodObject<{
12
+ pageId: z.ZodString;
13
+ revision: z.ZodNumber;
14
+ type: z.ZodLiteral<"downloads">;
15
+ }, z.core.$strict>, z.ZodObject<{
16
+ id: z.ZodString;
17
+ pageId: z.ZodString;
18
+ revision: z.ZodNumber;
19
+ type: z.ZodLiteral<"cancel-download">;
20
+ }, z.core.$strict>, z.ZodObject<{
21
+ condition: z.ZodLiteral<"load">;
22
+ timeout: z.ZodNumber;
23
+ pageId: z.ZodString;
24
+ revision: z.ZodNumber;
25
+ type: z.ZodLiteral<"wait">;
26
+ }, z.core.$strict>, z.ZodObject<{
27
+ url: z.ZodString;
28
+ pageId: z.ZodString;
29
+ revision: z.ZodNumber;
30
+ type: z.ZodLiteral<"navigate">;
31
+ }, z.core.$strict>, z.ZodObject<{
32
+ pageId: z.ZodString;
33
+ revision: z.ZodNumber;
34
+ type: z.ZodEnum<{
35
+ select: "select";
36
+ close: "close";
37
+ release: "release";
38
+ back: "back";
39
+ forward: "forward";
40
+ reload: "reload";
41
+ snapshot: "snapshot";
42
+ screenshot: "screenshot";
43
+ }>;
44
+ }, z.core.$strict>, z.ZodObject<{
45
+ ref: z.ZodString;
46
+ pageId: z.ZodString;
47
+ revision: z.ZodNumber;
48
+ type: z.ZodLiteral<"click">;
49
+ }, z.core.$strict>, z.ZodObject<{
50
+ ref: z.ZodString;
51
+ value: z.ZodString;
52
+ pageId: z.ZodString;
53
+ revision: z.ZodNumber;
54
+ type: z.ZodEnum<{
55
+ fill: "fill";
56
+ "select-option": "select-option";
57
+ }>;
58
+ }, z.core.$strict>, z.ZodObject<{
59
+ key: z.ZodString;
60
+ pageId: z.ZodString;
61
+ revision: z.ZodNumber;
62
+ type: z.ZodLiteral<"press">;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ direction: z.ZodEnum<{
65
+ left: "left";
66
+ right: "right";
67
+ up: "up";
68
+ down: "down";
69
+ }>;
70
+ amount: z.ZodNumber;
71
+ pageId: z.ZodString;
72
+ revision: z.ZodNumber;
73
+ type: z.ZodLiteral<"scroll">;
74
+ }, z.core.$strict>, z.ZodObject<{
75
+ ref: z.ZodString;
76
+ checked: z.ZodBoolean;
77
+ pageId: z.ZodString;
78
+ revision: z.ZodNumber;
79
+ type: z.ZodLiteral<"check">;
80
+ }, z.core.$strict>, z.ZodObject<{
81
+ accept: z.ZodBoolean;
82
+ text: z.ZodString;
83
+ pageId: z.ZodString;
84
+ revision: z.ZodNumber;
85
+ type: z.ZodLiteral<"dialog">;
86
+ }, z.core.$strict>]>;
87
+ export declare function parseBrowserOperation(value: unknown): BrowserOperation;
88
+ export declare function isPublicBrowserUrl(value: string): boolean;
89
+ export declare function isPublicBrowserRead(operation: BrowserOperation, pageUrl?: string): boolean;
@@ -40,6 +40,7 @@ export interface ChatKnowledgeCapability {
40
40
  }): Promise<boolean>;
41
41
  }
42
42
  export interface ChatCapability {
43
+ readonly interactiveUi?: true;
43
44
  readonly attachments?: readonly ChatAttachmentGrant[];
44
45
  authorizeRef?(input: ChatCapabilityBinding & {
45
46
  ref: string;
@@ -1,4 +1,4 @@
1
- export type AgentErrorCode = "SESSION_MODE_MISMATCH" | "CHAT_RETRIEVAL_MODE_LOCKED" | "CHAT_TOOL_FORBIDDEN" | "CHAT_RAG_EVIDENCE_INSUFFICIENT" | "WORKSPACE_REQUIRED" | "WORK_HISTORY_READ_ONLY" | "SESSION_NOT_FOUND" | "SESSION_TITLE_INVALID" | "TURN_NOT_FOUND" | "TURN_NOT_RESUMABLE" | "TURN_ALREADY_RUNNING" | "CHECKPOINT_NOT_FOUND" | "PROJECT_NOT_FOUND" | "NOT_IMPLEMENTED" | "RUNTIME_ERROR" | "INVALID_RUN_CONFIG" | "PROVIDER_UNAUTHORIZED" | "MODEL_NOT_FOUND" | "MODEL_NOT_SUPPORTED" | "REASONING_EFFORT_NOT_SUPPORTED" | "TURN_FROZEN_MISMATCH" | "CREDENTIAL_REF_INVALID" | "MISSING_CREDENTIAL" | "PROVIDER_PROTOCOL_REQUIRED" | "UNSUPPORTED_API_PROTOCOL" | "INVALID_PROTOCOL_PROFILE" | "DUPLICATE_API_PROTOCOL_ADAPTER" | "CANONICAL_MESSAGE_INVALID" | "APPROVAL_NOT_FOUND" | "APPROVAL_MISMATCH" | "APPROVAL_ALREADY_SUBMITTED" | "QUESTION_NOT_FOUND" | "QUESTION_ALREADY_ANSWERED" | "QUESTION_ANSWER_INVALID" | "QUESTION_TURN_STATE_INVALID" | "JOB_NOT_FOUND" | "JOB_INPUT_INVALID" | "JOB_CURSOR_INVALID" | "JOB_OWNER_UNAVAILABLE" | "JOB_OWNER_UNKNOWN" | "JOB_STATE_CONFLICT" | "JOB_STOP_TIMEOUT" | "JOB_STOP_FAILED" | "JOB_STORAGE_FAILED" | "JOB_SPAWN_FAILED" | "JOB_STORE_CAPABILITY_UNSUPPORTED" | "SESSION_HAS_ACTIVE_JOBS" | "INTERACTIVE_TOOL_CONFLICT" | "INBOX_INPUT_NOT_FOUND" | "INVALID_INPUT";
1
+ export type AgentErrorCode = "SESSION_MODE_MISMATCH" | "CHAT_RETRIEVAL_MODE_LOCKED" | "CHAT_TOOL_FORBIDDEN" | "CHAT_RAG_EVIDENCE_INSUFFICIENT" | "WORKSPACE_REQUIRED" | "WORK_HISTORY_READ_ONLY" | "SESSION_NOT_FOUND" | "SESSION_TITLE_INVALID" | "TURN_NOT_FOUND" | "TURN_NOT_RESUMABLE" | "TURN_ALREADY_RUNNING" | "CHECKPOINT_NOT_FOUND" | "PROJECT_NOT_FOUND" | "NOT_IMPLEMENTED" | "RUNTIME_ERROR" | "INVALID_RUN_CONFIG" | "PROVIDER_UNAUTHORIZED" | "MODEL_NOT_FOUND" | "MODEL_NOT_SUPPORTED" | "REASONING_EFFORT_NOT_SUPPORTED" | "TURN_FROZEN_MISMATCH" | "CREDENTIAL_REF_INVALID" | "MISSING_CREDENTIAL" | "PROVIDER_PROTOCOL_REQUIRED" | "UNSUPPORTED_API_PROTOCOL" | "INVALID_PROTOCOL_PROFILE" | "DUPLICATE_API_PROTOCOL_ADAPTER" | "CANONICAL_MESSAGE_INVALID" | "APPROVAL_NOT_FOUND" | "APPROVAL_MISMATCH" | "APPROVAL_ALREADY_SUBMITTED" | "QUESTION_NOT_FOUND" | "QUESTION_ALREADY_ANSWERED" | "QUESTION_ANSWER_INVALID" | "QUESTION_TURN_STATE_INVALID" | "JOB_NOT_FOUND" | "JOB_INPUT_INVALID" | "JOB_CURSOR_INVALID" | "JOB_OWNER_UNAVAILABLE" | "JOB_OWNER_UNKNOWN" | "JOB_STATE_CONFLICT" | "JOB_STOP_TIMEOUT" | "JOB_STOP_FAILED" | "JOB_STORAGE_FAILED" | "JOB_SPAWN_FAILED" | "JOB_STORE_CAPABILITY_UNSUPPORTED" | "THREADS_UNAVAILABLE" | "THREAD_NOT_FOUND" | "THREAD_SCOPE_DENIED" | "THREAD_REQUEST_CONFLICT" | "THREAD_STATE_CONFLICT" | "THREAD_NOT_RUNNING" | "THREAD_TURN_MISMATCH" | "THREAD_RECOVERY_REQUIRED" | "THREAD_HOST_OFFLINE" | "THREAD_CURSOR_INVALID" | "THREAD_CURSOR_EXPIRED" | "THREAD_PAYLOAD_TOO_LARGE" | "THREAD_STORAGE_FULL" | "THREAD_HAS_PENDING_WORK" | "THREAD_HANDOFF_UNAVAILABLE" | "THREAD_HANDOFF_WRITE_FAILED" | "THREAD_HANDOFF_CONFLICT" | "SESSION_HAS_ACTIVE_JOBS" | "INTERACTIVE_TOOL_CONFLICT" | "INBOX_INPUT_NOT_FOUND" | "INVALID_INPUT";
2
2
  export declare class AgentRuntimeError extends Error {
3
3
  readonly code: AgentErrorCode;
4
4
  readonly cause?: unknown | undefined;
@@ -7,8 +7,9 @@ export interface FrozenRunConfigView {
7
7
  reasoningProfile?: ReasoningProfile;
8
8
  effectiveReasoning?: {
9
9
  effort: ReasoningEffort;
10
- source: "requested";
10
+ source: "requested" | "default";
11
11
  };
12
12
  permissionMode?: ToolPermissionMode;
13
+ executionPermissionMode?: ToolPermissionMode;
13
14
  capabilityCeiling?: import("../domain/product-mode").CapabilityCeiling;
14
15
  }
@@ -12,7 +12,7 @@ export { createEventEnvelope } from "./event-envelope";
12
12
  export type { McpCapability, McpServerConfig } from "./mcp-capability";
13
13
  export { parseMcpConfig, getMcpServerConfigHash, getMcpServerGrantConstraint } from "./mcp-capability";
14
14
  export { WebFetchCapabilityError, WebSearchCapabilityError } from "./web-capability";
15
- export type { WebCapability, WebFetchCapability, WebFetchCapabilityErrorCode, WebFetchResult, WebSearchCapability, WebSearchCapabilityErrorCode, WebSearchResult, WebSearchSource } from "./web-capability";
15
+ export type { WebCapability, WebFetchBlockReason, WebFetchCapability, WebFetchCapabilityErrorCode, WebFetchResult, WebSearchCapability, WebSearchCapabilityErrorCode, WebSearchResult, WebSearchSource } from "./web-capability";
16
16
  export type { WorkPreviewCapability, WorkPreviewPrepareRequest, WorkPreviewPrepareResult, WorkPreviewOpenWhen } from "./work-preview-capability";
17
17
  export type { CompactTurnInput, CompactTurnResult } from "./compact-turn-input";
18
18
  export type { AgentTerminationBudget, AgentTerminationReason, AgentTerminationView, RecoverableTurnStatus, RecoverableApprovalView, RecoverableTurnView } from "./recoverable-turn-view";
@@ -68,3 +68,4 @@ export interface SteerTurnInput {
68
68
  selectedSkills?: import("../domain/input-inbox").InboxSkillRef[];
69
69
  }
70
70
  export type { AgentCheckpoint };
71
+ export type { BrowserCapability, BrowserBinding, BrowserOperation, BrowserRequestAuthorization } from "./browser-capability";
@@ -29,4 +29,7 @@ export interface RecoverableTurnView {
29
29
  skillId: string;
30
30
  contentHash: string;
31
31
  }>;
32
+ execution?: "active" | "inactive" | "unconfirmed" | "lost";
33
+ interactionState?: "pending" | "decided" | "expired" | "unconfirmed";
34
+ warning?: "summary_lag";
32
35
  }
@@ -7,6 +7,7 @@ import type { ModelSampler } from "../../internal/kernel/model-sampler";
7
7
  import type { ModelSamplerFactory } from "../provider/model-sampler-factory";
8
8
  import type { McpCapability } from "./mcp-capability";
9
9
  import type { WebCapability } from "./web-capability";
10
+ import type { BrowserCapability } from "./browser-capability";
10
11
  import type { WorkPreviewCapability } from "./work-preview-capability";
11
12
  import type { SessionRunConfig } from "../domain/session-run-config";
12
13
  import type { FrozenRunConfig } from "../domain/frozen-run-config";
@@ -38,6 +39,15 @@ export interface CompactPolicy {
38
39
  targetTokens: number;
39
40
  }
40
41
  export interface RunConfig {
42
+ hostToolsLoader?: (binding: {
43
+ sessionId: string;
44
+ turnId: string;
45
+ }) => Promise<{
46
+ tools: import("../../internal/tools/types").AgentToolDefinition<any, any>[];
47
+ allowedTools?: string[];
48
+ beforeExecute?: (toolName: string) => Promise<void>;
49
+ browser?: BrowserCapability;
50
+ } | undefined>;
41
51
  toolAllowlist?: readonly string[];
42
52
  chatLoader?: (binding: import("./chat-capability").ChatCapabilityBinding) => Promise<import("./chat-capability").ChatCapability | undefined>;
43
53
  workspaceRoot?: string;
@@ -50,7 +60,10 @@ export interface RunConfig {
50
60
  web?: WebCapability;
51
61
  webLoader?: () => Promise<WebCapability | undefined>;
52
62
  workPreview?: WorkPreviewCapability;
63
+ browser?: BrowserCapability;
64
+ browserLoader?: () => Promise<BrowserCapability | undefined>;
53
65
  workPreviewLoader?: () => Promise<WorkPreviewCapability | undefined>;
66
+ threads?: import("./threads-capability").ThreadsCapability;
54
67
  databaseSearch?: DatabaseSearchCapability;
55
68
  databaseSearchPolicy?: DatabaseSearchPolicy;
56
69
  ragSourcePolicy?: RagSourcePolicy;
@@ -0,0 +1,14 @@
1
+ import type { ModelRef } from "../domain/model-ref";
2
+ import type { ThreadHandoffWriter } from "../ports/thread-handoff";
3
+ export interface ThreadsCapability {
4
+ workspaceId: string;
5
+ executionHost?: string;
6
+ stateRootId: string;
7
+ projectId: string;
8
+ allowedTools: readonly string[];
9
+ modelCatalog: readonly ModelRef[];
10
+ humanPrincipalId?: string;
11
+ allowRootGroupBootstrap?: boolean;
12
+ onThreadCreated?: () => void;
13
+ handoff?: ThreadHandoffWriter;
14
+ }
@@ -29,16 +29,20 @@ export interface WebFetchResult {
29
29
  truncated: boolean;
30
30
  }
31
31
  export type WebFetchCapabilityErrorCode = "WEB_URL_BLOCKED" | "WEB_REDIRECT_REQUIRES_APPROVAL" | "WEB_RESPONSE_TOO_LARGE" | "WEB_CONTENT_TYPE_UNSUPPORTED";
32
+ export type WebFetchBlockReason = "url_not_allowed" | "dns_failed" | "non_public_address" | "redirect_rejected";
33
+ export declare const WEB_FETCH_BLOCK_MESSAGES: Readonly<Record<WebFetchBlockReason, string>>;
34
+ export declare const WEB_FETCH_BLOCK_FALLBACK = "\u7F51\u9875\u5730\u5740\u88AB\u5B89\u5168\u7B56\u7565\u963B\u6B62";
32
35
  export declare class WebFetchCapabilityError extends Error {
33
36
  readonly code: WebFetchCapabilityErrorCode;
34
37
  readonly redirect?: {
35
38
  url: string;
36
39
  remainingRedirects: number;
37
40
  } | undefined;
41
+ readonly blockReason?: WebFetchBlockReason | undefined;
38
42
  constructor(code: WebFetchCapabilityErrorCode, message: string, redirect?: {
39
43
  url: string;
40
44
  remainingRedirects: number;
41
- } | undefined);
45
+ } | undefined, blockReason?: WebFetchBlockReason | undefined);
42
46
  }
43
47
  export declare function isWebFetchCapabilityError(value: unknown): value is WebFetchCapabilityError;
44
48
  export interface WebFetchCapability {
@@ -19,5 +19,6 @@ export interface WorkPreviewPrepareResult {
19
19
  autoOpen?: boolean;
20
20
  }
21
21
  export interface WorkPreviewCapability {
22
+ validatePreviewTarget?(url: string): void;
22
23
  preparePreview(request: WorkPreviewPrepareRequest): Promise<WorkPreviewPrepareResult>;
23
24
  }