aura-code 0.3.7 → 0.6.3

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 (160) hide show
  1. package/README.md +56 -4
  2. package/dist/agent/compactor.d.ts +26 -0
  3. package/dist/agent/compactor.js +156 -0
  4. package/dist/agent/compactor.js.map +1 -0
  5. package/dist/agent/context.d.ts +4 -0
  6. package/dist/agent/context.js +38 -0
  7. package/dist/agent/context.js.map +1 -1
  8. package/dist/agent/design.d.ts +17 -0
  9. package/dist/agent/design.js +175 -0
  10. package/dist/agent/design.js.map +1 -0
  11. package/dist/agent/loop.js +24 -1
  12. package/dist/agent/loop.js.map +1 -1
  13. package/dist/agent/system-prompt.d.ts +1 -1
  14. package/dist/agent/system-prompt.js +14 -3
  15. package/dist/agent/system-prompt.js.map +1 -1
  16. package/dist/cli/display.js +46 -5
  17. package/dist/cli/display.js.map +1 -1
  18. package/dist/cli/index.js +323 -46
  19. package/dist/cli/index.js.map +1 -1
  20. package/dist/config/defaults.js +8 -1
  21. package/dist/config/defaults.js.map +1 -1
  22. package/dist/config/project-config.d.ts +6 -0
  23. package/dist/config/project-config.js +2 -0
  24. package/dist/config/project-config.js.map +1 -1
  25. package/dist/dream/dream.d.ts +71 -0
  26. package/dist/dream/dream.js +217 -0
  27. package/dist/dream/dream.js.map +1 -0
  28. package/dist/dream/okf.d.ts +10 -0
  29. package/dist/dream/okf.js +280 -0
  30. package/dist/dream/okf.js.map +1 -0
  31. package/dist/dream/parser.d.ts +60 -0
  32. package/dist/dream/parser.js +176 -0
  33. package/dist/dream/parser.js.map +1 -0
  34. package/dist/dream/reconcile.d.ts +69 -0
  35. package/dist/dream/reconcile.js +303 -0
  36. package/dist/dream/reconcile.js.map +1 -0
  37. package/dist/kanban/index.d.ts +5 -0
  38. package/dist/kanban/index.js +11 -0
  39. package/dist/kanban/index.js.map +1 -0
  40. package/dist/kanban/pipeline.d.ts +16 -0
  41. package/dist/kanban/pipeline.js +910 -0
  42. package/dist/kanban/pipeline.js.map +1 -0
  43. package/dist/kanban/server.d.ts +5 -0
  44. package/dist/kanban/server.js +820 -0
  45. package/dist/kanban/server.js.map +1 -0
  46. package/dist/kanban/types.d.ts +75 -0
  47. package/dist/kanban/types.js +6 -0
  48. package/dist/kanban/types.js.map +1 -0
  49. package/dist/learnlight/driven.d.ts +2 -0
  50. package/dist/learnlight/driven.js +109 -0
  51. package/dist/learnlight/driven.js.map +1 -0
  52. package/dist/learnlight/index.d.ts +4 -0
  53. package/dist/learnlight/index.js +32 -0
  54. package/dist/learnlight/index.js.map +1 -0
  55. package/dist/learnlight/lesson-prep.d.ts +36 -0
  56. package/dist/learnlight/lesson-prep.js +224 -0
  57. package/dist/learnlight/lesson-prep.js.map +1 -0
  58. package/dist/learnlight/report.d.ts +2 -0
  59. package/dist/learnlight/report.js +37 -0
  60. package/dist/learnlight/report.js.map +1 -0
  61. package/dist/learnlight/types.d.ts +72 -0
  62. package/dist/learnlight/types.js +6 -0
  63. package/dist/learnlight/types.js.map +1 -0
  64. package/dist/machina/index.d.ts +16 -0
  65. package/dist/machina/index.js +61 -0
  66. package/dist/machina/index.js.map +1 -0
  67. package/dist/machina/render-html.d.ts +2 -0
  68. package/dist/machina/render-html.js +189 -0
  69. package/dist/machina/render-html.js.map +1 -0
  70. package/dist/machina/render-terminal.d.ts +2 -0
  71. package/dist/machina/render-terminal.js +92 -0
  72. package/dist/machina/render-terminal.js.map +1 -0
  73. package/dist/machina/spec.d.ts +61 -0
  74. package/dist/machina/spec.js +124 -0
  75. package/dist/machina/spec.js.map +1 -0
  76. package/dist/machina/verify.d.ts +27 -0
  77. package/dist/machina/verify.js +85 -0
  78. package/dist/machina/verify.js.map +1 -0
  79. package/dist/perception/graph-store.d.ts +11 -0
  80. package/dist/perception/graph-store.js +33 -0
  81. package/dist/perception/graph-store.js.map +1 -1
  82. package/dist/perception/index.d.ts +1 -1
  83. package/dist/perception/index.js +2 -1
  84. package/dist/perception/index.js.map +1 -1
  85. package/dist/providers/anthropic.js +1 -1
  86. package/dist/providers/anthropic.js.map +1 -1
  87. package/dist/providers/factory.d.ts +49 -0
  88. package/dist/providers/factory.js +99 -0
  89. package/dist/providers/factory.js.map +1 -1
  90. package/dist/providers/google.js +1 -1
  91. package/dist/providers/google.js.map +1 -1
  92. package/dist/providers/openai-compatible.js +81 -50
  93. package/dist/providers/openai-compatible.js.map +1 -1
  94. package/dist/rem/graph.d.ts +72 -0
  95. package/dist/rem/graph.js +139 -0
  96. package/dist/rem/graph.js.map +1 -0
  97. package/dist/rem/index.d.ts +16 -0
  98. package/dist/rem/index.js +60 -0
  99. package/dist/rem/index.js.map +1 -0
  100. package/dist/rem/render-html.d.ts +2 -0
  101. package/dist/rem/render-html.js +189 -0
  102. package/dist/rem/render-html.js.map +1 -0
  103. package/dist/rem/render-terminal.d.ts +4 -0
  104. package/dist/rem/render-terminal.js +94 -0
  105. package/dist/rem/render-terminal.js.map +1 -0
  106. package/dist/research/council.d.ts +27 -0
  107. package/dist/research/council.js +263 -0
  108. package/dist/research/council.js.map +1 -0
  109. package/dist/research/research.d.ts +24 -0
  110. package/dist/research/research.js +116 -0
  111. package/dist/research/research.js.map +1 -0
  112. package/dist/ruby/alternator.d.ts +36 -1
  113. package/dist/ruby/alternator.js +40 -31
  114. package/dist/ruby/alternator.js.map +1 -1
  115. package/dist/ruby/stats.js +10 -11
  116. package/dist/ruby/stats.js.map +1 -1
  117. package/dist/ruby/types.js +1 -1
  118. package/dist/ruby/types.js.map +1 -1
  119. package/dist/safety/permissions.d.ts +8 -0
  120. package/dist/safety/permissions.js +12 -0
  121. package/dist/safety/permissions.js.map +1 -1
  122. package/dist/setup/provider-registry.js +14 -0
  123. package/dist/setup/provider-registry.js.map +1 -1
  124. package/dist/setup/provider-test.js +24 -2
  125. package/dist/setup/provider-test.js.map +1 -1
  126. package/dist/setup/telegram-wizard.d.ts +57 -0
  127. package/dist/setup/telegram-wizard.js +343 -0
  128. package/dist/setup/telegram-wizard.js.map +1 -0
  129. package/dist/tools/audio-transcribe.d.ts +20 -0
  130. package/dist/tools/audio-transcribe.js +39 -28
  131. package/dist/tools/audio-transcribe.js.map +1 -1
  132. package/dist/tools/browser.js +8 -10
  133. package/dist/tools/browser.js.map +1 -1
  134. package/dist/tools/gmail-tool.d.ts +15 -0
  135. package/dist/tools/gmail-tool.js +361 -0
  136. package/dist/tools/gmail-tool.js.map +1 -0
  137. package/dist/tools/read-file.js +13 -0
  138. package/dist/tools/read-file.js.map +1 -1
  139. package/dist/tools/telegram-bot.js +103 -20
  140. package/dist/tools/telegram-bot.js.map +1 -1
  141. package/dist/tools/telegram-voice.d.ts +22 -0
  142. package/dist/tools/telegram-voice.js +203 -0
  143. package/dist/tools/telegram-voice.js.map +1 -0
  144. package/dist/tools/telegram.d.ts +6 -1
  145. package/dist/tools/telegram.js +115 -5
  146. package/dist/tools/telegram.js.map +1 -1
  147. package/dist/tools/video-render.d.ts +11 -0
  148. package/dist/tools/video-render.js +189 -0
  149. package/dist/tools/video-render.js.map +1 -0
  150. package/dist/tools/web-search.d.ts +20 -0
  151. package/dist/tools/web-search.js +134 -38
  152. package/dist/tools/web-search.js.map +1 -1
  153. package/dist/util/errors.js +6 -0
  154. package/dist/util/errors.js.map +1 -1
  155. package/dist/viz/index.js +816 -30
  156. package/dist/viz/index.js.map +1 -1
  157. package/dist/viz/reader.d.ts +33 -0
  158. package/dist/viz/reader.js +343 -0
  159. package/dist/viz/reader.js.map +1 -0
  160. package/package.json +3 -1
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ /**
3
+ * `:machina` — the Abstract Agent Machine (AAM).
4
+ *
5
+ * This module states a formal model of what `aura-code` *is*, independent of
6
+ * which LLM happens to be plugged in, and then checks every structural claim
7
+ * it makes against the real source tree at run time (see verify.ts). A spec
8
+ * that asserts "the main loop is at loop.ts:127" and never re-checks that
9
+ * line drifts silently as the code changes — this one refuses to.
10
+ *
11
+ * ── The model ──────────────────────────────────────────────────────────────
12
+ * AAM is the 5-tuple (S, P, O, δ, s0):
13
+ *
14
+ * S — state space. A state is the full conversation history plus loop
15
+ * counters: s = (history, turns, usage). Every run lives inside S.
16
+ * P — primitives. The finite, fixed set of tool definitions the machine
17
+ * can invoke (read_file, run_command, edit, ...). P is finite and
18
+ * enumerable — this is NOT where unboundedness comes from.
19
+ * O — the oracle. A function history -> {text, tool_calls, stop_reason}.
20
+ * The oracle is the ONLY part of the tuple that is swappable: it can
21
+ * be an LLM, a human, a rule table, or another AAM run recursively.
22
+ * Swapping the oracle does not change S, P, δ, or s0.
23
+ * δ — the transition function. δ(s, o(s)) -> s'. Concretely: take the
24
+ * oracle's output, run it through the safety gate, execute any tool
25
+ * calls against P, fold the results back into history, and check
26
+ * halting conditions.
27
+ * s0 — the initial state: empty history + the user's task as the first
28
+ * message.
29
+ *
30
+ * ── Why this matters, precisely ────────────────────────────────────────────
31
+ * Because δ can simulate a Turing machine's transition function (the oracle
32
+ * can be made to emit "move tape head" tool calls and the primitives can
33
+ * implement a tape as a file), AAM is Turing-complete *in principle*, for
34
+ * an UNBOUNDED machine (infinite turns, infinite context). Turing-completeness
35
+ * is the ceiling for computability — a quantum computer does not raise this
36
+ * ceiling; it changes the *complexity* of specific problems (factoring,
37
+ * search), not which problems are solvable at all. So "make the oracle
38
+ * quantum" would be a speed upgrade to O, not a power upgrade to the tuple.
39
+ *
40
+ * Turing-completeness has a cost the spec must not hide: the Halting Problem
41
+ * is undecidable for an unbounded AAM — there is no general procedure that
42
+ * decides, for an arbitrary task, whether the loop ever stops. This is
43
+ * exactly why real aura-code is NOT the unbounded machine: maxTurns and the
44
+ * context compactor are deliberate, finite approximations that trade a
45
+ * sliver of theoretical power for guaranteed termination. The unbounded
46
+ * machine is elegant on paper and undecidable in practice; the bounded
47
+ * machine is what you can actually run.
48
+ */
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.AAM_LIMITS_NOTE = exports.AAM_PREAMBLE = exports.AAM_CLAIMS = void 0;
51
+ exports.AAM_CLAIMS = [
52
+ {
53
+ id: 'main-loop',
54
+ component: 'delta',
55
+ description: 'The main transition loop — one iteration is one application of δ.',
56
+ file: 'src/agent/loop.ts',
57
+ line: 127,
58
+ mustContain: 'while (turns < maxTurns)',
59
+ },
60
+ {
61
+ id: 'oracle-call',
62
+ component: 'O',
63
+ description: "The oracle invocation — O(history) -> stream of {text, tool_calls, stop_reason}.",
64
+ file: 'src/agent/loop.ts',
65
+ line: 142,
66
+ mustContain: 'provider.stream(',
67
+ },
68
+ {
69
+ id: 'safety-gate',
70
+ component: 'delta',
71
+ description: 'The safety gate inside δ — tool calls are checked against permissions before primitives execute.',
72
+ file: 'src/agent/loop.ts',
73
+ line: 241,
74
+ mustContain: 'permissions.check(',
75
+ },
76
+ {
77
+ id: 'compaction-threshold',
78
+ component: 'limit',
79
+ description: 'The state-space pressure-relief valve: history is compacted once it crosses 70% of the context window, keeping S finite in practice.',
80
+ file: 'src/agent/compactor.ts',
81
+ line: 4,
82
+ mustContain: 'COMPACTION_THRESHOLD = 0.7',
83
+ },
84
+ {
85
+ id: 'compaction-check',
86
+ component: 'limit',
87
+ description: 'The actual threshold comparison that triggers compaction.',
88
+ file: 'src/agent/compactor.ts',
89
+ line: 113,
90
+ mustContain: 'if (totalTokens < threshold) return false;',
91
+ },
92
+ {
93
+ id: 'max-turns',
94
+ component: 'limit',
95
+ description: 'T_max — the hard halting bound that makes the REAL machine decidable (terminates within 150 turns), unlike the unbounded theoretical AAM.',
96
+ file: 'src/config/defaults.ts',
97
+ line: 17,
98
+ mustContain: 'maxTurns: 150',
99
+ },
100
+ {
101
+ id: 'primitives',
102
+ component: 'P',
103
+ description: 'P — the finite, enumerable set of tool primitives the machine can invoke.',
104
+ file: 'src/tools/index.ts',
105
+ line: 32,
106
+ mustContain: 'export const TOOL_DEFINITIONS',
107
+ },
108
+ ];
109
+ exports.AAM_PREAMBLE = 'Aura is not "an LLM with a loop around it." It is an Abstract Agent Machine: ' +
110
+ 'a 5-tuple (S, P, O, δ, s0) whose computational power comes from its structure ' +
111
+ '— state space, primitives, transition function — not from which oracle (LLM, ' +
112
+ 'human, rule table) happens to be plugged into O. Swap the oracle and the ' +
113
+ 'machine is unchanged. This is what makes Aura provider-agnostic by ' +
114
+ 'construction, not by convention.';
115
+ exports.AAM_LIMITS_NOTE = 'The UNBOUNDED version of this machine (infinite turns, infinite context) is ' +
116
+ 'Turing-complete, which means the Halting Problem is undecidable for it: no ' +
117
+ 'general test can say whether an arbitrary task ever finishes. Real aura-code ' +
118
+ 'is deliberately NOT that machine — maxTurns and the context compactor below ' +
119
+ 'are the finite bounds that buy guaranteed termination at the cost of some ' +
120
+ 'theoretical power. A quantum oracle would not restore that power: ' +
121
+ 'Turing-completeness is already the ceiling for what is computable at all; ' +
122
+ 'quantum computation changes the cost of solving certain problems, not which ' +
123
+ 'problems are solvable.';
124
+ //# sourceMappingURL=spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec.js","sourceRoot":"","sources":["../../src/machina/spec.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;;;AAcU,QAAA,UAAU,GAAsB;IAC3C;QACE,EAAE,EAAE,WAAW;QACf,SAAS,EAAE,OAAO;QAClB,WAAW,EAAE,mEAAmE;QAChF,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,0BAA0B;KACxC;IACD;QACE,EAAE,EAAE,aAAa;QACjB,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,kFAAkF;QAC/F,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,kBAAkB;KAChC;IACD;QACE,EAAE,EAAE,aAAa;QACjB,SAAS,EAAE,OAAO;QAClB,WAAW,EAAE,kGAAkG;QAC/G,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,oBAAoB;KAClC;IACD;QACE,EAAE,EAAE,sBAAsB;QAC1B,SAAS,EAAE,OAAO;QAClB,WAAW,EAAE,sIAAsI;QACnJ,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,CAAC;QACP,WAAW,EAAE,4BAA4B;KAC1C;IACD;QACE,EAAE,EAAE,kBAAkB;QACtB,SAAS,EAAE,OAAO;QAClB,WAAW,EAAE,2DAA2D;QACxE,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,4CAA4C;KAC1D;IACD;QACE,EAAE,EAAE,WAAW;QACf,SAAS,EAAE,OAAO;QAClB,WAAW,EAAE,2IAA2I;QACxJ,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,EAAE;QACR,WAAW,EAAE,eAAe;KAC7B;IACD;QACE,EAAE,EAAE,YAAY;QAChB,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,2EAA2E;QACxF,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,EAAE;QACR,WAAW,EAAE,+BAA+B;KAC7C;CACF,CAAC;AAEW,QAAA,YAAY,GACvB,+EAA+E;IAC/E,gFAAgF;IAChF,+EAA+E;IAC/E,2EAA2E;IAC3E,qEAAqE;IACrE,kCAAkC,CAAC;AAExB,QAAA,eAAe,GAC1B,8EAA8E;IAC9E,6EAA6E;IAC7E,+EAA+E;IAC/E,8EAA8E;IAC9E,4EAA4E;IAC5E,oEAAoE;IACpE,4EAA4E;IAC5E,8EAA8E;IAC9E,wBAAwB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type VerifiableClaim } from './spec.js';
2
+ export interface ClaimResult extends VerifiableClaim {
3
+ status: 'verified' | 'drifted' | 'missing';
4
+ /** The actual line content found, if the file exists. */
5
+ actualLine?: string;
6
+ }
7
+ /**
8
+ * Resolve the aura-code installation's own root directory, the same way
9
+ * telegram-bot.ts locates its repo for systemd unit generation. From a
10
+ * compiled module at dist/machina/verify.js, '../..' lands at the repo root
11
+ * (dist/machina -> dist -> root). This is intentionally independent of
12
+ * process.cwd(), since :machina describes aura-code's own machinery, not
13
+ * whatever project the user happens to be running it inside.
14
+ */
15
+ export declare function resolveAuraRepoRoot(): string;
16
+ export interface VerificationReport {
17
+ results: ClaimResult[];
18
+ verifiedCount: number;
19
+ drifted: ClaimResult[];
20
+ missing: ClaimResult[];
21
+ }
22
+ /**
23
+ * Verify every structural claim the spec makes. `repoRoot` should be the
24
+ * aura-code installation's own source root — pass `__dirname`-derived paths
25
+ * from the CLI entry point, not the user's project root.
26
+ */
27
+ export declare function verifyAamClaims(repoRoot: string): VerificationReport;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.resolveAuraRepoRoot = resolveAuraRepoRoot;
37
+ exports.verifyAamClaims = verifyAamClaims;
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ const spec_js_1 = require("./spec.js");
41
+ /**
42
+ * Check a single claim against the real file on disk. `repoRoot` is the
43
+ * aura-code repository root (NOT the user's current project — the AAM
44
+ * describes aura-code's own machinery, regardless of what project it's
45
+ * currently being run inside).
46
+ */
47
+ function verifyClaim(repoRoot, claim) {
48
+ const filePath = path.join(repoRoot, claim.file);
49
+ let lines;
50
+ try {
51
+ lines = fs.readFileSync(filePath, 'utf8').split('\n');
52
+ }
53
+ catch {
54
+ return { ...claim, status: 'missing' };
55
+ }
56
+ const actual = lines[claim.line - 1] ?? '';
57
+ const status = actual.includes(claim.mustContain) ? 'verified' : 'drifted';
58
+ return { ...claim, status, actualLine: actual.trim() };
59
+ }
60
+ /**
61
+ * Resolve the aura-code installation's own root directory, the same way
62
+ * telegram-bot.ts locates its repo for systemd unit generation. From a
63
+ * compiled module at dist/machina/verify.js, '../..' lands at the repo root
64
+ * (dist/machina -> dist -> root). This is intentionally independent of
65
+ * process.cwd(), since :machina describes aura-code's own machinery, not
66
+ * whatever project the user happens to be running it inside.
67
+ */
68
+ function resolveAuraRepoRoot() {
69
+ return path.resolve(__dirname, '../..');
70
+ }
71
+ /**
72
+ * Verify every structural claim the spec makes. `repoRoot` should be the
73
+ * aura-code installation's own source root — pass `__dirname`-derived paths
74
+ * from the CLI entry point, not the user's project root.
75
+ */
76
+ function verifyAamClaims(repoRoot) {
77
+ const results = spec_js_1.AAM_CLAIMS.map(c => verifyClaim(repoRoot, c));
78
+ return {
79
+ results,
80
+ verifiedCount: results.filter(r => r.status === 'verified').length,
81
+ drifted: results.filter(r => r.status === 'drifted'),
82
+ missing: results.filter(r => r.status === 'missing'),
83
+ };
84
+ }
85
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.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,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,MAAM;QAClE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC;QACpD,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC;KACrD,CAAC;AACJ,CAAC"}
@@ -23,3 +23,14 @@ export declare function isStale(perception: ProjectPerception, maxAgeMs?: number
23
23
  * Silently succeeds when the file does not exist.
24
24
  */
25
25
  export declare function clearPerception(filePath: string): Promise<void>;
26
+ /**
27
+ * Convert a ProjectPerception into the flat `{ nodes, edges }` shape that
28
+ * `viz/index.ts#loadGraph()` and `agent/context.ts#loadGraphSummary()` expect,
29
+ * then write it to `<projectRoot>/graphify-out/graph.json`.
30
+ *
31
+ * Node shape: `{ id, label, type, file?, summary?, source_location? }`
32
+ * Edge shape: `{ source, target, relation }`
33
+ *
34
+ * Writes atomically (tmp + rename).
35
+ */
36
+ export declare function saveGraphForViz(perception: ProjectPerception): Promise<void>;
@@ -37,6 +37,7 @@ exports.savePerception = savePerception;
37
37
  exports.loadPerception = loadPerception;
38
38
  exports.isStale = isStale;
39
39
  exports.clearPerception = clearPerception;
40
+ exports.saveGraphForViz = saveGraphForViz;
40
41
  const fs = __importStar(require("fs"));
41
42
  const path = __importStar(require("path"));
42
43
  // ─────────────────────────────────────────────────────────────────────────────
@@ -110,6 +111,38 @@ async function clearPerception(filePath) {
110
111
  }
111
112
  }
