@theokit/sdk 5.12.1 → 5.14.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.
Files changed (193) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/{agent-Cn0sphpA.d.cts → agent-DExqjqYy.d.cts} +18 -3
  3. package/dist/{agent-CVzDy_Oj.d.ts → agent-Dfw3VsIX.d.ts} +18 -3
  4. package/dist/{agent-IG7BP6GN.js → agent-T34LCGQM.js} +11 -11
  5. package/dist/{agent-IG7BP6GN.js.map → agent-T34LCGQM.js.map} +1 -1
  6. package/dist/{agent-BVKIUP7F.cjs → agent-TL4K7BTG.cjs} +12 -12
  7. package/dist/{agent-BVKIUP7F.cjs.map → agent-TL4K7BTG.cjs.map} +1 -1
  8. package/dist/auth/index.cjs +17 -16
  9. package/dist/auth/index.cjs.map +1 -1
  10. package/dist/auth/index.js +5 -4
  11. package/dist/auth/index.js.map +1 -1
  12. package/dist/{chunk-NHOEXFZT.js → chunk-2HXTNVLM.js} +5 -2
  13. package/dist/chunk-2HXTNVLM.js.map +1 -0
  14. package/dist/{chunk-Q6WT5535.cjs → chunk-2WY2OFSC.cjs} +259 -79
  15. package/dist/chunk-2WY2OFSC.cjs.map +1 -0
  16. package/dist/{chunk-HN4IKB6X.cjs → chunk-2XWAYCFM.cjs} +15 -13
  17. package/dist/chunk-2XWAYCFM.cjs.map +1 -0
  18. package/dist/{chunk-3FSBE4PS.js → chunk-3GTN4HOO.js} +10 -6
  19. package/dist/chunk-3GTN4HOO.js.map +1 -0
  20. package/dist/{chunk-VVGFZQZC.js → chunk-3LMVJTNJ.js} +9 -5
  21. package/dist/chunk-3LMVJTNJ.js.map +1 -0
  22. package/dist/{chunk-4GUFNDZR.js → chunk-3ONIVO2I.js} +3 -3
  23. package/dist/{chunk-4GUFNDZR.js.map → chunk-3ONIVO2I.js.map} +1 -1
  24. package/dist/{chunk-7WARNHWW.cjs → chunk-3UMPP553.cjs} +5 -2
  25. package/dist/chunk-3UMPP553.cjs.map +1 -0
  26. package/dist/{chunk-NWWTYBD3.cjs → chunk-4KBI37F3.cjs} +5 -5
  27. package/dist/{chunk-NWWTYBD3.cjs.map → chunk-4KBI37F3.cjs.map} +1 -1
  28. package/dist/{chunk-S46WJTDL.cjs → chunk-4TEGFMSP.cjs} +6 -6
  29. package/dist/{chunk-S46WJTDL.cjs.map → chunk-4TEGFMSP.cjs.map} +1 -1
  30. package/dist/{chunk-QISSETTG.cjs → chunk-5645PMVU.cjs} +6 -4
  31. package/dist/chunk-5645PMVU.cjs.map +1 -0
  32. package/dist/{chunk-ZLFFDPXC.js → chunk-73IITAF7.js} +36 -14
  33. package/dist/chunk-73IITAF7.js.map +1 -0
  34. package/dist/{chunk-5A4UFBHW.cjs → chunk-A77UMVMD.cjs} +15 -11
  35. package/dist/chunk-A77UMVMD.cjs.map +1 -0
  36. package/dist/{chunk-IO4RI5ZJ.cjs → chunk-BZK5QL3N.cjs} +4 -4
  37. package/dist/{chunk-IO4RI5ZJ.cjs.map → chunk-BZK5QL3N.cjs.map} +1 -1
  38. package/dist/{chunk-5HSMH2ZZ.js → chunk-CJN5CEI3.js} +4 -4
  39. package/dist/{chunk-5HSMH2ZZ.js.map → chunk-CJN5CEI3.js.map} +1 -1
  40. package/dist/{chunk-XRPMZ7TO.js → chunk-CYWOJA6B.js} +6 -4
  41. package/dist/chunk-CYWOJA6B.js.map +1 -0
  42. package/dist/{chunk-AQW54OWQ.js → chunk-DFBWYETS.js} +5 -3
  43. package/dist/chunk-DFBWYETS.js.map +1 -0
  44. package/dist/{chunk-EPANMGH7.cjs → chunk-FLDHYF5C.cjs} +11 -2
  45. package/dist/chunk-FLDHYF5C.cjs.map +1 -0
  46. package/dist/{chunk-BJ7BPLQK.js → chunk-GARVAUCU.js} +209 -29
  47. package/dist/chunk-GARVAUCU.js.map +1 -0
  48. package/dist/{chunk-YOVZMN4P.cjs → chunk-LXG6VL6R.cjs} +3 -3
  49. package/dist/{chunk-YOVZMN4P.cjs.map → chunk-LXG6VL6R.cjs.map} +1 -1
  50. package/dist/{chunk-NJBJ3CUG.js → chunk-NAVUTK6X.js} +3 -3
  51. package/dist/{chunk-NJBJ3CUG.js.map → chunk-NAVUTK6X.js.map} +1 -1
  52. package/dist/{chunk-2SFLLOMN.js → chunk-NVQSBRG6.js} +3 -3
  53. package/dist/{chunk-2SFLLOMN.js.map → chunk-NVQSBRG6.js.map} +1 -1
  54. package/dist/{chunk-FEAWEBWN.cjs → chunk-PDOXYXWX.cjs} +6 -4
  55. package/dist/chunk-PDOXYXWX.cjs.map +1 -0
  56. package/dist/{chunk-MS3TQSXU.js → chunk-QD6B6W6I.js} +6 -4
  57. package/dist/chunk-QD6B6W6I.js.map +1 -0
  58. package/dist/{chunk-NBNRQN6T.js → chunk-QGDPMM3C.js} +11 -2
  59. package/dist/chunk-QGDPMM3C.js.map +1 -0
  60. package/dist/{chunk-ZWLFHSON.cjs → chunk-R35ZJAYT.cjs} +38 -15
  61. package/dist/chunk-R35ZJAYT.cjs.map +1 -0
  62. package/dist/{chunk-4YD2WI57.cjs → chunk-R427EOZE.cjs} +19 -15
  63. package/dist/chunk-R427EOZE.cjs.map +1 -0
  64. package/dist/chunk-R5UQL2R5.cjs +18 -0
  65. package/dist/{chunk-LO6LIUZ6.cjs.map → chunk-R5UQL2R5.cjs.map} +1 -1
  66. package/dist/{chunk-TLVI2OQK.cjs → chunk-SETHRLQS.cjs} +18 -2
  67. package/dist/chunk-SETHRLQS.cjs.map +1 -0
  68. package/dist/{chunk-LSWHDOCL.cjs → chunk-SNVYOX46.cjs} +88 -72
  69. package/dist/chunk-SNVYOX46.cjs.map +1 -0
  70. package/dist/{chunk-BO3PV3OP.js → chunk-TDED5XES.js} +18 -3
  71. package/dist/chunk-TDED5XES.js.map +1 -0
  72. package/dist/{chunk-NKQVLWDF.js → chunk-ULEK4OM4.js} +3 -3
  73. package/dist/{chunk-NKQVLWDF.js.map → chunk-ULEK4OM4.js.map} +1 -1
  74. package/dist/{chunk-XJ4C4NFX.js → chunk-ZOL3L4EH.js} +63 -49
  75. package/dist/chunk-ZOL3L4EH.js.map +1 -0
  76. package/dist/{compact-session-NM56BREJ.cjs → compact-session-D2MQDB6G.cjs} +15 -15
  77. package/dist/{compact-session-NM56BREJ.cjs.map → compact-session-D2MQDB6G.cjs.map} +1 -1
  78. package/dist/{compact-session-3U2JYTVG.js → compact-session-N2PPHQO6.js} +6 -6
  79. package/dist/{compact-session-3U2JYTVG.js.map → compact-session-N2PPHQO6.js.map} +1 -1
  80. package/dist/{cron-CHn-F0fC.d.ts → cron-BubDpFJG.d.ts} +2 -2
  81. package/dist/{cron-BWDYetbq.d.cts → cron-CK2v0VWA.d.cts} +2 -2
  82. package/dist/cron.cjs +11 -11
  83. package/dist/cron.d.cts +3 -3
  84. package/dist/cron.d.ts +3 -3
  85. package/dist/cron.js +10 -10
  86. package/dist/eval.cjs +15 -15
  87. package/dist/eval.js +10 -10
  88. package/dist/{executor-HKHT4CWS.cjs → executor-5QL5AXIZ.cjs} +18 -15
  89. package/dist/executor-5QL5AXIZ.cjs.map +1 -0
  90. package/dist/{executor-3D2UDJHW.js → executor-THUXNAFR.js} +6 -3
  91. package/dist/executor-THUXNAFR.js.map +1 -0
  92. package/dist/generate-object-A5F576IT.cjs +20 -0
  93. package/dist/{generate-object-XBWD2PU7.cjs.map → generate-object-A5F576IT.cjs.map} +1 -1
  94. package/dist/{generate-object-S7MNVF2V.js → generate-object-TBDOBBYW.js} +4 -4
  95. package/dist/{generate-object-S7MNVF2V.js.map → generate-object-TBDOBBYW.js.map} +1 -1
  96. package/dist/generate-object.d.ts +14 -1
  97. package/dist/index.cjs +81 -65
  98. package/dist/index.cjs.map +1 -1
  99. package/dist/index.d.cts +36 -7
  100. package/dist/index.d.ts +36 -7
  101. package/dist/index.js +44 -28
  102. package/dist/index.js.map +1 -1
  103. package/dist/{inject-session-JVTZNQF6.cjs → inject-session-3ICZIJ2N.cjs} +4 -4
  104. package/dist/{inject-session-JVTZNQF6.cjs.map → inject-session-3ICZIJ2N.cjs.map} +1 -1
  105. package/dist/{inject-session-THABTKJY.js → inject-session-J26SHHIO.js} +3 -3
  106. package/dist/{inject-session-THABTKJY.js.map → inject-session-J26SHHIO.js.map} +1 -1
  107. package/dist/internal/agent-loop/prune-tool-results.d.ts +37 -0
  108. package/dist/internal/auth/credential-store.d.ts +1 -1
  109. package/dist/internal/auth/types.d.ts +4 -0
  110. package/dist/internal/providers/discovery.d.ts +2 -2
  111. package/dist/internal/providers/trust-gate.d.ts +35 -0
  112. package/dist/internal/runtime/plugin-loader/manifest-entry-import.d.ts +17 -0
  113. package/dist/internal/runtime/plugin-loader/workspace-plugin-trust.d.ts +16 -0
  114. package/dist/internal/runtime/skills/binary-on-path.d.ts +1 -0
  115. package/dist/internal/runtime/skills/discover-skills.d.ts +2 -0
  116. package/dist/internal/structured-output-helpers.d.ts +5 -2
  117. package/dist/mcp-auth.cjs +2 -2
  118. package/dist/mcp-auth.js +1 -1
  119. package/dist/models.cjs +11 -11
  120. package/dist/models.js +4 -4
  121. package/dist/providers.cjs +6 -6
  122. package/dist/providers.js +4 -4
  123. package/dist/sandbox/bwrap.d.cts +10 -8
  124. package/dist/sandbox/bwrap.d.ts +10 -8
  125. package/dist/sandbox/deny-read.d.cts +24 -0
  126. package/dist/sandbox/deny-read.d.ts +24 -0
  127. package/dist/sandbox/index.cjs +114 -35
  128. package/dist/sandbox/index.cjs.map +1 -1
  129. package/dist/sandbox/index.d.cts +2 -1
  130. package/dist/sandbox/index.d.ts +2 -1
  131. package/dist/sandbox/index.js +96 -21
  132. package/dist/sandbox/index.js.map +1 -1
  133. package/dist/sandbox/linux-sandbox.d.cts +16 -1
  134. package/dist/sandbox/linux-sandbox.d.ts +16 -1
  135. package/dist/sandbox/local-sandbox.d.cts +3 -1
  136. package/dist/sandbox/local-sandbox.d.ts +3 -1
  137. package/dist/sandbox/seccomp-delivery.d.cts +3 -0
  138. package/dist/sandbox/seccomp-delivery.d.ts +3 -0
  139. package/dist/sandbox/shell-escape.d.cts +14 -2
  140. package/dist/sandbox/shell-escape.d.ts +14 -2
  141. package/dist/sandbox/types.d.cts +45 -0
  142. package/dist/sandbox/types.d.ts +45 -0
  143. package/dist/{sdk-agent-4-dXI2GS.d.cts → sdk-agent-DwzHcuxy.d.cts} +28 -3
  144. package/dist/{sdk-agent-CTOJlWA_.d.ts → sdk-agent-a3fW1xUK.d.ts} +28 -3
  145. package/dist/skills.cjs +4 -4
  146. package/dist/skills.js +1 -1
  147. package/dist/stream-object-AS4YYM4B.cjs +20 -0
  148. package/dist/{stream-object-TEEK3CAX.cjs.map → stream-object-AS4YYM4B.cjs.map} +1 -1
  149. package/dist/stream-object-EKM4WGTI.js +7 -0
  150. package/dist/{stream-object-R6SMYV4R.js.map → stream-object-EKM4WGTI.js.map} +1 -1
  151. package/dist/stream-object.d.ts +14 -1
  152. package/dist/subagents-loader.d.cts +2 -2
  153. package/dist/subagents-loader.d.ts +2 -2
  154. package/dist/types/agent.d.ts +14 -1
  155. package/dist/types/run.d.ts +27 -2
  156. package/dist/workflow-as-tool.d.ts +39 -5
  157. package/dist/workflow-errors.d.ts +16 -0
  158. package/dist/workflow.cjs +31 -23
  159. package/dist/workflow.d.cts +55 -5
  160. package/dist/workflow.d.ts +55 -5
  161. package/dist/workflow.js +2 -2
  162. package/docs/adr/mutation-testing-scope.md +56 -0
  163. package/docs/error-codes.md +23 -18
  164. package/docs/harness-capability-map.md +78 -4
  165. package/package.json +1 -1
  166. package/dist/chunk-3FSBE4PS.js.map +0 -1
  167. package/dist/chunk-4YD2WI57.cjs.map +0 -1
  168. package/dist/chunk-5A4UFBHW.cjs.map +0 -1
  169. package/dist/chunk-7WARNHWW.cjs.map +0 -1
  170. package/dist/chunk-AQW54OWQ.js.map +0 -1
  171. package/dist/chunk-BJ7BPLQK.js.map +0 -1
  172. package/dist/chunk-BO3PV3OP.js.map +0 -1
  173. package/dist/chunk-EPANMGH7.cjs.map +0 -1
  174. package/dist/chunk-FEAWEBWN.cjs.map +0 -1
  175. package/dist/chunk-HN4IKB6X.cjs.map +0 -1
  176. package/dist/chunk-LO6LIUZ6.cjs +0 -18
  177. package/dist/chunk-LSWHDOCL.cjs.map +0 -1
  178. package/dist/chunk-MS3TQSXU.js.map +0 -1
  179. package/dist/chunk-NBNRQN6T.js.map +0 -1
  180. package/dist/chunk-NHOEXFZT.js.map +0 -1
  181. package/dist/chunk-Q6WT5535.cjs.map +0 -1
  182. package/dist/chunk-QISSETTG.cjs.map +0 -1
  183. package/dist/chunk-TLVI2OQK.cjs.map +0 -1
  184. package/dist/chunk-VVGFZQZC.js.map +0 -1
  185. package/dist/chunk-XJ4C4NFX.js.map +0 -1
  186. package/dist/chunk-XRPMZ7TO.js.map +0 -1
  187. package/dist/chunk-ZLFFDPXC.js.map +0 -1
  188. package/dist/chunk-ZWLFHSON.cjs.map +0 -1
  189. package/dist/executor-3D2UDJHW.js.map +0 -1
  190. package/dist/executor-HKHT4CWS.cjs.map +0 -1
  191. package/dist/generate-object-XBWD2PU7.cjs +0 -20
  192. package/dist/stream-object-R6SMYV4R.js +0 -7
  193. package/dist/stream-object-TEEK3CAX.cjs +0 -20
