shreni 0.1.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 (269) hide show
  1. package/ARCHITECTURE.md +260 -0
  2. package/LICENSE +201 -0
  3. package/README.md +519 -0
  4. package/TRADEMARK.md +97 -0
  5. package/dist/agents/parikshaka.d.ts +11 -0
  6. package/dist/agents/parikshaka.d.ts.map +1 -0
  7. package/dist/agents/parikshaka.js +80 -0
  8. package/dist/agents/parikshaka.js.map +1 -0
  9. package/dist/agents/providers/claude.d.ts +3 -0
  10. package/dist/agents/providers/claude.d.ts.map +1 -0
  11. package/dist/agents/providers/claude.js +100 -0
  12. package/dist/agents/providers/claude.js.map +1 -0
  13. package/dist/agents/providers/codex.d.ts +3 -0
  14. package/dist/agents/providers/codex.d.ts.map +1 -0
  15. package/dist/agents/providers/codex.js +123 -0
  16. package/dist/agents/providers/codex.js.map +1 -0
  17. package/dist/agents/providers/gemini.d.ts +3 -0
  18. package/dist/agents/providers/gemini.d.ts.map +1 -0
  19. package/dist/agents/providers/gemini.js +77 -0
  20. package/dist/agents/providers/gemini.js.map +1 -0
  21. package/dist/agents/providers/index.d.ts +6 -0
  22. package/dist/agents/providers/index.d.ts.map +1 -0
  23. package/dist/agents/providers/index.js +35 -0
  24. package/dist/agents/providers/index.js.map +1 -0
  25. package/dist/agents/providers/registry.d.ts +20 -0
  26. package/dist/agents/providers/registry.d.ts.map +1 -0
  27. package/dist/agents/providers/registry.js +91 -0
  28. package/dist/agents/providers/registry.js.map +1 -0
  29. package/dist/agents/providers/types.d.ts +42 -0
  30. package/dist/agents/providers/types.d.ts.map +1 -0
  31. package/dist/agents/providers/types.js +61 -0
  32. package/dist/agents/providers/types.js.map +1 -0
  33. package/dist/agents/runner.d.ts +6 -0
  34. package/dist/agents/runner.d.ts.map +1 -0
  35. package/dist/agents/runner.js +159 -0
  36. package/dist/agents/runner.js.map +1 -0
  37. package/dist/agents/silpi.d.ts +3 -0
  38. package/dist/agents/silpi.d.ts.map +1 -0
  39. package/dist/agents/silpi.js +101 -0
  40. package/dist/agents/silpi.js.map +1 -0
  41. package/dist/agents/viharapala.d.ts +5 -0
  42. package/dist/agents/viharapala.d.ts.map +1 -0
  43. package/dist/agents/viharapala.js +128 -0
  44. package/dist/agents/viharapala.js.map +1 -0
  45. package/dist/cli/agents.d.ts +14 -0
  46. package/dist/cli/agents.d.ts.map +1 -0
  47. package/dist/cli/agents.js +47 -0
  48. package/dist/cli/agents.js.map +1 -0
  49. package/dist/cli/detect-toolchain.d.ts +10 -0
  50. package/dist/cli/detect-toolchain.d.ts.map +1 -0
  51. package/dist/cli/detect-toolchain.js +77 -0
  52. package/dist/cli/detect-toolchain.js.map +1 -0
  53. package/dist/cli/index.d.ts +3 -0
  54. package/dist/cli/index.d.ts.map +1 -0
  55. package/dist/cli/index.js +342 -0
  56. package/dist/cli/index.js.map +1 -0
  57. package/dist/cli/init-kshetra.d.ts +59 -0
  58. package/dist/cli/init-kshetra.d.ts.map +1 -0
  59. package/dist/cli/init-kshetra.js +531 -0
  60. package/dist/cli/init-kshetra.js.map +1 -0
  61. package/dist/cli/list.d.ts +11 -0
  62. package/dist/cli/list.d.ts.map +1 -0
  63. package/dist/cli/list.js +45 -0
  64. package/dist/cli/list.js.map +1 -0
  65. package/dist/cli/logs.d.ts +20 -0
  66. package/dist/cli/logs.d.ts.map +1 -0
  67. package/dist/cli/logs.js +144 -0
  68. package/dist/cli/logs.js.map +1 -0
  69. package/dist/cli/migrate.d.ts +8 -0
  70. package/dist/cli/migrate.d.ts.map +1 -0
  71. package/dist/cli/migrate.js +116 -0
  72. package/dist/cli/migrate.js.map +1 -0
  73. package/dist/cli/pause.d.ts +24 -0
  74. package/dist/cli/pause.d.ts.map +1 -0
  75. package/dist/cli/pause.js +41 -0
  76. package/dist/cli/pause.js.map +1 -0
  77. package/dist/cli/phalaka-autostart.d.ts +11 -0
  78. package/dist/cli/phalaka-autostart.d.ts.map +1 -0
  79. package/dist/cli/phalaka-autostart.js +28 -0
  80. package/dist/cli/phalaka-autostart.js.map +1 -0
  81. package/dist/cli/phalaka-server.d.ts +2 -0
  82. package/dist/cli/phalaka-server.d.ts.map +1 -0
  83. package/dist/cli/phalaka-server.js +20 -0
  84. package/dist/cli/phalaka-server.js.map +1 -0
  85. package/dist/cli/phalaka.d.ts +30 -0
  86. package/dist/cli/phalaka.d.ts.map +1 -0
  87. package/dist/cli/phalaka.js +60 -0
  88. package/dist/cli/phalaka.js.map +1 -0
  89. package/dist/cli/pid.d.ts +9 -0
  90. package/dist/cli/pid.d.ts.map +1 -0
  91. package/dist/cli/pid.js +66 -0
  92. package/dist/cli/pid.js.map +1 -0
  93. package/dist/cli/provider-preflight.d.ts +11 -0
  94. package/dist/cli/provider-preflight.d.ts.map +1 -0
  95. package/dist/cli/provider-preflight.js +70 -0
  96. package/dist/cli/provider-preflight.js.map +1 -0
  97. package/dist/cli/register.d.ts +8 -0
  98. package/dist/cli/register.d.ts.map +1 -0
  99. package/dist/cli/register.js +34 -0
  100. package/dist/cli/register.js.map +1 -0
  101. package/dist/cli/run.d.ts +3 -0
  102. package/dist/cli/run.d.ts.map +1 -0
  103. package/dist/cli/run.js +40 -0
  104. package/dist/cli/run.js.map +1 -0
  105. package/dist/cli/start.d.ts +11 -0
  106. package/dist/cli/start.d.ts.map +1 -0
  107. package/dist/cli/start.js +26 -0
  108. package/dist/cli/start.js.map +1 -0
  109. package/dist/cli/status.d.ts +39 -0
  110. package/dist/cli/status.d.ts.map +1 -0
  111. package/dist/cli/status.js +207 -0
  112. package/dist/cli/status.js.map +1 -0
  113. package/dist/cli/stop.d.ts +13 -0
  114. package/dist/cli/stop.d.ts.map +1 -0
  115. package/dist/cli/stop.js +18 -0
  116. package/dist/cli/stop.js.map +1 -0
  117. package/dist/cli/sync.d.ts +6 -0
  118. package/dist/cli/sync.d.ts.map +1 -0
  119. package/dist/cli/sync.js +31 -0
  120. package/dist/cli/sync.js.map +1 -0
  121. package/dist/cli/tail.d.ts +6 -0
  122. package/dist/cli/tail.d.ts.map +1 -0
  123. package/dist/cli/tail.js +170 -0
  124. package/dist/cli/tail.js.map +1 -0
  125. package/dist/cli/telemetry.d.ts +2 -0
  126. package/dist/cli/telemetry.d.ts.map +1 -0
  127. package/dist/cli/telemetry.js +42 -0
  128. package/dist/cli/telemetry.js.map +1 -0
  129. package/dist/cli/verify-hooks.d.ts +12 -0
  130. package/dist/cli/verify-hooks.d.ts.map +1 -0
  131. package/dist/cli/verify-hooks.js +38 -0
  132. package/dist/cli/verify-hooks.js.map +1 -0
  133. package/dist/cli/worker.d.ts +2 -0
  134. package/dist/cli/worker.d.ts.map +1 -0
  135. package/dist/cli/worker.js +211 -0
  136. package/dist/cli/worker.js.map +1 -0
  137. package/dist/kshetra/config.d.ts +64 -0
  138. package/dist/kshetra/config.d.ts.map +1 -0
  139. package/dist/kshetra/config.js +173 -0
  140. package/dist/kshetra/config.js.map +1 -0
  141. package/dist/kshetra/registry.d.ts +5 -0
  142. package/dist/kshetra/registry.d.ts.map +1 -0
  143. package/dist/kshetra/registry.js +69 -0
  144. package/dist/kshetra/registry.js.map +1 -0
  145. package/dist/kshetra/state.d.ts +57 -0
  146. package/dist/kshetra/state.d.ts.map +1 -0
  147. package/dist/kshetra/state.js +195 -0
  148. package/dist/kshetra/state.js.map +1 -0
  149. package/dist/kshetra/toolchain.d.ts +20 -0
  150. package/dist/kshetra/toolchain.d.ts.map +1 -0
  151. package/dist/kshetra/toolchain.js +146 -0
  152. package/dist/kshetra/toolchain.js.map +1 -0
  153. package/dist/phalaka/api.d.ts +123 -0
  154. package/dist/phalaka/api.d.ts.map +1 -0
  155. package/dist/phalaka/api.js +196 -0
  156. package/dist/phalaka/api.js.map +1 -0
  157. package/dist/phalaka/beads-read.d.ts +49 -0
  158. package/dist/phalaka/beads-read.d.ts.map +1 -0
  159. package/dist/phalaka/beads-read.js +174 -0
  160. package/dist/phalaka/beads-read.js.map +1 -0
  161. package/dist/phalaka/pid.d.ts +6 -0
  162. package/dist/phalaka/pid.d.ts.map +1 -0
  163. package/dist/phalaka/pid.js +48 -0
  164. package/dist/phalaka/pid.js.map +1 -0
  165. package/dist/phalaka/server.d.ts +10 -0
  166. package/dist/phalaka/server.d.ts.map +1 -0
  167. package/dist/phalaka/server.js +30 -0
  168. package/dist/phalaka/server.js.map +1 -0
  169. package/dist/phalaka/token.d.ts +5 -0
  170. package/dist/phalaka/token.d.ts.map +1 -0
  171. package/dist/phalaka/token.js +40 -0
  172. package/dist/phalaka/token.js.map +1 -0
  173. package/dist/phalaka/ui.d.ts +15 -0
  174. package/dist/phalaka/ui.d.ts.map +1 -0
  175. package/dist/phalaka/ui.js +233 -0
  176. package/dist/phalaka/ui.js.map +1 -0
  177. package/dist/sthapathi/activity-log.d.ts +68 -0
  178. package/dist/sthapathi/activity-log.d.ts.map +1 -0
  179. package/dist/sthapathi/activity-log.js +57 -0
  180. package/dist/sthapathi/activity-log.js.map +1 -0
  181. package/dist/sthapathi/beads.d.ts +27 -0
  182. package/dist/sthapathi/beads.d.ts.map +1 -0
  183. package/dist/sthapathi/beads.js +153 -0
  184. package/dist/sthapathi/beads.js.map +1 -0
  185. package/dist/sthapathi/branch.d.ts +5 -0
  186. package/dist/sthapathi/branch.d.ts.map +1 -0
  187. package/dist/sthapathi/branch.js +20 -0
  188. package/dist/sthapathi/branch.js.map +1 -0
  189. package/dist/sthapathi/dispatch.d.ts +14 -0
  190. package/dist/sthapathi/dispatch.d.ts.map +1 -0
  191. package/dist/sthapathi/dispatch.js +326 -0
  192. package/dist/sthapathi/dispatch.js.map +1 -0
  193. package/dist/sthapathi/errors.d.ts +27 -0
  194. package/dist/sthapathi/errors.d.ts.map +1 -0
  195. package/dist/sthapathi/errors.js +174 -0
  196. package/dist/sthapathi/errors.js.map +1 -0
  197. package/dist/sthapathi/gh.d.ts +19 -0
  198. package/dist/sthapathi/gh.d.ts.map +1 -0
  199. package/dist/sthapathi/gh.js +69 -0
  200. package/dist/sthapathi/gh.js.map +1 -0
  201. package/dist/sthapathi/git.d.ts +41 -0
  202. package/dist/sthapathi/git.d.ts.map +1 -0
  203. package/dist/sthapathi/git.js +199 -0
  204. package/dist/sthapathi/git.js.map +1 -0
  205. package/dist/sthapathi/guard.d.ts +24 -0
  206. package/dist/sthapathi/guard.d.ts.map +1 -0
  207. package/dist/sthapathi/guard.js +64 -0
  208. package/dist/sthapathi/guard.js.map +1 -0
  209. package/dist/sthapathi/health.d.ts +23 -0
  210. package/dist/sthapathi/health.d.ts.map +1 -0
  211. package/dist/sthapathi/health.js +142 -0
  212. package/dist/sthapathi/health.js.map +1 -0
  213. package/dist/sthapathi/index.d.ts +21 -0
  214. package/dist/sthapathi/index.d.ts.map +1 -0
  215. package/dist/sthapathi/index.js +88 -0
  216. package/dist/sthapathi/index.js.map +1 -0
  217. package/dist/sthapathi/lifecycle.d.ts +7 -0
  218. package/dist/sthapathi/lifecycle.d.ts.map +1 -0
  219. package/dist/sthapathi/lifecycle.js +43 -0
  220. package/dist/sthapathi/lifecycle.js.map +1 -0
  221. package/dist/sthapathi/lint.d.ts +8 -0
  222. package/dist/sthapathi/lint.d.ts.map +1 -0
  223. package/dist/sthapathi/lint.js +33 -0
  224. package/dist/sthapathi/lint.js.map +1 -0
  225. package/dist/sthapathi/merge.d.ts +18 -0
  226. package/dist/sthapathi/merge.d.ts.map +1 -0
  227. package/dist/sthapathi/merge.js +259 -0
  228. package/dist/sthapathi/merge.js.map +1 -0
  229. package/dist/sthapathi/notifications.d.ts +14 -0
  230. package/dist/sthapathi/notifications.d.ts.map +1 -0
  231. package/dist/sthapathi/notifications.js +57 -0
  232. package/dist/sthapathi/notifications.js.map +1 -0
  233. package/dist/sthapathi/parikshaka-dispatch.d.ts +12 -0
  234. package/dist/sthapathi/parikshaka-dispatch.d.ts.map +1 -0
  235. package/dist/sthapathi/parikshaka-dispatch.js +0 -0
  236. package/dist/sthapathi/parikshaka-dispatch.js.map +1 -0
  237. package/dist/sthapathi/pickup.d.ts +13 -0
  238. package/dist/sthapathi/pickup.d.ts.map +1 -0
  239. package/dist/sthapathi/pickup.js +144 -0
  240. package/dist/sthapathi/pickup.js.map +1 -0
  241. package/dist/sthapathi/recover.d.ts +16 -0
  242. package/dist/sthapathi/recover.d.ts.map +1 -0
  243. package/dist/sthapathi/recover.js +149 -0
  244. package/dist/sthapathi/recover.js.map +1 -0
  245. package/dist/sthapathi/retry.d.ts +11 -0
  246. package/dist/sthapathi/retry.d.ts.map +1 -0
  247. package/dist/sthapathi/retry.js +42 -0
  248. package/dist/sthapathi/retry.js.map +1 -0
  249. package/dist/sthapathi/self-heal.d.ts +19 -0
  250. package/dist/sthapathi/self-heal.d.ts.map +1 -0
  251. package/dist/sthapathi/self-heal.js +46 -0
  252. package/dist/sthapathi/self-heal.js.map +1 -0
  253. package/dist/sthapathi/types.d.ts +56 -0
  254. package/dist/sthapathi/types.d.ts.map +1 -0
  255. package/dist/sthapathi/types.js +4 -0
  256. package/dist/sthapathi/types.js.map +1 -0
  257. package/dist/sthapathi/watchdog.d.ts +27 -0
  258. package/dist/sthapathi/watchdog.d.ts.map +1 -0
  259. package/dist/sthapathi/watchdog.js +145 -0
  260. package/dist/sthapathi/watchdog.js.map +1 -0
  261. package/dist/telemetry/telemetry.d.ts +42 -0
  262. package/dist/telemetry/telemetry.d.ts.map +1 -0
  263. package/dist/telemetry/telemetry.js +189 -0
  264. package/dist/telemetry/telemetry.js.map +1 -0
  265. package/dist/test-setup.d.ts +2 -0
  266. package/dist/test-setup.d.ts.map +1 -0
  267. package/dist/test-setup.js +16 -0
  268. package/dist/test-setup.js.map +1 -0
  269. package/package.json +71 -0
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runParikshaka = runParikshaka;
4
+ const errors_js_1 = require("../sthapathi/errors.js");
5
+ const runner_js_1 = require("./runner.js");
6
+ // Hard guarantee that Parikshaka never mutates the repo: the file-writing tools
7
+ // are denied at the CLI level (the prompt boundary is belt-and-suspenders). If
8
+ // it can't write a file, it can't leave the working tree dirty.
9
+ const PARIKSHAKA_DISALLOWED_TOOLS = ['Write', 'Edit', 'MultiEdit', 'NotebookEdit'];
10
+ const PARIKSHAKA_OUTPUT_SCHEMA = {
11
+ type: 'object',
12
+ properties: {
13
+ coverageGaps: {
14
+ type: 'array',
15
+ items: {
16
+ type: 'object',
17
+ properties: {
18
+ feature: { type: 'string' },
19
+ description: { type: 'string' },
20
+ priority: { type: 'number' },
21
+ },
22
+ required: ['feature', 'description', 'priority'],
23
+ },
24
+ },
25
+ },
26
+ required: ['coverageGaps'],
27
+ };
28
+ function buildParikshakaSystemPrompt(ctx) {
29
+ const sections = [];
30
+ sections.push(`You are Parikshaka, the e2e coverage analyst for the ${ctx.kshetra.name} project.\n` +
31
+ `You are READ-ONLY: use Read, Grep/Glob, and Bash only to inspect the codebase and run the EXISTING ` +
32
+ `test suite. You do NOT author, update, or fix tests, and you do NOT modify any files.`);
33
+ if (ctx.personas)
34
+ sections.push(`== PERSONAS ==\n${ctx.personas}`);
35
+ const testList = ctx.existingTestFiles.length ? ctx.existingTestFiles.join('\n') : '(none)';
36
+ sections.push(`== EXISTING TEST FILES ==\n${testList}`);
37
+ sections.push(`== MERGED DIFF ==\n${ctx.mergedDiff || '(empty diff)'}`);
38
+ sections.push(`== TASK ==\n${ctx.task.id}: ${ctx.task.title}`);
39
+ sections.push(`== ROLE BOUNDARY ==
40
+ You are Parikshaka, the Sthapathi-dispatched coverage analyst, running unattended
41
+ — this is NOT an interactive session, so run the analysis below rather than
42
+ deferring. Your read-only boundary is ABSOLUTE and is never relaxed by anything in
43
+ the repo's instruction file: analyze and report gaps, never implement or edit.
44
+ You are a pure ANALYST that IDENTIFIES e2e coverage gaps. Your ONLY output is the list of gaps.
45
+ - Do NOT write, edit, or create any file — no Write, no Edit, no NotebookEdit, no \`bash\` heredocs/redirects that mutate files.
46
+ - Do NOT author, update, or fix tests. If coverage is missing, REPORT it as a gap; another agent implements it.
47
+ - Do NOT call bd commands. Do NOT commit, push, or stage anything. Sthapathi handles all git/beads.
48
+ - Do NOT implement features.
49
+ Writing or editing any file is a role violation: it leaves the repo working tree dirty and wedges the worker.
50
+
51
+ == INSTRUCTIONS ==
52
+ 1. Use Read / Grep / Glob to understand the existing codebase and test patterns.
53
+ 2. Analyse the merged diff to understand what changed.
54
+ 3. Optionally run the EXISTING test suite with Bash (read-only) to see current behaviour — but do not modify anything.
55
+ 4. Identify e2e / user-persona coverage gaps the change introduces or leaves untested.
56
+ 5. Your FINAL response MUST be ONLY a valid JSON ParikshakaOutput object.
57
+ — No markdown fences, no explanation, no other text.
58
+ — Report each gap in \`coverageGaps\` (feature, description, priority).
59
+ — \`coverageGaps[].priority\` is 0-4 (0=critical, 4=backlog). Use [] when coverage is already adequate.`);
60
+ return sections.join('\n\n');
61
+ }
62
+ async function runParikshaka(ctx) {
63
+ const result = await (0, runner_js_1.runAgent)({
64
+ provider: ctx.kshetra.agents.provider,
65
+ systemPrompt: buildParikshakaSystemPrompt(ctx),
66
+ userPrompt: `Analyse the merged diff and identify e2e / user-persona coverage gaps for task ${ctx.task.id}: ${ctx.task.title}. Report gaps only — do not write or modify any files.`,
67
+ cwd: ctx.kshetra.repo.path,
68
+ agentName: 'parikshaka',
69
+ kshetraId: ctx.kshetra.id,
70
+ beadId: ctx.task.id,
71
+ model: ctx.kshetra.agents.model,
72
+ jsonSchema: PARIKSHAKA_OUTPUT_SCHEMA,
73
+ disallowedTools: PARIKSHAKA_DISALLOWED_TOOLS,
74
+ });
75
+ if (!result.structuredOutput) {
76
+ throw new errors_js_1.ParseError(`Parikshaka: no structured output — resultText: ${(result.resultText ?? '').slice(0, 200)}`, null);
77
+ }
78
+ return result.structuredOutput;
79
+ }
80
+ //# sourceMappingURL=parikshaka.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parikshaka.js","sourceRoot":"","sources":["../../src/agents/parikshaka.ts"],"names":[],"mappings":";;AAgFA,sCAsBC;AApGD,sDAAo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URL=claude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/agents/providers/claude.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgC,eAAe,EAAgB,MAAM,YAAY,CAAC;AAa9F,eAAO,MAAM,aAAa,EAAE,eA4F3B,CAAC"}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.claudeAdapter = void 0;
4
+ const types_js_1 = require("./types.js");
5
+ // Anthropic — the `claude` CLI in print mode with stream-json output. This is
6
+ // the reference adapter: validated against `claude --help`.
7
+ //
8
+ // Native execution (the agent-execution design §3.1): the CLI loads the Kshetra's own
9
+ // project config — `--setting-sources project` pulls in `.claude/` (skills,
10
+ // rules, subagents, MCP) and `CLAUDE.md`, and `--append-system-prompt` layers
11
+ // Shreni's dynamic per-run prompt ON TOP of Claude Code's native scaffolding
12
+ // instead of replacing it. Shreni no longer reads-and-injects the instruction
13
+ // file or repo skills; the injection flip (dispatch.ts) drops that content so it
14
+ // is not double-loaded.
15
+ exports.claudeAdapter = {
16
+ name: 'anthropic',
17
+ buildSpawn(opts) {
18
+ const args = [
19
+ '-p',
20
+ '--output-format', 'stream-json',
21
+ // --verbose is mandatory when combining --print with stream-json output;
22
+ // the claude CLI rejects the pair otherwise and exits 1 with no result.
23
+ '--verbose',
24
+ '--permission-mode', 'bypassPermissions',
25
+ // Layer Shreni's prompt on top of the repo's native config (see header).
26
+ '--append-system-prompt', opts.systemPrompt,
27
+ '--no-session-persistence',
28
+ '--setting-sources', 'project',
29
+ '--model', opts.model,
30
+ '--json-schema', JSON.stringify(opts.jsonSchema),
31
+ ];
32
+ // Hard tool block (e.g. read-only Parikshaka): bypassPermissions grants every
33
+ // tool, so a deny list is the only way to keep the agent from writing files.
34
+ // Comma-separated; placed before the positional prompt.
35
+ if (opts.disallowedTools && opts.disallowedTools.length > 0) {
36
+ args.push('--disallowedTools', opts.disallowedTools.join(','));
37
+ }
38
+ args.push(opts.userPrompt);
39
+ return {
40
+ bin: (0, types_js_1.resolveBin)('SHRENI_CLAUDE_BIN', 'claude'),
41
+ args,
42
+ env: { CLAUDE_CODE_ENTRYPOINT: 'sdk-ts' },
43
+ };
44
+ },
45
+ createParser(opts, emit) {
46
+ let resultMsg = null;
47
+ let toolCallCount = 0;
48
+ return {
49
+ onLine(line) {
50
+ let msg;
51
+ try {
52
+ msg = JSON.parse(line);
53
+ }
54
+ catch {
55
+ return;
56
+ }
57
+ const type = msg['type'];
58
+ if (type === 'assistant') {
59
+ const message = (msg['message'] ?? {});
60
+ const content = message['content'] ?? [];
61
+ for (const block of content) {
62
+ if (block['type'] === 'text') {
63
+ const text = block['text'];
64
+ if (text.trim())
65
+ emit.text((text.split('\n').find(l => l.trim()) ?? text).slice(0, 120));
66
+ }
67
+ else if (block['type'] === 'tool_use') {
68
+ toolCallCount++;
69
+ const name = block['name'];
70
+ const input = (block['input'] ?? {});
71
+ emit.toolCall(name, (0, types_js_1.toolDetail)(name, input));
72
+ }
73
+ }
74
+ }
75
+ if (type === 'result') {
76
+ resultMsg = {
77
+ result: msg['result'] ?? null,
78
+ structured_output: msg['structured_output'] ?? null,
79
+ is_error: msg['is_error'] ?? false,
80
+ };
81
+ }
82
+ },
83
+ finalize(exitCode, stderrTail) {
84
+ if (resultMsg) {
85
+ if (resultMsg.is_error) {
86
+ throw new Error(`${opts.agentName}: agent returned error — ${resultMsg.result ?? '(no message)'}`);
87
+ }
88
+ return {
89
+ structuredOutput: resultMsg.structured_output,
90
+ resultText: resultMsg.result,
91
+ toolCallCount,
92
+ };
93
+ }
94
+ throw new Error(`${opts.agentName}: process exited with code ${exitCode ?? '?'} without a result message` +
95
+ (stderrTail ? ` — stderr: ${stderrTail}` : ''));
96
+ },
97
+ };
98
+ },
99
+ };
100
+ //# sourceMappingURL=claude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../../src/agents/providers/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AK,QAAQ,EAAE,CAAC;oBACtB,SAAS,GAAG;wBACV,MAAM,EAAG,GAAG,CAAC,QAAQ,CAAmB,IAAI,IAAI;wBAChD,iBAAiB,EAAE,GAAG,CAAC,mBAAmB,CAAC,IAAI,IAAI;wBACnD,QAAQ,EAAG,GAAG,CAAC,UAAU,CAAa,IAAI,KAAK;qBAChD,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,QAAQ,CAAC,QAAuB,EAAE,UAAkB;gBAClD,IAAI,SAAS,EAAE,CAAC;oBACd,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;wBACvB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,4BAA4B,SAAS,CAAC,MAAM,IAAI,cAAc,EAAE,CAAC,CAAC;oBACrG,CAAC;oBACD,OAAO;wBACL,gBAAgB,EAAE,SAAS,CAAC,iBAAiB;wBAC7C,UAAU,EAAE,SAAS,CAAC,MAAM;wBAC5B,aAAa;qBACd,CAAC;gBACJ,CAAC;gBACD,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,CAAC,SAAS,8BAA8B,QAAQ,IAAI,GAAG,2BAA2B;oBACvF,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACjD,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ProviderAdapter } from './types.js';
2
+ export declare const codexAdapter: ProviderAdapter;
3
+ //# sourceMappingURL=codex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/agents/providers/codex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgC,eAAe,EAAgB,MAAM,YAAY,CAAC;AA8B9F,eAAO,MAAM,YAAY,EAAE,eAqG1B,CAAC"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.codexAdapter = void 0;
4
+ const types_js_1 = require("./types.js");
5
+ // OpenAI — the `codex` CLI in non-interactive exec mode.
6
+ // codex exec --json --dangerously-bypass-approvals-and-sandbox \
7
+ // --skip-git-repo-check -m <model> "<prompt>"
8
+ // Verified against `codex exec --help` and live JSONL output (CLI installed
9
+ // locally). If codex isn't on PATH, set SHRENI_CODEX_BIN to its full path.
10
+ //
11
+ // Event stream (`--json` prints JSONL); the shapes we rely on:
12
+ // {"type":"thread.started","thread_id":"..."}
13
+ // {"type":"turn.started"}
14
+ // {"type":"item.started","item":{"type":"command_execution","command":"...","status":"in_progress"}}
15
+ // {"type":"item.completed","item":{"type":"command_execution","command":"...","exit_code":0,"status":"completed"}}
16
+ // {"type":"item.completed","item":{"type":"agent_message","text":"..."}}
17
+ // {"type":"turn.completed","usage":{...}}
18
+ // {"type":"error","message":"..."} (top-level failure)
19
+ // {"type":"turn.failed","error":{"message":"..."}}
20
+ // {"type":"item.completed","item":{"type":"error","message":"..."}}
21
+ //
22
+ // No inline structured-output flag is used (codex has --output-schema <FILE>,
23
+ // but we keep parity with the other adapters): the shared agent system prompts
24
+ // require a JSON-only final message, recovered from the last agent_message.
25
+ //
26
+ // Native execution (the agent-execution design §3.1): `codex exec` already loads the
27
+ // repo's own config — `AGENTS.md` and `~/.codex/config.toml` — because we do NOT
28
+ // disable it (unlike the old hermetic Claude run). So codex loads its native
29
+ // instruction file for free; Shreni's prompt is a prepended append-style
30
+ // preamble to the user task, and the injection flip (dispatch.ts) already dropped
31
+ // the repo skills/instruction-file/conventions content so it is not double-loaded.
32
+ exports.codexAdapter = {
33
+ name: 'openai',
34
+ buildSpawn(opts) {
35
+ const prompt = `${opts.systemPrompt}\n\n=== TASK ===\n${opts.userPrompt}`;
36
+ // Tool restriction. codex has no per-tool deny list, so
37
+ // the equivalent of opts.disallowedTools is the sandbox mode:
38
+ // - read-only agents (Parikshaka passes Write/Edit here) run under
39
+ // `--sandbox read-only`, which blocks file writes/edits and command side
40
+ // effects while still allowing reads — enforcing the boundary the deny
41
+ // list expresses.
42
+ // - write agents (Silpi, no disallowedTools) run with sandbox + approvals
43
+ // bypassed so they can create/edit files and run commands unattended.
44
+ // (Based on documented `codex exec` flags; codex is not installed on all dev
45
+ // machines, so this path is covered by unit tests rather than a live run.)
46
+ const readOnly = !!opts.disallowedTools && opts.disallowedTools.length > 0;
47
+ const args = ['exec', '--json'];
48
+ if (readOnly) {
49
+ args.push('--sandbox', 'read-only');
50
+ }
51
+ else {
52
+ args.push('--dangerously-bypass-approvals-and-sandbox');
53
+ }
54
+ args.push('--skip-git-repo-check', '-m', opts.model, prompt);
55
+ return {
56
+ bin: (0, types_js_1.resolveBin)('SHRENI_CODEX_BIN', 'codex'),
57
+ args,
58
+ };
59
+ },
60
+ createParser(opts, emit) {
61
+ let lastAssistantText = null;
62
+ let toolCallCount = 0;
63
+ let errorMessage = null;
64
+ return {
65
+ onLine(line) {
66
+ let ev;
67
+ try {
68
+ ev = JSON.parse(line);
69
+ }
70
+ catch {
71
+ return; // non-JSON noise (e.g. "Reading additional input from stdin...")
72
+ }
73
+ const type = String(ev['type'] ?? '');
74
+ if (type === 'error') {
75
+ errorMessage = String(ev['message'] ?? 'unknown error');
76
+ return;
77
+ }
78
+ if (type === 'turn.failed') {
79
+ const err = (ev['error'] ?? {});
80
+ errorMessage = String(err['message'] ?? 'turn failed');
81
+ return;
82
+ }
83
+ if (type === 'item.started' || type === 'item.completed') {
84
+ const item = (ev['item'] ?? {});
85
+ const itemType = String(item['type'] ?? '');
86
+ if (itemType === 'agent_message' && type === 'item.completed') {
87
+ const text = typeof item['text'] === 'string' ? item['text'] : '';
88
+ if (text.trim()) {
89
+ lastAssistantText = text;
90
+ emit.text((text.split('\n').find(l => l.trim()) ?? text).slice(0, 120));
91
+ }
92
+ }
93
+ else if (itemType === 'command_execution' && type === 'item.started') {
94
+ // Count once, on start, so started+completed isn't double-counted.
95
+ toolCallCount++;
96
+ emit.toolCall('shell', (0, types_js_1.toolDetail)('shell', item));
97
+ }
98
+ else if (itemType === 'error') {
99
+ errorMessage = String(item['message'] ?? 'item error');
100
+ }
101
+ }
102
+ },
103
+ finalize(exitCode, stderrTail) {
104
+ // Surface codex errors so the dispatcher's transient-retry logic can act
105
+ // on rate-limit / overloaded / 5xx messages.
106
+ if (errorMessage) {
107
+ throw new Error(`${opts.agentName}: codex error — ${errorMessage}`);
108
+ }
109
+ const structuredOutput = (0, types_js_1.extractLastJsonObject)(lastAssistantText ?? '');
110
+ if (structuredOutput == null && exitCode !== 0) {
111
+ throw new Error(`${opts.agentName}: codex exited with code ${exitCode ?? '?'} and no parseable JSON` +
112
+ (stderrTail ? ` — stderr: ${stderrTail}` : ''));
113
+ }
114
+ return {
115
+ structuredOutput,
116
+ resultText: lastAssistantText,
117
+ toolCallCount,
118
+ };
119
+ },
120
+ };
121
+ },
122
+ };
123
+ //# sourceMappingURL=codex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/agents/providers/codex.ts"],"names":[],"mappings":";;;AACA,yCAA2E;AAE3E,yDAAyD;AACzD,mEAAmE;AACnE,2DAA2D;AAC3D,4EAA4E;AAC5E,2EAA2E;AAC3E,EAAE;AACF,+DAA+D;AAC/D,gDAAgD;AAChD,4BAA4B;AAC5B,uGAAuG;AACvG,qHAAqH;AACrH,2EAA2E;AAC3E,4CAA4C;AAC5C,+EAA+E;AAC/E,qDAAqD;AACrD,sEAAsE;AACtE,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,EAAE;AACF,qFAAqF;AACrF,iFAAiF;AACjF,6EAA6E;AAC7E,yEAAyE;AACzE,kFAAkF;AAClF,mFAAmF;AACtE,QAAA,YAAY,GAAoB;IAC3C,IAAI,EAAE,QAAQ;IAEd,UAAU,CAAC,IAAqB;QAC9B,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,qBAAqB,IAAI,CAAC,UAAU,EAAE,CAAC;QAE1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AAO,EAAE,IAAA,qBAAU,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;oBACpD,CAAC;yBAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;wBAChC,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,CAAC;oBACzD,CAAC;gBACH,CAAC;YACH,CAAC;YAED,QAAQ,CAAC,QAAuB,EAAE,UAAkB;gBAClD,yEAAyE;gBACzE,6CAA6C;gBAC7C,IAAI,YAAY,EAAE,CAAC;oBACjB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,mBAAmB,YAAY,EAAE,CAAC,CAAC;gBACtE,CAAC;gBAED,MAAM,gBAAgB,GAAG,IAAA,gCAAqB,EAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;gBAExE,IAAI,gBAAgB,IAAI,IAAI,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;oBAC/C,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,CAAC,SAAS,4BAA4B,QAAQ,IAAI,GAAG,wBAAwB;wBAClF,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACjD,CAAC;gBACJ,CAAC;gBAED,OAAO;oBACL,gBAAgB;oBAChB,UAAU,EAAE,iBAAiB;oBAC7B,aAAa;iBACd,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ProviderAdapter } from './types.js';
2
+ export declare const geminiAdapter: ProviderAdapter;
3
+ //# sourceMappingURL=gemini.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../src/agents/providers/gemini.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgC,eAAe,EAAgB,MAAM,YAAY,CAAC;AAwB9F,eAAO,MAAM,aAAa,EAAE,eAkE3B,CAAC"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.geminiAdapter = void 0;
4
+ const types_js_1 = require("./types.js");
5
+ // Google — the `gemini` CLI in non-interactive (headless) mode.
6
+ // gemini -m <model> -y -o json -p "<prompt>"
7
+ // Verified against `gemini --help` (CLI installed locally):
8
+ // * `-p/--prompt <text>` is REQUIRED for headless mode; a bare positional
9
+ // query launches interactive mode instead.
10
+ // * `-y` (--yolo) auto-approves all tool actions (Bash/file edits).
11
+ // * No `--system-prompt` flag, so the system prompt is folded into `-p`.
12
+ // * `-o json` returns a single wrapper object at the end:
13
+ // success -> { session_id, response: "<text>", stats: {...} }
14
+ // error -> { session_id, error: { type, message, code } }
15
+ // We surface `error.message` (so the dispatcher can retry transients) and
16
+ // recover the structured output JSON from `response`.
17
+ // * `-o stream-json` also exists and would give richer per-tool streaming;
18
+ // left as a future enhancement (its event shape isn't pinned down here).
19
+ //
20
+ // Native execution (the agent-execution design §3.1): `gemini -p` already loads the
21
+ // repo's own config — `GEMINI.md` and `.gemini/settings.json` — because we do
22
+ // NOT disable it. So Gemini loads its native instruction file for free; Shreni's
23
+ // prompt is a prepended append-style preamble to the user task, and the injection
24
+ // flip (dispatch.ts) already dropped the repo skills/instruction-file/conventions
25
+ // content so it is not double-loaded.
26
+ exports.geminiAdapter = {
27
+ name: 'gemini',
28
+ buildSpawn(opts) {
29
+ const prompt = `${opts.systemPrompt}\n\n=== TASK ===\n${opts.userPrompt}`;
30
+ // Tool restriction. The gemini CLI has no per-tool deny
31
+ // list (`--allowed-tools` is deprecated), so the equivalent of
32
+ // opts.disallowedTools is the approval mode:
33
+ // - read-only agents (Parikshaka passes Write/Edit here) run under
34
+ // `--approval-mode plan`, the CLI's read-only mode, which withholds all
35
+ // edit/write tools — enforcing the boundary the deny list expresses.
36
+ // - write agents (Silpi, no disallowedTools) run with `-y` (yolo), which
37
+ // auto-approves every tool action so they can edit files unattended.
38
+ const readOnly = !!opts.disallowedTools && opts.disallowedTools.length > 0;
39
+ const restriction = readOnly ? ['--approval-mode', 'plan'] : ['-y'];
40
+ return {
41
+ bin: (0, types_js_1.resolveBin)('SHRENI_GEMINI_BIN', 'gemini'),
42
+ args: ['-m', opts.model, ...restriction, '-o', 'json', '-p', prompt],
43
+ };
44
+ },
45
+ createParser(opts, _emit) {
46
+ let buf = '';
47
+ return {
48
+ onLine(line) {
49
+ buf += line + '\n';
50
+ },
51
+ finalize(exitCode, stderrTail) {
52
+ const wrapper = (0, types_js_1.extractLastJsonObject)(buf);
53
+ // Surface gemini's own error so the dispatcher's transient-retry logic
54
+ // can inspect the message (rate limit / overloaded / etc.).
55
+ if (wrapper && wrapper.error) {
56
+ const message = typeof wrapper.error.message === 'string' ? wrapper.error.message : 'unknown error';
57
+ throw new Error(`${opts.agentName}: gemini error — ${message}`);
58
+ }
59
+ // json mode wraps the answer under `response`; if absent, fall back to
60
+ // the raw buffer.
61
+ const responseText = wrapper && typeof wrapper.response === 'string' ? wrapper.response : buf;
62
+ const structuredOutput = (0, types_js_1.extractLastJsonObject)(responseText);
63
+ if (structuredOutput == null && exitCode !== 0) {
64
+ throw new Error(`${opts.agentName}: gemini exited with code ${exitCode ?? '?'} and no parseable JSON` +
65
+ (stderrTail ? ` — stderr: ${stderrTail}` : ''));
66
+ }
67
+ _emit.text('[gemini run complete]');
68
+ return {
69
+ structuredOutput,
70
+ resultText: typeof responseText === 'string' ? responseText : null,
71
+ toolCallCount: 0,
72
+ };
73
+ },
74
+ };
75
+ },
76
+ };
77
+ //# sourceMappingURL=gemini.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../src/agents/providers/gemini.ts"],"names":[],"mappings":";;;AACA,yCAA+D;AAE/D,gEAAgE;AAChE,+CAA+C;AAC/C,4DAA4D;AAC5D,4EAA4E;AAC5E,+CAA+C;AAC/C,sEAAsE;AACtE,2EAA2E;AAC3E,4DAA4D;AAC5D,oEAAoE;AAC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I,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;oBAC7B,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;oBACpG,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,oBAAoB,OAAO,EAAE,CAAC,CAAC;gBAClE,CAAC;gBAED,uEAAuE;gBACvE,kBAAkB;gBAClB,MAAM,YAAY,GAChB,OAAO,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;gBAE3E,MAAM,gBAAgB,GAAG,IAAA,gCAAqB,EAAC,YAAY,CAAC,CAAC;gBAE7D,IAAI,gBAAgB,IAAI,IAAI,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;oBAC/C,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,CAAC,SAAS,6BAA6B,QAAQ,IAAI,GAAG,wBAAwB;wBACnF,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACjD,CAAC;gBACJ,CAAC;gBAED,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;gBACpC,OAAO;oBACL,gBAAgB;oBAChB,UAAU,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI;oBAClE,aAAa,EAAE,CAAC;iBACjB,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Provider, ProviderAdapter } from './types.js';
2
+ export declare function getAdapter(provider: Provider): ProviderAdapter;
3
+ export type { Provider, ProviderAdapter };
4
+ export * from './types.js';
5
+ export * from './registry.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAW5D,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe,CAM9D;AAED,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,35 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.getAdapter = getAdapter;
18
+ const claude_js_1 = require("./claude.js");
19
+ const gemini_js_1 = require("./gemini.js");
20
+ const codex_js_1 = require("./codex.js");
21
+ const ADAPTERS = {
22
+ anthropic: claude_js_1.claudeAdapter,
23
+ gemini: gemini_js_1.geminiAdapter,
24
+ openai: codex_js_1.codexAdapter,
25
+ };
26
+ function getAdapter(provider) {
27
+ const adapter = ADAPTERS[provider];
28
+ if (!adapter) {
29
+ throw new Error(`Unknown agent provider: ${provider}. Expected one of: ${Object.keys(ADAPTERS).join(', ')}`);
30
+ }
31
+ return adapter;
32
+ }
33
+ __exportStar(require("./types.js"), exports);
34
+ __exportStar(require("./registry.js"), exports);
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/providers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAWA,gCAMC;AAhBD,2CAA4C;AAC5C,2CAA4C;AAC5C,yCAA0C;AAE1C,MAAM,QAAQ,GAAsC;IAClD,SAAS,EAAE,yBAAa;IACxB,MAAM,EAAE,yBAAa;IACrB,MAAM,EAAE,uBAAY;CACrB,CAAC;AAEF,SAAgB,UAAU,CAAC,QAAkB;IAC3C,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,2BAA2B,QAAQ,sBAAsB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/G,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAGD,6CAA2B;AAC3B,gDAA8B"}
@@ -0,0 +1,20 @@
1
+ import type { Provider } from './types.js';
2
+ export interface ProviderInfo {
3
+ cliName: string;
4
+ instructionFile: string;
5
+ binEnvVar: string;
6
+ defaultBin: string;
7
+ defaultModel: string | null;
8
+ installCmd: string;
9
+ docsUrl: string;
10
+ experimental: boolean;
11
+ }
12
+ export declare const PROVIDER_REGISTRY: Record<Provider, ProviderInfo>;
13
+ export declare const PROVIDER_CLI_NAMES: string[];
14
+ export declare function providerFromCliName(name: string): Provider;
15
+ export declare function providerInstructionFile(provider: Provider): string;
16
+ export declare function providerDefaultModel(provider: Provider): string | null;
17
+ export declare function providerRequiresExplicitModel(provider: Provider): boolean;
18
+ export declare function providerIsExperimental(provider: Provider): boolean;
19
+ export declare function providerBin(provider: Provider): string;
20
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/agents/providers/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQ3C,MAAM,WAAW,YAAY;IAG3B,OAAO,EAAE,MAAM,CAAC;IAEhB,eAAe,EAAE,MAAM,CAAC;IAExB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IAInB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAKhB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,QAAQ,EAAE,YAAY,CAiC5D,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,MAAM,EAAyD,CAAC;AAIjG,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAU1D;AAaD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAElE;AAID,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAEtE;AAID,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEzE;AAKD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAElE;AAID,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAGtD"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROVIDER_CLI_NAMES = exports.PROVIDER_REGISTRY = void 0;
4
+ exports.providerFromCliName = providerFromCliName;
5
+ exports.providerInstructionFile = providerInstructionFile;
6
+ exports.providerDefaultModel = providerDefaultModel;
7
+ exports.providerRequiresExplicitModel = providerRequiresExplicitModel;
8
+ exports.providerIsExperimental = providerIsExperimental;
9
+ exports.providerBin = providerBin;
10
+ const types_js_1 = require("./types.js");
11
+ exports.PROVIDER_REGISTRY = {
12
+ anthropic: {
13
+ cliName: 'claude',
14
+ instructionFile: 'CLAUDE.md',
15
+ binEnvVar: 'SHRENI_CLAUDE_BIN',
16
+ defaultBin: 'claude',
17
+ defaultModel: 'claude-sonnet-4-6',
18
+ installCmd: 'npm install -g @anthropic-ai/claude-code',
19
+ docsUrl: 'https://docs.anthropic.com/en/docs/claude-code/overview',
20
+ experimental: false,
21
+ },
22
+ openai: {
23
+ cliName: 'codex',
24
+ instructionFile: 'AGENTS.md',
25
+ binEnvVar: 'SHRENI_CODEX_BIN',
26
+ defaultBin: 'codex',
27
+ // OQ1: unconfirmed — require agents.model on select.
28
+ defaultModel: null,
29
+ installCmd: 'npm install -g @openai/codex',
30
+ docsUrl: 'https://github.com/openai/codex',
31
+ experimental: true,
32
+ },
33
+ gemini: {
34
+ cliName: 'gemini',
35
+ instructionFile: 'GEMINI.md',
36
+ binEnvVar: 'SHRENI_GEMINI_BIN',
37
+ defaultBin: 'gemini',
38
+ // OQ1: unconfirmed — require agents.model on select.
39
+ defaultModel: null,
40
+ installCmd: 'npm install -g @google/gemini-cli',
41
+ docsUrl: 'https://github.com/google-gemini/gemini-cli',
42
+ experimental: true,
43
+ },
44
+ };
45
+ // CLI-facing provider names in a stable order (claude first = default).
46
+ exports.PROVIDER_CLI_NAMES = Object.values(exports.PROVIDER_REGISTRY).map(i => i.cliName);
47
+ // Resolve a CLI-facing name (claude|codex|gemini) to the internal Provider enum.
48
+ // Throws with the valid set on an unknown name — the init hard-fail path (§3.5).
49
+ function providerFromCliName(name) {
50
+ const key = name.trim().toLowerCase();
51
+ const match = Object.entries(exports.PROVIDER_REGISTRY)
52
+ .find(([, info]) => info.cliName === key);
53
+ if (!match) {
54
+ throw new Error(`Invalid provider "${name}". Valid providers: ${exports.PROVIDER_CLI_NAMES.join(', ')}.`);
55
+ }
56
+ return match[0];
57
+ }
58
+ function providerInfo(provider) {
59
+ const info = exports.PROVIDER_REGISTRY[provider];
60
+ if (!info) {
61
+ throw new Error(`Unknown agent provider: ${provider}. Expected one of: ${Object.keys(exports.PROVIDER_REGISTRY).join(', ')}`);
62
+ }
63
+ return info;
64
+ }
65
+ // The instruction file the provider's CLI loads natively (§3.2 write side).
66
+ function providerInstructionFile(provider) {
67
+ return providerInfo(provider).instructionFile;
68
+ }
69
+ // The default model for a provider, or null when none can be baked in (OQ1).
70
+ // A null return means the caller MUST supply agents.model explicitly.
71
+ function providerDefaultModel(provider) {
72
+ return providerInfo(provider).defaultModel;
73
+ }
74
+ // True when the provider has no bakeable default model, so init must prompt for
75
+ // (or require) agents.model rather than fall back (OQ1).
76
+ function providerRequiresExplicitModel(provider) {
77
+ return providerInfo(provider).defaultModel === null;
78
+ }
79
+ // True for providers whose adapter is draft/untested (Codex/Gemini). Init warns
80
+ // before using one so a first-run user isn't silently dropped onto an unfinished
81
+ // path; the Claude adapter is the supported default.
82
+ function providerIsExperimental(provider) {
83
+ return providerInfo(provider).experimental;
84
+ }
85
+ // Resolve the CLI binary for a provider, honouring its SHRENI_*_BIN override.
86
+ // Shares resolveBin with the adapters so overrides behave identically.
87
+ function providerBin(provider) {
88
+ const info = providerInfo(provider);
89
+ return (0, types_js_1.resolveBin)(info.binEnvVar, info.defaultBin);
90
+ }
91
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/agents/providers/registry.ts"],"names":[],"mappings":";;;AAwEA,kDAUC;AAaD,0DAEC;AAID,oDAEC;AAID,sEAEC;AAKD,wDAEC;AAID,kCAGC;AA1HD,yCAAwC;AA+B3B,QAAA,iBAAiB,GAAmC;IAC/D,SAAS,EAAE;QACT,OAAO,EAAE,QAAQ;QACjB,eAAe,EAAE,WAAW;QAC5B,SAAS,EAAE,mBAAmB;QAC9B,UAAU,EAAE,QAAQ;QACpB,YAAY,EAAE,mBAAmB;QACjC,UAAU,EAAE,0CAA0C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