@cydm/pie 2.7.20 → 2.8.1

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.
Files changed (40) hide show
  1. package/README.md +18 -0
  2. package/dist/builtin/extensions/ask-user/README.md +117 -0
  3. package/dist/builtin/extensions/ask-user/index.js +4 -3
  4. package/dist/builtin/extensions/cron/index.js +299 -39
  5. package/dist/builtin/extensions/im-forward/README.md +297 -0
  6. package/dist/builtin/extensions/im-forward/index.js +315 -27
  7. package/dist/builtin/extensions/mcp-adapter/README.md +27 -0
  8. package/dist/builtin/extensions/memory/index.js +515 -0
  9. package/dist/builtin/extensions/memory/package.json +19 -0
  10. package/dist/builtin/extensions/pie-ipc/README.md +21 -0
  11. package/dist/builtin/extensions/plan-mode/METHOD.md +70 -0
  12. package/dist/builtin/extensions/plan-mode/index.js +150 -82
  13. package/dist/builtin/extensions/subagent/README.md +315 -0
  14. package/dist/builtin/extensions/subagent/index.js +8 -5
  15. package/dist/builtin/extensions/todo/index.js +4 -3
  16. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-bridge.js +1 -1
  17. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-runtime.js +1 -1
  18. package/dist/builtin/skills/chrome-devtools-axi/{chunk-U75F4DPF.js → chunk-BNSAEVRT.js} +201 -77
  19. package/dist/builtin/skills/chrome-devtools-axi/{cli-4ITIR57L.js → cli-AO2ZTPRM.js} +57 -202
  20. package/dist/builtin/skills/computer-use-axi/computer-use-axi-broker.js +6 -1
  21. package/dist/builtin/skills/computer-use-axi/computer-use-axi-runtime.js +6 -1
  22. package/dist/chunks/auth-storage-3EGM3VTK.js +13 -0
  23. package/dist/chunks/{chunk-X7UO6BA6.js → chunk-3BC5KGDQ.js} +451 -162
  24. package/dist/chunks/chunk-3NHP7HK5.js +298 -0
  25. package/dist/chunks/chunk-6DNYGVZP.js +278 -0
  26. package/dist/chunks/{chunk-TGCI5M6R.js → chunk-GDIYSMTS.js} +22 -142
  27. package/dist/chunks/{chunk-2H2DD22Z.js → chunk-GH4VW2OT.js} +1 -1
  28. package/dist/chunks/chunk-ILUHTKF3.js +149 -0
  29. package/dist/chunks/{chunk-UDCGB3LZ.js → chunk-PK72LVWQ.js} +11841 -16501
  30. package/dist/chunks/chunk-RSL7E4R7.js +9634 -0
  31. package/dist/chunks/chunk-YRR6C43W.js +1740 -0
  32. package/dist/chunks/config-74AUVDLT.js +46 -0
  33. package/dist/chunks/model-registry-LI5THXV4.js +17 -0
  34. package/dist/chunks/src-66XSMIAM.js +134 -0
  35. package/dist/chunks/src-BPSQMSSC.js +431 -0
  36. package/dist/chunks/src-OPPYTPWG.js +285 -0
  37. package/dist/chunks/{src-GX4UBAYF.js → src-YG5M2H44.js} +2 -2
  38. package/dist/chunks/{test-stream-AKIZNFCM.js → test-stream-JBWXKOQA.js} +1 -1
  39. package/dist/cli.js +986 -2292
  40. package/package.json +3 -3
@@ -285,83 +285,6 @@ var require_dist = __commonJS({
285
285
  }
286
286
  });
287
287
 
288
- // ../../packages/ai/src/utils/event-stream.ts
289
- var EventStream = class {
290
- constructor(isComplete, extractResult) {
291
- this.isComplete = isComplete;
292
- this.extractResult = extractResult;
293
- this.finalResultPromise = new Promise((resolve) => {
294
- this.resolveFinalResult = resolve;
295
- });
296
- }
297
- isComplete;
298
- extractResult;
299
- queue = [];
300
- waiting = [];
301
- done = false;
302
- resultResolved = false;
303
- finalResultPromise;
304
- resolveFinalResult;
305
- push(event) {
306
- if (this.done) return;
307
- if (this.isComplete(event)) {
308
- this.done = true;
309
- if (!this.resultResolved) {
310
- this.resultResolved = true;
311
- this.resolveFinalResult(this.extractResult(event));
312
- }
313
- }
314
- const waiter = this.waiting.shift();
315
- if (waiter) {
316
- waiter({ value: event, done: false });
317
- } else {
318
- this.queue.push(event);
319
- }
320
- }
321
- end(result) {
322
- this.done = true;
323
- if (result !== void 0 && !this.resultResolved) {
324
- this.resultResolved = true;
325
- this.resolveFinalResult(result);
326
- }
327
- while (this.waiting.length > 0) {
328
- const waiter = this.waiting.shift();
329
- waiter({ value: void 0, done: true });
330
- }
331
- }
332
- async *[Symbol.asyncIterator]() {
333
- while (true) {
334
- if (this.queue.length > 0) {
335
- yield this.queue.shift();
336
- } else if (this.done) {
337
- return;
338
- } else {
339
- const result = await new Promise((resolve) => this.waiting.push(resolve));
340
- if (result.done) return;
341
- yield result.value;
342
- }
343
- }
344
- }
345
- result() {
346
- return this.finalResultPromise;
347
- }
348
- };
349
- var AssistantMessageEventStream = class extends EventStream {
350
- constructor() {
351
- super(
352
- (event) => event.type === "done" || event.type === "error",
353
- (event) => {
354
- if (event.type === "done") {
355
- return event.message;
356
- } else if (event.type === "error") {
357
- return event.error;
358
- }
359
- throw new Error("Unexpected event type for final result");
360
- }
361
- );
362
- }
363
- };
364
-
365
288
  // ../../node_modules/@sinclair/typebox/build/esm/type/registry/format.mjs
366
289
  var format_exports = {};
