memeloop 0.2.2 → 0.2.4
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/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/{chunk-K6P63KD4.js → chunk-HY3U3GLE.js} +16 -4
- package/dist/chunk-HY3U3GLE.js.map +1 -0
- package/dist/{chunk-GYIOMQMY.js → chunk-XNSJRDCW.js} +104 -86
- package/dist/chunk-XNSJRDCW.js.map +1 -0
- package/dist/{fetchProvider-BhqRqi5-.d.ts → fetchProvider-B_vva3b3.d.ts} +26 -2
- package/dist/{fetchProvider-HJ_FkORN.d.cts → fetchProvider-Bz4CE3_R.d.cts} +26 -2
- package/dist/index.cjs +141 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/dist/llm-providers.cjs +17 -6
- package/dist/llm-providers.cjs.map +1 -1
- package/dist/llm-providers.d.cts +2 -0
- package/dist/llm-providers.d.ts +2 -0
- package/dist/llm-providers.js +4 -4
- package/dist/llm-providers.js.map +1 -1
- package/dist/loop-api.cjs +23 -10
- package/dist/loop-api.cjs.map +1 -1
- package/dist/loop-api.d.cts +1 -1
- package/dist/loop-api.d.ts +1 -1
- package/dist/loop-api.js +4 -2
- package/dist/mobile.cjs +14 -3
- package/dist/mobile.cjs.map +1 -1
- package/dist/mobile.d.cts +1 -1
- package/dist/mobile.d.ts +1 -1
- package/dist/mobile.js +1 -1
- package/dist/{orchestration-portable-B4udCSVd.d.ts → orchestration-portable-DUoAjtD1.d.ts} +10 -1
- package/dist/{orchestration-portable-BWaCsCGK.d.cts → orchestration-portable-xJ7z-ctw.d.cts} +10 -1
- package/dist/orchestration-portable.cjs.map +1 -1
- package/dist/orchestration-portable.d.cts +1 -1
- package/dist/orchestration-portable.d.ts +1 -1
- package/dist/orchestration-portable.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-GYIOMQMY.js.map +0 -1
- package/dist/chunk-K6P63KD4.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as AgentLoopStep, f as AgentLoopInput, e as AgentLoopGenerator, c as AgentInstanceState, A as AgentFrameworkContext, n as LoopProfile, k as ILLMProvider } from './scriptDeploymentPipeline-B1q-UhrO.js';
|
|
2
|
-
import { LanguageModel } from 'ai';
|
|
2
|
+
import { JSONValue, LanguageModel } from 'ai';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AgentToolLoop runner — convenience API for driving a full loop turn.
|
|
@@ -58,6 +58,30 @@ declare function registerBuiltinLoopProfiles(): void;
|
|
|
58
58
|
* cohere, mistral, azure, bedrock, groq, ollama, openrouter, together, etc.
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
|
+
interface FetchLLMChatRequest {
|
|
62
|
+
messages?: Array<{
|
|
63
|
+
role: string;
|
|
64
|
+
content: string;
|
|
65
|
+
}>;
|
|
66
|
+
model?: string;
|
|
67
|
+
stream?: boolean;
|
|
68
|
+
/** Legacy OpenAI-compatible spelling retained for host adapters. */
|
|
69
|
+
max_tokens?: number;
|
|
70
|
+
/** AI SDK spelling. Takes precedence over max_tokens. */
|
|
71
|
+
maxOutputTokens?: number;
|
|
72
|
+
temperature?: number;
|
|
73
|
+
topP?: number;
|
|
74
|
+
providerOptions?: Record<string, Record<string, JSONValue>>;
|
|
75
|
+
system?: string;
|
|
76
|
+
abortSignal?: AbortSignal;
|
|
77
|
+
}
|
|
78
|
+
declare function resolveFetchLLMCallSettings(body: FetchLLMChatRequest): {
|
|
79
|
+
maxOutputTokens: number | undefined;
|
|
80
|
+
temperature: number | undefined;
|
|
81
|
+
topP: number | undefined;
|
|
82
|
+
providerOptions: Record<string, Record<string, JSONValue>> | undefined;
|
|
83
|
+
abortSignal: AbortSignal | undefined;
|
|
84
|
+
};
|
|
61
85
|
interface FetchLLMProviderConfig {
|
|
62
86
|
/** Display name. */
|
|
63
87
|
name: string;
|
|
@@ -88,4 +112,4 @@ interface FetchLLMProviderConfig {
|
|
|
88
112
|
*/
|
|
89
113
|
declare function createFetchLLMProvider(config: FetchLLMProviderConfig): ILLMProvider;
|
|
90
114
|
|
|
91
|
-
export { type
|
|
115
|
+
export { type FetchLLMChatRequest as F, type RunAgentToolLoopTurnCallbacks as R, type RunAgentToolLoopTurnResult as a, getBuiltinLoopProfiles as b, createFetchLLMProvider as c, runAgentToolLoopTurn as d, type FetchLLMProviderConfig as e, registerBuiltinLoopProfiles as f, getBuiltinLoopProfile as g, resolveFetchLLMCallSettings as h, resolveAgentToolLoopTerminalState as r };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as AgentLoopStep, f as AgentLoopInput, e as AgentLoopGenerator, c as AgentInstanceState, A as AgentFrameworkContext, n as LoopProfile, k as ILLMProvider } from './scriptDeploymentPipeline-XJzQyYys.cjs';
|
|
2
|
-
import { LanguageModel } from 'ai';
|
|
2
|
+
import { JSONValue, LanguageModel } from 'ai';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AgentToolLoop runner — convenience API for driving a full loop turn.
|
|
@@ -58,6 +58,30 @@ declare function registerBuiltinLoopProfiles(): void;
|
|
|
58
58
|
* cohere, mistral, azure, bedrock, groq, ollama, openrouter, together, etc.
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
|
+
interface FetchLLMChatRequest {
|
|
62
|
+
messages?: Array<{
|
|
63
|
+
role: string;
|
|
64
|
+
content: string;
|
|
65
|
+
}>;
|
|
66
|
+
model?: string;
|
|
67
|
+
stream?: boolean;
|
|
68
|
+
/** Legacy OpenAI-compatible spelling retained for host adapters. */
|
|
69
|
+
max_tokens?: number;
|
|
70
|
+
/** AI SDK spelling. Takes precedence over max_tokens. */
|
|
71
|
+
maxOutputTokens?: number;
|
|
72
|
+
temperature?: number;
|
|
73
|
+
topP?: number;
|
|
74
|
+
providerOptions?: Record<string, Record<string, JSONValue>>;
|
|
75
|
+
system?: string;
|
|
76
|
+
abortSignal?: AbortSignal;
|
|
77
|
+
}
|
|
78
|
+
declare function resolveFetchLLMCallSettings(body: FetchLLMChatRequest): {
|
|
79
|
+
maxOutputTokens: number | undefined;
|
|
80
|
+
temperature: number | undefined;
|
|
81
|
+
topP: number | undefined;
|
|
82
|
+
providerOptions: Record<string, Record<string, JSONValue>> | undefined;
|
|
83
|
+
abortSignal: AbortSignal | undefined;
|
|
84
|
+
};
|
|
61
85
|
interface FetchLLMProviderConfig {
|
|
62
86
|
/** Display name. */
|
|
63
87
|
name: string;
|
|
@@ -88,4 +112,4 @@ interface FetchLLMProviderConfig {
|
|
|
88
112
|
*/
|
|
89
113
|
declare function createFetchLLMProvider(config: FetchLLMProviderConfig): ILLMProvider;
|
|
90
114
|
|
|
91
|
-
export { type
|
|
115
|
+
export { type FetchLLMChatRequest as F, type RunAgentToolLoopTurnCallbacks as R, type RunAgentToolLoopTurnResult as a, getBuiltinLoopProfiles as b, createFetchLLMProvider as c, runAgentToolLoopTurn as d, type FetchLLMProviderConfig as e, registerBuiltinLoopProfiles as f, getBuiltinLoopProfile as g, resolveFetchLLMCallSettings as h, resolveAgentToolLoopTerminalState as r };
|
package/dist/index.cjs
CHANGED
|
@@ -7143,6 +7143,112 @@ var init_identityAttestationManagement = __esm({
|
|
|
7143
7143
|
}
|
|
7144
7144
|
});
|
|
7145
7145
|
|
|
7146
|
+
// src/orchestration/drivers/modelProviderDriver.ts
|
|
7147
|
+
function classificationRank(value) {
|
|
7148
|
+
return CLASSIFICATION_ORDER[value];
|
|
7149
|
+
}
|
|
7150
|
+
function assertClassificationAllowed(policy, classification) {
|
|
7151
|
+
if (!policy?.maxInputClassification || !classification) return;
|
|
7152
|
+
if (classificationRank(classification) > classificationRank(policy.maxInputClassification)) {
|
|
7153
|
+
throw new OrchestrationError({
|
|
7154
|
+
code: "FORBIDDEN",
|
|
7155
|
+
message: `input classification '${classification}' exceeds endpoint limit '${policy.maxInputClassification}'`,
|
|
7156
|
+
retryable: false,
|
|
7157
|
+
details: { classification, maxInputClassification: policy.maxInputClassification }
|
|
7158
|
+
});
|
|
7159
|
+
}
|
|
7160
|
+
}
|
|
7161
|
+
function modelClassNameForSpec(model) {
|
|
7162
|
+
return `${model.provider}-${model.model}`.toLowerCase().replace(/[^a-z0-9.-]+/g, "-").replace(/^-+|-+$/g, "") || "model";
|
|
7163
|
+
}
|
|
7164
|
+
function createModelProviderDriverFromLLMProvider(provider, options) {
|
|
7165
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
7166
|
+
const toLegacyRequest = options.toLegacyRequest ?? ((request) => {
|
|
7167
|
+
const candidates = options.models.filter(
|
|
7168
|
+
(model) => modelClassNameForSpec(model) === request.modelClassRef.name || model.model === request.modelClassRef.name
|
|
7169
|
+
);
|
|
7170
|
+
if (candidates.length !== 1) {
|
|
7171
|
+
throw new OrchestrationError({
|
|
7172
|
+
code: "INVALID",
|
|
7173
|
+
message: candidates.length === 0 ? `model class '${request.modelClassRef.name}' is not served by provider '${provider.name}'` : `model class '${request.modelClassRef.name}' is ambiguous for provider '${provider.name}'`,
|
|
7174
|
+
retryable: false
|
|
7175
|
+
});
|
|
7176
|
+
}
|
|
7177
|
+
return {
|
|
7178
|
+
model: candidates[0].model,
|
|
7179
|
+
messages: request.messages,
|
|
7180
|
+
max_tokens: request.maxOutputTokens,
|
|
7181
|
+
temperature: request.temperature,
|
|
7182
|
+
topP: request.topP,
|
|
7183
|
+
providerOptions: request.providerOptions,
|
|
7184
|
+
abortSignal: request.signal
|
|
7185
|
+
};
|
|
7186
|
+
});
|
|
7187
|
+
const toDelta = options.toDelta ?? ((chunk) => typeof chunk === "string" ? chunk : void 0);
|
|
7188
|
+
return {
|
|
7189
|
+
async listModels() {
|
|
7190
|
+
return options.models;
|
|
7191
|
+
},
|
|
7192
|
+
async getHealth() {
|
|
7193
|
+
return {
|
|
7194
|
+
healthy: true,
|
|
7195
|
+
detail: `legacy provider ${provider.name}`,
|
|
7196
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
7197
|
+
};
|
|
7198
|
+
},
|
|
7199
|
+
async *generate(request) {
|
|
7200
|
+
assertClassificationAllowed(options.dataPolicy, request.inputClassification);
|
|
7201
|
+
const controller = new AbortController();
|
|
7202
|
+
inFlight.set(request.callId, controller);
|
|
7203
|
+
const onExternalAbort = () => {
|
|
7204
|
+
controller.abort();
|
|
7205
|
+
};
|
|
7206
|
+
request.signal?.addEventListener("abort", onExternalAbort);
|
|
7207
|
+
try {
|
|
7208
|
+
const legacy = toLegacyRequest({ ...request, signal: controller.signal });
|
|
7209
|
+
const output = await provider.chat(legacy);
|
|
7210
|
+
if (output != null && typeof output === "object" && Symbol.asyncIterator in output) {
|
|
7211
|
+
for await (const chunk of output) {
|
|
7212
|
+
if (controller.signal.aborted) {
|
|
7213
|
+
yield {
|
|
7214
|
+
type: "error",
|
|
7215
|
+
error: { code: "CANCELLED", message: "generate cancelled", retryable: false }
|
|
7216
|
+
};
|
|
7217
|
+
return;
|
|
7218
|
+
}
|
|
7219
|
+
const delta = toDelta(chunk);
|
|
7220
|
+
if (delta !== void 0) {
|
|
7221
|
+
yield { type: "delta", delta };
|
|
7222
|
+
}
|
|
7223
|
+
}
|
|
7224
|
+
} else if (typeof output === "string") {
|
|
7225
|
+
yield { type: "delta", delta: output };
|
|
7226
|
+
}
|
|
7227
|
+
yield { type: "done" };
|
|
7228
|
+
} finally {
|
|
7229
|
+
request.signal?.removeEventListener("abort", onExternalAbort);
|
|
7230
|
+
inFlight.delete(request.callId);
|
|
7231
|
+
}
|
|
7232
|
+
},
|
|
7233
|
+
async cancel(callId) {
|
|
7234
|
+
inFlight.get(callId)?.abort();
|
|
7235
|
+
}
|
|
7236
|
+
};
|
|
7237
|
+
}
|
|
7238
|
+
var CLASSIFICATION_ORDER;
|
|
7239
|
+
var init_modelProviderDriver = __esm({
|
|
7240
|
+
"src/orchestration/drivers/modelProviderDriver.ts"() {
|
|
7241
|
+
"use strict";
|
|
7242
|
+
init_errors();
|
|
7243
|
+
CLASSIFICATION_ORDER = {
|
|
7244
|
+
public: 0,
|
|
7245
|
+
internal: 1,
|
|
7246
|
+
confidential: 2,
|
|
7247
|
+
restricted: 3
|
|
7248
|
+
};
|
|
7249
|
+
}
|
|
7250
|
+
});
|
|
7251
|
+
|
|
7146
7252
|
// src/orchestration/drivers/localModelRegistration.ts
|
|
7147
7253
|
function sanitizeModelName(name) {
|
|
7148
7254
|
return name.toLowerCase().replace(/[^a-z0-9.-]+/g, "-").replace(/^-+|-+$/g, "") || "model";
|
|
@@ -7153,7 +7259,7 @@ async function describeLocalModelEndpoints(driver, options) {
|
|
|
7153
7259
|
const modelClasses = [];
|
|
7154
7260
|
const endpoints = [];
|
|
7155
7261
|
for (const model of models) {
|
|
7156
|
-
const baseName =
|
|
7262
|
+
const baseName = modelClassNameForSpec(model);
|
|
7157
7263
|
modelClasses.push(createModelClassManifest(baseName, model));
|
|
7158
7264
|
endpoints.push(createModelEndpointManifest(`${baseName}-${sanitizeModelName(options.nodeId)}`, {
|
|
7159
7265
|
modelClassRef: { apiVersion: MODEL_CLASS_API_VERSION, kind: MODEL_CLASS_KIND, name: baseName },
|
|
@@ -7190,6 +7296,7 @@ var init_localModelRegistration = __esm({
|
|
|
7190
7296
|
"src/orchestration/drivers/localModelRegistration.ts"() {
|
|
7191
7297
|
"use strict";
|
|
7192
7298
|
init_resources();
|
|
7299
|
+
init_modelProviderDriver();
|
|
7193
7300
|
TRUST_RANK2 = {
|
|
7194
7301
|
quarantine: 0,
|
|
7195
7302
|
restricted: 1,
|
|
@@ -8952,95 +9059,6 @@ var init_managedLoopRuntimeAdapter = __esm({
|
|
|
8952
9059
|
}
|
|
8953
9060
|
});
|
|
8954
9061
|
|
|
8955
|
-
// src/orchestration/drivers/modelProviderDriver.ts
|
|
8956
|
-
function classificationRank(value) {
|
|
8957
|
-
return CLASSIFICATION_ORDER[value];
|
|
8958
|
-
}
|
|
8959
|
-
function assertClassificationAllowed(policy, classification) {
|
|
8960
|
-
if (!policy?.maxInputClassification || !classification) return;
|
|
8961
|
-
if (classificationRank(classification) > classificationRank(policy.maxInputClassification)) {
|
|
8962
|
-
throw new OrchestrationError({
|
|
8963
|
-
code: "FORBIDDEN",
|
|
8964
|
-
message: `input classification '${classification}' exceeds endpoint limit '${policy.maxInputClassification}'`,
|
|
8965
|
-
retryable: false,
|
|
8966
|
-
details: { classification, maxInputClassification: policy.maxInputClassification }
|
|
8967
|
-
});
|
|
8968
|
-
}
|
|
8969
|
-
}
|
|
8970
|
-
function createModelProviderDriverFromLLMProvider(provider, options) {
|
|
8971
|
-
const inFlight = /* @__PURE__ */ new Map();
|
|
8972
|
-
const toLegacyRequest = options.toLegacyRequest ?? ((request) => ({
|
|
8973
|
-
...provider.modelId !== void 0 ? { model: provider.modelId } : {},
|
|
8974
|
-
messages: request.messages,
|
|
8975
|
-
max_tokens: request.maxOutputTokens,
|
|
8976
|
-
temperature: request.temperature,
|
|
8977
|
-
abortSignal: request.signal
|
|
8978
|
-
}));
|
|
8979
|
-
const toDelta = options.toDelta ?? ((chunk) => typeof chunk === "string" ? chunk : void 0);
|
|
8980
|
-
return {
|
|
8981
|
-
async listModels() {
|
|
8982
|
-
return options.models;
|
|
8983
|
-
},
|
|
8984
|
-
async getHealth() {
|
|
8985
|
-
return {
|
|
8986
|
-
healthy: true,
|
|
8987
|
-
detail: `legacy provider ${provider.name}`,
|
|
8988
|
-
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
8989
|
-
};
|
|
8990
|
-
},
|
|
8991
|
-
async *generate(request) {
|
|
8992
|
-
assertClassificationAllowed(options.dataPolicy, request.inputClassification);
|
|
8993
|
-
const controller = new AbortController();
|
|
8994
|
-
inFlight.set(request.callId, controller);
|
|
8995
|
-
const onExternalAbort = () => {
|
|
8996
|
-
controller.abort();
|
|
8997
|
-
};
|
|
8998
|
-
request.signal?.addEventListener("abort", onExternalAbort);
|
|
8999
|
-
try {
|
|
9000
|
-
const legacy = toLegacyRequest({ ...request, signal: controller.signal });
|
|
9001
|
-
const output = await provider.chat(legacy);
|
|
9002
|
-
if (output != null && typeof output === "object" && Symbol.asyncIterator in output) {
|
|
9003
|
-
for await (const chunk of output) {
|
|
9004
|
-
if (controller.signal.aborted) {
|
|
9005
|
-
yield {
|
|
9006
|
-
type: "error",
|
|
9007
|
-
error: { code: "CANCELLED", message: "generate cancelled", retryable: false }
|
|
9008
|
-
};
|
|
9009
|
-
return;
|
|
9010
|
-
}
|
|
9011
|
-
const delta = toDelta(chunk);
|
|
9012
|
-
if (delta !== void 0) {
|
|
9013
|
-
yield { type: "delta", delta };
|
|
9014
|
-
}
|
|
9015
|
-
}
|
|
9016
|
-
} else if (typeof output === "string") {
|
|
9017
|
-
yield { type: "delta", delta: output };
|
|
9018
|
-
}
|
|
9019
|
-
yield { type: "done" };
|
|
9020
|
-
} finally {
|
|
9021
|
-
request.signal?.removeEventListener("abort", onExternalAbort);
|
|
9022
|
-
inFlight.delete(request.callId);
|
|
9023
|
-
}
|
|
9024
|
-
},
|
|
9025
|
-
async cancel(callId) {
|
|
9026
|
-
inFlight.get(callId)?.abort();
|
|
9027
|
-
}
|
|
9028
|
-
};
|
|
9029
|
-
}
|
|
9030
|
-
var CLASSIFICATION_ORDER;
|
|
9031
|
-
var init_modelProviderDriver = __esm({
|
|
9032
|
-
"src/orchestration/drivers/modelProviderDriver.ts"() {
|
|
9033
|
-
"use strict";
|
|
9034
|
-
init_errors();
|
|
9035
|
-
CLASSIFICATION_ORDER = {
|
|
9036
|
-
public: 0,
|
|
9037
|
-
internal: 1,
|
|
9038
|
-
confidential: 2,
|
|
9039
|
-
restricted: 3
|
|
9040
|
-
};
|
|
9041
|
-
}
|
|
9042
|
-
});
|
|
9043
|
-
|
|
9044
9062
|
// src/orchestration/drivers/managedModelGatewayAdapter.ts
|
|
9045
9063
|
function fail(code, message, retryable = false) {
|
|
9046
9064
|
throw new OrchestrationError({ code, message, retryable });
|
|
@@ -13244,9 +13262,13 @@ function createGatewayMediatedLLMProvider(options) {
|
|
|
13244
13262
|
const messages = Array.isArray(record2.messages) ? record2.messages : [];
|
|
13245
13263
|
const runReference = options.runRefForRequest?.(request) ?? options.runRef;
|
|
13246
13264
|
return (async function* () {
|
|
13247
|
-
const
|
|
13265
|
+
const selectedModel = options.resolveModelForRequest?.(request) ?? {
|
|
13248
13266
|
modelClassRef: options.modelClassRef,
|
|
13249
|
-
...options.modelDigest !== void 0 ? { modelDigest: options.modelDigest } : {}
|
|
13267
|
+
...options.modelDigest !== void 0 ? { modelDigest: options.modelDigest } : {}
|
|
13268
|
+
};
|
|
13269
|
+
const handle = await options.broker.issueModelAccessHandle({
|
|
13270
|
+
modelClassRef: selectedModel.modelClassRef,
|
|
13271
|
+
...selectedModel.modelDigest !== void 0 ? { modelDigest: selectedModel.modelDigest } : {},
|
|
13250
13272
|
...options.policyDigest !== void 0 ? { policyDigest: options.policyDigest } : {},
|
|
13251
13273
|
...runReference ? { runRef: runReference } : {},
|
|
13252
13274
|
...runReference && options.attempt !== void 0 ? { attempt: options.attempt } : {},
|
|
@@ -13257,12 +13279,18 @@ function createGatewayMediatedLLMProvider(options) {
|
|
|
13257
13279
|
try {
|
|
13258
13280
|
for await (const chunk of options.gateway.generate({
|
|
13259
13281
|
callId,
|
|
13260
|
-
modelClassRef:
|
|
13261
|
-
...
|
|
13282
|
+
modelClassRef: selectedModel.modelClassRef,
|
|
13283
|
+
...selectedModel.modelDigest !== void 0 ? { modelDigest: selectedModel.modelDigest } : {},
|
|
13262
13284
|
messages,
|
|
13285
|
+
...typeof record2.maxOutputTokens === "number" ? { maxOutputTokens: record2.maxOutputTokens } : typeof record2.max_tokens === "number" ? { maxOutputTokens: record2.max_tokens } : {},
|
|
13286
|
+
...typeof record2.temperature === "number" ? { temperature: record2.temperature } : {},
|
|
13287
|
+
...typeof record2.topP === "number" ? { topP: record2.topP } : {},
|
|
13288
|
+
...record2.providerOptions !== null && typeof record2.providerOptions === "object" ? {
|
|
13289
|
+
providerOptions: record2.providerOptions
|
|
13290
|
+
} : {},
|
|
13263
13291
|
accessHandle: handle.token,
|
|
13264
13292
|
...options.workerKey !== void 0 ? { workerKey: options.workerKey } : {},
|
|
13265
|
-
...record2.
|
|
13293
|
+
...record2.abortSignal ?? record2.signal ? { signal: record2.abortSignal ?? record2.signal } : {}
|
|
13266
13294
|
})) {
|
|
13267
13295
|
if (chunk.type === "delta" && chunk.delta !== void 0) {
|
|
13268
13296
|
yield chunk.delta;
|
|
@@ -26875,6 +26903,7 @@ __export(src_exports, {
|
|
|
26875
26903
|
mcpForwardImpl: () => mcpForwardImpl,
|
|
26876
26904
|
mergeAgentToolsIntoFrameworkConfig: () => mergeAgentToolsIntoFrameworkConfig,
|
|
26877
26905
|
mergePermissionSets: () => mergePermissionSets,
|
|
26906
|
+
modelClassNameForSpec: () => modelClassNameForSpec,
|
|
26878
26907
|
negotiateCapabilities: () => negotiateCapabilities,
|
|
26879
26908
|
normalizeScript: () => normalizeScript,
|
|
26880
26909
|
onApprovalRequest: () => onApprovalRequest,
|
|
@@ -26919,6 +26948,7 @@ __export(src_exports, {
|
|
|
26919
26948
|
resolveCategory: () => resolveCategory,
|
|
26920
26949
|
resolveExternalWorkloadResources: () => resolveExternalWorkloadResources,
|
|
26921
26950
|
resolveExternalWorkloadRuntime: () => resolveExternalWorkloadRuntime,
|
|
26951
|
+
resolveFetchLLMCallSettings: () => resolveFetchLLMCallSettings,
|
|
26922
26952
|
resolvePromptPluginMap: () => resolvePromptPluginMap,
|
|
26923
26953
|
resolveQuestionAnswer: () => resolveQuestionAnswer,
|
|
26924
26954
|
restoreArtifactManagementState: () => restoreArtifactManagementState,
|
|
@@ -28478,6 +28508,15 @@ var PromptPreviewController = class {
|
|
|
28478
28508
|
|
|
28479
28509
|
// src/llm/fetchProvider.ts
|
|
28480
28510
|
var import_ai = require("ai");
|
|
28511
|
+
function resolveFetchLLMCallSettings(body) {
|
|
28512
|
+
return {
|
|
28513
|
+
maxOutputTokens: body.maxOutputTokens ?? body.max_tokens,
|
|
28514
|
+
temperature: body.temperature,
|
|
28515
|
+
topP: body.topP,
|
|
28516
|
+
providerOptions: body.providerOptions,
|
|
28517
|
+
abortSignal: body.abortSignal
|
|
28518
|
+
};
|
|
28519
|
+
}
|
|
28481
28520
|
function createFetchLLMProvider(config) {
|
|
28482
28521
|
return {
|
|
28483
28522
|
name: config.name,
|
|
@@ -28502,9 +28541,7 @@ function createFetchLLMProvider(config) {
|
|
|
28502
28541
|
};
|
|
28503
28542
|
});
|
|
28504
28543
|
const system = body.system ?? (systemMessages.length > 0 ? systemMessages.join("\n\n") : void 0);
|
|
28505
|
-
const temperature = body
|
|
28506
|
-
const abortSignal = body.abortSignal;
|
|
28507
|
-
const maxOutputTokens = body.max_tokens;
|
|
28544
|
+
const { abortSignal, maxOutputTokens, providerOptions, temperature, topP } = resolveFetchLLMCallSettings(body);
|
|
28508
28545
|
if (body.stream !== false) {
|
|
28509
28546
|
let streamingError;
|
|
28510
28547
|
const result2 = (0, import_ai.streamText)({
|
|
@@ -28513,6 +28550,8 @@ function createFetchLLMProvider(config) {
|
|
|
28513
28550
|
messages,
|
|
28514
28551
|
maxOutputTokens,
|
|
28515
28552
|
temperature,
|
|
28553
|
+
topP,
|
|
28554
|
+
providerOptions,
|
|
28516
28555
|
abortSignal,
|
|
28517
28556
|
onError: ({ error: error2 }) => {
|
|
28518
28557
|
streamingError = error2;
|
|
@@ -28533,6 +28572,8 @@ function createFetchLLMProvider(config) {
|
|
|
28533
28572
|
messages,
|
|
28534
28573
|
maxOutputTokens,
|
|
28535
28574
|
temperature,
|
|
28575
|
+
topP,
|
|
28576
|
+
providerOptions,
|
|
28536
28577
|
abortSignal
|
|
28537
28578
|
});
|
|
28538
28579
|
return result.text;
|
|
@@ -32148,6 +32189,7 @@ function getToolDefinition(toolId) {
|
|
|
32148
32189
|
mcpForwardImpl,
|
|
32149
32190
|
mergeAgentToolsIntoFrameworkConfig,
|
|
32150
32191
|
mergePermissionSets,
|
|
32192
|
+
modelClassNameForSpec,
|
|
32151
32193
|
negotiateCapabilities,
|
|
32152
32194
|
normalizeScript,
|
|
32153
32195
|
onApprovalRequest,
|
|
@@ -32192,6 +32234,7 @@ function getToolDefinition(toolId) {
|
|
|
32192
32234
|
resolveCategory,
|
|
32193
32235
|
resolveExternalWorkloadResources,
|
|
32194
32236
|
resolveExternalWorkloadRuntime,
|
|
32237
|
+
resolveFetchLLMCallSettings,
|
|
32195
32238
|
resolvePromptPluginMap,
|
|
32196
32239
|
resolveQuestionAnswer,
|
|
32197
32240
|
restoreArtifactManagementState,
|