@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.
- package/dist/VERSION +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/chunk-55OPA5TR.js +1 -0
- package/dist/chunk-FFIZ6TKW.js +1 -1
- package/dist/chunk-NHBKADBW.js +1 -1
- package/dist/chunk-NYZR4XKO.js +1 -1
- package/dist/chunk-QDOE7NWO.js +1 -1
- package/dist/chunk-X7VAACWY.js +1 -1
- package/dist/formats/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/models/chat-model.d.ts +2 -0
- package/dist/models/index.js +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/types.d.ts +15 -0
- package/dist/tools/background-process-registry.d.ts +64 -0
- package/dist/tools/bash-internals.d.ts +5 -0
- package/dist/tools/bash-output-tool.d.ts +20 -0
- package/dist/tools/bash-tool.d.ts +12 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools/kill-shell-tool.d.ts +16 -0
- package/package.json +2 -2
- package/dist/chunk-HRU363DY.js +0 -1
package/dist/shared/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
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};
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -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
|
}>;
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -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";
|