@copilotkit/runtime 1.72.0 → 1.72.1-canary.sp-longthread-perf
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/agent/index.cjs +34 -0
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +36 -2
- package/dist/agent/index.d.cts.map +1 -1
- package/dist/agent/index.d.mts +36 -2
- package/dist/agent/index.d.mts.map +1 -1
- package/dist/agent/index.mjs +35 -2
- package/dist/agent/index.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +23 -16
- package/dist/index.d.mts +23 -16
- package/dist/index.mjs +1 -1
- package/dist/langgraph.d.cts +3 -1
- package/dist/langgraph.d.mts +3 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.cjs.map +1 -1
- package/dist/lib/index.d.cts.map +1 -1
- package/dist/lib/index.d.mts.map +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/integrations/nextjs/app-router.cjs.map +1 -1
- package/dist/lib/integrations/nextjs/app-router.mjs.map +1 -1
- package/dist/lib/integrations/node-express/index.cjs.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs.map +1 -1
- package/dist/lib/integrations/node-http/index.cjs.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs.map +1 -1
- package/dist/lib/runtime/copilot-runtime.cjs +2 -16
- package/dist/lib/runtime/copilot-runtime.cjs.map +1 -1
- package/dist/lib/runtime/copilot-runtime.d.cts.map +1 -1
- package/dist/lib/runtime/copilot-runtime.d.mts.map +1 -1
- package/dist/lib/runtime/copilot-runtime.mjs +3 -17
- package/dist/lib/runtime/copilot-runtime.mjs.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/v2/index.cjs +1 -0
- package/dist/v2/index.d.cts +2 -2
- package/dist/v2/index.d.mts +2 -2
- package/dist/v2/index.mjs +2 -2
- package/dist/v2/runtime/core/channel-manager.d.mts +1 -0
- package/dist/v2/runtime/core/channel-manager.d.mts.map +1 -1
- package/dist/v2/runtime/core/debug-event-bus.cjs +22 -0
- package/dist/v2/runtime/core/debug-event-bus.cjs.map +1 -1
- package/dist/v2/runtime/core/debug-event-bus.d.cts +1 -1
- package/dist/v2/runtime/core/debug-event-bus.d.mts +1 -1
- package/dist/v2/runtime/core/debug-event-bus.mjs +22 -1
- package/dist/v2/runtime/core/debug-event-bus.mjs.map +1 -1
- package/dist/v2/runtime/core/runtime.cjs +5 -5
- package/dist/v2/runtime/core/runtime.cjs.map +1 -1
- package/dist/v2/runtime/core/runtime.d.cts +11 -0
- package/dist/v2/runtime/core/runtime.d.cts.map +1 -1
- package/dist/v2/runtime/core/runtime.d.mts +11 -0
- package/dist/v2/runtime/core/runtime.d.mts.map +1 -1
- package/dist/v2/runtime/core/runtime.mjs +6 -6
- package/dist/v2/runtime/core/runtime.mjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-connect.cjs +3 -2
- package/dist/v2/runtime/handlers/handle-connect.cjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-connect.mjs +3 -2
- package/dist/v2/runtime/handlers/handle-connect.mjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-debug-events.cjs +2 -1
- package/dist/v2/runtime/handlers/handle-debug-events.cjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-debug-events.mjs +3 -1
- package/dist/v2/runtime/handlers/handle-debug-events.mjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-run.cjs +5 -3
- package/dist/v2/runtime/handlers/handle-run.cjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-run.mjs +5 -3
- package/dist/v2/runtime/handlers/handle-run.mjs.map +1 -1
- package/dist/v2/runtime/handlers/shared/cloud-telemetry.cjs +31 -0
- package/dist/v2/runtime/handlers/shared/cloud-telemetry.cjs.map +1 -0
- package/dist/v2/runtime/handlers/shared/cloud-telemetry.mjs +30 -0
- package/dist/v2/runtime/handlers/shared/cloud-telemetry.mjs.map +1 -0
- package/dist/v2/runtime/handlers/shared/sse-response.cjs +31 -3
- package/dist/v2/runtime/handlers/shared/sse-response.cjs.map +1 -1
- package/dist/v2/runtime/handlers/shared/sse-response.mjs +31 -3
- package/dist/v2/runtime/handlers/shared/sse-response.mjs.map +1 -1
- package/dist/v2/runtime/handlers/sse/run.cjs +1 -0
- package/dist/v2/runtime/handlers/sse/run.cjs.map +1 -1
- package/dist/v2/runtime/handlers/sse/run.mjs +1 -0
- package/dist/v2/runtime/handlers/sse/run.mjs.map +1 -1
- package/dist/v2/runtime/telemetry/events.d.cts +12 -0
- package/dist/v2/runtime/telemetry/events.d.cts.map +1 -1
- package/dist/v2/runtime/telemetry/events.d.mts +12 -0
- package/dist/v2/runtime/telemetry/events.d.mts.map +1 -1
- package/dist/v2/runtime/telemetry/telemetry-client.cjs +3 -2
- package/dist/v2/runtime/telemetry/telemetry-client.cjs.map +1 -1
- package/dist/v2/runtime/telemetry/telemetry-client.d.cts.map +1 -1
- package/dist/v2/runtime/telemetry/telemetry-client.d.mts.map +1 -1
- package/dist/v2/runtime/telemetry/telemetry-client.mjs +7 -6
- package/dist/v2/runtime/telemetry/telemetry-client.mjs.map +1 -1
- package/package.json +2 -2
package/dist/agent/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { convertAISDKStream } from "./converters/aisdk.cjs";
|
|
|
3
3
|
import { TanStackChatMessage, TanStackInputResult, convertInputToTanStackAI, convertTanStackStream } from "./converters/tanstack.cjs";
|
|
4
4
|
import { LanguageModel, ModelMessage, ToolChoice, ToolSet } from "ai";
|
|
5
5
|
import { Observable } from "rxjs";
|
|
6
|
-
import { InferSchemaOutput, StandardSchemaV1 } from "@copilotkit/shared";
|
|
6
|
+
import { InferSchemaOutput, ModelHostClass, StandardSchemaV1 } from "@copilotkit/shared";
|
|
7
7
|
import { AbstractAgent, BaseEvent, Interrupt, Message, ResumeEntry, RunAgentInput } from "@ag-ui/client";
|
|
8
8
|
import { AgentCapabilities } from "@ag-ui/core";
|
|
9
9
|
import { z } from "zod";
|
|
@@ -73,6 +73,26 @@ interface MCPClientProvider {
|
|
|
73
73
|
* @returns LanguageModel instance
|
|
74
74
|
*/
|
|
75
75
|
declare function resolveModel(spec: ModelSpecifier, apiKey?: string): LanguageModel;
|
|
76
|
+
/**
|
|
77
|
+
* Which vendor a model specifier will actually reach, as a closed vocabulary.
|
|
78
|
+
*
|
|
79
|
+
* `resolveModel` above is the only place this runtime builds a provider, so it
|
|
80
|
+
* is the only place that knows the endpoint. Once built, the endpoint is gone:
|
|
81
|
+
* an AI SDK model reports `provider: "openai.responses"` whether it points at
|
|
82
|
+
* api.openai.com, Azure, OpenRouter or a laptop, and its base URL survives
|
|
83
|
+
* only inside a closure that the public `LanguageModelV3` type does not
|
|
84
|
+
* expose. Azure's own migration guide tells customers to use that same OpenAI
|
|
85
|
+
* client, so the case we are blindest to is the common one.
|
|
86
|
+
*
|
|
87
|
+
* A caller who hands us an already-built LanguageModel gets `unknown`. Nobody
|
|
88
|
+
* can recover the host from it, and saying so is more useful than guessing
|
|
89
|
+
* `openai` from a provider label that means only "speaks the OpenAI wire".
|
|
90
|
+
*
|
|
91
|
+
* The branches below mirror `resolveModel`'s switch and must change with it.
|
|
92
|
+
* `model-host-class.test.ts` walks every provider that switch accepts and
|
|
93
|
+
* fails if one lands here as `unknown`.
|
|
94
|
+
*/
|
|
95
|
+
declare function classifyModelSpec(spec: ModelSpecifier): ModelHostClass;
|
|
76
96
|
/**
|
|
77
97
|
* Thrown by `AgentFactoryContext.interrupt()` on a fresh (non-resume) run to
|
|
78
98
|
* pause the factory. Caught in `runFactory` and translated into a RUN_FINISHED
|
|
@@ -342,6 +362,20 @@ type BuiltInAgentConfiguration = BuiltInAgentClassicConfig | BuiltInAgentFactory
|
|
|
342
362
|
declare class BuiltInAgent extends AbstractAgent {
|
|
343
363
|
private config;
|
|
344
364
|
private abortController?;
|
|
365
|
+
/**
|
|
366
|
+
* Which vendor this agent's configured model reaches. Read by the SSE layer
|
|
367
|
+
* onto `agent_execution_stream_*` telemetry.
|
|
368
|
+
*
|
|
369
|
+
* Computed once, from the configured model, because that is what holds for
|
|
370
|
+
* the agent's lifetime. A per-request `forwardedProps.model` override
|
|
371
|
+
* (handled further down in `run`) can point somewhere else for one run and
|
|
372
|
+
* is not reflected here — overrides are rare and the field describes the
|
|
373
|
+
* agent, not the call.
|
|
374
|
+
*
|
|
375
|
+
* Factory-mode configs own their own LLM call, so there is no model for us
|
|
376
|
+
* to classify.
|
|
377
|
+
*/
|
|
378
|
+
readonly modelHostClass: ModelHostClass;
|
|
345
379
|
constructor(config: BuiltInAgentConfiguration);
|
|
346
380
|
/**
|
|
347
381
|
* Check if a property can be overridden by forwardedProps
|
|
@@ -362,5 +396,5 @@ declare class BasicAgent extends BuiltInAgent {
|
|
|
362
396
|
/** @deprecated Use BuiltInAgentClassicConfig instead */
|
|
363
397
|
type BasicAgentConfiguration = BuiltInAgentClassicConfig;
|
|
364
398
|
//#endregion
|
|
365
|
-
export { BasicAgent, BasicAgentConfiguration, BuiltInAgent, BuiltInAgentAISDKFactoryConfig, BuiltInAgentClassicConfig, BuiltInAgentConfiguration, BuiltInAgentCustomFactoryConfig, BuiltInAgentFactoryConfig, BuiltInAgentModel, BuiltInAgentTanStackFactoryConfig, InterruptSignal, MCPClientConfig, MCPClientConfigHTTP, MCPClientConfigSSE, MCPClientProvider, MessageConversionOptions, ModelSpecifier, OverridableProperty, ToolDefinition, convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, defineTool, resolveModel };
|
|
399
|
+
export { BasicAgent, BasicAgentConfiguration, BuiltInAgent, BuiltInAgentAISDKFactoryConfig, BuiltInAgentClassicConfig, BuiltInAgentConfiguration, BuiltInAgentCustomFactoryConfig, BuiltInAgentFactoryConfig, BuiltInAgentModel, BuiltInAgentTanStackFactoryConfig, InterruptSignal, MCPClientConfig, MCPClientConfigHTTP, MCPClientConfigSSE, MCPClientProvider, MessageConversionOptions, ModelSpecifier, OverridableProperty, ToolDefinition, classifyModelSpec, convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, defineTool, resolveModel };
|
|
366
400
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/agent/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/agent/index.ts"],"mappings":";;;;;;;;;;;;;;AA0EA;;KAAY,mBAAA;;;AAkBZ;KAAY,iBAAA;;;;KA+BA,cAAA,YAA0B,aAAA;;;;UAKrB,mBAAA;EAAA;EAEf,IAAA;;EAEA,GAAA;EAFA;;;;;;EASA,OAAA,GAAU,oCAAA;AAAA;;;;UAMK,kBAAA;EAMf;EAJA,IAAA;EAIgB;EAFhB,GAAA;EAQU;EANV,OAAA,GAAU,MAAA;AAAA;;;AAgBZ;KAVY,eAAA,GAAkB,mBAAA,GAAsB,kBAAA;;;;;;;;AAqBpD;UAXiB,iBAAA;;EAEf,KAAA,IAAS,OAAA,CAAQ,OAAA;AAAA;;;;;;AAyHnB;iBAhHgB,YAAA,CACd,IAAA,EAAM,cAAA,EACN,MAAA,YACC,aAAA;;;;;;;;AAmJH;;;;;;;;;;;;iBAtCgB,iBAAA,CAAkB,IAAA,EAAM,cAAA,GAAiB,cAAA;;;;AAgDzD;;cAVa,eAAA,SAAwB,KAAA;EAAA,SACP,UAAA,EAAY,SAAA;cAAZ,UAAA,EAAY,SAAA;AAAA;;;;UASzB,cAAA,qBACK,gBAAA,GAAmB,gBAAA;EAEvC,IAAA;EACA,WAAA;EACA,UAAA,EAAY,WAAA;EAJ2B;;;;EASvC,OAAA,IAAW,IAAA,EAAM,iBAAA,CAAkB,WAAA,MAAiB,OAAA;EAApD;;;;;;;;EASA,SAAA;EAIgB;EAFhB,eAAA;EAawB;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AAA;EAAA,QA42B9B,UAAA;EA8LR,KAAA,CAAA,GAAK,YAAA;EASL,QAAA,CAAA;AAAA;;;;cAQW,UAAA,SAAmB,YAAA;cAClB,MAAA,EAAQ,yBAAA;AAAA;;KAOV,uBAAA,GAA0B,yBAAA"}
|
package/dist/agent/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { convertAISDKStream } from "./converters/aisdk.mjs";
|
|
3
3
|
import { TanStackChatMessage, TanStackInputResult, convertInputToTanStackAI, convertTanStackStream } from "./converters/tanstack.mjs";
|
|
4
4
|
import "./converters/index.mjs";
|
|
5
|
-
import { InferSchemaOutput, StandardSchemaV1 } from "@copilotkit/shared";
|
|
5
|
+
import { InferSchemaOutput, ModelHostClass, StandardSchemaV1 } from "@copilotkit/shared";
|
|
6
6
|
import { Observable } from "rxjs";
|
|
7
7
|
import { AbstractAgent, BaseEvent, Interrupt, Message, ResumeEntry, RunAgentInput } from "@ag-ui/client";
|
|
8
8
|
import { z } from "zod";
|
|
@@ -74,6 +74,26 @@ interface MCPClientProvider {
|
|
|
74
74
|
* @returns LanguageModel instance
|
|
75
75
|
*/
|
|
76
76
|
declare function resolveModel(spec: ModelSpecifier, apiKey?: string): LanguageModel;
|
|
77
|
+
/**
|
|
78
|
+
* Which vendor a model specifier will actually reach, as a closed vocabulary.
|
|
79
|
+
*
|
|
80
|
+
* `resolveModel` above is the only place this runtime builds a provider, so it
|
|
81
|
+
* is the only place that knows the endpoint. Once built, the endpoint is gone:
|
|
82
|
+
* an AI SDK model reports `provider: "openai.responses"` whether it points at
|
|
83
|
+
* api.openai.com, Azure, OpenRouter or a laptop, and its base URL survives
|
|
84
|
+
* only inside a closure that the public `LanguageModelV3` type does not
|
|
85
|
+
* expose. Azure's own migration guide tells customers to use that same OpenAI
|
|
86
|
+
* client, so the case we are blindest to is the common one.
|
|
87
|
+
*
|
|
88
|
+
* A caller who hands us an already-built LanguageModel gets `unknown`. Nobody
|
|
89
|
+
* can recover the host from it, and saying so is more useful than guessing
|
|
90
|
+
* `openai` from a provider label that means only "speaks the OpenAI wire".
|
|
91
|
+
*
|
|
92
|
+
* The branches below mirror `resolveModel`'s switch and must change with it.
|
|
93
|
+
* `model-host-class.test.ts` walks every provider that switch accepts and
|
|
94
|
+
* fails if one lands here as `unknown`.
|
|
95
|
+
*/
|
|
96
|
+
declare function classifyModelSpec(spec: ModelSpecifier): ModelHostClass;
|
|
77
97
|
/**
|
|
78
98
|
* Thrown by `AgentFactoryContext.interrupt()` on a fresh (non-resume) run to
|
|
79
99
|
* pause the factory. Caught in `runFactory` and translated into a RUN_FINISHED
|
|
@@ -343,6 +363,20 @@ type BuiltInAgentConfiguration = BuiltInAgentClassicConfig | BuiltInAgentFactory
|
|
|
343
363
|
declare class BuiltInAgent extends AbstractAgent {
|
|
344
364
|
private config;
|
|
345
365
|
private abortController?;
|
|
366
|
+
/**
|
|
367
|
+
* Which vendor this agent's configured model reaches. Read by the SSE layer
|
|
368
|
+
* onto `agent_execution_stream_*` telemetry.
|
|
369
|
+
*
|
|
370
|
+
* Computed once, from the configured model, because that is what holds for
|
|
371
|
+
* the agent's lifetime. A per-request `forwardedProps.model` override
|
|
372
|
+
* (handled further down in `run`) can point somewhere else for one run and
|
|
373
|
+
* is not reflected here — overrides are rare and the field describes the
|
|
374
|
+
* agent, not the call.
|
|
375
|
+
*
|
|
376
|
+
* Factory-mode configs own their own LLM call, so there is no model for us
|
|
377
|
+
* to classify.
|
|
378
|
+
*/
|
|
379
|
+
readonly modelHostClass: ModelHostClass;
|
|
346
380
|
constructor(config: BuiltInAgentConfiguration);
|
|
347
381
|
/**
|
|
348
382
|
* Check if a property can be overridden by forwardedProps
|
|
@@ -363,5 +397,5 @@ declare class BasicAgent extends BuiltInAgent {
|
|
|
363
397
|
/** @deprecated Use BuiltInAgentClassicConfig instead */
|
|
364
398
|
type BasicAgentConfiguration = BuiltInAgentClassicConfig;
|
|
365
399
|
//#endregion
|
|
366
|
-
export { BasicAgent, BasicAgentConfiguration, BuiltInAgent, BuiltInAgentAISDKFactoryConfig, BuiltInAgentClassicConfig, BuiltInAgentConfiguration, BuiltInAgentCustomFactoryConfig, BuiltInAgentFactoryConfig, BuiltInAgentModel, BuiltInAgentTanStackFactoryConfig, InterruptSignal, MCPClientConfig, MCPClientConfigHTTP, MCPClientConfigSSE, MCPClientProvider, MessageConversionOptions, ModelSpecifier, OverridableProperty, ToolDefinition, convertJsonSchemaToZodSchema$1 as convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, defineTool, resolveModel };
|
|
400
|
+
export { BasicAgent, BasicAgentConfiguration, BuiltInAgent, BuiltInAgentAISDKFactoryConfig, BuiltInAgentClassicConfig, BuiltInAgentConfiguration, BuiltInAgentCustomFactoryConfig, BuiltInAgentFactoryConfig, BuiltInAgentModel, BuiltInAgentTanStackFactoryConfig, InterruptSignal, MCPClientConfig, MCPClientConfigHTTP, MCPClientConfigSSE, MCPClientProvider, MessageConversionOptions, ModelSpecifier, OverridableProperty, ToolDefinition, classifyModelSpec, convertJsonSchemaToZodSchema$1 as convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, defineTool, resolveModel };
|
|
367
401
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/agent/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/agent/index.ts"],"mappings":";;;;;;;;;;;;;;;;AA0EA;KAAY,mBAAA;;;;KAkBA,iBAAA;;;;KA+BA,cAAA,YAA0B,aAAA;AAAtC;;;AAAA,UAKiB,mBAAA;EALkC;EAOjD,IAAA;EAFkC;EAIlC,GAAA;EAO8C;;;;;;EAA9C,OAAA,GAAU,oCAAA;AAAA;;;;UAMK,kBAAA;EAIf;EAFA,IAAA;EAIU;E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A;EAhFtB;;;EAoFF,UAAA,GAAa,eAAA;EAnF2B;;;;AAM1C;;;;;;;EAyFE,UAAA,GAAa,iBAAA;EAxFX;;;EA4FF,KAAA,GAAQ,cAAA;EA1FyB;AAKnC;;;EA0FE,qBAAA;EAtF2B;;;;EA2F3B,wBAAA;EAda;;;;EAmBb,eAAA,GAAkB,MAAA;EASI;;;;;;;;EAAtB,YAAA,GAAe,OAAA,CAAQ,iBAAA;AAAA;;;;;;;;KAUb,yBAAA,GACR,yBAAA,GACA,yBAAA;AAAA,cAWS,YAAA,SAAqB,aAAA;EAAA,QAkBZ,MAAA;EAAA,QAjBZ,eAAA;EApEgB;;;;;;;;;;;;;EAAA,SAmFf,cAAA,EAAgB,cAAA;cAEL,MAAA,EAAQ,yBAAA;EAzCY;AAU1C;;EAyCE,WAAA,CAAY,QAAA,EAAU,mBAAA;EAKhB,eAAA,CAAA,GAAmB,OAAA,CAAQ,iBAAA;EA+BjC,GAAA,CAAI,KAAA,EAAO,aAAA,GAAgB,UAAA,CAAW,SAAA;EAAA,QA42B9B,UAAA;EA8LR,KAAA,CAAA,GAAK,YAAA;EASL,QAAA,CAAA;AAAA;;;;cAQW,UAAA,SAAmB,YAAA;cAClB,MAAA,EAAQ,yBAAA;AAAA;;KAOV,uBAAA,GAA0B,yBAAA"}
|
package/dist/agent/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { collectStandardRunFinishedDetails, getNonEmptyString, isRecord } from "
|
|
|
4
4
|
import { convertAISDKStream, getAISDKRunFinishedDetails } from "./converters/aisdk.mjs";
|
|
5
5
|
import { convertInputToTanStackAI, convertTanStackStream } from "./converters/tanstack.mjs";
|
|
6
6
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
7
|
-
import { randomUUID, safeParseToolArgs, schemaToJsonSchema } from "@copilotkit/shared";
|
|
7
|
+
import { classifyModelHost, randomUUID, safeParseToolArgs, schemaToJsonSchema } from "@copilotkit/shared";
|
|
8
8
|
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
9
9
|
import { Observable } from "rxjs";
|
|
10
10
|
import { AbstractAgent, EventType } from "@ag-ui/client";
|
|
@@ -58,6 +58,38 @@ function resolveModel(spec, apiKey) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
+
* Which vendor a model specifier will actually reach, as a closed vocabulary.
|
|
62
|
+
*
|
|
63
|
+
* `resolveModel` above is the only place this runtime builds a provider, so it
|
|
64
|
+
* is the only place that knows the endpoint. Once built, the endpoint is gone:
|
|
65
|
+
* an AI SDK model reports `provider: "openai.responses"` whether it points at
|
|
66
|
+
* api.openai.com, Azure, OpenRouter or a laptop, and its base URL survives
|
|
67
|
+
* only inside a closure that the public `LanguageModelV3` type does not
|
|
68
|
+
* expose. Azure's own migration guide tells customers to use that same OpenAI
|
|
69
|
+
* client, so the case we are blindest to is the common one.
|
|
70
|
+
*
|
|
71
|
+
* A caller who hands us an already-built LanguageModel gets `unknown`. Nobody
|
|
72
|
+
* can recover the host from it, and saying so is more useful than guessing
|
|
73
|
+
* `openai` from a provider label that means only "speaks the OpenAI wire".
|
|
74
|
+
*
|
|
75
|
+
* The branches below mirror `resolveModel`'s switch and must change with it.
|
|
76
|
+
* `model-host-class.test.ts` walks every provider that switch accepts and
|
|
77
|
+
* fails if one lands here as `unknown`.
|
|
78
|
+
*/
|
|
79
|
+
function classifyModelSpec(spec) {
|
|
80
|
+
if (typeof spec !== "string") return "unknown";
|
|
81
|
+
switch (spec.replace("/", ":").trim().split(":")[0]?.toLowerCase()) {
|
|
82
|
+
case "openai": return classifyModelHost(process.env.OPENAI_BASE_URL, "openai");
|
|
83
|
+
case "anthropic": return classifyModelHost(process.env.ANTHROPIC_BASE_URL, "anthropic");
|
|
84
|
+
case "google":
|
|
85
|
+
case "gemini":
|
|
86
|
+
case "google-gemini": return classifyModelHost(process.env.GOOGLE_GENERATIVE_AI_BASE_URL, "google");
|
|
87
|
+
case "minimax": return classifyModelHost(process.env.MINIMAX_BASE_URL || "https://api.minimax.io/v1", "minimax");
|
|
88
|
+
case "vertex": return "vertex";
|
|
89
|
+
default: return "unknown";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
61
93
|
* Thrown by `AgentFactoryContext.interrupt()` on a fresh (non-resume) run to
|
|
62
94
|
* pause the factory. Caught in `runFactory` and translated into a RUN_FINISHED
|
|
63
95
|
* event carrying `outcome:{type:"interrupt",interrupts}`. Not a real error.
|
|
@@ -387,6 +419,7 @@ var BuiltInAgent = class BuiltInAgent extends AbstractAgent {
|
|
|
387
419
|
constructor(config) {
|
|
388
420
|
super();
|
|
389
421
|
this.config = config;
|
|
422
|
+
this.modelHostClass = isFactoryConfig(config) ? "unknown" : classifyModelSpec(config.model);
|
|
390
423
|
}
|
|
391
424
|
/**
|
|
392
425
|
* Check if a property can be overridden by forwardedProps
|
|
@@ -1034,5 +1067,5 @@ var BasicAgent = class extends BuiltInAgent {
|
|
|
1034
1067
|
};
|
|
1035
1068
|
|
|
1036
1069
|
//#endregion
|
|
1037
|
-
export { BasicAgent, BuiltInAgent, InterruptSignal, convertJsonSchemaToZodSchema$1 as convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, defineTool, resolveModel };
|
|
1070
|
+
export { BasicAgent, BuiltInAgent, InterruptSignal, classifyModelSpec, convertJsonSchemaToZodSchema$1 as convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, defineTool, resolveModel };
|
|
1038
1071
|
//# sourceMappingURL=index.mjs.map
|