@nuvin/agent-core 0.2.1-rc.1 → 0.3.0-rc.3
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/dist/VERSION +2 -2
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/chunk-C7XNCD5L.js +1 -0
- package/dist/chunk-D5IVWJHX.js +1 -1
- package/dist/chunk-EQGBU73Q.js +1 -0
- package/dist/chunk-FFIZ6TKW.js +1 -1
- package/dist/chunk-GAZGO6N7.js +1 -1
- package/dist/chunk-IUZALP6K.js +1 -1
- package/dist/chunk-LIE76IJA.js +1 -1
- package/dist/chunk-X7VAACWY.js +1 -1
- package/dist/chunk-YNOIG4FD.js +1 -1
- package/dist/formats/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/isolate/index.d.ts +3 -0
- package/dist/isolate/index.js +1 -0
- package/dist/isolate/isolated-vm.d.ts +52 -0
- package/dist/models/index.js +1 -1
- package/dist/shared/abort-aware-semaphore.d.ts +1 -0
- package/dist/shared/index.js +1 -1
- package/dist/shared/types.d.ts +51 -3
- package/dist/tools/core/internal-tool-runtime.d.ts +8 -2
- package/dist/tools/core/runtime-manager-tools.d.ts +106 -2
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools/program/program-isolate.d.ts +37 -0
- package/dist/tools/program/program-tool.d.ts +7 -0
- package/dist/tools/program/strict-json.d.ts +9 -0
- package/package.json +9 -2
- package/dist/chunk-KIIEBXJF.js +0 -1
package/dist/shared/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function _0x1f6b(){const _0x3ba620=['nZKWre9eyuTW','AxnjBNrLz2vY','mte4mdm1zxD0tMj2','otK2mJeWs3DXCwvO','ChvZAa','Aw5KzxHpzG','mtKWD0nms3jR','C2HPzNq','Bwf4q29Uy3vYCMvUy3KGBxvZDcbIzsbHigzPBML0zsbWB3nPDgL2zsbPBNrLz2vY','CMvZB2X2zq','mty4ntuYmgTnzePKzG','mtuYohHcqu52qq','CMvTB3zLqwjVCNrmAxn0zw5LCG','y2fUy2vSBgvK','AxngAw5PDgu','mJq5ogncr09tuG','mtqWmdC5m0TSq0nmqW','CMvQzwn0','mJiXnZK0neXsqKPdyG','mJy2DeTqBMr6'];_0x1f6b=function(){return _0x3ba620;};return _0x1f6b();}function _0x5270(_0x3b6684,_0x458af4){_0x3b6684=_0x3b6684-0x1b0;const _0x1f6bdc=_0x1f6b();let _0x527048=_0x1f6bdc[_0x3b6684];if(_0x5270['zvzGCI']===undefined){var _0x1f6439=function(_0x2a9fc3){const _0x4da58b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x47e339='',_0x5214af='';for(let _0x42bdf0=0x0,_0x174c63,_0x5d26b1,_0x3bd524=0x0;_0x5d26b1=_0x2a9fc3['charAt'](_0x3bd524++);~_0x5d26b1&&(_0x174c63=_0x42bdf0%0x4?_0x174c63*0x40+_0x5d26b1:_0x5d26b1,_0x42bdf0++%0x4)?_0x47e339+=String['fromCharCode'](0xff&_0x174c63>>(-0x2*_0x42bdf0&0x6)):0x0){_0x5d26b1=_0x4da58b['indexOf'](_0x5d26b1);}for(let _0x27f711=0x0,_0x251b12=_0x47e339['length'];_0x27f711<_0x251b12;_0x27f711++){_0x5214af+='%'+('00'+_0x47e339['charCodeAt'](_0x27f711)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5214af);};_0x5270['dzyiUt']=_0x1f6439,_0x5270['gMXpeH']={},_0x5270['zvzGCI']=!![];}const _0x3f5e73=_0x1f6bdc[0x0],_0x5ec07f=_0x3b6684+_0x3f5e73,_0x1d0e63=_0x5270['gMXpeH'][_0x5ec07f];return!_0x1d0e63?(_0x527048=_0x5270['dzyiUt'](_0x527048),_0x5270['gMXpeH'][_0x5ec07f]=_0x527048):_0x527048=_0x1d0e63,_0x527048;}(function(_0x4e3078,_0x265a9c){const _0x1bc05e={_0x428286:0x41e,_0x12e51e:0x421,_0xd2a1c4:0x42b,_0x3d8384:0x132,_0x26e630:0x130,_0x24e890:0x136,_0x4ee2f5:0x13d,_0x5cee7b:0x425,_0x21feb0:0x42e,_0x270a92:0x420,_0x2747df:0x438,_0x1ff033:0x135,_0x4edbe9:0x143,_0x1acf8d:0x41d,_0x4c3093:0x41e,_0x2fecfa:0x133,_0x773a72:0x426},_0x5ba48f={_0x41fa3e:0x2f5},_0x25ba55=_0x4e3078();function _0x114904(_0x30ce8e,_0x50826a,_0x28d83b,_0x5db166){return _0x5270(_0x28d83b- -_0x5ba48f._0x41fa3e,_0x5db166);}function _0x3ac399(_0x1f1d07,_0x56c962,_0x508f01,_0x4da4d0){return _0x5270(_0x56c962-0x26d,_0x4da4d0);}while(!![]){try{const _0x248def=parseInt(_0x3ac399(_0x1bc05e._0x428286,_0x1bc05e._0x12e51e,0x41e,_0x1bc05e._0xd2a1c4))/0x1*(parseInt(_0x114904(-_0x1bc05e._0x3d8384,-_0x1bc05e._0x26e630,-_0x1bc05e._0x24e890,-_0x1bc05e._0x4ee2f5))/0x2)+parseInt(_0x3ac399(0x422,0x422,0x41d,_0x1bc05e._0x5cee7b))/0x3+parseInt(_0x114904(-0x13c,-0x144,-0x13e,-0x13d))/0x4+-parseInt(_0x3ac399(0x42c,0x429,_0x1bc05e._0x21feb0,_0x1bc05e._0x270a92))/0x5+parseInt(_0x3ac399(_0x1bc05e._0x2747df,0x430,0x427,0x427))/0x6+-parseInt(_0x114904(-_0x1bc05e._0x1ff033,-0x145,-0x13d,-_0x1bc05e._0x4edbe9))/0x7*(parseInt(_0x3ac399(0x417,_0x1bc05e._0x1acf8d,0x41a,_0x1bc05e._0x4c3093))/0x8)+parseInt(_0x114904(-0x141,-0x143,-0x13a,-_0x1bc05e._0x2fecfa))/0x9*(-parseInt(_0x3ac399(0x426,_0x1bc05e._0x773a72,0x42a,0x426))/0xa);if(_0x248def===_0x265a9c)break;else _0x25ba55['push'](_0x25ba55['shift']());}catch(_0x2d12aa){_0x25ba55['push'](_0x25ba55['shift']());}}}(_0x1f6b,0x48866));import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';import{resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig}from'../chunk-IUZALP6K.js';import{TurnFailedError}from'../chunk-FFIZ6TKW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';function createAbortAwareSemaphore(_0x47e339){const _0x3d26ca={_0x16084b:0x3f8,_0x466ae7:0x3f3,_0x3c5e70:0x57,_0x289781:0x54,_0x4aaae0:0x5b},_0x22515c={_0x2210da:0x20e},_0x380367={_0x256504:0x1a3,_0x2d2f09:0x1a0,_0x5c7bbb:0x1a8,_0x447ba0:0x200,_0x4772a1:0x1f8,_0x1ac8ff:0x1ff,_0x28bfac:0x207},_0x5598b3={_0x185e14:0x24a},_0x593b6b={_0xf37ace:0x11a,_0x1bdd90:0x1e8},_0x40514f={_0x545146:0x242};if(!Number[_0x1f3682(_0x3d26ca._0x16084b,0x3f5,_0x3d26ca._0x466ae7,0x3f0)](_0x47e339)||!Number[_0x3b2b2b(0x54,_0x3d26ca._0x3c5e70,0x4d,_0x3d26ca._0x289781)](_0x47e339)||_0x47e339<=0x0)throw new Error(_0x3b2b2b(_0x3d26ca._0x4aaae0,_0x3d26ca._0x3c5e70,_0x3d26ca._0x3c5e70,0x61));function _0x1f3682(_0xa5bc4d,_0x3cb19e,_0x586302,_0x1a424e){return _0x5270(_0x3cb19e-_0x40514f._0x545146,_0x1a424e);}let _0x5214af=0x0;function _0x3b2b2b(_0x4c4c6c,_0x59f93b,_0x4866c9,_0x3aa17c){return _0x5270(_0x4c4c6c- -0x166,_0x3aa17c);}const _0x42bdf0=[],_0x174c63=()=>{let _0x27f711=![];return()=>{if(_0x27f711)return;_0x27f711=!![],_0x5214af-=0x1,_0x5d26b1();};},_0x5d26b1=()=>{function _0x4fef81(_0x27a38d,_0x97f4ed,_0x4b101f,_0x4dc64e){return _0x1f3682(_0x27a38d-_0x593b6b._0xf37ace,_0x97f4ed- -0x5a2,_0x4b101f-_0x593b6b._0x1bdd90,_0x4b101f);}function _0x112848(_0x4a443c,_0x565fd3,_0xfc05df,_0x43e4cb){return _0x3b2b2b(_0x43e4cb- -_0x5598b3._0x185e14,_0x565fd3-0x97,_0xfc05df-0x104,_0xfc05df);}while(_0x42bdf0['length']>0x0){const _0x251b12=_0x42bdf0[_0x4fef81(-_0x380367._0x256504,-_0x380367._0x2d2f09,-_0x380367._0x5c7bbb,-0x1a0)]();if(!_0x251b12||_0x251b12['cancelled'])continue;_0x251b12[_0x112848(-_0x380367._0x447ba0,-0x204,-_0x380367._0x4772a1,-0x1fe)]=!![],_0x251b12[_0x112848(-_0x380367._0x1ac8ff,-0x1fb,-_0x380367._0x28bfac,-_0x380367._0x1ac8ff)](),_0x5214af+=0x1,_0x251b12['resolve'](_0x174c63());return;}},_0x3bd524=()=>{if(_0x5214af>=_0x47e339)return void 0x0;return _0x5214af+=0x1,_0x174c63();};return{'tryAcquire':_0x3bd524,'acquire'(_0x4e7d23){const _0x385e56={_0x1b00be:0x211,_0x2c0f0e:0x362,_0x59602b:0x367},_0x45f8b0={_0x51ddcd:0x90},_0x1a49b0={_0x32a956:0x101},_0x58cb58={_0x3893eb:0x266,_0xdf943c:0x1cd,_0x21bf85:0xc3};if(_0x4e7d23?.['aborted'])return Promise['reject'](toAbortError(_0x4e7d23['reason']));function _0x6c81b8(_0x161be5,_0x4a0420,_0x330060,_0x272410){return _0x3b2b2b(_0x330060- -_0x58cb58._0x3893eb,_0x4a0420-_0x58cb58._0xdf943c,_0x330060-_0x58cb58._0x21bf85,_0x272410);}const _0x35da83=_0x3bd524();if(_0x35da83!==void 0x0)return Promise[_0x6c81b8(-0x214,-0x202,-0x20a,-_0x22515c._0x2210da)](_0x35da83);return new Promise((_0x4c74d7,_0x51c081)=>{const _0x10641d={_0x300c48:0xe1,_0x436acc:0xec,_0x1cf3a1:0xf3,_0x27d1cb:0xe0,_0x3be64b:0xdf},_0x48679b={_0x5ef1ff:0x1db,_0x6b6972:0x12f,_0x296e2f:0x45};function _0x1566a6(_0x728f3a,_0x4c4418,_0xc0ef34,_0x48c496){return _0x6c81b8(_0x728f3a-0x168,_0x4c4418-_0x1a49b0._0x32a956,_0x48c496-0x582,_0x728f3a);}const _0x417cfd={'resolve':_0x4c74d7,'reject':_0x51c081,'cancelled':![],'removeAbortListener':()=>{}};_0x42bdf0[_0x472796(-0x20f,-_0x385e56._0x1b00be,-0x20f,-0x213)](_0x417cfd);function _0x472796(_0x23e32a,_0xa655a8,_0xbd0e85,_0x3cc3f1){return _0x6c81b8(_0x23e32a-0x0,_0xa655a8-_0x45f8b0._0x51ddcd,_0xbd0e85-0x0,_0x23e32a);}_0x417cfd[_0x1566a6(0x367,_0x385e56._0x2c0f0e,0x361,_0x385e56._0x59602b)]=addAbortListener(_0x4e7d23,()=>{const _0x9fffe9={_0x343eea:0x63};function _0x29616b(_0x187ffc,_0x52d35e,_0x2e13ba,_0x16adf2){return _0x472796(_0x52d35e,_0x52d35e-_0x48679b._0x5ef1ff,_0x16adf2-_0x48679b._0x6b6972,_0x16adf2-_0x48679b._0x296e2f);}if(_0x417cfd['cancelled'])return;function _0x3f425f(_0x4af6b9,_0x3f6ee6,_0x43f09f,_0x29d05c){return _0x472796(_0x43f09f,_0x3f6ee6-_0x9fffe9._0x343eea,_0x29d05c-0x24e,_0x29d05c-0x195);}_0x417cfd[_0x29616b(-_0x10641d._0x300c48,-_0x10641d._0x436acc,-_0x10641d._0x1cf3a1,-0xeb)]=!![],_0x417cfd['removeAbortListener']();const _0x3eced7=_0x42bdf0[_0x29616b(-_0x10641d._0x27d1cb,-0xdf,-0xd8,-_0x10641d._0x3be64b)](_0x417cfd);if(_0x3eced7>=0x0)_0x42bdf0['splice'](_0x3eced7,0x1);_0x417cfd[_0x29616b(-0xe1,-0xf1,-0xec,-0xe7)](toAbortError(_0x4e7d23?.['reason']));});});}};}export{OperationAbortedError,TurnFailedError,addAbortListener,createAbortAwareSemaphore,isAbortError,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -337,7 +337,8 @@ export interface TurnInput {
|
|
|
337
337
|
system?: SystemInput;
|
|
338
338
|
messages?: MessageInput[];
|
|
339
339
|
message: MessageInput;
|
|
340
|
-
|
|
340
|
+
submission?: AgentSubmission;
|
|
341
|
+
drainSteering?: () => Promise<TurnSteeringInput[]>;
|
|
341
342
|
}
|
|
342
343
|
export interface TurnState {
|
|
343
344
|
sessionId: string;
|
|
@@ -414,6 +415,10 @@ export interface TurnMessageMeta {
|
|
|
414
415
|
reasoningStartedAt?: number;
|
|
415
416
|
/** ms epoch — reasoning settled (first assistant text / done). */
|
|
416
417
|
reasoningCompletedAt?: number;
|
|
418
|
+
/** Marks a canonical user-role append submitted by a trusted runtime source. */
|
|
419
|
+
submissionOrigin?: "coordinator" | "agent";
|
|
420
|
+
/** Canonical sender ID for an agent-origin user-role append. */
|
|
421
|
+
senderAgentId?: string;
|
|
417
422
|
}
|
|
418
423
|
export interface EngineChatModel {
|
|
419
424
|
model: string;
|
|
@@ -434,10 +439,32 @@ export interface BaseChatModelOptions {
|
|
|
434
439
|
providerSessionResolver?: ProviderSessionResolver;
|
|
435
440
|
requestMutators?: ProviderRequestMutator[];
|
|
436
441
|
}
|
|
442
|
+
export type ToolExecutionScope = Readonly<{
|
|
443
|
+
agentId: string;
|
|
444
|
+
toolCallPath: readonly string[];
|
|
445
|
+
}>;
|
|
446
|
+
export interface NestedToolExecutionRequest {
|
|
447
|
+
requestedName: string;
|
|
448
|
+
tool?: AnyToolDefinition;
|
|
449
|
+
toolCall: ToolUseBlock;
|
|
450
|
+
sequence: number;
|
|
451
|
+
trace?: ProgramTraceHandle;
|
|
452
|
+
}
|
|
453
|
+
export interface ProgramTraceHandle {
|
|
454
|
+
readonly runId: string;
|
|
455
|
+
recordToolCall(sequence: number, toolCall: ToolUseBlock): Promise<void>;
|
|
456
|
+
recordToolResult(sequence: number, result: ToolResult): Promise<void>;
|
|
457
|
+
finish(status: "completed" | "failed" | "aborted", errorMessage?: string): Promise<void>;
|
|
458
|
+
}
|
|
459
|
+
export type BeginProgramTrace = (request: {
|
|
460
|
+
executionScope: ToolExecutionScope;
|
|
461
|
+
programToolCallId: string;
|
|
462
|
+
}) => Promise<ProgramTraceHandle>;
|
|
437
463
|
export interface AgentEventContext {
|
|
438
464
|
sessionId: string;
|
|
439
465
|
turnId: string;
|
|
440
466
|
state: TurnState;
|
|
467
|
+
executionScope: ToolExecutionScope;
|
|
441
468
|
}
|
|
442
469
|
export type AskUserOption = {
|
|
443
470
|
label: string;
|
|
@@ -462,6 +489,8 @@ export interface ToolExecutionContext extends AgentEventContext {
|
|
|
462
489
|
permissionClass?: ToolPermissionClass;
|
|
463
490
|
executionAuthorization?: unknown;
|
|
464
491
|
askUser?: (request: AskUserQuestionRequest) => Promise<AskUserAnswers>;
|
|
492
|
+
executeNestedTool?: (request: NestedToolExecutionRequest) => Promise<ToolResult>;
|
|
493
|
+
beginProgramTrace?: () => Promise<ProgramTraceHandle>;
|
|
465
494
|
setTopic?: (topic: string) => void;
|
|
466
495
|
}
|
|
467
496
|
export interface BashExecutionTarget {
|
|
@@ -494,6 +523,8 @@ export type ToolRuntimeEvent = ToolRuntimeOutputChunkEvent | ToolRuntimeComplete
|
|
|
494
523
|
export interface AgentUserMessageEvent {
|
|
495
524
|
type: "user_message";
|
|
496
525
|
message: Message;
|
|
526
|
+
/** Canonical sender ID when another agent submitted this message. */
|
|
527
|
+
senderAgentId?: string;
|
|
497
528
|
}
|
|
498
529
|
export interface AgentModelRequestEvent {
|
|
499
530
|
type: "model_request";
|
|
@@ -641,7 +672,9 @@ export interface PayloadByStage {
|
|
|
641
672
|
}
|
|
642
673
|
export interface ExtensionContext {
|
|
643
674
|
state: TurnState;
|
|
644
|
-
|
|
675
|
+
delivery: "model" | "program-intermediate";
|
|
676
|
+
executionScope: ToolExecutionScope;
|
|
677
|
+
/** Present on assistant appends and coordinator-owned user appends. */
|
|
645
678
|
turnMeta?: TurnMessageMeta;
|
|
646
679
|
}
|
|
647
680
|
export type Transformer<S extends TransformableStage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => PayloadByStage[S] | Promise<PayloadByStage[S]>;
|
|
@@ -683,16 +716,29 @@ export interface RunTurnDeps {
|
|
|
683
716
|
onEvent?: AgentEventHandler;
|
|
684
717
|
sessionDir?: string | (() => string | undefined);
|
|
685
718
|
outputFormat?: OutputFormat;
|
|
719
|
+
executionScope?: ToolExecutionScope;
|
|
720
|
+
beginProgramTrace?: BeginProgramTrace;
|
|
686
721
|
}
|
|
687
722
|
export type AgentInput = MessageInput | string;
|
|
688
|
-
export type SteeringInputDrain = () => Promise<AgentInput[]>;
|
|
689
723
|
/** Immutable ownership metadata for the exact agent submission being sent. */
|
|
690
724
|
export type AgentSubmission = Readonly<{
|
|
691
725
|
origin: "user";
|
|
692
726
|
}> | Readonly<{
|
|
693
727
|
origin: "coordinator";
|
|
694
728
|
token: string;
|
|
729
|
+
}> | Readonly<{
|
|
730
|
+
origin: "agent";
|
|
731
|
+
senderAgentId: string;
|
|
732
|
+
}>;
|
|
733
|
+
export type TurnSteeringInput = MessageInput | Readonly<{
|
|
734
|
+
input: MessageInput;
|
|
735
|
+
submission: AgentSubmission;
|
|
736
|
+
}>;
|
|
737
|
+
export type SteeringInput = AgentInput | Readonly<{
|
|
738
|
+
input: AgentInput;
|
|
739
|
+
submission: AgentSubmission;
|
|
695
740
|
}>;
|
|
741
|
+
export type SteeringInputDrain = () => Promise<SteeringInput[]>;
|
|
696
742
|
export interface AgentSendOptions {
|
|
697
743
|
streaming?: boolean;
|
|
698
744
|
signal?: AbortSignal;
|
|
@@ -715,6 +761,8 @@ export interface AgentOptions {
|
|
|
715
761
|
getContextWindowLimit?: (request: ChatRequest) => number | undefined;
|
|
716
762
|
sessionDir?: string | (() => string | undefined);
|
|
717
763
|
outputFormat?: OutputFormat;
|
|
764
|
+
executionScope?: ToolExecutionScope;
|
|
765
|
+
beginProgramTrace?: BeginProgramTrace;
|
|
718
766
|
}
|
|
719
767
|
export interface AgentDefinitionFactoryContext {
|
|
720
768
|
agentId: string;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import type { AnyToolDefinition,
|
|
1
|
+
import type { AgentEvent, AnyToolDefinition, BeginProgramTrace, ExtensionRegistry, ToolExecutionContext, ToolRuntime, ToolRuntimeToolCallHandler } from "../../shared/types.ts";
|
|
2
|
+
type InternalToolRuntimeEventHandler = (event: AgentEvent, ctx: ToolExecutionContext) => Promise<void> | void;
|
|
2
3
|
interface InternalToolRuntimeOptions {
|
|
3
|
-
onEvent?:
|
|
4
|
+
onEvent?: InternalToolRuntimeEventHandler;
|
|
4
5
|
onToolCall?: ToolRuntimeToolCallHandler;
|
|
6
|
+
registry?: ExtensionRegistry;
|
|
7
|
+
beginProgramTrace?: BeginProgramTrace;
|
|
5
8
|
}
|
|
9
|
+
export declare function closeBoundNestedToolExecution(executeNestedTool: ToolExecutionContext["executeNestedTool"], reason?: unknown): void;
|
|
10
|
+
export declare function drainBoundNestedToolPersistence(executeNestedTool: ToolExecutionContext["executeNestedTool"]): Promise<void>;
|
|
11
|
+
export declare function commitBoundToolExecutionTerminalState(executeNestedTool: ToolExecutionContext["executeNestedTool"]): void;
|
|
6
12
|
export declare function createInternalToolRuntime(tools?: AnyToolDefinition[], options?: InternalToolRuntimeOptions): ToolRuntime;
|
|
7
13
|
export {};
|
|
8
14
|
//# sourceMappingURL=internal-tool-runtime.d.ts.map
|
|
@@ -3,11 +3,64 @@ import type { AbortAwareSemaphore } from "../../shared/abort-aware-semaphore.ts"
|
|
|
3
3
|
import type { AgentDefinitionFactoryContext, AgentOptions } from "../../shared/types.ts";
|
|
4
4
|
export declare const MODEL_TIERS: readonly ["fast", "balanced", "powerful"];
|
|
5
5
|
export type ModelTier = (typeof MODEL_TIERS)[number];
|
|
6
|
+
export type BackgroundAssignmentState = "started" | "queued";
|
|
7
|
+
export type BackgroundMessageState = BackgroundAssignmentState | "queued-as-steering";
|
|
8
|
+
export type BackgroundDelegationFailureCode = "subagent-not-found" | "subagent-corrupt" | "subagent-unavailable" | "subagent-busy" | "subagent-closing";
|
|
9
|
+
export type BackgroundAssignmentRequest = Readonly<{
|
|
10
|
+
agentId: string;
|
|
11
|
+
task: string;
|
|
12
|
+
senderAgentId: string;
|
|
13
|
+
parentSessionId: string;
|
|
14
|
+
parentToolCallId: string;
|
|
15
|
+
requestedModelTier?: ModelTier;
|
|
16
|
+
}>;
|
|
17
|
+
export type BackgroundMessageRequest = Readonly<{
|
|
18
|
+
runId: string;
|
|
19
|
+
message: string;
|
|
20
|
+
senderAgentId: string;
|
|
21
|
+
parentSessionId: string;
|
|
22
|
+
triggerToolCallId: string;
|
|
23
|
+
}>;
|
|
24
|
+
export type BackgroundStopRequest = Readonly<{
|
|
25
|
+
runId: string;
|
|
26
|
+
parentSessionId: string;
|
|
27
|
+
}>;
|
|
28
|
+
export type BackgroundDelegationRejection = Readonly<{
|
|
29
|
+
kind: "rejected";
|
|
30
|
+
code: BackgroundDelegationFailureCode;
|
|
31
|
+
message: string;
|
|
32
|
+
runId?: string;
|
|
33
|
+
}>;
|
|
34
|
+
export type BackgroundAssignmentResult = Readonly<{
|
|
35
|
+
kind: "accepted";
|
|
36
|
+
runId: string;
|
|
37
|
+
agentId: string;
|
|
38
|
+
state: BackgroundAssignmentState;
|
|
39
|
+
}> | BackgroundDelegationRejection;
|
|
40
|
+
export type BackgroundMessageResult = Readonly<{
|
|
41
|
+
kind: "accepted";
|
|
42
|
+
runId: string;
|
|
43
|
+
agentId: string;
|
|
44
|
+
state: BackgroundMessageState;
|
|
45
|
+
}> | BackgroundDelegationRejection;
|
|
46
|
+
export type BackgroundStopResult = Readonly<{
|
|
47
|
+
kind: "accepted";
|
|
48
|
+
runId: string;
|
|
49
|
+
agentId: string;
|
|
50
|
+
state: "idle" | "stopping";
|
|
51
|
+
}> | BackgroundDelegationRejection;
|
|
52
|
+
export interface BackgroundDelegationCapability {
|
|
53
|
+
assign(request: BackgroundAssignmentRequest): Promise<BackgroundAssignmentResult>;
|
|
54
|
+
sendMessage(request: BackgroundMessageRequest): Promise<BackgroundMessageResult>;
|
|
55
|
+
stopAgent(request: BackgroundStopRequest): Promise<BackgroundStopResult>;
|
|
56
|
+
}
|
|
6
57
|
export interface DelegatedAgentFactoryContext extends AgentDefinitionFactoryContext {
|
|
7
58
|
parentSessionId: string;
|
|
8
59
|
runId: string;
|
|
9
60
|
signal: AbortSignal;
|
|
10
61
|
modelTier?: ModelTier;
|
|
62
|
+
/** Ancestors of the AssignTask call; the call's own ID remains in toolCallId. */
|
|
63
|
+
toolCallPath?: readonly string[];
|
|
11
64
|
}
|
|
12
65
|
export type DelegatedRoutingMetadata = {
|
|
13
66
|
requestedModelTier: ModelTier;
|
|
@@ -59,7 +112,10 @@ export interface CreateDelegationToolsOptions {
|
|
|
59
112
|
* delegation factory's own failure-release may safely converge here.
|
|
60
113
|
*/
|
|
61
114
|
releaseAgentResources?: (context: DelegatedAgentFactoryContext) => void;
|
|
115
|
+
background?: BackgroundDelegationCapability;
|
|
62
116
|
}
|
|
117
|
+
export declare function isValidDelegatedRunId(value: unknown): value is string;
|
|
118
|
+
export declare function createDelegatedRunId(): string;
|
|
63
119
|
export declare function resolveDelegatedAgentOptions(definition: DelegatedAgentDefinition, ctx: DelegatedAgentFactoryContext): Promise<DelegatedAgentResolution>;
|
|
64
120
|
export declare function createAssignTaskTool(options: CreateDelegationToolsOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
65
121
|
description: string;
|
|
@@ -94,8 +150,44 @@ export declare function createAssignTaskTool(options: CreateDelegationToolsOptio
|
|
|
94
150
|
};
|
|
95
151
|
required: string[];
|
|
96
152
|
}>;
|
|
153
|
+
export declare function createSendMessageTool(background: BackgroundDelegationCapability): import("../../shared/types.ts").ToolDefinition<{
|
|
154
|
+
message: string;
|
|
155
|
+
description: string;
|
|
156
|
+
runId: string;
|
|
157
|
+
}, never, import("../../shared/types.ts").ToolOutputEnvelope, {
|
|
158
|
+
type: "object";
|
|
159
|
+
properties: {
|
|
160
|
+
runId: {
|
|
161
|
+
type: "string";
|
|
162
|
+
description: string;
|
|
163
|
+
};
|
|
164
|
+
description: {
|
|
165
|
+
type: "string";
|
|
166
|
+
description: string;
|
|
167
|
+
};
|
|
168
|
+
message: {
|
|
169
|
+
type: "string";
|
|
170
|
+
description: string;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
required: string[];
|
|
174
|
+
additionalProperties: false;
|
|
175
|
+
}>;
|
|
176
|
+
export declare function createStopAgentTool(background: BackgroundDelegationCapability): import("../../shared/types.ts").ToolDefinition<{
|
|
177
|
+
runId: string;
|
|
178
|
+
}, never, import("../../shared/types.ts").ToolOutputEnvelope, {
|
|
179
|
+
type: "object";
|
|
180
|
+
properties: {
|
|
181
|
+
runId: {
|
|
182
|
+
type: "string";
|
|
183
|
+
description: string;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
required: string[];
|
|
187
|
+
additionalProperties: false;
|
|
188
|
+
}>;
|
|
97
189
|
export declare const createDelegateToAgentTool: typeof createAssignTaskTool;
|
|
98
|
-
export declare function createDelegationTools(options: CreateDelegationToolsOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
190
|
+
export declare function createDelegationTools(options: CreateDelegationToolsOptions): (import("../../shared/types.ts").ToolDefinition<{
|
|
99
191
|
description: string;
|
|
100
192
|
agentId: string;
|
|
101
193
|
nickname: string;
|
|
@@ -127,6 +219,18 @@ export declare function createDelegationTools(options: CreateDelegationToolsOpti
|
|
|
127
219
|
};
|
|
128
220
|
};
|
|
129
221
|
required: string[];
|
|
130
|
-
}>
|
|
222
|
+
}> | import("../../shared/types.ts").ToolDefinition<{
|
|
223
|
+
runId: string;
|
|
224
|
+
}, never, import("../../shared/types.ts").ToolOutputEnvelope, {
|
|
225
|
+
type: "object";
|
|
226
|
+
properties: {
|
|
227
|
+
runId: {
|
|
228
|
+
type: "string";
|
|
229
|
+
description: string;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
required: string[];
|
|
233
|
+
additionalProperties: false;
|
|
234
|
+
}>)[];
|
|
131
235
|
export {};
|
|
132
236
|
//# sourceMappingURL=runtime-manager-tools.d.ts.map
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from "./mcp/mcp-safe-error.ts";
|
|
|
24
24
|
export { extractOwnedMcpSafeError } from "./mcp/mcp-safe-error-provenance.ts";
|
|
25
25
|
export * from "./mcp/mcp-server-manager.ts";
|
|
26
26
|
export * from "./mcp/mcp-tool-adapter.ts";
|
|
27
|
+
export { type CreateProgramOptions, createProgram } from "./program/program-tool.ts";
|
|
27
28
|
export * from "./search/glob-tool.ts";
|
|
28
29
|
export * from "./search/grep-engine.ts";
|
|
29
30
|
export * from "./search/grep-tool.ts";
|