112
113
  // ─────────────────────────────────────────────────────────────────────────────
114
+ /**
115
+ * Convert a ProjectPerception into the flat `{ nodes, edges }` shape that
116
+ * `viz/index.ts#loadGraph()` and `agent/context.ts#loadGraphSummary()` expect,
117
+ * then write it to `<projectRoot>/graphify-out/graph.json`.
118
+ *
119
+ * Node shape: `{ id, label, type, file?, summary?, source_location? }`
120
+ * Edge shape: `{ source, target, relation }`
121
+ *
122
+ * Writes atomically (tmp + rename).
123
+ */
124
+ async function saveGraphForViz(perception) {
125
+ const dir = path.join(perception.projectRoot, 'graphify-out');
126
+ if (!fs.existsSync(dir))
127
+ fs.mkdirSync(dir, { recursive: true });
128
+ const nodes = perception.nodes.map(n => ({
129
+ id: n.id,
130
+ label: n.label,
131
+ type: n.type === 'module' ? 'file' : n.type, // 'module' → 'file' for viz color mapping
132
+ file: n.type === 'file' ? n.id : n.metadata?.source,
133
+ summary: n.description?.slice(0, 200),
134
+ }));
135
+ const edges = perception.edges.map(e => ({
136
+ source: e.from,
137
+ target: e.to,
138
+ relation: e.relationship,
139
+ }));
140
+ const target = path.join(dir, 'graph.json');
141
+ const tmp = target + '.tmp';
142
+ await fs.promises.writeFile(tmp, JSON.stringify({ nodes, edges }, null, 2), 'utf8');
143
+ await fs.promises.rename(tmp, target);
144
+ }
145
+ // ─────────────────────────────────────────────────────────────────────────────
113
146
  function defaultPath(projectRoot) {
114
147
  const dir = path.join(projectRoot, '.aura');
115
148
  return path.join(dir, 'perception.json');
@@ -1 +1 @@
1
- {"version":3,"file":"graph-store.js","sourceRoot":"","sources":["../../src/perception/graph-store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,wCAQC;AAMD,wCAcC;AAMD,0BAKC;AAMD,0CAMC;AAvED,uCAAyB;AACzB,2CAA6B;AAG7B,gFAAgF;AAChF,kEAAkE;AAClE,gFAAgF;AAEhF,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;AAEpD,gFAAgF;AAEhF;;;;;;;GAOG;AACI,KAAK,UAAU,cAAc,CAAC,UAA6B,EAAE,QAAiB;IACnF,MAAM,MAAM,GAAG,QAAQ,IAAI,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,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AC,CAAE,CAAC,CAAC,QAAQ,EAAE,MAA6B;QAC5E,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;KACtC,CAAC,CAAC,CAAC;IAEJ,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,EAAI,CAAC,CAAC,IAAI;QAChB,MAAM,EAAI,CAAC,CAAC,EAAE;QACd,QAAQ,EAAE,CAAC,CAAC,YAAY;KACzB,CAAC,CAAC,CAAC;IAEJ,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACpF,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC;AAED,gFAAgF;AAEhF,SAAS,WAAW,CAAC,WAAmB;IACtC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;AAC3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { extractPerception } from './extractor.js';
2
- export { savePerception, loadPerception, isStale, clearPerception } from './graph-store.js';
2
+ export { savePerception, loadPerception, isStale, clearPerception, saveGraphForViz } from './graph-store.js';
3
3
  export { getDependencies, getImpact, getConstraints, getRiskAreas, getTrajectory, findRelated } from './queries.js';
4
4
  export type { ProjectPerception, ArchitectureNode, ArchitectureEdge, PerceptionQuery, PerceptionQueryResult } from './types.js';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findRelated = exports.getTrajectory = exports.getRiskAreas = exports.getConstraints = exports.getImpact = exports.getDependencies = exports.clearPerception = exports.isStale = exports.loadPerception = exports.savePerception = exports.extractPerception = void 0;
3
+ exports.findRelated = exports.getTrajectory = exports.getRiskAreas = exports.getConstraints = exports.getImpact = exports.getDependencies = exports.saveGraphForViz = exports.clearPerception = exports.isStale = exports.loadPerception = exports.savePerception = exports.extractPerception = void 0;
4
4
  var extractor_js_1 = require("./extractor.js");
5
5
  Object.defineProperty(exports, "extractPerception", { enumerable: true, get: function () { return extractor_js_1.extractPerception; } });
6
6
  var graph_store_js_1 = require("./graph-store.js");
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "savePerception", { enumerable: true, get: functi
8
8
  Object.defineProperty(exports, "loadPerception", { enumerable: true, get: function () { return graph_store_js_1.loadPerception; } });
9
9
  Object.defineProperty(exports, "isStale", { enumerable: true, get: function () { return graph_store_js_1.isStale; } });
10
10
  Object.defineProperty(exports, "clearPerception", { enumerable: true, get: function () { return graph_store_js_1.clearPerception; } });
11
+ Object.defineProperty(exports, "saveGraphForViz", { enumerable: true, get: function () { return graph_store_js_1.saveGraphForViz; } });
11
12
  var queries_js_1 = require("./queries.js");
12
13
  Object.defineProperty(exports, "getDependencies", { enumerable: true, get: function () { return queries_js_1.getDependencies; } });
13
14
  Object.defineProperty(exports, "getImpact", { enumerable: true, get: function () { return queries_js_1.getImpact; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/perception/index.ts"],"names":[],"mappings":";;;AAAA,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA;AAC1B,mDAA4F;AAAnF,gHAAA,cAAc,OAAA;AAAE,gHAAA,cAAc,OAAA;AAAE,yGAAA,OAAO,OAAA;AAAE,iHAAA,eAAe,OAAA;AACjE,2CAAoH;AAA3G,6GAAA,eAAe,OAAA;AAAE,uGAAA,SAAS,OAAA;AAAE,4GAAA,cAAc,OAAA;AAAE,0GAAA,YAAY,OAAA;AAAE,2GAAA,aAAa,OAAA;AAAE,yGAAA,WAAW,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/perception/index.ts"],"names":[],"mappings":";;;AAAA,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA;AAC1B,mDAA6G;AAApG,gHAAA,cAAc,OAAA;AAAE,gHAAA,cAAc,OAAA;AAAE,yGAAA,OAAO,OAAA;AAAE,iHAAA,eAAe,OAAA;AAAE,iHAAA,eAAe,OAAA;AAClF,2CAAoH;AAA3G,6GAAA,eAAe,OAAA;AAAE,uGAAA,SAAS,OAAA;AAAE,4GAAA,cAAc,OAAA;AAAE,0GAAA,YAAY,OAAA;AAAE,2GAAA,aAAa,OAAA;AAAE,yGAAA,WAAW,OAAA"}
@@ -14,7 +14,7 @@ class AnthropicProvider {
14
14
  maxTokens;
15
15
  constructor(config) {
16
16
  this.model = config.model;
17
- this.maxTokens = config.maxTokens ?? 8096;
17
+ this.maxTokens = config.maxTokens ?? 2048; // aligned with DEFAULTS.maxTokens (402 cost-gate fix)
18
18
  this.client = new sdk_1.default({
19
19
  apiKey: config.apiKey ?? (0, env_js_1.getApiKey)('ANTHROPIC_API_KEY'),
20
20
  });
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA0C;AAC1C,2CAA2C;AAM3C,MAAa,iBAAiB;IAC5B,IAAI,GAAG,WAAW,CAAC;IACnB,aAAa,GAAG,IAAI,CAAC;IACrB,KAAK,CAAS;IAEN,MAAM,CAAY;IAClB,SAAS,CAAS;IAE1B,YAAY,MAAsB;QAChC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,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AAW,EAAE,CAAC,CAAC,EAAE;oBACjB,OAAO,EAAE,CAAC,CAAC,OAAO;oBAClB,QAAQ,EAAE,CAAC,CAAC,OAAO;iBACpB,CAAC,CAAC;aACJ,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,qBAAqB,CAAC,QAA2B;IACxD,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,MAAM,SAAS,GAAe,EAAE,CAAC;IAEjC,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;YAAE,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC;QAC9C,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC9B,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAgC,EAAE,CAAC,CAAC;QACpG,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GACd,QAAQ,CAAC,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC/C,QAAQ,CAAC,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAE3D,OAAO;QACL,IAAI,EAAE,SAAS,EAAE,UAAU;QAC3B,KAAK,EAAE;YACL,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY;YACxC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,aAAa;SAC3C;KACF,CAAC;AACJ,CAAC"}
@@ -14,6 +14,22 @@ export declare function getCustomProviders(): ProviderDef[];
14
14
  export declare function detectProviderKind(model: string): 'anthropic' | 'google' | 'openai-compatible';
15
15
  /** Rough provider family for routing / alternator guardrails. */
16
16
  export declare function modelProviderFamily(modelId: string): string;
17
+ /**
18
+ * The name of the environment variable that holds the API key for a given
19
+ * model's provider family (e.g. "deepseek/..." → "DEEPSEEK_API_KEY"). Returns
20
+ * the key's *name*, not its value — used by setup wizards to tell the user
21
+ * which variable to set. Falls back to OPENAI_API_KEY for unknown families.
22
+ */
23
+ export declare function apiKeyEnvVarForModel(model: string): string;
24
+ /**
25
+ * Resolves an API key for a given model, trying that model's own provider
26
+ * family first — falling back to other configured keys only as a last
27
+ * resort. Use this instead of an unconditional "try DeepSeek, then Xiaomi,
28
+ * then..." chain: that ordering picks whichever key happens to exist first,
29
+ * completely independent of which model is actually being called, which is
30
+ * exactly how a MiMo model string ends up paired with a DeepSeek key.
31
+ */
32
+ export declare function getApiKeyForModel(model: string): string | undefined;
17
33
  /**
18
34
  * Drop baseUrl/apiKey from a different wizard setup so we never send DeepSeek to MiMo URL.
19
35
  */
@@ -24,6 +40,39 @@ export declare function resolveProviderTransport(model: string, opts: {
24
40
  baseUrl?: string;
25
41
  apiKey?: string;
26
42
  };
43
+ /**
44
+ * Resolve which baseUrl (if any) should be trusted for a given task model,
45
+ * given a project-level config and/or a global config that each carry their
46
+ * own (model, baseUrl) pair.
47
+ *
48
+ * A saved config's baseUrl is only trustworthy if it was saved alongside
49
+ * the SAME model that's actually about to be called. Without this check, a
50
+ * project's .aura.json or the global config can hold a baseUrl from a
51
+ * previous provider setup (e.g. DeepSeek's https://api.deepseek.com/v1)
52
+ * that gets paired with whatever the task model resolves to NOW (e.g.
53
+ * opencode/big-pickle, from a later env-var override) — sending an
54
+ * OpenCode model name to DeepSeek's endpoint, which DeepSeek then rejects
55
+ * with a 400 ("supported API model names are deepseek-v4-pro or
56
+ * deepseek-v4-flash, but you passed big-pickle").
57
+ *
58
+ * createProvider()'s own internal saved-config merge has an equivalent
59
+ * guard for provider.json (the wizard's saved config) — this function
60
+ * covers the OTHER two config sources (project-level fileConfig and the
61
+ * global config), which callers like telegram-bot.ts read independently
62
+ * before ever reaching createProvider().
63
+ */
64
+ export declare function resolveTaskModelBaseUrl(opts: {
65
+ taskModel: string;
66
+ envBaseUrl?: string;
67
+ fileConfig?: {
68
+ model?: string;
69
+ baseUrl?: string;
70
+ };
71
+ globalCfg?: {
72
+ defaultModel?: string;
73
+ baseUrl?: string;
74
+ } | null;
75
+ }): string | undefined;
27
76
  /**
28
77
  * Auto-detect the right provider from the model name, then instantiate it.
29
78
  *
@@ -38,7 +38,10 @@ exports.registerCustomProviders = registerCustomProviders;
38
38
  exports.getCustomProviders = getCustomProviders;
39
39
  exports.detectProviderKind = detectProviderKind;
40
40
  exports.modelProviderFamily = modelProviderFamily;
41
+ exports.apiKeyEnvVarForModel = apiKeyEnvVarForModel;
42
+ exports.getApiKeyForModel = getApiKeyForModel;
41
43
  exports.resolveProviderTransport = resolveProviderTransport;
44
+ exports.resolveTaskModelBaseUrl = resolveTaskModelBaseUrl;
42
45
  exports.createProvider = createProvider;
43
46
  exports.getAllModels = getAllModels;
44
47
  exports.getContextWindow = getContextWindow;
@@ -94,10 +97,61 @@ function modelProviderFamily(modelId) {
94
97
  return 'openrouter';
95
98
  if (m.startsWith('grok-') || m.startsWith('xai/'))
96
99
  return 'xai';
100
+ if (m.startsWith('opencode/') || m.startsWith('zen/'))
101
+ return 'opencode';
97
102
  if (m.startsWith('ollama/'))
98
103
  return 'ollama';
99
104
  return 'openai-compatible';
100
105
  }
106
+ const FAMILY_API_KEY_ENV = {
107
+ deepseek: 'DEEPSEEK_API_KEY',
108
+ xiaomi: 'XIAOMI_API_KEY',
109
+ anthropic: 'ANTHROPIC_API_KEY',
110
+ google: 'GOOGLE_API_KEY',
111
+ openrouter: 'OPENROUTER_API_KEY',
112
+ xai: 'XAI_API_KEY',
113
+ opencode: 'OPENCODE_API_KEY',
114
+ 'openai-compatible': 'OPENAI_API_KEY',
115
+ };
116
+ /**
117
+ * The name of the environment variable that holds the API key for a given
118
+ * model's provider family (e.g. "deepseek/..." → "DEEPSEEK_API_KEY"). Returns
119
+ * the key's *name*, not its value — used by setup wizards to tell the user
120
+ * which variable to set. Falls back to OPENAI_API_KEY for unknown families.
121
+ */
122
+ function apiKeyEnvVarForModel(model) {
123
+ return FAMILY_API_KEY_ENV[modelProviderFamily(model)] ?? 'OPENAI_API_KEY';
124
+ }
125
+ /**
126
+ * Resolves an API key for a given model, trying that model's own provider
127
+ * family first — falling back to other configured keys only as a last
128
+ * resort. Use this instead of an unconditional "try DeepSeek, then Xiaomi,
129
+ * then..." chain: that ordering picks whichever key happens to exist first,
130
+ * completely independent of which model is actually being called, which is
131
+ * exactly how a MiMo model string ends up paired with a DeepSeek key.
132
+ */
133
+ function getApiKeyForModel(model) {
134
+ const family = modelProviderFamily(model);
135
+ const preferredEnvVar = FAMILY_API_KEY_ENV[family];
136
+ if (preferredEnvVar) {
137
+ const preferred = (0, env_js_1.getApiKey)(preferredEnvVar);
138
+ if (preferred)
139
+ return preferred;
140
+ }
141
+ // Fall back to any other configured key, in case the user only has one
142
+ // provider set up and is calling a model from a different family by
143
+ // mistake — createProvider()'s own baseUrl logic will still catch and
144
+ // correct an actual family mismatch, so this fallback can't silently
145
+ // send the wrong key to the wrong endpoint the way the old code could.
146
+ for (const envVar of Object.values(FAMILY_API_KEY_ENV)) {
147
+ if (envVar === preferredEnvVar)
148
+ continue;
149
+ const key = (0, env_js_1.getApiKey)(envVar);
150
+ if (key)
151
+ return key;
152
+ }
153
+ return undefined;
154
+ }
101
155
  /**
102
156
  * Known default endpoints, keyed to the same family ids `modelProviderFamily`
103
157
  * returns. Lets us recognise "this baseUrl is MiMo's, but the model is
@@ -159,6 +213,32 @@ function resolveProviderTransport(model, opts) {
159
213
  }
160
214
  return { baseUrl, apiKey: opts.apiKey };
161
215
  }
216
+ /**
217
+ * Resolve which baseUrl (if any) should be trusted for a given task model,
218
+ * given a project-level config and/or a global config that each carry their
219
+ * own (model, baseUrl) pair.
220
+ *
221
+ * A saved config's baseUrl is only trustworthy if it was saved alongside
222
+ * the SAME model that's actually about to be called. Without this check, a
223
+ * project's .aura.json or the global config can hold a baseUrl from a
224
+ * previous provider setup (e.g. DeepSeek's https://api.deepseek.com/v1)
225
+ * that gets paired with whatever the task model resolves to NOW (e.g.
226
+ * opencode/big-pickle, from a later env-var override) — sending an
227
+ * OpenCode model name to DeepSeek's endpoint, which DeepSeek then rejects
228
+ * with a 400 ("supported API model names are deepseek-v4-pro or
229
+ * deepseek-v4-flash, but you passed big-pickle").
230
+ *
231
+ * createProvider()'s own internal saved-config merge has an equivalent
232
+ * guard for provider.json (the wizard's saved config) — this function
233
+ * covers the OTHER two config sources (project-level fileConfig and the
234
+ * global config), which callers like telegram-bot.ts read independently
235
+ * before ever reaching createProvider().
236
+ */
237
+ function resolveTaskModelBaseUrl(opts) {
238
+ return opts.envBaseUrl
239
+ ?? (opts.fileConfig?.model === opts.taskModel ? opts.fileConfig?.baseUrl : undefined)
240
+ ?? (opts.globalCfg?.defaultModel === opts.taskModel ? opts.globalCfg?.baseUrl : undefined);
241
+ }
162
242
  /**
163
243
  * Auto-detect the right provider from the model name, then instantiate it.
164
244
  *
@@ -235,6 +315,16 @@ function createProvider(config) {
235
315
  apiKey: config.apiKey ?? (0, env_js_1.getApiKey)('XIAOMI_API_KEY'),
236
316
  }, 'Xiaomi MiMo');
237
317
  }
318
+ // ── OpenCode Zen (OpenAI-compatible gateway) ──────────────────────────────
319
+ if (model.startsWith('opencode/') || model.startsWith('zen/')) {
320
+ const zenModel = model.replace(/^(opencode|zen)\//, '');
321
+ return new openai_compatible_js_1.OpenAICompatibleProvider({
322
+ ...config,
323
+ model: zenModel,
324
+ baseUrl: config.baseUrl ?? (0, env_js_1.getEnv)('OPENCODE_BASE_URL') ?? 'https://opencode.ai/zen/v1',
325
+ apiKey: config.apiKey ?? (0, env_js_1.getApiKey)('OPENCODE_API_KEY'),
326
+ }, 'OpenCode Zen');
327
+ }
238
328
  // ── xAI / Grok ─────────────────────────────────────────────────────────────
239
329
  if (model.startsWith('grok-') || model.startsWith('xai/')) {
240
330
  return new openai_compatible_js_1.OpenAICompatibleProvider({
@@ -412,6 +502,15 @@ exports.CONTEXT_WINDOWS = {
412
502
  'mimo-v2.5': 1_048_576,
413
503
  'mimo-v2-flash': 1_048_576,
414
504
  'mimo-v1': 131_072,
505
+ // DeepSeek — also covers OpenRouter-hosted ids; getContextWindow() strips the
506
+ // "openrouter/<vendor>/" prefix before lookup, so "openrouter/deepseek/deepseek-v4-pro"
507
+ // resolves here. Adjust the numbers to the real published limits as needed.
508
+ 'deepseek-v4-pro': 1_048_576,
509
+ 'deepseek-v4-flash': 1_048_576,
510
+ 'deepseek-v4': 1_048_576,
511
+ 'deepseek-r1': 131_072,
512
+ 'deepseek-chat': 131_072,
513
+ 'deepseek-coder-v2': 131_072,
415
514
  // xAI Grok
416
515
  'grok-2': 131_072,
417
516
  'grok-2-mini': 131_072,