@saturn-universe/cli 0.0.0-stage → 0.1.1
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/LICENSE +661 -0
- package/dist/attach.d.ts +9 -0
- package/dist/attach.js +80 -0
- package/dist/auth-config.d.ts +31 -0
- package/dist/auth-config.js +285 -0
- package/dist/choice-menu.d.ts +13 -0
- package/dist/choice-menu.js +238 -0
- package/dist/cli-diagnostics.d.ts +23 -0
- package/dist/cli-diagnostics.js +42 -0
- package/dist/cli-help.d.ts +6 -0
- package/dist/cli-help.js +163 -0
- package/dist/client.d.ts +13 -0
- package/dist/client.js +90 -0
- package/dist/commands.d.ts +64 -0
- package/dist/commands.js +299 -0
- package/dist/compaction-command.d.ts +16 -0
- package/dist/compaction-command.js +16 -0
- package/dist/composer.d.ts +88 -0
- package/dist/composer.js +124 -0
- package/dist/config-cli.d.ts +1 -0
- package/dist/config-cli.js +47 -0
- package/dist/config-file.d.ts +1 -0
- package/dist/config-file.js +43 -0
- package/dist/config-lock.d.ts +5 -0
- package/dist/config-lock.js +45 -0
- package/dist/duration.d.ts +2 -0
- package/dist/duration.js +11 -0
- package/dist/export.d.ts +19 -0
- package/dist/export.js +66 -0
- package/dist/host-command.d.ts +40 -0
- package/dist/host-command.js +48 -0
- package/dist/host-launcher.d.ts +22 -0
- package/dist/host-launcher.js +300 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +400 -0
- package/dist/markdown.d.ts +1 -0
- package/dist/markdown.js +118 -0
- package/dist/mcp-cli.d.ts +44 -0
- package/dist/mcp-cli.js +647 -0
- package/dist/menu.d.ts +7 -0
- package/dist/menu.js +91 -0
- package/dist/project-mcp-config.d.ts +9 -0
- package/dist/project-mcp-config.js +98 -0
- package/dist/provider-discovery.d.ts +26 -0
- package/dist/provider-discovery.js +138 -0
- package/dist/provider-pricing.d.ts +3 -0
- package/dist/provider-pricing.js +130 -0
- package/dist/provider.d.ts +16 -0
- package/dist/provider.js +370 -0
- package/dist/reconcile-command.d.ts +36 -0
- package/dist/reconcile-command.js +64 -0
- package/dist/renderer.d.ts +204 -0
- package/dist/renderer.js +1134 -0
- package/dist/repl-host.d.ts +22 -0
- package/dist/repl-host.js +51 -0
- package/dist/repl-run-observer.d.ts +27 -0
- package/dist/repl-run-observer.js +86 -0
- package/dist/repl.d.ts +12 -0
- package/dist/repl.js +1834 -0
- package/dist/results.d.ts +23 -0
- package/dist/results.js +1 -0
- package/dist/sandbox-cli.d.ts +39 -0
- package/dist/sandbox-cli.js +324 -0
- package/dist/session-history.d.ts +17 -0
- package/dist/session-history.js +76 -0
- package/dist/settings-menu.d.ts +2 -0
- package/dist/settings-menu.js +111 -0
- package/dist/skill-cli.d.ts +25 -0
- package/dist/skill-cli.js +355 -0
- package/dist/slash-commands.d.ts +66 -0
- package/dist/slash-commands.js +1449 -0
- package/dist/terminal-input.d.ts +24 -0
- package/dist/terminal-input.js +111 -0
- package/dist/terminal-selection.d.ts +21 -0
- package/dist/terminal-selection.js +72 -0
- package/dist/terminal-text.d.ts +38 -0
- package/dist/terminal-text.js +238 -0
- package/dist/tui.d.ts +170 -0
- package/dist/tui.js +2559 -0
- package/dist/usage.d.ts +13 -0
- package/dist/usage.js +46 -0
- package/dist/user-config.d.ts +48 -0
- package/dist/user-config.js +188 -0
- package/package.json +18 -3
- package/README.md +0 -3
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { access, cp, lstat, mkdir, mkdtemp, readFile, realpath, rename, rm, stat, writeFile, } from 'node:fs/promises';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { promisify } from 'node:util';
|
|
7
|
+
import { parseArgs } from 'node:util';
|
|
8
|
+
import { parse } from 'smol-toml';
|
|
9
|
+
import { discoverAgentSkills, inspectSkillDirectory, isInsideSkillDir, localSkillSearchDirectories, projectSkillsDir, rewriteSkillFrontmatterName, skillNamePattern, userConfigPath, userSkillsDir, workspaceConfigPath, } from '@saturn-universe/protocol';
|
|
10
|
+
import { CliError } from './cli-diagnostics.js';
|
|
11
|
+
import { topicHelp } from './cli-help.js';
|
|
12
|
+
const execFileAsync = promisify(execFile);
|
|
13
|
+
const skillHelp = topicHelp('skill');
|
|
14
|
+
function parseRemoteSkillSource(source) {
|
|
15
|
+
if (source.startsWith('github:')) {
|
|
16
|
+
const raw = source.slice('github:'.length).trim();
|
|
17
|
+
const hashIdx = raw.indexOf('#');
|
|
18
|
+
const withoutRef = hashIdx >= 0 ? raw.slice(0, hashIdx) : raw;
|
|
19
|
+
const ref = hashIdx >= 0 ? raw.slice(hashIdx + 1).trim() || undefined : undefined;
|
|
20
|
+
const parts = withoutRef.split('/').filter(Boolean);
|
|
21
|
+
if (parts.length < 2) {
|
|
22
|
+
throw new Error('Invalid github: skill reference. Expected github:owner/repo[/subpath].');
|
|
23
|
+
}
|
|
24
|
+
const [owner, repo, ...subParts] = parts;
|
|
25
|
+
const repoName = repo.endsWith('.git') ? repo : `${repo}.git`;
|
|
26
|
+
const subpath = subParts.length ? subParts.join('/') : undefined;
|
|
27
|
+
return {
|
|
28
|
+
repoUrl: `https://github.com/${owner}/${repoName}`,
|
|
29
|
+
...(subpath ? { subpath } : {}),
|
|
30
|
+
...(ref ? { ref } : {}),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (/^(?:https?:\/\/|ssh:\/\/|git@|file:\/\/)/i.test(source) || source.endsWith('.git')) {
|
|
34
|
+
const hashIdx = source.indexOf('#');
|
|
35
|
+
const repoUrl = hashIdx >= 0 ? source.slice(0, hashIdx) : source;
|
|
36
|
+
const ref = hashIdx >= 0 ? source.slice(hashIdx + 1).trim() || undefined : undefined;
|
|
37
|
+
return {
|
|
38
|
+
repoUrl,
|
|
39
|
+
...(ref ? { ref } : {}),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
async function runGit(args, cwd) {
|
|
45
|
+
try {
|
|
46
|
+
await execFileAsync('git', [...args], {
|
|
47
|
+
...(cwd ? { cwd } : {}),
|
|
48
|
+
windowsHide: true,
|
|
49
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const err = error;
|
|
54
|
+
if (err.code === 'ENOENT') {
|
|
55
|
+
throw new Error('`git` executable is required to install remote skills.');
|
|
56
|
+
}
|
|
57
|
+
const detail = err.stderr?.trim() || err.message || 'git command failed';
|
|
58
|
+
throw new Error(`git failed: ${detail}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function cloneSkillSource(remote, cloneDir) {
|
|
62
|
+
const branchArgs = remote.ref ? ['--branch', remote.ref] : [];
|
|
63
|
+
if (remote.subpath) {
|
|
64
|
+
try {
|
|
65
|
+
await runGit([
|
|
66
|
+
'clone',
|
|
67
|
+
'--depth',
|
|
68
|
+
'1',
|
|
69
|
+
'--filter=blob:none',
|
|
70
|
+
'--sparse',
|
|
71
|
+
...branchArgs,
|
|
72
|
+
remote.repoUrl,
|
|
73
|
+
cloneDir,
|
|
74
|
+
]);
|
|
75
|
+
await runGit(['-C', cloneDir, 'sparse-checkout', 'set', '--no-cone', remote.subpath]);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
await rm(cloneDir, { recursive: true, force: true });
|
|
79
|
+
await runGit(['clone', '--depth', '1', ...branchArgs, remote.repoUrl, cloneDir]);
|
|
80
|
+
}
|
|
81
|
+
const candidate = path.resolve(cloneDir, remote.subpath);
|
|
82
|
+
if (!isInsideSkillDir(cloneDir, candidate)) {
|
|
83
|
+
throw new Error(`Invalid skill subpath: ${remote.subpath}`);
|
|
84
|
+
}
|
|
85
|
+
return candidate;
|
|
86
|
+
}
|
|
87
|
+
await runGit(['clone', '--depth', '1', ...branchArgs, remote.repoUrl, cloneDir]);
|
|
88
|
+
return cloneDir;
|
|
89
|
+
}
|
|
90
|
+
async function readLegacyExplicitSkills(workdir, env) {
|
|
91
|
+
for (const candidate of [workspaceConfigPath(workdir), userConfigPath(env)]) {
|
|
92
|
+
try {
|
|
93
|
+
const text = await readFile(candidate, 'utf8');
|
|
94
|
+
const parsed = parse(text);
|
|
95
|
+
if (parsed.skills && typeof parsed.skills === 'object' && !Array.isArray(parsed.skills)) {
|
|
96
|
+
return parsed.skills;
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// Try next config candidate.
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
async function pathExists(target) {
|
|
107
|
+
try {
|
|
108
|
+
await access(target);
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async function copySkillTreeSafely(sourceRealDir, destinationDir) {
|
|
116
|
+
await mkdir(path.dirname(destinationDir), { recursive: true });
|
|
117
|
+
await cp(sourceRealDir, destinationDir, {
|
|
118
|
+
recursive: true,
|
|
119
|
+
dereference: false,
|
|
120
|
+
filter: async (src) => {
|
|
121
|
+
const rel = path.relative(sourceRealDir, src);
|
|
122
|
+
if (!rel)
|
|
123
|
+
return true;
|
|
124
|
+
const segments = rel.split(path.sep);
|
|
125
|
+
if (segments.some((seg) => seg === '.git' || seg === 'node_modules' || /^\.env(?:\..*)?$/i.test(seg))) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
const linkStat = await lstat(src);
|
|
130
|
+
if (linkStat.isSymbolicLink()) {
|
|
131
|
+
const targetReal = await realpath(src);
|
|
132
|
+
return isInsideSkillDir(sourceRealDir, targetReal);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
export async function listDiscoveredSkillsCli(workdir, env = process.env) {
|
|
143
|
+
const explicitSkills = await readLegacyExplicitSkills(workdir, env);
|
|
144
|
+
return discoverAgentSkills(workdir, {
|
|
145
|
+
env,
|
|
146
|
+
...(explicitSkills ? { explicitSkills } : {}),
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
export async function addSkillCli(workdir, source, options = {}) {
|
|
150
|
+
const env = options.env ?? process.env;
|
|
151
|
+
const scope = options.scope ?? 'user';
|
|
152
|
+
const targetRoot = scope === 'project' ? projectSkillsDir(workdir) : userSkillsDir(env);
|
|
153
|
+
let tempCloneRoot;
|
|
154
|
+
let sourceDir;
|
|
155
|
+
const remote = parseRemoteSkillSource(source);
|
|
156
|
+
try {
|
|
157
|
+
if (remote) {
|
|
158
|
+
tempCloneRoot = await mkdtemp(path.join(os.tmpdir(), 'saturn-skill-clone-'));
|
|
159
|
+
sourceDir = await cloneSkillSource(remote, path.join(tempCloneRoot, 'repo'));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
const resolvedLocal = path.resolve(workdir, source);
|
|
163
|
+
const localStat = await stat(resolvedLocal).catch(() => undefined);
|
|
164
|
+
if (!localStat) {
|
|
165
|
+
throw new Error(`Skill source not found: ${source}`);
|
|
166
|
+
}
|
|
167
|
+
sourceDir =
|
|
168
|
+
localStat.isFile() && path.basename(resolvedLocal) === 'SKILL.md'
|
|
169
|
+
? path.dirname(resolvedLocal)
|
|
170
|
+
: resolvedLocal;
|
|
171
|
+
}
|
|
172
|
+
const inspected = await inspectSkillDirectory(sourceDir);
|
|
173
|
+
const finalName = options.name?.trim() || inspected.name;
|
|
174
|
+
if (!skillNamePattern.test(finalName)) {
|
|
175
|
+
throw new Error(`Invalid skill name "${finalName}". Use 1-64 characters matching [a-zA-Z0-9._-].`);
|
|
176
|
+
}
|
|
177
|
+
const targetDir = path.join(targetRoot, finalName);
|
|
178
|
+
if (await pathExists(targetDir)) {
|
|
179
|
+
if (!options.force) {
|
|
180
|
+
throw new Error(`Skill "${finalName}" already exists at ${targetDir} (pass --force to overwrite).`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
await mkdir(targetRoot, { recursive: true });
|
|
184
|
+
const stagingDir = path.join(targetRoot, `.staging-${finalName}-${randomUUID()}`);
|
|
185
|
+
try {
|
|
186
|
+
await copySkillTreeSafely(inspected.rootDir, stagingDir);
|
|
187
|
+
if (options.name?.trim()) {
|
|
188
|
+
const stagedMd = path.join(stagingDir, 'SKILL.md');
|
|
189
|
+
const originalMd = await readFile(stagedMd, 'utf8');
|
|
190
|
+
await writeFile(stagedMd, rewriteSkillFrontmatterName(originalMd, finalName), 'utf8');
|
|
191
|
+
}
|
|
192
|
+
if (options.force && (await pathExists(targetDir))) {
|
|
193
|
+
await rm(targetDir, { recursive: true, force: true });
|
|
194
|
+
}
|
|
195
|
+
await rename(stagingDir, targetDir);
|
|
196
|
+
}
|
|
197
|
+
finally {
|
|
198
|
+
await rm(stagingDir, { recursive: true, force: true });
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
name: finalName,
|
|
202
|
+
description: inspected.description,
|
|
203
|
+
scope,
|
|
204
|
+
path: targetDir,
|
|
205
|
+
resources: inspected.resources,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
if (tempCloneRoot) {
|
|
210
|
+
await rm(tempCloneRoot, { recursive: true, force: true });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
export async function removeSkillCli(workdir, name, options = {}) {
|
|
215
|
+
const trimmed = name.trim();
|
|
216
|
+
if (!skillNamePattern.test(trimmed)) {
|
|
217
|
+
throw new Error(`Invalid skill name "${name}".`);
|
|
218
|
+
}
|
|
219
|
+
const env = options.env ?? process.env;
|
|
220
|
+
for (const { dir, scope } of localSkillSearchDirectories(workdir, env)) {
|
|
221
|
+
if (options.scope && scope !== options.scope)
|
|
222
|
+
continue;
|
|
223
|
+
const candidate = path.join(dir, trimmed);
|
|
224
|
+
if (await pathExists(candidate)) {
|
|
225
|
+
await rm(candidate, { recursive: true, force: true });
|
|
226
|
+
return { name: trimmed, scope, path: candidate };
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
throw new Error(`Skill "${trimmed}" not found${options.scope ? ` in ${options.scope} scope` : ' in project or user skill directories'}.`);
|
|
230
|
+
}
|
|
231
|
+
function parseScopeFlag(raw) {
|
|
232
|
+
if (raw === undefined)
|
|
233
|
+
return undefined;
|
|
234
|
+
if (raw === 'user' || raw === 'project')
|
|
235
|
+
return raw;
|
|
236
|
+
throw new CliError('USAGE');
|
|
237
|
+
}
|
|
238
|
+
export async function runSkillCommand(args, workdir, env = process.env) {
|
|
239
|
+
const sub = args[0]?.toLowerCase() ?? 'list';
|
|
240
|
+
if (!sub || sub === 'help' || sub === '--help' || sub === '-h') {
|
|
241
|
+
process.stdout.write(skillHelp + '\n');
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (sub === 'list') {
|
|
245
|
+
let parsed;
|
|
246
|
+
try {
|
|
247
|
+
parsed = parseArgs({
|
|
248
|
+
args: args.slice(1),
|
|
249
|
+
allowPositionals: false,
|
|
250
|
+
strict: true,
|
|
251
|
+
options: {
|
|
252
|
+
json: { type: 'boolean' },
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
catch {
|
|
257
|
+
throw new CliError('USAGE');
|
|
258
|
+
}
|
|
259
|
+
const skills = await listDiscoveredSkillsCli(workdir, env);
|
|
260
|
+
if (parsed.values.json) {
|
|
261
|
+
process.stdout.write(JSON.stringify({
|
|
262
|
+
ok: true,
|
|
263
|
+
skills: skills.map(({ name, description, scope, source, resources, rootDir }) => ({
|
|
264
|
+
name,
|
|
265
|
+
description,
|
|
266
|
+
scope,
|
|
267
|
+
source,
|
|
268
|
+
resources,
|
|
269
|
+
path: rootDir,
|
|
270
|
+
})),
|
|
271
|
+
}) + '\n');
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (!skills.length) {
|
|
275
|
+
process.stdout.write('尚未发现已安装的技能。\n');
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
for (const skill of skills) {
|
|
279
|
+
const extra = skill.resources.length ? ` (${skill.resources.length} resources)` : '';
|
|
280
|
+
process.stdout.write(`[${skill.scope}] ${skill.name} — ${skill.description}${extra}\n`);
|
|
281
|
+
}
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (sub === 'add') {
|
|
285
|
+
let parsed;
|
|
286
|
+
try {
|
|
287
|
+
parsed = parseArgs({
|
|
288
|
+
args: args.slice(1),
|
|
289
|
+
allowPositionals: true,
|
|
290
|
+
strict: true,
|
|
291
|
+
options: {
|
|
292
|
+
scope: { type: 'string' },
|
|
293
|
+
name: { type: 'string' },
|
|
294
|
+
force: { type: 'boolean' },
|
|
295
|
+
json: { type: 'boolean' },
|
|
296
|
+
},
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
throw new CliError('USAGE');
|
|
301
|
+
}
|
|
302
|
+
const source = parsed.positionals[0];
|
|
303
|
+
if (!source || parsed.positionals.length > 1) {
|
|
304
|
+
throw new CliError('USAGE');
|
|
305
|
+
}
|
|
306
|
+
const scope = parseScopeFlag(parsed.values.scope) ?? 'user';
|
|
307
|
+
const result = await addSkillCli(workdir, source, {
|
|
308
|
+
scope,
|
|
309
|
+
...(typeof parsed.values.name === 'string' ? { name: parsed.values.name } : {}),
|
|
310
|
+
force: Boolean(parsed.values.force),
|
|
311
|
+
env,
|
|
312
|
+
});
|
|
313
|
+
if (parsed.values.json) {
|
|
314
|
+
process.stdout.write(JSON.stringify({ ok: true, skill: result }) + '\n');
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
process.stdout.write(`Installed skill "${result.name}" (${result.scope}) at ${result.path}\n`);
|
|
318
|
+
}
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (sub === 'remove' || sub === 'rm') {
|
|
322
|
+
let parsed;
|
|
323
|
+
try {
|
|
324
|
+
parsed = parseArgs({
|
|
325
|
+
args: args.slice(1),
|
|
326
|
+
allowPositionals: true,
|
|
327
|
+
strict: true,
|
|
328
|
+
options: {
|
|
329
|
+
scope: { type: 'string' },
|
|
330
|
+
json: { type: 'boolean' },
|
|
331
|
+
},
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
catch {
|
|
335
|
+
throw new CliError('USAGE');
|
|
336
|
+
}
|
|
337
|
+
const name = parsed.positionals[0];
|
|
338
|
+
if (!name || parsed.positionals.length > 1) {
|
|
339
|
+
throw new CliError('USAGE');
|
|
340
|
+
}
|
|
341
|
+
const scope = parseScopeFlag(parsed.values.scope);
|
|
342
|
+
const result = await removeSkillCli(workdir, name, {
|
|
343
|
+
...(scope ? { scope } : {}),
|
|
344
|
+
env,
|
|
345
|
+
});
|
|
346
|
+
if (parsed.values.json) {
|
|
347
|
+
process.stdout.write(JSON.stringify({ ok: true, removed: result }) + '\n');
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
process.stdout.write(`Removed skill "${result.name}" (${result.scope}) from ${result.path}\n`);
|
|
351
|
+
}
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
throw new CliError('USAGE');
|
|
355
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { parseTeamConfig } from '@saturn-universe/protocol';
|
|
2
|
+
import type { HostStatusSnapshot, PermissionMode, SessionListItem, SessionSummary } from '@saturn-universe/protocol';
|
|
3
|
+
import type { ChoicePrompt, SlashCommandHint } from './composer.js';
|
|
4
|
+
import type { ManagedHost } from './host-launcher.js';
|
|
5
|
+
import type { ReplHostState } from './repl-host.js';
|
|
6
|
+
import { type SaveUserConfigResult, type UserConfigDefaultsPatch } from './user-config.js';
|
|
7
|
+
export declare const SLASH_COMMAND_HINTS: readonly (SlashCommandHint & {
|
|
8
|
+
readonly takesArgs?: boolean;
|
|
9
|
+
})[];
|
|
10
|
+
export declare const SLASH_COMMAND_NAMES: string[];
|
|
11
|
+
export interface ReplState extends ReplHostState {
|
|
12
|
+
sessionId?: string | undefined;
|
|
13
|
+
member?: SessionSummary['member'] | undefined;
|
|
14
|
+
workspaceId?: string | undefined;
|
|
15
|
+
profile?: string | undefined;
|
|
16
|
+
taskProfile?: string | undefined;
|
|
17
|
+
reasoningEffort?: string | undefined;
|
|
18
|
+
profileDefaultReasoningEffort?: string | null | undefined;
|
|
19
|
+
workerReasoningEffort?: string | undefined;
|
|
20
|
+
hasRunHistory?: boolean | undefined;
|
|
21
|
+
skillRefs: string[];
|
|
22
|
+
disabledSkills?: string[] | undefined;
|
|
23
|
+
permissionMode: PermissionMode;
|
|
24
|
+
userMutatedDefaults?: Set<'permission' | 'effort' | 'workerEffort' | 'profile' | 'mode'> | undefined;
|
|
25
|
+
lastRunId?: string | undefined;
|
|
26
|
+
readonly runCursors: Map<string, string>;
|
|
27
|
+
}
|
|
28
|
+
export interface TeamHintConfig {
|
|
29
|
+
readonly force?: boolean;
|
|
30
|
+
readonly concurrency?: number;
|
|
31
|
+
readonly maxMembers?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface SubmitRunOptions {
|
|
34
|
+
readonly text: string;
|
|
35
|
+
readonly teamHint?: TeamHintConfig;
|
|
36
|
+
readonly teamPreset?: string;
|
|
37
|
+
readonly team?: ReturnType<typeof parseTeamConfig>;
|
|
38
|
+
}
|
|
39
|
+
export interface ReplHooks {
|
|
40
|
+
write(text: string): void;
|
|
41
|
+
writeLine(text: string): void;
|
|
42
|
+
submitAndFollow(options: SubmitRunOptions): Promise<void>;
|
|
43
|
+
followRun(runId: string, after?: string): Promise<void>;
|
|
44
|
+
ensureConnected(): Promise<ManagedHost>;
|
|
45
|
+
refreshHostStatus(): Promise<HostStatusSnapshot | undefined>;
|
|
46
|
+
isRunActive?(): boolean;
|
|
47
|
+
steer?(content: string): Promise<void>;
|
|
48
|
+
showSideQuestion?(question: string, ask: (signal?: AbortSignal) => Promise<string>): void;
|
|
49
|
+
isPausedOrCheckpointedRun?(): boolean;
|
|
50
|
+
pickSession?(sessions: readonly SessionListItem[]): Promise<string | null>;
|
|
51
|
+
promptChoice?(prompt: ChoicePrompt): Promise<string | null>;
|
|
52
|
+
switchMode?(targetMode: string): Promise<HostStatusSnapshot>;
|
|
53
|
+
restartHost?(): Promise<HostStatusSnapshot>;
|
|
54
|
+
promptMcpSecret?(label: string): Promise<string | null>;
|
|
55
|
+
persistDefaults?(patch: UserConfigDefaultsPatch): Promise<SaveUserConfigResult>;
|
|
56
|
+
onSessionChanged?(info: SessionSummary): void;
|
|
57
|
+
checkSessionSwitch?(info: SessionSummary): void;
|
|
58
|
+
getNavigationSignal?(): AbortSignal | undefined;
|
|
59
|
+
renderBanner?(): string;
|
|
60
|
+
clearScreen?(): void;
|
|
61
|
+
}
|
|
62
|
+
export declare function tokenizeCommandLine(line: string): string[];
|
|
63
|
+
export declare function ensureWorkspaceId(state: ReplState): Promise<string>;
|
|
64
|
+
export declare function ensureSessionId(state: ReplState, title?: string): Promise<string>;
|
|
65
|
+
export declare function isImmediateSlashCommand(line: string): boolean;
|
|
66
|
+
export declare function handleSlashCommand(line: string, state: ReplState, hooks: ReplHooks): Promise<'continue' | 'exit'>;
|