@rowan-agent/agent 0.16.2 → 0.18.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 +12 -3
- package/dist/index.d.ts +373 -205
- package/dist/index.js +1821 -486
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _rowan_agent_models from '@rowan-agent/models';
|
|
2
|
-
import { LlmContentPart, ModelRef, ContentBlock, ModelConfig, StreamFn } from '@rowan-agent/models';
|
|
3
|
-
export { ModelConfig, ModelRef, StreamFn, ThinkingLevel } from '@rowan-agent/models';
|
|
2
|
+
import { LlmContentPart, ModelRef, ContentBlock, ScopeRef, ToolKind, ToolAnnotations, ToolCallStatus, ToolProgress, ToolCallContent, ToolCallLocation, JsonValue as JsonValue$1, JsonObject as JsonObject$1, ModelConfig, StreamFn, ThinkingLevel, ToolCall as ToolCall$1, ToolCallUpdate } from '@rowan-agent/models';
|
|
3
|
+
export { ModelConfig, ModelRef, ProviderCallContext, ProviderConfig, ProviderModelConfig, ProviderStreamFn, ScopeRef, StreamFn, ThinkingLevel, ToolAnnotations, ToolCall, ToolCallContent, ToolCallLocation, ToolCallOptions, ToolCallOutcome, ToolCallStatus, ToolCallUpdate, ToolDefinitionSummary, ToolKind, ToolProgress } from '@rowan-agent/models';
|
|
4
4
|
import Type from 'typebox';
|
|
5
5
|
|
|
6
6
|
type AgentMessage = {
|
|
@@ -53,6 +53,8 @@ type ToolResult = {
|
|
|
53
53
|
ok: boolean;
|
|
54
54
|
content: unknown;
|
|
55
55
|
error?: string;
|
|
56
|
+
structuredContent?: unknown;
|
|
57
|
+
isError?: boolean;
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
type PhaseRegistrySelection = Readonly<{
|
|
@@ -206,15 +208,25 @@ type PhaseMessageManager = {
|
|
|
206
208
|
discard(messageId: string): void;
|
|
207
209
|
};
|
|
208
210
|
|
|
209
|
-
type
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
211
|
+
type UiSlot = "settings" | "model-picker";
|
|
212
|
+
type UiContribution = {
|
|
213
|
+
slot: "settings";
|
|
214
|
+
id: string;
|
|
215
|
+
title: string;
|
|
216
|
+
description?: string;
|
|
217
|
+
settings: SettingsDefinition;
|
|
214
218
|
} | {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
219
|
+
slot: "model-picker";
|
|
220
|
+
id: string;
|
|
221
|
+
provider: string;
|
|
222
|
+
status?: {
|
|
223
|
+
kind: "ready" | "needs-setup" | "error";
|
|
224
|
+
message?: string;
|
|
225
|
+
};
|
|
226
|
+
actions?: {
|
|
227
|
+
id: string;
|
|
228
|
+
label: string;
|
|
229
|
+
}[];
|
|
218
230
|
};
|
|
219
231
|
interface ExtensionStateStore {
|
|
220
232
|
get(key: string): Promise<JsonValue | undefined>;
|
|
@@ -227,6 +239,9 @@ interface ExtensionHost {
|
|
|
227
239
|
getAgentState(extensionId: string, agentId: string, key: string): Promise<JsonValue | undefined> | JsonValue | undefined;
|
|
228
240
|
setAgentState(extensionId: string, agentId: string, key: string, value: JsonValue): Promise<void> | void;
|
|
229
241
|
deleteAgentState(extensionId: string, agentId: string, key: string): Promise<void> | void;
|
|
242
|
+
getGlobalState(extensionId: string, key: string): Promise<JsonValue | undefined> | JsonValue | undefined;
|
|
243
|
+
setGlobalState(extensionId: string, key: string, value: JsonValue): Promise<void> | void;
|
|
244
|
+
deleteGlobalState(extensionId: string, key: string): Promise<void> | void;
|
|
230
245
|
}
|
|
231
246
|
type ExtensionToolContribution = {
|
|
232
247
|
kind: "tool";
|
|
@@ -248,11 +263,11 @@ interface SourceInfo {
|
|
|
248
263
|
/** Register a Phase by directory path or Phase object; PHASE.md and direct child Skills are loaded atomically when a path is supplied. */
|
|
249
264
|
type PhaseRegistration = string | Phase;
|
|
250
265
|
/**
|
|
251
|
-
* Tool definition for registering LLM-callable tools via `api.
|
|
266
|
+
* Tool definition for registering LLM-callable tools via `api.tools.register()`.
|
|
252
267
|
*
|
|
253
268
|
* @example
|
|
254
269
|
* ```typescript
|
|
255
|
-
* api.
|
|
270
|
+
* api.tools.register({
|
|
256
271
|
* name: "search_docs",
|
|
257
272
|
* description: "Search documentation",
|
|
258
273
|
* parameters: { type: "object", properties: { query: { type: "string" } } },
|
|
@@ -273,24 +288,31 @@ interface ToolDefinition {
|
|
|
273
288
|
promptSnippet?: string;
|
|
274
289
|
/** Optional: additional guidelines appended to system prompt */
|
|
275
290
|
promptGuidelines?: string[];
|
|
291
|
+
kind?: ToolKind;
|
|
292
|
+
annotations?: ToolAnnotations;
|
|
293
|
+
_meta?: JsonObject;
|
|
294
|
+
present?: (call: {
|
|
295
|
+
status: ToolCallStatus;
|
|
296
|
+
args: JsonValue;
|
|
297
|
+
progress?: ToolProgress;
|
|
298
|
+
result?: ToolExecutionResult;
|
|
299
|
+
}) => {
|
|
300
|
+
title?: string;
|
|
301
|
+
content?: ToolCallContent[];
|
|
302
|
+
locations?: ToolCallLocation[];
|
|
303
|
+
_meta?: JsonObject;
|
|
304
|
+
} | undefined | void | Promise<{
|
|
305
|
+
title?: string;
|
|
306
|
+
content?: ToolCallContent[];
|
|
307
|
+
locations?: ToolCallLocation[];
|
|
308
|
+
_meta?: JsonObject;
|
|
309
|
+
} | undefined | void>;
|
|
276
310
|
/** Execute the tool */
|
|
277
|
-
execute: (args: unknown, context: ToolInvocationContext, signal?: AbortSignal) => Promise<ToolExecutionResult
|
|
311
|
+
execute: (args: unknown, context: ToolInvocationContext, signal?: AbortSignal) => Promise<ToolExecutionResult>;
|
|
278
312
|
/** Optional: per-tool execution mode override */
|
|
279
313
|
executionMode?: "sequential" | "parallel";
|
|
280
314
|
}
|
|
281
|
-
|
|
282
|
-
* Result from tool execution.
|
|
283
|
-
*/
|
|
284
|
-
interface ToolExecutionResult$1 {
|
|
285
|
-
/** Content blocks to return to the LLM */
|
|
286
|
-
content: Array<{
|
|
287
|
-
type: string;
|
|
288
|
-
text?: string;
|
|
289
|
-
[key: string]: unknown;
|
|
290
|
-
}>;
|
|
291
|
-
/** Whether this is an error result */
|
|
292
|
-
isError?: boolean;
|
|
293
|
-
}
|
|
315
|
+
|
|
294
316
|
/**
|
|
295
317
|
* Registered tool with source metadata.
|
|
296
318
|
*/
|
|
@@ -417,7 +439,7 @@ interface EventBus {
|
|
|
417
439
|
*
|
|
418
440
|
* @example
|
|
419
441
|
* ```typescript
|
|
420
|
-
* api.on("before_tool_call", (event, ctx) => {
|
|
442
|
+
* api.hooks.on("before_tool_call", (event, ctx) => {
|
|
421
443
|
* console.log(`cwd: ${ctx.cwd}`);
|
|
422
444
|
* if (ctx.isIdle()) { ... }
|
|
423
445
|
* });
|
|
@@ -502,15 +524,18 @@ interface ExtensionUtils {
|
|
|
502
524
|
* ```
|
|
503
525
|
*/
|
|
504
526
|
interface ExtensionAPI {
|
|
505
|
-
/**
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
527
|
+
/** Hook events — subscribe or unsubscribe. */
|
|
528
|
+
hooks: {
|
|
529
|
+
/**
|
|
530
|
+
* Subscribe to a hook event.
|
|
531
|
+
*
|
|
532
|
+
* @param eventType - Hook type, e.g. "before_tool_call"
|
|
533
|
+
* @param handler - Hook handler, can return result to modify behavior
|
|
534
|
+
*/
|
|
535
|
+
on<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
536
|
+
/** Unsubscribe from a hook event. */
|
|
537
|
+
off<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
538
|
+
};
|
|
514
539
|
/** Extension configuration — read own layered config or listen for changes. */
|
|
515
540
|
config: {
|
|
516
541
|
/** Get the extension's own effective configuration block. */
|
|
@@ -518,15 +543,17 @@ interface ExtensionAPI {
|
|
|
518
543
|
/** Listen for configuration changes for a scope. */
|
|
519
544
|
changed(handler: (scope: ScopeRef) => void): void;
|
|
520
545
|
};
|
|
521
|
-
/** Extension state — scoped to run (in-memory) or agent (durable). */
|
|
546
|
+
/** Extension state — scoped to run (in-memory) or agent (durable) or global (durable). */
|
|
522
547
|
state: {
|
|
523
548
|
/** Run-scoped in-memory state; dropped when the Run ends. */
|
|
524
549
|
run(runId: string): ExtensionStateStore;
|
|
525
550
|
/** Agent-scoped durable state; persisted with the Agent record. */
|
|
526
551
|
agent(agentId: string): ExtensionStateStore;
|
|
552
|
+
/** Extension-scoped durable state; survives process restarts. */
|
|
553
|
+
global(): ExtensionStateStore;
|
|
527
554
|
};
|
|
528
555
|
/** Tool capabilities — register and unregister custom tools. */
|
|
529
|
-
|
|
556
|
+
tools: {
|
|
530
557
|
/** Register a custom LLM-callable tool. */
|
|
531
558
|
register(tool: ToolDefinition): void;
|
|
532
559
|
/** Unregister a previously registered tool by name. */
|
|
@@ -537,20 +564,15 @@ interface ExtensionAPI {
|
|
|
537
564
|
/** Contribute a capability to the host. Returns a disposer to remove the contribution. */
|
|
538
565
|
contribute(contribution: ExtensionCapabilityContribution): () => void;
|
|
539
566
|
};
|
|
540
|
-
/**
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
utils: ExtensionUtils;
|
|
548
|
-
/** Runtime context — cwd, signal, exec, message access, etc. */
|
|
549
|
-
context: ExtensionContext;
|
|
550
|
-
/** Shared event bus for inter-extension communication. */
|
|
551
|
-
events: EventBus;
|
|
567
|
+
/** Model provider registration. */
|
|
568
|
+
providers: {
|
|
569
|
+
/** Register a model provider. Registering with an existing id replaces it. */
|
|
570
|
+
register(config: _rowan_agent_models.ProviderConfig): void;
|
|
571
|
+
/** Unregister a model provider by id. */
|
|
572
|
+
unregister(id: string): void;
|
|
573
|
+
};
|
|
552
574
|
/** Phase execution capabilities — provides Phase In/Out, phase identity, phase routing, and registration. */
|
|
553
|
-
|
|
575
|
+
phases: {
|
|
554
576
|
/** Register a Phase directory bundle or Phase object. */
|
|
555
577
|
register(phase: PhaseRegistration): Promise<void>;
|
|
556
578
|
/** Unregister a previously registered phase by name. */
|
|
@@ -569,11 +591,20 @@ interface ExtensionAPI {
|
|
|
569
591
|
getNextPhase(): string | undefined;
|
|
570
592
|
/** Get the message set by setMessage */
|
|
571
593
|
getMessage(): string | undefined;
|
|
572
|
-
/** Phase Settings contributions registered by the Phase extension. */
|
|
573
|
-
settings: {
|
|
574
|
-
register(provider: PhaseSettingsProvider): void;
|
|
575
|
-
};
|
|
576
594
|
};
|
|
595
|
+
/** Declarative UI contributions — settings or model picker decorations. */
|
|
596
|
+
ui: {
|
|
597
|
+
/** Contribute declarative UI to a host slot. Returns a disposer to remove the contribution. */
|
|
598
|
+
contribute(contribution: UiContribution): () => void;
|
|
599
|
+
};
|
|
600
|
+
/** Extension manifest from package.json `rowan` field. */
|
|
601
|
+
manifest?: ExtensionManifest;
|
|
602
|
+
/** Utility functions. */
|
|
603
|
+
utils: ExtensionUtils;
|
|
604
|
+
/** Runtime context — cwd, signal, exec, message access, etc. */
|
|
605
|
+
context: ExtensionContext;
|
|
606
|
+
/** Shared event bus for inter-extension communication. */
|
|
607
|
+
events: EventBus;
|
|
577
608
|
}
|
|
578
609
|
/**
|
|
579
610
|
* Extension factory function.
|
|
@@ -586,10 +617,12 @@ type ExtensionFactory = (api: ExtensionAPI) => ExtensionFactoryResult | Promise<
|
|
|
586
617
|
declare class InMemoryExtensionHost implements ExtensionHost {
|
|
587
618
|
private readonly configs;
|
|
588
619
|
private readonly agentState;
|
|
620
|
+
private readonly globalState;
|
|
589
621
|
private readonly listeners;
|
|
590
622
|
constructor(options?: {
|
|
591
623
|
configs?: Record<string, Record<string, JsonObject>>;
|
|
592
624
|
agentState?: Record<string, Record<string, Record<string, JsonValue>>>;
|
|
625
|
+
globalState?: Record<string, Record<string, JsonValue>>;
|
|
593
626
|
});
|
|
594
627
|
setConfig(extensionId: string, config: JsonObject | null, scope?: ScopeRef): void;
|
|
595
628
|
getConfig(extensionId: string, scope?: ScopeRef): JsonObject | null;
|
|
@@ -598,6 +631,9 @@ declare class InMemoryExtensionHost implements ExtensionHost {
|
|
|
598
631
|
getAgentState(extensionId: string, agentId: string, key: string): JsonValue | undefined;
|
|
599
632
|
setAgentState(extensionId: string, agentId: string, key: string, value: JsonValue): void;
|
|
600
633
|
deleteAgentState(extensionId: string, agentId: string, key: string): void;
|
|
634
|
+
getGlobalState(extensionId: string, key: string): JsonValue | undefined;
|
|
635
|
+
setGlobalState(extensionId: string, key: string, value: JsonValue): void;
|
|
636
|
+
deleteGlobalState(extensionId: string, key: string): void;
|
|
601
637
|
}
|
|
602
638
|
|
|
603
639
|
/**
|
|
@@ -664,6 +700,7 @@ declare class ExtensionRunner {
|
|
|
664
700
|
private bound;
|
|
665
701
|
private readonly errorListeners;
|
|
666
702
|
private readonly capabilityListeners;
|
|
703
|
+
private readonly uiContributionListeners;
|
|
667
704
|
/** Current agent context — set by the agent before each phase */
|
|
668
705
|
currentContext?: AgentContext;
|
|
669
706
|
constructor(options?: ExtensionRunnerOptions);
|
|
@@ -729,6 +766,18 @@ declare class ExtensionRunner {
|
|
|
729
766
|
* Returns an unsubscribe function.
|
|
730
767
|
*/
|
|
731
768
|
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
769
|
+
/** Get all contributed UI elements across all extensions. */
|
|
770
|
+
getUiContributions(): readonly UiContribution[];
|
|
771
|
+
/**
|
|
772
|
+
* Subscribe to UI contribution changes (contributions added, removed, or extensions disposed).
|
|
773
|
+
* Returns an unsubscribe function.
|
|
774
|
+
*/
|
|
775
|
+
onUiContributionsChanged(listener: (contributions: readonly UiContribution[]) => void): () => void;
|
|
776
|
+
triggerUiAction(event: {
|
|
777
|
+
contributionId: string;
|
|
778
|
+
actionId: string;
|
|
779
|
+
scope?: ScopeRef;
|
|
780
|
+
}): void;
|
|
732
781
|
getPhase(name: string): Phase | undefined;
|
|
733
782
|
getPhases(): Phase[];
|
|
734
783
|
createPhaseRegistry(input?: {
|
|
@@ -798,6 +847,8 @@ declare class ExtensionRunner {
|
|
|
798
847
|
private unregisterTool;
|
|
799
848
|
private contributeCapability;
|
|
800
849
|
private notifyCapabilitiesChanged;
|
|
850
|
+
private contributeUi;
|
|
851
|
+
private notifyUiContributionsChanged;
|
|
801
852
|
private registerPhase;
|
|
802
853
|
private registerPhaseDefinition;
|
|
803
854
|
private unregisterPhase;
|
|
@@ -811,6 +862,40 @@ declare class ExtensionRunner {
|
|
|
811
862
|
private disposeExtension;
|
|
812
863
|
}
|
|
813
864
|
|
|
865
|
+
type ToolCallPresentationInput = Readonly<{
|
|
866
|
+
status: ToolCallStatus;
|
|
867
|
+
args: JsonValue$1;
|
|
868
|
+
progress?: ToolProgress;
|
|
869
|
+
result?: ToolExecutionResult;
|
|
870
|
+
}>;
|
|
871
|
+
type ToolCallPresentationOutput = {
|
|
872
|
+
title?: string;
|
|
873
|
+
content?: ToolCallContent[];
|
|
874
|
+
locations?: ToolCallLocation[];
|
|
875
|
+
_meta?: JsonObject$1;
|
|
876
|
+
};
|
|
877
|
+
type ToolCallMergeTarget = {
|
|
878
|
+
title?: string;
|
|
879
|
+
kind?: ToolKind;
|
|
880
|
+
status?: ToolCallStatus;
|
|
881
|
+
locations?: ToolCallLocation[];
|
|
882
|
+
content?: ToolCallContent[];
|
|
883
|
+
rawInput?: JsonValue$1;
|
|
884
|
+
rawOutput?: JsonValue$1;
|
|
885
|
+
_meta?: JsonObject$1;
|
|
886
|
+
};
|
|
887
|
+
type ToolCallMergePatch = {
|
|
888
|
+
title?: string;
|
|
889
|
+
kind?: ToolKind;
|
|
890
|
+
status?: ToolCallStatus;
|
|
891
|
+
locations?: ToolCallLocation[];
|
|
892
|
+
content?: ToolCallContent[];
|
|
893
|
+
rawInput?: JsonValue$1;
|
|
894
|
+
rawOutput?: JsonValue$1;
|
|
895
|
+
_meta?: JsonObject$1;
|
|
896
|
+
};
|
|
897
|
+
declare function mergeToolCall<T extends ToolCallMergeTarget>(target: T, patch: ToolCallMergePatch): T;
|
|
898
|
+
|
|
814
899
|
type ExtensionContribution = LoadedExtension;
|
|
815
900
|
type ExtensionLoadInput = LoadInput<ExtensionContribution>;
|
|
816
901
|
type ExtensionActivationError = Readonly<{
|
|
@@ -911,6 +996,7 @@ declare function isConfigurationSnapshot(config: AgentConfiguration | Configurat
|
|
|
911
996
|
type UserInput = string | Readonly<{
|
|
912
997
|
content: UserContent;
|
|
913
998
|
metadata?: Metadata;
|
|
999
|
+
thinkingLevel?: ThinkingLevel;
|
|
914
1000
|
}>;
|
|
915
1001
|
type HistorySeed = readonly Message[];
|
|
916
1002
|
type ContextStatus = Readonly<{
|
|
@@ -946,13 +1032,16 @@ type ToolCallContext = Readonly<{
|
|
|
946
1032
|
agentMetadata?: Metadata;
|
|
947
1033
|
runMetadata?: Metadata;
|
|
948
1034
|
toolCallId: ToolCallId;
|
|
1035
|
+
/** The model's id for this call, matching `tool_call_delta` events; absent when a host runs the tool itself. */
|
|
1036
|
+
providerToolCallId?: string;
|
|
949
1037
|
scope?: ScopeRef;
|
|
950
1038
|
turn?: JsonObject;
|
|
951
|
-
reportProgress(progress:
|
|
1039
|
+
reportProgress(progress: ToolProgress): void;
|
|
952
1040
|
}>;
|
|
953
1041
|
type ToolInvocationContext = ToolCallContext & Readonly<{
|
|
954
1042
|
interaction: RunInteractionDriver;
|
|
955
1043
|
}>;
|
|
1044
|
+
|
|
956
1045
|
type Tool$1 = Readonly<{
|
|
957
1046
|
name: string;
|
|
958
1047
|
/** Rowan-owned Core Tool; Core Tools bypass Definition/Phase filtering. */
|
|
@@ -961,6 +1050,20 @@ type Tool$1 = Readonly<{
|
|
|
961
1050
|
parameters: Type.TSchema;
|
|
962
1051
|
promptSnippet?: string;
|
|
963
1052
|
promptGuidelines?: readonly string[];
|
|
1053
|
+
kind?: ToolKind;
|
|
1054
|
+
annotations?: ToolAnnotations;
|
|
1055
|
+
_meta?: JsonObject;
|
|
1056
|
+
present?(call: ToolCallPresentationInput): {
|
|
1057
|
+
title?: string;
|
|
1058
|
+
content?: ToolCallContent[];
|
|
1059
|
+
locations?: ToolCallLocation[];
|
|
1060
|
+
_meta?: JsonObject;
|
|
1061
|
+
} | undefined | void | Promise<{
|
|
1062
|
+
title?: string;
|
|
1063
|
+
content?: ToolCallContent[];
|
|
1064
|
+
locations?: ToolCallLocation[];
|
|
1065
|
+
_meta?: JsonObject;
|
|
1066
|
+
} | undefined | void>;
|
|
964
1067
|
execute(args: JsonValue, context: ToolInvocationContext, signal: AbortSignal): Promise<ToolExecutionResult>;
|
|
965
1068
|
}>;
|
|
966
1069
|
type ContextCandidate = Readonly<{
|
|
@@ -1039,6 +1142,11 @@ type ToolCallReservation = Readonly<{
|
|
|
1039
1142
|
name: string;
|
|
1040
1143
|
args: JsonValue;
|
|
1041
1144
|
toolCallId?: ToolCallId;
|
|
1145
|
+
title?: string;
|
|
1146
|
+
kind?: ToolKind;
|
|
1147
|
+
locations?: ToolCallLocation[];
|
|
1148
|
+
content?: ToolCallContent[];
|
|
1149
|
+
_meta?: JsonObject;
|
|
1042
1150
|
}>;
|
|
1043
1151
|
type ToolCommit = Readonly<{
|
|
1044
1152
|
run: RunRecord;
|
|
@@ -1060,6 +1168,8 @@ type RunRecord = Readonly<{
|
|
|
1060
1168
|
revision: number;
|
|
1061
1169
|
state: RunState;
|
|
1062
1170
|
input: UserInput;
|
|
1171
|
+
scope?: ScopeRef;
|
|
1172
|
+
cwd?: string;
|
|
1063
1173
|
initialMessageId?: MessageId;
|
|
1064
1174
|
invalidatedBy?: Readonly<{
|
|
1065
1175
|
messageId: MessageId;
|
|
@@ -1123,6 +1233,8 @@ type RunSnapshotBase = Readonly<{
|
|
|
1123
1233
|
agentSequence: number;
|
|
1124
1234
|
revision: number;
|
|
1125
1235
|
input: UserInput;
|
|
1236
|
+
scope?: ScopeRef;
|
|
1237
|
+
cwd?: string;
|
|
1126
1238
|
metadata?: Metadata;
|
|
1127
1239
|
/** Effective entry Phase payload the Run started with (defaults filled). */
|
|
1128
1240
|
phasePayload?: JsonValue;
|
|
@@ -1137,6 +1249,7 @@ type RunSnapshotBase = Readonly<{
|
|
|
1137
1249
|
type RunSnapshot = RunSnapshotBase & (Readonly<{
|
|
1138
1250
|
state: "queued" | "running";
|
|
1139
1251
|
currentPhaseId?: string;
|
|
1252
|
+
interactions?: readonly RunInteraction[];
|
|
1140
1253
|
}> | Readonly<{
|
|
1141
1254
|
state: "input_required";
|
|
1142
1255
|
interactions: readonly RunInteraction[];
|
|
@@ -1233,6 +1346,8 @@ interface OwnedStore {
|
|
|
1233
1346
|
agentId: AgentId;
|
|
1234
1347
|
input: UserInput;
|
|
1235
1348
|
metadata?: Metadata;
|
|
1349
|
+
scope?: ScopeRef;
|
|
1350
|
+
cwd?: string;
|
|
1236
1351
|
phasePayload?: JsonValue;
|
|
1237
1352
|
entryPhases?: readonly EntryPhaseSpec[];
|
|
1238
1353
|
pinnedConfigToken?: ConfigToken;
|
|
@@ -1298,6 +1413,11 @@ interface OwnedStore {
|
|
|
1298
1413
|
args: JsonValue;
|
|
1299
1414
|
toolCallId?: ToolCallId;
|
|
1300
1415
|
providerToolCallId?: string;
|
|
1416
|
+
title?: string;
|
|
1417
|
+
kind?: ToolKind;
|
|
1418
|
+
locations?: ToolCallLocation[];
|
|
1419
|
+
content?: ToolCallContent[];
|
|
1420
|
+
_meta?: JsonObject;
|
|
1301
1421
|
}): Promise<ToolCommit>;
|
|
1302
1422
|
reserveToolCalls(input: {
|
|
1303
1423
|
runId: RunId;
|
|
@@ -1313,6 +1433,11 @@ interface OwnedStore {
|
|
|
1313
1433
|
execution: ExecutionToken;
|
|
1314
1434
|
expectedRevision: number;
|
|
1315
1435
|
toolCallId: ToolCallId;
|
|
1436
|
+
title?: string;
|
|
1437
|
+
kind?: ToolKind;
|
|
1438
|
+
locations?: ToolCallLocation[];
|
|
1439
|
+
content?: ToolCallContent[];
|
|
1440
|
+
_meta?: JsonObject;
|
|
1316
1441
|
}): Promise<ToolCommit>;
|
|
1317
1442
|
suspendToolCall(input: {
|
|
1318
1443
|
runId: RunId;
|
|
@@ -1328,6 +1453,12 @@ interface OwnedStore {
|
|
|
1328
1453
|
result: ToolExecutionResult;
|
|
1329
1454
|
state: "completed" | "failed" | "indeterminate";
|
|
1330
1455
|
reason?: string;
|
|
1456
|
+
title?: string;
|
|
1457
|
+
kind?: ToolKind;
|
|
1458
|
+
content?: ToolCallContent[];
|
|
1459
|
+
locations?: ToolCallLocation[];
|
|
1460
|
+
rawOutput?: JsonValue;
|
|
1461
|
+
_meta?: JsonObject;
|
|
1331
1462
|
}): Promise<ToolCommit>;
|
|
1332
1463
|
cancelRun(input: {
|
|
1333
1464
|
runId: RunId;
|
|
@@ -1335,6 +1466,12 @@ interface OwnedStore {
|
|
|
1335
1466
|
reason?: string;
|
|
1336
1467
|
output?: AssistantMessage;
|
|
1337
1468
|
}): Promise<RunRecord>;
|
|
1469
|
+
recordToolCall(input: {
|
|
1470
|
+
runId: RunId;
|
|
1471
|
+
execution?: ExecutionToken;
|
|
1472
|
+
update: ToolCall$1 | ToolCallUpdate;
|
|
1473
|
+
external?: boolean;
|
|
1474
|
+
}): Promise<DurableRunEvent>;
|
|
1338
1475
|
snapshotRun(runId: RunId): Promise<RunSnapshot>;
|
|
1339
1476
|
history(agentId: AgentId): Promise<readonly Message[]>;
|
|
1340
1477
|
listAgents(): Promise<readonly AgentRecord[]>;
|
|
@@ -1365,6 +1502,8 @@ type AgentRuntimeOptions = Readonly<{
|
|
|
1365
1502
|
concurrency?: number;
|
|
1366
1503
|
bootstrap?: (registry: RuntimeBootstrapRegistry) => void | Promise<void>;
|
|
1367
1504
|
host?: ExtensionHost;
|
|
1505
|
+
/** @internal Private / testing parameter to override retry delay */
|
|
1506
|
+
retryDelayMs?: number;
|
|
1368
1507
|
}>;
|
|
1369
1508
|
type DurableConsumer = Readonly<{
|
|
1370
1509
|
caughtUp: Promise<void>;
|
|
@@ -1424,6 +1563,8 @@ interface AgentRuntime$1 {
|
|
|
1424
1563
|
start(agentId: AgentId, input: UserInput, options: {
|
|
1425
1564
|
idempotencyKey: string;
|
|
1426
1565
|
metadata?: Metadata;
|
|
1566
|
+
scope?: ScopeRef;
|
|
1567
|
+
cwd?: string;
|
|
1427
1568
|
phasePayload?: JsonValue;
|
|
1428
1569
|
entryPhases?: ReadonlyArray<EntryPhaseSpec>;
|
|
1429
1570
|
}): Promise<AgentRun>;
|
|
@@ -1459,6 +1600,13 @@ interface AgentRuntime$1 {
|
|
|
1459
1600
|
}): Promise<DurableConsumer>;
|
|
1460
1601
|
listCapabilities(): readonly ExtensionCapability[];
|
|
1461
1602
|
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
1603
|
+
listUiContributions(): readonly UiContribution[];
|
|
1604
|
+
onUiContributionsChanged(listener: (contributions: readonly UiContribution[]) => void): () => void;
|
|
1605
|
+
triggerUiAction(event: {
|
|
1606
|
+
contributionId: string;
|
|
1607
|
+
actionId: string;
|
|
1608
|
+
scope?: ScopeRef;
|
|
1609
|
+
}): void;
|
|
1462
1610
|
close(): Promise<void>;
|
|
1463
1611
|
}
|
|
1464
1612
|
type ConsumerRegistration = Readonly<{
|
|
@@ -1561,7 +1709,7 @@ type RunInteractionDriver = Readonly<{
|
|
|
1561
1709
|
}>;
|
|
1562
1710
|
declare class RunInteractionCancelledError extends Error {
|
|
1563
1711
|
readonly code: "run_interaction_cancelled";
|
|
1564
|
-
constructor();
|
|
1712
|
+
constructor(message?: string);
|
|
1565
1713
|
}
|
|
1566
1714
|
declare class RunInteractionBoundary extends Error {
|
|
1567
1715
|
readonly state: ExecutionState;
|
|
@@ -1616,10 +1764,20 @@ type ToolUseContent = Readonly<{
|
|
|
1616
1764
|
type ToolExecutionResult = Readonly<{
|
|
1617
1765
|
ok: true;
|
|
1618
1766
|
content: JsonValue;
|
|
1767
|
+
structuredContent?: JsonValue;
|
|
1768
|
+
isError?: boolean;
|
|
1619
1769
|
}> | Readonly<{
|
|
1620
1770
|
ok: false;
|
|
1621
1771
|
content: JsonValue;
|
|
1622
1772
|
error: string;
|
|
1773
|
+
structuredContent?: JsonValue;
|
|
1774
|
+
isError?: boolean;
|
|
1775
|
+
}> | Readonly<{
|
|
1776
|
+
content: readonly ContentBlock[];
|
|
1777
|
+
structuredContent?: JsonValue;
|
|
1778
|
+
isError?: boolean;
|
|
1779
|
+
ok?: boolean;
|
|
1780
|
+
error?: string;
|
|
1623
1781
|
}>;
|
|
1624
1782
|
type DurableToolResult = Readonly<{
|
|
1625
1783
|
toolCallId: ToolCallId;
|
|
@@ -1683,9 +1841,14 @@ type Outcome = Readonly<{
|
|
|
1683
1841
|
toolResults?: readonly DurableToolResult[];
|
|
1684
1842
|
}>;
|
|
1685
1843
|
type RunState = "queued" | "running" | "input_required" | "completed" | "failed" | "cancelled";
|
|
1844
|
+
type WithdrawnUserInput = Readonly<{
|
|
1845
|
+
messageId: MessageId;
|
|
1846
|
+
content: UserContent;
|
|
1847
|
+
}>;
|
|
1686
1848
|
type RunFailure = Readonly<{
|
|
1687
1849
|
code: "configuration_unavailable";
|
|
1688
1850
|
message: string;
|
|
1851
|
+
withdrawnInput?: WithdrawnUserInput;
|
|
1689
1852
|
}> | Readonly<{
|
|
1690
1853
|
code: "checkpoint_incompatible";
|
|
1691
1854
|
message: string;
|
|
@@ -1697,18 +1860,22 @@ type RunFailure = Readonly<{
|
|
|
1697
1860
|
codec: string;
|
|
1698
1861
|
version: number;
|
|
1699
1862
|
}>;
|
|
1863
|
+
withdrawnInput?: WithdrawnUserInput;
|
|
1700
1864
|
}> | Readonly<{
|
|
1701
1865
|
code: "runtime_interrupted";
|
|
1702
1866
|
message: string;
|
|
1703
1867
|
ownerEpoch: number;
|
|
1868
|
+
withdrawnInput?: WithdrawnUserInput;
|
|
1704
1869
|
}> | Readonly<{
|
|
1705
1870
|
code: "tool_indeterminate";
|
|
1706
1871
|
message: string;
|
|
1707
1872
|
toolCallIds: readonly [ToolCallId, ...ToolCallId[]];
|
|
1873
|
+
withdrawnInput?: WithdrawnUserInput;
|
|
1708
1874
|
}> | Readonly<{
|
|
1709
1875
|
code: "execution_failed";
|
|
1710
1876
|
message: string;
|
|
1711
1877
|
details?: JsonValue;
|
|
1878
|
+
withdrawnInput?: WithdrawnUserInput;
|
|
1712
1879
|
}>;
|
|
1713
1880
|
type QueuedRunFailure = Extract<RunFailure, {
|
|
1714
1881
|
code: "configuration_unavailable" | "checkpoint_incompatible";
|
|
@@ -1716,43 +1883,24 @@ type QueuedRunFailure = Extract<RunFailure, {
|
|
|
1716
1883
|
type RunningRunFailure = Extract<RunFailure, {
|
|
1717
1884
|
code: "runtime_interrupted" | "tool_indeterminate" | "execution_failed";
|
|
1718
1885
|
}>;
|
|
1719
|
-
type ToolCallState =
|
|
1720
|
-
type
|
|
1886
|
+
type ToolCallState = ToolCallStatus;
|
|
1887
|
+
type ToolCallSnapshot = ToolCall$1 & Readonly<{
|
|
1721
1888
|
id: ToolCallId;
|
|
1722
|
-
providerToolCallId
|
|
1723
|
-
agentId
|
|
1724
|
-
runId
|
|
1725
|
-
executionId
|
|
1726
|
-
requestMessageId
|
|
1727
|
-
name
|
|
1728
|
-
args
|
|
1729
|
-
|
|
1730
|
-
|
|
1889
|
+
providerToolCallId?: string;
|
|
1890
|
+
agentId?: AgentId;
|
|
1891
|
+
runId?: RunId;
|
|
1892
|
+
executionId?: ExecutionId;
|
|
1893
|
+
requestMessageId?: MessageId;
|
|
1894
|
+
name?: string;
|
|
1895
|
+
args?: JsonValue;
|
|
1896
|
+
state?: ToolCallStatus;
|
|
1897
|
+
result?: DurableToolResult;
|
|
1898
|
+
resultMessageId?: MessageId;
|
|
1899
|
+
reason?: string;
|
|
1900
|
+
external?: boolean;
|
|
1901
|
+
createdAt?: string;
|
|
1902
|
+
updatedAt?: string;
|
|
1731
1903
|
}>;
|
|
1732
|
-
type ToolCallSnapshot = ToolCallSnapshotBase & (Readonly<{
|
|
1733
|
-
state: "pending";
|
|
1734
|
-
}> | Readonly<{
|
|
1735
|
-
state: "running";
|
|
1736
|
-
}> | Readonly<{
|
|
1737
|
-
state: "completed";
|
|
1738
|
-
result: DurableToolResult & Readonly<{
|
|
1739
|
-
ok: true;
|
|
1740
|
-
}>;
|
|
1741
|
-
resultMessageId: MessageId;
|
|
1742
|
-
}> | Readonly<{
|
|
1743
|
-
state: "failed";
|
|
1744
|
-
result: DurableToolResult & Readonly<{
|
|
1745
|
-
ok: false;
|
|
1746
|
-
}>;
|
|
1747
|
-
resultMessageId: MessageId;
|
|
1748
|
-
}> | Readonly<{
|
|
1749
|
-
state: "indeterminate";
|
|
1750
|
-
result: DurableToolResult & Readonly<{
|
|
1751
|
-
ok: false;
|
|
1752
|
-
}>;
|
|
1753
|
-
resultMessageId: MessageId;
|
|
1754
|
-
reason: string;
|
|
1755
|
-
}>);
|
|
1756
1904
|
type DurableEventBase = Readonly<{
|
|
1757
1905
|
id: EventId;
|
|
1758
1906
|
schemaVersion: 1;
|
|
@@ -1811,91 +1959,42 @@ type RunStateChanged = DurableEventBase & (Readonly<{
|
|
|
1811
1959
|
from: "queued";
|
|
1812
1960
|
to: "failed";
|
|
1813
1961
|
failure: QueuedRunFailure;
|
|
1962
|
+
withdrawnInput?: WithdrawnUserInput;
|
|
1814
1963
|
}> | Readonly<{
|
|
1815
1964
|
kind: "run_state_changed";
|
|
1816
1965
|
from: "running";
|
|
1817
1966
|
to: "failed";
|
|
1818
1967
|
failure: RunningRunFailure;
|
|
1968
|
+
withdrawnInput?: WithdrawnUserInput;
|
|
1819
1969
|
}> | Readonly<{
|
|
1820
1970
|
kind: "run_state_changed";
|
|
1821
1971
|
from: "queued" | "running" | "input_required";
|
|
1822
1972
|
to: "cancelled";
|
|
1823
1973
|
reason?: string;
|
|
1824
1974
|
}>);
|
|
1825
|
-
type ToolStateChanged = DurableEventBase &
|
|
1826
|
-
kind: "tool_state_changed";
|
|
1827
|
-
transition: Readonly<{
|
|
1828
|
-
from: null;
|
|
1829
|
-
to: "pending";
|
|
1830
|
-
}>;
|
|
1831
|
-
toolCall: Extract<ToolCallSnapshot, {
|
|
1832
|
-
state: "pending";
|
|
1833
|
-
}>;
|
|
1834
|
-
}> | Readonly<{
|
|
1835
|
-
kind: "tool_state_changed";
|
|
1836
|
-
transition: Readonly<{
|
|
1837
|
-
from: "pending";
|
|
1838
|
-
to: "running";
|
|
1839
|
-
}>;
|
|
1840
|
-
toolCall: Extract<ToolCallSnapshot, {
|
|
1841
|
-
state: "running";
|
|
1842
|
-
}>;
|
|
1843
|
-
}> | Readonly<{
|
|
1844
|
-
kind: "tool_state_changed";
|
|
1845
|
-
transition: Readonly<{
|
|
1846
|
-
from: "pending";
|
|
1847
|
-
to: "failed";
|
|
1848
|
-
}>;
|
|
1849
|
-
toolCall: Extract<ToolCallSnapshot, {
|
|
1850
|
-
state: "failed";
|
|
1851
|
-
}>;
|
|
1852
|
-
}> | Readonly<{
|
|
1975
|
+
type ToolStateChanged = (DurableEventBase & Readonly<{
|
|
1853
1976
|
kind: "tool_state_changed";
|
|
1854
1977
|
transition: Readonly<{
|
|
1855
|
-
from:
|
|
1856
|
-
to:
|
|
1978
|
+
from: ToolCallStatus | null;
|
|
1979
|
+
to: ToolCallStatus;
|
|
1857
1980
|
}>;
|
|
1858
|
-
toolCall:
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
}> | Readonly<{
|
|
1862
|
-
kind: "tool_state_changed";
|
|
1863
|
-
transition: Readonly<{
|
|
1864
|
-
from: "running";
|
|
1865
|
-
to: "pending";
|
|
1866
|
-
}>;
|
|
1867
|
-
toolCall: Extract<ToolCallSnapshot, {
|
|
1868
|
-
state: "pending";
|
|
1869
|
-
}>;
|
|
1870
|
-
}> | Readonly<{
|
|
1871
|
-
kind: "tool_state_changed";
|
|
1872
|
-
transition: Readonly<{
|
|
1873
|
-
from: "running";
|
|
1874
|
-
to: "completed";
|
|
1875
|
-
}>;
|
|
1876
|
-
toolCall: Extract<ToolCallSnapshot, {
|
|
1877
|
-
state: "completed";
|
|
1878
|
-
}>;
|
|
1879
|
-
}> | Readonly<{
|
|
1880
|
-
kind: "tool_state_changed";
|
|
1881
|
-
transition: Readonly<{
|
|
1882
|
-
from: "running";
|
|
1883
|
-
to: "failed";
|
|
1884
|
-
}>;
|
|
1885
|
-
toolCall: Extract<ToolCallSnapshot, {
|
|
1886
|
-
state: "failed";
|
|
1887
|
-
}>;
|
|
1888
|
-
}> | Readonly<{
|
|
1981
|
+
toolCall: ToolCall$1;
|
|
1982
|
+
external?: boolean;
|
|
1983
|
+
}>) | Readonly<{
|
|
1889
1984
|
kind: "tool_state_changed";
|
|
1985
|
+
durability: "transient";
|
|
1986
|
+
runId: RunId;
|
|
1987
|
+
executionId?: ExecutionId;
|
|
1890
1988
|
transition: Readonly<{
|
|
1891
|
-
from:
|
|
1892
|
-
to:
|
|
1893
|
-
}>;
|
|
1894
|
-
toolCall: Extract<ToolCallSnapshot, {
|
|
1895
|
-
state: "indeterminate";
|
|
1989
|
+
from: ToolCallStatus | null;
|
|
1990
|
+
to: ToolCallStatus;
|
|
1896
1991
|
}>;
|
|
1897
|
-
|
|
1898
|
-
|
|
1992
|
+
toolCall: ToolCall$1 | ToolCallUpdate;
|
|
1993
|
+
external?: boolean;
|
|
1994
|
+
}>;
|
|
1995
|
+
type DurableRunEvent = PhaseEntered | MessageCommitted | MessageRevised | RunStateChanged | Extract<ToolStateChanged, {
|
|
1996
|
+
durability: "durable";
|
|
1997
|
+
}>;
|
|
1899
1998
|
type MessageDelta = Readonly<{
|
|
1900
1999
|
kind: "message_delta";
|
|
1901
2000
|
durability: "transient";
|
|
@@ -1915,13 +2014,16 @@ type ThinkingDelta = Readonly<{
|
|
|
1915
2014
|
offset: number;
|
|
1916
2015
|
text: string;
|
|
1917
2016
|
}>;
|
|
1918
|
-
type
|
|
1919
|
-
kind: "
|
|
2017
|
+
type ToolCallDelta = Readonly<{
|
|
2018
|
+
kind: "tool_call_delta";
|
|
1920
2019
|
durability: "transient";
|
|
1921
2020
|
runId: RunId;
|
|
1922
2021
|
executionId: ExecutionId;
|
|
1923
|
-
|
|
1924
|
-
|
|
2022
|
+
messageId: MessageId;
|
|
2023
|
+
providerToolCallId: string;
|
|
2024
|
+
toolName: string;
|
|
2025
|
+
arguments: string;
|
|
2026
|
+
args: JsonValue | undefined;
|
|
1925
2027
|
}>;
|
|
1926
2028
|
type PhaseStatusEvent = Readonly<{
|
|
1927
2029
|
kind: "phase_status";
|
|
@@ -1931,7 +2033,19 @@ type PhaseStatusEvent = Readonly<{
|
|
|
1931
2033
|
phaseId: string;
|
|
1932
2034
|
status: PhaseStatus;
|
|
1933
2035
|
}>;
|
|
1934
|
-
type
|
|
2036
|
+
type ModelRetry = Readonly<{
|
|
2037
|
+
kind: "model_retry";
|
|
2038
|
+
durability: "transient";
|
|
2039
|
+
runId: RunId;
|
|
2040
|
+
executionId: ExecutionId;
|
|
2041
|
+
attempt: number;
|
|
2042
|
+
maxRetries: number;
|
|
2043
|
+
delayMs: number;
|
|
2044
|
+
error: string;
|
|
2045
|
+
}>;
|
|
2046
|
+
type RunEvent = DurableRunEvent | MessageDelta | ThinkingDelta | ToolCallDelta | PhaseStatusEvent | ModelRetry | Extract<ToolStateChanged, {
|
|
2047
|
+
durability: "transient";
|
|
2048
|
+
}>;
|
|
1935
2049
|
|
|
1936
2050
|
type PhaseStatusState = "running" | "completed";
|
|
1937
2051
|
/** Normalized status event exposed to Runtime consumers. */
|
|
@@ -1993,6 +2107,8 @@ type PhaseExecutionIdentity = Readonly<{
|
|
|
1993
2107
|
/** Opaque metadata captured at the durable boundary; Rowan does not decode it. */
|
|
1994
2108
|
agentMetadata?: Readonly<Record<string, unknown>>;
|
|
1995
2109
|
runMetadata?: Readonly<Record<string, unknown>>;
|
|
2110
|
+
scope?: _rowan_agent_models.ScopeRef;
|
|
2111
|
+
cwd?: string;
|
|
1996
2112
|
}>;
|
|
1997
2113
|
/** Everything a phase needs to execute */
|
|
1998
2114
|
interface PhaseContext {
|
|
@@ -2015,24 +2131,24 @@ interface PhaseContext {
|
|
|
2015
2131
|
}
|
|
2016
2132
|
/** JSON-safe structural defaults declared by a Phase's `input` mapping. */
|
|
2017
2133
|
type PhaseInput = Readonly<Record<string, JsonValue>>;
|
|
2018
|
-
/** JSON-safe option metadata exposed
|
|
2019
|
-
interface
|
|
2134
|
+
/** JSON-safe option metadata exposed to a host Settings surface. */
|
|
2135
|
+
interface SettingsOption {
|
|
2020
2136
|
value: string;
|
|
2021
2137
|
label: string;
|
|
2022
2138
|
description?: string;
|
|
2023
2139
|
disabled?: boolean;
|
|
2024
2140
|
}
|
|
2025
|
-
interface
|
|
2141
|
+
interface SettingsBadge {
|
|
2026
2142
|
label: string;
|
|
2027
2143
|
tone?: "neutral" | "success" | "review" | "danger";
|
|
2028
2144
|
}
|
|
2029
|
-
interface
|
|
2145
|
+
interface SettingsItem {
|
|
2030
2146
|
id: string;
|
|
2031
2147
|
title: string;
|
|
2032
2148
|
description?: string;
|
|
2033
|
-
badges?: readonly
|
|
2149
|
+
badges?: readonly SettingsBadge[];
|
|
2034
2150
|
}
|
|
2035
|
-
type
|
|
2151
|
+
type SettingsControl = {
|
|
2036
2152
|
type: "boolean";
|
|
2037
2153
|
path: string;
|
|
2038
2154
|
label: string;
|
|
@@ -2052,7 +2168,7 @@ type PhaseSettingsControl = {
|
|
|
2052
2168
|
path: string;
|
|
2053
2169
|
label: string;
|
|
2054
2170
|
description?: string;
|
|
2055
|
-
options: readonly
|
|
2171
|
+
options: readonly SettingsOption[];
|
|
2056
2172
|
} | {
|
|
2057
2173
|
type: "text";
|
|
2058
2174
|
path: string;
|
|
@@ -2066,32 +2182,26 @@ type PhaseSettingsControl = {
|
|
|
2066
2182
|
path: string;
|
|
2067
2183
|
label: string;
|
|
2068
2184
|
description?: string;
|
|
2069
|
-
items: readonly
|
|
2070
|
-
fields: readonly
|
|
2185
|
+
items: readonly SettingsItem[];
|
|
2186
|
+
fields: readonly SettingsControl[];
|
|
2071
2187
|
add?: {
|
|
2072
2188
|
label: string;
|
|
2073
2189
|
idLabel?: string;
|
|
2074
|
-
fields: readonly
|
|
2190
|
+
fields: readonly SettingsControl[];
|
|
2075
2191
|
};
|
|
2076
2192
|
removeLabel?: string;
|
|
2077
2193
|
};
|
|
2078
|
-
interface
|
|
2194
|
+
interface SettingsSection {
|
|
2079
2195
|
id: string;
|
|
2080
2196
|
title: string;
|
|
2081
2197
|
description?: string;
|
|
2082
|
-
controls: readonly
|
|
2198
|
+
controls: readonly SettingsControl[];
|
|
2083
2199
|
}
|
|
2084
|
-
/** Declarative, host-neutral Settings surface
|
|
2085
|
-
interface
|
|
2200
|
+
/** Declarative, host-neutral Settings surface. */
|
|
2201
|
+
interface SettingsDefinition {
|
|
2086
2202
|
description?: string;
|
|
2087
|
-
sections: readonly
|
|
2203
|
+
sections: readonly SettingsSection[];
|
|
2088
2204
|
}
|
|
2089
|
-
/** Host context is intentionally opaque beyond the effective configuration. */
|
|
2090
|
-
interface PhaseSettingsContext {
|
|
2091
|
-
configuration: Readonly<Record<string, unknown>>;
|
|
2092
|
-
metadata?: Readonly<Record<string, unknown>>;
|
|
2093
|
-
}
|
|
2094
|
-
type PhaseSettingsProvider = (context: PhaseSettingsContext) => PhaseSettingsDefinition | Promise<PhaseSettingsDefinition>;
|
|
2095
2205
|
/**
|
|
2096
2206
|
* Loaded Phase object
|
|
2097
2207
|
*/
|
|
@@ -2257,6 +2367,7 @@ type Tool<TArgs = unknown> = {
|
|
|
2257
2367
|
promptGuidelines?: string[];
|
|
2258
2368
|
/** Whether this tool can run concurrently with others. Default: "parallel". */
|
|
2259
2369
|
executionMode?: ToolExecutionMode;
|
|
2370
|
+
_meta?: JsonObject$1;
|
|
2260
2371
|
execute(args: TArgs, context: ToolContext, signal?: AbortSignal): Promise<ToolResult>;
|
|
2261
2372
|
};
|
|
2262
2373
|
/** Context snapshot passed into the low-level agent loop. */
|
|
@@ -2271,6 +2382,7 @@ type AgentContext = {
|
|
|
2271
2382
|
skills: Skill[];
|
|
2272
2383
|
/** Custom phases for this run. Agent normalizes this with the built-in default phase. */
|
|
2273
2384
|
phases?: PhaseRegistry;
|
|
2385
|
+
cwd?: string;
|
|
2274
2386
|
};
|
|
2275
2387
|
|
|
2276
2388
|
/**
|
|
@@ -2303,9 +2415,11 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
2303
2415
|
readonly host: ExtensionHost;
|
|
2304
2416
|
private readonly resources;
|
|
2305
2417
|
private readonly startedRuns;
|
|
2418
|
+
private readonly liveInteractions;
|
|
2306
2419
|
private heartbeat?;
|
|
2307
2420
|
private pumping;
|
|
2308
2421
|
private closed;
|
|
2422
|
+
private readonly retryDelayMs?;
|
|
2309
2423
|
private constructor();
|
|
2310
2424
|
static init(options: AgentRuntimeOptions): Promise<AgentRuntime>;
|
|
2311
2425
|
private handleRunEnd;
|
|
@@ -2357,6 +2471,8 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
2357
2471
|
start(agentId: AgentId, input: UserInput, options: {
|
|
2358
2472
|
idempotencyKey: string;
|
|
2359
2473
|
metadata?: Metadata;
|
|
2474
|
+
scope?: ScopeRef;
|
|
2475
|
+
cwd?: string;
|
|
2360
2476
|
phasePayload?: JsonValue;
|
|
2361
2477
|
entryPhases?: ReadonlyArray<EntryPhaseSpec>;
|
|
2362
2478
|
}): Promise<AgentRun>;
|
|
@@ -2383,6 +2499,14 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
2383
2499
|
}): Promise<DurableConsumer>;
|
|
2384
2500
|
listCapabilities(): readonly ExtensionCapability[];
|
|
2385
2501
|
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
2502
|
+
listUiContributions(): readonly UiContribution[];
|
|
2503
|
+
onUiContributionsChanged(listener: (contributions: readonly UiContribution[]) => void): () => void;
|
|
2504
|
+
triggerUiAction(event: {
|
|
2505
|
+
contributionId: string;
|
|
2506
|
+
actionId: string;
|
|
2507
|
+
scope?: ScopeRef;
|
|
2508
|
+
}): void;
|
|
2509
|
+
private liveInteract;
|
|
2386
2510
|
close(): Promise<void>;
|
|
2387
2511
|
snapshot(runId: RunId): Promise<RunSnapshot>;
|
|
2388
2512
|
history(agentId: AgentId): Promise<readonly Message[]>;
|
|
@@ -2398,6 +2522,7 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
2398
2522
|
private resolveContextWindow;
|
|
2399
2523
|
private executeTool;
|
|
2400
2524
|
private executeToolBatch;
|
|
2525
|
+
private executeAndCommitTool;
|
|
2401
2526
|
private foldToolInteractionRecords;
|
|
2402
2527
|
private requireAgent;
|
|
2403
2528
|
private archiveDirFor;
|
|
@@ -2423,14 +2548,24 @@ type StoredAgent = Mutable<AgentRecord>;
|
|
|
2423
2548
|
type StoredRun = Mutable<RunRecord>;
|
|
2424
2549
|
type StoredToolCall = {
|
|
2425
2550
|
id: ToolCallId;
|
|
2426
|
-
providerToolCallId
|
|
2551
|
+
providerToolCallId?: string;
|
|
2427
2552
|
agentId: AgentId;
|
|
2428
2553
|
runId: RunId;
|
|
2429
|
-
executionId
|
|
2430
|
-
requestMessageId
|
|
2431
|
-
name
|
|
2432
|
-
args
|
|
2433
|
-
state
|
|
2554
|
+
executionId?: ExecutionId;
|
|
2555
|
+
requestMessageId?: MessageId;
|
|
2556
|
+
name?: string;
|
|
2557
|
+
args?: JsonValue;
|
|
2558
|
+
state?: ToolCallState;
|
|
2559
|
+
toolCallId: string;
|
|
2560
|
+
title: string;
|
|
2561
|
+
kind: ToolKind;
|
|
2562
|
+
status: ToolCallStatus;
|
|
2563
|
+
content?: ToolCallContent[];
|
|
2564
|
+
locations?: ToolCallLocation[];
|
|
2565
|
+
rawInput?: JsonValue;
|
|
2566
|
+
rawOutput?: JsonValue;
|
|
2567
|
+
_meta?: JsonObject;
|
|
2568
|
+
external?: boolean;
|
|
2434
2569
|
result?: DurableToolResult;
|
|
2435
2570
|
resultMessageId?: MessageId;
|
|
2436
2571
|
reason?: string;
|
|
@@ -2549,6 +2684,8 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2549
2684
|
agentId: AgentId;
|
|
2550
2685
|
input: UserInput;
|
|
2551
2686
|
metadata?: Metadata;
|
|
2687
|
+
scope?: ScopeRef;
|
|
2688
|
+
cwd?: string;
|
|
2552
2689
|
phasePayload?: JsonValue;
|
|
2553
2690
|
entryPhases?: readonly EntryPhaseSpec[];
|
|
2554
2691
|
pinnedConfigToken?: ConfigToken;
|
|
@@ -2624,6 +2761,11 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2624
2761
|
execution: ExecutionToken;
|
|
2625
2762
|
expectedRevision: number;
|
|
2626
2763
|
toolCallId: ToolCallId;
|
|
2764
|
+
title?: string;
|
|
2765
|
+
kind?: ToolKind;
|
|
2766
|
+
locations?: ToolCallLocation[];
|
|
2767
|
+
content?: ToolCallContent[];
|
|
2768
|
+
_meta?: JsonObject;
|
|
2627
2769
|
}): ToolCommit;
|
|
2628
2770
|
suspendToolCall(lease: OwnerLease, input: {
|
|
2629
2771
|
runId: RunId;
|
|
@@ -2639,6 +2781,12 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2639
2781
|
result: ToolExecutionResult;
|
|
2640
2782
|
state: "completed" | "failed" | "indeterminate";
|
|
2641
2783
|
reason?: string;
|
|
2784
|
+
title?: string;
|
|
2785
|
+
kind?: ToolKind;
|
|
2786
|
+
content?: ToolCallContent[];
|
|
2787
|
+
locations?: ToolCallLocation[];
|
|
2788
|
+
rawOutput?: JsonValue;
|
|
2789
|
+
_meta?: JsonObject;
|
|
2642
2790
|
}): ToolCommit;
|
|
2643
2791
|
commitOutcome(lease: OwnerLease, input: {
|
|
2644
2792
|
runId: RunId;
|
|
@@ -2654,6 +2802,12 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2654
2802
|
reason?: string;
|
|
2655
2803
|
output?: AssistantMessage;
|
|
2656
2804
|
}): RunRecord;
|
|
2805
|
+
recordToolCall(lease: OwnerLease, input: {
|
|
2806
|
+
runId: RunId;
|
|
2807
|
+
execution?: ExecutionToken;
|
|
2808
|
+
update: ToolCall$1 | ToolCallUpdate;
|
|
2809
|
+
external?: boolean;
|
|
2810
|
+
}): DurableRunEvent;
|
|
2657
2811
|
snapshotRun(lease: OwnerLease, runId: RunId): RunSnapshot;
|
|
2658
2812
|
listAgents(lease: OwnerLease): readonly AgentRecord[];
|
|
2659
2813
|
listRuns(lease: OwnerLease, input?: {
|
|
@@ -2701,6 +2855,7 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2701
2855
|
private nextReady;
|
|
2702
2856
|
private nextMessageSequence;
|
|
2703
2857
|
private messagesForRun;
|
|
2858
|
+
private withdrawUserInputIfNoOutput;
|
|
2704
2859
|
history(lease: OwnerLease, agentId: AgentId): readonly Message[];
|
|
2705
2860
|
contextStatus(lease: OwnerLease, agentId: AgentId, contextWindow: number): ContextStatus;
|
|
2706
2861
|
contextMessages(lease: OwnerLease, agentId: AgentId, recentTokenBudget?: number): readonly Message[];
|
|
@@ -2779,6 +2934,8 @@ declare class SqliteStore implements DurableStore {
|
|
|
2779
2934
|
agentId: AgentId;
|
|
2780
2935
|
input: UserInput;
|
|
2781
2936
|
metadata?: Metadata;
|
|
2937
|
+
scope?: ScopeRef;
|
|
2938
|
+
cwd?: string;
|
|
2782
2939
|
phasePayload?: JsonValue;
|
|
2783
2940
|
entryPhases?: readonly EntryPhaseSpec[];
|
|
2784
2941
|
pinnedConfigToken?: ConfigToken;
|
|
@@ -2846,18 +3003,18 @@ declare class SqliteStore implements DurableStore {
|
|
|
2846
3003
|
args: JsonValue;
|
|
2847
3004
|
toolCallId?: ToolCallId;
|
|
2848
3005
|
providerToolCallId?: string;
|
|
3006
|
+
title?: string;
|
|
3007
|
+
kind?: ToolKind;
|
|
3008
|
+
locations?: ToolCallLocation[];
|
|
3009
|
+
content?: ToolCallContent[];
|
|
3010
|
+
_meta?: JsonObject;
|
|
2849
3011
|
}): Promise<ToolCommit>;
|
|
2850
3012
|
reserveToolCalls(lease: OwnerLease, input: {
|
|
2851
3013
|
runId: RunId;
|
|
2852
3014
|
execution: ExecutionToken;
|
|
2853
3015
|
expectedRevision: number;
|
|
2854
3016
|
requestMessageId: MessageId;
|
|
2855
|
-
calls: readonly
|
|
2856
|
-
providerToolCallId: string;
|
|
2857
|
-
name: string;
|
|
2858
|
-
args: JsonValue;
|
|
2859
|
-
toolCallId?: ToolCallId;
|
|
2860
|
-
}>[];
|
|
3017
|
+
calls: readonly ToolCallReservation[];
|
|
2861
3018
|
contentBlocks?: readonly ContentBlock[];
|
|
2862
3019
|
}): Promise<ToolBatchCommit>;
|
|
2863
3020
|
startToolCall(lease: OwnerLease, input: {
|
|
@@ -2865,6 +3022,11 @@ declare class SqliteStore implements DurableStore {
|
|
|
2865
3022
|
execution: ExecutionToken;
|
|
2866
3023
|
expectedRevision: number;
|
|
2867
3024
|
toolCallId: ToolCallId;
|
|
3025
|
+
title?: string;
|
|
3026
|
+
kind?: ToolKind;
|
|
3027
|
+
locations?: ToolCallLocation[];
|
|
3028
|
+
content?: ToolCallContent[];
|
|
3029
|
+
_meta?: JsonObject;
|
|
2868
3030
|
}): Promise<ToolCommit>;
|
|
2869
3031
|
suspendToolCall(lease: OwnerLease, input: {
|
|
2870
3032
|
runId: RunId;
|
|
@@ -2880,6 +3042,12 @@ declare class SqliteStore implements DurableStore {
|
|
|
2880
3042
|
result: ToolExecutionResult;
|
|
2881
3043
|
state: "completed" | "failed" | "indeterminate";
|
|
2882
3044
|
reason?: string;
|
|
3045
|
+
title?: string;
|
|
3046
|
+
kind?: ToolKind;
|
|
3047
|
+
content?: ToolCallContent[];
|
|
3048
|
+
locations?: ToolCallLocation[];
|
|
3049
|
+
rawOutput?: JsonValue;
|
|
3050
|
+
_meta?: JsonObject;
|
|
2883
3051
|
}): Promise<ToolCommit>;
|
|
2884
3052
|
cancelRun(lease: OwnerLease, input: {
|
|
2885
3053
|
runId: RunId;
|
|
@@ -2887,6 +3055,12 @@ declare class SqliteStore implements DurableStore {
|
|
|
2887
3055
|
reason?: string;
|
|
2888
3056
|
output?: AssistantMessage;
|
|
2889
3057
|
}): Promise<RunRecord>;
|
|
3058
|
+
recordToolCall(lease: OwnerLease, input: {
|
|
3059
|
+
runId: RunId;
|
|
3060
|
+
execution?: ExecutionToken;
|
|
3061
|
+
update: ToolCall$1 | ToolCallUpdate;
|
|
3062
|
+
external?: boolean;
|
|
3063
|
+
}): Promise<DurableRunEvent>;
|
|
2890
3064
|
snapshotRun(lease: OwnerLease, runId: RunId): Promise<RunSnapshot>;
|
|
2891
3065
|
history(lease: OwnerLease, agentId: AgentId): Promise<readonly Message[]>;
|
|
2892
3066
|
listAgents(lease: OwnerLease): Promise<readonly AgentRecord[]>;
|
|
@@ -3079,12 +3253,6 @@ declare function loadSkills(targetPath: string): Promise<Skill[]>;
|
|
|
3079
3253
|
* If a directory is provided, the loader reads its PHASE.md.
|
|
3080
3254
|
*/
|
|
3081
3255
|
declare function loadPhase(targetPath: string): Promise<Phase>;
|
|
3082
|
-
/**
|
|
3083
|
-
* Collect and evaluate the Settings provider registered through the Phase's
|
|
3084
|
-
* ExtensionAPI namespace. Settings discovery never reads a direct module
|
|
3085
|
-
* export; the Phase contributes through `api.phase.settings.register()`.
|
|
3086
|
-
*/
|
|
3087
|
-
declare function loadPhaseSettings(phase: Phase, context: PhaseSettingsContext): Promise<PhaseSettingsDefinition | undefined>;
|
|
3088
3256
|
/**
|
|
3089
3257
|
* Load all phases from the target directory.
|
|
3090
3258
|
*
|
|
@@ -3138,4 +3306,4 @@ declare function parseFrontmatter<T = Record<string, unknown>>(raw: string): Fro
|
|
|
3138
3306
|
|
|
3139
3307
|
declare function createCoreTools(input?: CoreToolContext): Tool$1[];
|
|
3140
3308
|
|
|
3141
|
-
export { type AfterToolCall, type AgentConfiguration, type AgentDefinition, type AgentId, type AgentListCursor, type AgentRecord, type AgentRun, AgentRuntime, type AgentRuntimeOptions, type AgentSummary, type AnyRuntimeError, type AssistantContent, type AssistantMessage, type BeforeToolCall, COMPACT_PHASE_ID, type ConfigProvider, type ConfigPutResult, type ConfigResolution, type ConfigToken, type ConfigurationSnapshot, type ContextCandidate, type ContextCompactionRecord, type ContextStatus, type CoreToolContext, DEFAULT_PHASE_ID, type DefinitionLayer, type DurableConsumer, type DurableRunEvent, type DurableStore, type DurableToolResult, type EntryPhaseSpec, type EventCursor, type EventId, type ExecutionCheckpoint, type ExecutionId, type ExecutionToken, type ExtensionAPI, type ExtensionActivationError, type ExtensionActivationResult, type ExtensionCapability, type ExtensionCapabilityContribution, type ExtensionContribution, type ExtensionDisposer, type ExtensionFactory, type ExtensionFactoryResult, type ExtensionHost, ExtensionLifetimeError, type ExtensionLifetimeErrorCode, type ExtensionLoadInput, type ExtensionStateStore, type ExtensionToolContribution, type FrontmatterResult, type HistorySeed, type HookEvent, type HookEventType, type HookHandler, InMemoryConfigProvider, InMemoryExtensionHost, InMemoryStore, type InteractionRecord, type InvocationCatalogEntry, type InvocationSource, type JsonObject, type JsonPrimitive, type JsonValue, type LoadExtensionsResult, type LoadInput, type LoadResult, type LoadedExtension, type Message, type MessageBase, type MessageCommitted, type MessageContent, type MessageDelta, type MessageId, type MessageRevised, type MessageRevisionResult, type Metadata, type OpaqueId, type Outcome, type OwnerLease, type OwnerToken, type Page, type Phase, type PhaseContext, type PhaseContribution, type PhaseExecution, type PhaseExecutionIdentity, type PhaseInput, type PhaseInvocation, type PhaseMessageManager, type PhaseOutput, type PhaseRegistry, type PhaseRegistrySelection, type
|
|
3309
|
+
export { type AfterToolCall, type AgentConfiguration, type AgentDefinition, type AgentId, type AgentListCursor, type AgentRecord, type AgentRun, AgentRuntime, type AgentRuntimeOptions, type AgentSummary, type AnyRuntimeError, type AssistantContent, type AssistantMessage, type BeforeToolCall, COMPACT_PHASE_ID, type ConfigProvider, type ConfigPutResult, type ConfigResolution, type ConfigToken, type ConfigurationSnapshot, type ContextCandidate, type ContextCompactionRecord, type ContextStatus, type CoreToolContext, DEFAULT_PHASE_ID, type DefinitionLayer, type DurableConsumer, type DurableRunEvent, type DurableStore, type DurableToolResult, type EntryPhaseSpec, type EventCursor, type EventId, type ExecutionCheckpoint, type ExecutionId, type ExecutionToken, type ExtensionAPI, type ExtensionActivationError, type ExtensionActivationResult, type ExtensionCapability, type ExtensionCapabilityContribution, type ExtensionContribution, type ExtensionDisposer, type ExtensionFactory, type ExtensionFactoryResult, type ExtensionHost, ExtensionLifetimeError, type ExtensionLifetimeErrorCode, type ExtensionLoadInput, type ExtensionStateStore, type ExtensionToolContribution, type FrontmatterResult, type HistorySeed, type HookEvent, type HookEventType, type HookHandler, InMemoryConfigProvider, InMemoryExtensionHost, InMemoryStore, type InteractionRecord, type InvocationCatalogEntry, type InvocationSource, type JsonObject, type JsonPrimitive, type JsonValue, type LoadExtensionsResult, type LoadInput, type LoadResult, type LoadedExtension, type Message, type MessageBase, type MessageCommitted, type MessageContent, type MessageDelta, type MessageId, type MessageRevised, type MessageRevisionResult, type Metadata, type ModelRetry, type OpaqueId, type Outcome, type OwnerLease, type OwnerToken, type Page, type Phase, type PhaseContext, type PhaseContribution, type PhaseExecution, type PhaseExecutionIdentity, type PhaseInput, type PhaseInvocation, type PhaseMessageManager, type PhaseOutput, type PhaseRegistry, type PhaseRegistrySelection, type PhaseState, type PhaseStatus, type PhaseStatusState, type ResolvedResourceView, type ResourceDiagnostic, type ResourceKind, type ResourceRef, ResourceRegistry, ResourceRegistryError, type ResourceRegistryErrorCode, type ResourceSourceId, type ResourceView, type RetentionResult, type RunBoundary, type RunClaim, type RunEndEvent, type RunEvent, type RunFailure, type RunId, type RunInteraction, RunInteractionBoundary, RunInteractionCancelledError, type RunInteractionDriver, type RunInteractionKind, type RunInteractionRequest, type RunInteractionState, type RunInteractionStatus, type RunListCursor, type RunRecord, type RunSnapshot, type RunStartEvent, type RunState, type RunStateChanged, type RunSummary, RuntimeBootstrapRegistry, RuntimeError, type RuntimeErrorCode, type RuntimeErrorDetails, RuntimeExtensionLifetime, STOP_PHASE_ID, type SettingsBadge, type SettingsControl, type SettingsDefinition, type SettingsItem, type SettingsOption, type SettingsSection, type Skill, SqliteStore, type TextContent, type ThinkingContent, type ThinkingDelta, type Tool$1 as Tool, type ToolCallContext, type ToolCallDelta, type ToolCallId, type ToolCallPresentationInput, type ToolCallPresentationOutput, type ToolCallSnapshot, type ToolCallState, type ToolContribution, type ToolDefinition, type ToolExecutionResult, type ToolInvocationContext, type ToolMessage, type ToolMessageContent, type ToolResultContent, type ToolStateChanged, type ToolUseContent, type UiContribution, type UiSlot, type UserContent, type UserInput, type UserMessage, type WithdrawnUserInput, brandConfigToken, createCompactPhase, createCorePhases, createCoreTools, createDefaultPhase, createStopPhase, isConfigurationSnapshot, isRuntimeError, loadExtensionsFromPath as loadExtensions, loadPhase, loadPhases, loadSkill, loadSkills, mergeToolCall, parseAgentDefinition, parseFrontmatter, resolveConfigurationSnapshot };
|