367
290
  __export(format_exports, {
@@ -455,8 +378,17 @@ function registerApiProvider(provider) {
455
378
  function getApiProvider(api) {
456
379
  return apiProviderRegistry.get(api);
457
380
  }
381
+ function getApiProviders() {
382
+ return Array.from(apiProviderRegistry.values());
383
+ }
384
+ function clearApiProviders() {
385
+ apiProviderRegistry.clear();
386
+ }
458
387
 
459
388
  // ../../packages/ai/src/env-api-keys.ts
389
+ function getProviderEnvVar(provider) {
390
+ return `${provider.toUpperCase().replace(/[^A-Z0-9]+/gi, "_")}_API_KEY`;
391
+ }
460
392
  function getEnvApiKey(provider, explicitEnvVar) {
461
393
  void provider;
462
394
  const env = typeof process !== "undefined" ? process.env : {};
@@ -468,7 +400,73 @@ function getEnvApiKey(provider, explicitEnvVar) {
468
400
  return void 0;
469
401
  }
470
402
 
403
+ // ../../packages/ai/src/models.builtins.ts
404
+ var BUILTIN_MODEL_DEFINITIONS = {};
405
+ function getBuiltInModels() {
406
+ return [];
407
+ }
408
+
471
409
  // ../../packages/ai/src/models.ts
410
+ var modelRegistry = /* @__PURE__ */ new Map();
411
+ function getModel(provider, modelId) {
412
+ const providerModels = modelRegistry.get(provider);
413
+ const model = providerModels?.get(modelId);
414
+ if (!model) {
415
+ throw new Error(`Model "${modelId}" not found for provider "${provider}". Available: ${listAvailableModels().join(", ") || "(none)"}`);
416
+ }
417
+ return model;
418
+ }
419
+ function registerModel(model) {
420
+ let providerModels = modelRegistry.get(model.provider);
421
+ if (!providerModels) {
422
+ providerModels = /* @__PURE__ */ new Map();
423
+ modelRegistry.set(model.provider, providerModels);
424
+ }
425
+ providerModels.set(model.id, model);
426
+ }
427
+ function registerModels(models) {
428
+ for (const model of models) {
429
+ registerModel(model);
430
+ }
431
+ }
432
+ function unregisterModel(provider, modelId) {
433
+ const providerModels = modelRegistry.get(provider);
434
+ if (!providerModels) return false;
435
+ const deleted = providerModels.delete(modelId);
436
+ if (providerModels.size === 0) {
437
+ modelRegistry.delete(provider);
438
+ }
439
+ return deleted;
440
+ }
441
+ function getProviders() {
442
+ return Array.from(modelRegistry.keys());
443
+ }
444
+ function getModels(provider) {
445
+ const models = modelRegistry.get(provider);
446
+ return models ? Array.from(models.values()) : [];
447
+ }
448
+ function getAllModels() {
449
+ const all = [];
450
+ for (const providerModels of modelRegistry.values()) {
451
+ all.push(...providerModels.values());
452
+ }
453
+ return all;
454
+ }
455
+ function listAvailableModels() {
456
+ const ids = [];
457
+ for (const [provider, models] of modelRegistry) {
458
+ for (const modelId of models.keys()) {
459
+ ids.push(`${provider}/${modelId}`);
460
+ }
461
+ }
462
+ return ids.sort();
463
+ }
464
+ function hasModel(provider, modelId) {
465
+ return modelRegistry.get(provider)?.has(modelId) ?? false;
466
+ }
467
+ function clearModels() {
468
+ modelRegistry.clear();
469
+ }
472
470
  function calculateCost(model, usage) {
473
471
  const input = model.cost.input / 1e6 * usage.input;
474
472
  const output = model.cost.output / 1e6 * usage.output;
@@ -490,6 +488,129 @@ function calculateCost(model, usage) {
490
488
  total: input + output + cacheRead + cacheWrite + cacheWriteLong
491
489
  };
492
490
  }
491
+ function createModel(id, config) {
492
+ return {
493
+ id,
494
+ ...config
495
+ };
496
+ }
497
+ function registerDefaultModels() {
498
+ registerModels(getBuiltInModels());
499
+ }
500
+ function registerModelsFromConfig(config) {
501
+ const apiKeys = /* @__PURE__ */ new Map();
502
+ const configuredProfiles = config.profiles || {};
503
+ for (const [providerName, providerConfig] of Object.entries(configuredProfiles)) {
504
+ if (providerConfig.apiKey) {
505
+ apiKeys.set(providerName, providerConfig.apiKey);
506
+ }
507
+ for (const modelDef of providerConfig.models) {
508
+ const model = {
509
+ id: modelDef.id,
510
+ name: modelDef.name,
511
+ api: providerConfig.api,
512
+ provider: providerName,
513
+ baseUrl: providerConfig.baseUrl,
514
+ reasoning: modelDef.reasoning,
515
+ input: modelDef.input,
516
+ cost: modelDef.cost,
517
+ contextWindow: modelDef.contextWindow,
518
+ maxTokens: modelDef.maxTokens,
519
+ apiKeyEnv: modelDef.apiKeyEnv || providerConfig.apiKeyEnv,
520
+ displayName: modelDef.displayName || providerConfig.displayName,
521
+ filePlatform: modelDef.filePlatform || providerConfig.filePlatform,
522
+ attachmentPlatform: modelDef.attachmentPlatform || providerConfig.attachmentPlatform,
523
+ headers: providerConfig.headers ? { ...providerConfig.headers, ...modelDef.headers } : modelDef.headers,
524
+ compat: modelDef.compat,
525
+ cacheCapability: modelDef.cacheCapability,
526
+ webSearch: modelDef.webSearch || providerConfig.webSearch,
527
+ fileCapabilities: modelDef.fileCapabilities || providerConfig.fileCapabilities
528
+ };
529
+ registerModel(model);
530
+ }
531
+ }
532
+ return apiKeys;
533
+ }
534
+
535
+ // ../../packages/ai/src/utils/event-stream.ts
536
+ var EventStream = class {
537
+ constructor(isComplete, extractResult) {
538
+ this.isComplete = isComplete;
539
+ this.extractResult = extractResult;
540
+ this.finalResultPromise = new Promise((resolve) => {
541
+ this.resolveFinalResult = resolve;
542
+ });
543
+ }
544
+ isComplete;
545
+ extractResult;
546
+ queue = [];
547
+ waiting = [];
548
+ done = false;
549
+ resultResolved = false;
550
+ finalResultPromise;
551
+ resolveFinalResult;
552
+ push(event) {
553
+ if (this.done) return;
554
+ if (this.isComplete(event)) {
555
+ this.done = true;
556
+ if (!this.resultResolved) {
557
+ this.resultResolved = true;
558
+ this.resolveFinalResult(this.extractResult(event));
559
+ }
560
+ }
561
+ const waiter = this.waiting.shift();
562
+ if (waiter) {
563
+ waiter({ value: event, done: false });
564
+ } else {
565
+ this.queue.push(event);
566
+ }
567
+ }
568
+ end(result) {
569
+ this.done = true;
570
+ if (result !== void 0 && !this.resultResolved) {
571
+ this.resultResolved = true;
572
+ this.resolveFinalResult(result);
573
+ }
574
+ while (this.waiting.length > 0) {
575
+ const waiter = this.waiting.shift();
576
+ waiter({ value: void 0, done: true });
577
+ }
578
+ }
579
+ async *[Symbol.asyncIterator]() {
580
+ while (true) {
581
+ if (this.queue.length > 0) {
582
+ yield this.queue.shift();
583
+ } else if (this.done) {
584
+ return;
585
+ } else {
586
+ const result = await new Promise((resolve) => this.waiting.push(resolve));
587
+ if (result.done) return;
588
+ yield result.value;
589
+ }
590
+ }
591
+ }
592
+ result() {
593
+ return this.finalResultPromise;
594
+ }
595
+ };
596
+ var AssistantMessageEventStream = class extends EventStream {
597
+ constructor() {
598
+ super(
599
+ (event) => event.type === "done" || event.type === "error",
600
+ (event) => {
601
+ if (event.type === "done") {
602
+ return event.message;
603
+ } else if (event.type === "error") {
604
+ return event.error;
605
+ }
606
+ throw new Error("Unexpected event type for final result");
607
+ }
608
+ );
609
+ }
610
+ };
611
+ function createAssistantMessageEventStream() {
612
+ return new AssistantMessageEventStream();
613
+ }
493
614
 
494
615
  // ../../packages/platform/src/text-hash.ts
495
616
  function createTextHasher() {
@@ -1198,11 +1319,11 @@ var NodeFileSystem = class {
1198
1319
  lastCharWasNewline = char === "\n";
1199
1320
  }
1200
1321
  };
1201
- const stream = fs.createReadStream(path);
1322
+ const stream2 = fs.createReadStream(path);
1202
1323
  try {
1203
- for await (const chunk of stream) {
1324
+ for await (const chunk of stream2) {
1204
1325
  if (signal?.aborted) {
1205
- stream.destroy();
1326
+ stream2.destroy();
1206
1327
  throw new Error("Operation aborted");
1207
1328
  }
1208
1329
  const bytes = chunk;
@@ -1212,7 +1333,7 @@ var NodeFileSystem = class {
1212
1333
  scanText(textDecoder.decode());
1213
1334
  finishLine();
1214
1335
  } finally {
1215
- stream.destroy();
1336
+ stream2.destroy();
1216
1337
  }
1217
1338
  return {
1218
1339
  content: outputLines.join("\n"),
@@ -1295,11 +1416,11 @@ var NodeFileSystem = class {
1295
1416
  lastCharWasNewline = char === "\n";
1296
1417
  }
1297
1418
  };
1298
- const stream = fs.createReadStream(path);
1419
+ const stream2 = fs.createReadStream(path);
1299
1420
  try {
1300
- for await (const chunk of stream) {
1421
+ for await (const chunk of stream2) {
1301
1422
  if (signal?.aborted) {
1302
- stream.destroy();
1423
+ stream2.destroy();
1303
1424
  throw new Error("Operation aborted");
1304
1425
  }
1305
1426
  const bytes = chunk;
@@ -1308,7 +1429,7 @@ var NodeFileSystem = class {
1308
1429
  }
1309
1430
  scanText(textDecoder.decode());
1310
1431
  } finally {
1311
- stream.destroy();
1432
+ stream2.destroy();
1312
1433
  }
1313
1434
  if (lastCharWasNewline) {
1314
1435
  totalLines++;
@@ -2160,8 +2281,15 @@ function isAbortErrorMessage(message) {
2160
2281
  }
2161
2282
  var nodeHttps = null;
2162
2283
  var nodeHttp = null;
2284
+ var nodeTls = null;
2163
2285
  var nodeUrl = null;
2164
2286
  var nodeStringDecoder = null;
2287
+ function getNodeTls() {
2288
+ if (!nodeTls) {
2289
+ nodeTls = require3("tls");
2290
+ }
2291
+ return nodeTls;
2292
+ }
2165
2293
  function getNodeHttps() {
2166
2294
  if (!nodeHttps) {
2167
2295
  nodeHttps = require3("https");
@@ -2188,6 +2316,7 @@ function getNodeStringDecoder() {
2188
2316
  }
2189
2317
  var globalHttpsAgent = null;
2190
2318
  var globalHttpAgent = null;
2319
+ var globalProxyTunnels = /* @__PURE__ */ new Map();
2191
2320
  var agentStats = {
2192
2321
  httpsRequests: 0,
2193
2322
  httpsReusedConnections: 0,
@@ -2230,6 +2359,52 @@ function getHttpAgent() {
2230
2359
  }
2231
2360
  return globalHttpAgent;
2232
2361
  }
2362
+ function getProxyTunnelAgent(targetHost) {
2363
+ const proxy = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.ALL_PROXY || process.env.all_proxy || "";
2364
+ if (!proxy || !/^https?:\/\//i.test(proxy)) return null;
2365
+ const noProxy = (process.env.NO_PROXY || process.env.no_proxy || "").split(",").map((s) => s.trim().toLowerCase());
2366
+ if (noProxy.some((entry) => entry && (targetHost.toLowerCase() === entry || targetHost.toLowerCase().endsWith(`.${entry}`)))) {
2367
+ return null;
2368
+ }
2369
+ let agent = globalProxyTunnels.get(proxy);
2370
+ if (agent) return agent;
2371
+ const https = getNodeHttps();
2372
+ const parsed = new (getNodeUrl()).URL(proxy);
2373
+ const createConnection = (options, callback) => {
2374
+ const http = getNodeHttp();
2375
+ const connect = http.request({
2376
+ host: parsed.hostname,
2377
+ port: Number(parsed.port) || 80,
2378
+ method: "CONNECT",
2379
+ path: `${options.host}:${options.port}`,
2380
+ timeout: 15e3,
2381
+ headers: parsed.username ? { "proxy-authorization": `Basic ${Buffer.from(`${decodeURIComponent(parsed.username)}:${decodeURIComponent(parsed.password)}`).toString("base64")}` } : {}
2382
+ });
2383
+ connect.on("connect", (res, socket) => {
2384
+ if (!res.statusCode || res.statusCode < 200 || res.statusCode >= 300) {
2385
+ callback(new Error(`proxy CONNECT failed with ${res.statusCode}`));
2386
+ return;
2387
+ }
2388
+ const tls = getNodeTls();
2389
+ const tlsSocket = tls.connect(
2390
+ { socket, servername: options.servername || options.host },
2391
+ () => callback(null, tlsSocket)
2392
+ );
2393
+ tlsSocket.once("error", (error) => callback(error));
2394
+ });
2395
+ connect.on("timeout", () => connect.destroy(new Error("proxy CONNECT timed out")));
2396
+ connect.on("error", (error) => callback(error));
2397
+ connect.end();
2398
+ };
2399
+ agent = new https.Agent({
2400
+ keepAlive: true,
2401
+ maxSockets: 10
2402
+ });
2403
+ agent.createConnection = createConnection;
2404
+ globalProxyTunnels.set(proxy, agent);
2405
+ logHttp("INFO", `Proxy tunnel agent created for ${parsed.host} (HTTPS_PROXY)`);
2406
+ return agent;
2407
+ }
2233
2408
  var NodeHttpClient = class {
2234
2409
  /** The Node client never re-sends a request: one `request()` call is one submission. */
2235
2410
  transportCapabilities = { singleAttempt: true };
@@ -2264,7 +2439,7 @@ var NodeHttpClient = class {
2264
2439
  const parsedUrl = new (getNodeUrl()).URL(url);
2265
2440
  const isHttps = parsedUrl.protocol === "https:";
2266
2441
  const lib = isHttps ? getNodeHttps() : getNodeHttp();
2267
- const agent = isHttps ? getHttpsAgent() : getHttpAgent();
2442
+ const agent = (isHttps ? getProxyTunnelAgent(parsedUrl.hostname) : null) ?? (isHttps ? getHttpsAgent() : getHttpAgent());
2268
2443
  if (isHttps) {
2269
2444
  agentStats.httpsRequests++;
2270
2445
  } else {
@@ -2589,6 +2764,13 @@ var NodeHttpClient = class {
2589
2764
  });
2590
2765
  }
2591
2766
  };
2767
+ function scheduleNextTick(callback) {
2768
+ if (typeof setTimeout === "function") {
2769
+ setTimeout(callback, 0);
2770
+ return;
2771
+ }
2772
+ Promise.resolve().then(callback);
2773
+ }
2592
2774
  var PuerTSHttpClient = class {
2593
2775
  /** No internal re-send: each call starts exactly one bridge request. */
2594
2776
  transportCapabilities = { singleAttempt: true };
@@ -2597,7 +2779,13 @@ var PuerTSHttpClient = class {
2597
2779
  url: url.slice(0, 100),
2598
2780
  method: options.method || "GET"
2599
2781
  });
2600
- if (typeof CS !== "undefined" && CS?.AgentBridge?.HttpPostAsyncStart && CS?.AgentBridge?.HttpPostAsyncPoll) {
2782
+ let legacyBridge = false;
2783
+ try {
2784
+ legacyBridge = typeof CS !== "undefined" && !!CS?.AgentBridge && typeof CS.AgentBridge.HttpPostAsyncStart === "function";
2785
+ } catch {
2786
+ legacyBridge = false;
2787
+ }
2788
+ if (legacyBridge) {
2601
2789
  const method2 = options.method || "GET";
2602
2790
  const body2 = options.body || "";
2603
2791
  const auth = options.headers?.Authorization || options.headers?.authorization || "";
@@ -2667,9 +2855,42 @@ var PuerTSHttpClient = class {
2667
2855
  request.SetRequestHeader(key, value);
2668
2856
  }
2669
2857
  if (body && ["POST", "PUT", "PATCH"].includes(method.toUpperCase())) {
2670
- const encoder = new TextEncoder();
2671
- const bodyData = encoder.encode(body);
2672
- request.uploadHandler = new UnityEngine.Networking.UploadHandlerRaw(bodyData);
2858
+ const encodeUtf8 = (text) => {
2859
+ const out = [];
2860
+ for (let i = 0; i < text.length; i++) {
2861
+ let code = text.charCodeAt(i);
2862
+ if (code < 128) out.push(code);
2863
+ else {
2864
+ if (code >= 55296 && code <= 56319 && i + 1 < text.length) {
2865
+ const low = text.charCodeAt(i + 1);
2866
+ if (low >= 56320 && low <= 57343) {
2867
+ code = 65536 + (code - 55296 << 10) + (low - 56320);
2868
+ i++;
2869
+ }
2870
+ }
2871
+ if (code < 2048) out.push(192 | code >> 6, 128 | code & 63);
2872
+ else if (code < 65536) out.push(224 | code >> 12, 128 | code >> 6 & 63, 128 | code & 63);
2873
+ else out.push(240 | code >> 18, 128 | code >> 12 & 63, 128 | code >> 6 & 63, 128 | code & 63);
2874
+ }
2875
+ }
2876
+ return new Uint8Array(out);
2877
+ };
2878
+ const base64 = (bytes) => {
2879
+ let binary = "";
2880
+ const table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2881
+ for (let i = 0; i < bytes.length; i += 3) {
2882
+ const b0 = bytes[i], b1 = bytes[i + 1], b2 = bytes[i + 2];
2883
+ binary += table[b0 >> 2] + table[(b0 & 3) << 4 | (b1 ?? 0) >> 4];
2884
+ if (b1 === void 0) break;
2885
+ binary += table[(b1 & 15) << 2 | (b2 ?? 0) >> 6];
2886
+ if (b2 === void 0) break;
2887
+ binary += table[b2 & 63];
2888
+ }
2889
+ const pad = bytes.length % 3;
2890
+ return binary + (pad === 1 ? "==" : pad === 2 ? "=" : "");
2891
+ };
2892
+ const bodyBytes = CS.System.Convert.FromBase64String(base64(encodeUtf8(body)));
2893
+ request.uploadHandler = new UnityEngine.Networking.UploadHandlerRaw(bodyBytes);
2673
2894
  }
2674
2895
  request.downloadHandler = new UnityEngine.Networking.DownloadHandlerBuffer();
2675
2896
  let aborted = false;
@@ -2682,6 +2903,12 @@ var PuerTSHttpClient = class {
2682
2903
  options.signal.addEventListener("abort", onAbort, { once: true });
2683
2904
  }
2684
2905
  const asyncOp = request.SendWebRequest();
2906
+ const completed = new Promise((resolveCompleted) => {
2907
+ try {
2908
+ asyncOp.add_completed(() => resolveCompleted());
2909
+ } catch {
2910
+ }
2911
+ });
2685
2912
  const checkComplete = () => {
2686
2913
  if (aborted) return;
2687
2914
  if (asyncOp.isDone) {
@@ -2727,26 +2954,10 @@ var PuerTSHttpClient = class {
2727
2954
  }
2728
2955
  });
2729
2956
  } else {
2730
- if (typeof setTimeout !== "undefined") {
2731
- setTimeout(checkComplete, 10);
2732
- } else {
2733
- const startWait = Date.now();
2734
- const wait = () => {
2735
- if (!asyncOp.isDone && Date.now() - startWait < 3e4) {
2736
- if (typeof setImmediate !== "undefined") {
2737
- setImmediate(wait);
2738
- } else {
2739
- checkComplete();
2740
- }
2741
- } else {
2742
- checkComplete();
2743
- }
2744
- };
2745
- wait();
2746
- }
2957
+ void completed.then(() => checkComplete());
2747
2958
  }
2748
2959
  };
2749
- checkComplete();
2960
+ scheduleNextTick(checkComplete);
2750
2961
  });
2751
2962
  }
2752
2963
  };
@@ -3372,6 +3583,13 @@ var FileSystemGateway = class {
3372
3583
  return this.config;
3373
3584
  }
3374
3585
  };
3586
+ var gatewayInstance = null;
3587
+ function getFileSystemGateway(options) {
3588
+ if (!gatewayInstance) {
3589
+ gatewayInstance = new FileSystemGateway(options);
3590
+ }
3591
+ return gatewayInstance;
3592
+ }
3375
3593
  function csharpStringArray(value) {
3376
3594
  if (Array.isArray(value)) {
3377
3595
  return value.map((entry) => String(entry ?? ""));
@@ -3891,6 +4109,9 @@ function getModelCacheCapability(model) {
3891
4109
  function isPromptCacheCapability(capability) {
3892
4110
  return capability.mode === "prompt_cache";
3893
4111
  }
4112
+ function isSessionStoreCapability(capability) {
4113
+ return capability.mode === "session_store";
4114
+ }
3894
4115
 
3895
4116
  // ../../packages/ai/src/providers/openai-compat-config.ts
3896
4117
  function detectCompat(_model) {
@@ -4439,7 +4660,7 @@ function tryParseFinalToolArguments(partialArgs) {
4439
4660
  }
4440
4661
  var streamOpenAICompletions = (model, context, options) => {
4441
4662
  if ((options?.transport ?? model.transport) === "websocket") throw new Error(`API ${model.api} does not support WebSocket transport.`);
4442
- const stream = new AssistantMessageEventStream();
4663
+ const stream2 = new AssistantMessageEventStream();
4443
4664
  (async () => {
4444
4665
  const output = {
4445
4666
  role: "assistant",
@@ -4493,7 +4714,7 @@ var streamOpenAICompletions = (model, context, options) => {
4493
4714
  const errorBody = await response.text().catch(() => "");
4494
4715
  throw new Error(`API error ${response.status}: ${errorBody}`);
4495
4716
  }
4496
- stream.push({ type: "start", partial: output });
4717
+ stream2.push({ type: "start", partial: output });
4497
4718
  let currentBlock = null;
4498
4719
  const blocks = output.content;
4499
4720
  const blockIndex = () => blocks.length - 1;
@@ -4514,7 +4735,7 @@ var streamOpenAICompletions = (model, context, options) => {
4514
4735
  output.content.push(block);
4515
4736
  const entry = { block, partialArgs: "", contentIndex: blockIndex(), index };
4516
4737
  toolCallEntries.push(entry);
4517
- stream.push({
4738
+ stream2.push({
4518
4739
  type: "toolcall_start",
4519
4740
  contentIndex: entry.contentIndex,
4520
4741
  partial: output
@@ -4588,14 +4809,14 @@ var streamOpenAICompletions = (model, context, options) => {
4588
4809
  const finishCurrentBlock = (block) => {
4589
4810
  if (block) {
4590
4811
  if (block.type === "text") {
4591
- stream.push({
4812
+ stream2.push({
4592
4813
  type: "text_end",
4593
4814
  contentIndex: blocks.indexOf(block),
4594
4815
  content: block.text,
4595
4816
  partial: output
4596
4817
  });
4597
4818
  } else if (block.type === "thinking") {
4598
- stream.push({
4819
+ stream2.push({
4599
4820
  type: "thinking_end",
4600
4821
  contentIndex: blocks.indexOf(block),
4601
4822
  content: block.thinking,
@@ -4661,7 +4882,7 @@ var streamOpenAICompletions = (model, context, options) => {
4661
4882
  finishCurrentBlock(currentBlock);
4662
4883
  currentBlock = { type: "text", text: "" };
4663
4884
  output.content.push(currentBlock);
4664
- stream.push({
4885
+ stream2.push({
4665
4886
  type: "text_start",
4666
4887
  contentIndex: blockIndex(),
4667
4888
  partial: output
@@ -4669,7 +4890,7 @@ var streamOpenAICompletions = (model, context, options) => {
4669
4890
  }
4670
4891
  if (currentBlock.type === "text") {
4671
4892
  currentBlock.text += choice.delta.content;
4672
- stream.push({
4893
+ stream2.push({
4673
4894
  type: "text_delta",
4674
4895
  contentIndex: blockIndex(),
4675
4896
  delta: choice.delta.content,
@@ -4698,7 +4919,7 @@ var streamOpenAICompletions = (model, context, options) => {
4698
4919
  thinkingSignature: foundReasoningField
4699
4920
  };
4700
4921
  output.content.push(currentBlock);
4701
- stream.push({
4922
+ stream2.push({
4702
4923
  type: "thinking_start",
4703
4924
  contentIndex: blockIndex(),
4704
4925
  partial: output
@@ -4707,7 +4928,7 @@ var streamOpenAICompletions = (model, context, options) => {
4707
4928
  if (currentBlock.type === "thinking") {
4708
4929
  const delta = choice.delta[foundReasoningField];
4709
4930
  currentBlock.thinking += delta;
4710
- stream.push({
4931
+ stream2.push({
4711
4932
  type: "thinking_delta",
4712
4933
  contentIndex: blockIndex(),
4713
4934
  delta,
@@ -4735,7 +4956,7 @@ var streamOpenAICompletions = (model, context, options) => {
4735
4956
  entry.partialArgs += delta;
4736
4957
  entry.block.arguments = parseStreamingJson(entry.partialArgs);
4737
4958
  }
4738
- stream.push({
4959
+ stream2.push({
4739
4960
  type: "toolcall_delta",
4740
4961
  contentIndex: entry.contentIndex,
4741
4962
  delta,
@@ -4834,7 +5055,7 @@ ${entry.partialArgs}`;
4834
5055
  throw createProtocolError("OpenAI-compatible stream returned a tool call without a function name.");
4835
5056
  }
4836
5057
  block.arguments = parseFinalToolArguments(partialArgs, block.name);
4837
- stream.push({ type: "toolcall_end", contentIndex, toolCall: block, partial: output });
5058
+ stream2.push({ type: "toolcall_end", contentIndex, toolCall: block, partial: output });
4838
5059
  }
4839
5060
  const hasToolCallBlocks = output.content.some((block) => block.type === "toolCall");
4840
5061
  if (output.stopReason !== "error" && output.stopReason !== "aborted" && hasToolCallBlocks) {
@@ -4850,8 +5071,8 @@ ${entry.partialArgs}`;
4850
5071
  }
4851
5072
  assertAssistantHasContent(output);
4852
5073
  resetOpenAICompatFirstByteTimeoutEscalation(model);
4853
- stream.push({ type: "done", reason: output.stopReason, message: output });
4854
- stream.end();
5074
+ stream2.push({ type: "done", reason: output.stopReason, message: output });
5075
+ stream2.end();
4855
5076
  } catch (error) {
4856
5077
  logEmptyAssistantContentError(error, model, options);
4857
5078
  if (error instanceof Error && error.message.includes("Request timeout (first byte)")) {
@@ -4859,11 +5080,11 @@ ${entry.partialArgs}`;
4859
5080
  }
4860
5081
  output.stopReason = options?.signal?.aborted ? "aborted" : "error";
4861
5082
  output.errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
4862
- stream.push({ type: "error", reason: output.stopReason, error: output });
4863
- stream.end();
5083
+ stream2.push({ type: "error", reason: output.stopReason, error: output });
5084
+ stream2.end();
4864
5085
  }
4865
5086
  })();
4866
- return stream;
5087
+ return stream2;
4867
5088
  };
4868
5089
  var streamSimpleOpenAICompletions = (model, context, options) => {
4869
5090
  const apiKey = options?.apiKey || getEnvApiKey(model.provider, model.apiKeyEnv);
@@ -5144,7 +5365,7 @@ function applyCacheBreakpoints(params, retention) {
5144
5365
  }
5145
5366
  var streamAnthropic = (model, context, options) => {
5146
5367
  if ((options?.transport ?? model.transport) === "websocket") throw new Error(`API ${model.api} does not support WebSocket transport.`);
5147
- const stream = new AssistantMessageEventStream();
5368
+ const stream2 = new AssistantMessageEventStream();
5148
5369
  (async () => {
5149
5370
  const output = {
5150
5371
  role: "assistant",
@@ -5211,7 +5432,7 @@ var streamAnthropic = (model, context, options) => {
5211
5432
  }
5212
5433
  options?.onPayload?.(params);
5213
5434
  const anthropicStream = client.messages.stream({ ...params, stream: true }, { signal: options?.signal });
5214
- stream.push({ type: "start", partial: output });
5435
+ stream2.push({ type: "start", partial: output });
5215
5436
  const blocks = output.content;
5216
5437
  let hasReportedInputUsage = false;
5217
5438
  for await (const event of anthropicStream) {
@@ -5223,11 +5444,11 @@ var streamAnthropic = (model, context, options) => {
5223
5444
  if (event.content_block.type === "text") {
5224
5445
  const block = { type: "text", text: "", index: event.index };
5225
5446
  output.content.push(block);
5226
- stream.push({ type: "text_start", contentIndex: output.content.length - 1, partial: output });
5447
+ stream2.push({ type: "text_start", contentIndex: output.content.length - 1, partial: output });
5227
5448
  } else if (event.content_block.type === "thinking") {
5228
5449
  const block = { type: "thinking", thinking: "", thinkingSignature: "", index: event.index };
5229
5450
  output.content.push(block);
5230
- stream.push({
5451
+ stream2.push({
5231
5452
  type: "thinking_start",
5232
5453
  contentIndex: output.content.length - 1,
5233
5454
  partial: output
@@ -5242,7 +5463,7 @@ var streamAnthropic = (model, context, options) => {
5242
5463
  index: event.index
5243
5464
  };
5244
5465
  output.content.push(block);
5245
- stream.push({
5466
+ stream2.push({
5246
5467
  type: "toolcall_start",
5247
5468
  contentIndex: output.content.length - 1,
5248
5469
  partial: output
@@ -5254,14 +5475,14 @@ var streamAnthropic = (model, context, options) => {
5254
5475
  const block = blocks[index];
5255
5476
  if (block?.type === "text") {
5256
5477
  block.text += event.delta.text;
5257
- stream.push({ type: "text_delta", contentIndex: index, delta: event.delta.text, partial: output });
5478
+ stream2.push({ type: "text_delta", contentIndex: index, delta: event.delta.text, partial: output });
5258
5479
  }
5259
5480
  } else if (event.delta.type === "thinking_delta") {
5260
5481
  const index = blocks.findIndex((b) => b.index === event.index);
5261
5482
  const block = blocks[index];
5262
5483
  if (block?.type === "thinking") {
5263
5484
  block.thinking += event.delta.thinking;
5264
- stream.push({
5485
+ stream2.push({
5265
5486
  type: "thinking_delta",
5266
5487
  contentIndex: index,
5267
5488
  delta: event.delta.thinking,
@@ -5274,7 +5495,7 @@ var streamAnthropic = (model, context, options) => {
5274
5495
  if (block?.type === "toolCall") {
5275
5496
  block.partialJson += event.delta.partial_json;
5276
5497
  block.arguments = parseStreamingJson(block.partialJson);
5277
- stream.push({
5498
+ stream2.push({
5278
5499
  type: "toolcall_delta",
5279
5500
  contentIndex: index,
5280
5501
  delta: event.delta.partial_json,
@@ -5294,14 +5515,14 @@ var streamAnthropic = (model, context, options) => {
5294
5515
  if (block) {
5295
5516
  delete block.index;
5296
5517
  if (block.type === "text") {
5297
- stream.push({
5518
+ stream2.push({
5298
5519
  type: "text_end",
5299
5520
  contentIndex: index,
5300
5521
  content: block.text,
5301
5522
  partial: output
5302
5523
  });
5303
5524
  } else if (block.type === "thinking") {
5304
- stream.push({
5525
+ stream2.push({
5305
5526
  type: "thinking_end",
5306
5527
  contentIndex: index,
5307
5528
  content: block.thinking,
@@ -5310,7 +5531,7 @@ var streamAnthropic = (model, context, options) => {
5310
5531
  } else if (block.type === "toolCall") {
5311
5532
  block.arguments = parseStreamingJson(block.partialJson);
5312
5533
  delete block.partialJson;
5313
- stream.push({
5534
+ stream2.push({
5314
5535
  type: "toolcall_end",
5315
5536
  contentIndex: index,
5316
5537
  toolCall: block,
@@ -5330,18 +5551,18 @@ var streamAnthropic = (model, context, options) => {
5330
5551
  throw new Error("Request was aborted");
5331
5552
  }
5332
5553
  assertAssistantHasContent(output);
5333
- stream.push({ type: "done", reason: output.stopReason, message: output });
5334
- stream.end();
5554
+ stream2.push({ type: "done", reason: output.stopReason, message: output });
5555
+ stream2.end();
5335
5556
  } catch (error) {
5336
5557
  logEmptyAssistantContentError(error, model, options);
5337
5558
  for (const block of output.content) delete block.index;
5338
5559
  output.stopReason = options?.signal?.aborted ? "aborted" : "error";
5339
5560
  output.errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
5340
- stream.push({ type: "error", reason: output.stopReason, error: output });
5341
- stream.end();
5561
+ stream2.push({ type: "error", reason: output.stopReason, error: output });
5562
+ stream2.end();
5342
5563
  }
5343
5564
  })();
5344
- return stream;
5565
+ return stream2;
5345
5566
  };
5346
5567
  var streamSimpleAnthropic = (model, context, options) => {
5347
5568
  const apiKey = options?.apiKey || getEnvApiKey(model.provider, model.apiKeyEnv);
@@ -5456,13 +5677,16 @@ function encodeUserMessage(content, model) {
5456
5677
  }
5457
5678
  return { role: "user", type: "message", content: parts };
5458
5679
  }
5680
+ function omittedAttachmentNote(modality, reason) {
5681
+ return { type: "input_text", text: `[${modality} attachment omitted: ${reason} Re-read with a compatible model.]` };
5682
+ }
5459
5683
  function encodeUserContentBlock(block, model) {
5460
5684
  if (block.type === "hostContext") {
5461
5685
  throw new ResponsesProtocolError(`Unprojected hostContext block reached Responses conversion (${block.kind}); the request path must project host envelopes to text first.`);
5462
5686
  }
5463
5687
  const modality = block.type === "fileRef" ? block.modality : block.type;
5464
5688
  if (modality !== "text" && !model.input.includes(modality)) {
5465
- throw new ResponsesProtocolError(`Current model does not support ${modality} input.`);
5689
+ return [omittedAttachmentNote(modality, "current model does not support this modality.")];
5466
5690
  }
5467
5691
  switch (block.type) {
5468
5692
  case "text":
@@ -5471,13 +5695,13 @@ function encodeUserContentBlock(block, model) {
5471
5695
  return [{ type: "input_image", image_url: `data:${block.mimeType};base64,${block.data}` }];
5472
5696
  case "video":
5473
5697
  case "audio":
5474
- throw new ResponsesProtocolError(`Responses ${block.type} input is not supported by this provider.`);
5698
+ return [omittedAttachmentNote(block.type, `the Responses provider does not deliver ${block.type} input.`)];
5475
5699
  case "fileRef": {
5476
5700
  const ref = block;
5477
5701
  if (ref.modality === "image") {
5478
5702
  return [{ type: "input_image", image_url: ref.url }];
5479
5703
  }
5480
- throw new ResponsesProtocolError(`Responses ${ref.modality} file references are not supported by this provider.`);
5704
+ return [omittedAttachmentNote(ref.modality, `the Responses provider does not deliver ${ref.modality} file references.`)];
5481
5705
  }
5482
5706
  default:
5483
5707
  throw new ResponsesProtocolError("Unsupported Responses content block.");
@@ -6238,7 +6462,7 @@ function resolveSSEBudgets(options, model) {
6238
6462
  };
6239
6463
  }
6240
6464
  function streamResponsesSSE(model, context, options) {
6241
- const stream = new AssistantMessageEventStream();
6465
+ const stream2 = new AssistantMessageEventStream();
6242
6466
  void (async () => {
6243
6467
  const reducer = new ResponsesEventReducer(model);
6244
6468
  const localRequestId = nextLocalRequestId("sse");
@@ -6426,7 +6650,7 @@ function streamResponsesSSE(model, context, options) {
6426
6650
  throw error;
6427
6651
  }
6428
6652
  for (const assistantEvent of events) {
6429
- stream.push(assistantEvent);
6653
+ stream2.push(assistantEvent);
6430
6654
  }
6431
6655
  if (reducer.isTerminal) {
6432
6656
  terminalAccepted = true;
@@ -6437,7 +6661,7 @@ function streamResponsesSSE(model, context, options) {
6437
6661
  }
6438
6662
  }
6439
6663
  if (reducer.isTerminal) {
6440
- stream.end();
6664
+ stream2.end();
6441
6665
  return;
6442
6666
  }
6443
6667
  if (requestAbort.signal.aborted) {
@@ -6447,7 +6671,7 @@ function streamResponsesSSE(model, context, options) {
6447
6671
  throw reducer.finishWithoutTerminal();
6448
6672
  } catch (error) {
6449
6673
  if (reducer.isTerminal) {
6450
- stream.end();
6674
+ stream2.end();
6451
6675
  return;
6452
6676
  }
6453
6677
  const message = reducer.message;
@@ -6483,14 +6707,14 @@ function streamResponsesSSE(model, context, options) {
6483
6707
  cancelSource: userAborted ? "user" : internalTimeout ? "internal_timeout" : "none",
6484
6708
  cleanupOutcome: "request_abandoned"
6485
6709
  });
6486
- stream.push({ type: "error", reason: message.stopReason, error: message });
6487
- stream.end();
6710
+ stream2.push({ type: "error", reason: message.stopReason, error: message });
6711
+ stream2.end();
6488
6712
  } finally {
6489
6713
  clearTotalTimer();
6490
6714
  options?.signal?.removeEventListener("abort", onUserAbort);
6491
6715
  }
6492
6716
  })();
6493
- return stream;
6717
+ return stream2;
6494
6718
  }
6495
6719
 
6496
6720
  // ../../packages/ai/src/providers/responses/responses-continuation.ts
@@ -6698,7 +6922,7 @@ function websocketUrl(base) {
6698
6922
  return `${url.protocol === "https:" ? "wss:" : "ws:"}${url.toString().slice(url.protocol.length)}`;
6699
6923
  }
6700
6924
  function streamResponsesWS(model, context, options) {
6701
- const stream = new AssistantMessageEventStream();
6925
+ const stream2 = new AssistantMessageEventStream();
6702
6926
  const owner = options?.transportOwner ?? {};
6703
6927
  const state = stateFor(owner);
6704
6928
  const reducer = new ResponsesEventReducer(model);
@@ -6706,9 +6930,9 @@ function streamResponsesWS(model, context, options) {
6706
6930
  reducer.message.stopReason = "error";
6707
6931
  reducer.message.errorMessage = "Responses owner already has an in-flight request.";
6708
6932
  reducer.message.retryable = false;
6709
- stream.push({ type: "error", reason: "error", error: reducer.message });
6710
- stream.end();
6711
- return stream;
6933
+ stream2.push({ type: "error", reason: "error", error: reducer.message });
6934
+ stream2.end();
6935
+ return stream2;
6712
6936
  }
6713
6937
  let budgets;
6714
6938
  try {
@@ -6717,9 +6941,9 @@ function streamResponsesWS(model, context, options) {
6717
6941
  reducer.message.stopReason = "error";
6718
6942
  reducer.message.errorMessage = error instanceof Error ? error.message : String(error);
6719
6943
  reducer.message.retryable = false;
6720
- stream.push({ type: "error", reason: "error", error: reducer.message });
6721
- stream.end();
6722
- return stream;
6944
+ stream2.push({ type: "error", reason: "error", error: reducer.message });
6945
+ stream2.end();
6946
+ return stream2;
6723
6947
  }
6724
6948
  state.busy = true;
6725
6949
  const localRequestId = nextLocalRequestId("ws");
@@ -6761,7 +6985,7 @@ function streamResponsesWS(model, context, options) {
6761
6985
  const requestAbort = new AbortController();
6762
6986
  const publish = (event) => {
6763
6987
  if (event.type === "done" || event.type === "error") terminalEvents.push(event);
6764
- else stream.push(event);
6988
+ else stream2.push(event);
6765
6989
  };
6766
6990
  const ageMs = () => Math.round(monotonicNow() - startedAt);
6767
6991
  const lastReceiveAgeMs = () => Math.round(monotonicNow() - lastReceiveAt);
@@ -7175,7 +7399,7 @@ function streamResponsesWS(model, context, options) {
7175
7399
  }
7176
7400
  if (message.remoteFailure) retryDecision = `remote_${message.remoteFailure.category}`;
7177
7401
  cleanupCancelSource = userAborted ? "user" : timedOut ? "internal_timeout" : ownerDisposed ? "owner_disposal" : "none";
7178
- stream.push({ type: "error", reason: message.stopReason, error: message });
7402
+ stream2.push({ type: "error", reason: message.stopReason, error: message });
7179
7403
  }
7180
7404
  } finally {
7181
7405
  clearRequestTimers();
@@ -7200,11 +7424,11 @@ function streamResponsesWS(model, context, options) {
7200
7424
  retryDecision,
7201
7425
  cleanupOutcome
7202
7426
  });
7203
- for (const event of terminalEvents) stream.push(event);
7204
- stream.end();
7427
+ for (const event of terminalEvents) stream2.push(event);
7428
+ stream2.end();
7205
7429
  }
7206
7430
  })();
7207
- return stream;
7431
+ return stream2;
7208
7432
  }
7209
7433
 
7210
7434
  // ../../packages/ai/src/providers/openai-responses.ts
@@ -7252,6 +7476,14 @@ function resolveApiProvider(api) {
7252
7476
  }
7253
7477
  return provider;
7254
7478
  }
7479
+ function stream(model, context, options) {
7480
+ const provider = resolveApiProvider(model.api);
7481
+ return provider.stream(model, context, options);
7482
+ }
7483
+ async function complete(model, context, options) {
7484
+ const s = stream(model, context, options);
7485
+ return s.result();
7486
+ }
7255
7487
  function streamSimple(model, context, options) {
7256
7488
  const provider = resolveApiProvider(model.api);
7257
7489
  return provider.streamSimple(model, context, options);
@@ -10637,6 +10869,13 @@ __export(value_exports, {
10637
10869
  });
10638
10870
 
10639
10871
  // ../../packages/ai/src/utils/validation.ts
10872
+ function validateToolCall(tools, toolCall) {
10873
+ const tool = tools.find((t) => t.name === toolCall.name);
10874
+ if (!tool) {
10875
+ throw new Error(`Tool "${toolCall.name}" not found`);
10876
+ }
10877
+ return validateToolArguments(tool, toolCall);
10878
+ }
10640
10879
  function validateToolArguments(tool, toolCall) {
10641
10880
  const args = toolCall.arguments ?? {};
10642
10881
  if (value_exports.Check(tool.parameters, args)) {
@@ -10718,19 +10957,68 @@ export {
10718
10957
  getLogger,
10719
10958
  getPlatformConfig,
10720
10959
  FileSystemGateway,
10960
+ getFileSystemGateway,
10721
10961
  getFileSystem,
10722
10962
  format_exports,
10723
10963
  type_exports,
10724
10964
  ExtendsUndefinedCheck,
10965
+ registerApiProvider,
10966
+ getApiProvider,
10967
+ getApiProviders,
10968
+ clearApiProviders,
10969
+ getProviderEnvVar,
10970
+ getEnvApiKey,
10971
+ BUILTIN_MODEL_DEFINITIONS,
10972
+ getBuiltInModels,
10973
+ getModel,
10974
+ registerModel,
10975
+ registerModels,
10976
+ unregisterModel,
10977
+ getProviders,
10978
+ getModels,
10979
+ getAllModels,
10980
+ listAvailableModels,
10981
+ hasModel,
10982
+ clearModels,
10983
+ calculateCost,
10984
+ createModel,
10985
+ registerDefaultModels,
10986
+ registerModelsFromConfig,
10725
10987
  EventStream,
10726
10988
  AssistantMessageEventStream,
10989
+ createAssistantMessageEventStream,
10990
+ parseStreamingJson,
10991
+ NO_CACHE_CAPABILITY,
10992
+ ANTHROPIC_PROMPT_CACHE_CAPABILITY,
10727
10993
  getModelCacheCapability,
10994
+ isPromptCacheCapability,
10995
+ isSessionStoreCapability,
10996
+ getCompat,
10728
10997
  EMPTY_ASSISTANT_CONTENT_ERROR,
10998
+ EMPTY_ASSISTANT_CONTENT_ERROR_CODE,
10999
+ EmptyAssistantContentError,
11000
+ hasAssistantContent,
11001
+ assertAssistantHasContent,
11002
+ isEmptyAssistantContentError,
11003
+ logEmptyAssistantContentError,
10729
11004
  OPENAI_COMPAT_PROTOCOL_ERROR_CODE,
11005
+ OpenAICompatProtocolError,
11006
+ streamOpenAICompletions,
11007
+ streamSimpleOpenAICompletions,
11008
+ streamAnthropic,
11009
+ streamSimpleAnthropic,
11010
+ getResponsesCompat,
11011
+ RESPONSES_PROTOCOL_ERROR_CODE,
11012
+ ResponsesProtocolError,
10730
11013
  disposeModelTransports,
11014
+ streamResponses,
11015
+ streamSimpleResponses,
11016
+ stream,
11017
+ complete,
10731
11018
  streamSimple,
10732
11019
  completeSimple,
10733
11020
  MODEL_CLASS_FALLBACK_ORDER,
11021
+ fileKindForToolModelPurpose,
10734
11022
  requiredCapabilityForToolPurpose,
10735
11023
  modelSupportsToolPurpose,
10736
11024
  sortToolModelCandidatesByCapability,
@@ -10742,5 +11030,6 @@ export {
10742
11030
  TransformEncodeCheckError,
10743
11031
  TransformEncode,
10744
11032
  HasTransform,
11033
+ validateToolCall,
10745
11034
  validateToolArguments
10746
11035
  };