@@ -9,9 +9,9 @@ var chunkFRITRLZQ_cjs = require('./chunk-FRITRLZQ.cjs');
9
9
  var chunk3WKWBYPO_cjs = require('./chunk-3WKWBYPO.cjs');
10
10
  var chunkKX5QXLBS_cjs = require('./chunk-KX5QXLBS.cjs');
11
11
  var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
12
- var chunkS46WJTDL_cjs = require('./chunk-S46WJTDL.cjs');
12
+ var chunk4TEGFMSP_cjs = require('./chunk-4TEGFMSP.cjs');
13
13
  var chunkNVXXWAU7_cjs = require('./chunk-NVXXWAU7.cjs');
14
- var chunkQISSETTG_cjs = require('./chunk-QISSETTG.cjs');
14
+ var chunk5645PMVU_cjs = require('./chunk-5645PMVU.cjs');
15
15
  var chunkEHD25JBZ_cjs = require('./chunk-EHD25JBZ.cjs');
16
16
  var chunkCEGU5AVD_cjs = require('./chunk-CEGU5AVD.cjs');
17
17
  var chunkRNXXYF22_cjs = require('./chunk-RNXXYF22.cjs');
@@ -23,55 +23,62 @@ var url = require('url');
23
23
  var module$1 = require('module');
