@nuvin/agent-core 0.2.1-rc.1 → 0.3.0-rc.2
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-D5IVWJHX.js +1 -1
- package/dist/chunk-EQGBU73Q.js +1 -0
- package/dist/chunk-FFIZ6TKW.js +1 -1
- package/dist/chunk-FWBTCRT2.js +1 -0
- 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/index.js +1 -1
- package/dist/shared/types.d.ts +30 -0
- package/dist/tools/core/internal-tool-runtime.d.ts +8 -2
- package/dist/tools/core/runtime-manager-tools.d.ts +2 -0
- 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 +8 -1
- package/dist/chunk-KIIEBXJF.js +0 -1
package/dist/shared/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4e26a1,_0x2a9050){const _0x36f146={_0x29d9dd:0x3d,_0x4cce36:0x32,_0x3bfdef:0x233,_0x15c47b:0x224,_0x44444b:0x3a,_0xb2f4e4:0x228,_0x4256dd:0x223,_0x5e6160:0x226,_0x4a91e6:0x35,_0x14c0f2:0x39,_0x43a577:0x38,_0x95340d:0x3b,_0x4f418c:0x40,_0x543a6e:0x30,_0x42e176:0x22b,_0x4d4f45:0x237,_0x1426d6:0x235},_0x5b15b3={_0x5b720b:0x2f3},_0x3a380d={_0x8c6bde:0xfc};function _0x864a49(_0x32977a,_0x32af65,_0x1416ff,_0x10fa15){return _0x7a50(_0x32af65- -_0x3a380d._0x8c6bde,_0x10fa15);}function _0x3b2fc4(_0x226c40,_0x1116d8,_0x3a09e0,_0x3bac1a){return _0x7a50(_0x3a09e0- -_0x5b15b3._0x5b720b,_0x226c40);}const _0x5c7404=_0x4e26a1();while(!![]){try{const _0x34ec46=-parseInt(_0x864a49(-_0x36f146._0x29d9dd,-0x3e,-_0x36f146._0x4cce36,-0x44))/0x1*(parseInt(_0x3b2fc4(-0x22e,-0x236,-0x231,-_0x36f146._0x3bfdef))/0x2)+parseInt(_0x3b2fc4(-0x22a,-0x22f,-0x226,-_0x36f146._0x15c47b))/0x3+parseInt(_0x864a49(-_0x36f146._0x44444b,-0x43,-0x48,-0x3b))/0x4+-parseInt(_0x3b2fc4(-_0x36f146._0xb2f4e4,-0x233,-_0x36f146._0x3bfdef,-0x22f))/0x5*(parseInt(_0x3b2fc4(-_0x36f146._0x4256dd,-0x226,-0x225,-_0x36f146._0x5e6160))/0x6)+parseInt(_0x864a49(-_0x36f146._0x4a91e6,-_0x36f146._0x14c0f2,-0x40,-_0x36f146._0x43a577))/0x7*(parseInt(_0x864a49(-_0x36f146._0x95340d,-0x33,-0x3a,-0x3d))/0x8)+parseInt(_0x864a49(-0x2d,-0x35,-_0x36f146._0x4f418c,-_0x36f146._0x543a6e))/0x9*(-parseInt(_0x3b2fc4(-0x22c,-0x231,-_0x36f146._0x42e176,-0x231))/0xa)+-parseInt(_0x3b2fc4(-_0x36f146._0x4d4f45,-0x234,-0x22d,-_0x36f146._0x1426d6))/0xb*(parseInt(_0x3b2fc4(-0x22c,-0x23b,-0x234,-0x232))/0xc);if(_0x34ec46===_0x2a9050)break;else _0x5c7404['push'](_0x5c7404['shift']());}catch(_0x24b2f0){_0x5c7404['push'](_0x5c7404['shift']());}}}(_0x20bd,0x7064a));import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';import{resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig}from'../chunk-IUZALP6K.js';function _0x20bd(){const _0x49fced=['ndKZmMLoy0Pczq','C2HPzNq','BgvUz3rO','mJKWmJaZmMnuEuPQAa','C3bSAwnL','AxnjBNrLz2vY','CMvQzwn0','ywjVCNrLza','nteZodnAz0rNq0W','mZzuu1nuALG','mZaZnwHMCwf0rq','AxngAw5PDgu','mtbPBMPYsem','ndLjB01TBva','y2fUy2vSBgvK','Aw5KzxHpzG','mJiWodiZoxHpq1zQzG','mtKYmZeYs1vxq3nn','mtCWz2nRA2Xf','nJm2nty4sNLVy1z4','CMvHC29U','CMvTB3zLqwjVCNrmAxn0zw5LCG','ChvZAa','mJy5nZy4n3bSwuP5tq'];_0x20bd=function(){return _0x49fced;};return _0x20bd();}import{TurnFailedError}from'../chunk-FFIZ6TKW.js';function _0x7a50(_0x1256da,_0x1453c0){_0x1256da=_0x1256da-0xb8;const _0x20bd47=_0x20bd();let _0x7a50e2=_0x20bd47[_0x1256da];if(_0x7a50['KRlwRz']===undefined){var _0x570179=function(_0x393f65){const _0x1acfe7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x59a96d='',_0x4cc35b='';for(let _0x5ca942=0x0,_0x3fdbca,_0x13dbc8,_0x2ad9a6=0x0;_0x13dbc8=_0x393f65['charAt'](_0x2ad9a6++);~_0x13dbc8&&(_0x3fdbca=_0x5ca942%0x4?_0x3fdbca*0x40+_0x13dbc8:_0x13dbc8,_0x5ca942++%0x4)?_0x59a96d+=String['fromCharCode'](0xff&_0x3fdbca>>(-0x2*_0x5ca942&0x6)):0x0){_0x13dbc8=_0x1acfe7['indexOf'](_0x13dbc8);}for(let _0x12468f=0x0,_0x1ace23=_0x59a96d['length'];_0x12468f<_0x1ace23;_0x12468f++){_0x4cc35b+='%'+('00'+_0x59a96d['charCodeAt'](_0x12468f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4cc35b);};_0x7a50['brYuIG']=_0x570179,_0x7a50['ttzgyU']={},_0x7a50['KRlwRz']=!![];}const _0x1273d9=_0x20bd47[0x0],_0x1601c1=_0x1256da+_0x1273d9,_0x5e5d72=_0x7a50['ttzgyU'][_0x1601c1];return!_0x5e5d72?(_0x7a50e2=_0x7a50['brYuIG'](_0x7a50e2),_0x7a50['ttzgyU'][_0x1601c1]=_0x7a50e2):_0x7a50e2=_0x5e5d72,_0x7a50e2;}import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';function createAbortAwareSemaphore(_0x59a96d){const _0x39a786={_0x49dd49:0x441,_0x30f162:0x226,_0x3a4e03:0x21a},_0xeeb1db={_0x42f7b4:0x12c,_0x259bbf:0x136,_0x3e3c71:0x12e,_0x2391e4:0x124,_0xeff6ce:0x12b,_0x1f2d97:0x136,_0x4c272f:0x145,_0x305271:0x139,_0x5d049e:0x134},_0x24d750={_0x4214f8:0x2f8,_0x160bb7:0x309,_0xc5e4bd:0x308,_0x422d2e:0x49,_0x20ba6c:0x302},_0x2b4a1a={_0x41e88f:0x51a},_0x17fcf8={_0x2cbef8:0x2e1};if(!Number[_0x4895b6(0x43a,0x446,0x43b,_0x39a786._0x49dd49)](_0x59a96d)||!Number[_0x448ae3(-_0x39a786._0x30f162,-_0x39a786._0x3a4e03,-0x22a,-0x232)](_0x59a96d)||_0x59a96d<=0x0)throw new Error('maxConcurrency\x20must\x20be\x20a\x20finite\x20positive\x20integer');let _0x4cc35b=0x0;function _0x448ae3(_0x51ce23,_0x20ee4c,_0x43651a,_0x16fccc){return _0x7a50(_0x51ce23- -_0x17fcf8._0x2cbef8,_0x20ee4c);}const _0x5ca942=[],_0x3fdbca=()=>{let _0x2ad9a6=![];return()=>{if(_0x2ad9a6)return;_0x2ad9a6=!![],_0x4cc35b-=0x1,_0x13dbc8();};};function _0x4895b6(_0x5cac16,_0x1a48eb,_0x5f2160,_0xa23fa9){return _0x7a50(_0x5f2160-0x37a,_0xa23fa9);}const _0x13dbc8=()=>{const _0x4877d6={_0xc36291:0x1d8};function _0x29bd06(_0x2677e0,_0xfbef50,_0x3ac17e,_0x2de14b){return _0x448ae3(_0x2677e0-_0x4877d6._0xc36291,_0x2de14b,_0x3ac17e-0xbb,_0x2de14b-0x33);}function _0x17a55e(_0x1a49ef,_0x303d4c,_0x28253f,_0x42bb1a){return _0x448ae3(_0x28253f-_0x2b4a1a._0x41e88f,_0x1a49ef,_0x28253f-0x1a9,_0x42bb1a-0x1d5);}while(_0x5ca942[_0x17a55e(0x2f9,0x2f7,0x2f1,_0x24d750._0x4214f8)]>0x0){const _0x12468f=_0x5ca942[_0x17a55e(0x30f,_0x24d750._0x160bb7,_0x24d750._0xc5e4bd,0x30c)]();if(!_0x12468f||_0x12468f['cancelled'])continue;_0x12468f[_0x29bd06(-0x45,-_0x24d750._0x422d2e,-0x3f,-0x47)]=!![],_0x12468f[_0x17a55e(0x301,0x30f,0x304,_0x24d750._0x20ba6c)](),_0x4cc35b+=0x1,_0x12468f['resolve'](_0x3fdbca());return;}};return{'acquire'(_0x1ace23){const _0x585338={_0x2a8038:0x2f8,_0x358c16:0x302,_0x5c3cea:0x2ff,_0x82385c:0x2fd,_0x2c50dd:0x2fe},_0x455ef3={_0x376c1c:0x156,_0x252266:0x1d},_0x27d997={_0x13a49b:0x1e8,_0x1bd844:0x337};if(_0x1ace23?.[_0x5e4b51(_0xeeb1db._0x42f7b4,_0xeeb1db._0x259bbf,0x12c,_0xeeb1db._0x3e3c71)])return Promise[_0x5e4b51(0x128,_0xeeb1db._0x2391e4,_0xeeb1db._0xeff6ce,_0xeeb1db._0x1f2d97)](toAbortError(_0x1ace23[_0x5e4b51(0x12f,_0xeeb1db._0x4c272f,_0xeeb1db._0x305271,_0xeeb1db._0x5d049e)]));function _0x24628b(_0x271b05,_0x5cbd05,_0x9d8d25,_0x5f4b98){return _0x4895b6(_0x271b05-0x18e,_0x5cbd05-_0x27d997._0x13a49b,_0x5cbd05- -_0x27d997._0x1bd844,_0x271b05);}function _0x5e4b51(_0x2c2698,_0x11c6c9,_0xc9abb,_0x342380){return _0x4895b6(_0x2c2698-_0x455ef3._0x376c1c,_0x11c6c9-_0x455ef3._0x252266,_0xc9abb- -0x30b,_0x11c6c9);}if(_0x4cc35b<_0x59a96d)return _0x4cc35b+=0x1,Promise['resolve'](_0x3fdbca());return new Promise((_0x3bc0e3,_0x16be5c)=>{const _0xf103fe={_0x43af0a:0xb6,_0x53d042:0xbb,_0x49896c:0xb8,_0x48bd6b:0x2bb,_0x442af1:0x2b0,_0x4d82a3:0x2c1,_0x236bf8:0x2ba,_0x19e05f:0x2c6,_0x2cb97a:0x2b9,_0x2555e5:0xa8,_0x356b8c:0xb5,_0x16b2da:0xb2},_0x2387f9={_0x4be447:0xe7,_0x5a6869:0x5b0},_0x8354d3={_0x31c2df:0x19f,_0x19f461:0x3af},_0x816f2e={_0x2686fe:0x1f0,_0x394e1c:0x7c,_0x2882e6:0x2e};function _0x3ec488(_0x5f3a9a,_0x588680,_0x390523,_0x38378b){return _0x24628b(_0x390523,_0x38378b- -0x268,_0x390523-0x128,_0x38378b-0x129);}function _0x78fc11(_0x38a1e2,_0x23d60b,_0xd3ec09,_0x4daf49){return _0x24628b(_0xd3ec09,_0x4daf49-_0x816f2e._0x2686fe,_0xd3ec09-_0x816f2e._0x394e1c,_0x4daf49-_0x816f2e._0x2882e6);}const _0xde72e6={'resolve':_0x3bc0e3,'reject':_0x16be5c,'cancelled':![],'removeAbortListener':()=>{}};_0x5ca942[_0x78fc11(0x2fe,_0x585338._0x2a8038,_0x585338._0x358c16,_0x585338._0x5c3cea)](_0xde72e6),_0xde72e6[_0x78fc11(0x2fa,0x2fa,_0x585338._0x82385c,_0x585338._0x2c50dd)]=addAbortListener(_0x1ace23,()=>{if(_0xde72e6[_0x33025f(-_0xf103fe._0x43af0a,-0xbc,-_0xf103fe._0x53d042,-_0xf103fe._0x49896c)])return;_0xde72e6['cancelled']=!![];function _0x33025f(_0xabb9c5,_0x135a02,_0x5ab727,_0x4381a0){return _0x78fc11(_0xabb9c5-_0x8354d3._0x31c2df,_0x135a02-0xe,_0xabb9c5,_0x4381a0- -_0x8354d3._0x19f461);}_0xde72e6['removeAbortListener']();function _0x29d6f7(_0x29d091,_0x5a341a,_0x308f76,_0xb2119a){return _0x78fc11(_0x29d091-_0x2387f9._0x4be447,_0x5a341a-0x172,_0x29d091,_0x308f76- -_0x2387f9._0x5a6869);}const _0x17c2aa=_0x5ca942[_0x29d6f7(-0x2c4,-_0xf103fe._0x48bd6b,-0x2b8,-_0xf103fe._0x442af1)](_0xde72e6);if(_0x17c2aa>=0x0)_0x5ca942[_0x29d6f7(-0x2b8,-_0xf103fe._0x4d82a3,-0x2c3,-_0xf103fe._0x236bf8)](_0x17c2aa,0x1);_0xde72e6[_0x29d6f7(-_0xf103fe._0x19e05f,-0x2c8,-0x2c1,-_0xf103fe._0x2cb97a)](toAbortError(_0x1ace23?.[_0x33025f(-0xb1,-_0xf103fe._0x2555e5,-_0xf103fe._0x356b8c,-_0xf103fe._0x16b2da)]));});});}};}export{OperationAbortedError,TurnFailedError,addAbortListener,createAbortAwareSemaphore,isAbortError,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -434,10 +434,32 @@ export interface BaseChatModelOptions {
|
|
|
434
434
|
providerSessionResolver?: ProviderSessionResolver;
|
|
435
435
|
requestMutators?: ProviderRequestMutator[];
|
|
436
436
|
}
|
|
437
|
+
export type ToolExecutionScope = Readonly<{
|
|
438
|
+
agentId: string;
|
|
439
|
+
toolCallPath: readonly string[];
|
|
440
|
+
}>;
|
|
441
|
+
export interface NestedToolExecutionRequest {
|
|
442
|
+
requestedName: string;
|
|
443
|
+
tool?: AnyToolDefinition;
|
|
444
|
+
toolCall: ToolUseBlock;
|
|
445
|
+
sequence: number;
|
|
446
|
+
trace?: ProgramTraceHandle;
|
|
447
|
+
}
|
|
448
|
+
export interface ProgramTraceHandle {
|
|
449
|
+
readonly runId: string;
|
|
450
|
+
recordToolCall(sequence: number, toolCall: ToolUseBlock): Promise<void>;
|
|
451
|
+
recordToolResult(sequence: number, result: ToolResult): Promise<void>;
|
|
452
|
+
finish(status: "completed" | "failed" | "aborted", errorMessage?: string): Promise<void>;
|
|
453
|
+
}
|
|
454
|
+
export type BeginProgramTrace = (request: {
|
|
455
|
+
executionScope: ToolExecutionScope;
|
|
456
|
+
programToolCallId: string;
|
|
457
|
+
}) => Promise<ProgramTraceHandle>;
|
|
437
458
|
export interface AgentEventContext {
|
|
438
459
|
sessionId: string;
|
|
439
460
|
turnId: string;
|
|
440
461
|
state: TurnState;
|
|
462
|
+
executionScope: ToolExecutionScope;
|
|
441
463
|
}
|
|
442
464
|
export type AskUserOption = {
|
|
443
465
|
label: string;
|
|
@@ -462,6 +484,8 @@ export interface ToolExecutionContext extends AgentEventContext {
|
|
|
462
484
|
permissionClass?: ToolPermissionClass;
|
|
463
485
|
executionAuthorization?: unknown;
|
|
464
486
|
askUser?: (request: AskUserQuestionRequest) => Promise<AskUserAnswers>;
|
|
487
|
+
executeNestedTool?: (request: NestedToolExecutionRequest) => Promise<ToolResult>;
|
|
488
|
+
beginProgramTrace?: () => Promise<ProgramTraceHandle>;
|
|
465
489
|
setTopic?: (topic: string) => void;
|
|
466
490
|
}
|
|
467
491
|
export interface BashExecutionTarget {
|
|
@@ -641,6 +665,8 @@ export interface PayloadByStage {
|
|
|
641
665
|
}
|
|
642
666
|
export interface ExtensionContext {
|
|
643
667
|
state: TurnState;
|
|
668
|
+
delivery: "model" | "program-intermediate";
|
|
669
|
+
executionScope: ToolExecutionScope;
|
|
644
670
|
/** Present only on the assistant-message `afterMessageAppend` run. */
|
|
645
671
|
turnMeta?: TurnMessageMeta;
|
|
646
672
|
}
|
|
@@ -683,6 +709,8 @@ export interface RunTurnDeps {
|
|
|
683
709
|
onEvent?: AgentEventHandler;
|
|
684
710
|
sessionDir?: string | (() => string | undefined);
|
|
685
711
|
outputFormat?: OutputFormat;
|
|
712
|
+
executionScope?: ToolExecutionScope;
|
|
713
|
+
beginProgramTrace?: BeginProgramTrace;
|
|
686
714
|
}
|
|
687
715
|
export type AgentInput = MessageInput | string;
|
|
688
716
|
export type SteeringInputDrain = () => Promise<AgentInput[]>;
|
|
@@ -715,6 +743,8 @@ export interface AgentOptions {
|
|
|
715
743
|
getContextWindowLimit?: (request: ChatRequest) => number | undefined;
|
|
716
744
|
sessionDir?: string | (() => string | undefined);
|
|
717
745
|
outputFormat?: OutputFormat;
|
|
746
|
+
executionScope?: ToolExecutionScope;
|
|
747
|
+
beginProgramTrace?: BeginProgramTrace;
|
|
718
748
|
}
|
|
719
749
|
export interface AgentDefinitionFactoryContext {
|
|
720
750
|
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
|
|
@@ -8,6 +8,8 @@ export interface DelegatedAgentFactoryContext extends AgentDefinitionFactoryCont
|
|
|
8
8
|
runId: string;
|
|
9
9
|
signal: AbortSignal;
|
|
10
10
|
modelTier?: ModelTier;
|
|
11
|
+
/** Ancestors of the AssignTask call; the call's own ID remains in toolCallId. */
|
|
12
|
+
toolCallPath?: readonly string[];
|
|
11
13
|
}
|
|
12
14
|
export type DelegatedRoutingMetadata = {
|
|
13
15
|
requestedModelTier: ModelTier;
|
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";
|