@nuvin/agent-core 0.1.0-rc.8 → 0.1.0
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-BLGBVFVX.js +1 -0
- package/dist/chunk-D5IVWJHX.js +1 -0
- package/dist/chunk-FFIZ6TKW.js +1 -1
- package/dist/chunk-NYZR4XKO.js +1 -1
- package/dist/chunk-UIXQPCSN.js +1 -0
- 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 +4 -2
- package/dist/models/index.js +1 -1
- package/dist/models/mock-model.d.ts +3 -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 +3 -1
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -1
- package/dist/shared/model-identity.d.ts +2 -0
- package/dist/shared/types.d.ts +10 -2
- package/dist/tools/index.js +1 -1
- package/dist/tools/mcp-server-manager.d.ts +6 -6
- package/package.json +2 -2
- package/dist/chunk-FKZ3QQWZ.js +0 -1
- package/dist/chunk-NHBKADBW.js +0 -1
- package/dist/chunk-QDOE7NWO.js +0 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { ChatRequest, ChatResponse, EngineChatModel, ModelExecutionOptions, ReasoningConfig } from "../shared/types.ts";
|
|
2
2
|
export interface MockModelOptions {
|
|
3
3
|
model?: string;
|
|
4
|
+
modelIdentity?: string;
|
|
4
5
|
maxTokens?: number;
|
|
5
6
|
reasoning?: ReasoningConfig;
|
|
6
7
|
}
|
|
7
8
|
export declare class MockModel implements EngineChatModel {
|
|
8
9
|
readonly model: string;
|
|
9
|
-
readonly
|
|
10
|
+
readonly modelIdentity: string;
|
|
11
|
+
readonly maxTokens?: number;
|
|
10
12
|
readonly requests: ChatRequest[];
|
|
11
13
|
private readonly reasoning?;
|
|
12
14
|
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 {};
|
|
@@ -30,6 +30,7 @@ export interface RoutedModelOptions {
|
|
|
30
30
|
baseUrl: string;
|
|
31
31
|
fetch?: typeof globalThis.fetch;
|
|
32
32
|
model: string;
|
|
33
|
+
modelIdentity?: string;
|
|
33
34
|
maxTokens?: number;
|
|
34
35
|
reasoning?: ReasoningConfig;
|
|
35
36
|
providerAdapter: ProviderAdapter;
|
|
@@ -42,7 +43,8 @@ export interface RoutedModelOptions {
|
|
|
42
43
|
}
|
|
43
44
|
export declare class RoutedModel implements EngineChatModel {
|
|
44
45
|
readonly model: string;
|
|
45
|
-
readonly
|
|
46
|
+
readonly modelIdentity: string;
|
|
47
|
+
readonly maxTokens?: number;
|
|
46
48
|
protected readonly reasoning?: ReasoningConfig;
|
|
47
49
|
protected readonly apiKey?: string;
|
|
48
50
|
protected readonly baseUrl: string;
|
package/dist/shared/index.d.ts
CHANGED
package/dist/shared/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function _0x115b(){var _0x5b3cb7=['mteZmZC5mgHnqLPOCG','ndC0mZGWowLkAefxtq','mJmZmdjuwhHYq1O','otC3otqZmM1QCLDOEq','nJe4uvLVD3nU','mtq5nZqZogLSDvHZDW','mJaZmdHJA1fPCeS','nJK5mZeXnfvvC0n2rG','nZLOr0zus0q'];_0x115b=function(){return _0x5b3cb7;};return _0x115b();}(function(_0x1270b4,_0x355ec2){var _0x524b29={_0x5364ae:0x1ee,_0x202300:0x1e7,_0x2cb361:0x1ec,_0x26d465:0x1ed,_0x4ff5a7:0x1ef,_0x204b8c:0x1e8,_0x28fb9f:0x1eb,_0x39d03b:0x1e9,_0x4f2e7d:0x1ea,_0x2d6a90:0x34d,_0xd8c14a:0x34d,_0x25a0d7:0x350,_0x2c8cf9:0x1f1,_0x5f1860:0x1ec},_0x3eebef={_0x5d110d:0x256},_0x52c083={_0x728fb6:0x2e7};function _0x17176f(_0x4183a3,_0x34f02e,_0x3e1533,_0xead982){return _0x3ee1(_0x4183a3-_0x52c083._0x728fb6,_0x34f02e);}function _0x524e92(_0x1b48d5,_0xa3c274,_0x1f31f5,_0x43907d){return _0x3ee1(_0xa3c274- -_0x3eebef._0x5d110d,_0x1b48d5);}var _0x587a46=_0x1270b4();while(!![]){try{var _0x560067=-parseInt(_0x524e92(-_0x524b29._0x5364ae,-0x1e9,-0x1ed,-_0x524b29._0x202300))/0x1*(-parseInt(_0x524e92(-_0x524b29._0x2cb361,-0x1ef,-_0x524b29._0x26d465,-0x1ee))/0x2)+-parseInt(_0x524e92(-_0x524b29._0x4ff5a7,-_0x524b29._0x26d465,-0x1f1,-_0x524b29._0x204b8c))/0x3*(-parseInt(_0x524e92(-0x1ec,-_0x524b29._0x28fb9f,-0x1e6,-_0x524b29._0x5364ae))/0x4)+parseInt(_0x524e92(-0x1e7,-0x1e8,-_0x524b29._0x2cb361,-_0x524b29._0x39d03b))/0x5+-parseInt(_0x524e92(-0x1e8,-_0x524b29._0x4f2e7d,-_0x524b29._0x4f2e7d,-0x1ea))/0x6+parseInt(_0x17176f(_0x524b29._0x2d6a90,_0x524b29._0xd8c14a,_0x524b29._0x25a0d7,0x350))/0x7+-parseInt(_0x524e92(-0x1eb,-_0x524b29._0x5364ae,-0x1eb,-0x1eb))/0x8+parseInt(_0x524e92(-_0x524b29._0x2c8cf9,-_0x524b29._0x5f1860,-0x1e8,-0x1ed))/0x9;if(_0x560067===_0x355ec2)break;else _0x587a46['push'](_0x587a46['shift']());}catch(_0x2181eb){_0x587a46['push'](_0x587a46['shift']());}}}(_0x115b,0x9e7d2));import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';import{mapAutoReasoningEffortToBudgetTokens,resolveAnthropicThinkingConfig,resolveOpenAiReasoningConfig}from'../chunk-NYZR4XKO.js';import{TurnFailedError}from'../chunk-FFIZ6TKW.js';function _0x3ee1(_0x186be7,_0x295985){_0x186be7=_0x186be7-0x66;var _0x115b8c=_0x115b();var _0x3ee183=_0x115b8c[_0x186be7];if(_0x3ee1['RJsdii']===undefined){var _0x75ee2=function(_0x5ab47d){var _0x4de450='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x3a3226='',_0x517d48='';for(var _0x56187e=0x0,_0x380406,_0x4e31b1,_0x48933e=0x0;_0x4e31b1=_0x5ab47d['charAt'](_0x48933e++);~_0x4e31b1&&(_0x380406=_0x56187e%0x4?_0x380406*0x40+_0x4e31b1:_0x4e31b1,_0x56187e++%0x4)?_0x3a3226+=String['fromCharCode'](0xff&_0x380406>>(-0x2*_0x56187e&0x6)):0x0){_0x4e31b1=_0x4de450['indexOf'](_0x4e31b1);}for(var _0x2cc177=0x0,_0x5b173f=_0x3a3226['length'];_0x2cc177<_0x5b173f;_0x2cc177++){_0x517d48+='%'+('00'+_0x3a3226['charCodeAt'](_0x2cc177)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x517d48);};_0x3ee1['fPlGBu']=_0x75ee2,_0x3ee1['qWbPKO']={},_0x3ee1['RJsdii']=!![];}var _0x1bf831=_0x115b8c[0x0],_0x281cf1=_0x186be7+_0x1bf831,_0x2a1399=_0x3ee1['qWbPKO'][_0x281cf1];return!_0x2a1399?(_0x3ee183=_0x3ee1['fPlGBu'](_0x3ee183),_0x3ee1['qWbPKO'][_0x281cf1]=_0x3ee183):_0x3ee183=_0x2a1399,_0x3ee183;}import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';export{OperationAbortedError,TurnFailedError,addAbortListener,isAbortError,mapAutoReasoningEffortToBudgetTokens,modelIdentityFromParts,resolveAnthropicThinkingConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ export interface OutputFormat {
|
|
|
160
160
|
}
|
|
161
161
|
export interface ModelRequest {
|
|
162
162
|
model: string;
|
|
163
|
-
max_tokens
|
|
163
|
+
max_tokens?: number;
|
|
164
164
|
reasoning?: ReasoningConfig;
|
|
165
165
|
system: TextBlock[];
|
|
166
166
|
messages: Message[];
|
|
@@ -183,7 +183,7 @@ export interface ModelResponse {
|
|
|
183
183
|
}
|
|
184
184
|
export interface ChatRequest {
|
|
185
185
|
model: string;
|
|
186
|
-
maxTokens
|
|
186
|
+
maxTokens?: number;
|
|
187
187
|
reasoning?: ReasoningConfig;
|
|
188
188
|
system: TextBlock[];
|
|
189
189
|
messages: Message[];
|
|
@@ -335,6 +335,12 @@ export interface ResolvedProviderSession {
|
|
|
335
335
|
}
|
|
336
336
|
export interface ProviderSessionResolver {
|
|
337
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;
|
|
338
344
|
}
|
|
339
345
|
export interface PrepareRequestInput {
|
|
340
346
|
sessionId: string;
|
|
@@ -371,6 +377,7 @@ export interface TurnMessageMeta {
|
|
|
371
377
|
}
|
|
372
378
|
export interface EngineChatModel {
|
|
373
379
|
model: string;
|
|
380
|
+
modelIdentity: string;
|
|
374
381
|
provider?: string;
|
|
375
382
|
maxTokens?: number;
|
|
376
383
|
complete(request: ChatRequest, options?: ModelExecutionOptions): Promise<ChatResponse>;
|
|
@@ -379,6 +386,7 @@ export interface EngineChatModel {
|
|
|
379
386
|
}
|
|
380
387
|
export interface BaseChatModelOptions {
|
|
381
388
|
model: string;
|
|
389
|
+
modelIdentity?: string;
|
|
382
390
|
maxTokens?: number;
|
|
383
391
|
reasoning?: ReasoningConfig;
|
|
384
392
|
providerSessionResolver?: ProviderSessionResolver;
|