thoth-agents 0.11.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 (68) 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-5WPP6IY7.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-DNPKVFOB.js → chunk-NY2IPJ7V.js} +78 -87
  9. package/dist/{chunk-HACUJFKI.js → chunk-QOA2AETX.js} +2 -228
  10. package/dist/{chunk-I5TXGNSG.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/hooks/delegate-task-retry/hook.d.ts +8 -8
  29. package/dist/hooks/foreground-fallback/index.d.ts +14 -69
  30. package/dist/hooks/index.d.ts +0 -2
  31. package/dist/hooks/json-error-recovery/hook.d.ts +2 -15
  32. package/dist/hooks/oracle-gate-verdict/hook.d.ts +4 -11
  33. package/dist/index.d.ts +7 -4
  34. package/dist/index.js +822 -1421
  35. package/dist/opencode/agents.d.ts +3 -0
  36. package/dist/opencode/command.d.ts +3 -0
  37. package/dist/opencode/context.d.ts +20 -0
  38. package/dist/opencode/delegation-hooks.d.ts +3 -0
  39. package/dist/opencode/mcp.d.ts +3 -0
  40. package/dist/opencode/permission-rules.d.ts +9 -0
  41. package/dist/opencode/permissions.d.ts +3 -0
  42. package/dist/opencode/session-hooks.d.ts +3 -0
  43. package/dist/opencode/session-state.d.ts +39 -0
  44. package/dist/opencode/skills.d.ts +3 -0
  45. package/dist/opencode/tools.d.ts +3 -0
  46. package/dist/pi.js +3 -3
  47. package/dist/tools/ast-grep/cli.d.ts +1 -0
  48. package/dist/tools/ast-grep/index.d.ts +108 -2
  49. package/dist/tools/ast-grep/tools.d.ts +107 -3
  50. package/dist/tools/define-tool.d.ts +23 -0
  51. package/dist/tools/lsp/tools.d.ts +97 -5
  52. package/dist/utils/index.d.ts +0 -1
  53. package/package.json +14 -3
  54. package/plugin/.claude-plugin/plugin.json +1 -1
  55. package/plugin/.codex-plugin/plugin.json +1 -1
  56. package/plugin/skills/thoth-sdd/SKILL.md +8 -2
  57. package/plugin/skills/thoth-sdd/scripts/validate-result.mjs +28 -2
  58. package/skills/thoth-sdd/SKILL.md +8 -2
  59. package/skills/thoth-sdd/scripts/validate-result.mjs +28 -2
  60. package/thoth-agents.schema.json +0 -26
  61. package/dist/chunk-62L3ORXN.js +0 -30
  62. package/dist/delegation/project-id.d.ts +0 -10
  63. package/dist/hooks/auto-update-checker/checker.d.ts +0 -23
  64. package/dist/hooks/auto-update-checker/constants.d.ts +0 -11
  65. package/dist/hooks/auto-update-checker/index.d.ts +0 -17
  66. package/dist/hooks/auto-update-checker/types.d.ts +0 -22
  67. package/dist/utils/tmux-session-manager.d.ts +0 -63
  68. package/dist/utils/tmux.d.ts +0 -32
@@ -122,12 +122,38 @@ function checkExpectations(options, issue) {
122
122
  );
123
123
  }
124
124
 
