thoth-agents 0.1.19 → 0.2.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.
- package/README.md +41 -9
- package/dist/agents/prompt-dialects.d.ts +9 -0
- package/dist/{chunk-2SGSRR6L.js → chunk-3NOVCFN7.js} +61 -3
- package/dist/chunk-4WYCZ5Z7.js +698 -0
- package/dist/{chunk-7CTSLCEU.js → chunk-WH3F3GWE.js} +1461 -310
- package/dist/cli/claude-code-install.d.ts +53 -0
- package/dist/cli/claude-code-paths.d.ts +31 -0
- package/dist/cli/codex-install.d.ts +1 -5
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli/index.js +85 -27
- package/dist/cli/managed-state-io.d.ts +16 -0
- package/dist/cli/operations/claude-code.d.ts +21 -0
- package/dist/cli/tui/index.js +87 -9
- package/dist/cli/tui/operations.d.ts +2 -0
- package/dist/cli/types.d.ts +3 -3
- package/dist/config/index.d.ts +1 -1
- package/dist/config/schema.d.ts +11 -0
- package/dist/config/utils.d.ts +5 -0
- package/dist/harness/adapters/claude-code.d.ts +24 -0
- package/dist/harness/core/package-version.d.ts +7 -0
- package/dist/harness/types.d.ts +1 -1
- package/dist/harness/writers/claude-code-plugin-package.d.ts +32 -0
- package/dist/harness/writers/claude-code-skill-layout.d.ts +16 -0
- package/dist/harness/writers/claude-code-subagent.d.ts +26 -0
- package/dist/harness/writers/fs-skill-collect.d.ts +7 -0
- package/dist/index.js +4 -476
- package/package.json +1 -1
- package/thoth-agents.schema.json +16 -0
- package/dist/chunk-DYGVRAMS.js +0 -182
package/dist/config/utils.d.ts
CHANGED
|
@@ -8,3 +8,8 @@ import type { AgentOverrideConfig, PluginConfig } from './schema';
|
|
|
8
8
|
* @returns The agent-specific override configuration if found
|
|
9
9
|
*/
|
|
10
10
|
export declare function getAgentOverride(config: PluginConfig | undefined, name: string): AgentOverrideConfig | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Resolve the primary model id from an agent override `model` value, which may
|
|
13
|
+
* be a single id, an object with an `id`, or a failover array of either.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getPrimaryModelId(model: AgentOverrideConfig['model']): string | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type PluginConfig } from '../../config';
|
|
2
|
+
import type { HarnessAdapter, HarnessCapabilities, HarnessRenderContext } from '../types';
|
|
3
|
+
export interface ClaudeCodeRenderContext extends HarnessRenderContext {
|
|
4
|
+
config?: PluginConfig;
|
|
5
|
+
packageRoot?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const CLAUDE_CODE_CAPABILITIES: HarnessCapabilities;
|
|
8
|
+
export declare const CLAUDE_CODE_SUBAGENT_DEFAULT_MODELS: {
|
|
9
|
+
readonly explorer: "haiku";
|
|
10
|
+
readonly librarian: "sonnet";
|
|
11
|
+
readonly oracle: "opus";
|
|
12
|
+
readonly designer: "sonnet";
|
|
13
|
+
readonly quick: "haiku";
|
|
14
|
+
readonly deep: "sonnet";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The orchestrator system prompt body. This is the system prompt of the
|
|
18
|
+
* `orchestrator` plugin agent, which the plugin `settings.json` activates as the
|
|
19
|
+
* Claude Code main thread (`{"agent":"orchestrator"}`) — replacing the default
|
|
20
|
+
* system prompt entirely, which is far stronger than a SessionStart
|
|
21
|
+
* additionalContext injection.
|
|
22
|
+
*/
|
|
23
|
+
export declare function renderClaudeCodeRootInstructions(config?: PluginConfig): string;
|
|
24
|
+
export declare const claudeCodeAdapter: HarnessAdapter;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locate the thoth-agents root package.json by walking up from each candidate
|
|
3
|
+
* directory. Shared by harness adapters that stamp the package version into
|
|
4
|
+
* generated plugin manifests.
|
|
5
|
+
*/
|
|
6
|
+
export declare function findRootPackageJsonPath(startDirs: readonly string[]): string;
|
|
7
|
+
export declare function readPackageJsonVersion(packageJsonPath: string): string;
|
package/dist/harness/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type HarnessId = 'opencode' | 'codex';
|
|
1
|
+
export type HarnessId = 'opencode' | 'codex' | 'claude';
|
|
2
2
|
export type HarnessArtifactKind = 'agent-config' | 'harness-config' | 'mcp-config' | 'skill' | 'hook-config' | 'manifest' | 'documentation';
|
|
3
3
|
export type HarnessDiagnosticSeverity = 'info' | 'warning' | 'error';
|
|
4
4
|
export type HarnessDiagnosticCode = 'harness.unsupported' | 'harness.capability_gap' | 'harness.surface_unvalidated' | 'harness.artifact_skipped' | (string & {});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { HarnessArtifact, HarnessDiagnostic } from '../types';
|
|
2
|
+
export declare const CLAUDE_PLUGIN_MANIFEST_FIELDS: readonly ["name", "version", "description", "author"];
|
|
3
|
+
export interface ClaudeCodePluginAuthor {
|
|
4
|
+
name?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ClaudeCodePluginManifest {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
description: string;
|
|
12
|
+
author?: ClaudeCodePluginAuthor | string;
|
|
13
|
+
}
|
|
14
|
+
export interface ClaudeCodePluginPackageInput {
|
|
15
|
+
manifest: ClaudeCodePluginManifest;
|
|
16
|
+
/**
|
|
17
|
+
* Already-rendered plugin component artifacts (subagents, `.mcp.json`,
|
|
18
|
+
* `hooks/`, skills). Auto-discovered by Claude Code, so the manifest does not
|
|
19
|
+
* reference them; the writer records their provenance.
|
|
20
|
+
*/
|
|
21
|
+
componentArtifacts: HarnessArtifact[];
|
|
22
|
+
}
|
|
23
|
+
export interface ClaudeCodePluginPackageResult {
|
|
24
|
+
artifacts: HarnessArtifact[];
|
|
25
|
+
diagnostics: HarnessDiagnostic[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Assemble the Claude Code plugin package: the deterministic `plugin.json`
|
|
29
|
+
* manifest, an asset-provenance manifest, and the passed-through component
|
|
30
|
+
* artifacts (sorted by path). First-class — no surface-validation gate.
|
|
31
|
+
*/
|
|
32
|
+
export declare function renderClaudeCodePluginPackage(input: ClaudeCodePluginPackageInput): ClaudeCodePluginPackageResult;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SkillRegistryEntry } from '../core/skills';
|
|
2
|
+
import type { HarnessArtifact, HarnessDiagnostic } from '../types';
|
|
3
|
+
export interface ClaudeCodeSkillLayoutInput {
|
|
4
|
+
projectRoot: string;
|
|
5
|
+
packageRoot?: string;
|
|
6
|
+
skills: SkillRegistryEntry[];
|
|
7
|
+
}
|
|
8
|
+
export interface ClaudeCodeSkillLayoutResult {
|
|
9
|
+
artifacts: HarnessArtifact[];
|
|
10
|
+
diagnostics: HarnessDiagnostic[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Copy the bundled skill registry into the Claude Code plugin `skills/` layout.
|
|
14
|
+
* First-class: no surface gate. Records source provenance with content hashes.
|
|
15
|
+
*/
|
|
16
|
+
export declare function renderClaudeCodeSkillLayout(input: ClaudeCodeSkillLayoutInput): ClaudeCodeSkillLayoutResult;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ClaudeCodeModel = 'sonnet' | 'opus' | 'haiku' | 'inherit';
|
|
2
|
+
/** The model aliases Claude Code accepts in subagent frontmatter. */
|
|
3
|
+
export declare const CLAUDE_CODE_MODELS: readonly ["sonnet", "opus", "haiku", "inherit"];
|
|
4
|
+
export declare function isClaudeCodeModel(value: string): value is ClaudeCodeModel;
|
|
5
|
+
export interface ClaudeCodeSubagentInput {
|
|
6
|
+
/** Subagent name; also the `subagent_type` used by the Task tool. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** When the orchestrator should delegate to this subagent. */
|
|
9
|
+
description: string;
|
|
10
|
+
/**
|
|
11
|
+
* Comma-separated tool allowlist. This is the Claude Code mechanism that
|
|
12
|
+
* enforces role permissions (read-only vs write-capable). Omit to inherit all
|
|
13
|
+
* tools — used by the orchestrator main-thread agent, which must keep Task,
|
|
14
|
+
* AskUserQuestion, TodoWrite, MCP, and edit tools.
|
|
15
|
+
*/
|
|
16
|
+
tools?: string;
|
|
17
|
+
/** Per-role model alias for the subagent frontmatter. */
|
|
18
|
+
model: ClaudeCodeModel;
|
|
19
|
+
/** Rendered system prompt body (role prompt + governance). */
|
|
20
|
+
instructions: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Render a Claude Code subagent file: deterministic YAML frontmatter plus the
|
|
24
|
+
* markdown system-prompt body. Auto-discovered from a plugin `agents/` directory.
|
|
25
|
+
*/
|
|
26
|
+
export declare function renderClaudeCodeSubagent(input: ClaudeCodeSubagentInput): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function normalizeSkillPath(value: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* Recursively collect every file under a directory, sorted for deterministic
|
|
4
|
+
* output. Shared by harness skill-layout writers.
|
|
5
|
+
*/
|
|
6
|
+
export declare function collectSkillFiles(directory: string): string[];
|
|
7
|
+
export declare function sha256Hash(content: string | Uint8Array): string;
|
package/dist/index.js
CHANGED
|
@@ -1,496 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
+
createAgents,
|
|
3
|
+
renderOpenCodeAgentConfigs,
|
|
2
4
|
spawn,
|
|
3
5
|
spawnSync
|
|
4
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4WYCZ5Z7.js";
|
|
5
7
|
import {
|
|
6
|
-
DEFAULT_MODELS,
|
|
7
8
|
DEFAULT_THOTH_COMMAND,
|
|
8
|
-
OPENCODE_PROMPT_DIALECT,
|
|
9
9
|
POLL_INTERVAL_BACKGROUND_MS,
|
|
10
|
-
SUBAGENT_NAMES,
|
|
11
|
-
appendPromptSections,
|
|
12
|
-
composeAgentPrompt,
|
|
13
10
|
context7,
|
|
14
|
-
createOrchestratorPromptSections,
|
|
15
|
-
createReadOnlySpecialistPromptSections,
|
|
16
|
-
createWriteCapableSpecialistPromptSections,
|
|
17
|
-
detectModelFamily,
|
|
18
11
|
exa,
|
|
19
|
-
getAgentOverride,
|
|
20
|
-
getModelFamilyPromptSection,
|
|
21
12
|
getOpenCodeConfigPaths,
|
|
22
|
-
getStepBudgetPromptSection,
|
|
23
13
|
grep_app,
|
|
24
14
|
installCustomSkills,
|
|
25
|
-
loadAgentPrompt,
|
|
26
15
|
loadPluginConfig,
|
|
27
|
-
renderRolePrompt,
|
|
28
16
|
stripJsonComments
|
|
29
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3NOVCFN7.js";
|
|
30
18
|
|
|
31
19
|
// src/index.ts
|
|
32
20
|
import path4 from "path";
|
|
33
21
|
|
|
34
|
-
// src/agents/deep.ts
|
|
35
|
-
var DEEP_PROMPT = renderRolePrompt(
|
|
36
|
-
createWriteCapableSpecialistPromptSections("deep"),
|
|
37
|
-
OPENCODE_PROMPT_DIALECT
|
|
38
|
-
);
|
|
39
|
-
function createDeepAgent(model, customPrompt, customAppendPrompt) {
|
|
40
|
-
const prompt = composeAgentPrompt({
|
|
41
|
-
basePrompt: DEEP_PROMPT,
|
|
42
|
-
customPrompt,
|
|
43
|
-
customAppendPrompt: appendPromptSections(
|
|
44
|
-
getModelFamilyPromptSection("deep", model),
|
|
45
|
-
customAppendPrompt
|
|
46
|
-
)
|
|
47
|
-
});
|
|
48
|
-
return {
|
|
49
|
-
name: "deep",
|
|
50
|
-
description: "Synchronous write-capable implementation agent optimized for thorough context analysis, edge cases, and correctness \u2014 not for bulk mechanical changes.",
|
|
51
|
-
config: {
|
|
52
|
-
model,
|
|
53
|
-
temperature: 0.1,
|
|
54
|
-
prompt,
|
|
55
|
-
color: "secondary"
|
|
56
|
-
// steps: 80,
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// src/agents/designer.ts
|
|
62
|
-
var DESIGNER_PROMPT = renderRolePrompt(
|
|
63
|
-
createWriteCapableSpecialistPromptSections("designer"),
|
|
64
|
-
OPENCODE_PROMPT_DIALECT
|
|
65
|
-
);
|
|
66
|
-
function createDesignerAgent(model, customPrompt, customAppendPrompt) {
|
|
67
|
-
const prompt = composeAgentPrompt({
|
|
68
|
-
basePrompt: DESIGNER_PROMPT,
|
|
69
|
-
customPrompt,
|
|
70
|
-
customAppendPrompt: appendPromptSections(
|
|
71
|
-
getModelFamilyPromptSection("designer", model),
|
|
72
|
-
customAppendPrompt
|
|
73
|
-
)
|
|
74
|
-
});
|
|
75
|
-
return {
|
|
76
|
-
name: "designer",
|
|
77
|
-
description: "Synchronous write-capable UI/UX implementation agent with ownership of approach, execution, and visual verification.",
|
|
78
|
-
config: {
|
|
79
|
-
model,
|
|
80
|
-
temperature: 0.4,
|
|
81
|
-
prompt,
|
|
82
|
-
color: "accent"
|
|
83
|
-
// steps: 50,
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// src/agents/explorer.ts
|
|
89
|
-
var EXPLORER_PROMPT = renderRolePrompt(
|
|
90
|
-
createReadOnlySpecialistPromptSections("explorer"),
|
|
91
|
-
OPENCODE_PROMPT_DIALECT
|
|
92
|
-
);
|
|
93
|
-
function createExplorerAgent(model, customPrompt, customAppendPrompt) {
|
|
94
|
-
const prompt = composeAgentPrompt({
|
|
95
|
-
basePrompt: EXPLORER_PROMPT,
|
|
96
|
-
customPrompt,
|
|
97
|
-
customAppendPrompt: appendPromptSections(
|
|
98
|
-
getModelFamilyPromptSection("explorer", model),
|
|
99
|
-
customAppendPrompt
|
|
100
|
-
)
|
|
101
|
-
});
|
|
102
|
-
return {
|
|
103
|
-
name: "explorer",
|
|
104
|
-
description: "Read-only local discovery agent for fast codebase search, references, and repository mapping.",
|
|
105
|
-
config: {
|
|
106
|
-
model,
|
|
107
|
-
temperature: 0.1,
|
|
108
|
-
prompt,
|
|
109
|
-
color: "info"
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// src/agents/librarian.ts
|
|
115
|
-
var LIBRARIAN_PROMPT = renderRolePrompt(
|
|
116
|
-
createReadOnlySpecialistPromptSections("librarian"),
|
|
117
|
-
OPENCODE_PROMPT_DIALECT
|
|
118
|
-
);
|
|
119
|
-
function createLibrarianAgent(model, customPrompt, customAppendPrompt) {
|
|
120
|
-
const prompt = composeAgentPrompt({
|
|
121
|
-
basePrompt: LIBRARIAN_PROMPT,
|
|
122
|
-
customPrompt,
|
|
123
|
-
customAppendPrompt: appendPromptSections(
|
|
124
|
-
getModelFamilyPromptSection("librarian", model),
|
|
125
|
-
customAppendPrompt
|
|
126
|
-
)
|
|
127
|
-
});
|
|
128
|
-
return {
|
|
129
|
-
name: "librarian",
|
|
130
|
-
description: "Read-only research agent for official docs, public examples, and externally sourced implementation guidance.",
|
|
131
|
-
config: {
|
|
132
|
-
model,
|
|
133
|
-
temperature: 0.1,
|
|
134
|
-
prompt,
|
|
135
|
-
color: "info"
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// src/agents/oracle.ts
|
|
141
|
-
var ORACLE_PROMPT = renderRolePrompt(
|
|
142
|
-
createReadOnlySpecialistPromptSections("oracle"),
|
|
143
|
-
OPENCODE_PROMPT_DIALECT
|
|
144
|
-
);
|
|
145
|
-
function createOracleAgent(model, customPrompt, customAppendPrompt) {
|
|
146
|
-
const prompt = composeAgentPrompt({
|
|
147
|
-
basePrompt: ORACLE_PROMPT,
|
|
148
|
-
customPrompt,
|
|
149
|
-
customAppendPrompt: appendPromptSections(
|
|
150
|
-
getModelFamilyPromptSection("oracle", model),
|
|
151
|
-
customAppendPrompt
|
|
152
|
-
)
|
|
153
|
-
});
|
|
154
|
-
return {
|
|
155
|
-
name: "oracle",
|
|
156
|
-
description: "Synchronous read-only strategic advisor for debugging, architecture, code review, and SDD plan review.",
|
|
157
|
-
config: {
|
|
158
|
-
model,
|
|
159
|
-
temperature: 0.1,
|
|
160
|
-
prompt,
|
|
161
|
-
color: "warning"
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// src/agents/orchestrator.ts
|
|
167
|
-
var OPENCODE_RUNTIME_SECTION = `<opencode-runtime>
|
|
168
|
-
In the OpenCode harness, an automatic \`<reminder>...</reminder>\` workflow block followed by a \`\\n\\n---\\n\\n\` separator is prepended to your user messages as harness scaffolding, not user input.
|
|
169
|
-
When saving the user prompt via mem_save(kind="prompt"), you MUST exclude that injected \`<reminder>\` block and the \`---\` separator, and persist only the real user request text that follows.
|
|
170
|
-
</opencode-runtime>`;
|
|
171
|
-
var ORCHESTRATOR_PROMPT = appendPromptSections(
|
|
172
|
-
renderRolePrompt(createOrchestratorPromptSections(), OPENCODE_PROMPT_DIALECT),
|
|
173
|
-
OPENCODE_RUNTIME_SECTION
|
|
174
|
-
);
|
|
175
|
-
function createOrchestratorAgent(model, customPrompt, customAppendPrompt) {
|
|
176
|
-
const prompt = composeAgentPrompt({
|
|
177
|
-
basePrompt: ORCHESTRATOR_PROMPT,
|
|
178
|
-
customPrompt,
|
|
179
|
-
customAppendPrompt: appendPromptSections(
|
|
180
|
-
getModelFamilyPromptSection("orchestrator", model),
|
|
181
|
-
customAppendPrompt
|
|
182
|
-
)
|
|
183
|
-
});
|
|
184
|
-
const definition = {
|
|
185
|
-
name: "orchestrator",
|
|
186
|
-
description: "Delegate-first coordinator for SDD workflow, specialist dispatch, and root-session memory ownership.",
|
|
187
|
-
config: {
|
|
188
|
-
temperature: 0.1,
|
|
189
|
-
prompt,
|
|
190
|
-
color: "primary"
|
|
191
|
-
// steps: 100,
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
if (Array.isArray(model)) {
|
|
195
|
-
definition._modelArray = model.map(
|
|
196
|
-
(entry) => typeof entry === "string" ? { id: entry } : entry
|
|
197
|
-
);
|
|
198
|
-
} else if (typeof model === "string" && model) {
|
|
199
|
-
definition.config.model = model;
|
|
200
|
-
}
|
|
201
|
-
return definition;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// src/agents/quick.ts
|
|
205
|
-
var QUICK_PROMPT = renderRolePrompt(
|
|
206
|
-
createWriteCapableSpecialistPromptSections("quick"),
|
|
207
|
-
OPENCODE_PROMPT_DIALECT
|
|
208
|
-
);
|
|
209
|
-
function createQuickAgent(model, customPrompt, customAppendPrompt) {
|
|
210
|
-
const prompt = composeAgentPrompt({
|
|
211
|
-
basePrompt: QUICK_PROMPT,
|
|
212
|
-
customPrompt,
|
|
213
|
-
customAppendPrompt: appendPromptSections(
|
|
214
|
-
getModelFamilyPromptSection("quick", model),
|
|
215
|
-
customAppendPrompt
|
|
216
|
-
)
|
|
217
|
-
});
|
|
218
|
-
return {
|
|
219
|
-
name: "quick",
|
|
220
|
-
description: "Synchronous write-capable implementation agent optimized for fast, mechanical, well-bounded changes \u2014 including uniform patterns across multiple files.",
|
|
221
|
-
config: {
|
|
222
|
-
model,
|
|
223
|
-
temperature: 0.2,
|
|
224
|
-
prompt,
|
|
225
|
-
color: "success"
|
|
226
|
-
// steps: 30,
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// src/agents/index.ts
|
|
232
|
-
var GEMINI_DEFAULT_STEPS = {
|
|
233
|
-
explorer: 120,
|
|
234
|
-
librarian: 80,
|
|
235
|
-
oracle: 80,
|
|
236
|
-
designer: 80,
|
|
237
|
-
quick: 40,
|
|
238
|
-
deep: 120
|
|
239
|
-
};
|
|
240
|
-
var BUILTIN_PERMISSION_PRESETS = {
|
|
241
|
-
orchestrator: {
|
|
242
|
-
read: "allow",
|
|
243
|
-
edit: "allow",
|
|
244
|
-
write: "allow",
|
|
245
|
-
glob: "allow",
|
|
246
|
-
grep: "allow",
|
|
247
|
-
list: "allow",
|
|
248
|
-
bash: "allow",
|
|
249
|
-
codesearch: "allow",
|
|
250
|
-
lsp: "allow",
|
|
251
|
-
skill: "allow",
|
|
252
|
-
question: "allow",
|
|
253
|
-
webfetch: "allow",
|
|
254
|
-
exa: "allow",
|
|
255
|
-
todowrite: "allow",
|
|
256
|
-
task: "allow",
|
|
257
|
-
external_directory: "allow"
|
|
258
|
-
},
|
|
259
|
-
explorer: {
|
|
260
|
-
read: "allow",
|
|
261
|
-
glob: "allow",
|
|
262
|
-
grep: "allow",
|
|
263
|
-
list: "allow",
|
|
264
|
-
codesearch: "allow",
|
|
265
|
-
lsp: "allow",
|
|
266
|
-
external_directory: "allow",
|
|
267
|
-
bash: "allow",
|
|
268
|
-
question: "allow",
|
|
269
|
-
skill: "allow",
|
|
270
|
-
edit: "deny",
|
|
271
|
-
todowrite: "deny",
|
|
272
|
-
task: "deny"
|
|
273
|
-
},
|
|
274
|
-
librarian: {
|
|
275
|
-
read: "allow",
|
|
276
|
-
glob: "allow",
|
|
277
|
-
grep: "allow",
|
|
278
|
-
external_directory: "allow",
|
|
279
|
-
bash: "allow",
|
|
280
|
-
webfetch: "allow",
|
|
281
|
-
exa: "allow",
|
|
282
|
-
codesearch: "allow",
|
|
283
|
-
question: "allow",
|
|
284
|
-
skill: "allow",
|
|
285
|
-
edit: "deny",
|
|
286
|
-
todowrite: "deny",
|
|
287
|
-
task: "deny"
|
|
288
|
-
},
|
|
289
|
-
oracle: {
|
|
290
|
-
read: "allow",
|
|
291
|
-
glob: "allow",
|
|
292
|
-
grep: "allow",
|
|
293
|
-
list: "allow",
|
|
294
|
-
lsp: "allow",
|
|
295
|
-
codesearch: "allow",
|
|
296
|
-
webfetch: "allow",
|
|
297
|
-
exa: "allow",
|
|
298
|
-
external_directory: "allow",
|
|
299
|
-
bash: "allow",
|
|
300
|
-
question: "allow",
|
|
301
|
-
skill: "allow",
|
|
302
|
-
edit: "deny",
|
|
303
|
-
todowrite: "deny",
|
|
304
|
-
task: "deny"
|
|
305
|
-
},
|
|
306
|
-
designer: {
|
|
307
|
-
read: "allow",
|
|
308
|
-
edit: "allow",
|
|
309
|
-
glob: "allow",
|
|
310
|
-
grep: "allow",
|
|
311
|
-
list: "allow",
|
|
312
|
-
bash: "allow",
|
|
313
|
-
codesearch: "allow",
|
|
314
|
-
lsp: "allow",
|
|
315
|
-
skill: "allow",
|
|
316
|
-
question: "allow",
|
|
317
|
-
todowrite: "deny",
|
|
318
|
-
task: "deny",
|
|
319
|
-
external_directory: {
|
|
320
|
-
"~/.config/opencode/skills/**": "allow"
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
quick: {
|
|
324
|
-
read: "allow",
|
|
325
|
-
edit: "allow",
|
|
326
|
-
glob: "allow",
|
|
327
|
-
grep: "allow",
|
|
328
|
-
list: "allow",
|
|
329
|
-
bash: "allow",
|
|
330
|
-
question: "allow",
|
|
331
|
-
codesearch: "allow",
|
|
332
|
-
lsp: "allow",
|
|
333
|
-
skill: "allow",
|
|
334
|
-
todowrite: "deny",
|
|
335
|
-
task: "deny",
|
|
336
|
-
external_directory: {
|
|
337
|
-
"~/.config/opencode/skills/**": "allow"
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
deep: {
|
|
341
|
-
read: "allow",
|
|
342
|
-
edit: "allow",
|
|
343
|
-
glob: "allow",
|
|
344
|
-
grep: "allow",
|
|
345
|
-
list: "allow",
|
|
346
|
-
bash: "allow",
|
|
347
|
-
codesearch: "allow",
|
|
348
|
-
lsp: "allow",
|
|
349
|
-
skill: "allow",
|
|
350
|
-
question: "allow",
|
|
351
|
-
webfetch: "allow",
|
|
352
|
-
exa: "allow",
|
|
353
|
-
todowrite: "deny",
|
|
354
|
-
task: "deny",
|
|
355
|
-
external_directory: {
|
|
356
|
-
"~/.config/opencode/skills/**": "allow"
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
function normalizeModelArray(model) {
|
|
361
|
-
return model.map(
|
|
362
|
-
(entry) => typeof entry === "string" ? { id: entry } : entry
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
|
-
function applyOverrides(agent, override) {
|
|
366
|
-
if (override.model) {
|
|
367
|
-
if (Array.isArray(override.model)) {
|
|
368
|
-
agent._modelArray = normalizeModelArray(override.model);
|
|
369
|
-
agent.config.model = void 0;
|
|
370
|
-
} else {
|
|
371
|
-
agent.config.model = override.model;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
if (override.variant) {
|
|
375
|
-
agent.config.variant = override.variant;
|
|
376
|
-
}
|
|
377
|
-
if (override.temperature !== void 0) {
|
|
378
|
-
agent.config.temperature = override.temperature;
|
|
379
|
-
}
|
|
380
|
-
if (override.steps !== void 0) {
|
|
381
|
-
agent.config.steps = override.steps;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
function applyStepBudgetPrompt(agent) {
|
|
385
|
-
const stepBudgetPrompt = getStepBudgetPromptSection(agent.config.steps);
|
|
386
|
-
if (!stepBudgetPrompt) {
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
agent.config.prompt = appendPromptSections(
|
|
390
|
-
agent.config.prompt,
|
|
391
|
-
stepBudgetPrompt
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
function applyGeminiDefaultSteps(agent) {
|
|
395
|
-
if (!isSubagent(agent.name) || agent.config.steps !== void 0) {
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
if (detectModelFamily(agent._modelArray ?? agent.config.model) !== "gemini") {
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
agent.config.steps = GEMINI_DEFAULT_STEPS[agent.name];
|
|
402
|
-
}
|
|
403
|
-
function clonePermissionConfig(permission) {
|
|
404
|
-
if (typeof permission === "string") {
|
|
405
|
-
return permission;
|
|
406
|
-
}
|
|
407
|
-
return Object.fromEntries(
|
|
408
|
-
Object.entries(permission).map(([key, value]) => [
|
|
409
|
-
key,
|
|
410
|
-
value && typeof value === "object" && !Array.isArray(value) ? { ...value } : value
|
|
411
|
-
])
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
function getBuiltinPermissionPreset(name) {
|
|
415
|
-
return clonePermissionConfig(BUILTIN_PERMISSION_PRESETS[name]);
|
|
416
|
-
}
|
|
417
|
-
function getExplicitPermissionOverride(override) {
|
|
418
|
-
return override?.permission;
|
|
419
|
-
}
|
|
420
|
-
function getPrimaryModelForPrompt(model) {
|
|
421
|
-
if (Array.isArray(model)) {
|
|
422
|
-
const first = model[0];
|
|
423
|
-
return typeof first === "string" ? first : first?.id;
|
|
424
|
-
}
|
|
425
|
-
return model;
|
|
426
|
-
}
|
|
427
|
-
function isSubagent(name) {
|
|
428
|
-
return SUBAGENT_NAMES.includes(name);
|
|
429
|
-
}
|
|
430
|
-
var SUBAGENT_FACTORIES = {
|
|
431
|
-
explorer: createExplorerAgent,
|
|
432
|
-
librarian: createLibrarianAgent,
|
|
433
|
-
oracle: createOracleAgent,
|
|
434
|
-
designer: createDesignerAgent,
|
|
435
|
-
quick: createQuickAgent,
|
|
436
|
-
deep: createDeepAgent
|
|
437
|
-
};
|
|
438
|
-
function createAgents(config) {
|
|
439
|
-
const protoSubAgents = Object.entries(SUBAGENT_FACTORIES).map(([name, factory]) => {
|
|
440
|
-
const override = getAgentOverride(config, name);
|
|
441
|
-
const prompts = loadAgentPrompt(name, config?.preset);
|
|
442
|
-
const model = getPrimaryModelForPrompt(override?.model) ?? DEFAULT_MODELS[name];
|
|
443
|
-
return factory(model, prompts.prompt, prompts.appendPrompt);
|
|
444
|
-
});
|
|
445
|
-
const allSubAgents = protoSubAgents.map((agent) => {
|
|
446
|
-
const override = getAgentOverride(config, agent.name);
|
|
447
|
-
if (override) {
|
|
448
|
-
applyOverrides(agent, override);
|
|
449
|
-
}
|
|
450
|
-
applyGeminiDefaultSteps(agent);
|
|
451
|
-
applyStepBudgetPrompt(agent);
|
|
452
|
-
return agent;
|
|
453
|
-
});
|
|
454
|
-
const orchestratorOverride = getAgentOverride(config, "orchestrator");
|
|
455
|
-
const orchestratorPrompts = loadAgentPrompt("orchestrator", config?.preset);
|
|
456
|
-
const orchestrator = createOrchestratorAgent(
|
|
457
|
-
orchestratorOverride?.model ?? DEFAULT_MODELS.orchestrator,
|
|
458
|
-
orchestratorPrompts.prompt,
|
|
459
|
-
orchestratorPrompts.appendPrompt
|
|
460
|
-
);
|
|
461
|
-
if (orchestratorOverride) {
|
|
462
|
-
applyOverrides(orchestrator, orchestratorOverride);
|
|
463
|
-
}
|
|
464
|
-
applyStepBudgetPrompt(orchestrator);
|
|
465
|
-
return [orchestrator, ...allSubAgents];
|
|
466
|
-
}
|
|
467
|
-
function getAgentConfigs(config) {
|
|
468
|
-
const agents = createAgents(config);
|
|
469
|
-
return Object.fromEntries(
|
|
470
|
-
agents.map((agent) => {
|
|
471
|
-
const override = getAgentOverride(config, agent.name);
|
|
472
|
-
const sdkConfig = {
|
|
473
|
-
...agent.config,
|
|
474
|
-
description: agent.description
|
|
475
|
-
};
|
|
476
|
-
const builtinPermission = isSubagent(agent.name) ? getBuiltinPermissionPreset(agent.name) : agent.name === "orchestrator" ? getBuiltinPermissionPreset("orchestrator") : void 0;
|
|
477
|
-
const explicitPermissionOverride = getExplicitPermissionOverride(override);
|
|
478
|
-
sdkConfig.permission = explicitPermissionOverride ?? agent.config.permission ?? builtinPermission;
|
|
479
|
-
if (isSubagent(agent.name)) {
|
|
480
|
-
sdkConfig.mode = "subagent";
|
|
481
|
-
} else if (agent.name === "orchestrator") {
|
|
482
|
-
sdkConfig.mode = "primary";
|
|
483
|
-
}
|
|
484
|
-
return [agent.name, sdkConfig];
|
|
485
|
-
})
|
|
486
|
-
);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
// src/harness/adapters/opencode.ts
|
|
490
|
-
function renderOpenCodeAgentConfigs(config) {
|
|
491
|
-
return getAgentConfigs(config);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
22
|
// src/utils/logger.ts
|
|
495
23
|
import { createRequire } from "module";
|
|
496
24
|
var require2 = createRequire(import.meta.url);
|
package/package.json
CHANGED
package/thoth-agents.schema.json
CHANGED
|
@@ -466,6 +466,22 @@
|
|
|
466
466
|
"type": "boolean"
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
+
},
|
|
470
|
+
"claudeCode": {
|
|
471
|
+
"type": "object",
|
|
472
|
+
"properties": {
|
|
473
|
+
"enabled": {
|
|
474
|
+
"default": false,
|
|
475
|
+
"type": "boolean"
|
|
476
|
+
},
|
|
477
|
+
"outputRoot": {
|
|
478
|
+
"type": "string"
|
|
479
|
+
},
|
|
480
|
+
"dryRun": {
|
|
481
|
+
"default": true,
|
|
482
|
+
"type": "boolean"
|
|
483
|
+
}
|
|
484
|
+
}
|
|
469
485
|
}
|
|
470
486
|
},
|
|
471
487
|
"title": "thoth-agents",
|