theokit 0.47.0 → 0.48.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 (79) hide show
  1. package/dist/{actions-virtual-module-PUYSUA5O.js → actions-virtual-module-2VVLVXHY.js} +3 -3
  2. package/dist/{actions-virtual-module-Z76RNOJC.js → actions-virtual-module-Z5LXAX7E.js} +5 -4
  3. package/dist/actions-virtual-module-Z5LXAX7E.js.map +1 -0
  4. package/dist/{agent-3VDG5XK5.js → agent-Y3JKRROD.js} +2 -2
  5. package/dist/{app-typed-client-QYMZWXAW.js → app-typed-client-N4I4RBLT.js} +3 -3
  6. package/dist/{app-typed-client-VLT4FBKE.js → app-typed-client-NI3CM2FA.js} +5 -4
  7. package/dist/app-typed-client-NI3CM2FA.js.map +1 -0
  8. package/dist/boot/index.js +1 -1
  9. package/dist/{build-6KKFX33J.js → build-SJQDRD2B.js} +2 -2
  10. package/dist/chunk-6E5WKMDS.js +67 -0
  11. package/dist/chunk-6E5WKMDS.js.map +1 -0
  12. package/dist/{chunk-FZG3JYB3.js → chunk-7ZOQN7UH.js} +1 -1
  13. package/dist/{chunk-U3H53IIN.js → chunk-FO55VGMQ.js} +3 -3
  14. package/dist/{chunk-ELDTTO6P.js → chunk-GEHX6CAE.js} +2 -2
  15. package/dist/{chunk-7SABX4DJ.js → chunk-IZ3TIL6K.js} +28 -2
  16. package/dist/{chunk-7SABX4DJ.js.map → chunk-IZ3TIL6K.js.map} +1 -1
  17. package/dist/{chunk-B7XHGEDH.js → chunk-O5W7XSUX.js} +36 -36
  18. package/dist/chunk-O5W7XSUX.js.map +1 -0
  19. package/dist/{chunk-EIRQM55C.js → chunk-OJLL4YD6.js} +5 -46
  20. package/dist/chunk-OJLL4YD6.js.map +1 -0
  21. package/dist/{chunk-XTM32FF6.js → chunk-VQIUTCK2.js} +28 -2
  22. package/dist/{chunk-XTM32FF6.js.map → chunk-VQIUTCK2.js.map} +1 -1
  23. package/dist/{chunk-VPV7WABO.js → chunk-VTJMND23.js} +2 -2
  24. package/dist/{chunk-37ZO643S.js → chunk-XALU5LCU.js} +3 -3
  25. package/dist/{chunk-SEELKQUM.js → chunk-Y2KHTD2W.js} +6 -2
  26. package/dist/chunk-Y2KHTD2W.js.map +1 -0
  27. package/dist/{chunk-4TLLWXWH.js → chunk-YRRWQDKK.js} +11 -9
  28. package/dist/chunk-YRRWQDKK.js.map +1 -0
  29. package/dist/{chunk-OGU2MIHC.js → chunk-ZALJIZH2.js} +6 -6
  30. package/dist/cli/index.js +27 -5
  31. package/dist/cli/index.js.map +1 -1
  32. package/dist/{dev-4NLBCCLU.js → dev-6TWDBX6G.js} +5 -5
  33. package/dist/doctor-Y53QTUSP.js +56 -0
  34. package/dist/doctor-Y53QTUSP.js.map +1 -0
  35. package/dist/index.js +6 -5
  36. package/dist/index.js.map +1 -1
  37. package/dist/{internal-api-C5UJG3E2.js → internal-api-REGN3WMX.js} +8 -6
  38. package/dist/{internal-api-XAQ7H73N.js → internal-api-XQA2L663.js} +3 -3
  39. package/dist/{mcp-TJIUDFY2.js → mcp-CO4AGAXV.js} +2 -2
  40. package/dist/server/agent/index.d.ts +90 -1
  41. package/dist/server/agent/index.js +14 -2
  42. package/dist/server/cost/index.d.ts +1 -0
  43. package/dist/server/cost/index.js +3 -1
  44. package/dist/server/http/index.js +2 -2
  45. package/dist/server/index.d.ts +496 -3
  46. package/dist/server/index.js +486 -7
  47. package/dist/server/index.js.map +1 -1
  48. package/dist/{server-error-to-envelope-UM7DEVM4.js → server-error-to-envelope-2MQOME5Q.js} +2 -2
  49. package/dist/{server-error-to-envelope-J5NFZGCQ.js → server-error-to-envelope-4TGCDQ2S.js} +2 -2
  50. package/dist/sessions-gc-H4WC4IXB.js +38 -0
  51. package/dist/sessions-gc-H4WC4IXB.js.map +1 -0
  52. package/dist/{start-XPQ4EJ6J.js → start-IO3ZYGEX.js} +4 -4
  53. package/dist/vite-plugin/index.js +6 -5
  54. package/dist/{vite-plugin-CD67YAD5.js → vite-plugin-NQ6F7FGV.js} +5 -5
  55. package/package.json +5 -5
  56. package/dist/actions-virtual-module-Z76RNOJC.js.map +0 -1
  57. package/dist/app-typed-client-VLT4FBKE.js.map +0 -1
  58. package/dist/chunk-4TLLWXWH.js.map +0 -1
  59. package/dist/chunk-B7XHGEDH.js.map +0 -1
  60. package/dist/chunk-EIRQM55C.js.map +0 -1
  61. package/dist/chunk-SEELKQUM.js.map +0 -1
  62. /package/dist/{actions-virtual-module-PUYSUA5O.js.map → actions-virtual-module-2VVLVXHY.js.map} +0 -0
  63. /package/dist/{agent-3VDG5XK5.js.map → agent-Y3JKRROD.js.map} +0 -0
  64. /package/dist/{app-typed-client-QYMZWXAW.js.map → app-typed-client-N4I4RBLT.js.map} +0 -0
  65. /package/dist/{build-6KKFX33J.js.map → build-SJQDRD2B.js.map} +0 -0
  66. /package/dist/{chunk-FZG3JYB3.js.map → chunk-7ZOQN7UH.js.map} +0 -0
  67. /package/dist/{chunk-U3H53IIN.js.map → chunk-FO55VGMQ.js.map} +0 -0
  68. /package/dist/{chunk-ELDTTO6P.js.map → chunk-GEHX6CAE.js.map} +0 -0
  69. /package/dist/{chunk-VPV7WABO.js.map → chunk-VTJMND23.js.map} +0 -0
  70. /package/dist/{chunk-37ZO643S.js.map → chunk-XALU5LCU.js.map} +0 -0
  71. /package/dist/{chunk-OGU2MIHC.js.map → chunk-ZALJIZH2.js.map} +0 -0
  72. /package/dist/{dev-4NLBCCLU.js.map → dev-6TWDBX6G.js.map} +0 -0
  73. /package/dist/{internal-api-C5UJG3E2.js.map → internal-api-REGN3WMX.js.map} +0 -0
  74. /package/dist/{internal-api-XAQ7H73N.js.map → internal-api-XQA2L663.js.map} +0 -0
  75. /package/dist/{mcp-TJIUDFY2.js.map → mcp-CO4AGAXV.js.map} +0 -0
  76. /package/dist/{server-error-to-envelope-UM7DEVM4.js.map → server-error-to-envelope-2MQOME5Q.js.map} +0 -0
  77. /package/dist/{server-error-to-envelope-J5NFZGCQ.js.map → server-error-to-envelope-4TGCDQ2S.js.map} +0 -0
  78. /package/dist/{start-XPQ4EJ6J.js.map → start-IO3ZYGEX.js.map} +0 -0
  79. /package/dist/{vite-plugin-CD67YAD5.js.map → vite-plugin-NQ6F7FGV.js.map} +0 -0
