thoth-agents 0.10.0 → 0.12.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 (101) hide show
  1. package/README.md +5 -3
  2. package/dist/agents/agent-config.d.ts +13 -0
  3. package/dist/agents/index.d.ts +1 -1
  4. package/dist/agents/orchestrator.d.ts +1 -1
  5. package/dist/{chunk-VHQMTZ5O.js → chunk-7F33WUSD.js} +1 -1
  6. package/dist/{chunk-RWQPMWEM.js → chunk-JLU3FSBT.js} +17 -2
  7. package/dist/chunk-MIDGZE34.js +107 -0
  8. package/dist/{chunk-RVQ6IIBR.js → chunk-NY2IPJ7V.js} +361 -118
  9. package/dist/{chunk-RN2ERZLZ.js → chunk-QOA2AETX.js} +2 -228
  10. package/dist/{chunk-6NZTNWI4.js → chunk-SEF6PFM6.js} +504 -211
  11. package/dist/cli/config-io.d.ts +2 -2
  12. package/dist/cli/index.js +92 -39
  13. package/dist/cli/install.d.ts +1 -0
  14. package/dist/cli/opencode-skill-consent.d.ts +5 -0
  15. package/dist/cli/operations/opencode.d.ts +2 -1
  16. package/dist/cli/operations/types.d.ts +1 -0
  17. package/dist/cli/owned-skills.d.ts +16 -0
  18. package/dist/cli/paths.d.ts +1 -1
  19. package/dist/cli/providers.d.ts +1 -1
  20. package/dist/cli/system.d.ts +3 -1
  21. package/dist/cli/thoth-mem-install.d.ts +10 -10
  22. package/dist/cli/tui/index.js +53 -5
  23. package/dist/cli/tui/operations.d.ts +2 -0
  24. package/dist/cli/types.d.ts +2 -4
  25. package/dist/config/loader.d.ts +1 -1
  26. package/dist/config/schema.d.ts +0 -31
  27. package/dist/harness/adapters/opencode.d.ts +1 -1
  28. package/dist/harness/core/agent-pack.d.ts +1 -0
  29. package/dist/harness/core/sdd.d.ts +6 -6
  30. package/dist/hooks/delegate-task-retry/hook.d.ts +8 -8
  31. package/dist/hooks/foreground-fallback/index.d.ts +14 -69
  32. package/dist/hooks/index.d.ts +0 -2
  33. package/dist/hooks/json-error-recovery/hook.d.ts +2 -15
  34. package/dist/hooks/oracle-gate-verdict/hook.d.ts +4 -11
  35. package/dist/index.d.ts +7 -4
  36. package/dist/index.js +822 -1421
  37. package/dist/opencode/agents.d.ts +3 -0
  38. package/dist/opencode/command.d.ts +3 -0
  39. package/dist/opencode/context.d.ts +20 -0
  40. package/dist/opencode/delegation-hooks.d.ts +3 -0
  41. package/dist/opencode/mcp.d.ts +3 -0
  42. package/dist/opencode/permission-rules.d.ts +9 -0
  43. package/dist/opencode/permissions.d.ts +3 -0
  44. package/dist/opencode/session-hooks.d.ts +3 -0
  45. package/dist/opencode/session-state.d.ts +39 -0
  46. package/dist/opencode/skills.d.ts +3 -0
  47. package/dist/opencode/tools.d.ts +3 -0
  48. package/dist/pi.js +3 -3
  49. package/dist/tools/ast-grep/cli.d.ts +1 -0
  50. package/dist/tools/ast-grep/index.d.ts +108 -2
  51. package/dist/tools/ast-grep/tools.d.ts +107 -3
  52. package/dist/tools/define-tool.d.ts +23 -0
  53. package/dist/tools/lsp/tools.d.ts +97 -5
  54. package/dist/utils/index.d.ts +0 -1
  55. package/package.json +14 -3
  56. package/pi/.thoth-agents-assets.json +2 -2
  57. package/pi/agents/thoth-designer.md +1 -1
  58. package/pi/agents/thoth-worker.md +1 -1
  59. package/plugin/.claude-plugin/.thoth-agents-plugin-assets.json +3 -3
  60. package/plugin/.claude-plugin/plugin.json +1 -1
  61. package/plugin/.codex-plugin/.thoth-agents-plugin-assets.json +3 -3
  62. package/plugin/.codex-plugin/plugin.json +1 -1
  63. package/plugin/agents/designer.md +1 -1
  64. package/plugin/agents/orchestrator.md +32 -32
  65. package/plugin/agents/worker.md +1 -1
  66. package/plugin/codex-hooks/payloads/designer.md +1 -1
  67. package/plugin/codex-hooks/payloads/root.md +32 -32
  68. package/plugin/codex-hooks/payloads/worker.md +1 -1
  69. package/plugin/skills/plan-reviewer/SKILL.md +5 -5
  70. package/plugin/skills/thoth-sdd/SKILL.md +33 -9
  71. package/plugin/skills/thoth-sdd/references/phases/checklist.md +1 -1
  72. package/plugin/skills/thoth-sdd/references/phases/clarify.md +1 -1
  73. package/plugin/skills/thoth-sdd/references/phases/converge.md +8 -1
  74. package/plugin/skills/thoth-sdd/references/phases/implement.md +5 -1
  75. package/plugin/skills/thoth-sdd/references/phases/plan.md +1 -1
  76. package/plugin/skills/thoth-sdd/references/phases/specify.md +1 -1
  77. package/plugin/skills/thoth-sdd/references/phases/tasks.md +1 -1
  78. package/plugin/skills/thoth-sdd/references/phases/verify.md +10 -3
  79. package/plugin/skills/thoth-sdd/scripts/validate-result.mjs +28 -2
  80. package/plugin/skills/thoth-sdd/templates/change.md +2 -1
  81. package/skills/plan-reviewer/SKILL.md +5 -5
  82. package/skills/thoth-sdd/SKILL.md +33 -9
  83. package/skills/thoth-sdd/references/phases/checklist.md +1 -1
  84. package/skills/thoth-sdd/references/phases/clarify.md +1 -1
  85. package/skills/thoth-sdd/references/phases/converge.md +8 -1
  86. package/skills/thoth-sdd/references/phases/implement.md +5 -1
  87. package/skills/thoth-sdd/references/phases/plan.md +1 -1
  88. package/skills/thoth-sdd/references/phases/specify.md +1 -1
  89. package/skills/thoth-sdd/references/phases/tasks.md +1 -1
  90. package/skills/thoth-sdd/references/phases/verify.md +10 -3
  91. package/skills/thoth-sdd/scripts/validate-result.mjs +28 -2
  92. package/skills/thoth-sdd/templates/change.md +2 -1
  93. package/thoth-agents.schema.json +0 -26
  94. package/dist/chunk-62L3ORXN.js +0 -30
  95. package/dist/delegation/project-id.d.ts +0 -10
  96. package/dist/hooks/auto-update-checker/checker.d.ts +0 -23
  97. package/dist/hooks/auto-update-checker/constants.d.ts +0 -11
  98. package/dist/hooks/auto-update-checker/index.d.ts +0 -17
  99. package/dist/hooks/auto-update-checker/types.d.ts +0 -22
  100. package/dist/utils/tmux-session-manager.d.ts +0 -63
  101. package/dist/utils/tmux.d.ts +0 -32
