@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.
- package/README.md +10 -4
- package/dist/experimental/index.js +159 -59
- package/dist/experimental/index.mjs +159 -59
- package/dist/failure.d.ts +3 -0
- package/dist/failure.js +1 -0
- package/dist/failure.mjs +1 -0
- package/dist/index.d.ts +30 -5
- package/dist/index.js +346 -214
- package/dist/index.mjs +346 -214
- package/dist/internal/agent-runtime.d.ts +87 -2
- package/dist/internal/kernel/model-sampler.d.ts +5 -0
- package/dist/internal/kernel/run-context.d.ts +6 -0
- package/dist/internal/kernel/session-images.d.ts +21 -0
- package/dist/internal/kernel/turn-usage.d.ts +14 -0
- package/dist/internal/lib/document-parser.js +2 -2
- package/dist/internal/lib/image-normalization.d.ts +16 -0
- package/dist/internal/lib/llm.d.ts +7 -1
- package/dist/internal/lib/llm.js +3 -3
- package/dist/internal/lib/pdf-processor.js +1 -1
- package/dist/internal/tools/builtins/browser-tool.d.ts +13 -0
- package/dist/internal/tools/builtins/open-preview-tool.d.ts +5 -1
- package/dist/internal/tools/builtins/read-output-budget.d.ts +5 -0
- package/dist/internal/tools/builtins/render-ui-tool.d.ts +11 -0
- package/dist/internal/tools/builtins/static-preview.d.ts +15 -0
- package/dist/internal/tools/builtins/thread-tools.d.ts +125 -0
- package/dist/internal/tools/builtins/vision-analyze-tool.d.ts +1 -0
- package/dist/internal/tools/mcp-images.d.ts +6 -0
- package/dist/internal/tools/mcp-runtime.d.ts +4 -0
- package/dist/internal/tools/permissions/command-policy.d.ts +2 -0
- package/dist/internal/tools/policy-engine.d.ts +1 -0
- package/dist/internal/tools/process-utils.d.ts +1 -0
- package/dist/internal/tools/thread-observation-display.d.ts +2 -0
- package/dist/internal/tools/types.d.ts +21 -0
- package/dist/internal/types/agent-message.d.ts +12 -2
- package/dist/internal/types/index.d.ts +1 -1
- package/dist/runtime/adapters/memory/memory-lease-store.d.ts +6 -0
- package/dist/runtime/adapters/memory/memory-session-store.d.ts +14 -0
- package/dist/runtime/adapters/memory/memory-thread-store.d.ts +24 -0
- package/dist/runtime/adapters/memory/memory-transcript-store.d.ts +9 -0
- package/dist/runtime/application/approval-service.d.ts +5 -0
- package/dist/runtime/application/input-inbox-service.d.ts +1 -1
- package/dist/runtime/application/runtime-facts.d.ts +54 -0
- package/dist/runtime/application/session-service.d.ts +9 -0
- package/dist/runtime/application/thread-delivery-service.d.ts +97 -0
- package/dist/runtime/application/thread-execution-host.d.ts +7 -0
- package/dist/runtime/application/thread-service.d.ts +1027 -0
- package/dist/runtime/application/thread-task.d.ts +11 -0
- package/dist/runtime/application/thread-tool-binding.d.ts +218 -0
- package/dist/runtime/application/turn/turn-capability-ceiling.d.ts +2 -0
- package/dist/runtime/application/turn/turn-compaction-coordinator.d.ts +2 -1
- package/dist/runtime/application/turn/turn-event-recorder.d.ts +1 -0
- package/dist/runtime/application/turn/turn-execution-view.d.ts +43 -0
- package/dist/runtime/application/turn/turn-recovery-service.d.ts +14 -0
- package/dist/runtime/application/turn-service.d.ts +28 -0
- package/dist/runtime/application/user-question-service.d.ts +1 -0
- package/dist/runtime/bootstrap/runtime-bootstrap-service.d.ts +2 -0
- package/dist/runtime/domain/frozen-run-config.d.ts +2 -0
- package/dist/runtime/domain/index.d.ts +16 -1
- package/dist/runtime/domain/input-inbox.d.ts +16 -0
- package/dist/runtime/domain/model-ref.d.ts +1 -1
- package/dist/runtime/domain/session-presentation.d.ts +9 -0
- package/dist/runtime/domain/thread-collaboration.d.ts +179 -0
- package/dist/runtime/domain/turn.d.ts +8 -0
- package/dist/runtime/ports/index.d.ts +6 -0
- package/dist/runtime/ports/lease-store.d.ts +4 -0
- package/dist/runtime/ports/session-image-store.d.ts +26 -0
- package/dist/runtime/ports/session-store.d.ts +16 -0
- package/dist/runtime/ports/thread-handoff.d.ts +14 -0
- package/dist/runtime/ports/thread-store.d.ts +15 -0
- package/dist/runtime/ports/transcript-store.d.ts +8 -0
- package/dist/runtime/protocol/browser-capability.d.ts +81 -0
- package/dist/runtime/protocol/browser-operation.d.ts +89 -0
- package/dist/runtime/protocol/chat-capability.d.ts +1 -0
- package/dist/runtime/protocol/error-code.d.ts +1 -1
- package/dist/runtime/protocol/frozen-run-config-view.d.ts +2 -1
- package/dist/runtime/protocol/index.d.ts +2 -1
- package/dist/runtime/protocol/recoverable-turn-view.d.ts +3 -0
- package/dist/runtime/protocol/run-config.d.ts +13 -0
- package/dist/runtime/protocol/threads-capability.d.ts +14 -0
- package/dist/runtime/protocol/web-capability.d.ts +5 -1
- package/dist/runtime/protocol/work-preview-capability.d.ts +1 -0
- package/dist/runtime/provider/anthropic-messages-adapter.d.ts +4 -2
- package/dist/runtime/provider/api-protocol.d.ts +16 -2
- package/dist/runtime/provider/compatibility-presets.d.ts +19 -0
- package/dist/runtime/provider/frozen-provider-config.d.ts +4 -1
- package/dist/runtime/provider/index.d.ts +4 -2
- package/dist/runtime/provider/model-capability-catalog.d.ts +7 -0
- package/dist/runtime/provider/model-sample-resolver.d.ts +3 -2
- package/dist/runtime/provider/openai-chat-completions-adapter.d.ts +5 -1
- package/dist/runtime/provider/openai-responses-adapter.d.ts +22 -0
- package/dist/runtime/provider/provider-failure-guidance.d.ts +4 -0
- package/dist/runtime/provider/provider-failure-normalization.d.ts +9 -0
- package/dist/runtime/public/agent-runtime.d.ts +5 -0
- package/dist/ui/catalog.d.ts +870 -0
- package/dist/ui/document.d.ts +580 -0
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/index.mjs +1 -0
- package/package.json +17 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RuntimePorts } from "../ports";
|
|
2
|
+
import type { ThreadControl } from "../domain/thread-collaboration";
|
|
3
|
+
export declare function readThreadTask(ports: RuntimePorts, control: ThreadControl, threadId: string, taskId: string): Promise<{
|
|
4
|
+
taskId: string;
|
|
5
|
+
message: import("../domain/thread-collaboration").ThreadMessage;
|
|
6
|
+
delivery: import("../domain/thread-collaboration").ThreadDelivery;
|
|
7
|
+
turnId: string | undefined;
|
|
8
|
+
turn: import("../domain").Turn | undefined;
|
|
9
|
+
} | undefined>;
|
|
10
|
+
export declare function currentThreadTaskId(ports: RuntimePorts, control: ThreadControl, threadId: string, turnId: string): Promise<string | undefined>;
|
|
11
|
+
export declare function threadTaskProgressKey(threadId: string, taskId: string): string;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type { ModelRef, ReasoningEffort } from "../domain/model-ref";
|
|
2
|
+
import type { Session, TurnStatus } from "../domain";
|
|
3
|
+
import type { ThreadActor, ThreadHandoffInput, ThreadHandoffRef, ThreadMessage, ThreadProgressKind } from "../domain/thread-collaboration";
|
|
4
|
+
import type { RuntimePorts } from "../ports";
|
|
5
|
+
import type { ThreadsCapability } from "../protocol/threads-capability";
|
|
6
|
+
import type { WaitResult } from "./thread-service";
|
|
7
|
+
export interface AgentThreadMemberView {
|
|
8
|
+
threadId: string;
|
|
9
|
+
parentThreadId: string | null;
|
|
10
|
+
title?: string;
|
|
11
|
+
roleLabel?: string;
|
|
12
|
+
createdAt: number;
|
|
13
|
+
}
|
|
14
|
+
export interface AgentThreadMessageView {
|
|
15
|
+
messageId: string;
|
|
16
|
+
from: ThreadActor;
|
|
17
|
+
mode: ThreadMessage["mode"];
|
|
18
|
+
content: string;
|
|
19
|
+
replyTo?: string;
|
|
20
|
+
expectedTurnId?: string;
|
|
21
|
+
createdAt: number;
|
|
22
|
+
deliverySeq: number;
|
|
23
|
+
deliveryStatus: ThreadMessage["deliveryStatus"];
|
|
24
|
+
deliveryReason?: import("../domain/thread-collaboration").ThreadDeliveryReason;
|
|
25
|
+
inputId?: string;
|
|
26
|
+
turnId?: string;
|
|
27
|
+
inputState?: {
|
|
28
|
+
inputId: string;
|
|
29
|
+
turnId: string;
|
|
30
|
+
status: "pending" | "claimed" | "consumed" | "cancelled";
|
|
31
|
+
};
|
|
32
|
+
handoffRef?: ThreadHandoffRef;
|
|
33
|
+
}
|
|
34
|
+
export interface AgentThreadReadResult {
|
|
35
|
+
thread: {
|
|
36
|
+
threadId: string;
|
|
37
|
+
title?: string;
|
|
38
|
+
status: Session["status"];
|
|
39
|
+
activeTurnId?: string;
|
|
40
|
+
relativeLink?: string;
|
|
41
|
+
};
|
|
42
|
+
turn?: {
|
|
43
|
+
turnId: string;
|
|
44
|
+
status: TurnStatus;
|
|
45
|
+
};
|
|
46
|
+
latestMessages: Array<{
|
|
47
|
+
id: string;
|
|
48
|
+
role: "assistant";
|
|
49
|
+
content: string;
|
|
50
|
+
turnId?: string;
|
|
51
|
+
createdAt: number;
|
|
52
|
+
}>;
|
|
53
|
+
messages: AgentThreadMessageView[];
|
|
54
|
+
history: Array<{
|
|
55
|
+
seq: number;
|
|
56
|
+
turnId: string;
|
|
57
|
+
timestamp: string;
|
|
58
|
+
type: string;
|
|
59
|
+
content?: string;
|
|
60
|
+
}>;
|
|
61
|
+
nextCursor?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface AgentThreadProgressPage {
|
|
64
|
+
items: Array<{
|
|
65
|
+
threadId: string;
|
|
66
|
+
taskId?: string;
|
|
67
|
+
turnId?: string;
|
|
68
|
+
kind: ThreadProgressKind;
|
|
69
|
+
summary: string;
|
|
70
|
+
progressSeq: number;
|
|
71
|
+
mergedCount: number;
|
|
72
|
+
createdAt: number;
|
|
73
|
+
evidence?: {
|
|
74
|
+
turnId?: string;
|
|
75
|
+
messageId?: string;
|
|
76
|
+
};
|
|
77
|
+
}>;
|
|
78
|
+
cursor: string;
|
|
79
|
+
compacted: number;
|
|
80
|
+
nextCursor?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface AgentThreadsCapability {
|
|
83
|
+
presentationHost?: "web";
|
|
84
|
+
handoffPath(requestId: string): string;
|
|
85
|
+
create(input: {
|
|
86
|
+
groupId?: string;
|
|
87
|
+
requestId: string;
|
|
88
|
+
title?: string;
|
|
89
|
+
roleLabel?: string;
|
|
90
|
+
modelRef?: ModelRef;
|
|
91
|
+
reasoningEffort?: ReasoningEffort;
|
|
92
|
+
}): Promise<{
|
|
93
|
+
threadId: string;
|
|
94
|
+
groupId: string;
|
|
95
|
+
parentThreadId: string;
|
|
96
|
+
relativeLink: string;
|
|
97
|
+
}>;
|
|
98
|
+
list(input: {
|
|
99
|
+
groupId?: string;
|
|
100
|
+
cursor?: string;
|
|
101
|
+
limit?: number;
|
|
102
|
+
}): Promise<{
|
|
103
|
+
items: AgentThreadMemberView[];
|
|
104
|
+
nextCursor?: string;
|
|
105
|
+
}>;
|
|
106
|
+
read(input: {
|
|
107
|
+
groupId?: string;
|
|
108
|
+
threadId: string;
|
|
109
|
+
cursor?: string;
|
|
110
|
+
limit?: number;
|
|
111
|
+
}): Promise<AgentThreadReadResult>;
|
|
112
|
+
send(input: {
|
|
113
|
+
reportingAgreement?: {
|
|
114
|
+
taskId: string;
|
|
115
|
+
explicit: boolean;
|
|
116
|
+
};
|
|
117
|
+
groupId?: string;
|
|
118
|
+
requestId: string;
|
|
119
|
+
threadId: string;
|
|
120
|
+
mode?: ThreadMessage["mode"];
|
|
121
|
+
content: string;
|
|
122
|
+
replyTo?: string;
|
|
123
|
+
expectedTurnId?: string;
|
|
124
|
+
handoff?: ThreadHandoffInput;
|
|
125
|
+
}): Promise<{
|
|
126
|
+
messageId: string;
|
|
127
|
+
mode: ThreadMessage["mode"];
|
|
128
|
+
expectedTurnId?: string;
|
|
129
|
+
taskId?: string;
|
|
130
|
+
deliverySeq: number;
|
|
131
|
+
deliveryStatus: ThreadMessage["deliveryStatus"];
|
|
132
|
+
handoffRef?: ThreadHandoffRef;
|
|
133
|
+
}>;
|
|
134
|
+
wait(input: {
|
|
135
|
+
groupId?: string;
|
|
136
|
+
targets: Array<{
|
|
137
|
+
threadId: string;
|
|
138
|
+
taskId?: string;
|
|
139
|
+
cursor?: string;
|
|
140
|
+
}>;
|
|
141
|
+
timeoutMs: number;
|
|
142
|
+
signal?: AbortSignal;
|
|
143
|
+
}): Promise<WaitResult>;
|
|
144
|
+
readState(input?: {
|
|
145
|
+
groupId?: string;
|
|
146
|
+
}): Promise<{
|
|
147
|
+
value: Record<string, unknown>;
|
|
148
|
+
revision: number;
|
|
149
|
+
updatedAt: number;
|
|
150
|
+
updatedBy: ThreadActor;
|
|
151
|
+
}>;
|
|
152
|
+
updateState(input: {
|
|
153
|
+
groupId?: string;
|
|
154
|
+
requestId: string;
|
|
155
|
+
expectedRevision: number;
|
|
156
|
+
operations: Array<{
|
|
157
|
+
op: "set";
|
|
158
|
+
key: string;
|
|
159
|
+
value: unknown;
|
|
160
|
+
} | {
|
|
161
|
+
op: "remove";
|
|
162
|
+
key: string;
|
|
163
|
+
}>;
|
|
164
|
+
}): Promise<{
|
|
165
|
+
revision: number;
|
|
166
|
+
}>;
|
|
167
|
+
reportProgress(input: {
|
|
168
|
+
groupId?: string;
|
|
169
|
+
requestId: string;
|
|
170
|
+
kind: ThreadProgressKind;
|
|
171
|
+
summary: string;
|
|
172
|
+
evidence?: {
|
|
173
|
+
turnId?: string;
|
|
174
|
+
messageId?: string;
|
|
175
|
+
};
|
|
176
|
+
}): Promise<{
|
|
177
|
+
progressSeq: number;
|
|
178
|
+
taskId: string;
|
|
179
|
+
taskProgressSeq: number;
|
|
180
|
+
}>;
|
|
181
|
+
readProgress(input: {
|
|
182
|
+
groupId?: string;
|
|
183
|
+
threadId: string;
|
|
184
|
+
taskId?: string;
|
|
185
|
+
cursor?: string;
|
|
186
|
+
limit?: number;
|
|
187
|
+
kinds?: ThreadProgressKind[];
|
|
188
|
+
}): Promise<AgentThreadProgressPage>;
|
|
189
|
+
resumeConstraint(input: {
|
|
190
|
+
groupId?: string;
|
|
191
|
+
threadId: string;
|
|
192
|
+
expectedTurnId: string;
|
|
193
|
+
}): Promise<string>;
|
|
194
|
+
resume(input: {
|
|
195
|
+
groupId?: string;
|
|
196
|
+
requestId: string;
|
|
197
|
+
threadId: string;
|
|
198
|
+
expectedTurnId: string;
|
|
199
|
+
}): Promise<{
|
|
200
|
+
accepted: true;
|
|
201
|
+
controlId: string;
|
|
202
|
+
recoveryAction?: "open_target_continue";
|
|
203
|
+
}>;
|
|
204
|
+
interrupt(input: {
|
|
205
|
+
groupId?: string;
|
|
206
|
+
requestId: string;
|
|
207
|
+
threadId: string;
|
|
208
|
+
expectedTurnId: string;
|
|
209
|
+
}): Promise<{
|
|
210
|
+
accepted: true;
|
|
211
|
+
controlId: string;
|
|
212
|
+
hostOffline: boolean;
|
|
213
|
+
}>;
|
|
214
|
+
}
|
|
215
|
+
export declare function createThreadsToolBinding(ports: RuntimePorts, capability: ThreadsCapability, actor: {
|
|
216
|
+
threadId: string;
|
|
217
|
+
turnId: string;
|
|
218
|
+
}): AgentThreadsCapability;
|
|
@@ -2,6 +2,8 @@ import type { Session, FrozenRunConfig } from "../../domain";
|
|
|
2
2
|
import type { ChatCapability } from "../../protocol/chat-capability";
|
|
3
3
|
import type { RunConfig } from "../../protocol/run-config";
|
|
4
4
|
export interface TurnCapabilities extends RunConfig {
|
|
5
|
+
hostToolAdmission?: (toolName: string) => Promise<void>;
|
|
6
|
+
hostTools?: import("../../../internal/tools/types").AgentToolDefinition<any, any>[];
|
|
5
7
|
chatCapability?: ChatCapability;
|
|
6
8
|
}
|
|
7
9
|
export declare function resolveTurnCapabilities(input: {
|
|
@@ -8,6 +8,7 @@ import type { TurnLeaseCoordinator } from "./turn-lease-coordinator";
|
|
|
8
8
|
import type { TurnRuntimeConfigResolver } from "./turn-runtime-config-resolver";
|
|
9
9
|
export interface TurnCompactionRequest extends CompactTurnInput {
|
|
10
10
|
sampler?: ModelSampler;
|
|
11
|
+
tools?: import("../../../internal/lib/llm").AgentModelToolDefinition[];
|
|
11
12
|
}
|
|
12
13
|
export interface ContextBudgetBounds {
|
|
13
14
|
budgetWindowTokens: number | undefined;
|
|
@@ -17,7 +18,7 @@ export interface ContextBudgetBounds {
|
|
|
17
18
|
}
|
|
18
19
|
export declare function resolveContextBudgetBounds(providerConfig: FrozenProviderConfig | undefined): ContextBudgetBounds;
|
|
19
20
|
export interface TurnCompactionCoordinator {
|
|
20
|
-
buildContextCompactionManager(frozen: FrozenRunConfig, providerConfig: FrozenProviderConfig | undefined, sampler: ModelSampler): ContextCompactionManager | undefined;
|
|
21
|
+
buildContextCompactionManager(frozen: FrozenRunConfig, providerConfig: FrozenProviderConfig | undefined, sampler: ModelSampler, sessionId?: string): ContextCompactionManager | undefined;
|
|
21
22
|
compact(input: TurnCompactionRequest): Promise<CompactTurnResult>;
|
|
22
23
|
}
|
|
23
24
|
export declare function createTurnCompactionCoordinator(ports: RuntimePorts, defaultRunConfig: RunConfig, leaseCoordinator: TurnLeaseCoordinator, runtimeConfigResolver: TurnRuntimeConfigResolver): TurnCompactionCoordinator;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { UserQuestionRequest } from "../../domain/user-question";
|
|
2
|
+
import { type ThreadControlIntent } from "../../domain/thread-collaboration";
|
|
3
|
+
import type { RuntimePorts } from "../../ports";
|
|
4
|
+
import type { Session } from "../../domain";
|
|
5
|
+
import type { AgentEventEnvelope } from "../../protocol";
|
|
6
|
+
export interface TurnExecutionView {
|
|
7
|
+
sessionId: string;
|
|
8
|
+
turnId: string;
|
|
9
|
+
status: Session["status"];
|
|
10
|
+
execution: "active" | "inactive" | "unconfirmed" | "lost";
|
|
11
|
+
executionHost?: string;
|
|
12
|
+
unconfirmedReason?: "snapshot_changed" | "checkpoint_missing" | "lease_mismatch" | "turn_summary_lag" | "boundary_unconfirmed";
|
|
13
|
+
continuation?: {
|
|
14
|
+
controlId: string;
|
|
15
|
+
state: ThreadControlIntent["status"];
|
|
16
|
+
requestId?: string;
|
|
17
|
+
approvalId?: string;
|
|
18
|
+
failureCode?: ThreadControlIntent["failureCode"];
|
|
19
|
+
failureDiagnostic?: ThreadControlIntent["failureDiagnostic"];
|
|
20
|
+
};
|
|
21
|
+
waiting?: "approval" | "user_input" | "threads";
|
|
22
|
+
result?: "completed" | "failed" | "interrupted" | "limit_reached";
|
|
23
|
+
warning?: "summary_lag";
|
|
24
|
+
interaction?: {
|
|
25
|
+
state: "pending" | "decided" | "expired" | "unconfirmed";
|
|
26
|
+
decision?: "approved" | "denied";
|
|
27
|
+
approval?: AgentEventEnvelope;
|
|
28
|
+
requestId?: string;
|
|
29
|
+
question?: UserQuestionRequest;
|
|
30
|
+
continuation?: {
|
|
31
|
+
controlId: string;
|
|
32
|
+
state: ThreadControlIntent["status"];
|
|
33
|
+
failureCode?: ThreadControlIntent["failureCode"];
|
|
34
|
+
failureDiagnostic?: ThreadControlIntent["failureDiagnostic"];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
lastSeq: number;
|
|
38
|
+
}
|
|
39
|
+
export declare function readTurnExecutionView(ports: RuntimePorts, input: {
|
|
40
|
+
sessionId: string;
|
|
41
|
+
turnId?: string;
|
|
42
|
+
signal?: AbortSignal;
|
|
43
|
+
}): Promise<TurnExecutionView | null>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ContextUsageView } from "../../../internal/kernel/context-budget";
|
|
2
|
+
import { type TurnUsageSummaryView } from "../../../internal/kernel/turn-usage";
|
|
2
3
|
import type { AgentCheckpoint, AgentEventEnvelope, FrozenRunConfigView, PublicCheckpointView, RecoverableTurnView } from "../../protocol";
|
|
4
|
+
import { getAgentToolCalls, type AgentMessage } from "../../../internal/types/agent-message";
|
|
3
5
|
import type { Turn } from "../../domain";
|
|
4
6
|
import type { RuntimePorts } from "../../ports";
|
|
5
7
|
import type { TurnLeaseCoordinator } from "./turn-lease-coordinator";
|
|
@@ -30,6 +32,18 @@ export interface TurnRecoveryService {
|
|
|
30
32
|
sessionId: string;
|
|
31
33
|
turnId?: string;
|
|
32
34
|
}): Promise<ContextUsageView | null>;
|
|
35
|
+
getTurnUsageSummary(input: {
|
|
36
|
+
sessionId: string;
|
|
37
|
+
turnId?: string;
|
|
38
|
+
}): Promise<TurnUsageSummaryView | null>;
|
|
39
|
+
getUsageSnapshot(input: {
|
|
40
|
+
sessionId: string;
|
|
41
|
+
turnId?: string;
|
|
42
|
+
}): Promise<{
|
|
43
|
+
contextUsage: ContextUsageView | null;
|
|
44
|
+
turnUsage: TurnUsageSummaryView | null;
|
|
45
|
+
}>;
|
|
33
46
|
getContinuation(sessionId: string, turnId: string | undefined): Promise<RecoverableContinuation>;
|
|
34
47
|
}
|
|
48
|
+
export declare function closeInterruptedToolCalls(messages: AgentMessage[], pendingCalls: ReturnType<typeof getAgentToolCalls>): AgentMessage[];
|
|
35
49
|
export declare function createTurnRecoveryService(ports: RuntimePorts, leaseCoordinator: TurnLeaseCoordinator): TurnRecoveryService;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ContextUsageView } from "../../internal/kernel/context-budget";
|
|
2
|
+
import type { TurnUsageSummaryView } from "../../internal/kernel/turn-usage";
|
|
2
3
|
import type { RuntimePorts } from "../ports";
|
|
3
4
|
import type { AgentEvent, StartTurnInput, ContinueTurnInput, CancelTurnInput, SteerTurnInput, RunConfig, CompactTurnInput, CompactTurnResult, FrozenRunConfigView, RecoverableTurnView } from "../protocol";
|
|
4
5
|
import type { InboxInput } from "../domain";
|
|
5
6
|
import type { ApprovalService } from "./approval-service";
|
|
6
7
|
import type { InputInboxService } from "./input-inbox-service";
|
|
7
8
|
import type { JobService } from "./job-service";
|
|
9
|
+
import { type TurnExecutionView } from "./turn/turn-execution-view";
|
|
8
10
|
import type { TurnState } from "./turn/turn-recovery-service";
|
|
9
11
|
import type { UserQuestionService } from "./user-question-service";
|
|
10
12
|
export { STALE_AGENT_LEASE_MS } from "./turn/turn-lease-coordinator";
|
|
@@ -12,7 +14,17 @@ export type { TurnState } from "./turn/turn-recovery-service";
|
|
|
12
14
|
export interface TurnService {
|
|
13
15
|
start(input: StartTurnInput): AsyncIterable<AgentEvent>;
|
|
14
16
|
continue(input: ContinueTurnInput): AsyncIterable<AgentEvent>;
|
|
17
|
+
requestInteractionContinuation?(input: {
|
|
18
|
+
sessionId: string;
|
|
19
|
+
turnId: string;
|
|
20
|
+
approvalId?: string;
|
|
21
|
+
requestId?: string;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
queued: boolean;
|
|
24
|
+
controlId?: string;
|
|
25
|
+
}>;
|
|
15
26
|
cancel(input: CancelTurnInput): Promise<void>;
|
|
27
|
+
cancelLocalExecution?(input: CancelTurnInput): Promise<boolean>;
|
|
16
28
|
steer(input: SteerTurnInput): Promise<InboxInput>;
|
|
17
29
|
compact(input: CompactTurnInput): Promise<CompactTurnResult>;
|
|
18
30
|
getState(input: {
|
|
@@ -23,6 +35,11 @@ export interface TurnService {
|
|
|
23
35
|
sessionId: string;
|
|
24
36
|
turnId?: string;
|
|
25
37
|
}): Promise<RecoverableTurnView | null>;
|
|
38
|
+
getExecutionState(input: {
|
|
39
|
+
sessionId: string;
|
|
40
|
+
turnId?: string;
|
|
41
|
+
signal?: AbortSignal;
|
|
42
|
+
}): Promise<TurnExecutionView | null>;
|
|
26
43
|
getFrozenRunConfig(input: {
|
|
27
44
|
sessionId: string;
|
|
28
45
|
turnId?: string;
|
|
@@ -31,5 +48,16 @@ export interface TurnService {
|
|
|
31
48
|
sessionId: string;
|
|
32
49
|
turnId?: string;
|
|
33
50
|
}): Promise<ContextUsageView | null>;
|
|
51
|
+
getTurnUsageSummary(input: {
|
|
52
|
+
sessionId: string;
|
|
53
|
+
turnId?: string;
|
|
54
|
+
}): Promise<TurnUsageSummaryView | null>;
|
|
55
|
+
getUsageSnapshot(input: {
|
|
56
|
+
sessionId: string;
|
|
57
|
+
turnId?: string;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
contextUsage: ContextUsageView | null;
|
|
60
|
+
turnUsage: TurnUsageSummaryView | null;
|
|
61
|
+
}>;
|
|
34
62
|
}
|
|
35
63
|
export declare function createTurnService(ports: RuntimePorts, defaultRunConfig?: RunConfig, approvalService?: ApprovalService, inputInboxService?: InputInboxService, jobService?: JobService, userQuestionService?: UserQuestionService, enableUserQuestions?: boolean): TurnService;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AgentRuntime } from "../public";
|
|
2
2
|
import type { RuntimePorts } from "../ports";
|
|
3
3
|
import type { WorkspaceAdapter } from "../ports/workspace-adapter";
|
|
4
|
+
import type { BrowserCapability } from "../protocol/browser-capability";
|
|
4
5
|
import type { RunConfig, McpCapability, WebCapability, WorkPreviewCapability } from "../protocol";
|
|
5
6
|
import type { AgentContextSnapshot } from "../../internal/agent-context";
|
|
6
7
|
import type { AgentSkillsCapability } from "../../internal/tools/builtins/skill-tool";
|
|
@@ -10,6 +11,7 @@ import type { DatabaseSearchCapability } from "../../internal/database-search";
|
|
|
10
11
|
import type { SafeBootstrapConfig } from "./safe-bootstrap-config";
|
|
11
12
|
import type { WorkspaceTrustPolicy, WorkspaceTrustEntry } from "./workspace-trust-policy";
|
|
12
13
|
export interface CapabilityLoader {
|
|
14
|
+
loadBrowser?(workspaceRoot: string): Promise<BrowserCapability | undefined> | BrowserCapability | undefined;
|
|
13
15
|
loadProvider?(workspaceRoot: string): Promise<ModelSamplerFactory> | ModelSamplerFactory;
|
|
14
16
|
loadMcp?(workspaceRoot: string): Promise<McpCapability | undefined> | McpCapability | undefined;
|
|
15
17
|
loadWeb?(workspaceRoot: string): Promise<WebCapability | undefined> | WebCapability | undefined;
|
|
@@ -7,10 +7,12 @@ import type { DatabaseSearchPolicy, RagSourcePolicy } from "../../internal/datab
|
|
|
7
7
|
import type { RerankPolicy } from "../../internal/lib/rerank";
|
|
8
8
|
import type { SandboxMode } from "./sandbox-policy";
|
|
9
9
|
export interface FrozenRunConfig {
|
|
10
|
+
threadsEnabled?: boolean;
|
|
10
11
|
workContextVersion?: 1;
|
|
11
12
|
capabilityCeiling?: import("./product-mode").CapabilityCeiling;
|
|
12
13
|
chatAttachmentGrants?: readonly import("../protocol/chat-capability").ChatAttachmentGrant[];
|
|
13
14
|
workPreviewEnabled?: boolean;
|
|
15
|
+
browserEnabled?: boolean;
|
|
14
16
|
modelRef?: ModelRef;
|
|
15
17
|
reasoningProfile?: ReasoningProfile;
|
|
16
18
|
credentialRef?: CredentialRef;
|
|
@@ -17,13 +17,24 @@ export type { ExternalFileOperation, ParsedExternalPermissionRule, ExternalFileA
|
|
|
17
17
|
export type { ApprovalDecision, PersistentGrant, SubmitApprovalInput, FindPersistentGrantInput, } from "./approval";
|
|
18
18
|
export type { UserQuestionOption, UserQuestionItem, UserQuestionAnswerItem, UserQuestionRequest, UserQuestionAnswer, StoredUserQuestion, } from "./user-question";
|
|
19
19
|
export type { TodoStatus, TodoItem, TodoCounts, TodoSnapshot, TodoWriteResult, } from "./todo";
|
|
20
|
-
export type { InboxInput, InboxDelivery, InboxStatus, InboxBoundary, InboxAttachmentRef, InboxSkillRef, PostInboxInput, DrainInboxInput, ClaimNextInboxInput, ConsumeInboxInput, ListInboxInput, } from "./input-inbox";
|
|
20
|
+
export type { InboxInput, InboxDelivery, InboxStatus, InboxBoundary, InboxOrigin, InboxAttachmentRef, InboxSkillRef, PostInboxInput, DrainInboxInput, ClaimNextInboxInput, ConsumeInboxInput, ListInboxInput, } from "./input-inbox";
|
|
21
21
|
export type SessionPersistenceMode = "durable" | "ephemeral";
|
|
22
22
|
export type { SessionPresentation, SessionPresentationCompaction, SessionPresentationMessage, SessionPresentationPinnedSkill, } from "./session-presentation";
|
|
23
23
|
export type SessionStatus = "idle" | "running" | "waiting_approval" | "waiting_user_input" | "interrupted" | "failed" | "completed";
|
|
24
24
|
export interface Session {
|
|
25
|
+
readonly managedExecution?: {
|
|
26
|
+
hostId: string;
|
|
27
|
+
requestId: string;
|
|
28
|
+
threadPolicy: "disabled";
|
|
29
|
+
};
|
|
25
30
|
readonly workContextVersion?: 1;
|
|
26
31
|
id: string;
|
|
32
|
+
readonly collaborationCreationId?: string;
|
|
33
|
+
readonly creationSource?: {
|
|
34
|
+
actor: import("./thread-collaboration").ThreadActor;
|
|
35
|
+
requestId: string;
|
|
36
|
+
};
|
|
37
|
+
readonly collaborationAllowedTools?: readonly string[];
|
|
27
38
|
readonly productMode?: import("./product-mode").ProductMode;
|
|
28
39
|
readonly chatRetrievalMode?: import("./product-mode").ChatRetrievalMode;
|
|
29
40
|
projectId?: string;
|
|
@@ -32,6 +43,10 @@ export interface Session {
|
|
|
32
43
|
activeTurnId?: string;
|
|
33
44
|
title?: string;
|
|
34
45
|
defaultRunConfig?: import("./session-run-config").SessionRunConfig;
|
|
46
|
+
permissionSelection?: {
|
|
47
|
+
mode: import("../../internal/tools/types").ToolPermissionMode;
|
|
48
|
+
revision: string;
|
|
49
|
+
};
|
|
35
50
|
presentation?: import("./session-presentation").SessionPresentation;
|
|
36
51
|
createdAt: number;
|
|
37
52
|
updatedAt: number;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
export type InboxDelivery = "steer" | "queue";
|
|
2
2
|
export type InboxStatus = "pending" | "claimed" | "consumed" | "cancelled";
|
|
3
3
|
export type InboxBoundary = "before_sample" | "after_sample" | "after_tools" | "before_complete";
|
|
4
|
+
export type InboxOrigin = {
|
|
5
|
+
kind: "human";
|
|
6
|
+
principalId?: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: "thread";
|
|
9
|
+
threadId: string;
|
|
10
|
+
turnId?: string;
|
|
11
|
+
purpose?: "reporting_agreement";
|
|
12
|
+
};
|
|
13
|
+
export declare function inboxOriginKey(origin?: InboxOrigin): string;
|
|
4
14
|
export interface InboxInput {
|
|
5
15
|
inputId: string;
|
|
6
16
|
sessionId: string;
|
|
@@ -11,6 +21,7 @@ export interface InboxInput {
|
|
|
11
21
|
clientMessageId?: string;
|
|
12
22
|
attachments: InboxAttachmentRef[];
|
|
13
23
|
selectedSkills: InboxSkillRef[];
|
|
24
|
+
origin?: InboxOrigin;
|
|
14
25
|
createdAt: string;
|
|
15
26
|
}
|
|
16
27
|
export interface InboxAttachmentRef {
|
|
@@ -18,6 +29,10 @@ export interface InboxAttachmentRef {
|
|
|
18
29
|
name: string;
|
|
19
30
|
mimeType: string;
|
|
20
31
|
relativePath?: string;
|
|
32
|
+
sha256?: string;
|
|
33
|
+
width?: number;
|
|
34
|
+
height?: number;
|
|
35
|
+
bytes?: number;
|
|
21
36
|
}
|
|
22
37
|
export interface InboxSkillRef {
|
|
23
38
|
skillRef: string;
|
|
@@ -34,6 +49,7 @@ export interface PostInboxInput {
|
|
|
34
49
|
content: string;
|
|
35
50
|
attachments?: InboxAttachmentRef[];
|
|
36
51
|
selectedSkills?: InboxSkillRef[];
|
|
52
|
+
origin?: InboxOrigin;
|
|
37
53
|
}
|
|
38
54
|
export interface DrainInboxInput {
|
|
39
55
|
sessionId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ReasoningEffort = "none" | "low" | "medium" | "high" | "max";
|
|
1
|
+
export type ReasoningEffort = "none" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
2
2
|
export declare function parseReasoningEffort(value: unknown): ReasoningEffort | undefined;
|
|
3
3
|
export interface ModelRef {
|
|
4
4
|
provider: string;
|
|
@@ -39,6 +39,15 @@ export interface SessionPresentationMessage {
|
|
|
39
39
|
message: string;
|
|
40
40
|
}>;
|
|
41
41
|
}>;
|
|
42
|
+
origin?: {
|
|
43
|
+
kind: "thread";
|
|
44
|
+
threadId: string;
|
|
45
|
+
};
|
|
46
|
+
handoffDisplay?: {
|
|
47
|
+
title: string;
|
|
48
|
+
instruction: string;
|
|
49
|
+
summary: string;
|
|
50
|
+
};
|
|
42
51
|
createdAt: number;
|
|
43
52
|
}
|
|
44
53
|
export interface SessionPresentationCompaction {
|