24
24
 
25
25
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
26
- var discoveryState = chunkNVXXWAU7_cjs.globalSingleton("theokit-sdk.providers.discovered", () => ({
27
- done: false
28
- }));
29
- function pluginsRoot() {
30
- return path.join(os.homedir(), ".theokit", "plugins", "model-providers");
31
- }
32
26
  function trustFilePath() {
33
27
  return path.join(os.homedir(), ".theokit", "plugins", "trusted-providers.json");
34
28
  }
35
- function loadTrustedNames() {
36
- const trusted = /* @__PURE__ */ new Set();
37
- const path = trustFilePath();
38
- if (fs.existsSync(path)) {
39
- try {
40
- const parsed = JSON.parse(fs.readFileSync(path, "utf-8"));
41
- if (Array.isArray(parsed)) {
42
- let discarded = 0;
43
- for (const name of parsed) {
44
- if (typeof name === "string" && name.length > 0) trusted.add(name);
45
- else discarded += 1;
46
- }
47
- if (discarded > 0) {
48
- chunkRNXXYF22_cjs.diag(
49
- `[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be plugin-name strings)
50
- `
51
- );
52
- }
53
- } else {
54
- chunkRNXXYF22_cjs.diag(
55
- `[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO provider plugins (fail-closed)
56
- `
57
- );
58
- }
59
- } catch {
60
- chunkRNXXYF22_cjs.diag(
61
- `[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO provider plugins (fail-closed)
62
- `
63
- );
64
- }
65
- }
29
+ function readTrustedNames() {
30
+ const trusted = new Set(readTrustArray(trustFilePath(), PROVIDER_TRUST));
66
31
  for (const name of (process.env.THEOKIT_TRUSTED_PROVIDERS ?? "").split(",")) {
67
32
  const trimmed = name.trim();
68
33
  if (trimmed.length > 0) trusted.add(trimmed);
69
34
  }
70
35
  return trusted;
71
36
  }
37
+ var PROVIDER_TRUST = {
38
+ subject: "provider plugins",
39
+ entries: "plugin-name strings"
40
+ };
41
+ function readTrustArray(path, shape) {
42
+ if (!fs.existsSync(path)) return [];
43
+ let parsed;
44
+ try {
45
+ parsed = JSON.parse(fs.readFileSync(path, "utf-8"));
46
+ } catch {
47
+ chunkRNXXYF22_cjs.diag(
48
+ `[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO ${shape.subject} (fail-closed)
49
+ `
50
+ );
51
+ return [];
52
+ }
53
+ if (!Array.isArray(parsed)) {
54
+ chunkRNXXYF22_cjs.diag(
55
+ `[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO ${shape.subject} (fail-closed)
56
+ `
57
+ );
58
+ return [];
59
+ }
60
+ const names = parsed.filter(
61
+ (name) => typeof name === "string" && name.length > 0
62
+ );
63
+ const discarded = parsed.length - names.length;
64
+ if (discarded > 0) {
65
+ chunkRNXXYF22_cjs.diag(
66
+ `[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be ${shape.entries})
67
+ `
68
+ );
69
+ }
70
+ return names;
71
+ }
72
+
73
+ // src/internal/providers/discovery.ts
74
+ var discoveryState = chunkNVXXWAU7_cjs.globalSingleton("theokit-sdk.providers.discovered", () => ({
75
+ loaded: /* @__PURE__ */ new Set(),
76
+ warned: /* @__PURE__ */ new Set()
77
+ }));
78
+ function pluginsRoot() {
79
+ return path.join(os.homedir(), ".theokit", "plugins", "model-providers");
80
+ }
72
81
  async function discoverProviderPlugins() {
73
- if (discoveryState.done) return;
74
- discoveryState.done = true;
75
82
  const root = pluginsRoot();
76
83
  if (!fs.existsSync(root)) return;
77
84
  let entries;
@@ -80,18 +87,25 @@ async function discoverProviderPlugins() {
80
87
  } catch {
81
88
  return;
82
89
  }
83
- const trusted = loadTrustedNames();
90
+ const trusted = readTrustedNames();
84
91
  for (const entry of entries) {
92
+ if (discoveryState.loaded.has(entry)) continue;
85
93
  if (!trusted.has(entry)) {
86
- chunkRNXXYF22_cjs.diag(
87
- `[theokit-sdk] WARN: provider plugin "${entry}" is present but NOT trusted \u2014 skipped. To trust it, add "${entry}" to ${trustFilePath()} (JSON array of names) or THEOKIT_TRUSTED_PROVIDERS (comma-separated), then restart the process.
88
- `
89
- );
94
+ warnUntrusted(entry);
90
95
  continue;
91
96
  }
97
+ discoveryState.loaded.add(entry);
92
98
  await loadOne(path.join(root, entry), entry);
93
99
  }
94
100
  }
101
+ function warnUntrusted(entry) {
102
+ if (discoveryState.warned.has(entry)) return;
103
+ discoveryState.warned.add(entry);
104
+ chunkRNXXYF22_cjs.diag(
105
+ `[theokit-sdk] WARN: provider plugin "${entry}" is present but NOT trusted \u2014 skipped. To trust it, add "${entry}" to ${trustFilePath()} (JSON array of names) or THEOKIT_TRUSTED_PROVIDERS (comma-separated).
106
+ `
107
+ );
108
+ }
95
109
  async function loadOne(dir, entryName) {
96
110
  for (const ext of ["index.mjs", "index.js"]) {
97
111
  const indexPath = path.join(dir, ext);
@@ -102,7 +116,7 @@ async function loadOne(dir, entryName) {
102
116
  if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
103
117
  const profile = plugin.profile;
104
118
  if (profile !== void 0 && typeof profile === "object") {
105
- chunkS46WJTDL_cjs.registerProvider(profile);
119
+ chunk4TEGFMSP_cjs.registerProvider(profile);
106
120
  }
107
121
  }
108
122
  return;
@@ -788,7 +802,7 @@ async function resolveBedrockToken(region) {
788
802
  return cachedToken.value;
789
803
  }
790
804
  try {
791
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LSWHDOCL.cjs', document.baseURI).href)));
805
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-SNVYOX46.cjs', document.baseURI).href)));
792
806
  const gen = r("@aws/bedrock-token-generator");
793
807
  if (typeof gen.getToken !== "function") return void 0;
794
808
  const providers = r("@aws-sdk/credential-providers");
@@ -822,10 +836,10 @@ var BedrockAnthropicClient = class {
822
836
  );
823
837
  }
824
838
  async *stream(request, signal) {
825
- const region = chunkS46WJTDL_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
839
+ const region = chunk4TEGFMSP_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
826
840
  const token = await this.resolveTokenOrThrow(region);
827
- const bareModel = chunkS46WJTDL_cjs.stripBedrockPrefix(request.model);
828
- const baseUrl = this.options.baseUrl ?? chunkS46WJTDL_cjs.resolveBedrockBaseUrl(request.model);
841
+ const bareModel = chunk4TEGFMSP_cjs.stripBedrockPrefix(request.model);
842
+ const baseUrl = this.options.baseUrl ?? chunk4TEGFMSP_cjs.resolveBedrockBaseUrl(request.model);
829
843
  const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
830
844
  const url = `${baseUrl}${endpoint}`;
831
845
  const response = await postAnthropicRequest({
@@ -2677,7 +2691,7 @@ async function resolveVertexAccessToken() {
2677
2691
  async function getAuthClientOrThrow() {
2678
2692
  let mod;
2679
2693
  try {
2680
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LSWHDOCL.cjs', document.baseURI).href)));
2694
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-SNVYOX46.cjs', document.baseURI).href)));
2681
2695
  mod = r("google-auth-library");
2682
2696
  } catch (err) {
2683
2697
  const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
@@ -2738,8 +2752,8 @@ var VertexAnthropicClient = class {
2738
2752
  const projectId = this.resolveProjectOrThrow();
2739
2753
  const location = this.options.location ?? resolveVertexLocation();
2740
2754
  const accessToken = await this.resolveTokenOrThrow();
2741
- const baseUrl = chunkS46WJTDL_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
2742
- const bareModel = chunkS46WJTDL_cjs.stripVertexPrefix(request.model);
2755
+ const baseUrl = chunk4TEGFMSP_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
2756
+ const bareModel = chunk4TEGFMSP_cjs.stripVertexPrefix(request.model);
2743
2757
  const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
2744
2758
  const url = `${baseUrl}${endpoint}`;
2745
2759
  const response = await postAnthropicRequest({
@@ -2788,7 +2802,7 @@ var VertexGeminiClient = class {
2788
2802
  { code: "auth_failed" }
2789
2803
  );
2790
2804
  }
2791
- const baseUrl = chunkS46WJTDL_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
2805
+ const baseUrl = chunk4TEGFMSP_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
2792
2806
  const url = `${baseUrl}/chat/completions`;
2793
2807
  const innerFetch = chunkEHD25JBZ_cjs.boundFetch(this.options.fetch);
2794
2808
  const rewriteFetch = (_input, init) => innerFetch(url, init);
@@ -2810,7 +2824,7 @@ var VertexRouterClient = class {
2810
2824
  options;
2811
2825
  name = "vertex";
2812
2826
  async *stream(request, signal) {
2813
- const dialect = chunkS46WJTDL_cjs.inferModelDialect(request.model);
2827
+ const dialect = chunk4TEGFMSP_cjs.inferModelDialect(request.model);
2814
2828
  if (dialect === "anthropic") {
2815
2829
  const inner2 = new VertexAnthropicClient(this.options);
2816
2830
  return yield* inner2.stream(request, signal);
@@ -2822,7 +2836,7 @@ var VertexRouterClient = class {
2822
2836
 
2823
2837
  // src/internal/llm/router.ts
2824
2838
  function resolveProviderChain(options) {
2825
- chunkS46WJTDL_cjs.registerBuiltins();
2839
+ chunk4TEGFMSP_cjs.registerBuiltins();
2826
2840
  return buildChain(options);
2827
2841
  }
2828
2842
  function buildChain(options) {
@@ -2839,7 +2853,7 @@ function buildChain(options) {
2839
2853
  addClient(options.primary, options.baseUrl);
2840
2854
  for (const fallback of options.fallback ?? []) addClient(fallback);
2841
2855
  if (clients.length === 0) {
2842
- if (chunkS46WJTDL_cjs.getProviderProfile(normalizeProviderName(options.primary)) === void 0) {
2856
+ if (chunk4TEGFMSP_cjs.getProviderProfile(normalizeProviderName(options.primary)) === void 0) {
2843
2857
  throw new chunkCEGU5AVD_cjs.ConfigurationError(unregisteredProviderMessage(options.primary), {
2844
2858
  code: "provider_unresolved"
2845
2859
  });
@@ -2856,7 +2870,7 @@ function normalizeProviderName(name) {
2856
2870
  }
2857
2871
  function unregisteredProviderMessage(name) {
2858
2872
  const normalized = normalizeProviderName(name);
2859
- const caseOnlyMatch = chunkS46WJTDL_cjs.listProviders().find(
2873
+ const caseOnlyMatch = chunk4TEGFMSP_cjs.listProviders().find(
2860
2874
  (profile) => normalizeProviderName(profile.name) === normalized
2861
2875
  );
2862
2876
  if (caseOnlyMatch !== void 0) {
@@ -2864,11 +2878,11 @@ function unregisteredProviderMessage(name) {
2864
2878
  }
2865
2879
  const aliasMessage = caseOnlyAliasMessage(name, normalized);
2866
2880
  if (aliasMessage !== void 0) return aliasMessage;
2867
- const registered = chunkS46WJTDL_cjs.listProviders().map((profile) => profile.name).sort((a, b) => a.localeCompare(b)).join(", ");
2881
+ const registered = chunk4TEGFMSP_cjs.listProviders().map((profile) => profile.name).sort((a, b) => a.localeCompare(b)).join(", ");
2868
2882
  return `No provider client could be resolved: "${name}" is not a known provider. Registered providers: ${registered}.`;
2869
2883
  }
2870
2884
  function caseOnlyAliasMessage(name, normalized) {
2871
- for (const profile of chunkS46WJTDL_cjs.listProviders()) {
2885
+ for (const profile of chunk4TEGFMSP_cjs.listProviders()) {
2872
2886
  const alias = profile.aliases?.find((entry) => normalizeProviderName(entry) === normalized);
2873
2887
  if (alias === void 0) continue;
2874
2888
  return `No provider client could be resolved: "${name}" matches the alias "${alias}" of the registered provider "${profile.name}" only when case is ignored, and routes look provider names up in lowercase. Register the alias as "${normalized}", or route to "${profile.name}".`;
@@ -2876,7 +2890,7 @@ function caseOnlyAliasMessage(name, normalized) {
2876
2890
  return void 0;
2877
2891
  }
2878
2892
  function buildTransport(name, routerOptions, perCallBaseUrl) {
2879
- const baseProfile = chunkS46WJTDL_cjs.getProviderProfile(name);
2893
+ const baseProfile = chunk4TEGFMSP_cjs.getProviderProfile(name);
2880
2894
  if (baseProfile === void 0) return void 0;
2881
2895
  const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
2882
2896
  const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
@@ -2971,7 +2985,7 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
2971
2985
  if (apiKeys === void 0) return;
2972
2986
  for (const name of Object.keys(apiKeys)) {
2973
2987
  if (warnedProviders.has(name)) continue;
2974
- const profile = chunkS46WJTDL_cjs.getProviderProfile(name);
2988
+ const profile = chunk4TEGFMSP_cjs.getProviderProfile(name);
2975
2989
  if (profile === void 0) {
2976
2990
  warnedProviders.add(name);
2977
2991
  chunkRNXXYF22_cjs.diag(
@@ -3146,7 +3160,7 @@ function checkProviderPrefix(key, provider) {
3146
3160
  function registerPluginProviderProfiles(entries) {
3147
3161
  let registered = 0;
3148
3162
  for (const entry of entries) {
3149
- chunkS46WJTDL_cjs.registerProvider(entry.profile);
3163
+ chunk4TEGFMSP_cjs.registerProvider(entry.profile);
3150
3164
  registered += 1;
3151
3165
  }
3152
3166
  return registered;
@@ -3170,7 +3184,7 @@ var AMBIENT_STORE = {
3170
3184
  };
3171
3185
  function isStoredOAuthAvailable(env = process.env) {
3172
3186
  try {
3173
- return chunkQISSETTG_cjs.readStoredOAuth(AMBIENT_STORE, env) !== void 0;
3187
+ return chunk5645PMVU_cjs.readStoredOAuth(AMBIENT_STORE, env) !== void 0;
3174
3188
  } catch {
3175
3189
  return false;
3176
3190
  }
@@ -3230,7 +3244,7 @@ function shouldUseRealLocalRuntime(apiKey) {
3230
3244
  function inferProviderFromApiKey(apiKey) {
3231
3245
  const provider = chunkFRITRLZQ_cjs.providerFromApiKeyPrefix(apiKey);
3232
3246
  if (provider === void 0) return void 0;
3233
- return chunkS46WJTDL_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
3247
+ return chunk4TEGFMSP_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
3234
3248
  }
3235
3249
  function detectPrimaryProvider() {
3236
3250
  if (process.env.ANTHROPIC_API_KEY !== void 0 && process.env.ANTHROPIC_API_KEY.length > 0) {
@@ -3257,7 +3271,7 @@ function warnProviderPrecedenceOnce(asked, used) {
3257
3271
  }
3258
3272
  var pluginProvidersAnnounced = false;
3259
3273
  function resolveRunProvider(options) {
3260
- chunkS46WJTDL_cjs.registerBuiltins();
3274
+ chunk4TEGFMSP_cjs.registerBuiltins();
3261
3275
  const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
3262
3276
  const registered = registerPluginProviderProfiles(profiles);
3263
3277
  if (registered > 0 && !pluginProvidersAnnounced) {
@@ -3267,7 +3281,7 @@ function resolveRunProvider(options) {
3267
3281
  `);
3268
3282
  }
3269
3283
  const parsedModel = chunk3EE6LVWT_cjs.parseModelId(options.model?.id);
3270
- const modelInferredProvider = parsedModel.provider !== void 0 && chunkS46WJTDL_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
3284
+ const modelInferredProvider = parsedModel.provider !== void 0 && chunk4TEGFMSP_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
3271
3285
  const keyInferredProvider = inferProviderFromApiKey(options.agentOptions.apiKey);
3272
3286
  const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? detectPrimaryProvider();
3273
3287
  warnProviderPrecedenceOnce(modelInferredProvider, primary);
@@ -3407,9 +3421,9 @@ function resolveSummarizerRoute(opts) {
3407
3421
  }
3408
3422
  function buildDefaultSummarizer(opts) {
3409
3423
  return async (messages) => {
3410
- chunkS46WJTDL_cjs.registerBuiltins();
3424
+ chunk4TEGFMSP_cjs.registerBuiltins();
3411
3425
  const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
3412
- const prefixProfile = modelPrefix !== void 0 ? chunkS46WJTDL_cjs.getProviderProfile(modelPrefix) : void 0;
3426
+ const prefixProfile = modelPrefix !== void 0 ? chunk4TEGFMSP_cjs.getProviderProfile(modelPrefix) : void 0;
3413
3427
  const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
3414
3428
  const route = resolveSummarizerRoute({
3415
3429
  keyProvider: inferProviderFromApiKey(opts.apiKey),
@@ -3505,6 +3519,7 @@ exports.normalizeUsage = normalizeUsage;
3505
3519
  exports.parseSseStream = parseSseStream;
3506
3520
  exports.presentProviderCredentialEnvVars = presentProviderCredentialEnvVars;
3507
3521
  exports.readErrorResponseBody = readErrorResponseBody;
3522
+ exports.readTrustArray = readTrustArray;
3508
3523
  exports.relayStream = relayStream;
3509
3524
  exports.renderToolResultContentText = renderToolResultContentText;
3510
3525
  exports.resolveProviderChain = resolveProviderChain;
@@ -3513,7 +3528,8 @@ exports.resolveSummarizerRoute = resolveSummarizerRoute;
3513
3528
  exports.shouldAutoCompact = shouldAutoCompact;
3514
3529
  exports.shouldUseFixtureMode = shouldUseFixtureMode;
3515
3530
  exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
3531
+ exports.trustFilePath = trustFilePath;
3516
3532
  exports.tryFirstEvent = tryFirstEvent;
3517
3533
  exports.validateApiKeyShape = validateApiKeyShape;
3518
- //# sourceMappingURL=chunk-LSWHDOCL.cjs.map
3519
- //# sourceMappingURL=chunk-LSWHDOCL.cjs.map
3534
+ //# sourceMappingURL=chunk-SNVYOX46.cjs.map
3535
+ //# sourceMappingURL=chunk-SNVYOX46.cjs.map