@tangle-network/agent-interface 0.45.0 → 0.46.1
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 +1 -1
- package/dist/agent-candidate-profile-schema.d.ts +2 -2
- package/dist/agent-candidate-promotion-schema.d.ts +22 -22
- package/dist/agent-candidate-schema-common.js +1 -1
- package/dist/agent-candidate-schema.d.ts +2 -2
- package/dist/agent-execution-preparation.d.ts +26 -26
- package/dist/agent-profile.d.ts +10 -3
- package/dist/agent-profile.js +45 -22
- package/dist/backend-message.d.ts +14 -0
- package/dist/backend-message.js +1 -0
- package/dist/contract-limits.d.ts +26 -0
- package/dist/contract-limits.js +175 -0
- package/dist/environment-exact-process.d.ts +161 -0
- package/dist/environment-exact-process.js +1 -0
- package/dist/environment-profile-capabilities.d.ts +26 -0
- package/dist/environment-profile-capabilities.js +34 -0
- package/dist/environment-provider.d.ts +3 -730
- package/dist/environment-provider.js +3 -245
- package/dist/environment-requests.d.ts +70 -0
- package/dist/environment-requests.js +1 -0
- package/dist/environment-runtime.d.ts +834 -0
- package/dist/environment-runtime.js +228 -0
- package/dist/execution-types.d.ts +50 -0
- package/dist/execution-types.js +1 -0
- package/dist/host-services.d.ts +91 -0
- package/dist/host-services.js +1 -0
- package/dist/index.d.ts +10 -617
- package/dist/index.js +10 -125
- package/dist/interaction-answer-validation.d.ts +13 -0
- package/dist/interaction-answer-validation.js +149 -0
- package/dist/interaction-data.d.ts +22 -0
- package/dist/interaction-data.js +46 -0
- package/dist/interaction-envelope.d.ts +267 -0
- package/dist/interaction-envelope.js +247 -0
- package/dist/interaction-fields.d.ts +130 -0
- package/dist/interaction-fields.js +227 -0
- package/dist/interaction-permissions.d.ts +28 -0
- package/dist/interaction-permissions.js +57 -0
- package/dist/interaction-resolution-validation.d.ts +9 -0
- package/dist/interaction-resolution-validation.js +50 -0
- package/dist/interaction-response-validation.d.ts +17 -0
- package/dist/interaction-response-validation.js +102 -0
- package/dist/interaction.d.ts +6 -397
- package/dist/interaction.js +6 -603
- package/dist/mcp.d.ts +38 -0
- package/dist/mcp.js +1 -0
- package/dist/parts.d.ts +104 -0
- package/dist/parts.js +55 -0
- package/dist/portable-context-base.d.ts +82 -0
- package/dist/portable-context-base.js +63 -0
- package/dist/portable-context-continuation.d.ts +168 -0
- package/dist/portable-context-continuation.js +194 -0
- package/dist/portable-context-plan-request.d.ts +86 -0
- package/dist/portable-context-plan-request.js +102 -0
- package/dist/portable-context-plan.d.ts +229 -0
- package/dist/portable-context-plan.js +241 -0
- package/dist/portable-context-shared.d.ts +36 -0
- package/dist/portable-context-shared.js +46 -0
- package/dist/portable-context-transfer.d.ts +319 -0
- package/dist/portable-context-transfer.js +206 -0
- package/dist/portable-context.d.ts +5 -753
- package/dist/portable-context.js +5 -754
- package/dist/profile-diff.js +56 -47
- package/dist/provider-adapter.d.ts +45 -0
- package/dist/provider-adapter.js +1 -0
- package/dist/provider-config.d.ts +58 -0
- package/dist/provider-config.js +42 -0
- package/dist/runtime-control.d.ts +87 -10
- package/dist/runtime-control.js +159 -38
- package/dist/stream-events.d.ts +55 -0
- package/dist/stream-events.js +1 -0
- package/dist/workspace-branching-shared.d.ts +7 -0
- package/dist/workspace-branching-shared.js +20 -0
- package/dist/workspace-branching.d.ts +4 -254
- package/dist/workspace-branching.js +4 -400
- package/dist/workspace-checkpoint.d.ts +99 -0
- package/dist/workspace-checkpoint.js +169 -0
- package/dist/workspace-cleanup.d.ts +85 -0
- package/dist/workspace-cleanup.js +156 -0
- package/dist/workspace-confidentiality.d.ts +59 -0
- package/dist/workspace-confidentiality.js +123 -0
- package/dist/workspace-fork.d.ts +182 -0
- package/dist/workspace-fork.js +267 -0
- package/package.json +1 -1
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { InteractionCapabilitiesSchema } from "./interaction.js";
|
|
3
|
+
import { ContextTransferReceiptSchema, ContextTransferRequestSchema, NativeContextContinuationAcknowledgementSchema, NativeContextContinuationRequestSchema, nativeContextContinuationAcknowledgementMatches } from "./portable-context.js";
|
|
4
|
+
import { AgentExactRunControlRefSchema, AgentRunControlRefSchema, CanonicalStreamEventSchema } from "./runtime-control.js";
|
|
5
|
+
import { AgentProfileCapabilitiesSchema } from "./environment-profile-capabilities.js";
|
|
6
|
+
import { boundedIdentifierSchema, boundedJsonRecordSchema, boundedJsonSchema, boundedStringSchema, CONTRACT_MAX_ARRAY_LENGTH } from "./contract-limits.js";
|
|
7
|
+
import { InputPartSchema } from "./portable-context-shared.js";
|
|
8
|
+
export const AgentTurnInputSchema = z.strictObject({
|
|
9
|
+
prompt: boundedStringSchema.optional(),
|
|
10
|
+
parts: z.array(InputPartSchema).max(CONTRACT_MAX_ARRAY_LENGTH).optional(),
|
|
11
|
+
sessionId: boundedIdentifierSchema.optional(),
|
|
12
|
+
model: boundedIdentifierSchema.optional(),
|
|
13
|
+
timeoutMs: z.number().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),
|
|
14
|
+
executionId: boundedIdentifierSchema.optional(),
|
|
15
|
+
lastEventId: boundedIdentifierSchema.optional(),
|
|
16
|
+
turnId: boundedIdentifierSchema.optional(),
|
|
17
|
+
detach: z.boolean().optional(),
|
|
18
|
+
controlRef: AgentRunControlRefSchema.optional(),
|
|
19
|
+
contextTransfer: ContextTransferRequestSchema.optional(),
|
|
20
|
+
nativeContinuation: NativeContextContinuationRequestSchema.optional(),
|
|
21
|
+
context: boundedJsonRecordSchema.optional(),
|
|
22
|
+
signal: z.custom().optional(),
|
|
23
|
+
providerOptions: boundedJsonRecordSchema.optional(),
|
|
24
|
+
});
|
|
25
|
+
const TokenUsageSchema = z.strictObject({
|
|
26
|
+
inputTokens: z.number().int().nonnegative(),
|
|
27
|
+
outputTokens: z.number().int().nonnegative(),
|
|
28
|
+
totalTokens: z.number().int().nonnegative().optional(),
|
|
29
|
+
cacheReadInputTokens: z.number().int().nonnegative().optional(),
|
|
30
|
+
cacheCreationInputTokens: z.number().int().nonnegative().optional(),
|
|
31
|
+
reasoningTokens: z.number().int().nonnegative().optional(),
|
|
32
|
+
cost: z.number().finite().nonnegative().optional(),
|
|
33
|
+
});
|
|
34
|
+
const AgentEnvironmentEventSchema = z.strictObject({
|
|
35
|
+
type: boundedIdentifierSchema,
|
|
36
|
+
data: boundedJsonRecordSchema,
|
|
37
|
+
id: boundedIdentifierSchema.optional(),
|
|
38
|
+
normalized: CanonicalStreamEventSchema.optional(),
|
|
39
|
+
usage: TokenUsageSchema.optional(),
|
|
40
|
+
providerEvent: boundedJsonSchema.optional(),
|
|
41
|
+
});
|
|
42
|
+
/** Runtime validator for a provider turn returned from durable continuation. */
|
|
43
|
+
export const AgentTurnResultSchema = z.strictObject({
|
|
44
|
+
text: boundedStringSchema,
|
|
45
|
+
success: z.boolean(),
|
|
46
|
+
error: boundedStringSchema.optional(),
|
|
47
|
+
sessionId: boundedIdentifierSchema.optional(),
|
|
48
|
+
usage: TokenUsageSchema.optional(),
|
|
49
|
+
metadata: boundedJsonRecordSchema.optional(),
|
|
50
|
+
events: z.array(AgentEnvironmentEventSchema).max(CONTRACT_MAX_ARRAY_LENGTH).optional(),
|
|
51
|
+
contextTransferReceipt: ContextTransferReceiptSchema.optional(),
|
|
52
|
+
});
|
|
53
|
+
/** Durable provider result for one digest-bound native continuation. */
|
|
54
|
+
export const AgentNativeContextContinuationResultSchema = z.union([
|
|
55
|
+
z
|
|
56
|
+
.strictObject({
|
|
57
|
+
acknowledgement: NativeContextContinuationAcknowledgementSchema.and(z.object({ status: z.enum(["accepted", "replayed"]) })),
|
|
58
|
+
result: AgentTurnResultSchema,
|
|
59
|
+
controlRef: AgentExactRunControlRefSchema,
|
|
60
|
+
})
|
|
61
|
+
.superRefine((outcome, refinement) => {
|
|
62
|
+
if (outcome.result.contextTransferReceipt !== undefined) {
|
|
63
|
+
refinement.addIssue({
|
|
64
|
+
code: "custom",
|
|
65
|
+
path: ["result", "contextTransferReceipt"],
|
|
66
|
+
message: "native continuation cannot return a context transfer receipt",
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
z
|
|
71
|
+
.strictObject({
|
|
72
|
+
acknowledgement: NativeContextContinuationAcknowledgementSchema.and(z.object({
|
|
73
|
+
status: z.enum([
|
|
74
|
+
"conflict",
|
|
75
|
+
"boundary_mismatch",
|
|
76
|
+
"unverified",
|
|
77
|
+
"unknown_session",
|
|
78
|
+
"transport_failure",
|
|
79
|
+
]),
|
|
80
|
+
})),
|
|
81
|
+
})
|
|
82
|
+
.superRefine((outcome, refinement) => {
|
|
83
|
+
if (outcome.acknowledgement.status === "transport_failure" &&
|
|
84
|
+
outcome.acknowledgement.retryable !== true) {
|
|
85
|
+
refinement.addIssue({
|
|
86
|
+
code: "custom",
|
|
87
|
+
path: ["acknowledgement", "retryable"],
|
|
88
|
+
message: "a durable native continuation transport failure must be retryable",
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}),
|
|
92
|
+
]);
|
|
93
|
+
/** Cross-check a successful native continuation against its retained session. */
|
|
94
|
+
export function agentNativeContextContinuationResultMatchesRequest(request, outcome) {
|
|
95
|
+
const parsedRequest = NativeContextContinuationRequestSchema.safeParse(request);
|
|
96
|
+
const parsedOutcome = AgentNativeContextContinuationResultSchema.safeParse(outcome);
|
|
97
|
+
if (!parsedRequest.success || !parsedOutcome.success)
|
|
98
|
+
return false;
|
|
99
|
+
const exactOutcome = parsedOutcome.data;
|
|
100
|
+
if (exactOutcome.acknowledgement.status !== "accepted" &&
|
|
101
|
+
exactOutcome.acknowledgement.status !== "replayed")
|
|
102
|
+
return false;
|
|
103
|
+
if (!("result" in exactOutcome) || !("controlRef" in exactOutcome))
|
|
104
|
+
return false;
|
|
105
|
+
if (!nativeContextContinuationAcknowledgementMatches(parsedRequest.data, exactOutcome.acknowledgement))
|
|
106
|
+
return false;
|
|
107
|
+
const current = exactOutcome.controlRef;
|
|
108
|
+
return (current.provider === request.run.provider &&
|
|
109
|
+
current.environmentId === request.run.environmentId &&
|
|
110
|
+
current.sessionId === request.run.sessionId &&
|
|
111
|
+
(exactOutcome.result.sessionId === undefined ||
|
|
112
|
+
exactOutcome.result.sessionId === current.sessionId));
|
|
113
|
+
}
|
|
114
|
+
/** Strict runtime validator for provider capability negotiation. */
|
|
115
|
+
export const AgentEnvironmentCapabilitiesSchema = z
|
|
116
|
+
.strictObject({
|
|
117
|
+
profile: AgentProfileCapabilitiesSchema,
|
|
118
|
+
streaming: z.strictObject({
|
|
119
|
+
live: z.boolean(),
|
|
120
|
+
replay: z.boolean(),
|
|
121
|
+
detach: z.boolean(),
|
|
122
|
+
turnIdempotency: z.boolean(),
|
|
123
|
+
}),
|
|
124
|
+
sessions: z.strictObject({
|
|
125
|
+
continue: z.boolean(),
|
|
126
|
+
list: z.boolean(),
|
|
127
|
+
messages: z.boolean(),
|
|
128
|
+
}),
|
|
129
|
+
retainedControl: z
|
|
130
|
+
.strictObject({
|
|
131
|
+
exactRunIdentity: z.boolean(),
|
|
132
|
+
resultIdentity: z.boolean(),
|
|
133
|
+
eventIdentity: z.boolean(),
|
|
134
|
+
cancellationIdempotency: z.boolean(),
|
|
135
|
+
})
|
|
136
|
+
.optional(),
|
|
137
|
+
nativeContinuation: z
|
|
138
|
+
.strictObject({
|
|
139
|
+
atomicBoundary: z.boolean(),
|
|
140
|
+
requestIdempotency: z.boolean(),
|
|
141
|
+
})
|
|
142
|
+
.optional(),
|
|
143
|
+
interactions: InteractionCapabilitiesSchema.optional(),
|
|
144
|
+
workspace: z.strictObject({
|
|
145
|
+
read: z.boolean(),
|
|
146
|
+
write: z.boolean(),
|
|
147
|
+
exec: z.boolean(),
|
|
148
|
+
git: z.boolean(),
|
|
149
|
+
upload: z.boolean(),
|
|
150
|
+
download: z.boolean(),
|
|
151
|
+
}),
|
|
152
|
+
branching: z.strictObject({
|
|
153
|
+
checkpoint: z.boolean(),
|
|
154
|
+
fork: z.boolean(),
|
|
155
|
+
retrySafe: z.boolean().optional(),
|
|
156
|
+
lookup: z.boolean().optional(),
|
|
157
|
+
cleanup: z.boolean().optional(),
|
|
158
|
+
}),
|
|
159
|
+
placement: z.boolean(),
|
|
160
|
+
usage: z.boolean(),
|
|
161
|
+
confidential: z.boolean(),
|
|
162
|
+
exactProcess: z
|
|
163
|
+
.strictObject({
|
|
164
|
+
egress: z
|
|
165
|
+
.array(z.enum(["blocked", "strict"]))
|
|
166
|
+
.min(1)
|
|
167
|
+
.max(CONTRACT_MAX_ARRAY_LENGTH),
|
|
168
|
+
})
|
|
169
|
+
.optional(),
|
|
170
|
+
})
|
|
171
|
+
.superRefine((capabilities, refinement) => {
|
|
172
|
+
if (capabilities.retainedControl !== undefined &&
|
|
173
|
+
(!capabilities.retainedControl.exactRunIdentity ||
|
|
174
|
+
!capabilities.retainedControl.resultIdentity ||
|
|
175
|
+
!capabilities.retainedControl.eventIdentity ||
|
|
176
|
+
!capabilities.retainedControl.cancellationIdempotency ||
|
|
177
|
+
!capabilities.streaming.replay ||
|
|
178
|
+
!capabilities.streaming.detach ||
|
|
179
|
+
!capabilities.streaming.turnIdempotency ||
|
|
180
|
+
!capabilities.sessions.continue)) {
|
|
181
|
+
refinement.addIssue({
|
|
182
|
+
code: "custom",
|
|
183
|
+
path: ["retainedControl"],
|
|
184
|
+
message: "retained control requires exact run, result, event, cancellation, replay, detach, turn, and session identity together",
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
if (capabilities.nativeContinuation !== undefined &&
|
|
188
|
+
(!capabilities.nativeContinuation.atomicBoundary ||
|
|
189
|
+
!capabilities.nativeContinuation.requestIdempotency ||
|
|
190
|
+
!capabilities.sessions.continue)) {
|
|
191
|
+
refinement.addIssue({
|
|
192
|
+
code: "custom",
|
|
193
|
+
path: ["nativeContinuation"],
|
|
194
|
+
message: "native continuation requires session continuation, atomic boundary admission, and request idempotency together",
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const durableBranching = [
|
|
198
|
+
capabilities.branching.retrySafe ?? false,
|
|
199
|
+
capabilities.branching.lookup ?? false,
|
|
200
|
+
capabilities.branching.cleanup ?? false,
|
|
201
|
+
];
|
|
202
|
+
if (durableBranching.some(Boolean) &&
|
|
203
|
+
(!durableBranching.every(Boolean) ||
|
|
204
|
+
!capabilities.branching.checkpoint ||
|
|
205
|
+
!capabilities.branching.fork)) {
|
|
206
|
+
refinement.addIssue({
|
|
207
|
+
code: "custom",
|
|
208
|
+
path: ["branching"],
|
|
209
|
+
message: "retry-safe branching requires checkpoint, fork, lookup, and cleanup together",
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const egress = capabilities.exactProcess?.egress;
|
|
213
|
+
if (egress && new Set(egress).size !== egress.length) {
|
|
214
|
+
refinement.addIssue({
|
|
215
|
+
code: "custom",
|
|
216
|
+
path: ["exactProcess", "egress"],
|
|
217
|
+
message: "exact process egress modes must be unique",
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
const extensions = capabilities.profile.extensions;
|
|
221
|
+
if (extensions && new Set(extensions).size !== extensions.length) {
|
|
222
|
+
refinement.addIssue({
|
|
223
|
+
code: "custom",
|
|
224
|
+
path: ["profile", "extensions"],
|
|
225
|
+
message: "profile extension namespaces must be unique",
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { AgentExecutionOutcome, PlanContinuation } from "./plan.js";
|
|
2
|
+
import type { InputPart } from "./parts.js";
|
|
3
|
+
import type { ProviderConfig } from "./provider-config.js";
|
|
4
|
+
import type { InteractionExecutionBinding } from "./interaction-envelope.js";
|
|
5
|
+
export type ToolInvocation = {
|
|
6
|
+
toolName: string;
|
|
7
|
+
input: unknown;
|
|
8
|
+
result?: unknown;
|
|
9
|
+
isError?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type TokenUsage = {
|
|
12
|
+
inputTokens: number;
|
|
13
|
+
outputTokens: number;
|
|
14
|
+
totalTokens?: number;
|
|
15
|
+
cacheReadInputTokens?: number;
|
|
16
|
+
cacheCreationInputTokens?: number;
|
|
17
|
+
reasoningTokens?: number;
|
|
18
|
+
cost?: number;
|
|
19
|
+
};
|
|
20
|
+
export type ExecutionTiming = {
|
|
21
|
+
startedAt: number;
|
|
22
|
+
completedAt: number;
|
|
23
|
+
durationMs: number;
|
|
24
|
+
};
|
|
25
|
+
export type AgentExecutionInput = {
|
|
26
|
+
message?: string;
|
|
27
|
+
parts?: InputPart[];
|
|
28
|
+
systemPrompt: string;
|
|
29
|
+
userId?: string;
|
|
30
|
+
traceId?: string;
|
|
31
|
+
sessionId?: string;
|
|
32
|
+
/** Exact run coordinates required when this turn can emit interactions. */
|
|
33
|
+
interactionBinding?: InteractionExecutionBinding;
|
|
34
|
+
workspaceRoot?: string;
|
|
35
|
+
abortSignal?: AbortSignal;
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
|
+
model?: ProviderConfig["model"];
|
|
38
|
+
turnId?: string;
|
|
39
|
+
planContinuation?: PlanContinuation;
|
|
40
|
+
};
|
|
41
|
+
export type AgentExecutionResult = {
|
|
42
|
+
outcome: AgentExecutionOutcome;
|
|
43
|
+
text: string;
|
|
44
|
+
toolInvocations: ToolInvocation[];
|
|
45
|
+
reasoning?: string[];
|
|
46
|
+
sessionId?: string;
|
|
47
|
+
metadata?: Record<string, unknown>;
|
|
48
|
+
tokenUsage?: TokenUsage;
|
|
49
|
+
timing?: ExecutionTiming;
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { BackendMessage } from "./backend-message.js";
|
|
2
|
+
import type { AgentExecutionResult } from "./execution-types.js";
|
|
3
|
+
import type { Part } from "./parts.js";
|
|
4
|
+
import type { SdkPlanHost } from "./plan.js";
|
|
5
|
+
import type { ProviderConfig } from "./provider-config.js";
|
|
6
|
+
export type MemoryEntry = {
|
|
7
|
+
id: string;
|
|
8
|
+
type: "summary" | "fact" | "note";
|
|
9
|
+
content: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
};
|
|
12
|
+
export type MemoryEntryInput = Omit<MemoryEntry, "id" | "createdAt">;
|
|
13
|
+
export interface SdkMemoryHost {
|
|
14
|
+
list(sessionId: string): Promise<MemoryEntry[]>;
|
|
15
|
+
remember(sessionId: string, entry: MemoryEntryInput): Promise<void>;
|
|
16
|
+
format(entries: MemoryEntry[]): string;
|
|
17
|
+
}
|
|
18
|
+
export type ToolExecutionContext = {
|
|
19
|
+
workspaceRoot?: string;
|
|
20
|
+
};
|
|
21
|
+
export type ToolDefinition = {
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
instruction?: string;
|
|
25
|
+
inputSchema: unknown;
|
|
26
|
+
inputSchemaJson: Record<string, unknown>;
|
|
27
|
+
outputSchema?: unknown;
|
|
28
|
+
outputSchemaJson?: Record<string, unknown>;
|
|
29
|
+
handler: (input: unknown, context: ToolExecutionContext) => Promise<unknown>;
|
|
30
|
+
};
|
|
31
|
+
export interface SdkToolHost {
|
|
32
|
+
buildPromptBlock(): string;
|
|
33
|
+
registerInstruction?(instruction: string, key?: string): void;
|
|
34
|
+
clear?(): void;
|
|
35
|
+
getRegisteredTools(): ToolDefinition[];
|
|
36
|
+
}
|
|
37
|
+
export interface SdkRecorder {
|
|
38
|
+
recordUserMessage(parts: BackendMessage["parts"]): Promise<void>;
|
|
39
|
+
appendAssistantParts(parts: BackendMessage["parts"]): Promise<void>;
|
|
40
|
+
setSessionId(sessionId?: string): Promise<void>;
|
|
41
|
+
recordAssistantPartUpdate?(part: Part, delta?: string): Promise<void>;
|
|
42
|
+
setTurnId?(turnId: string): void;
|
|
43
|
+
markTurnCompleted?(payload?: {
|
|
44
|
+
result?: Record<string, unknown>;
|
|
45
|
+
[extra: string]: unknown;
|
|
46
|
+
}): Promise<void>;
|
|
47
|
+
markTurnInterrupted?(payload?: {
|
|
48
|
+
reason?: string;
|
|
49
|
+
[extra: string]: unknown;
|
|
50
|
+
}): Promise<void>;
|
|
51
|
+
findCompletedTurn?(turnId: string): Promise<AgentExecutionResult | null>;
|
|
52
|
+
}
|
|
53
|
+
export type TraceEventInput = {
|
|
54
|
+
type: "message.part.updated";
|
|
55
|
+
part: Part;
|
|
56
|
+
delta?: string;
|
|
57
|
+
} | {
|
|
58
|
+
type: "message.updated";
|
|
59
|
+
text?: string;
|
|
60
|
+
finalText?: string;
|
|
61
|
+
tokenUsage?: Record<string, unknown>;
|
|
62
|
+
timing?: Record<string, unknown>;
|
|
63
|
+
toolInvocations?: unknown[];
|
|
64
|
+
metadata?: Record<string, unknown>;
|
|
65
|
+
} | {
|
|
66
|
+
type: "error";
|
|
67
|
+
category: "runtime" | "syntax" | "type" | "network" | "timeout" | "unknown";
|
|
68
|
+
message: string;
|
|
69
|
+
stack?: string;
|
|
70
|
+
code?: string;
|
|
71
|
+
source?: string;
|
|
72
|
+
} | {
|
|
73
|
+
type: "custom";
|
|
74
|
+
name: string;
|
|
75
|
+
data: Record<string, unknown>;
|
|
76
|
+
};
|
|
77
|
+
export interface SdkTraceContext {
|
|
78
|
+
addEvent(event: TraceEventInput): void;
|
|
79
|
+
addSignal(signal: string, metadata?: Record<string, unknown>): void;
|
|
80
|
+
complete(metadata?: Record<string, unknown>): void;
|
|
81
|
+
fail(error: string | Error, metadata?: Record<string, unknown>): void;
|
|
82
|
+
trackSubAgent?(childSessionId: string, agentType?: string): void;
|
|
83
|
+
}
|
|
84
|
+
export type SdkHostServices = {
|
|
85
|
+
memoryHost: SdkMemoryHost;
|
|
86
|
+
toolHost: SdkToolHost;
|
|
87
|
+
planHost: SdkPlanHost;
|
|
88
|
+
recorder: SdkRecorder;
|
|
89
|
+
providerConfig: ProviderConfig;
|
|
90
|
+
traceContext?: SdkTraceContext;
|
|
91
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|