@nuvin/agent-core 0.1.0-rc.1 → 0.1.0-rc.11
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/topic-reminder-extension.d.ts +2 -2
- package/dist/chunk-BLGBVFVX.js +1 -0
- package/dist/chunk-FFIZ6TKW.js +1 -1
- package/dist/chunk-LIJXXCAA.js +1 -0
- package/dist/chunk-NYZR4XKO.js +1 -1
- package/dist/chunk-X7VAACWY.js +1 -1
- package/dist/chunk-YWQXXHHU.js +1 -0
- package/dist/formats/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/models/chat-model.d.ts +5 -3
- package/dist/models/index.js +1 -1
- package/dist/models/mock-model.d.ts +1 -1
- package/dist/models/model-registry.d.ts +0 -1
- package/dist/models/openai-model.d.ts +4 -0
- package/dist/models/openai-surfaces.d.ts +3 -0
- package/dist/models/routed-model.d.ts +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/types.d.ts +18 -2
- package/dist/tools/ask-user-tool.d.ts +1 -1
- package/dist/tools/bash-tool.d.ts +13 -2
- package/dist/tools/file-edit-tool.d.ts +5 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools/mcp-server-manager.d.ts +18 -1
- package/package.json +2 -2
- package/dist/chunk-55OPA5TR.js +0 -1
- package/dist/chunk-NHBKADBW.js +0 -1
- package/dist/chunk-QDOE7NWO.js +0 -1
|
@@ -6,7 +6,7 @@ export interface MockModelOptions {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class MockModel implements EngineChatModel {
|
|
8
8
|
readonly model: string;
|
|
9
|
-
readonly maxTokens
|
|
9
|
+
readonly maxTokens?: number;
|
|
10
10
|
readonly requests: ChatRequest[];
|
|
11
11
|
private readonly reasoning?;
|
|
12
12
|
constructor(options?: MockModelOptions);
|
|
@@ -33,7 +33,6 @@ export interface ResolvedModelProfile {
|
|
|
33
33
|
export declare function getProviderProfile(provider: string): ProviderProfile | undefined;
|
|
34
34
|
export declare function getModelProfile(provider: string, model: string): ModelProfile | undefined;
|
|
35
35
|
export declare function resolveModelProfile(provider: string, model: string): ResolvedModelProfile | undefined;
|
|
36
|
-
export declare function getDefaultMaxTokens(): number;
|
|
37
36
|
export declare function getDefaultModel(): string;
|
|
38
37
|
export declare function getCliDefaultModel(): string;
|
|
39
38
|
export declare function getProviderLabel(provider: string): string | undefined;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { BaseChatModelOptions, ChatRequest, ChatResponse, ChatResponseChunk, ModelExecutionOptions, ProviderCredential } from "../shared/types.ts";
|
|
2
2
|
import type { WebSocketFactory } from "./model-transports.ts";
|
|
3
|
+
import type { OpenAiPromptCacheKeyResolver } from "./openai-surfaces.ts";
|
|
3
4
|
import { OpenAiApiError } from "./openai-surfaces.ts";
|
|
4
5
|
import type { ProviderRequestMutator, ProviderSessionResolver, ResolvedProviderSession } from "./provider-session.ts";
|
|
5
6
|
import { type ProviderSessionManager } from "./provider-session.ts";
|
|
6
7
|
import { RoutedModel } from "./routed-model.ts";
|
|
7
8
|
export type { WebSocketFactory } from "./model-transports.ts";
|
|
9
|
+
export type { OpenAiPromptCacheKeyResolver } from "./openai-surfaces.ts";
|
|
8
10
|
export { OpenAiApiError };
|
|
9
11
|
export interface OpenAiRequestHeadersContext {
|
|
10
12
|
request?: ChatRequest;
|
|
@@ -21,6 +23,7 @@ export interface OpenAiModelOptions extends Partial<BaseChatModelOptions> {
|
|
|
21
23
|
responsesPath?: string;
|
|
22
24
|
fetch?: typeof globalThis.fetch;
|
|
23
25
|
providerSessionResolver?: ProviderSessionResolver;
|
|
26
|
+
promptCacheKeyResolver?: OpenAiPromptCacheKeyResolver;
|
|
24
27
|
requestMutators?: ProviderRequestMutator[];
|
|
25
28
|
headerResolver?: OpenAiHeaderResolver;
|
|
26
29
|
sessionManager?: ProviderSessionManager;
|
|
@@ -28,6 +31,7 @@ export interface OpenAiModelOptions extends Partial<BaseChatModelOptions> {
|
|
|
28
31
|
}
|
|
29
32
|
export declare class OpenAiModel extends RoutedModel {
|
|
30
33
|
private readonly responsesSocketSessions;
|
|
34
|
+
private readonly promptCacheKeyResolver?;
|
|
31
35
|
protected readonly chatCompletionsPath: string;
|
|
32
36
|
protected readonly responsesPath: string;
|
|
33
37
|
constructor(options?: OpenAiModelOptions);
|
|
@@ -6,6 +6,7 @@ export declare const OPENAI_CHAT_COMPLETIONS_STREAM_SURFACE = "openai-chat-compl
|
|
|
6
6
|
export declare const OPENAI_RESPONSES_SURFACE = "openai-responses";
|
|
7
7
|
export declare const OPENAI_RESPONSES_STREAM_SURFACE = "openai-responses-stream";
|
|
8
8
|
export declare const OPENAI_RESPONSES_WEBSOCKET_SURFACE = "openai-responses-ws";
|
|
9
|
+
export type OpenAiPromptCacheKeyResolver = (request: ChatRequest) => string | undefined;
|
|
9
10
|
interface OpenAiChatCompletionToolCall {
|
|
10
11
|
id: string;
|
|
11
12
|
type: "function";
|
|
@@ -62,12 +63,14 @@ export declare class OpenAiApiError extends Error {
|
|
|
62
63
|
export declare function createChatRequestBody(request: ChatRequest, stream: boolean): OpenAiChatCompletionsRequest;
|
|
63
64
|
export declare function createOpenAiResponsesWebSocketEvent(request: ChatRequest, options?: {
|
|
64
65
|
input?: ReturnType<typeof toOpenAiResponsesRequest>["input"];
|
|
66
|
+
promptCacheKey?: string;
|
|
65
67
|
previousResponseId?: string;
|
|
66
68
|
}): Record<string, unknown>;
|
|
67
69
|
export declare function createOpenAiApiError(response: Response): Promise<OpenAiApiError>;
|
|
68
70
|
export declare function createOpenAiResponsesStreamParser(request: ChatRequest): RoutedModelStreamParser;
|
|
69
71
|
export declare function createOpenAiSurfaces(options?: {
|
|
70
72
|
chatCompletionsPath?: string;
|
|
73
|
+
promptCacheKeyResolver?: OpenAiPromptCacheKeyResolver;
|
|
71
74
|
responsesPath?: string;
|
|
72
75
|
}): RoutedModelSurface[];
|
|
73
76
|
export {};
|
|
@@ -42,7 +42,7 @@ export interface RoutedModelOptions {
|
|
|
42
42
|
}
|
|
43
43
|
export declare class RoutedModel implements EngineChatModel {
|
|
44
44
|
readonly model: string;
|
|
45
|
-
readonly maxTokens
|
|
45
|
+
readonly maxTokens?: number;
|
|
46
46
|
protected readonly reasoning?: ReasoningConfig;
|
|
47
47
|
protected readonly apiKey?: string;
|
|
48
48
|
protected readonly baseUrl: string;
|
package/dist/shared/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x449cff,_0x34b35e){var _0x1abe19={_0x3022b4:0x19e,_0x39e9f8:0x19a,_0x51f1fe:0x19c,_0x3006e8:0x19c,_0x2243b1:0x198,_0x14ec78:0x19d,_0xb66913:0x1b3,_0x275a85:0x1b5,_0x4900f9:0x1b7,_0x46f519:0x1b2,_0x36085f:0x1b0,_0x4a718d:0x1b6,_0x57f630:0x1b4,_0x30fa89:0x1b1},_0x4f78ce=_0x449cff();function _0x53ee4e(_0x250ec3,_0x57edb6,_0x3c3583,_0x40070b){return _0xabc5(_0x3c3583-0x95,_0x250ec3);}function _0x19a654(_0x47e954,_0x35a031,_0x30dd2c,_0x1d334d){return _0xabc5(_0x35a031-0xaa,_0x47e954);}while(!![]){try{var _0x33d6c7=-parseInt(_0x53ee4e(0x196,_0x1abe19._0x3022b4,_0x1abe19._0x39e9f8,_0x1abe19._0x51f1fe))/0x1+-parseInt(_0x53ee4e(_0x1abe19._0x3006e8,_0x1abe19._0x2243b1,_0x1abe19._0x14ec78,0x198))/0x2+parseInt(_0x19a654(0x1b4,_0x1abe19._0xb66913,_0x1abe19._0x275a85,_0x1abe19._0x4900f9))/0x3*(parseInt(_0x19a654(_0x1abe19._0x46f519,0x1ad,0x1aa,0x1b2))/0x4)+parseInt(_0x19a654(0x1b4,_0x1abe19._0x36085f,0x1b0,0x1af))/0x5+-parseInt(_0x19a654(0x1b1,0x1b5,0x1b8,0x1b5))/0x6*(parseInt(_0x19a654(_0x1abe19._0x4a718d,_0x1abe19._0x57f630,0x1b5,0x1b4))/0x7)+parseInt(_0x19a654(_0x1abe19._0x30fa89,0x1ae,0x1ab,0x1ae))/0x8+parseInt(_0x53ee4e(0x198,0x19b,0x19c,0x19a))/0x9;if(_0x33d6c7===_0x34b35e)break;else _0x4f78ce['push'](_0x4f78ce['shift']());}catch(_0x3f61c1){_0x4f78ce['push'](_0x4f78ce['shift']());}}}(_0x5992,0xce5f7));function _0x5992(){var _0x5addfd=['mtrNEgfNAvC','mteWndqYrMHWyLbA','nJCYmdG4DevTCLbQ','ntiYnJmXmKDLyw5ysq','mtu4mJC2m2zJzKLAEq','nJG3mdG3nwT3DKLLEG','mtqWnJK2muH5wwfjwa','nZGYmdaYsMrID0z6','mtjqsvLOAKy'];_0x5992=function(){return _0x5addfd;};return _0x5992();}import{mapAutoReasoningEffortToBudgetTokens,resolveAnthropicThinkingConfig,resolveOpenAiReasoningConfig}from'../chunk-NYZR4XKO.js';import{TurnFailedError}from'../chunk-FFIZ6TKW.js';function _0xabc5(_0x49f003,_0x4417ee){_0x49f003=_0x49f003-0x103;var _0x599292=_0x5992();var _0xabc545=_0x599292[_0x49f003];if(_0xabc5['wKfiBV']===undefined){var _0x5863e1=function(_0x97c989){var _0x38d313='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x4efa0d='',_0x30d0c3='';for(var _0x24a94e=0x0,_0x42a495,_0x56717f,_0x2ea677=0x0;_0x56717f=_0x97c989['charAt'](_0x2ea677++);~_0x56717f&&(_0x42a495=_0x24a94e%0x4?_0x42a495*0x40+_0x56717f:_0x56717f,_0x24a94e++%0x4)?_0x4efa0d+=String['fromCharCode'](0xff&_0x42a495>>(-0x2*_0x24a94e&0x6)):0x0){_0x56717f=_0x38d313['indexOf'](_0x56717f);}for(var _0x421cdb=0x0,_0xc0345d=_0x4efa0d['length'];_0x421cdb<_0xc0345d;_0x421cdb++){_0x30d0c3+='%'+('00'+_0x4efa0d['charCodeAt'](_0x421cdb)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x30d0c3);};_0xabc5['eCTcNX']=_0x5863e1,_0xabc5['uOcKyq']={},_0xabc5['wKfiBV']=!![];}var _0x412cda=_0x599292[0x0],_0x1812dd=_0x49f003+_0x412cda,_0x3341b5=_0xabc5['uOcKyq'][_0x1812dd];return!_0x3341b5?(_0xabc545=_0xabc5['eCTcNX'](_0xabc545),_0xabc5['uOcKyq'][_0x1812dd]=_0xabc545):_0xabc545=_0x3341b5,_0xabc545;}import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';export{OperationAbortedError,TurnFailedError,addAbortListener,isAbortError,mapAutoReasoningEffortToBudgetTokens,resolveAnthropicThinkingConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type JsonValue = JsonObject | JsonPrimitive | JsonValue[];
|
|
|
6
6
|
export type JsonSchemaType = "array" | "boolean" | "number" | "object" | "string";
|
|
7
7
|
export interface JsonSchemaString {
|
|
8
8
|
type: "string";
|
|
9
|
+
description?: string;
|
|
9
10
|
}
|
|
10
11
|
export interface JsonSchemaNumber {
|
|
11
12
|
type: "number";
|
|
@@ -159,7 +160,7 @@ export interface OutputFormat {
|
|
|
159
160
|
}
|
|
160
161
|
export interface ModelRequest {
|
|
161
162
|
model: string;
|
|
162
|
-
max_tokens
|
|
163
|
+
max_tokens?: number;
|
|
163
164
|
reasoning?: ReasoningConfig;
|
|
164
165
|
system: TextBlock[];
|
|
165
166
|
messages: Message[];
|
|
@@ -182,7 +183,7 @@ export interface ModelResponse {
|
|
|
182
183
|
}
|
|
183
184
|
export interface ChatRequest {
|
|
184
185
|
model: string;
|
|
185
|
-
maxTokens
|
|
186
|
+
maxTokens?: number;
|
|
186
187
|
reasoning?: ReasoningConfig;
|
|
187
188
|
system: TextBlock[];
|
|
188
189
|
messages: Message[];
|
|
@@ -334,6 +335,12 @@ export interface ResolvedProviderSession {
|
|
|
334
335
|
}
|
|
335
336
|
export interface ProviderSessionResolver {
|
|
336
337
|
resolve(signal?: AbortSignal): Promise<ResolvedProviderSession>;
|
|
338
|
+
/**
|
|
339
|
+
* Optional hook invoked by {@link ProviderSessionManager.invalidate} before
|
|
340
|
+
* the cached session is dropped. Used by resolvers that must force a token
|
|
341
|
+
* refresh on the next resolve (e.g. ChatGPT OAuth after a provider 401).
|
|
342
|
+
*/
|
|
343
|
+
invalidate?(): void;
|
|
337
344
|
}
|
|
338
345
|
export interface PrepareRequestInput {
|
|
339
346
|
sessionId: string;
|
|
@@ -502,6 +509,15 @@ export type ToolRuntimeDispatchDecision = {
|
|
|
502
509
|
reason?: string;
|
|
503
510
|
} | {
|
|
504
511
|
action: "run";
|
|
512
|
+
/**
|
|
513
|
+
* Present when the user granted directory access as part of approving
|
|
514
|
+
* this call (dir-access prompt). Applied by the dispatcher that owns
|
|
515
|
+
* the live allowedDirs array; the tool runtime itself ignores it.
|
|
516
|
+
*/
|
|
517
|
+
grantDir?: {
|
|
518
|
+
dir: string;
|
|
519
|
+
persist: boolean;
|
|
520
|
+
};
|
|
505
521
|
};
|
|
506
522
|
export type ToolRuntimeToolCallHandler = (toolCall: ToolUseBlock, ctx: ToolExecutionContext) => Promise<ToolRuntimeDispatchDecision | undefined> | ToolRuntimeDispatchDecision | undefined;
|
|
507
523
|
export type ToolRuntimeEventHandler = (event: ToolRuntimeEvent, ctx: ToolExecutionContext) => Promise<void> | void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BackgroundProcessRegistry } from "./background-process-registry.ts";
|
|
2
2
|
export interface BashToolInput {
|
|
3
3
|
command: string;
|
|
4
|
+
description: string;
|
|
4
5
|
cwd?: string;
|
|
5
6
|
timeoutMs?: number;
|
|
6
7
|
ignoreOutput?: boolean;
|
|
@@ -19,6 +20,7 @@ export interface BashToolOptions {
|
|
|
19
20
|
backgroundRegistry?: BackgroundProcessRegistry;
|
|
20
21
|
}
|
|
21
22
|
export declare function createBashTool(options?: BashToolOptions): import("../shared/types.ts").ToolDefinition<{
|
|
23
|
+
description: string;
|
|
22
24
|
command: string;
|
|
23
25
|
timeoutMs?: number | undefined;
|
|
24
26
|
cwd?: string | undefined;
|
|
@@ -30,6 +32,10 @@ export declare function createBashTool(options?: BashToolOptions): import("../sh
|
|
|
30
32
|
command: {
|
|
31
33
|
type: "string";
|
|
32
34
|
};
|
|
35
|
+
description: {
|
|
36
|
+
type: "string";
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
33
39
|
cwd: {
|
|
34
40
|
type: "string";
|
|
35
41
|
};
|
|
@@ -43,9 +49,10 @@ export declare function createBashTool(options?: BashToolOptions): import("../sh
|
|
|
43
49
|
type: "boolean";
|
|
44
50
|
};
|
|
45
51
|
};
|
|
46
|
-
required: readonly ["command"];
|
|
52
|
+
required: readonly ["command", "description"];
|
|
47
53
|
}>;
|
|
48
54
|
export declare function createShellExecTool(options?: BashToolOptions): import("../shared/types.ts").ToolDefinition<{
|
|
55
|
+
description: string;
|
|
49
56
|
command: string;
|
|
50
57
|
timeoutMs?: number | undefined;
|
|
51
58
|
cwd?: string | undefined;
|
|
@@ -57,6 +64,10 @@ export declare function createShellExecTool(options?: BashToolOptions): import("
|
|
|
57
64
|
command: {
|
|
58
65
|
type: "string";
|
|
59
66
|
};
|
|
67
|
+
description: {
|
|
68
|
+
type: "string";
|
|
69
|
+
description: string;
|
|
70
|
+
};
|
|
60
71
|
cwd: {
|
|
61
72
|
type: "string";
|
|
62
73
|
};
|
|
@@ -70,6 +81,6 @@ export declare function createShellExecTool(options?: BashToolOptions): import("
|
|
|
70
81
|
type: "boolean";
|
|
71
82
|
};
|
|
72
83
|
};
|
|
73
|
-
required: readonly ["command"];
|
|
84
|
+
required: readonly ["command", "description"];
|
|
74
85
|
}>;
|
|
75
86
|
//# sourceMappingURL=bash-tool.d.ts.map
|
|
@@ -7,6 +7,7 @@ export declare function createFileEditTool(options?: FileEditToolOptions): impor
|
|
|
7
7
|
filePath: string;
|
|
8
8
|
oldText: string;
|
|
9
9
|
newText: string;
|
|
10
|
+
description?: string | undefined;
|
|
10
11
|
dryRun?: boolean | undefined;
|
|
11
12
|
}, import("../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
12
13
|
type: "object";
|
|
@@ -14,6 +15,10 @@ export declare function createFileEditTool(options?: FileEditToolOptions): impor
|
|
|
14
15
|
filePath: {
|
|
15
16
|
type: "string";
|
|
16
17
|
};
|
|
18
|
+
description: {
|
|
19
|
+
type: "string";
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
17
22
|
oldText: {
|
|
18
23
|
type: "string";
|
|
19
24
|
};
|