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/chunk-DYGVRAMS.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
// src/utils/subprocess.ts
|
|
2
|
-
import {
|
|
3
|
-
spawn as nodeSpawn,
|
|
4
|
-
spawnSync as nodeSpawnSync
|
|
5
|
-
} from "child_process";
|
|
6
|
-
import { Readable } from "stream";
|
|
7
|
-
function emptyReadableStream() {
|
|
8
|
-
return new ReadableStream({
|
|
9
|
-
start(controller) {
|
|
10
|
-
controller.close();
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
function toWebReadable(stream) {
|
|
15
|
-
if (!stream) {
|
|
16
|
-
return emptyReadableStream();
|
|
17
|
-
}
|
|
18
|
-
return Readable.toWeb(
|
|
19
|
-
stream
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
function fallbackStdin() {
|
|
23
|
-
return {
|
|
24
|
-
write: () => void 0,
|
|
25
|
-
end: () => void 0
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function spawn(command, options = {}) {
|
|
29
|
-
const child = nodeSpawn(command[0], command.slice(1), {
|
|
30
|
-
cwd: options.cwd,
|
|
31
|
-
env: options.env,
|
|
32
|
-
stdio: [
|
|
33
|
-
options.stdin ?? "pipe",
|
|
34
|
-
options.stdout ?? "pipe",
|
|
35
|
-
options.stderr ?? "pipe"
|
|
36
|
-
]
|
|
37
|
-
});
|
|
38
|
-
const managed = {
|
|
39
|
-
stdin: child.stdin ?? fallbackStdin(),
|
|
40
|
-
stdout: toWebReadable(child.stdout),
|
|
41
|
-
stderr: toWebReadable(child.stderr),
|
|
42
|
-
exited: new Promise((resolve) => {
|
|
43
|
-
child.on("exit", (code) => {
|
|
44
|
-
managed.exitCode = code;
|
|
45
|
-
resolve(code ?? 1);
|
|
46
|
-
});
|
|
47
|
-
child.on("error", () => {
|
|
48
|
-
managed.exitCode = 1;
|
|
49
|
-
resolve(1);
|
|
50
|
-
});
|
|
51
|
-
}),
|
|
52
|
-
exitCode: child.exitCode,
|
|
53
|
-
kill: () => {
|
|
54
|
-
child.kill();
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
return managed;
|
|
58
|
-
}
|
|
59
|
-
function spawnSync(command, options = {}) {
|
|
60
|
-
const result = nodeSpawnSync(command[0], command.slice(1), {
|
|
61
|
-
cwd: options.cwd,
|
|
62
|
-
env: options.env,
|
|
63
|
-
stdio: [
|
|
64
|
-
options.stdin ?? "ignore",
|
|
65
|
-
options.stdout ?? "pipe",
|
|
66
|
-
options.stderr ?? "pipe"
|
|
67
|
-
]
|
|
68
|
-
});
|
|
69
|
-
return { exitCode: result.status };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// src/cli/system.ts
|
|
73
|
-
import { statSync } from "fs";
|
|
74
|
-
var cachedOpenCodePath = null;
|
|
75
|
-
function getOpenCodePaths() {
|
|
76
|
-
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
77
|
-
return [
|
|
78
|
-
// PATH (try this first)
|
|
79
|
-
"opencode",
|
|
80
|
-
// User local installations (Linux & macOS)
|
|
81
|
-
`${home}/.local/bin/opencode`,
|
|
82
|
-
`${home}/.opencode/bin/opencode`,
|
|
83
|
-
`${home}/bin/opencode`,
|
|
84
|
-
// System-wide installations
|
|
85
|
-
"/usr/local/bin/opencode",
|
|
86
|
-
"/opt/opencode/bin/opencode",
|
|
87
|
-
"/usr/bin/opencode",
|
|
88
|
-
"/bin/opencode",
|
|
89
|
-
// macOS specific
|
|
90
|
-
"/Applications/OpenCode.app/Contents/MacOS/opencode",
|
|
91
|
-
`${home}/Applications/OpenCode.app/Contents/MacOS/opencode`,
|
|
92
|
-
// Homebrew (macOS & Linux)
|
|
93
|
-
"/opt/homebrew/bin/opencode",
|
|
94
|
-
"/home/linuxbrew/.linuxbrew/bin/opencode",
|
|
95
|
-
`${home}/homebrew/bin/opencode`,
|
|
96
|
-
// macOS user Library
|
|
97
|
-
`${home}/Library/Application Support/opencode/bin/opencode`,
|
|
98
|
-
// Snap (Linux)
|
|
99
|
-
"/snap/bin/opencode",
|
|
100
|
-
"/var/snap/opencode/current/bin/opencode",
|
|
101
|
-
// Flatpak (Linux)
|
|
102
|
-
"/var/lib/flatpak/exports/bin/ai.opencode.OpenCode",
|
|
103
|
-
`${home}/.local/share/flatpak/exports/bin/ai.opencode.OpenCode`,
|
|
104
|
-
// Nix (Linux/macOS)
|
|
105
|
-
"/nix/store/opencode/bin/opencode",
|
|
106
|
-
`${home}/.nix-profile/bin/opencode`,
|
|
107
|
-
"/run/current-system/sw/bin/opencode",
|
|
108
|
-
// Cargo (Rust toolchain)
|
|
109
|
-
`${home}/.cargo/bin/opencode`,
|
|
110
|
-
// npm/npx global
|
|
111
|
-
`${home}/.npm-global/bin/opencode`,
|
|
112
|
-
"/usr/local/lib/node_modules/opencode/bin/opencode",
|
|
113
|
-
// Yarn global
|
|
114
|
-
`${home}/.yarn/bin/opencode`,
|
|
115
|
-
// PNPM
|
|
116
|
-
`${home}/.pnpm-global/bin/opencode`
|
|
117
|
-
];
|
|
118
|
-
}
|
|
119
|
-
function resolveOpenCodePath() {
|
|
120
|
-
if (cachedOpenCodePath) {
|
|
121
|
-
return cachedOpenCodePath;
|
|
122
|
-
}
|
|
123
|
-
const paths = getOpenCodePaths();
|
|
124
|
-
for (const opencodePath of paths) {
|
|
125
|
-
if (opencodePath === "opencode") continue;
|
|
126
|
-
try {
|
|
127
|
-
const stat = statSync(opencodePath);
|
|
128
|
-
if (stat.isFile()) {
|
|
129
|
-
cachedOpenCodePath = opencodePath;
|
|
130
|
-
return opencodePath;
|
|
131
|
-
}
|
|
132
|
-
} catch {
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return "opencode";
|
|
136
|
-
}
|
|
137
|
-
async function isOpenCodeInstalled() {
|
|
138
|
-
const paths = getOpenCodePaths();
|
|
139
|
-
for (const opencodePath of paths) {
|
|
140
|
-
try {
|
|
141
|
-
const proc = spawn([opencodePath, "--version"], {
|
|
142
|
-
stdout: "pipe",
|
|
143
|
-
stderr: "pipe"
|
|
144
|
-
});
|
|
145
|
-
await proc.exited;
|
|
146
|
-
if (proc.exitCode === 0) {
|
|
147
|
-
cachedOpenCodePath = opencodePath;
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
} catch {
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
async function getOpenCodeVersion() {
|
|
156
|
-
const opencodePath = resolveOpenCodePath();
|
|
157
|
-
try {
|
|
158
|
-
const proc = spawn([opencodePath, "--version"], {
|
|
159
|
-
stdout: "pipe",
|
|
160
|
-
stderr: "pipe"
|
|
161
|
-
});
|
|
162
|
-
const output = await new Response(proc.stdout).text();
|
|
163
|
-
await proc.exited;
|
|
164
|
-
if (proc.exitCode === 0) {
|
|
165
|
-
return output.trim();
|
|
166
|
-
}
|
|
167
|
-
} catch {
|
|
168
|
-
}
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
function getOpenCodePath() {
|
|
172
|
-
const path = resolveOpenCodePath();
|
|
173
|
-
return path === "opencode" ? null : path;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export {
|
|
177
|
-
spawn,
|
|
178
|
-
spawnSync,
|
|
179
|
-
isOpenCodeInstalled,
|
|
180
|
-
getOpenCodeVersion,
|
|
181
|
-
getOpenCodePath
|
|
182
|
-
};
|