@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.
- package/dist/VERSION +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/agent/metrics.d.ts +9 -1
- package/dist/chunk-A4CS4HLK.js +1 -0
- package/dist/chunk-D5IVWJHX.js +1 -1
- package/dist/chunk-FFIZ6TKW.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/models/index.js +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/types.d.ts +23 -0
- package/dist/tools/bash-tool.d.ts +6 -2
- package/dist/tools/index.js +1 -1
- package/dist/tools/runtime-manager-tools.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunk-QKOKWD5Y.js +0 -1
package/dist/shared/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
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};
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -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: {
|