sprag-cli 3.130.0 → 3.131.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/mod/sprag-statusline/hooks/register.tsx +58 -3
- package/package.json +1 -1
- package/src/claude-version.js +38 -0
- package/src/codex/budget.js +1 -1
- package/src/codex/delegation-diagnostics.js +1 -1
- package/src/commands/delegate.js +1 -0
- package/src/commands/feedback.js +2 -2
- package/src/commands/install.js +3 -1
- package/src/commands/route-scan.js +10 -1
- package/src/commands/team.js +1 -1
- package/src/commands/upgrade.js +1 -1
- package/src/compact-window.js +1 -1
- package/src/cowork-sync.js +1 -1
- package/src/delegation-agents.js +41 -2
- package/src/doc2md.cjs +1 -0
- package/src/gateway-auth.js +1 -0
- package/src/handoff.js +1 -0
- package/src/korean-style.js +1 -1
- package/src/permission-secrets.js +1 -1
- package/src/team-sync.js +1 -1
- package/src/transcript-lines.js +1 -1
|
@@ -99,6 +99,36 @@ export function statuslinePayload(input: {
|
|
|
99
99
|
return payload
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/**
|
|
103
|
+
* The argv with `--columns <n>` added, so sprag fits its chips to the band and
|
|
104
|
+
* wraps them at chip boundaries instead of the band wrapping them mid-chip. A
|
|
105
|
+
* command that already names its width, or an unknown width, is left as it is.
|
|
106
|
+
*/
|
|
107
|
+
export function withColumns(argv: string[], columns: number | undefined): string[] {
|
|
108
|
+
if (!columns || !Number.isFinite(columns) || columns < 20) return argv
|
|
109
|
+
if (argv.includes('--columns')) return argv
|
|
110
|
+
return [...argv, '--columns', String(Math.floor(columns))]
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// First engine whose Box takes overflowX="scroll" and whose Text takes
|
|
114
|
+
// wrap="clip". Older engines check a tree's props by name and value and skip a
|
|
115
|
+
// hook whose tree has one they do not know, so the band would vanish there.
|
|
116
|
+
export const CLIP_MIN_VERSION = '2.1.326'
|
|
117
|
+
|
|
118
|
+
/** Whether a release version (`2.1.326`, `2.1.330-dev`) is at least `min`. */
|
|
119
|
+
export function atLeast(version: string | undefined, min: string): boolean {
|
|
120
|
+
const parse = (v: string) => /^(\d+)\.(\d+)\.(\d+)/.exec(v)?.slice(1).map(Number)
|
|
121
|
+
const a = version ? parse(version) : undefined
|
|
122
|
+
const b = parse(min)
|
|
123
|
+
if (!a || !b) return false
|
|
124
|
+
for (let i = 0; i < 3; i++) {
|
|
125
|
+
const x = a[i] ?? 0
|
|
126
|
+
const y = b[i] ?? 0
|
|
127
|
+
if (x !== y) return x > y
|
|
128
|
+
}
|
|
129
|
+
return true
|
|
130
|
+
}
|
|
131
|
+
|
|
102
132
|
/** Output with stray ANSI escapes removed and blank lines dropped. */
|
|
103
133
|
export function cleanOutput(text: string): string[] {
|
|
104
134
|
return text
|
|
@@ -111,6 +141,19 @@ export function cleanOutput(text: string): string[] {
|
|
|
111
141
|
|
|
112
142
|
let isRunning = false
|
|
113
143
|
let timer: { cancel: () => void } | undefined
|
|
144
|
+
// The band's width as the last draw saw it; the next run fits the text to it
|
|
145
|
+
let bandColumns: number | undefined
|
|
146
|
+
// Whether this engine takes the clip props; read once, after a reload again
|
|
147
|
+
let canClip: Promise<boolean> | undefined
|
|
148
|
+
|
|
149
|
+
/** Whether the engine is CLIP_MIN_VERSION or later. An engine that cannot say counts as older. */
|
|
150
|
+
function engineCanClip($: EngineInterface): Promise<boolean> {
|
|
151
|
+
canClip ??= $.session
|
|
152
|
+
.version()
|
|
153
|
+
.then(v => atLeast(v.base ?? v.version, CLIP_MIN_VERSION))
|
|
154
|
+
.catch(() => false)
|
|
155
|
+
return canClip
|
|
156
|
+
}
|
|
114
157
|
|
|
115
158
|
/** Runs the statusline once and stores its text; any failure leaves the last text as it was. */
|
|
116
159
|
async function refresh($: EngineInterface): Promise<void> {
|
|
@@ -125,7 +168,7 @@ async function refresh($: EngineInterface): Promise<void> {
|
|
|
125
168
|
$.session.usage(),
|
|
126
169
|
$.settings.read(),
|
|
127
170
|
])
|
|
128
|
-
const run = await $.process.run(statuslineArgv(settings), {
|
|
171
|
+
const run = await $.process.run(withColumns(statuslineArgv(settings), bandColumns), {
|
|
129
172
|
stdin: JSON.stringify(statuslinePayload({ sessionId, cwd, model, usage })),
|
|
130
173
|
timeoutMs: RUN_TIMEOUT_MS,
|
|
131
174
|
})
|
|
@@ -158,15 +201,27 @@ export const register: Register = on => {
|
|
|
158
201
|
|
|
159
202
|
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
|
|
160
203
|
if (e.surface !== 'desktop' || e.props.hasSurvey) return next(e)
|
|
204
|
+
// A new width refits the text now rather than at the next tick
|
|
205
|
+
const columns = e.props.bodyColumns
|
|
206
|
+
if (typeof columns === 'number' && columns !== bandColumns) {
|
|
207
|
+
bandColumns = columns
|
|
208
|
+
void refresh($)
|
|
209
|
+
}
|
|
161
210
|
const shown = (await read($, lines)).slice(0, Math.max(0, e.props.maxRows))
|
|
162
211
|
if (!shown.length) return next(e)
|
|
163
212
|
|
|
164
213
|
const { Box, Text } = $.ui.resolve(e)
|
|
214
|
+
// On an engine that has them, a line wider than the band stays on its row
|
|
215
|
+
// and scrolls sideways instead of wrapping in the middle of a chip. They go
|
|
216
|
+
// in as spreads so the module still type-checks against older engine types.
|
|
217
|
+
const clip = await engineCanClip($)
|
|
218
|
+
const boxProps = clip ? { overflowX: 'scroll' as const } : {}
|
|
219
|
+
const textProps = clip ? { wrap: 'clip' as const } : {}
|
|
165
220
|
// One statusline line per row; a Box lays its children out in a row unless told otherwise
|
|
166
221
|
return (
|
|
167
|
-
<Box flexDirection="column">
|
|
222
|
+
<Box flexDirection="column" {...boxProps}>
|
|
168
223
|
{shown.map((line, i) => (
|
|
169
|
-
<Text key={`line-${i}`} dimColor>
|
|
224
|
+
<Text key={`line-${i}`} dimColor {...textProps}>
|
|
170
225
|
{line}
|
|
171
226
|
</Text>
|
|
172
227
|
))}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprag-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.131.0",
|
|
4
4
|
"description": "The delegation layer for Claude Code and Codex: each task goes to the model and effort that fits it, down to cheaper models for lookups and up to higher effort when a cheaper run would miss, backed by public replay cases, with a live statusline and team rules for Pro and Enterprise.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which Claude Code is running this hook or command, read without spawning it.
|
|
3
|
+
*
|
|
4
|
+
* Measured on Claude Code 2.1.319: the SessionStart and UserPromptSubmit hook
|
|
5
|
+
* processes carry AI_AGENT=claude-code_2-1-319_harness, and the Bash tool's
|
|
6
|
+
* children carry claude-code_2-1-319_agent. The Claude process's own
|
|
7
|
+
* environment does not have it, so the value exists only in hook and tool
|
|
8
|
+
* children. That is enough here, because the callers are hooks and CLI
|
|
9
|
+
* commands that a session runs. `claude --version` is deliberately not used: it
|
|
10
|
+
* would slow the hook path and make tests depend on the machine.
|
|
11
|
+
*
|
|
12
|
+
* Why the version matters: before 2.1.326 a session did not find an agent file
|
|
13
|
+
* first created while it was running ("Fixed a first skill, command or agent
|
|
14
|
+
* created during a session not being found right away").
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { isNewer } from './update-check.js';
|
|
18
|
+
|
|
19
|
+
export const AGENTS_LIVE_MIN_VERSION = '2.1.326';
|
|
20
|
+
|
|
21
|
+
const AI_AGENT_RE = /^claude-code_(\d+)-(\d+)-(\d+)(?:_|$)/;
|
|
22
|
+
|
|
23
|
+
/** Claude Code version from AI_AGENT ("claude-code_2-1-319_harness" -> "2.1.319"), or null. */
|
|
24
|
+
export function sessionClaudeVersion(env = process.env) {
|
|
25
|
+
const hit = AI_AGENT_RE.exec(String((env && env.AI_AGENT) || '').trim());
|
|
26
|
+
return hit ? `${hit[1]}.${hit[2]}.${hit[3]}` : null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* True when this Claude Code finds an agent first created mid-session; false
|
|
31
|
+
* when it is older; null when the version is unknown (callers treat null like
|
|
32
|
+
* false, so an old Claude Code is never assumed to be new).
|
|
33
|
+
*/
|
|
34
|
+
export function agentsLoadMidSession(version) {
|
|
35
|
+
if (!version) return null;
|
|
36
|
+
if (!/^\d+\.\d+\.\d+$/.test(String(version))) return null;
|
|
37
|
+
return version === AGENTS_LIVE_MIN_VERSION || isNewer(version, AGENTS_LIVE_MIN_VERSION);
|
|
38
|
+
}
|
package/src/codex/budget.js
CHANGED
|
@@ -30,7 +30,7 @@ export async function codexProviderKey(provider, { execute = run } = {}) {
|
|
|
30
30
|
let key = provider.key;
|
|
31
31
|
if (!key && typeof provider.command === 'string') {
|
|
32
32
|
try {
|
|
33
|
-
const result = await execute(provider.command, provider.args, { encoding: 'utf8', timeout: 10000, maxBuffer: 64 * 1024 });
|
|
33
|
+
const result = await execute(provider.command, provider.args, { encoding: 'utf8', timeout: 10000, maxBuffer: 64 * 1024, windowsHide: true });
|
|
34
34
|
key = result.stdout.trim().split(/\r?\n/).filter(Boolean).pop();
|
|
35
35
|
} catch { throw new Error('Codex provider authentication helper failed'); }
|
|
36
36
|
}
|
|
@@ -18,7 +18,7 @@ export function codexDelegationDiagnostics({ home = codexUserDir(), model = code
|
|
|
18
18
|
(profile?.features?.multi_agent ?? cfg.features?.multi_agent) === false;
|
|
19
19
|
} catch (e) { if (e.code !== 'ENOENT') result.errors.push('Cannot parse user config.'); }
|
|
20
20
|
const run = (args) => exec('codex', args, { encoding: 'utf8', timeout: 5000, maxBuffer: 20 * 1024 * 1024,
|
|
21
|
-
env: { ...process.env, CODEX_HOME: home }, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
21
|
+
env: { ...process.env, CODEX_HOME: home }, stdio: ['ignore', 'pipe', 'pipe'], windowsHide: true });
|
|
22
22
|
try { result.version = run(['--version']).trim().slice(0, 100); } catch { result.errors.push('Codex version unavailable.'); }
|
|
23
23
|
try {
|
|
24
24
|
for (const line of run(['features', 'list']).split('\n')) {
|
package/src/commands/delegate.js
CHANGED
|
@@ -190,6 +190,7 @@ async function agentsCommand(action, lang) {
|
|
|
190
190
|
const r = action === 'on' ? da.syncDelegationAgents() : da.removeDelegationAgents();
|
|
191
191
|
await rerender();
|
|
192
192
|
report(r);
|
|
193
|
+
if (r.createdDir) console.log(da.firstInstallCliLine({ lang: ko ? 'ko' : 'en' }));
|
|
193
194
|
console.log(action === 'on'
|
|
194
195
|
? (ko ? '위임 전용 에이전트를 켰습니다. 래칫 문구가 에이전트 이름으로 다시 만들어졌습니다.' : 'Delegation agents are on. The ratchet wording was re-rendered with the agent names.')
|
|
195
196
|
: (ko ? '위임 전용 에이전트를 껐습니다. 래칫 문구가 model 지정 방식으로 다시 만들어졌습니다.' : 'Delegation agents are off. The ratchet wording was re-rendered with plain model tiers.'));
|
package/src/commands/feedback.js
CHANGED
|
@@ -53,10 +53,10 @@ function metadata(version) {
|
|
|
53
53
|
|
|
54
54
|
function tryGhCli(title, body) {
|
|
55
55
|
try {
|
|
56
|
-
const auth = spawnSync('gh', ['auth', 'status'], { encoding: 'utf8', timeout: 10_000 });
|
|
56
|
+
const auth = spawnSync('gh', ['auth', 'status'], { encoding: 'utf8', timeout: 10_000, windowsHide: true });
|
|
57
57
|
if (auth.status !== 0) return null;
|
|
58
58
|
const res = spawnSync('gh', ['issue', 'create', '-R', REPO, '--title', title, '--body', body],
|
|
59
|
-
{ encoding: 'utf8', timeout: 30_000 });
|
|
59
|
+
{ encoding: 'utf8', timeout: 30_000, windowsHide: true });
|
|
60
60
|
if (res.status !== 0) { debug('feedback:gh', res.stderr); return null; }
|
|
61
61
|
const url = String(res.stdout).trim().split('\n').pop();
|
|
62
62
|
return { transport: 'gh', url };
|
package/src/commands/install.js
CHANGED
|
@@ -420,11 +420,13 @@ export async function run({ hasFlag }) {
|
|
|
420
420
|
// Presets now live in ratchet-preset.md. Moving the ones older versions
|
|
421
421
|
// appended to ratchet.md comes first, so they are not offered again below.
|
|
422
422
|
try {
|
|
423
|
-
const
|
|
423
|
+
const da = await import('../delegation-agents.js');
|
|
424
|
+
const d = da.syncDelegationAgents();
|
|
424
425
|
if (d.written.length) {
|
|
425
426
|
console.log(lang === 'ko'
|
|
426
427
|
? ` agents: 위임 전용 에이전트 ${d.written.length}개를 ~/.claude/agents 에 설치했습니다 (MCP 도구 없음).`
|
|
427
428
|
: ` agents: installed ${d.written.length} delegation-only agent(s) in ~/.claude/agents (no MCP tools).`);
|
|
429
|
+
if (d.createdDir) console.log(da.firstInstallCliLine({ lang }));
|
|
428
430
|
}
|
|
429
431
|
} catch (e) {
|
|
430
432
|
debug('install:delegation-agents', e);
|
|
@@ -327,7 +327,14 @@ export async function run({ args, hasFlag, numArg }) {
|
|
|
327
327
|
// session start; this one uses whatever was already cached.
|
|
328
328
|
try { (await import('../preset-sync.js')).spawnPresetSyncIfDue(); } catch (e) { debug('route-scan:preset-sync', e); }
|
|
329
329
|
// Agent files come first so the ratchet-model.md rendered next names them.
|
|
330
|
-
|
|
330
|
+
let agentsFirstBlock = null;
|
|
331
|
+
let agentsSync = null;
|
|
332
|
+
let da = null;
|
|
333
|
+
try {
|
|
334
|
+
da = await import('../delegation-agents.js');
|
|
335
|
+
agentsSync = da.syncDelegationAgents();
|
|
336
|
+
} catch (e) { debug('route-scan:delegation-agents', e); }
|
|
337
|
+
try { if (da && agentsSync) agentsFirstBlock = da.firstInstallNotice(agentsSync, { lang }); } catch (e) { debug('route-scan:agents-first', e); }
|
|
331
338
|
// The session's project is passed so its rule-less file follows the
|
|
332
339
|
// routing switch as well (see syncAllFiles).
|
|
333
340
|
try {
|
|
@@ -449,6 +456,7 @@ export async function run({ args, hasFlag, numArg }) {
|
|
|
449
456
|
if (updateBlock) console.log(updateBlock);
|
|
450
457
|
if (monthlyResetBlock) console.log(monthlyResetBlock);
|
|
451
458
|
if (driftBlock) console.log(driftBlock);
|
|
459
|
+
if (agentsFirstBlock) console.log(agentsFirstBlock);
|
|
452
460
|
if (seedBlock) console.log(seedBlock);
|
|
453
461
|
if (doc2mdBlock) console.log(doc2mdBlock);
|
|
454
462
|
if (koreanBlock) console.log(koreanBlock);
|
|
@@ -460,6 +468,7 @@ export async function run({ args, hasFlag, numArg }) {
|
|
|
460
468
|
if (updateBlock) console.log(updateBlock);
|
|
461
469
|
if (monthlyResetBlock) console.log(monthlyResetBlock);
|
|
462
470
|
if (driftBlock) console.log(driftBlock);
|
|
471
|
+
if (agentsFirstBlock) console.log(agentsFirstBlock);
|
|
463
472
|
if (seedBlock) console.log(seedBlock);
|
|
464
473
|
if (doc2mdBlock) console.log(doc2mdBlock);
|
|
465
474
|
// This text is injected straight into the model's context, so it must
|
package/src/commands/team.js
CHANGED
|
@@ -233,7 +233,7 @@ function openInBrowser(url) {
|
|
|
233
233
|
const cmd = process.platform === 'darwin' ? 'open' : win ? 'cmd' : 'xdg-open';
|
|
234
234
|
const args = win ? ['/c', 'start', '', url] : [url];
|
|
235
235
|
try {
|
|
236
|
-
const child = spawn(cmd, args, { detached: true, stdio: 'ignore' });
|
|
236
|
+
const child = spawn(cmd, args, { detached: true, stdio: 'ignore', windowsHide: true });
|
|
237
237
|
child.on('error', () => {});
|
|
238
238
|
child.unref();
|
|
239
239
|
} catch { /* no opener on this machine */ }
|
package/src/commands/upgrade.js
CHANGED
|
@@ -23,7 +23,7 @@ function runCommand(cmd) {
|
|
|
23
23
|
// Shell form: the upgrade command is a fixed string we composed ourselves
|
|
24
24
|
// (no user input reaches it), and `npm install -g` needs the user's PATH
|
|
25
25
|
// resolution to find the same npm that installed us.
|
|
26
|
-
const child = spawn(cmd, { shell: true, stdio: 'inherit' });
|
|
26
|
+
const child = spawn(cmd, { shell: true, stdio: 'inherit', windowsHide: true });
|
|
27
27
|
child.on('close', (code) => resolve(code === null ? 1 : code));
|
|
28
28
|
child.on('error', () => resolve(1));
|
|
29
29
|
});
|
package/src/compact-window.js
CHANGED
|
@@ -40,7 +40,7 @@ import { parseJsonText } from './json-text.js';
|
|
|
40
40
|
export const MODEL_SETTINGS_MIN_VERSION = '2.1.288';
|
|
41
41
|
|
|
42
42
|
/** Installed Claude Code version (`2.1.302`), or null when it cannot be read. */
|
|
43
|
-
export function claudeCodeVersion({ run = () => execFileSync('claude', ['--version'], { encoding: 'utf8', timeout: 3000, stdio: ['ignore', 'pipe', 'ignore'] }) } = {}) {
|
|
43
|
+
export function claudeCodeVersion({ run = () => execFileSync('claude', ['--version'], { encoding: 'utf8', timeout: 3000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true }) } = {}) {
|
|
44
44
|
try {
|
|
45
45
|
const m = String(run()).match(/(\d+\.\d+\.\d+)/);
|
|
46
46
|
return m ? m[1] : null;
|
package/src/cowork-sync.js
CHANGED
|
@@ -204,7 +204,7 @@ const isOwned = (file) => { try { return firstLine(file) === COWORK_MARKER; } ca
|
|
|
204
204
|
// ---------- git exclude ----------
|
|
205
205
|
|
|
206
206
|
const git = (dir, args) => execFileSync('git', ['-C', dir, ...args], {
|
|
207
|
-
timeout: 3000, stdio: ['ignore', 'pipe', 'ignore'], encoding: 'utf8',
|
|
207
|
+
timeout: 3000, stdio: ['ignore', 'pipe', 'ignore'], encoding: 'utf8', windowsHide: true,
|
|
208
208
|
}).trim();
|
|
209
209
|
|
|
210
210
|
function addGitExclude(dir) {
|
package/src/delegation-agents.js
CHANGED
|
@@ -17,6 +17,7 @@ import { join } from 'node:path';
|
|
|
17
17
|
import { claudeUserDir } from './paths.js';
|
|
18
18
|
import { loadConfig, saveConfig } from './config.js';
|
|
19
19
|
import { agentDefinitions, cliVersion, presetSource } from './presets-source.js';
|
|
20
|
+
import { AGENTS_LIVE_MIN_VERSION, agentsLoadMidSession, sessionClaudeVersion } from './claude-version.js';
|
|
20
21
|
|
|
21
22
|
export const OWNER_MARK = 'sprag:delegation-agent';
|
|
22
23
|
const MARK_LINE = `# managed by sprag (${OWNER_MARK}); edits are overwritten`;
|
|
@@ -100,16 +101,19 @@ export function removeDelegationAgents() {
|
|
|
100
101
|
if (f && isOwned(f.text)) { unlinkSync(p); removed.push(name); }
|
|
101
102
|
} catch { /* one file failing does not stop the rest */ }
|
|
102
103
|
}
|
|
103
|
-
return { written: [], unchanged: [], skipped: [], removed };
|
|
104
|
+
return { written: [], unchanged: [], skipped: [], removed, createdDir: false };
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
export function syncDelegationAgents({ agent = 'claude' } = {}) {
|
|
107
|
-
const res = { written: [], unchanged: [], skipped: [], removed: [] };
|
|
108
|
+
const res = { written: [], unchanged: [], skipped: [], removed: [], createdDir: false };
|
|
108
109
|
if (agent === 'codex') return res;
|
|
109
110
|
try {
|
|
110
111
|
if (loadConfig().delegationAgents === false) return removeDelegationAgents();
|
|
111
112
|
} catch { /* an unreadable config means the default, on */ }
|
|
112
113
|
const defs = definitions();
|
|
114
|
+
// Remembered before the loop: a Claude Code older than 2.1.326 does not see
|
|
115
|
+
// an agents folder that first appears mid-session (see claude-version.js).
|
|
116
|
+
const dirExisted = existsSync(agentsDir());
|
|
113
117
|
for (const def of defs) {
|
|
114
118
|
try {
|
|
115
119
|
const p = fileOf(def.name);
|
|
@@ -134,9 +138,44 @@ export function syncDelegationAgents({ agent = 'claude' } = {}) {
|
|
|
134
138
|
try { unlinkSync(fileOf(name)); res.removed.push(name); } catch { /* left for the next sync */ }
|
|
135
139
|
}
|
|
136
140
|
}
|
|
141
|
+
res.createdDir = !dirExisted && res.written.length > 0;
|
|
137
142
|
return res;
|
|
138
143
|
}
|
|
139
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Session-start notice for the first install of the agent files. Only a Claude
|
|
147
|
+
* Code older than AGENTS_LIVE_MIN_VERSION (or one whose version is unknown)
|
|
148
|
+
* needs it: it cannot find an agent created mid-session, so the model is told
|
|
149
|
+
* to delegate through general-purpose for this one session. Returns null when
|
|
150
|
+
* the folder was not just created or the running version finds the agents.
|
|
151
|
+
*/
|
|
152
|
+
export function firstInstallNotice(result, { lang = 'ko', env = process.env } = {}) {
|
|
153
|
+
if (!result || !result.createdDir || !Array.isArray(result.written) || result.written.length === 0) return null;
|
|
154
|
+
if (agentsLoadMidSession(sessionClaudeVersion(env)) === true) return null;
|
|
155
|
+
const names = result.written.join(', ');
|
|
156
|
+
const n = result.written.length;
|
|
157
|
+
return lang === 'ko'
|
|
158
|
+
? `✇ [sprag agents] 이번 세션을 시작하면서 위임 전용 에이전트 ${n}개(${names})를 처음 설치했습니다. Claude Code ${AGENTS_LIVE_MIN_VERSION} 미만은 세션 도중 처음 생긴 에이전트를 찾지 못하므로 이 세션에서는 이 이름으로 위임하지 말고 general-purpose에 model 인자(haiku, sonnet, opus)를 넘기십시오. 다음 세션부터는 에이전트 이름으로 위임합니다.`
|
|
159
|
+
: `✇ [sprag agents] This session start installed ${n} delegation-only agent(s) for the first time (${names}). Claude Code before ${AGENTS_LIVE_MIN_VERSION} does not find an agent first created mid-session, so in this session do not delegate by these names: use general-purpose with a model argument (haiku, sonnet, opus). From the next session on, delegate by agent name.`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The line `sprag install` and `delegate agents on` print after the first
|
|
164
|
+
* install of the agent files: whether a session already running can use them.
|
|
165
|
+
* One copy here so the two commands cannot drift apart.
|
|
166
|
+
*/
|
|
167
|
+
export function firstInstallCliLine({ lang = 'ko', env = process.env } = {}) {
|
|
168
|
+
const version = sessionClaudeVersion(env);
|
|
169
|
+
if (agentsLoadMidSession(version) === true) {
|
|
170
|
+
return lang === 'ko'
|
|
171
|
+
? ` 실행 중인 Claude Code 세션에서도 바로 쓸 수 있습니다(Claude Code ${version}).`
|
|
172
|
+
: ` Running Claude Code sessions can use them right away (Claude Code ${version}).`;
|
|
173
|
+
}
|
|
174
|
+
return lang === 'ko'
|
|
175
|
+
? ` 실행 중인 Claude Code 세션이 바로 찾으려면 ${AGENTS_LIVE_MIN_VERSION} 이상이어야 합니다. 그보다 오래된 버전은 새 세션부터 씁니다.`
|
|
176
|
+
: ` A running Claude Code session finds them right away only on ${AGENTS_LIVE_MIN_VERSION} or later; older versions pick them up from the next session.`;
|
|
177
|
+
}
|
|
178
|
+
|
|
140
179
|
export function delegationAgentStatus() {
|
|
141
180
|
let enabled = true;
|
|
142
181
|
try { enabled = loadConfig().delegationAgents !== false; } catch { /* default on */ }
|
package/src/doc2md.cjs
CHANGED
|
@@ -478,6 +478,7 @@ function spawnFigConvert(fig2md, filePath) {
|
|
|
478
478
|
encoding: 'utf8',
|
|
479
479
|
timeout: CONVERT_TIMEOUT_MS,
|
|
480
480
|
maxBuffer: MAX_MARKDOWN_BYTES * 4,
|
|
481
|
+
windowsHide: true,
|
|
481
482
|
});
|
|
482
483
|
if (run.error && run.error.code === 'ETIMEDOUT') return { ok: false, reason: 'timeout' };
|
|
483
484
|
if (run.status !== 0) {
|
package/src/gateway-auth.js
CHANGED
|
@@ -104,6 +104,7 @@ export function keyFromApiKeyHelper(cwd = process.cwd()) {
|
|
|
104
104
|
timeout: HELPER_TIMEOUT_MS,
|
|
105
105
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
106
106
|
env: { ...process.env, APIKEY_HELPER_NONINTERACTIVE: '1' },
|
|
107
|
+
windowsHide: true,
|
|
107
108
|
});
|
|
108
109
|
// 진행 로그를 함께 출력하는 헬퍼가 있으므로 마지막 비어 있지 않은 줄을 취합니다.
|
|
109
110
|
const token = out.trim().split(/\r?\n/).filter(Boolean).pop();
|
package/src/handoff.js
CHANGED
package/src/korean-style.js
CHANGED
|
@@ -89,7 +89,7 @@ export function koreanLocaleDetected({ env = process.env, platform = process.pla
|
|
|
89
89
|
// locale is the only reliable signal there.
|
|
90
90
|
const { execFileSync } = require('node:child_process');
|
|
91
91
|
const out = execFileSync('defaults', ['read', '-g', 'AppleLocale'], {
|
|
92
|
-
encoding: 'utf8', timeout: 2000, stdio: ['ignore', 'pipe', 'ignore'],
|
|
92
|
+
encoding: 'utf8', timeout: 2000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true,
|
|
93
93
|
}).trim();
|
|
94
94
|
if (/^ko(_|-|$)/i.test(out)) return true;
|
|
95
95
|
} catch { /* `defaults` missing or slow — treat as "not detected" */ }
|
|
@@ -95,7 +95,7 @@ export function scanSettingsFile(path) {
|
|
|
95
95
|
/** Run git without a shell. Returns the exit status, or null when git cannot answer (missing, timed out). */
|
|
96
96
|
function gitStatus(args, cwd) {
|
|
97
97
|
try {
|
|
98
|
-
execFileSync('git', args, { cwd, stdio: 'ignore', timeout: GIT_TIMEOUT_MS });
|
|
98
|
+
execFileSync('git', args, { cwd, stdio: 'ignore', timeout: GIT_TIMEOUT_MS, windowsHide: true });
|
|
99
99
|
return 0;
|
|
100
100
|
} catch (e) {
|
|
101
101
|
return typeof e.status === 'number' ? e.status : null;
|
package/src/team-sync.js
CHANGED
|
@@ -715,7 +715,7 @@ const DARWIN_TO_MACOS = { 20: '11', 21: '12', 22: '13', 23: '14', 24: '15', 25:
|
|
|
715
715
|
|
|
716
716
|
export function deviceInfo({
|
|
717
717
|
platform = process.platform, release = osRelease(),
|
|
718
|
-
exec = (cmd, args) => execFileSync(cmd, args, { timeout: 2000, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }),
|
|
718
|
+
exec = (cmd, args) => execFileSync(cmd, args, { timeout: 2000, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true }),
|
|
719
719
|
readText = (f) => readFileSync(f, 'utf8'),
|
|
720
720
|
} = {}) {
|
|
721
721
|
let os = String(platform);
|
package/src/transcript-lines.js
CHANGED
|
@@ -80,7 +80,7 @@ async function* zstdLines(filePath) {
|
|
|
80
80
|
|
|
81
81
|
// Node before 22.15 has no zstd in zlib; the binary is the only way to read these files there.
|
|
82
82
|
async function* zstdBinaryLines(filePath) {
|
|
83
|
-
const child = spawn('zstd', ['-dc', '--', filePath], { stdio: ['ignore', 'pipe', 'ignore'] });
|
|
83
|
+
const child = spawn('zstd', ['-dc', '--', filePath], { stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true });
|
|
84
84
|
// Registered before any await, so a very fast exit cannot slip past it.
|
|
85
85
|
const closed = new Promise((resolve) => child.once('close', (code) => resolve(code)));
|
|
86
86
|
// A missing binary reports through 'error', not through stdout, so settle that first.
|