@@ -8,8 +8,8 @@ import {
8
8
  } from "./chunk-GEQJAFSV.js";
9
9
  import {
10
10
  theoPluginAsync
11
- } from "./chunk-OGU2MIHC.js";
12
- import "./chunk-ELDTTO6P.js";
11
+ } from "./chunk-ZALJIZH2.js";
12
+ import "./chunk-GEHX6CAE.js";
13
13
  import "./chunk-2CVV6CNN.js";
14
14
  import "./chunk-IEES3CHD.js";
15
15
  import {
@@ -24,14 +24,14 @@ import {
24
24
  } from "./chunk-CUYEA62B.js";
25
25
  import "./chunk-5ODOE6EF.js";
26
26
  import "./chunk-HRCNHWLP.js";
27
- import "./chunk-VPV7WABO.js";
27
+ import "./chunk-VTJMND23.js";
28
28
  import "./chunk-6GGWS7J3.js";
29
29
  import "./chunk-FXZZS7YW.js";
30
30
  import "./chunk-D3425YDV.js";
31
31
  import "./chunk-LNVMHQ2Z.js";
32
32
  import "./chunk-MNIQ5F3Y.js";
33
33
  import "./chunk-A7JBF5FO.js";
34
- import "./chunk-XTM32FF6.js";
34
+ import "./chunk-VQIUTCK2.js";
35
35
 
36
36
  // src/cli/commands/dev.ts
37
37
  import react from "@vitejs/plugin-react";
@@ -112,4 +112,4 @@ export {
112
112
  devCommand,
113
113
  startDevServer
114
114
  };
115
- //# sourceMappingURL=dev-4NLBCCLU.js.map
115
+ //# sourceMappingURL=dev-6TWDBX6G.js.map
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ import "tsx/esm";
3
+
4
+ // src/cli/commands/doctor.ts
5
+ import { diagnose, renderDiagnosis, secretPresence } from "@theokit/agents/doctor";
6
+ function credentialCheck(env) {
7
+ const candidates = ["OPENROUTER_API_KEY", "OPENAI_API_KEY", "ANTHROPIC_API_KEY"];
8
+ const found = candidates.find((name) => secretPresence(env[name]) === "present");
9
+ return found === void 0 ? {
10
+ name: "credential",
11
+ status: "fail",
12
+ detail: "absent \u2014 set one of OPENROUTER_API_KEY, OPENAI_API_KEY or ANTHROPIC_API_KEY, or run `theokit auth login`"
13
+ } : { name: "credential", status: "ok", detail: `${found}: ${secretPresence(env[found])}` };
14
+ }
15
+ async function mcpCheck(projectRoot) {
16
+ const { readFile } = await import("fs/promises");
17
+ const { join } = await import("path");
18
+ try {
19
+ const raw = await readFile(join(projectRoot, ".mcp.json"), "utf8");
20
+ const parsed = JSON.parse(raw);
21
+ const count = Object.keys(parsed.mcpServers ?? {}).length;
22
+ return { name: "mcp", status: "ok", detail: `${String(count)} server(s) configured` };
23
+ } catch (error) {
24
+ return error.code === "ENOENT" ? { name: "mcp", status: "warn", detail: "no .mcp.json \u2014 no MCP servers will start" } : {
25
+ name: "mcp",
26
+ status: "fail",
27
+ detail: `.mcp.json is unreadable: ${error.message}`
28
+ };
29
+ }
30
+ }
31
+ async function subagentCheck(projectRoot) {
32
+ const { listSubagentNames } = await import("@theokit/agents");
33
+ const names = await listSubagentNames(projectRoot);
34
+ return names.length === 0 ? { name: "subagents", status: "warn", detail: "none defined in .theokit/agents/" } : { name: "subagents", status: "ok", detail: names.join(", ") };
35
+ }
36
+ async function doctorCommand(deps = {}) {
37
+ const projectRoot = deps.projectRoot ?? process.cwd();
38
+ const env = deps.env ?? process.env;
39
+ const write = deps.write ?? ((text) => {
40
+ process.stdout.write(`${text}
41
+ `);
42
+ });
43
+ const checks = [
44
+ credentialCheck(env),
45
+ await mcpCheck(projectRoot),
46
+ await subagentCheck(projectRoot),
47
+ ...deps.extraChecks ?? []
48
+ ];
49
+ const diagnosis = diagnose(checks);
50
+ write(renderDiagnosis(diagnosis));
51
+ return diagnosis.exitCode;
52
+ }
53
+ export {
54
+ doctorCommand
55
+ };
56
+ //# sourceMappingURL=doctor-Y53QTUSP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/commands/doctor.ts"],"sourcesContent":["import { diagnose, renderDiagnosis, secretPresence, type Check } from '@theokit/agents/doctor'\n\n/**\n * M84 — `theokit doctor`: what will this installation actually DO?\n *\n * `theokit info` answers \"does my project parse?\". That is not the question an agent product has.\n * The question is which credential will be used, which MCP servers will start, which skills exist —\n * the RESOLVED state, not the declared one.\n *\n * ## Never prints a secret\n *\n * Enforced by `secretPresence` from the primitive: present / absent / unreadable, never a value, a\n * prefix, a truncation or a length. A doctor that printed secrets would be the one command built for\n * support that you must not paste into a support request.\n *\n * ## The list lives here, the mechanism does not\n *\n * `diagnose` / `renderDiagnosis` / `Check` come from `@theokit/agents/doctor`, because every product\n * re-derives them identically. WHICH checks to run is what differs per product — so this file holds\n * the framework's own list, and a product composes its own on top.\n */\n\n/**\n * The injection surface of {@link doctorCommand}.\n *\n * Exported because a product composing its own checks on top needs to name this shape — and because\n * Knip caught it exported from the module and reachable from nothing, which is the same\n * published-but-unreachable failure M67, M73 and M79 each closed one instance of.\n */\nexport interface DoctorDeps {\n readonly projectRoot?: string\n readonly env?: Readonly<Record<string, string | undefined>>\n /** Where the report goes. Injected so the suite never writes to the real stdout. */\n readonly write?: (text: string) => void\n /** Extra checks a product contributes. Appended after the framework's own. */\n readonly extraChecks?: readonly Check[]\n}\n\n/** The credential the run will use, reported WITHOUT its value. */\nfunction credentialCheck(env: Readonly<Record<string, string | undefined>>): Check {\n const candidates = ['OPENROUTER_API_KEY', 'OPENAI_API_KEY', 'ANTHROPIC_API_KEY'] as const\n const found = candidates.find((name) => secretPresence(env[name]) === 'present')\n return found === undefined\n ? {\n name: 'credential',\n status: 'fail',\n detail:\n 'absent — set one of OPENROUTER_API_KEY, OPENAI_API_KEY or ANTHROPIC_API_KEY, or run `theokit auth login`',\n }\n : { name: 'credential', status: 'ok', detail: `${found}: ${secretPresence(env[found])}` }\n}\n\n/** Whether an `.mcp.json` is present, and whether it parses. */\nasync function mcpCheck(projectRoot: string): Promise<Check> {\n const { readFile } = await import('node:fs/promises')\n const { join } = await import('node:path')\n try {\n const raw = await readFile(join(projectRoot, '.mcp.json'), 'utf8')\n const parsed: unknown = JSON.parse(raw)\n const count = Object.keys((parsed as { mcpServers?: object }).mcpServers ?? {}).length\n return { name: 'mcp', status: 'ok', detail: `${String(count)} server(s) configured` }\n } catch (error) {\n // An absent file is the common case and NOT a failure — most projects use no MCP server. A file\n // that exists and does not parse IS a failure, because the operator believes it is in effect.\n return (error as NodeJS.ErrnoException).code === 'ENOENT'\n ? { name: 'mcp', status: 'warn', detail: 'no .mcp.json — no MCP servers will start' }\n : {\n name: 'mcp',\n status: 'fail',\n detail: `.mcp.json is unreadable: ${(error as Error).message}`,\n }\n }\n}\n\n/** Whether `.theokit/agents/*.md` defines any subagent. */\nasync function subagentCheck(projectRoot: string): Promise<Check> {\n const { listSubagentNames } = await import('@theokit/agents')\n const names = await listSubagentNames(projectRoot)\n return names.length === 0\n ? { name: 'subagents', status: 'warn', detail: 'none defined in .theokit/agents/' }\n : { name: 'subagents', status: 'ok', detail: names.join(', ') }\n}\n\n/**\n * Run the framework's checks and report.\n *\n * Returns the exit code rather than calling `process.exit`: a command that exits cannot be tested,\n * and a doctor nobody ran is the one thing worse than no doctor.\n */\nexport async function doctorCommand(deps: DoctorDeps = {}): Promise<number> {\n const projectRoot = deps.projectRoot ?? process.cwd()\n const env = deps.env ?? process.env\n const write =\n deps.write ??\n ((text: string) => {\n process.stdout.write(`${text}\\n`)\n })\n\n const checks: Check[] = [\n credentialCheck(env),\n await mcpCheck(projectRoot),\n await subagentCheck(projectRoot),\n ...(deps.extraChecks ?? []),\n ]\n\n const diagnosis = diagnose(checks)\n write(renderDiagnosis(diagnosis))\n return diagnosis.exitCode\n}\n"],"mappings":";;;;AAAA,SAAS,UAAU,iBAAiB,sBAAkC;AAuCtE,SAAS,gBAAgB,KAA0D;AACjF,QAAM,aAAa,CAAC,sBAAsB,kBAAkB,mBAAmB;AAC/E,QAAM,QAAQ,WAAW,KAAK,CAAC,S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ACJ,KAAK,UACJ,CAAC,SAAiB;AACjB,YAAQ,OAAO,MAAM,GAAG,IAAI;AAAA,CAAI;AAAA,EAClC;AAEF,QAAM,SAAkB;AAAA,IACtB,gBAAgB,GAAG;AAAA,IACnB,MAAM,SAAS,WAAW;AAAA,IAC1B,MAAM,cAAc,WAAW;AAAA,IAC/B,GAAI,KAAK,eAAe,CAAC;AAAA,EAC3B;AAEA,QAAM,YAAY,SAAS,MAAM;AACjC,QAAM,gBAAgB,SAAS,CAAC;AAChC,SAAO,UAAU;AACnB;","names":[]}
package/dist/index.js CHANGED
@@ -8,12 +8,12 @@ import {
8
8
  scanRoutes,
9
9
  theoConfigSchema,
10
10
  theoPlugin
11
- } from "./chunk-4TLLWXWH.js";
11
+ } from "./chunk-YRRWQDKK.js";
12
12
  import "./chunk-SSYDEKWF.js";
