@nuvin/agent-core 0.1.0-rc.1 → 0.1.0-rc.10
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 _0x4508(_0x5c8dcf,_0x48b569){_0x5c8dcf=_0x5c8dcf-0x147;var _0x541dae=_0x541d();var _0x45088c=_0x541dae[_0x5c8dcf];if(_0x4508['Sxflfa']===undefined){var _0x2e23b1=function(_0x5a5431){var _0x32af1c='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x4185f7='',_0x5655d7='';for(var _0x36ed13=0x0,_0x4c333a,_0x15e0e2,_0xa23592=0x0;_0x15e0e2=_0x5a5431['charAt'](_0xa23592++);~_0x15e0e2&&(_0x4c333a=_0x36ed13%0x4?_0x4c333a*0x40+_0x15e0e2:_0x15e0e2,_0x36ed13++%0x4)?_0x4185f7+=String['fromCharCode'](0xff&_0x4c333a>>(-0x2*_0x36ed13&0x6)):0x0){_0x15e0e2=_0x32af1c['indexOf'](_0x15e0e2);}for(var _0x2b25d7=0x0,_0x4151b2=_0x4185f7['length'];_0x2b25d7<_0x4151b2;_0x2b25d7++){_0x5655d7+='%'+('00'+_0x4185f7['charCodeAt'](_0x2b25d7)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5655d7);};_0x4508['FTDexN']=_0x2e23b1,_0x4508['hGbZYB']={},_0x4508['Sxflfa']=!![];}var _0x480626=_0x541dae[0x0],_0x2ded0b=_0x5c8dcf+_0x480626,_0x1efca5=_0x4508['hGbZYB'][_0x2ded0b];return!_0x1efca5?(_0x45088c=_0x4508['FTDexN'](_0x45088c),_0x4508['hGbZYB'][_0x2ded0b]=_0x45088c):_0x45088c=_0x1efca5,_0x45088c;}function _0x541d(){var _0x3906d7=['m2jzt3DNDG','mtaXodmXnZzbDKzdqK0','mtm2odC4otzkyuPKBxO','mLLfv1LsyW','nte1ndy1nevtuxDfDa','mte2nduWmLH4CgfOsq','nw5ssgT5Ba','mJa5CvzIAuHA','otC3mde4n0jetKvWvq','oenJwNnMuq','nZiWmtbYEgjcyNK','odCYmZmYvxDUBeHK'];_0x541d=function(){return _0x3906d7;};return _0x541d();}(function(_0xdc3ac6,_0x3c217b){var _0x3ed521={_0x3b3aa2:0x12b,_0x4f46dc:0x132,_0xcb4841:0x12f,_0x1a005b:0x12f,_0x4b1f3b:0x121,_0x20fab4:0x127,_0x38c1da:0x8f,_0x508780:0x91,_0x4dad03:0x123,_0x29bb97:0x126,_0x5d8990:0x88,_0x1ad538:0x8c,_0x375123:0x12d,_0x12d121:0x12e,_0x118e96:0x128,_0x41288d:0x90,_0x3fda44:0x92,_0x43a1d4:0x93,_0x1c6847:0x131,_0x3a05ec:0x12d,_0x2f31b9:0x125,_0x352127:0x12a,_0x9e7dd8:0x123,_0x23cb4f:0x92,_0x333ba0:0x8f,_0x184642:0x8c,_0x461d1c:0x8e};function _0x1041b7(_0x9e5960,_0x201844,_0x1bd7ff,_0x5a8dcc){return _0x4508(_0x5a8dcc- -0x22,_0x201844);}function _0x55c4d8(_0xfab75b,_0x4e68bb,_0x1b6cd3,_0x4bfd05){return _0x4508(_0x4bfd05- -0x1de,_0x1b6cd3);}var _0x1f86c6=_0xdc3ac6();while(!![]){try{var _0x341431=parseInt(_0x1041b7(_0x3ed521._0x3b3aa2,_0x3ed521._0x4f46dc,_0x3ed521._0xcb4841,_0x3ed521._0x1a005b))/0x1*(parseInt(_0x1041b7(0x125,_0x3ed521._0x4b1f3b,0x12b,0x125))/0x2)+parseInt(_0x1041b7(_0x3ed521._0x20fab4,0x129,0x12c,0x12c))/0x3*(parseInt(_0x55c4d8(-_0x3ed521._0x38c1da,-0x90,-0x93,-_0x3ed521._0x508780))/0x4)+-parseInt(_0x1041b7(0x12a,0x126,_0x3ed521._0x4dad03,_0x3ed521._0x29bb97))/0x5*(-parseInt(_0x55c4d8(-_0x3ed521._0x5d8990,-_0x3ed521._0x1ad538,-0x8f,-_0x3ed521._0x1ad538))/0x6)+-parseInt(_0x1041b7(_0x3ed521._0x3b3aa2,_0x3ed521._0x375123,_0x3ed521._0x12d121,_0x3ed521._0x118e96))/0x7+parseInt(_0x55c4d8(-_0x3ed521._0x41288d,-_0x3ed521._0x3fda44,-_0x3ed521._0x43a1d4,-0x93))/0x8*(-parseInt(_0x1041b7(0x133,_0x3ed521._0x1c6847,0x12e,_0x3ed521._0x3a05ec))/0x9)+parseInt(_0x1041b7(0x130,_0x3ed521._0x2f31b9,0x129,_0x3ed521._0x352127))/0xa*(-parseInt(_0x1041b7(_0x3ed521._0x4b1f3b,0x121,_0x3ed521._0x9e7dd8,0x127))/0xb)+parseInt(_0x55c4d8(-_0x3ed521._0x23cb4f,-_0x3ed521._0x333ba0,-_0x3ed521._0x184642,-_0x3ed521._0x461d1c))/0xc;if(_0x341431===_0x3c217b)break;else _0x1f86c6['push'](_0x1f86c6['shift']());}catch(_0x553703){_0x1f86c6['push'](_0x1f86c6['shift']());}}}(_0x541d,0xaf5f8));import{mapAutoReasoningEffortToBudgetTokens,resolveAnthropicThinkingConfig,resolveOpenAiReasoningConfig}from'../chunk-NYZR4XKO.js';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};
|
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
|
};
|