@@ -16,7 +16,7 @@ import {
16
16
  loadAgentPrompt,
17
17
  renderAgentRoutingDescription,
18
18
  renderRolePrompt
19
- } from "./chunk-RVQ6IIBR.js";
19
+ } from "./chunk-NY2IPJ7V.js";
20
20
 
21
21
  // src/agents/designer.ts
22
22
  var DESIGNER_PROMPT = renderRolePrompt(
@@ -455,234 +455,8 @@ var opencodeAdapter = {
455
455
  }
456
456
  };
457
457
 
458
- // src/utils/subprocess.ts
459
- import {
460
- spawn as nodeSpawn,
461
- spawnSync as nodeSpawnSync
462
- } from "child_process";
463
- import { Readable } from "stream";
464
- function emptyReadableStream() {
465
- return new ReadableStream({
466
- start(controller) {
467
- controller.close();
468
- }
469
- });
470
- }
471
- function toWebReadable(stream) {
472
- if (!stream) {
473
- return emptyReadableStream();
474
- }
475
- return Readable.toWeb(
476
- stream
477
- );
478
- }
479
- function fallbackStdin() {
480
- return {
481
- write: () => void 0,
482
- end: () => void 0
483
- };
484
- }
485
- function spawn(command, options = {}) {
486
- const child = nodeSpawn(command[0], command.slice(1), {
487
- cwd: options.cwd,
488
- env: options.env,
489
- stdio: [
490
- options.stdin ?? "pipe",
491
- options.stdout ?? "pipe",
492
- options.stderr ?? "pipe"
493
- ],
494
- shell: options.shell,
495
- windowsHide: options.windowsHide ?? true
496
- });
497
- const managed = {
498
- stdin: child.stdin ?? fallbackStdin(),
499
- stdout: toWebReadable(child.stdout),
500
- stderr: toWebReadable(child.stderr),
501
- exited: new Promise((resolve) => {
502
- child.on("exit", (code) => {
503
- managed.exitCode = code;
504
- resolve(code ?? 1);
505
- });
506
- child.on("error", () => {
507
- managed.exitCode = 1;
508
- resolve(1);
509
- });
510
- }),
511
- exitCode: child.exitCode,
512
- kill: () => {
513
- child.kill();
514
- }
515
- };
516
- return managed;
517
- }
518
- function spawnSync(command, options = {}) {
519
- const result = nodeSpawnSync(command[0], command.slice(1), {
520
- cwd: options.cwd,
521
- env: options.env,
522
- stdio: [
523
- options.stdin ?? "ignore",
524
- options.stdout ?? "pipe",
525
- options.stderr ?? "pipe"
526
- ],
527
- shell: options.shell,
528
- windowsHide: options.windowsHide ?? true
529
- });
530
- return { exitCode: result.status };
531
- }
532
-
533
- // src/cli/system.ts
534
- import { statSync } from "fs";
535
- var cachedOpenCodePath = null;
536
- var OPENCODE_PROBE_TIMEOUT_MS = 1500;
537
- function quoteWindowsShellCommand(command) {
538
- if (!/[\s&()^<>"|]/.test(command)) {
539
- return command;
540
- }
541
- return `"${command.replace(/"/g, '\\"')}"`;
542
- }
543
- function getOpenCodeVersionInvocation(opencodePath, platform = process.platform) {
544
- const options = {
545
- stdout: "pipe",
546
- stderr: "pipe"
547
- };
548
- if (platform === "win32") {
549
- return {
550
- command: [`${quoteWindowsShellCommand(opencodePath)} --version`],
551
- options: { ...options, shell: true }
552
- };
553
- }
554
- return { command: [opencodePath, "--version"], options };
555
- }
556
- function getOpenCodePaths() {
557
- const home = process.env.HOME || process.env.USERPROFILE || "";
558
- return [
559
- // PATH (try this first)
560
- "opencode",
561
- // User local installations (Linux & macOS)
562
- `${home}/.local/bin/opencode`,
563
- `${home}/.opencode/bin/opencode`,
564
- `${home}/bin/opencode`,
565
- // System-wide installations
566
- "/usr/local/bin/opencode",
567
- "/opt/opencode/bin/opencode",
568
- "/usr/bin/opencode",
569
- "/bin/opencode",
570
- // macOS specific
571
- "/Applications/OpenCode.app/Contents/MacOS/opencode",
572
- `${home}/Applications/OpenCode.app/Contents/MacOS/opencode`,
573
- // Homebrew (macOS & Linux)
574
- "/opt/homebrew/bin/opencode",
575
- "/home/linuxbrew/.linuxbrew/bin/opencode",
576
- `${home}/homebrew/bin/opencode`,
577
- // macOS user Library
578
- `${home}/Library/Application Support/opencode/bin/opencode`,
579
- // Snap (Linux)
580
- "/snap/bin/opencode",
581
- "/var/snap/opencode/current/bin/opencode",
582
- // Flatpak (Linux)
583
- "/var/lib/flatpak/exports/bin/ai.opencode.OpenCode",
584
- `${home}/.local/share/flatpak/exports/bin/ai.opencode.OpenCode`,
585
- // Nix (Linux/macOS)
586
- "/nix/store/opencode/bin/opencode",
587
- `${home}/.nix-profile/bin/opencode`,
588
- "/run/current-system/sw/bin/opencode",
589
- // Cargo (Rust toolchain)
590
- `${home}/.cargo/bin/opencode`,
591
- // npm/npx global
592
- `${home}/.npm-global/bin/opencode`,
593
- "/usr/local/lib/node_modules/opencode/bin/opencode",
594
- // Yarn global
595
- `${home}/.yarn/bin/opencode`,
596
- // PNPM
597
- `${home}/.pnpm-global/bin/opencode`
598
- ];
599
- }
600
- function resolveOpenCodePath() {
601
- if (cachedOpenCodePath) {
602
- return cachedOpenCodePath;
603
- }
604
- const paths = getOpenCodePaths();
605
- for (const opencodePath of paths) {
606
- if (opencodePath === "opencode") continue;
607
- try {
608
- const stat = statSync(opencodePath);
609
- if (stat.isFile()) {
610
- cachedOpenCodePath = opencodePath;
611
- return opencodePath;
612
- }
613
- } catch {
614
- }
615
- }
616
- return "opencode";
617
- }
618
- async function isOpenCodeInstalled() {
619
- const paths = getOpenCodePaths();
620
- for (const opencodePath of paths) {
621
- try {
622
- const invocation = getOpenCodeVersionInvocation(opencodePath);
623
- const proc = spawn(invocation.command, {
624
- ...invocation.options,
625
- windowsHide: true
626
- });
627
- let timer;
628
- const timedOut = /* @__PURE__ */ Symbol("timeout");
629
- try {
630
- const outcome = await Promise.race([
631
- proc.exited.then(() => proc.exitCode),
632
- new Promise((resolve) => {
633
- timer = setTimeout(
634
- () => resolve(timedOut),
635
- OPENCODE_PROBE_TIMEOUT_MS
636
- );
637
- })
638
- ]);
639
- if (outcome === timedOut) {
640
- proc.kill();
641
- continue;
642
- }
643
- if (outcome === 0) {
644
- cachedOpenCodePath = opencodePath;
645
- return true;
646
- }
647
- } finally {
648
- if (timer) {
649
- clearTimeout(timer);
650
- }
651
- }
652
- } catch {
653
- }
654
- }
655
- return false;
656
- }
657
- async function getOpenCodeVersion() {
658
- const opencodePath = resolveOpenCodePath();
659
- try {
660
- const invocation = getOpenCodeVersionInvocation(opencodePath);
661
- const proc = spawn(invocation.command, {
662
- ...invocation.options,
663
- windowsHide: true
664
- });
665
- const output = await new Response(proc.stdout).text();
666
- await proc.exited;
667
- if (proc.exitCode === 0) {
668
- return output.trim();
669
- }
670
- } catch {
671
- }
672
- return null;
673
- }
674
- function getOpenCodePath() {
675
- const path = resolveOpenCodePath();
676
- return path === "opencode" ? null : path;
677
- }
678
-
679
458
  export {
680
459
  createAgents,
681
460
  renderOpenCodeAgentConfigs,
682
- opencodeAdapter,
683
- spawn,
684
- spawnSync,
685
- isOpenCodeInstalled,
686
- getOpenCodeVersion,
687
- getOpenCodePath
461
+ opencodeAdapter
688
462
  };