13
13
  import "./chunk-OIGJOYX6.js";
14
- import "./chunk-EIRQM55C.js";
15
- import "./chunk-U3H53IIN.js";
16
- import "./chunk-37ZO643S.js";
14
+ import "./chunk-OJLL4YD6.js";
15
+ import "./chunk-FO55VGMQ.js";
16
+ import "./chunk-XALU5LCU.js";
17
17
  import "./chunk-47FFT43U.js";
18
18
  import "./chunk-NTDN54XO.js";
19
19
  import "./chunk-KD5G3YXI.js";
@@ -27,8 +27,9 @@ import "./chunk-MTEWLGVY.js";
27
27
  import "./chunk-OLGPYOLO.js";
28
28
  import "./chunk-AVQU5CQF.js";
29
29
  import "./chunk-ACKBVBUI.js";
30
- import "./chunk-7SABX4DJ.js";
30
+ import "./chunk-IZ3TIL6K.js";
31
31
  import "./chunk-YOIVCCZT.js";
32
+ import "./chunk-6E5WKMDS.js";
32
33
  import "./chunk-JA2ZAT5Q.js";
33
34
  import "./chunk-52PDWL5S.js";
34
35
  import "./chunk-U267AOWS.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config/define-config.ts","../src/config/config-builder.ts","../src/config/validate-structure.ts","../src/core/errors.ts"],"mappings":";;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;AACF;;;ADHA,IAAM,iBAAmC;AAAA,EACvC;AAAA,IACE,MAAM;AAAA,IACN,cAAc;AAAA,EAChB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,cAAc;AAAA,EAChB;AACF;AAIO,SAAS,yBAAyB,SAAiB,SAAS,OAAa;AAC9E,MAAI,CAAC,WAAW,OAAO,GAAG;AACxB,UAAM,IAAI,iBAAiB,CAAC,qCAAqC,OAAO,EAAE,GAAG,OAAO;AAAA,EACtF;AAEA,QAAM,SAAmB,CAAC;AAE1B,QAAM,eAAiC;AAAA,IACrC,EAAE,MAAM,QAAQ,cAAc,+BAA+B,MAAM,IAAI;AAAA,EACzE;AAEA,aAAW,QAAQ,cAAc;AAC/B,QAAI,CAAC,WAAW,KAAK,SAAS,KAAK,IAAI,CAAC,GAAG;AACzC,aAAO,KAAK,KAAK,YAAY;AAAA,IAC/B;AAAA,EACF;AAEA,aAAW,QAAQ,gBAAgB;AACjC,QAAI,CAAC,WAAW,KAAK,SAAS,KAAK,IAAI,CAAC,GAAG;AACzC,aAAO,KAAK,KAAK,YAAY;AAAA,IAC/B;AAAA,EACF;AAEA,MAAI,OAAO,SAAS,GAAG;AACrB,UAAM,IAAI,iBAAiB,QAAQ,OAAO;AAAA,EAC5C;AACF;","names":["config"]}
