@namzu/cli 0.5.1 → 0.7.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/dist/__tests__/permission-rules-reach-the-turn.test.d.ts +31 -0
- package/dist/__tests__/permission-rules-reach-the-turn.test.d.ts.map +1 -0
- package/dist/__tests__/permission-rules-reach-the-turn.test.js +132 -0
- package/dist/__tests__/permission-rules-reach-the-turn.test.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +16 -3
- package/dist/cli.js.map +1 -1
- package/dist/cli.test.js +7 -1
- package/dist/cli.test.js.map +1 -1
- package/dist/commands/__tests__/resume.test.d.ts +15 -0
- package/dist/commands/__tests__/resume.test.d.ts.map +1 -0
- package/dist/commands/__tests__/resume.test.js +116 -0
- package/dist/commands/__tests__/resume.test.js.map +1 -0
- package/dist/commands/__tests__/run-flags.test.d.ts +11 -0
- package/dist/commands/__tests__/run-flags.test.d.ts.map +1 -0
- package/dist/commands/__tests__/run-flags.test.js +189 -0
- package/dist/commands/__tests__/run-flags.test.js.map +1 -0
- package/dist/commands/__tests__/run-stream-flags.test.js +160 -11
- package/dist/commands/__tests__/run-stream-flags.test.js.map +1 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/resume.d.ts +60 -0
- package/dist/commands/resume.d.ts.map +1 -0
- package/dist/commands/resume.js +107 -0
- package/dist/commands/resume.js.map +1 -0
- package/dist/commands/run-flags.d.ts +76 -0
- package/dist/commands/run-flags.d.ts.map +1 -0
- package/dist/commands/run-flags.js +163 -0
- package/dist/commands/run-flags.js.map +1 -0
- package/dist/commands/run-stream.d.ts +3 -39
- package/dist/commands/run-stream.d.ts.map +1 -1
- package/dist/commands/run-stream.js +74 -101
- package/dist/commands/run-stream.js.map +1 -1
- package/dist/commands/run.d.ts +25 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +189 -16
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/stubs.d.ts +10 -0
- package/dist/commands/stubs.d.ts.map +1 -1
- package/dist/commands/stubs.js +12 -2
- package/dist/commands/stubs.js.map +1 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +20 -4
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +9 -12
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/doctor/checks/credentials.d.ts +20 -0
- package/dist/doctor/checks/credentials.d.ts.map +1 -0
- package/dist/doctor/checks/credentials.js +58 -0
- package/dist/doctor/checks/credentials.js.map +1 -0
- package/dist/doctor/checks/credentials.test.d.ts +10 -0
- package/dist/doctor/checks/credentials.test.d.ts.map +1 -0
- package/dist/doctor/checks/credentials.test.js +47 -0
- package/dist/doctor/checks/credentials.test.js.map +1 -0
- package/dist/doctor/checks/index.d.ts +2 -1
- package/dist/doctor/checks/index.d.ts.map +1 -1
- package/dist/doctor/checks/index.js +3 -1
- package/dist/doctor/checks/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/providers/discover.d.ts +3 -8
- package/dist/integrations/providers/discover.d.ts.map +1 -1
- package/dist/integrations/providers/discover.js +2 -12
- package/dist/integrations/providers/discover.js.map +1 -1
- package/dist/integrations/providers/discover.test.js +1 -28
- package/dist/integrations/providers/discover.test.js.map +1 -1
- package/dist/integrations/providers/index.d.ts +0 -1
- package/dist/integrations/providers/index.d.ts.map +1 -1
- package/dist/integrations/providers/index.js +0 -1
- package/dist/integrations/providers/index.js.map +1 -1
- package/dist/integrations/providers/oauth.d.ts +1 -1
- package/dist/integrations/providers/oauth.js +1 -1
- package/dist/integrations/providers/preferences.d.ts +2 -2
- package/dist/integrations/providers/preferences.js +2 -2
- package/dist/integrations/sessions/store.js +1 -1
- package/dist/integrations/sessions/store.js.map +1 -1
- package/dist/integrations/updates.d.ts +4 -12
- package/dist/integrations/updates.d.ts.map +1 -1
- package/dist/integrations/updates.js +6 -53
- package/dist/integrations/updates.js.map +1 -1
- package/dist/permissions/__tests__/mode.test.d.ts +10 -0
- package/dist/permissions/__tests__/mode.test.d.ts.map +1 -0
- package/dist/permissions/__tests__/mode.test.js +115 -0
- package/dist/permissions/__tests__/mode.test.js.map +1 -0
- package/dist/permissions/__tests__/rules.test.d.ts +10 -0
- package/dist/permissions/__tests__/rules.test.d.ts.map +1 -0
- package/dist/permissions/__tests__/rules.test.js +196 -0
- package/dist/permissions/__tests__/rules.test.js.map +1 -0
- package/dist/permissions/mode.d.ts +64 -0
- package/dist/permissions/mode.d.ts.map +1 -0
- package/dist/permissions/mode.js +32 -0
- package/dist/permissions/mode.js.map +1 -0
- package/dist/permissions/rules.d.ts +105 -0
- package/dist/permissions/rules.d.ts.map +1 -0
- package/dist/permissions/rules.js +163 -0
- package/dist/permissions/rules.js.map +1 -0
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +29 -133
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/Picker.d.ts +4 -4
- package/dist/tui/Picker.d.ts.map +1 -1
- package/dist/tui/Picker.js +6 -8
- package/dist/tui/Picker.js.map +1 -1
- package/dist/tui/__tests__/deferred-tool-discovery.test.d.ts +24 -0
- package/dist/tui/__tests__/deferred-tool-discovery.test.d.ts.map +1 -0
- package/dist/tui/__tests__/deferred-tool-discovery.test.js +111 -0
- package/dist/tui/__tests__/deferred-tool-discovery.test.js.map +1 -0
- package/dist/tui/__tests__/to-agent-event.test.js +88 -0
- package/dist/tui/__tests__/to-agent-event.test.js.map +1 -1
- package/dist/tui/__tests__/working-directory.test.d.ts +13 -0
- package/dist/tui/__tests__/working-directory.test.d.ts.map +1 -0
- package/dist/tui/__tests__/working-directory.test.js +109 -0
- package/dist/tui/__tests__/working-directory.test.js.map +1 -0
- package/dist/tui/agent.d.ts +46 -5
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/agent.js +140 -43
- package/dist/tui/agent.js.map +1 -1
- package/dist/tui/slashCommands.d.ts +0 -6
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/slashCommands.js +1 -21
- package/dist/tui/slashCommands.js.map +1 -1
- package/dist/tui/types.d.ts +12 -0
- package/dist/tui/types.d.ts.map +1 -1
- package/package.json +4 -5
- package/dist/commands/tools.d.ts +0 -16
- package/dist/commands/tools.d.ts.map +0 -1
- package/dist/commands/tools.js +0 -161
- package/dist/commands/tools.js.map +0 -1
- package/dist/integrations/clawtool/agents.d.ts +0 -31
- package/dist/integrations/clawtool/agents.d.ts.map +0 -1
- package/dist/integrations/clawtool/agents.js +0 -30
- package/dist/integrations/clawtool/agents.js.map +0 -1
- package/dist/integrations/clawtool/agents.test.d.ts +0 -2
- package/dist/integrations/clawtool/agents.test.d.ts.map +0 -1
- package/dist/integrations/clawtool/agents.test.js +0 -79
- package/dist/integrations/clawtool/agents.test.js.map +0 -1
- package/dist/integrations/clawtool/auth.d.ts +0 -26
- package/dist/integrations/clawtool/auth.d.ts.map +0 -1
- package/dist/integrations/clawtool/auth.js +0 -56
- package/dist/integrations/clawtool/auth.js.map +0 -1
- package/dist/integrations/clawtool/auth.test.d.ts +0 -2
- package/dist/integrations/clawtool/auth.test.d.ts.map +0 -1
- package/dist/integrations/clawtool/auth.test.js +0 -40
- package/dist/integrations/clawtool/auth.test.js.map +0 -1
- package/dist/integrations/clawtool/binary.d.ts +0 -25
- package/dist/integrations/clawtool/binary.d.ts.map +0 -1
- package/dist/integrations/clawtool/binary.js +0 -50
- package/dist/integrations/clawtool/binary.js.map +0 -1
- package/dist/integrations/clawtool/binary.test.d.ts +0 -2
- package/dist/integrations/clawtool/binary.test.d.ts.map +0 -1
- package/dist/integrations/clawtool/binary.test.js +0 -50
- package/dist/integrations/clawtool/binary.test.js.map +0 -1
- package/dist/integrations/clawtool/daemon.d.ts +0 -37
- package/dist/integrations/clawtool/daemon.d.ts.map +0 -1
- package/dist/integrations/clawtool/daemon.js +0 -109
- package/dist/integrations/clawtool/daemon.js.map +0 -1
- package/dist/integrations/clawtool/daemon.test.d.ts +0 -11
- package/dist/integrations/clawtool/daemon.test.d.ts.map +0 -1
- package/dist/integrations/clawtool/daemon.test.js +0 -118
- package/dist/integrations/clawtool/daemon.test.js.map +0 -1
- package/dist/integrations/clawtool/dispatch.d.ts +0 -33
- package/dist/integrations/clawtool/dispatch.d.ts.map +0 -1
- package/dist/integrations/clawtool/dispatch.js +0 -155
- package/dist/integrations/clawtool/dispatch.js.map +0 -1
- package/dist/integrations/clawtool/dispatch.test.d.ts +0 -2
- package/dist/integrations/clawtool/dispatch.test.d.ts.map +0 -1
- package/dist/integrations/clawtool/dispatch.test.js +0 -138
- package/dist/integrations/clawtool/dispatch.test.js.map +0 -1
- package/dist/integrations/clawtool/index.d.ts +0 -11
- package/dist/integrations/clawtool/index.d.ts.map +0 -1
- package/dist/integrations/clawtool/index.js +0 -10
- package/dist/integrations/clawtool/index.js.map +0 -1
- package/dist/integrations/clawtool/mcp.d.ts +0 -51
- package/dist/integrations/clawtool/mcp.d.ts.map +0 -1
- package/dist/integrations/clawtool/mcp.js +0 -174
- package/dist/integrations/clawtool/mcp.js.map +0 -1
- package/dist/integrations/clawtool/mcp.test.d.ts +0 -2
- package/dist/integrations/clawtool/mcp.test.d.ts.map +0 -1
- package/dist/integrations/clawtool/mcp.test.js +0 -126
- package/dist/integrations/clawtool/mcp.test.js.map +0 -1
- package/dist/integrations/clawtool/paths.d.ts +0 -8
- package/dist/integrations/clawtool/paths.d.ts.map +0 -1
- package/dist/integrations/clawtool/paths.js +0 -19
- package/dist/integrations/clawtool/paths.js.map +0 -1
- package/dist/integrations/clawtool/peers.d.ts +0 -67
- package/dist/integrations/clawtool/peers.d.ts.map +0 -1
- package/dist/integrations/clawtool/peers.js +0 -150
- package/dist/integrations/clawtool/peers.js.map +0 -1
- package/dist/integrations/clawtool/plugin.d.ts +0 -42
- package/dist/integrations/clawtool/plugin.d.ts.map +0 -1
- package/dist/integrations/clawtool/plugin.js +0 -38
- package/dist/integrations/clawtool/plugin.js.map +0 -1
- package/dist/integrations/clawtool/state.d.ts +0 -11
- package/dist/integrations/clawtool/state.d.ts.map +0 -1
- package/dist/integrations/clawtool/state.js +0 -41
- package/dist/integrations/clawtool/state.js.map +0 -1
- package/dist/integrations/clawtool/state.test.d.ts +0 -2
- package/dist/integrations/clawtool/state.test.d.ts.map +0 -1
- package/dist/integrations/clawtool/state.test.js +0 -38
- package/dist/integrations/clawtool/state.test.js.map +0 -1
- package/dist/integrations/clawtool/tooling.d.ts +0 -52
- package/dist/integrations/clawtool/tooling.d.ts.map +0 -1
- package/dist/integrations/clawtool/tooling.js +0 -91
- package/dist/integrations/clawtool/tooling.js.map +0 -1
- package/dist/integrations/clawtool/tooling.test.d.ts +0 -2
- package/dist/integrations/clawtool/tooling.test.d.ts.map +0 -1
- package/dist/integrations/clawtool/tooling.test.js +0 -58
- package/dist/integrations/clawtool/tooling.test.js.map +0 -1
- package/dist/integrations/clawtool/types.d.ts +0 -41
- package/dist/integrations/clawtool/types.d.ts.map +0 -1
- package/dist/integrations/clawtool/types.js +0 -9
- package/dist/integrations/clawtool/types.js.map +0 -1
- package/dist/integrations/providers/secrets.d.ts +0 -37
- package/dist/integrations/providers/secrets.d.ts.map +0 -1
- package/dist/integrations/providers/secrets.js +0 -69
- package/dist/integrations/providers/secrets.js.map +0 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `namzu run` accepts what `namzu run-stream` accepts.
|
|
3
|
+
*
|
|
4
|
+
* The two are the same headless one-shot and differ only in how they print, so
|
|
5
|
+
* an option one takes and the other reads aloud to the model is a defect, not a
|
|
6
|
+
* design. `run` joined every argument into the prompt, which is the exact shape
|
|
7
|
+
* already fixed once in the streaming sibling — `--cwd` was documented there,
|
|
8
|
+
* unparsed, and silently ran in the process's own directory.
|
|
9
|
+
*/
|
|
10
|
+
import { mkdtempSync, rmSync } from 'node:fs';
|
|
11
|
+
import { tmpdir } from 'node:os';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { Readable } from 'node:stream';
|
|
14
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
15
|
+
import { EXIT_USAGE } from '../../exit-codes.js';
|
|
16
|
+
import { composePrompt, runCommand } from '../run.js';
|
|
17
|
+
const seen = { prompt: null, cwd: undefined, provider: undefined, model: undefined };
|
|
18
|
+
vi.mock('../../tui/agent.js', () => ({
|
|
19
|
+
probeAgentSession: vi.fn(async () => ({
|
|
20
|
+
preferences: { version: 2, provider: 'mock', subagents: { active: [] } },
|
|
21
|
+
needsRepickReason: null,
|
|
22
|
+
detected: [],
|
|
23
|
+
})),
|
|
24
|
+
createAgentSession: vi.fn(async (prefs, _detected, opts) => {
|
|
25
|
+
seen.cwd = opts?.cwd;
|
|
26
|
+
seen.provider = prefs.provider;
|
|
27
|
+
seen.model = prefs.model;
|
|
28
|
+
return {
|
|
29
|
+
hasProvider: true,
|
|
30
|
+
providerSummary: 'mock',
|
|
31
|
+
modelSummary: 'mock-model',
|
|
32
|
+
toolNames: [],
|
|
33
|
+
errorHint: null,
|
|
34
|
+
send: (messages) => {
|
|
35
|
+
seen.prompt = messages[0]?.content ?? null;
|
|
36
|
+
return (async function* () {
|
|
37
|
+
yield { kind: 'done', stopReason: 'end_turn' };
|
|
38
|
+
})();
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}),
|
|
42
|
+
}));
|
|
43
|
+
function context() {
|
|
44
|
+
const printed = [];
|
|
45
|
+
const errors = [];
|
|
46
|
+
const ctx = {
|
|
47
|
+
formatter: {
|
|
48
|
+
name: 'text',
|
|
49
|
+
print: (d) => printed.push(String(d?.text ?? d)),
|
|
50
|
+
info: () => { },
|
|
51
|
+
error: (e) => errors.push(String(e?.message ?? e)),
|
|
52
|
+
},
|
|
53
|
+
config: {},
|
|
54
|
+
};
|
|
55
|
+
return { ctx, printed, errors };
|
|
56
|
+
}
|
|
57
|
+
async function run(rawArgs) {
|
|
58
|
+
seen.prompt = null;
|
|
59
|
+
seen.cwd = undefined;
|
|
60
|
+
seen.provider = undefined;
|
|
61
|
+
seen.model = undefined;
|
|
62
|
+
const { ctx, errors } = context();
|
|
63
|
+
const code = (await runCommand.handler({ rawArgs, ctx }));
|
|
64
|
+
return { code, errors };
|
|
65
|
+
}
|
|
66
|
+
describe('namzu run reads its options instead of reciting them', () => {
|
|
67
|
+
it('works in --cwd and keeps it out of the prompt', async () => {
|
|
68
|
+
const elsewhere = mkdtempSync(join(tmpdir(), 'namzu-run-cwd-'));
|
|
69
|
+
try {
|
|
70
|
+
const { code } = await run(['--cwd', elsewhere, 'fix', 'the', 'test']);
|
|
71
|
+
expect(code).toBe(0);
|
|
72
|
+
expect(seen.cwd).toBe(elsewhere);
|
|
73
|
+
// The whole point: the flag was previously the first two words the
|
|
74
|
+
// model was asked to act on.
|
|
75
|
+
expect(seen.prompt).toBe('fix the test');
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
rmSync(elsewhere, { recursive: true, force: true });
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
it('takes --provider and --model over the stored preference', async () => {
|
|
82
|
+
const { code } = await run(['--provider', 'openai', '--model', 'some-model', 'hello']);
|
|
83
|
+
expect(code).toBe(0);
|
|
84
|
+
expect(seen.provider).toBe('openai');
|
|
85
|
+
expect(seen.model).toBe('some-model');
|
|
86
|
+
expect(seen.prompt).toBe('hello');
|
|
87
|
+
});
|
|
88
|
+
it('refuses an option it does not know, with a usage exit code', async () => {
|
|
89
|
+
// A shell caller reads `$?`; saying "--temperature 0.5" to the model and
|
|
90
|
+
// exiting 0 is the failure this replaces.
|
|
91
|
+
const { code, errors } = await run(['--temperature', '0.5', 'hello']);
|
|
92
|
+
expect(code).toBe(EXIT_USAGE);
|
|
93
|
+
expect(errors.join('')).toContain('--temperature');
|
|
94
|
+
expect(seen.prompt).toBeNull();
|
|
95
|
+
});
|
|
96
|
+
it('refuses a --cwd that is not there rather than running in this one', async () => {
|
|
97
|
+
const { code, errors } = await run(['--cwd', join(tmpdir(), 'namzu-run-no-such'), 'hello']);
|
|
98
|
+
expect(code).toBe(EXIT_USAGE);
|
|
99
|
+
expect(errors.join('')).toContain('--cwd does not exist');
|
|
100
|
+
expect(seen.prompt).toBeNull();
|
|
101
|
+
});
|
|
102
|
+
it('lets `--` carry a prompt that begins with a dash', async () => {
|
|
103
|
+
const { code } = await run(['--', '--force', 'is', 'part', 'of', 'the', 'question']);
|
|
104
|
+
expect(code).toBe(0);
|
|
105
|
+
expect(seen.prompt).toBe('--force is part of the question');
|
|
106
|
+
});
|
|
107
|
+
it('accepts --yolo and does not put it in the prompt', async () => {
|
|
108
|
+
// Headless turns never prompt for approval, so there is nothing to skip.
|
|
109
|
+
// Accepting it silently is what keeps `namzu --yolo run …` working.
|
|
110
|
+
const { code } = await run(['--yolo', 'hello']);
|
|
111
|
+
expect(code).toBe(0);
|
|
112
|
+
expect(seen.prompt).toBe('hello');
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
describe('a pipe and a question are both the prompt', () => {
|
|
116
|
+
// `cat notes.txt | namzu run "summarise this"` read the three words and
|
|
117
|
+
// silently dropped the file: piped input was consulted only when there was
|
|
118
|
+
// no argument prompt. The run succeeded and answered about nothing.
|
|
119
|
+
it('keeps piped material alongside the question', () => {
|
|
120
|
+
const prompt = composePrompt('summarise this', 'line one\nline two\n');
|
|
121
|
+
expect(prompt).toContain('summarise this');
|
|
122
|
+
expect(prompt).toContain('line one');
|
|
123
|
+
expect(prompt).toContain('line two');
|
|
124
|
+
});
|
|
125
|
+
it('fences the piped material so it cannot read as part of the question', () => {
|
|
126
|
+
// Without a boundary the last line of a long paste runs into the
|
|
127
|
+
// instruction, and the model cannot tell the request from the material.
|
|
128
|
+
const prompt = composePrompt('what is wrong here?', 'const x = 1');
|
|
129
|
+
expect(prompt).toBe('what is wrong here?\n\n<stdin>\nconst x = 1\n</stdin>');
|
|
130
|
+
});
|
|
131
|
+
it('is just the pipe when no question was given', () => {
|
|
132
|
+
expect(composePrompt('', 'do the thing')).toBe('do the thing');
|
|
133
|
+
});
|
|
134
|
+
it('is just the question when nothing was piped', () => {
|
|
135
|
+
expect(composePrompt('do the thing', '')).toBe('do the thing');
|
|
136
|
+
// No empty tag block either — a model shown `<stdin></stdin>` is being
|
|
137
|
+
// told something was attached when nothing was.
|
|
138
|
+
expect(composePrompt('do the thing', ' \n ')).toBe('do the thing');
|
|
139
|
+
});
|
|
140
|
+
it('is empty when neither was given, so the caller can report it', () => {
|
|
141
|
+
expect(composePrompt('', '')).toBe('');
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
describe('the pipe reaches the model, not just the composer', () => {
|
|
145
|
+
// composePrompt is pure and proves the shape. This proves the plumbing:
|
|
146
|
+
// that piped bytes are actually READ when a prompt argument is present.
|
|
147
|
+
// They were not — stdin was consulted only when the argument was absent —
|
|
148
|
+
// and a unit test of the composer alone would pass with that defect intact.
|
|
149
|
+
function withStdin(text, fn) {
|
|
150
|
+
const real = Object.getOwnPropertyDescriptor(process, 'stdin');
|
|
151
|
+
const fake = text === null ? Readable.from([]) : Readable.from([Buffer.from(text)]);
|
|
152
|
+
Object.defineProperty(process, 'stdin', {
|
|
153
|
+
configurable: true,
|
|
154
|
+
get: () => Object.assign(fake, { isTTY: text === null }),
|
|
155
|
+
});
|
|
156
|
+
return fn().finally(() => {
|
|
157
|
+
if (real)
|
|
158
|
+
Object.defineProperty(process, 'stdin', real);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
it('sends the piped file alongside the question', async () => {
|
|
162
|
+
await withStdin('the contents of notes.txt', async () => {
|
|
163
|
+
const { code } = await run(['summarise this']);
|
|
164
|
+
expect(code).toBe(0);
|
|
165
|
+
expect(seen.prompt).toContain('summarise this');
|
|
166
|
+
expect(seen.prompt).toContain('the contents of notes.txt');
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
it('reads the pipe as the whole prompt for the `-` sentinel', async () => {
|
|
170
|
+
await withStdin('the question is in here', async () => {
|
|
171
|
+
const { code } = await run(['-']);
|
|
172
|
+
expect(code).toBe(0);
|
|
173
|
+
expect(seen.prompt).toBe('the question is in here');
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
describe('a flag that was never read is refused, not swallowed', () => {
|
|
178
|
+
// `--instance` was parsed into a field nothing anywhere in the repo read.
|
|
179
|
+
// A host passing it got the persona selection it asked for exactly never,
|
|
180
|
+
// and was told exactly nothing — which is worse than an absent flag,
|
|
181
|
+
// because an absent flag says so immediately.
|
|
182
|
+
it('refuses --instance now that it means nothing', async () => {
|
|
183
|
+
const { code, errors } = await run(['--instance', 'namzu-2', 'hello']);
|
|
184
|
+
expect(code).toBe(EXIT_USAGE);
|
|
185
|
+
expect(errors.join('')).toContain('--instance');
|
|
186
|
+
expect(seen.prompt).toBeNull();
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
//# sourceMappingURL=run-flags.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-flags.test.js","sourceRoot":"","sources":["../../../src/commands/__tests__/run-flags.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAGrD,MAAM,IAAI,GAKN,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAA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,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join, resolve } from 'node:path';
|
|
1
4
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
5
|
import { openSessions } from '../../integrations/sessions/store.js';
|
|
3
|
-
import {
|
|
6
|
+
import { parseRunFlags } from '../run-flags.js';
|
|
7
|
+
import { historyCommand, runStreamCommand, skillsJSONCommand } from '../run-stream.js';
|
|
4
8
|
// Mocked so the directory the store is opened at is observable. Nothing here
|
|
5
9
|
// touches a real `.namzu` store; `resolveConversation` returning null is the
|
|
6
10
|
// "no such session" path, which is what makes the handler terminate.
|
|
@@ -10,6 +14,28 @@ vi.mock('../../integrations/sessions/store.js', () => ({
|
|
|
10
14
|
loadConversation: vi.fn(async () => []),
|
|
11
15
|
appendMessages: vi.fn(async () => undefined),
|
|
12
16
|
}));
|
|
17
|
+
// Stubbed so a turn can be driven to completion without a credential, and so
|
|
18
|
+
// the directory the SESSION is created in is observable. What the session then
|
|
19
|
+
// does with that directory is asserted in `src/tui/__tests__/`.
|
|
20
|
+
const sessionOptions = [];
|
|
21
|
+
vi.mock('../../tui/agent.js', () => ({
|
|
22
|
+
probeAgentSession: vi.fn(async () => ({
|
|
23
|
+
preferences: { version: 2, provider: 'anthropic', subagents: { active: [] } },
|
|
24
|
+
needsRepickReason: null,
|
|
25
|
+
detected: [],
|
|
26
|
+
})),
|
|
27
|
+
createAgentSession: vi.fn(async (_prefs, _detected, opts) => {
|
|
28
|
+
sessionOptions.push(opts);
|
|
29
|
+
return {
|
|
30
|
+
hasProvider: true,
|
|
31
|
+
providerSummary: 'stub',
|
|
32
|
+
modelSummary: 'stub',
|
|
33
|
+
toolNames: [],
|
|
34
|
+
errorHint: null,
|
|
35
|
+
send: async function* () { },
|
|
36
|
+
};
|
|
37
|
+
}),
|
|
38
|
+
}));
|
|
13
39
|
/**
|
|
14
40
|
* `run-stream` folded every argument it did not recognise into `rest`, and
|
|
15
41
|
* `rest.join(' ')` is the PROMPT. `--cwd <path>` was in this command's own help
|
|
@@ -22,7 +48,7 @@ vi.mock('../../integrations/sessions/store.js', () => ({
|
|
|
22
48
|
* to stop treating an option as content; the fix here is the same, plus
|
|
23
49
|
* actually honouring the flag that was advertised.
|
|
24
50
|
*/
|
|
25
|
-
const ctx = {};
|
|
51
|
+
const ctx = { config: {} };
|
|
26
52
|
function capture() {
|
|
27
53
|
const lines = [];
|
|
28
54
|
const spy = vi.spyOn(process.stdout, 'write').mockImplementation((chunk) => {
|
|
@@ -33,6 +59,7 @@ function capture() {
|
|
|
33
59
|
}
|
|
34
60
|
beforeEach(() => {
|
|
35
61
|
vi.mocked(openSessions).mockClear();
|
|
62
|
+
sessionOptions.length = 0;
|
|
36
63
|
});
|
|
37
64
|
afterEach(() => {
|
|
38
65
|
vi.restoreAllMocks();
|
|
@@ -71,51 +98,122 @@ describe('run-stream does not turn options into prompt text', () => {
|
|
|
71
98
|
expect(lines.join('')).toContain('"kind":"done"');
|
|
72
99
|
});
|
|
73
100
|
});
|
|
101
|
+
describe('run-stream works in the directory it was pointed at', () => {
|
|
102
|
+
it('hands --cwd to the agent session, not only to the session store', async () => {
|
|
103
|
+
// `--session` keeps the turn off stdin: without a session key the command
|
|
104
|
+
// reads prior history from a pipe, and in a test runner that pipe never
|
|
105
|
+
// closes.
|
|
106
|
+
const elsewhere = mkdtempSync(join(tmpdir(), 'namzu-run-stream-'));
|
|
107
|
+
try {
|
|
108
|
+
await run(['--cwd', elsewhere, '--session', 'k', 'read', 'notes.txt']);
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
rmSync(elsewhere, { recursive: true, force: true });
|
|
112
|
+
}
|
|
113
|
+
expect(sessionOptions[0]?.cwd).toBe(elsewhere);
|
|
114
|
+
});
|
|
115
|
+
it('refuses a --cwd that is not there instead of quietly using this one', async () => {
|
|
116
|
+
// The silent fallback is the whole defect: the run proceeds, searches the
|
|
117
|
+
// wrong tree, finds nothing, and reports that the file does not exist.
|
|
118
|
+
const lines = await run(['--cwd', join(tmpdir(), 'namzu-no-such-dir'), 'hello']);
|
|
119
|
+
const joined = lines.join('');
|
|
120
|
+
expect(joined).toContain('--cwd does not exist');
|
|
121
|
+
expect(joined).toContain('"kind":"done"');
|
|
122
|
+
expect(sessionOptions).toEqual([]);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
74
125
|
describe('the flag parser itself', () => {
|
|
75
126
|
// Asserted here rather than through the handler: a valid prompt sends the
|
|
76
127
|
// handler on to stdin and a provider probe, so the first version of this
|
|
77
128
|
// case hung for five seconds and failed on a timeout rather than on the
|
|
78
129
|
// behaviour. A pure function deserves to be called.
|
|
79
130
|
it('lets `--` carry a prompt that begins with a dash', () => {
|
|
80
|
-
const flags =
|
|
131
|
+
const flags = parseRunFlags(['--', '--this-is-the-prompt']);
|
|
81
132
|
expect(flags.rest).toEqual(['--this-is-the-prompt']);
|
|
82
133
|
expect(flags.unknown).toEqual([]);
|
|
83
134
|
});
|
|
84
135
|
it('stops interpreting options after `--`', () => {
|
|
85
|
-
const flags =
|
|
136
|
+
const flags = parseRunFlags(['--session', 'abc', '--', '--model', 'not-a-flag']);
|
|
86
137
|
expect(flags.session).toBe('abc');
|
|
87
138
|
expect(flags.model).toBeNull();
|
|
88
139
|
expect(flags.rest).toEqual(['--model', 'not-a-flag']);
|
|
89
140
|
});
|
|
90
141
|
it('reads --cwd in both spellings', () => {
|
|
91
|
-
expect(
|
|
92
|
-
expect(
|
|
93
|
-
expect(
|
|
142
|
+
expect(parseRunFlags(['--cwd', '/a', 'hi']).cwd).toBe('/a');
|
|
143
|
+
expect(parseRunFlags(['--cwd=/b', 'hi']).cwd).toBe('/b');
|
|
144
|
+
expect(parseRunFlags(['--cwd', '/a', 'hi']).rest).toEqual(['hi']);
|
|
94
145
|
});
|
|
95
146
|
it('leaves a lone dash alone, since that is not an option', () => {
|
|
96
|
-
expect(
|
|
97
|
-
expect(
|
|
147
|
+
expect(parseRunFlags(['-', 'hi']).unknown).toEqual([]);
|
|
148
|
+
expect(parseRunFlags(['-', 'hi']).rest).toEqual(['-', 'hi']);
|
|
98
149
|
});
|
|
99
150
|
});
|
|
151
|
+
describe('skills-json lists the directory it was pointed at', () => {
|
|
152
|
+
// A host that lists skills for one checkout and then runs a turn in that
|
|
153
|
+
// same checkout has to be told about the same skills both times. It was
|
|
154
|
+
// not: this command read the process directory whatever `--cwd` said, so
|
|
155
|
+
// it could offer a skill that `run-stream --cwd <there>` then could not
|
|
156
|
+
// find, and hide one that was actually available.
|
|
157
|
+
function skillIn(root, name) {
|
|
158
|
+
mkdirSync(join(root, 'skills', name), { recursive: true });
|
|
159
|
+
writeFileSync(join(root, 'skills', name, 'SKILL.md'), `---\nname: ${name}\ndescription: only in this checkout\n---\n\nbody\n`);
|
|
160
|
+
}
|
|
161
|
+
it('discovers the project skills under --cwd', async () => {
|
|
162
|
+
const elsewhere = mkdtempSync(join(tmpdir(), 'namzu-skills-'));
|
|
163
|
+
skillIn(elsewhere, 'only-over-there');
|
|
164
|
+
const { lines, restore } = capture();
|
|
165
|
+
try {
|
|
166
|
+
await skillsJSONCommand.handler({ rawArgs: ['--cwd', elsewhere], ctx });
|
|
167
|
+
}
|
|
168
|
+
finally {
|
|
169
|
+
restore();
|
|
170
|
+
rmSync(elsewhere, { recursive: true, force: true });
|
|
171
|
+
}
|
|
172
|
+
const names = JSON.parse(lines.join('').trim()).map((s) => s.name);
|
|
173
|
+
expect(names).toContain('only-over-there');
|
|
174
|
+
});
|
|
175
|
+
// There is deliberately no paired "and not from anywhere else" case: with
|
|
176
|
+
// the flag ignored the command read `packages/cli`, which has no skills
|
|
177
|
+
// directory, so a negative assertion passes with the defect still in place
|
|
178
|
+
// and would only look like coverage.
|
|
179
|
+
});
|
|
100
180
|
describe('history reads the directory it was pointed at', () => {
|
|
101
181
|
it('opens the store at --cwd, not at the process directory', async () => {
|
|
102
182
|
// Parsing the flag is not the fix; USING it is. An assertion that the
|
|
103
183
|
// command merely survives `--cwd` would pass with the wiring reverted —
|
|
104
184
|
// `[]` is printed either way — which would leave the flag parsed and
|
|
105
185
|
// still undriven, the exact shape being repaired here.
|
|
186
|
+
//
|
|
187
|
+
// A real directory, because `--cwd` is now resolved and checked before
|
|
188
|
+
// the store is opened: a path that is not there cannot be told apart
|
|
189
|
+
// from a session with no messages, so it never reaches the store.
|
|
190
|
+
const elsewhere = mkdtempSync(join(tmpdir(), 'namzu-history-'));
|
|
106
191
|
const { lines, restore } = capture();
|
|
107
192
|
try {
|
|
108
193
|
await historyCommand.handler({
|
|
109
|
-
rawArgs: ['--cwd',
|
|
194
|
+
rawArgs: ['--cwd', elsewhere, '--session', 'some-key'],
|
|
110
195
|
ctx,
|
|
111
196
|
});
|
|
112
197
|
}
|
|
113
198
|
finally {
|
|
114
199
|
restore();
|
|
200
|
+
rmSync(elsewhere, { recursive: true, force: true });
|
|
115
201
|
}
|
|
116
|
-
expect(openSessions).toHaveBeenCalledWith(
|
|
202
|
+
expect(openSessions).toHaveBeenCalledWith(elsewhere);
|
|
117
203
|
expect(lines.join('').trim()).toBe('[]');
|
|
118
204
|
});
|
|
205
|
+
it('resolves a relative --cwd against the process directory', async () => {
|
|
206
|
+
// A host that passes `.` or `../sibling` gets the directory it meant,
|
|
207
|
+
// and the agent downstream gets an absolute path it cannot misread.
|
|
208
|
+
const { restore } = capture();
|
|
209
|
+
try {
|
|
210
|
+
await historyCommand.handler({ rawArgs: ['--cwd', '.', '--session', 'k'], ctx });
|
|
211
|
+
}
|
|
212
|
+
finally {
|
|
213
|
+
restore();
|
|
214
|
+
}
|
|
215
|
+
expect(openSessions).toHaveBeenCalledWith(resolve(process.cwd(), '.'));
|
|
216
|
+
});
|
|
119
217
|
it('falls back to the process directory when --cwd is absent', async () => {
|
|
120
218
|
const { restore } = capture();
|
|
121
219
|
try {
|
|
@@ -127,4 +225,55 @@ describe('history reads the directory it was pointed at', () => {
|
|
|
127
225
|
expect(openSessions).toHaveBeenCalledWith(process.cwd());
|
|
128
226
|
});
|
|
129
227
|
});
|
|
228
|
+
describe('run-stream honours the permission surface, not just parses it', () => {
|
|
229
|
+
// It accepted `--permission-mode` and never used it, and it never compiled
|
|
230
|
+
// the `[permissions]` table at all — so an operator who wrote rules, or who
|
|
231
|
+
// typed `--permission-mode strict` precisely because they did not trust the
|
|
232
|
+
// run, got an unrestricted one that looked like it had obeyed. A safety
|
|
233
|
+
// control that parses and does nothing is worse than one that is missing,
|
|
234
|
+
// because the absence is visible and the silence is not.
|
|
235
|
+
const withConfig = {
|
|
236
|
+
config: { permissions: { bash: 'deny' } },
|
|
237
|
+
};
|
|
238
|
+
async function runWith(rawArgs, context = withConfig) {
|
|
239
|
+
const { lines, restore } = capture();
|
|
240
|
+
try {
|
|
241
|
+
await runStreamCommand.handler({ rawArgs, ctx: context });
|
|
242
|
+
}
|
|
243
|
+
finally {
|
|
244
|
+
restore();
|
|
245
|
+
}
|
|
246
|
+
return lines;
|
|
247
|
+
}
|
|
248
|
+
it('compiles the operator table into the session', async () => {
|
|
249
|
+
await runWith(['--session', 'k', 'hello']);
|
|
250
|
+
expect(sessionOptions[0]?.rules).toEqual([{ type: 'deny_by_name', toolNames: ['bash'] }]);
|
|
251
|
+
});
|
|
252
|
+
it('passes --permission-mode through instead of ignoring it', async () => {
|
|
253
|
+
await runWith(['--session', 'k', '--permission-mode', 'strict', 'hello']);
|
|
254
|
+
expect(sessionOptions[0]?.permissionMode).toBe('strict');
|
|
255
|
+
});
|
|
256
|
+
it('refuses a mode it does not know rather than running unrestricted', async () => {
|
|
257
|
+
const lines = await runWith(['--session', 'k', '--permission-mode', 'yolo', 'hello']);
|
|
258
|
+
expect(lines.join('')).toContain('--permission-mode must be one of');
|
|
259
|
+
expect(sessionOptions).toEqual([]);
|
|
260
|
+
});
|
|
261
|
+
it('defaults to auto when nothing was asked for, and says so by acting on it', async () => {
|
|
262
|
+
await runWith(['--session', 'k', 'hello']);
|
|
263
|
+
expect(sessionOptions[0]?.permissionMode).toBe('auto');
|
|
264
|
+
});
|
|
265
|
+
it('reports an unreadable rule in band, where a host can see it', async () => {
|
|
266
|
+
const bad = {
|
|
267
|
+
config: { permissions: { bash: { 'git push*': 'maybe' } } },
|
|
268
|
+
};
|
|
269
|
+
const lines = await runWith(['--session', 'k', 'hello'], bad);
|
|
270
|
+
// Parsed, not substring-matched: the line is JSON, so the quotes around
|
|
271
|
+
// the pattern are escaped in the raw text and a naive contains() would
|
|
272
|
+
// pass or fail for reasons unrelated to what the host actually reads.
|
|
273
|
+
const messages = lines
|
|
274
|
+
.map((l) => JSON.parse(l))
|
|
275
|
+
.map((e) => e.message ?? '');
|
|
276
|
+
expect(messages.some((m) => m.includes('permissions.bash."git push*"'))).toBe(true);
|
|
277
|
+
});
|
|
278
|
+
});
|
|
130
279
|
//# sourceMappingURL=run-stream-flags.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-stream-flags.test.js","sourceRoot":"","sources":["../../../src/commands/__tests__/run-stream-flags.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGxF,6EAA6E;AAC7E,6EAA6E;AAC7E,qEAAqE;AACrE,EAAE,CAAC,IAAI,CAAC,sCAAsC,EAAE,GAAG,EAAE,CAAC,CAAC;IACtD,YAAY,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,CAAU,CAAC;IAC9C,mBAAmB,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,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AM,EAAE,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE;SAC9B,CAAA;QAE9B,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAA;QAE7D,wEAAwE;QACxE,uEAAuE;QACvE,sEAAsE;QACtE,MAAM,QAAQ,GAAG,KAAK;aACpB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAyB,CAAC;aACjD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;QAC7B,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACpF,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAyB,oBAAoB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC9F,OAAO,
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAyB,oBAAoB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC9F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG7C,MAAM,gBAAgB,GAA8B;IACnD,SAAS;IACT,WAAW;IACX,OAAO;IACP,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C,KAAK,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACvE,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAA;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAe;IACxC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,uDAAuD;IACpE,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC;CACzD,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Picking up a previous conversation from the command line.
|
|
3
|
+
*
|
|
4
|
+
* The store, the reader and the picker all existed; only the entry point was
|
|
5
|
+
* missing, so a conversation you could resume inside the TUI could not be
|
|
6
|
+
* resumed from a script.
|
|
7
|
+
*
|
|
8
|
+
* ## What happens when it cannot be done
|
|
9
|
+
*
|
|
10
|
+
* **It refuses, and names the cause. It never falls back to a new session.**
|
|
11
|
+
*
|
|
12
|
+
* Someone who types `--resume <id>` is asking for THAT conversation. The three
|
|
13
|
+
* available answers are not equally good:
|
|
14
|
+
*
|
|
15
|
+
* - *Start fresh* is the worst. They asked for a specific thing, got a
|
|
16
|
+
* different thing that is indistinguishable from outside, and nothing
|
|
17
|
+
* failed — they find out several turns later, having already acted on an
|
|
18
|
+
* agent that has no idea what they are referring to.
|
|
19
|
+
* - *Resume with whatever survived* is worse still. The agent gets a partial
|
|
20
|
+
* history and neither it nor the user knows which part is missing, so it acts
|
|
21
|
+
* confidently on a hole. A half-context is not a degraded context; it is a
|
|
22
|
+
* different context that lies about being complete.
|
|
23
|
+
* - *Refuse* costs one command and loses nothing.
|
|
24
|
+
*
|
|
25
|
+
* The message names the CAUSE rather than the outcome, because the causes have
|
|
26
|
+
* different next moves — a conversation belonging to another directory is
|
|
27
|
+
* fixed with `--cwd`, and an empty store is not fixed at all. "Cannot resume"
|
|
28
|
+
* alone sends someone hunting through a store that is fine.
|
|
29
|
+
*
|
|
30
|
+
* There is deliberately no way to spell "resume if you can, otherwise start".
|
|
31
|
+
* If that is what you want, run the command with no flag. The absence of a
|
|
32
|
+
* thing must not be spellable as a silent widening of it.
|
|
33
|
+
*/
|
|
34
|
+
import type { Message } from '@namzu/sdk';
|
|
35
|
+
import { type CliSessions } from '../integrations/sessions/store.js';
|
|
36
|
+
export interface ResumeRequest {
|
|
37
|
+
/** `--continue`: the most recent conversation in this directory. */
|
|
38
|
+
readonly continueLast: boolean;
|
|
39
|
+
/** `--resume <id>`: this conversation, and no other. */
|
|
40
|
+
readonly sessionId: string | null;
|
|
41
|
+
}
|
|
42
|
+
export type ResumeOutcome = {
|
|
43
|
+
readonly kind: 'fresh';
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: 'resumed';
|
|
46
|
+
readonly sessionId: string;
|
|
47
|
+
readonly messages: readonly Message[];
|
|
48
|
+
} | {
|
|
49
|
+
readonly kind: 'error';
|
|
50
|
+
readonly message: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Resolve what a `--continue` / `--resume` asked for.
|
|
54
|
+
*
|
|
55
|
+
* `cwd` is carried only so a refusal can name the directory it looked in — the
|
|
56
|
+
* most common cause of "no previous session" is standing in the wrong one, and
|
|
57
|
+
* a message that does not say where it looked cannot tell you that.
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveResume(sessions: CliSessions | null, request: ResumeRequest, cwd: string): Promise<ResumeOutcome>;
|
|
60
|
+
//# sourceMappingURL=resume.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume.d.ts","sourceRoot":"","sources":["../../src/commands/resume.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzC,OAAO,EACN,KAAK,WAAW,EAIhB,MAAM,mCAAmC,CAAA;AAE1C,MAAM,WAAW,aAAa;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAC9B,wDAAwD;IACxD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED,MAAM,MAAM,aAAa,GACtB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,GAC/F;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD;;;;;;GAMG;AACH,wBAAsB,aAAa,CAClC,QAAQ,EAAE,WAAW,GAAG,IAAI,EAC5B,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,aAAa,CAAC,CA6CxB"}
|