@nuvin/agent-core 0.0.0 → 0.1.0-rc.1

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(_0x2cd82a,_0x454dea){var _0x442099={_0x30b1cf:0x2f8,_0x4a1ed8:0x2fc,_0x1a2acb:0x2fa,_0x54f30a:0x248,_0x351893:0x248,_0x5de95b:0x245,_0x152bb3:0x243,_0x2e653:0x23f,_0x547ca7:0x246,_0x2e4a14:0x24a,_0x51fd05:0x247,_0x81594a:0x2f7,_0x582f03:0x2fb,_0x289fe3:0x300,_0x5504cb:0x249,_0x13f5ee:0x303},_0x5e8892={_0x446dbf:0x181},_0x5613d3=_0x2cd82a();function _0x195084(_0x48f541,_0x59df2a,_0x21bb1b,_0x2d2b4d){return _0x2f7b(_0x59df2a-0xcc,_0x48f541);}function _0x1e9e03(_0x152a4c,_0x2e1266,_0x1c116a,_0x180d1e){return _0x2f7b(_0x180d1e-_0x5e8892._0x446dbf,_0x1c116a);}while(!![]){try{var _0x5c52bb=parseInt(_0x1e9e03(_0x442099._0x30b1cf,0x2ff,0x2f6,0x2fa))/0x1+parseInt(_0x1e9e03(_0x442099._0x4a1ed8,0x2f9,_0x442099._0x1a2acb,0x2fc))/0x2*(parseInt(_0x195084(_0x442099._0x54f30a,_0x442099._0x351893,0x24d,_0x442099._0x5de95b))/0x3)+parseInt(_0x1e9e03(_0x442099._0x1a2acb,0x2f7,0x2f6,0x2f8))/0x4*(-parseInt(_0x195084(0x248,0x244,_0x442099._0x152bb3,_0x442099._0x2e653))/0x5)+-parseInt(_0x195084(0x247,_0x442099._0x547ca7,_0x442099._0x2e4a14,_0x442099._0x51fd05))/0x6*(parseInt(_0x1e9e03(0x2f5,0x2f9,0x2f3,_0x442099._0x81594a))/0x7)+parseInt(_0x1e9e03(0x2fe,_0x442099._0x582f03,0x305,_0x442099._0x289fe3))/0x8+-parseInt(_0x195084(0x24d,0x249,0x24e,_0x442099._0x5504cb))/0x9+-parseInt(_0x1e9e03(0x301,_0x442099._0x13f5ee,0x2fd,0x2ff))/0xa;if(_0x5c52bb===_0x454dea)break;else _0x5613d3['push'](_0x5613d3['shift']());}catch(_0x5a27b0){_0x5613d3['push'](_0x5613d3['shift']());}}}(_0x3adc,0x6237c));import{mapAutoReasoningEffortToBudgetTokens,resolveAnthropicThinkingConfig,resolveOpenAiReasoningConfig}from'../chunk-NYZR4XKO.js';function _0x2f7b(_0x2bba3a,_0x50aedd){_0x2bba3a=_0x2bba3a-0x176;var _0x3adc84=_0x3adc();var _0x2f7b23=_0x3adc84[_0x2bba3a];if(_0x2f7b['ePFOAF']===undefined){var _0x371c37=function(_0xbff65b){var _0x59219f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x200a0a='',_0x532180='';for(var _0x3e4b2e=0x0,_0x1d7cac,_0x2a442f,_0x5e6b11=0x0;_0x2a442f=_0xbff65b['charAt'](_0x5e6b11++);~_0x2a442f&&(_0x1d7cac=_0x3e4b2e%0x4?_0x1d7cac*0x40+_0x2a442f:_0x2a442f,_0x3e4b2e++%0x4)?_0x200a0a+=String['fromCharCode'](0xff&_0x1d7cac>>(-0x2*_0x3e4b2e&0x6)):0x0){_0x2a442f=_0x59219f['indexOf'](_0x2a442f);}for(var _0xbc7e1b=0x0,_0x2738a3=_0x200a0a['length'];_0xbc7e1b<_0x2738a3;_0xbc7e1b++){_0x532180+='%'+('00'+_0x200a0a['charCodeAt'](_0xbc7e1b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x532180);};_0x2f7b['UFPXgL']=_0x371c37,_0x2f7b['ramQTw']={},_0x2f7b['ePFOAF']=!![];}var _0x41ccbc=_0x3adc84[0x0],_0x230b79=_0x2bba3a+_0x41ccbc,_0x465971=_0x2f7b['ramQTw'][_0x230b79];return!_0x465971?(_0x2f7b23=_0x2f7b['UFPXgL'](_0x2f7b23),_0x2f7b['ramQTw'][_0x230b79]=_0x2f7b23):_0x2f7b23=_0x465971,_0x2f7b23;}import{TurnFailedError}from'../chunk-FFIZ6TKW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';export{OperationAbortedError,TurnFailedError,addAbortListener,isAbortError,mapAutoReasoningEffortToBudgetTokens,resolveAnthropicThinkingConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};function _0x3adc(){var _0x144d6d=['mJi2mJqXmhbPweDoEq','nJmWody2neP0u2jgAq','nJqWnta3qKvYq2XA','mtiYodyYofDSAKXKvW','nvbPtMLgBG','ntK4mta0qKfHAgPh','nMH1u0nHsa','ndu2CfzdtxvN','mZi0m1jPBxnMzq','ntq1mZyWneXPBMLyBW'];_0x3adc=function(){return _0x144d6d;};return _0x3adc();}
1
+ (function(_0x516650,_0xa1311a){var _0x3b7553={_0x12490f:0x248,_0x4cf33c:0x24e,_0xa5c352:0x249,_0x32d3ef:0x24a,_0xfd935b:0x250,_0x6e161:0x243,_0x454059:0x237,_0x3be5c6:0x236,_0x4dc97d:0x236,_0x363110:0x238,_0x9b2505:0x244,_0x46bffc:0x247,_0x5a0662:0x247,_0x312419:0x237,_0x4c7cd1:0x245,_0x37ba09:0x242},_0x43943b={_0x1aa851:0x3e4};function _0x3657be(_0x516416,_0x37af82,_0x4983ae,_0x4330cd){return _0x35f3(_0x516416-0x93,_0x37af82);}var _0x1d3c8c=_0x516650();function _0x355e3f(_0x4f7964,_0x186616,_0x510366,_0x7ed936){return _0x35f3(_0x510366- -_0x43943b._0x1aa851,_0x4f7964);}while(!![]){try{var _0x520bbe=parseInt(_0x3657be(_0x3b7553._0x12490f,0x24c,_0x3b7553._0x4cf33c,_0x3b7553._0xa5c352))/0x1*(parseInt(_0x3657be(_0x3b7553._0x32d3ef,0x24f,_0x3b7553._0xfd935b,0x24d))/0x2)+-parseInt(_0x3657be(0x240,_0x3b7553._0x6e161,0x245,0x246))/0x3*(parseInt(_0x355e3f(-_0x3b7553._0x454059,-0x230,-0x231,-0x235))/0x4)+-parseInt(_0x355e3f(-0x235,-0x238,-0x232,-0x238))/0x5+parseInt(_0x355e3f(-0x237,-_0x3b7553._0x3be5c6,-_0x3b7553._0x4dc97d,-_0x3b7553._0x363110))/0x6*(-parseInt(_0x3657be(0x249,_0x3b7553._0x9b2505,0x24a,_0x3b7553._0x4cf33c))/0x7)+parseInt(_0x3657be(_0x3b7553._0x46bffc,_0x3b7553._0x5a0662,0x246,0x24c))/0x8*(-parseInt(_0x355e3f(-0x238,-0x22f,-0x233,-_0x3b7553._0x312419))/0x9)+parseInt(_0x355e3f(-0x238,-0x233,-0x234,-0x235))/0xa+parseInt(_0x3657be(0x24b,0x24c,0x245,_0x3b7553._0x4c7cd1))/0xb*(parseInt(_0x3657be(_0x3b7553._0x37ba09,0x243,0x240,0x23c))/0xc);if(_0x520bbe===_0xa1311a)break;else _0x1d3c8c['push'](_0x1d3c8c['shift']());}catch(_0x15f642){_0x1d3c8c['push'](_0x1d3c8c['shift']());}}}(_0x4bb5,0xde206));import{mapAutoReasoningEffortToBudgetTokens,resolveAnthropicThinkingConfig,resolveOpenAiReasoningConfig}from'../chunk-NYZR4XKO.js';function _0x4bb5(){var _0x462858=['mJGYmZm0mhvtAuLqtq','mteYmtCZmMXmzxDZDW','oti5nK9HwvHXza','mMDZq0nSDG','mZyWmtvRAfzhq1e','mtq3nZCYnMjzs2rtqW','mti2mtDjCxrSANC','mtjmruvPrw4','odr2AxbVrNu','mJe1mJHZvK5bzLm','ndaYodGYmfbnv3rtDa','otGZn3bfELjQza'];_0x4bb5=function(){return _0x462858;};return _0x4bb5();}import{TurnFailedError}from'../chunk-FFIZ6TKW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';function _0x35f3(_0x3bc35e,_0x1a5460){_0x3bc35e=_0x3bc35e-0x1ad;var _0x4bb599=_0x4bb5();var _0x35f373=_0x4bb599[_0x3bc35e];if(_0x35f3['dlcxFU']===undefined){var _0x29b7cd=function(_0x10fd95){var _0x16b1f5='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x55d045='',_0x566873='';for(var _0x124bf7=0x0,_0x20e49b,_0x2dcd18,_0xe68fa8=0x0;_0x2dcd18=_0x10fd95['charAt'](_0xe68fa8++);~_0x2dcd18&&(_0x20e49b=_0x124bf7%0x4?_0x20e49b*0x40+_0x2dcd18:_0x2dcd18,_0x124bf7++%0x4)?_0x55d045+=String['fromCharCode'](0xff&_0x20e49b>>(-0x2*_0x124bf7&0x6)):0x0){_0x2dcd18=_0x16b1f5['indexOf'](_0x2dcd18);}for(var _0x3a3eae=0x0,_0x5ca88c=_0x55d045['length'];_0x3a3eae<_0x5ca88c;_0x3a3eae++){_0x566873+='%'+('00'+_0x55d045['charCodeAt'](_0x3a3eae)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x566873);};_0x35f3['SDieXY']=_0x29b7cd,_0x35f3['KcVGYK']={},_0x35f3['dlcxFU']=!![];}var _0x15d7d6=_0x4bb599[0x0],_0x1cf5ad=_0x3bc35e+_0x15d7d6,_0x54212c=_0x35f3['KcVGYK'][_0x1cf5ad];return!_0x54212c?(_0x35f373=_0x35f3['SDieXY'](_0x35f373),_0x35f3['KcVGYK'][_0x1cf5ad]=_0x35f373):_0x35f373=_0x54212c,_0x35f373;}export{OperationAbortedError,TurnFailedError,addAbortListener,isAbortError,mapAutoReasoningEffortToBudgetTokens,resolveAnthropicThinkingConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
@@ -356,8 +356,21 @@ export interface ChatModel {
356
356
  export interface ModelExecutionOptions {
357
357
  signal?: AbortSignal;
358
358
  }
359
+ export interface TurnMessageMeta {
360
+ provider?: string;
361
+ model?: string;
362
+ /** ms epoch — provider request sent. */
363
+ turnStartedAt?: number;
364
+ /** ms epoch — response fully received. */
365
+ turnCompletedAt?: number;
366
+ /** ms epoch — first reasoning/thinking delta. */
367
+ reasoningStartedAt?: number;
368
+ /** ms epoch — reasoning settled (first assistant text / done). */
369
+ reasoningCompletedAt?: number;
370
+ }
359
371
  export interface EngineChatModel {
360
372
  model: string;
373
+ provider?: string;
361
374
  maxTokens?: number;
362
375
  complete(request: ChatRequest, options?: ModelExecutionOptions): Promise<ChatResponse>;
363
376
  stream?(request: ChatRequest, options?: ModelExecutionOptions): AsyncIterable<ChatResponseChunk>;
@@ -537,6 +550,8 @@ export interface PayloadByStage {
537
550
  }
538
551
  export interface ExtensionContext {
539
552
  state: TurnState;
553
+ /** Present only on the assistant-message `afterMessageAppend` run. */
554
+ turnMeta?: TurnMessageMeta;
540
555
  }
541
556
  export type Transformer<S extends TransformableStage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => PayloadByStage[S] | Promise<PayloadByStage[S]>;
542
557
  export type Observer<S extends Stage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => Promise<void> | void;
@@ -0,0 +1,64 @@
1
+ import type { ChildProcess } from "node:child_process";
2
+ import { StringDecoder } from "node:string_decoder";
3
+ export type BackgroundProcessStatus = "running" | "exited" | "killed" | "error";
4
+ export interface BackgroundProcessEntry {
5
+ shellId: string;
6
+ command: string;
7
+ cwd: string;
8
+ pid: number | undefined;
9
+ status: BackgroundProcessStatus;
10
+ exitCode: number | null;
11
+ signal: NodeJS.Signals | null;
12
+ startedAt: number;
13
+ error?: string;
14
+ child: ChildProcess | null;
15
+ buffer: string[];
16
+ bufferChars: number;
17
+ totalProduced: number;
18
+ totalDropped: number;
19
+ readCursor: number;
20
+ stdoutDecoder: StringDecoder;
21
+ stderrDecoder: StringDecoder;
22
+ stripAnsi: boolean;
23
+ killRequested: boolean;
24
+ processExited: boolean;
25
+ }
26
+ export interface BackgroundProcessReadResult {
27
+ output: string;
28
+ status: BackgroundProcessStatus;
29
+ exitCode: number | null;
30
+ signal: NodeJS.Signals | null;
31
+ truncated: boolean;
32
+ }
33
+ export interface BackgroundProcessRegistryOptions {
34
+ maxConcurrent?: number;
35
+ maxEntries?: number;
36
+ capChars?: number;
37
+ }
38
+ export declare class BackgroundProcessRegistry {
39
+ private readonly entries;
40
+ private readonly maxConcurrent;
41
+ private readonly maxEntries;
42
+ private readonly capChars;
43
+ private counter;
44
+ constructor(opts?: BackgroundProcessRegistryOptions);
45
+ spawn(opts: {
46
+ child: ChildProcess;
47
+ command: string;
48
+ cwd: string;
49
+ stripAnsi: boolean;
50
+ }): BackgroundProcessEntry;
51
+ read(shellId: string, opts?: {
52
+ regex?: string;
53
+ }): BackgroundProcessReadResult;
54
+ list(): BackgroundProcessEntry[];
55
+ kill(shellId: string): {
56
+ status: BackgroundProcessStatus;
57
+ exitCode: number | null;
58
+ signal: NodeJS.Signals | null;
59
+ };
60
+ closeAll(): Promise<void>;
61
+ private append;
62
+ private evictIfNeeded;
63
+ }
64
+ //# sourceMappingURL=background-process-registry.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { spawn } from "node:child_process";
2
+ export declare function isErrnoException(error: unknown): error is NodeJS.ErrnoException;
3
+ export declare function stripAnsiAndControls(s: string): string;
4
+ export declare function killProcessGroup(child: ReturnType<typeof spawn>, isWindows: boolean, signal?: NodeJS.Signals): void;
5
+ //# sourceMappingURL=bash-internals.d.ts.map
@@ -0,0 +1,20 @@
1
+ import type { BackgroundProcessRegistry } from "./background-process-registry.ts";
2
+ export interface BashOutputToolOptions {
3
+ registry: BackgroundProcessRegistry;
4
+ }
5
+ export declare function createBashOutputTool(options: BashOutputToolOptions): import("../shared/types.ts").ToolDefinition<{
6
+ shellId: string;
7
+ regex?: string | undefined;
8
+ }, never, import("../shared/types.ts").ToolOutputEnvelope, {
9
+ type: "object";
10
+ properties: {
11
+ shellId: {
12
+ type: "string";
13
+ };
14
+ regex: {
15
+ type: "string";
16
+ };
17
+ };
18
+ required: readonly ["shellId"];
19
+ }>;
20
+ //# sourceMappingURL=bash-output-tool.d.ts.map
@@ -1,8 +1,10 @@
1
+ import type { BackgroundProcessRegistry } from "./background-process-registry.ts";
1
2
  export interface BashToolInput {
2
3
  command: string;
3
4
  cwd?: string;
4
5
  timeoutMs?: number;
5
6
  ignoreOutput?: boolean;
7
+ runInBackground?: boolean;
6
8
  }
7
9
  export interface BashToolOptions {
8
10
  allowedDirs?: readonly string[];
@@ -13,12 +15,15 @@ export interface BashToolOptions {
13
15
  name?: string;
14
16
  shellPath?: string;
15
17
  stripAnsi?: boolean;
18
+ scrubEnvKeys?: readonly string[];
19
+ backgroundRegistry?: BackgroundProcessRegistry;
16
20
  }
17
21
  export declare function createBashTool(options?: BashToolOptions): import("../shared/types.ts").ToolDefinition<{
18
22
  command: string;
19
23
  timeoutMs?: number | undefined;
20
24
  cwd?: string | undefined;
21
25
  ignoreOutput?: boolean | undefined;
26
+ runInBackground?: boolean | undefined;
22
27
  }, string, import("../shared/types.ts").ToolOutputEnvelope, {
23
28
  type: "object";
24
29
  properties: {
@@ -34,6 +39,9 @@ export declare function createBashTool(options?: BashToolOptions): import("../sh
34
39
  ignoreOutput: {
35
40
  type: "boolean";
36
41
  };
42
+ runInBackground: {
43
+ type: "boolean";
44
+ };
37
45
  };
38
46
  required: readonly ["command"];
39
47
  }>;
@@ -42,6 +50,7 @@ export declare function createShellExecTool(options?: BashToolOptions): import("
42
50
  timeoutMs?: number | undefined;
43
51
  cwd?: string | undefined;
44
52
  ignoreOutput?: boolean | undefined;
53
+ runInBackground?: boolean | undefined;
45
54
  }, string, import("../shared/types.ts").ToolOutputEnvelope, {
46
55
  type: "object";
47
56
  properties: {
@@ -57,6 +66,9 @@ export declare function createShellExecTool(options?: BashToolOptions): import("
57
66
  ignoreOutput: {
58
67
  type: "boolean";
59
68
  };
69
+ runInBackground: {
70
+ type: "boolean";
71
+ };
60
72
  };
61
73
  required: readonly ["command"];
62
74
  }>;
@@ -1,5 +1,7 @@
1
1
  export * from "../lsp/index.ts";
2
2
  export * from "./ask-user-tool.ts";
3
+ export * from "./background-process-registry.ts";
4
+ export * from "./bash-output-tool.ts";
3
5
  export * from "./bash-tool.ts";
4
6
  export * from "./command-tool.ts";
5
7
  export * from "./file-edit-tool.ts";
@@ -8,6 +10,7 @@ export * from "./file-read-tool.ts";
8
10
  export * from "./glob-tool.ts";
9
11
  export * from "./grep-tool.ts";
10
12
  export * from "./internal-tool-runtime.ts";
13
+ export * from "./kill-shell-tool.ts";
11
14
  export * from "./ls-tool.ts";
12
15
  export * from "./lsp-tool.ts";
13
16
  export * from "./mcp-oauth-provider.ts";