1
+ {"version":3,"sources":["../src/config/define-config.ts","../src/config/config-builder.ts","../src/config/validate-structure.ts","../src/core/errors.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,SAAS,aAAaA,SAAkD;AAC7E,SAAOA;AACT;;;ACiCA,SAAS,kBAAkB,MAA0C;AACnE,QAAM,QAAQ,CAAC,UACb,kBAAkB,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC;AACzC,SAAO;AAAA,IACL,MAAM,CAAC,UAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,IACtC,WAAW,CAAC,UAAU,MAAM,EAAE,WAAW,MAAM,CAAC;AAAA,IAChD,QAAQ,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iC;AAAA,IACrC,EAAE,MAAM,QAAQ,cAAc,+BAA+B,MAAM,IAAI;AAAA,EACzE;AAEA,aAAW,QAAQ,cAAc;AAC/B,QAAI,CAAC,WAAW,KAAK,SAAS,KAAK,IAAI,CAAC,GAAG;AACzC,aAAO,KAAK,KAAK,YAAY;AAAA,IAC/B;AAAA,EACF;AAEA,aAAW,QAAQ,gBAAgB;AACjC,QAAI,CAAC,WAAW,KAAK,SAAS,KAAK,IAAI,CAAC,GAAG;AACzC,aAAO,KAAK,KAAK,YAAY;AAAA,IAC/B;AAAA,EACF;AAEA,MAAI,OAAO,SAAS,GAAG;AACrB,UAAM,IAAI,iBAAiB,QAAQ,OAAO;AAAA,EAC5C;AACF;","names":["config"]}
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  dispatchControllerRequest,
3
- mountAgent,
4
- resolveProvider
5
- } from "./chunk-EIRQM55C.js";
3
+ mountAgent
4
+ } from "./chunk-OJLL4YD6.js";
6
5
  import {
7
6
  BATCH_PATH,
8
7
  TRACE_HEADER,
@@ -13,7 +12,7 @@ import {
13
12
  handleBatchRequest,
14
13
  incomingMessageToHandlerRequest,
15
14
  sendError
16
- } from "./chunk-37ZO643S.js";
15
+ } from "./chunk-XALU5LCU.js";
17
16
  import "./chunk-47FFT43U.js";
