@nuvin/agent-core 0.2.0-rc.3 → 0.2.0-rc.4

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.
@@ -1 +1 @@
1
- (function(_0x52d6a9,_0x19b009){var _0x1af99f={_0x5f604f:0x187,_0x5b8d97:0x184,_0x143e9d:0xca,_0x571f70:0xc9,_0x5a51c1:0xc8,_0x29b68e:0xca,_0x3899cb:0xd3,_0x184fd0:0xd0,_0xff9145:0xcb,_0x8c15cd:0x189,_0x3a3656:0x18a,_0x161592:0x18d,_0x583c86:0x185,_0x2fd984:0x180,_0x31c6f1:0x188,_0x561f84:0xc9},_0x3ea0bf=_0x52d6a9();function _0x17f373(_0x395d31,_0x424fa5,_0x5c23f4,_0x408dee){return _0x4cd4(_0x424fa5- -0x325,_0x395d31);}function _0x4eada4(_0x275509,_0x44c80a,_0x59dfe2,_0x63b107){return _0x4cd4(_0x59dfe2- -0xcf,_0x63b107);}while(!![]){try{var _0x100239=-parseInt(_0x17f373(-0x182,-_0x1af99f._0x5f604f,-0x188,-_0x1af99f._0x5b8d97))/0x1+parseInt(_0x4eada4(_0x1af99f._0x143e9d,_0x1af99f._0x571f70,_0x1af99f._0x5a51c1,0xc6))/0x2+parseInt(_0x4eada4(0xc8,0xc6,_0x1af99f._0x29b68e,0xcc))/0x3*(parseInt(_0x4eada4(0xd5,_0x1af99f._0x3899cb,_0x1af99f._0x184fd0,_0x1af99f._0xff9145))/0x4)+-parseInt(_0x17f373(-0x184,-_0x1af99f._0x8c15cd,-0x187,-0x184))/0x5*(-parseInt(_0x17f373(-0x189,-_0x1af99f._0x3a3656,-_0x1af99f._0x161592,-0x189))/0x6)+-parseInt(_0x17f373(-0x183,-_0x1af99f._0x583c86,-_0x1af99f._0x2fd984,-0x186))/0x7*(parseInt(_0x17f373(-0x189,-0x18b,-_0x1af99f._0x5f604f,-0x18e))/0x8)+parseInt(_0x17f373(-0x186,-_0x1af99f._0x31c6f1,-0x189,-_0x1af99f._0x5f604f))/0x9+-parseInt(_0x4eada4(0xca,0xca,_0x1af99f._0x561f84,0xcb))/0xa;if(_0x100239===_0x19b009)break;else _0x3ea0bf['push'](_0x3ea0bf['shift']());}catch(_0x595eb2){_0x3ea0bf['push'](_0x3ea0bf['shift']());}}}(_0xae9d,0x93226));function _0xae9d(){var _0x2450e2=['nJqWmteYvNH5shLz','odKWotaWzvHQswT0','m0LAqxznBa','ndCYnJiZmMjQsgvPCq','nNvhtwDpAa','mtG3mte1mhjVsNj6Da','mtaZndq3mtDxs1fpsxu','odq1ndqWwLLwEMnb','mZuWmdiWneLIuhDkDa','mtr3wu1jrNC'];_0xae9d=function(){return _0x2450e2;};return _0xae9d();}import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';import{resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig}from'../chunk-IUZALP6K.js';function _0x4cd4(_0x3c3a66,_0xd56804){_0x3c3a66=_0x3c3a66-0x197;var _0xae9db=_0xae9d();var _0x4cd407=_0xae9db[_0x3c3a66];if(_0x4cd4['mVxHgH']===undefined){var _0x55cea6=function(_0x2f0f7b){var _0x5bec90='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x3544ab='',_0xe3ed64='';for(var _0x3c5953=0x0,_0x524d85,_0x3e7deb,_0xf31e2=0x0;_0x3e7deb=_0x2f0f7b['charAt'](_0xf31e2++);~_0x3e7deb&&(_0x524d85=_0x3c5953%0x4?_0x524d85*0x40+_0x3e7deb:_0x3e7deb,_0x3c5953++%0x4)?_0x3544ab+=String['fromCharCode'](0xff&_0x524d85>>(-0x2*_0x3c5953&0x6)):0x0){_0x3e7deb=_0x5bec90['indexOf'](_0x3e7deb);}for(var _0x5d27dd=0x0,_0x2e0a18=_0x3544ab['length'];_0x5d27dd<_0x2e0a18;_0x5d27dd++){_0xe3ed64+='%'+('00'+_0x3544ab['charCodeAt'](_0x5d27dd)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xe3ed64);};_0x4cd4['yrhrFk']=_0x55cea6,_0x4cd4['mnLfiT']={},_0x4cd4['mVxHgH']=!![];}var _0x31c2f8=_0xae9db[0x0],_0x15c899=_0x3c3a66+_0x31c2f8,_0x9418c7=_0x4cd4['mnLfiT'][_0x15c899];return!_0x9418c7?(_0x4cd407=_0x4cd4['yrhrFk'](_0x4cd407),_0x4cd4['mnLfiT'][_0x15c899]=_0x4cd407):_0x4cd407=_0x9418c7,_0x4cd407;}import{TurnFailedError}from'../chunk-FFIZ6TKW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';export{OperationAbortedError,TurnFailedError,addAbortListener,isAbortError,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
1
+ (function(_0x5decff,_0x3c2c65){var _0x456f32={_0x42f1f7:0x27c,_0x126e93:0x277,_0x368610:0x276,_0xe76eb8:0x244,_0x74400e:0x245,_0x14c5e3:0x273,_0x13ad44:0x248,_0x525a5c:0x250,_0x11e31e:0x24a,_0x216957:0x276,_0x51acd3:0x27c,_0x322857:0x275,_0x4d6895:0x27b,_0x410316:0x274,_0x208522:0x24c,_0x1bcaf8:0x24d,_0x14786d:0x249,_0x3939e7:0x246},_0x3140d5={_0xfe6fcd:0x374};function _0x8cbafb(_0x3e2fb7,_0x2c8786,_0x4a7e95,_0x11c6a1){return _0x491b(_0x11c6a1-0x14a,_0x4a7e95);}var _0x12381e=_0x5decff();function _0xc870c6(_0x26c597,_0x1342d0,_0x39868f,_0x44c244){return _0x491b(_0x1342d0- -_0x3140d5._0xfe6fcd,_0x44c244);}while(!![]){try{var _0x5299ac=-parseInt(_0xc870c6(-_0x456f32._0x42f1f7,-_0x456f32._0x126e93,-_0x456f32._0x368610,-0x272))/0x1*(parseInt(_0x8cbafb(_0x456f32._0xe76eb8,0x245,0x249,_0x456f32._0x74400e))/0x2)+-parseInt(_0xc870c6(-0x270,-_0x456f32._0x14c5e3,-0x276,-0x276))/0x3+parseInt(_0x8cbafb(_0x456f32._0x13ad44,_0x456f32._0x525a5c,_0x456f32._0x11e31e,_0x456f32._0x11e31e))/0x4*(parseInt(_0xc870c6(-0x26d,-0x272,-_0x456f32._0x216957,-0x271))/0x5)+-parseInt(_0xc870c6(-_0x456f32._0x51acd3,-0x27a,-_0x456f32._0x322857,-0x27b))/0x6*(parseInt(_0xc870c6(-0x27b,-0x27c,-0x27a,-0x278))/0x7)+-parseInt(_0x8cbafb(0x23f,0x246,0x248,0x243))/0x8*(parseInt(_0xc870c6(-_0x456f32._0x4d6895,-_0x456f32._0x216957,-0x27a,-_0x456f32._0x410316))/0x9)+parseInt(_0x8cbafb(_0x456f32._0x208522,_0x456f32._0x1bcaf8,0x245,_0x456f32._0x14786d))/0xa+parseInt(_0x8cbafb(_0x456f32._0x3939e7,_0x456f32._0x11e31e,0x243,_0x456f32._0x3939e7))/0xb;if(_0x5299ac===_0x3c2c65)break;else _0x12381e['push'](_0x12381e['shift']());}catch(_0x159437){_0x12381e['push'](_0x12381e['shift']());}}}(_0x3405,0x8db6d));import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';import{resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig}from'../chunk-IUZALP6K.js';function _0x491b(_0x341534,_0x5a81be){_0x341534=_0x341534-0xf8;var _0x340527=_0x3405();var _0x491bd9=_0x340527[_0x341534];if(_0x491b['RlwUjy']===undefined){var _0x2e4e10=function(_0x4a94a4){var _0x498c35='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x32ea79='',_0x2b8e1b='';for(var _0x283b30=0x0,_0x439ee3,_0x1873ba,_0x29be11=0x0;_0x1873ba=_0x4a94a4['charAt'](_0x29be11++);~_0x1873ba&&(_0x439ee3=_0x283b30%0x4?_0x439ee3*0x40+_0x1873ba:_0x1873ba,_0x283b30++%0x4)?_0x32ea79+=String['fromCharCode'](0xff&_0x439ee3>>(-0x2*_0x283b30&0x6)):0x0){_0x1873ba=_0x498c35['indexOf'](_0x1873ba);}for(var _0x3a3de9=0x0,_0x32f36e=_0x32ea79['length'];_0x3a3de9<_0x32f36e;_0x3a3de9++){_0x2b8e1b+='%'+('00'+_0x32ea79['charCodeAt'](_0x3a3de9)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2b8e1b);};_0x491b['ebrCTv']=_0x2e4e10,_0x491b['YhpFIX']={},_0x491b['RlwUjy']=!![];}var _0x524e7f=_0x340527[0x0],_0x4994aa=_0x341534+_0x524e7f,_0x14eff7=_0x491b['YhpFIX'][_0x4994aa];return!_0x14eff7?(_0x491bd9=_0x491b['ebrCTv'](_0x491bd9),_0x491b['YhpFIX'][_0x4994aa]=_0x491bd9):_0x491bd9=_0x14eff7,_0x491bd9;}function _0x3405(){var _0x253c5f=['mJu2otyXmhLTEez2Bq','ngPjBgrlqW','ntq0nZi1turfwun3','mJqYnJyXnw1ht0nxEG','mZK2mdq0nNrND2XRsG','mte1odiYneznu0zSrq','nNDlsfbREG','mta1otrLs3L2DMW','ote0mdq2muvsrMDOAq','mtLRz1P5uKK','ovHPzenqzG'];_0x3405=function(){return _0x253c5f;};return _0x3405();}import{TurnFailedError}from'../chunk-FFIZ6TKW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';export{OperationAbortedError,TurnFailedError,addAbortListener,isAbortError,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
@@ -222,6 +222,13 @@ export interface ChatResponseUsage {
222
222
  reportedCost?: ReportedModelCost;
223
223
  estimatedCost?: EstimatedModelCost;
224
224
  }
225
+ export interface PersistedModelCallMetricsV1 {
226
+ version: 1;
227
+ usage: ChatResponseUsage;
228
+ modelTimeMs: number;
229
+ completesRequest: boolean;
230
+ }
231
+ export type PersistedModelCallMetrics = PersistedModelCallMetricsV1;
225
232
  export interface ChatResponse {
226
233
  id: string;
227
234
  content: AssistantContentBlock[];
@@ -390,6 +397,7 @@ export interface TurnMessageMeta {
390
397
  provider?: string;
391
398
  model?: string;
392
399
  modelIdentity?: string;
400
+ metrics?: PersistedModelCallMetrics;
393
401
  /** ms epoch — provider request sent. */
394
402
  turnStartedAt?: number;
395
403
  /** ms epoch — response fully received. */
@@ -444,9 +452,17 @@ export interface ToolExecutionContext extends AgentEventContext {
444
452
  signal: AbortSignal;
445
453
  toolCallId?: string;
446
454
  permissionClass?: ToolPermissionClass;
455
+ executionAuthorization?: unknown;
447
456
  askUser?: (request: AskUserQuestionRequest) => Promise<AskUserAnswers>;
448
457
  setTopic?: (topic: string) => void;
449
458
  }
459
+ export interface BashExecutionTarget {
460
+ command: string;
461
+ cwd: string;
462
+ shellPath: string;
463
+ dialect: "bash" | "posix" | "windows" | "unknown";
464
+ background: boolean;
465
+ }
450
466
  export interface ToolRuntimeStartedEvent {
451
467
  type: "tool_started";
452
468
  toolCall: ToolUseBlock;
@@ -477,6 +493,8 @@ export interface AgentModelRequestEvent {
477
493
  }
478
494
  export interface AgentModelResponseEvent {
479
495
  type: "model_response";
496
+ /** Exact provider/model-call duration measured by the turn engine. */
497
+ modelTimeMs?: number;
480
498
  response: ChatResponse;
481
499
  }
482
500
  export interface AgentAssistantMessageEvent {
@@ -548,6 +566,9 @@ export type ToolRuntimeDispatchDecision = {
548
566
  dir: string;
549
567
  persist: boolean;
550
568
  };
569
+ executionAuthorization?: unknown;
570
+ approvalDecision?: "y" | "a" | "t";
571
+ approvalSource?: "policy" | "remembered" | "sudo" | "user";
551
572
  };
552
573
  export type ToolRuntimeToolCallHandler = (toolCall: ToolUseBlock, ctx: ToolExecutionContext) => Promise<ToolRuntimeDispatchDecision | undefined> | ToolRuntimeDispatchDecision | undefined;
553
574
  export type ToolRuntimeEventHandler = (event: ToolRuntimeEvent, ctx: ToolExecutionContext) => Promise<void> | void;
@@ -621,6 +642,8 @@ export interface ObserverExtensionRegistration<S extends Stage = Stage> {
621
642
  kind: "observer";
622
643
  order: number;
623
644
  enabled: boolean;
645
+ /** Runs after every enabled non-terminal observer registered for this stage. */
646
+ terminal?: boolean;
624
647
  run: Observer<S>;
625
648
  }
626
649
  export type AnyExtensionRegistration = {
@@ -1,3 +1,4 @@
1
+ import type { BashExecutionTarget, ToolExecutionContext } from "../shared/types.ts";
1
2
  import type { BackgroundProcessRegistry } from "./background-process-registry.ts";
2
3
  export interface BashToolInput {
3
4
  command: string;
@@ -18,16 +19,19 @@ export interface BashToolOptions {
18
19
  shellPath?: string;
19
20
  stripAnsi?: boolean;
20
21
  scrubEnvKeys?: readonly string[];
22
+ scrubEnvPrefixes?: readonly string[];
21
23
  backgroundRegistry?: BackgroundProcessRegistry;
24
+ verifyExecution?: (target: BashExecutionTarget, authorization: unknown, ctx: ToolExecutionContext) => Promise<void> | void;
22
25
  }
26
+ export declare function resolveBashExecutionTarget(input: Pick<BashToolInput, "command" | "cwd" | "runInBackground">, options?: Pick<BashToolOptions, "allowedDirs" | "defaultCwd" | "shellPath">): BashExecutionTarget;
23
27
  export declare function createBashTool(options?: BashToolOptions): import("../shared/types.ts").ToolDefinition<{
24
28
  description: string;
25
29
  command: string;
26
30
  timeoutMs?: number | undefined;
27
31
  cwd?: string | undefined;
32
+ runInBackground?: boolean | undefined;
28
33
  ignoreOutput?: boolean | undefined;
29
34
  outputRegex?: string | undefined;
30
- runInBackground?: boolean | undefined;
31
35
  }, string, import("../shared/types.ts").ToolOutputEnvelope, {
32
36
  type: "object";
33
37
  properties: {
@@ -62,9 +66,9 @@ export declare function createShellExecTool(options?: BashToolOptions): import("
62
66
  command: string;
63
67
  timeoutMs?: number | undefined;
64
68
  cwd?: string | undefined;
69
+ runInBackground?: boolean | undefined;
65
70
  ignoreOutput?: boolean | undefined;
66
71
  outputRegex?: string | undefined;
67
- runInBackground?: boolean | undefined;
68
72
  }, string, import("../shared/types.ts").ToolOutputEnvelope, {
69
73
  type: "object";
70
74
  properties: {