125
+ const isFenceLine = (line) => /^(?:`{3,}|~{3,})/.test(line);
126
+ const isVerdictLine = (line) => line.startsWith('thoth-gate-verdict ');
127
+
128
+ function unwrapSubagent(message, lines) {
129
+ if (!message.startsWith('<subagent ')) return message;
130
+ if (lines.at(-1) !== '</subagent>') return '';
131
+ const opener = lines.lastIndexOf('```thoth-result');
132
+ if (opener < 1) return '';
133
+ const header = lines.slice(0, opener).join('\n').trimEnd();
134
+ // Native descriptions are interpolated verbatim, not escaped attributes.
135
+ // Only structural lines and the completed-state marker are authoritative.
136
+ if (
137
+ !header.includes('state="completed"') ||
138
+ lines
139
+ .slice(0, opener)
140
+ .some((line) => isFenceLine(line) || isVerdictLine(line))
141
+ )
142
+ return '';
143
+ return lines.slice(opener, -1).join('\n').trim();
144
+ }
145
+
125
146
  function parseEnvelope(message) {
126
- const trimmed = typeof message === 'string' ? message.trim() : '';
147
+ const complete = typeof message === 'string' ? message.trim() : '';
148
+ const lines = complete.split(/\r\n|\r|\n/);
149
+ // Check structural lines in the complete delivery, including the header.
150
+ const singleEnvelope =
151
+ lines.filter(isFenceLine).length === 2 && !lines.some(isVerdictLine);
152
+ const trimmed = singleEnvelope ? unwrapSubagent(complete, lines) : '';
127
153
  const block = new RegExp(
128
154
  `^\`\`\`${contract.fence}\\r?\\n([\\s\\S]*?)\\r?\\n\`\`\`$`,
129
155
  ).exec(trimmed);
130
- if (!block || (trimmed.match(/^```.*$/gm) ?? []).length !== 2) {
156
+ if (!block) {
131
157
  return {
132
158
  issues: [
133
159
  {
@@ -298,32 +298,6 @@
298
298
  "type": "string"
299
299
  }
300
300
  },
301
- "tmux": {
302
- "type": "object",
303
- "properties": {
304
- "enabled": {
305
- "default": false,
306
- "type": "boolean"
307
- },
308
- "layout": {
309
- "default": "main-vertical",
310
- "type": "string",
311
- "enum": [
312
- "main-horizontal",
313
- "main-vertical",
314
- "tiled",
315
- "even-horizontal",
316
- "even-vertical"
317
- ]
318
- },
319
- "main_pane_size": {
320
- "default": 60,
321
- "type": "number",
322
- "minimum": 20,
323
- "maximum": 80
324
- }
325
- }
326
- },
327
301
  "fallback": {
328
302
  "type": "object",
329
303
  "properties": {
@@ -1,30 +0,0 @@
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
- export {
25
- CONTEXT7_MCP_URL,
26
- context7,
27
- exa,
28
- GREP_APP_MCP_URL,
29
- grep_app
30
- };
@@ -1,10 +0,0 @@
1
- import type { PluginInput } from '@opencode-ai/plugin';
2
- interface ProjectIdOptions {
3
- worktreeDirectory: string;
4
- projectName?: string;
5
- shell?: PluginInput['$'];
6
- timeoutMs?: number;
7
- }
8
- export declare function getProjectId(directory: string, timeoutMs?: number, projectName?: string, shell?: PluginInput['$']): Promise<string | null>;
9
- export declare function getProjectId(options: ProjectIdOptions): Promise<string | null>;
10
- export {};
@@ -1,23 +0,0 @@
1
- import type { PluginEntryInfo } from './types';
2
- /**
3
- * Extracts the update channel (latest, alpha, beta, etc.) from a version string.
4
- * @param version The version or tag to analyze.
5
- * @returns The channel name.
6
- */
7
- export declare function extractChannel(version: string | null): string;
8
- /**
9
- * Resolves the version of the plugin when running in local development mode.
10
- */
11
- export declare function getLocalDevVersion(directory: string): string | null;
12
- /**
13
- * Searches across all config locations to find the current installation entry for this plugin.
14
- */
15
- export declare function findPluginEntry(directory: string): PluginEntryInfo | null;
16
- /**
17
- * Resolves the installed version from node_modules, with memoization.
18
- */
19
- export declare function getCachedVersion(): string | null;
20
- /**
21
- * Fetches the latest version for a specific channel from the NPM registry.
22
- */
23
- export declare function getLatestVersion(channel?: string): Promise<string | null>;
@@ -1,11 +0,0 @@
1
- export declare const PACKAGE_NAME = "thoth-agents";
2
- export declare const NPM_REGISTRY_URL = "https://registry.npmjs.org/-/package/thoth-agents/dist-tags";
3
- export declare const NPM_FETCH_TIMEOUT = 5000;
4
- /** The directory used by OpenCode to cache node_modules for plugins. */
5
- export declare const CACHE_DIR: string;
6
- /** Path to this plugin's package.json within the OpenCode cache. */
7
- export declare const INSTALLED_PACKAGE_JSON: string;
8
- /** Primary OpenCode configuration file path (standard JSON). */
9
- export declare const USER_OPENCODE_CONFIG: string;
10
- /** Alternative OpenCode configuration file path (JSON with Comments). */
11
- export declare const USER_OPENCODE_CONFIG_JSONC: string;
@@ -1,17 +0,0 @@
1
- import type { PluginInput } from '@opencode-ai/plugin';
2
- import type { AutoUpdateCheckerOptions } from './types';
3
- /**
4
- * Creates an OpenCode hook that checks for plugin updates when a new session is created.
5
- * @param ctx The plugin input context.
6
- * @param options Configuration options for the update checker.
7
- * @returns A hook object for the session.created event.
8
- */
9
- export declare function createAutoUpdateCheckerHook(ctx: PluginInput, options?: AutoUpdateCheckerOptions): {
10
- event: ({ event }: {
11
- event: {
12
- type: string;
13
- properties?: unknown;
14
- };
15
- }) => void;
16
- };
17
- export type { AutoUpdateCheckerOptions } from './types';
@@ -1,22 +0,0 @@
1
- export interface NpmDistTags {
2
- latest: string;
3
- [key: string]: string;
4
- }
5
- export interface OpencodeConfig {
6
- plugin?: string[];
7
- [key: string]: unknown;
8
- }
9
- export interface PackageJson {
10
- version: string;
11
- name?: string;
12
- [key: string]: unknown;
13
- }
14
- export interface AutoUpdateCheckerOptions {
15
- showStartupToast?: boolean;
16
- }
17
- export interface PluginEntryInfo {
18
- entry: string;
19
- isPinned: boolean;
20
- pinnedVersion: string | null;
21
- configPath: string;
22
- }
@@ -1,63 +0,0 @@
1
- import type { PluginInput } from '@opencode-ai/plugin';
2
- import type { TmuxConfig } from '../config/schema';
3
- /**
4
- * Event shape for session events
5
- */
6
- interface SessionEvent {
7
- type: string;
8
- properties?: {
9
- info?: {
10
- id?: string;
11
- parentID?: string;
12
- title?: string;
13
- };
14
- sessionID?: string;
15
- status?: {
16
- type: string;
17
- };
18
- };
19
- }
20
- /**
21
- * TmuxSessionManager tracks child sessions and spawns/closes tmux panes for them.
22
- *
23
- * Uses session.status events for completion detection instead of polling.
24
- */
25
- export declare class TmuxSessionManager {
26
- private client;
27
- private tmuxConfig;
28
- private serverUrl;
29
- private sessions;
30
- private pollInterval?;
31
- private enabled;
32
- constructor(ctx: PluginInput, tmuxConfig: TmuxConfig);
33
- /**
34
- * Handle session.created events.
35
- * Spawns a tmux pane for child sessions (those with parentID).
36
- */
37
- onSessionCreated(event: SessionEvent): Promise<void>;
38
- /**
39
- * Handle session.status events for completion detection.
40
- * Uses session.status instead of deprecated session.idle.
41
- *
42
- * When a session becomes idle (completed), close its pane.
43
- */
44
- onSessionStatus(event: SessionEvent): Promise<void>;
45
- /**
46
- * Handle session.deleted events.
47
- * When a session is deleted, close its tmux pane immediately.
48
- */
49
- onSessionDeleted(event: SessionEvent): Promise<void>;
50
- private startPolling;
51
- private stopPolling;
52
- /**
53
- * Poll sessions for status updates (fallback for reliability).
54
- * Also handles timeout and missing session detection.
55
- */
56
- private pollSessions;
57
- private closeSession;
58
- /**
59
- * Clean up all tracked sessions.
60
- */
61
- cleanup(): Promise<void>;
62
- }
63
- export {};
@@ -1,32 +0,0 @@
1
- import type { TmuxConfig } from '../config/schema';
2
- /**
3
- * Reset the server availability cache (useful when server might have started)
4
- */
5
- export declare function resetServerCheck(): void;
6
- /**
7
- * Get cached tmux path, initializing if needed
8
- */
9
- export declare function getTmuxPath(): Promise<string | null>;
10
- /**
11
- * Check if we're running inside tmux
12
- */
13
- export declare function isInsideTmux(): boolean;
14
- export interface SpawnPaneResult {
15
- success: boolean;
16
- paneId?: string;
17
- }
18
- /**
19
- * Spawn a new tmux pane running `opencode attach <serverUrl> --session <sessionId>`
20
- * This connects the new TUI to the existing server so it receives streaming updates.
21
- * After spawning, applies the configured layout to auto-rebalance all panes.
22
- * Returns the pane ID so it can be closed later.
23
- */
24
- export declare function spawnTmuxPane(sessionId: string, description: string, config: TmuxConfig, serverUrl: string): Promise<SpawnPaneResult>;
25
- /**
26
- * Close a tmux pane by its ID and reapply layout to rebalance remaining panes
27
- */
28
- export declare function closeTmuxPane(paneId: string): Promise<boolean>;
29
- /**
30
- * Start background check for tmux availability
31
- */
32
- export declare function startTmuxCheck(): void;