18
17
  import {
19
18
  findSuggestion
@@ -51,7 +50,10 @@ import {
51
50
  import "./chunk-OLGPYOLO.js";
52
51
  import "./chunk-AVQU5CQF.js";
53
52
  import "./chunk-ACKBVBUI.js";
54
- import "./chunk-7SABX4DJ.js";
53
+ import "./chunk-IZ3TIL6K.js";
54
+ import {
55
+ resolveProvider
56
+ } from "./chunk-6E5WKMDS.js";
55
57
  import {
56
58
  generateNonce
57
59
  } from "./chunk-JA2ZAT5Q.js";
@@ -89,4 +91,4 @@ export {
89
91
  scanWebSocketRoutes,
90
92
  sendError
91
93
  };
92
- //# sourceMappingURL=internal-api-C5UJG3E2.js.map
94
+ //# sourceMappingURL=internal-api-REGN3WMX.js.map
@@ -21,7 +21,7 @@ import {
21
21
  findSuggestion,
22
22
  generateNonce,
23
23
  mountAgent
24
- } from "./chunk-VPV7WABO.js";
24
+ } from "./chunk-VTJMND23.js";
25
25
  import {
26
26
  resolveProvider
27
27
  } from "./chunk-6GGWS7J3.js";
@@ -45,7 +45,7 @@ import {
45
45
  scanWebSocketRoutes
46
46
  } from "./chunk-MNIQ5F3Y.js";
47
47
  import "./chunk-A7JBF5FO.js";
48
- import "./chunk-XTM32FF6.js";
48
+ import "./chunk-VQIUTCK2.js";
49
49
  export {
50
50
  BATCH_PATH,
51
51
  CSP_REPORT_PATH,
@@ -78,4 +78,4 @@ export {
78
78
  scanWebSocketRoutes,
79
79
  sendError
80
80
  };
81
- //# sourceMappingURL=internal-api-XAQ7H73N.js.map
81
+ //# sourceMappingURL=internal-api-XQA2L663.js.map
@@ -2,7 +2,7 @@
2
2
  import "tsx/esm";
3
3
  import {
4
4
  createAgentSsrLoader
5
- } from "./chunk-B7XHGEDH.js";
5
+ } from "./chunk-O5W7XSUX.js";
6
6
  import {
7
7
  extractAppResources,
8
8
  handleMcpJsonRpc
@@ -75,4 +75,4 @@ async function mcpCommand(name, deps = {}) {
75
75
  export {
76
76
  mcpCommand
77
77
  };
78
- //# sourceMappingURL=mcp-TJIUDFY2.js.map
78
+ //# sourceMappingURL=mcp-CO4AGAXV.js.map
@@ -5,6 +5,95 @@ export { InProcessApprovalRequest, InProcessApprovalRequiredError, InProcessAwai
5
5
  import { CustomTool as CustomTool$1 } from '@theokit/sdk';
6
6
  import { V as VerifyFn } from '../../webhook-types-CNUZY7o1.js';
7
7
 
8
+ /**
9
+ * Provider Resolver — Strategy + Registry pattern (FAANG-grade).
10
+ *
11
+ * Inspiration: Dapr Conversation Registry (`dapr/pkg/components/conversation/registry.go`)
12
+ * + Encore Manager provider array (`encore/runtimes/go/pubsub/manager_internal.go`).
13
+ *
14
+ * Principle: provider routing is the FRAMEWORK's responsibility, not the consumer's.
15
+ * The consumer template uses a plain `model: { id: 'gpt-4o-mini' }` — no conditionals.
16
+ *
17
+ * Wire protocol: OpenAI Chat Completions (universal — implemented by every
18
+ * os providers: OpenRouter, Groq, Mistral, Together, Anthropic via proxy, etc).
19
+ *
20
+ * Resolution by priority (FIRST match wins):
21
+ * 1. OPENROUTER_API_KEY → baseUrl=openrouter.ai (multi-model gateway)
22
+ * 2. OPENAI_API_KEY → baseUrl=api.openai.com
23
+ * 3. ANTHROPIC_API_KEY → direct Anthropic (Messages API, not OpenAI-compat)
24
+ *
25
+ * Escape hatch: an explicit `options.apiKey` OVERRIDES auto-resolution
26
+ * (the consumer can force a specific provider if it wants to).
27
+ */
28
+ /**
29
+ * Provider configuration descriptor — Registry entry shape.
30
+ *
31
+ * @public
32
+ */
33
+ interface ProviderDescriptor {
34
+ /** Stable name used internally — not exposed on the wire. */
35
+ name: string;
36
+ /** Environment variable that holds the API key for this provider. */
37
+ envKey: string;
38
+ /** Base URL for the provider's OpenAI-compatible (or native) API. */
39
+ baseUrl: string;
40
+ /** Resolution priority (lower = higher priority). FIRST match wins. */
41
+ priority: number;
42
+ }
43
+ /**
44
+ * Resolved provider configuration — output of `resolveProvider()`.
45
+ *
46
+ * @public
47
+ */
48
+ interface ResolvedProvider {
49
+ name: string;
50
+ apiKey: string;
51
+ baseUrl: string;
52
+ }
53
+ /**
54
+ * Register a new provider (Registry pattern — runtime extension point).
55
+ * Useful for self-hosted endpoints or custom providers without touching theokit src.
56
+ *
57
+ * @example
58
+ * registerProvider({
59
+ * name: 'self-hosted',
60
+ * envKey: 'SELF_HOSTED_API_KEY',
61
+ * baseUrl: 'https://llm.internal.acme.com/v1',
62
+ * priority: 0, // highest priority
63
+ * })
64
+ *
65
+ * @public
66
+ */
67
+ declare function registerProvider(descriptor: ProviderDescriptor): void;
68
+ /**
69
+ * Reset registry to DEFAULT_REGISTRY (test-only / dev escape hatch).
70
+ *
71
+ * @public
72
+ */
73
+ declare function resetProviderRegistry(): void;
74
+ /**
75
+ * Get current registry snapshot (read-only — inspection).
76
+ *
77
+ * @public
78
+ */
79
+ declare function listProviders(): readonly ProviderDescriptor[];
80
+ /**
81
+ * Resolve provider from env vars by priority. FIRST env var found wins.
82
+ *
83
+ * @returns ResolvedProvider with apiKey + baseUrl + name
84
+ * @throws Error if NO provider env var is set (actionable message)
85
+ *
86
+ * @public
87
+ */
88
+ declare function resolveProvider(): ResolvedProvider;
89
+ /**
90
+ * Try to resolve — does NOT throw. Returns null if no provider available.
91
+ * Useful for graceful degradation (e.g., mock mode).
92
+ *
93
+ * @public
94
+ */
95
+ declare function tryResolveProvider(): ResolvedProvider | null;
96
+
8
97
  /**
9
98
  * M26 (ADR-0041) — `createWorkflowTool`: wrap an SDK `Workflow` as a `CustomTool`.
10
99
  *
@@ -320,4 +409,4 @@ interface StdioStreams {
320
409
  */
321
410
  declare function serveMcpStdio(mod: unknown, name: string, appResources: readonly AppResource[], streams: StdioStreams): Promise<void>;
322
411
 
323
- export { type AcpToolConfig, type AppResource, type AppResourceInput, type ChannelMessage, type ChannelWebhookConfig, type CodeModeApi, type CodeModeConfig, type CodeModePermission, CodeModePermissionDeniedError, type McpResourceContents, type McpResourceDescriptor, NodeAcpTransport, type Sandbox, type StdioStreams, type VendorAgentClient, type VendorAgentToolConfig, type WorkflowLike, type WorkflowToolConfig, buildResourceDescriptors, createACPTool, createCodeMode, createVendorAgentTool, createWorkflowTool, defineAppResource, extractAppResources, handleChannelWebhook, handleMcpStdioLine, isChannelPath, parseChannelPath, readAppResource, serveMcpStdio };
412
+ export { type AcpToolConfig, type AppResource, type AppResourceInput, type ChannelMessage, type ChannelWebhookConfig, type CodeModeApi, type CodeModeConfig, type CodeModePermission, CodeModePermissionDeniedError, type McpResourceContents, type McpResourceDescriptor, NodeAcpTransport, type ProviderDescriptor, type ResolvedProvider, type Sandbox, type StdioStreams, type VendorAgentClient, type VendorAgentToolConfig, type WorkflowLike, type WorkflowToolConfig, buildResourceDescriptors, createACPTool, createCodeMode, createVendorAgentTool, createWorkflowTool, defineAppResource, extractAppResources, handleChannelWebhook, handleMcpStdioLine, isChannelPath, listProviders, parseChannelPath, readAppResource, registerProvider, resetProviderRegistry, resolveProvider, serveMcpStdio, tryResolveProvider };
@@ -12,13 +12,20 @@ import {
12
12
  parseChannelPath,
13
13
  serveMcpStdio,
14
14
  streamAgentTurnInProcess
15
- } from "../../chunk-FZG3JYB3.js";
15
+ } from "../../chunk-7ZOQN7UH.js";
16
16
  import {
17
17
  buildResourceDescriptors,
18
18
  defineAppResource,
19
19
  extractAppResources,
20
20
  readAppResource
21
21
  } from "../../chunk-YOIVCCZT.js";
22
+ import {
23
+ listProviders,
24
+ registerProvider,
25
+ resetProviderRegistry,
26
+ resolveProvider,
27
+ tryResolveProvider
28
+ } from "../../chunk-6E5WKMDS.js";
22
29
  import "../../chunk-SAFGDIPQ.js";
23
30
  import "../../chunk-XTHN6JBX.js";
24
31
  export {
@@ -35,9 +42,14 @@ export {
35
42
  handleChannelWebhook,
36
43
  handleMcpStdioLine,
37
44
  isChannelPath,
45
+ listProviders,
38
46
  parseChannelPath,
39
47
  readAppResource,
48
+ registerProvider,
49
+ resetProviderRegistry,
50
+ resolveProvider,
40
51
  serveMcpStdio,
41
- streamAgentTurnInProcess
52
+ streamAgentTurnInProcess,
53
+ tryResolveProvider
42
54
  };
43
55
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,5 @@
1
1
  import { d as StorageAdapter } from '../../storage-types-DsDTCPbp.js';
2
+ export { InMemoryUsageStorage as NeutralUsageStorage } from '@theokit/agents/usage';
2
3
 
3
4
  /**
4
5
  * Cost tracking types (R0.5.11).
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  InMemoryUsageStorage,
3
+ InMemoryUsageStorage2,
3
4
  trackAgentRun,
4
5
  trackAgentTools
5
- } from "../../chunk-SEELKQUM.js";
6
+ } from "../../chunk-Y2KHTD2W.js";
6
7
  import "../../chunk-XTHN6JBX.js";
7
8
  export {
8
9
  InMemoryUsageStorage,
10
+ InMemoryUsageStorage2 as NeutralUsageStorage,
9
11
  trackAgentRun,
10
12
  trackAgentTools
11
13
  };
@@ -24,7 +24,7 @@ import {
24
24
  runMiddlewareAndContext,
25
25
  sendError,
26
26
  sendJson
27
- } from "../../chunk-37ZO643S.js";
27
+ } from "../../chunk-XALU5LCU.js";
28
28
  import "../../chunk-47FFT43U.js";
29
29
  import "../../chunk-KD5G3YXI.js";
30
30
  import "../../chunk-FB2HBNIC.js";
@@ -38,7 +38,7 @@ import {
38
38
  TheoError,
39
39
  fromUnknown,
40
40
  serverErrorToEnvelope
41
- } from "../../chunk-7SABX4DJ.js";
41
+ } from "../../chunk-IZ3TIL6K.js";
42
42
  import {
43
43
  appendCookieToHeaders,
44
44
  appendDeleteCookieToHeaders,