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
package/README.md CHANGED
@@ -46,7 +46,10 @@ verification you can follow—without manually coordinating every agent.
46
46
  - **Continuity between sessions.** Published installs include setup of
47
47
  [thoth-mem](https://github.com/EremesNG/thoth-mem), the independent memory
48
48
  companion for reusable decisions and project knowledge. thoth-mem owns its own
49
- memory lifecycle, persistence, and storage; thoth-agents only invokes its setup.
49
+ memory lifecycle, persistence, and storage; thoth-agents only invokes
50
+ `npx -y "thoth-mem@>=0.7.0" setup <harness> --json` (adding `--plan` for
51
+ dry-run). Only exit 0 with `planned` for dry-run or `complete` for apply is
52
+ successful; see [provider outcomes](docs/installation.md#thoth-mem-companion-setup).
50
53
 
51
54
  > [!NOTE]
52
55
  > OpenCode is the CLI's default harness. Pi is our recommendation for the best
@@ -62,7 +65,7 @@ The commands below install at **global/user scope**.
62
65
 
63
66
  | Harness | What you get | Install command |
64
67
  | --- | --- | --- |
65
- | <a href="https://github.com/anomalyco/opencode"><picture><source media="(prefers-color-scheme: dark)" srcset="https://svgl.app/library/opencode-dark.svg"><img src="https://svgl.app/library/opencode.svg" alt="OpenCode logo" width="48" height="48"></picture></a><br>**OpenCode** | Native plugin, agent team, workflow skills, and memory setup. | `npx thoth-agents@latest install --agent=opencode` |
68
+ | <a href="https://github.com/anomalyco/opencode"><picture><source media="(prefers-color-scheme: dark)" srcset="https://svgl.app/library/opencode-dark.svg"><img src="https://svgl.app/library/opencode.svg" alt="OpenCode logo" width="48" height="48"></picture></a><br>**OpenCode** | OpenCode >=2.2.6 native v2 plugin, package skills, agent team, and memory setup. | `npx thoth-agents@latest install --agent=opencode` |
66
69
  | <a href="https://github.com/openai/codex"><img src="https://github.com/openai.png?size=120" alt="OpenAI logo — Codex" width="48" height="48"></a><br>**Codex** | Native plugin plus the required global agent and instruction setup. **Close Codex first.** | `npx thoth-agents@latest install --agent=codex` |
67
70
  | <a href="https://claude.com/product/claude-code"><img src="https://github.com/anthropics.png?size=120" alt="Anthropic logo — Claude Code" width="48" height="48"></a><br>**Claude Code** | Marketplace agents and skills, completed by the CLI's external skills and memory setup. | `npx thoth-agents@latest install --agent=claude` |
68
71
  | <a href="https://github.com/earendil-works/pi"><img src="https://raw.githubusercontent.com/EremesNG/thoth-mem/master/img/pi.svg" alt="Pi logo" width="48" height="48"></a><br>**Pi** | Native package, five specialists, delegation, research, theme, sidebar and background-task extensions, workflow skills, and memory setup. **Recommended for the best experience.** | `npx thoth-agents@latest install --agent=pi` |
@@ -386,7 +389,6 @@ visible foreign-overlay focus. See [question controls](pi-packages/pi-questions-
386
389
  | [Codex Model Customization](docs/codex-model-customization.md) | Adjust Codex specialist models. |
387
390
  | [Claude Code Install](docs/claude-code-install.md) | Follow marketplace setup and activation. |
388
391
  | [Pi Setup](docs/installation.md#pi) | Check Pi dependencies, permissions, and recovery steps. |
389
- | [Tmux Integration](docs/tmux-integration.md) | Configure OpenCode's optional terminal-pane integration. |
390
392
 
391
393
  ### Technical guides
392
394
 
@@ -0,0 +1,13 @@
1
+ /** Internal role-rendering input; translated to the host's v2 Agent.Info at registration. */
2
+ export interface AgentConfig {
3
+ model?: string;
4
+ variant?: string;
5
+ temperature?: number;
6
+ prompt?: string;
7
+ description?: string;
8
+ mode?: 'primary' | 'subagent' | 'all';
9
+ hidden?: boolean;
10
+ color?: string;
11
+ steps?: number;
12
+ permission?: 'allow' | 'ask' | 'deny' | Record<string, 'allow' | 'ask' | 'deny' | Record<string, 'allow' | 'ask' | 'deny'>>;
13
+ }
@@ -1,5 +1,5 @@
1
- import type { AgentConfig as SDKAgentConfig } from '@opencode-ai/sdk/v2';
2
1
  import { type PluginConfig, SUBAGENT_NAMES } from '../config';
2
+ import type { AgentConfig as SDKAgentConfig } from './agent-config';
3
3
  import { type AgentDefinition } from './orchestrator';
4
4
  export type { AgentDefinition } from './orchestrator';
5
5
  export type SubagentName = (typeof SUBAGENT_NAMES)[number];
@@ -1,4 +1,4 @@
1
- import type { AgentConfig } from '@opencode-ai/sdk/v2';
1
+ import type { AgentConfig } from './agent-config';
2
2
  export interface AgentDefinition {
3
3
  name: string;
4
4
  description?: string;
@@ -19,7 +19,7 @@ import {
19
19
  renderAgentRoutingDescription,
20
20
  renderPromptSection,
21
21
  renderRolePrompt
22
- } from "./chunk-RVQ6IIBR.js";
22
+ } from "./chunk-NY2IPJ7V.js";
23
23
 
24
24
  // src/harness/writers/pi-agent.ts
25
25
  var PI_MANAGED_OWNER = "thoth-agents";
@@ -332,12 +332,27 @@ function checkExpectations(options, issue) {
332
332
  "Expected digest must be 64 lowercase hex characters."
333
333
  );
334
334
  }
335
+ var isFenceLine = (line) => /^(?:`{3,}|~{3,})/.test(line);
336
+ var isVerdictLine = (line) => line.startsWith("thoth-gate-verdict ");
337
+ function unwrapSubagent(message, lines) {
338
+ if (!message.startsWith("<subagent ")) return message;
339
+ if (lines.at(-1) !== "</subagent>") return "";
340
+ const opener = lines.lastIndexOf("```thoth-result");
341
+ if (opener < 1) return "";
342
+ const header = lines.slice(0, opener).join("\n").trimEnd();
343
+ if (!header.includes('state="completed"') || lines.slice(0, opener).some((line) => isFenceLine(line) || isVerdictLine(line)))
344
+ return "";
345
+ return lines.slice(opener, -1).join("\n").trim();
346
+ }
335
347
  function parseEnvelope(message) {
336
- const trimmed = typeof message === "string" ? message.trim() : "";
348
+ const complete = typeof message === "string" ? message.trim() : "";
349
+ const lines = complete.split(/\r\n|\r|\n/);
350
+ const singleEnvelope = lines.filter(isFenceLine).length === 2 && !lines.some(isVerdictLine);
351
+ const trimmed = singleEnvelope ? unwrapSubagent(complete, lines) : "";
337
352
  const block = new RegExp(
338
353
  `^\`\`\`${result_contract_default.fence}\\r?\\n([\\s\\S]*?)\\r?\\n\`\`\`$`
339
354
  ).exec(trimmed);
340
- if (!block || (trimmed.match(/^```.*$/gm) ?? []).length !== 2) {
355
+ if (!block) {
341
356
  return {
342
357
  issues: [
343
358
  {
@@ -0,0 +1,107 @@
1
+ // src/mcp/context7.ts
2
+ var CONTEXT7_MCP_URL = "https://mcp.context7.com/mcp";
3
+ var context7 = {
4
+ type: "remote",
5
+ url: CONTEXT7_MCP_URL,
6
+ headers: process.env.CONTEXT7_API_KEY ? { CONTEXT7_API_KEY: process.env.CONTEXT7_API_KEY } : void 0,
7
+ oauth: false
8
+ };
9
+
10
+ // src/mcp/exa.ts
11
+ var exa = {
12
+ type: "local",
13
+ command: ["npx", "-y", "exa-mcp-server"]
14
+ };
15
+
16
+ // src/mcp/grep-app.ts
17
+ var GREP_APP_MCP_URL = "https://mcp.grep.app";
18
+ var grep_app = {
19
+ type: "remote",
20
+ url: GREP_APP_MCP_URL,
21
+ oauth: false
22
+ };
23
+
24
+ // src/utils/subprocess.ts
25
+ import {
26
+ spawn as nodeSpawn,
27
+ spawnSync as nodeSpawnSync
28
+ } from "child_process";
29
+ import { Readable } from "stream";
30
+ function emptyReadableStream() {
31
+ return new ReadableStream({
32
+ start(controller) {
33
+ controller.close();
34
+ }
35
+ });
36
+ }
37
+ function toWebReadable(stream) {
38
+ if (!stream) {
39
+ return emptyReadableStream();
40
+ }
41
+ return Readable.toWeb(
42
+ stream
43
+ );
44
+ }
45
+ function fallbackStdin() {
46
+ return {
47
+ write: () => void 0,
48
+ end: () => void 0
49
+ };
50
+ }
51
+ function spawn(command, options = {}) {
52
+ const child = nodeSpawn(command[0], command.slice(1), {
53
+ cwd: options.cwd,
54
+ env: options.env,
55
+ stdio: [
56
+ options.stdin ?? "pipe",
57
+ options.stdout ?? "pipe",
58
+ options.stderr ?? "pipe"
59
+ ],
60
+ shell: options.shell,
61
+ windowsHide: options.windowsHide ?? true
62
+ });
63
+ const managed = {
64
+ stdin: child.stdin ?? fallbackStdin(),
65
+ stdout: toWebReadable(child.stdout),
66
+ stderr: toWebReadable(child.stderr),
67
+ exited: new Promise((resolve) => {
68
+ child.on("exit", (code) => {
69
+ managed.exitCode = code;
70
+ resolve(code ?? 1);
71
+ });
72
+ child.on("error", () => {
73
+ managed.exitCode = 1;
74
+ resolve(1);
75
+ });
76
+ }),
77
+ exitCode: child.exitCode,
78
+ kill: () => {
79
+ child.kill();
80
+ }
81
+ };
82
+ return managed;
83
+ }
84
+ function spawnSync(command, options = {}) {
85
+ const result = nodeSpawnSync(command[0], command.slice(1), {
86
+ cwd: options.cwd,
87
+ env: options.env,
88
+ stdio: [
89
+ options.stdin ?? "ignore",
90
+ options.stdout ?? "pipe",
91
+ options.stderr ?? "pipe"
92
+ ],
93
+ shell: options.shell,
94
+ windowsHide: options.windowsHide ?? true
95
+ });
96
+ return { exitCode: result.status };
97
+ }
98
+
99
+ export {
100
+ CONTEXT7_MCP_URL,
101
+ context7,
102
+ exa,
103
+ GREP_APP_MCP_URL,
104
+ grep_app,
105
+ spawn,
106
+ spawnSync
107
+ };