@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,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An operator's `permissions` config reaches the turn that enforces it.
|
|
3
|
+
*
|
|
4
|
+
* There was no test that started from a real config FILE and ended at a real
|
|
5
|
+
* turn, and that gap is the whole reason this shipped: the chain is broken in
|
|
6
|
+
* two independent places, in series, and every existing test sits on one side
|
|
7
|
+
* or the other of a break.
|
|
8
|
+
*
|
|
9
|
+
* config file → loadConfig() → compilePermissions() → createAgentSession()
|
|
10
|
+
* ↑ break 1 → query()
|
|
11
|
+
* ↑ break 2
|
|
12
|
+
*
|
|
13
|
+
* - **Break 1.** `sanitize()` in `config/load.ts` copies exactly `format` and
|
|
14
|
+
* `quiet` off a parsed config, so `permissions` is dropped from every file
|
|
15
|
+
* namzu reads. `compilePermissions(ctx.config.permissions)` in `run.ts` and
|
|
16
|
+
* `run-stream.ts` is therefore always compiling `undefined`.
|
|
17
|
+
* - **Break 2.** `runTurn` destructures `rules` and passes the module-level
|
|
18
|
+
* `VERIFICATION_GATE` — whose `rules` is a hardcoded `[]` — to `query()`.
|
|
19
|
+
* So even a caller that hands rules in explicitly has them dropped.
|
|
20
|
+
*
|
|
21
|
+
* Either break alone is enough to make a configured rule do nothing, which is
|
|
22
|
+
* why this test is end-to-end: fixing one and testing that one would report
|
|
23
|
+
* success while the feature stayed broken.
|
|
24
|
+
*
|
|
25
|
+
* The failure is silent by construction. `ask` compiles to no rule because the
|
|
26
|
+
* gate's fallback is already to ask, so a dropped `deny` looks exactly like a
|
|
27
|
+
* config that was honoured — the tool prompts instead of refusing, and a user
|
|
28
|
+
* who clicks approve never learns their `deny` was ignored.
|
|
29
|
+
*/
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=permission-rules-reach-the-turn.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-rules-reach-the-turn.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/permission-rules-reach-the-turn.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An operator's `permissions` config reaches the turn that enforces it.
|
|
3
|
+
*
|
|
4
|
+
* There was no test that started from a real config FILE and ended at a real
|
|
5
|
+
* turn, and that gap is the whole reason this shipped: the chain is broken in
|
|
6
|
+
* two independent places, in series, and every existing test sits on one side
|
|
7
|
+
* or the other of a break.
|
|
8
|
+
*
|
|
9
|
+
* config file → loadConfig() → compilePermissions() → createAgentSession()
|
|
10
|
+
* ↑ break 1 → query()
|
|
11
|
+
* ↑ break 2
|
|
12
|
+
*
|
|
13
|
+
* - **Break 1.** `sanitize()` in `config/load.ts` copies exactly `format` and
|
|
14
|
+
* `quiet` off a parsed config, so `permissions` is dropped from every file
|
|
15
|
+
* namzu reads. `compilePermissions(ctx.config.permissions)` in `run.ts` and
|
|
16
|
+
* `run-stream.ts` is therefore always compiling `undefined`.
|
|
17
|
+
* - **Break 2.** `runTurn` destructures `rules` and passes the module-level
|
|
18
|
+
* `VERIFICATION_GATE` — whose `rules` is a hardcoded `[]` — to `query()`.
|
|
19
|
+
* So even a caller that hands rules in explicitly has them dropped.
|
|
20
|
+
*
|
|
21
|
+
* Either break alone is enough to make a configured rule do nothing, which is
|
|
22
|
+
* why this test is end-to-end: fixing one and testing that one would report
|
|
23
|
+
* success while the feature stayed broken.
|
|
24
|
+
*
|
|
25
|
+
* The failure is silent by construction. `ask` compiles to no rule because the
|
|
26
|
+
* gate's fallback is already to ask, so a dropped `deny` looks exactly like a
|
|
27
|
+
* config that was honoured — the tool prompts instead of refusing, and a user
|
|
28
|
+
* who clicks approve never learns their `deny` was ignored.
|
|
29
|
+
*/
|
|
30
|
+
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
31
|
+
import { tmpdir } from 'node:os';
|
|
32
|
+
import { join } from 'node:path';
|
|
33
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
34
|
+
import { loadConfig } from '../config/load.js';
|
|
35
|
+
import { compilePermissions } from '../permissions/rules.js';
|
|
36
|
+
const queryCalls = [];
|
|
37
|
+
vi.mock('@namzu/sdk', async (importOriginal) => {
|
|
38
|
+
const actual = await importOriginal();
|
|
39
|
+
return {
|
|
40
|
+
...actual,
|
|
41
|
+
query: (params) => {
|
|
42
|
+
queryCalls.push(params);
|
|
43
|
+
return (async function* () { })();
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
let workDir;
|
|
48
|
+
beforeEach(() => {
|
|
49
|
+
queryCalls.length = 0;
|
|
50
|
+
workDir = mkdtempSync(join(tmpdir(), 'namzu-perms-'));
|
|
51
|
+
});
|
|
52
|
+
afterEach(() => {
|
|
53
|
+
rmSync(workDir, { recursive: true, force: true });
|
|
54
|
+
});
|
|
55
|
+
/** A real config file, in the real project-config location and format. */
|
|
56
|
+
function writeProjectConfig(permissions) {
|
|
57
|
+
writeFileSync(join(workDir, 'namzu.config.json'), JSON.stringify({ permissions }, null, 2));
|
|
58
|
+
}
|
|
59
|
+
const prefs = {
|
|
60
|
+
version: 2,
|
|
61
|
+
provider: 'anthropic',
|
|
62
|
+
subagents: { active: [] },
|
|
63
|
+
};
|
|
64
|
+
function detectedAnthropic() {
|
|
65
|
+
return [
|
|
66
|
+
{
|
|
67
|
+
entry: {
|
|
68
|
+
id: 'anthropic',
|
|
69
|
+
label: 'Anthropic',
|
|
70
|
+
defaultModel: 'claude-sonnet-4-5',
|
|
71
|
+
requiresApiKey: true,
|
|
72
|
+
envVars: ['ANTHROPIC_API_KEY'],
|
|
73
|
+
},
|
|
74
|
+
source: 'env',
|
|
75
|
+
apiKey: 'sk-ant-not-a-real-key',
|
|
76
|
+
alternatives: [],
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
describe('a permissions rule written in a config file', () => {
|
|
81
|
+
it('survives loadConfig', () => {
|
|
82
|
+
writeProjectConfig({ bash: 'deny' });
|
|
83
|
+
const cfg = loadConfig({ cwd: workDir, home: workDir, env: {} });
|
|
84
|
+
expect(cfg.permissions, 'the loader dropped the permissions table off a config file it parsed').toBeDefined();
|
|
85
|
+
expect(cfg.permissions?.bash).toBe('deny');
|
|
86
|
+
});
|
|
87
|
+
it('reaches the gate of the turn that has to enforce it', async () => {
|
|
88
|
+
writeProjectConfig({ bash: 'deny' });
|
|
89
|
+
// Exactly what `run.ts` does, from the same starting point a user has.
|
|
90
|
+
const cfg = loadConfig({ cwd: workDir, home: workDir, env: {} });
|
|
91
|
+
const compiled = compilePermissions(cfg.permissions);
|
|
92
|
+
const { createAgentSession } = await import('../tui/agent.js');
|
|
93
|
+
const session = await createAgentSession(prefs, detectedAnthropic(), {
|
|
94
|
+
cwd: workDir,
|
|
95
|
+
rules: compiled.rules,
|
|
96
|
+
});
|
|
97
|
+
for await (const _ of session.send([{ role: 'user', content: 'hi', timestamp: 0 }])) {
|
|
98
|
+
// drain
|
|
99
|
+
}
|
|
100
|
+
expect(queryCalls.length, 'the turn must have reached query()').toBe(1);
|
|
101
|
+
const gate = queryCalls[0]?.verificationGate;
|
|
102
|
+
expect(gate?.rules).toEqual([{ type: 'deny_by_name', toolNames: ['bash'] }]);
|
|
103
|
+
});
|
|
104
|
+
it('is not silently replaced by the empty default when handed in directly', async () => {
|
|
105
|
+
// DO NOT DELETE THIS AS REDUNDANT WITH THE TEST ABOVE. It looks like a
|
|
106
|
+
// subset of it and it is the opposite: it is the only test that isolates
|
|
107
|
+
// the turn path from the loader.
|
|
108
|
+
//
|
|
109
|
+
// There were two faults, in series. Rules were dropped by the loader AND
|
|
110
|
+
// again by the turn, and either one alone makes a configured rule do
|
|
111
|
+
// nothing. A suite with only the end-to-end test above would go green the
|
|
112
|
+
// moment ONE of them was fixed — reporting success on a feature that was
|
|
113
|
+
// still dead — and a suite with only a loader test would never have looked
|
|
114
|
+
// at the turn at all.
|
|
115
|
+
//
|
|
116
|
+
// So: no config file here, rules handed straight to the session. When this
|
|
117
|
+
// fails and the end-to-end one fails, the turn drops them. When only the
|
|
118
|
+
// end-to-end one fails, the loader is the sole fault. The pair of results
|
|
119
|
+
// is the diagnosis; neither test gives it alone.
|
|
120
|
+
const { createAgentSession } = await import('../tui/agent.js');
|
|
121
|
+
const session = await createAgentSession(prefs, detectedAnthropic(), {
|
|
122
|
+
cwd: workDir,
|
|
123
|
+
rules: [{ type: 'deny_by_name', toolNames: ['bash'] }],
|
|
124
|
+
});
|
|
125
|
+
for await (const _ of session.send([{ role: 'user', content: 'hi', timestamp: 0 }])) {
|
|
126
|
+
// drain
|
|
127
|
+
}
|
|
128
|
+
const gate = queryCalls[0]?.verificationGate;
|
|
129
|
+
expect(gate?.rules).toEqual([{ type: 'deny_by_name', toolNames: ['bash'] }]);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
//# sourceMappingURL=permission-rules-reach-the-turn.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-rules-reach-the-turn.test.js","sourceRoot":"","sources":["../../src/__tests__/permission-rules-reach-the-turn.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,MAAM,UAAU,GAA8B,EAAE,CAAA;AAChD,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;IAC9C,MAAM,MAAM,GAAG,MAAM,cAAc,EAA+B,CAAA;IAClE,OAAO;QACN,GAAG,MAAM;QACT,KAAK,EAAE,CAAC,MAA+B,EAAE,EAAE;YAC1C,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YACvB,OAAO,CAAC,KAAK,SAAS,CAAC,MAAK,CAAC,CAAC,EAAE,CAAA;QACjC,CAAC;KACD,CAAA;AACF,CAAC,CAAC,CAAA;AAEF,IAAI,OAAe,CAAA;AAEnB,UAAU,CAAC,GAAG,EAAE;IACf,UAAU,CAAC,MAAM,GAAG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AAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAChC;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgDH,MAAM,WAAW,aAAa;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAChC;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAwGjE"}
|
package/dist/cli.js
CHANGED
|
@@ -17,10 +17,10 @@ import { registerAll } from './commands/registry.js';
|
|
|
17
17
|
import { historyCommand, providersJSONCommand, runStreamCommand, skillsJSONCommand, } from './commands/run-stream.js';
|
|
18
18
|
import { runCommand } from './commands/run.js';
|
|
19
19
|
import { stubCommands } from './commands/stubs.js';
|
|
20
|
-
import { toolsCommand } from './commands/tools.js';
|
|
21
20
|
import { loadConfig } from './config/load.js';
|
|
22
21
|
import { EXIT_INTERNAL_ERROR } from './exit-codes.js';
|
|
23
22
|
import { createFormatter, isFormatName } from './output/index.js';
|
|
23
|
+
import { compilePermissions } from './permissions/rules.js';
|
|
24
24
|
/** sysexits EX_USAGE — command-line argument error. */
|
|
25
25
|
const EX_USAGE = 64;
|
|
26
26
|
// Read the version straight from the package manifest so the `--version`
|
|
@@ -75,7 +75,6 @@ export async function runCli(opts) {
|
|
|
75
75
|
};
|
|
76
76
|
registerAll(program, [
|
|
77
77
|
doctorCommand,
|
|
78
|
-
toolsCommand,
|
|
79
78
|
providersCommand,
|
|
80
79
|
runCommand,
|
|
81
80
|
evalCommand,
|
|
@@ -96,8 +95,22 @@ export async function runCli(opts) {
|
|
|
96
95
|
if (process.stdout.isTTY) {
|
|
97
96
|
const launchOpts = program.opts();
|
|
98
97
|
const skipPermissions = Boolean(launchOpts.dangerouslySkipPermissions || launchOpts.yolo);
|
|
98
|
+
// The same three lines `run` and `run-stream` use. The TUI compiled
|
|
99
|
+
// nothing at all, so a `permissions` table in a config file did nothing
|
|
100
|
+
// in the mode most people actually use.
|
|
101
|
+
const tuiCtx = getContext();
|
|
102
|
+
const permissions = compilePermissions(tuiCtx.config.permissions);
|
|
103
|
+
for (const d of permissions.diagnostics) {
|
|
104
|
+
const where = d.pattern ? `permissions.${d.tool}."${d.pattern}"` : `permissions.${d.tool}`;
|
|
105
|
+
tuiCtx.formatter.error({ message: `${where}: ${d.message}` });
|
|
106
|
+
}
|
|
99
107
|
const { launchTui } = await import('./tui/index.js');
|
|
100
|
-
await launchTui({
|
|
108
|
+
await launchTui({
|
|
109
|
+
cwd: process.cwd(),
|
|
110
|
+
version: CLI_VERSION,
|
|
111
|
+
skipPermissions,
|
|
112
|
+
rules: permissions.rules,
|
|
113
|
+
});
|
|
101
114
|
const code = await Promise.resolve(0);
|
|
102
115
|
setExitCode(code);
|
|
103
116
|
return;
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EACN,cAAc,EACd,oBAAoB,EACpB,gBA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C,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAC7E,CAAA;QACD,OAAO,mBAAmB,CAAA;IAC3B,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAmB;IAC7C,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,yBAAyB,CAAC;QAC/B,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB;YACvB,OAAO,CAAC,CAAA;QACT,KAAK,0BAA0B,CAAC;QAChC,KAAK,yBAAyB,CAAC;QAC/B,KAAK,2BAA2B,CAAC;QACjC,KAAK,uCAAuC,CAAC;QAC7C,KAAK,2BAA2B,CAAC;QACjC,KAAK,iCAAiC,CAAC;QACvC,KAAK,2BAA2B;YAC/B,OAAO,QAAQ,CAAA;QAChB;YACC,OAAO,mBAAmB,CAAA;IAC5B,CAAC;AACF,CAAC"}
|
package/dist/cli.test.js
CHANGED
|
@@ -30,10 +30,16 @@ describe('runCli', () => {
|
|
|
30
30
|
// Commander prints help to stdout.
|
|
31
31
|
expect(stdout).toContain('namzu');
|
|
32
32
|
expect(stdout).toContain('doctor');
|
|
33
|
-
expect(stdout).toContain('tools');
|
|
34
33
|
expect(stdout).toContain('providers');
|
|
35
34
|
expect(stdout).toContain('skills');
|
|
36
35
|
expect(stdout).toContain('serve');
|
|
36
|
+
// `tools` was asserted here until the peer-daemon removal deleted the
|
|
37
|
+
// command. The assertion kept passing, because "tools" also occurs in
|
|
38
|
+
// the --dangerously-skip-permissions description ("Run tools without
|
|
39
|
+
// asking…") — a substring match on whole help output cannot tell a
|
|
40
|
+
// command from a word in a sentence. Anchored to the command column so
|
|
41
|
+
// it means what it says.
|
|
42
|
+
expect(stdout).not.toMatch(/^\s+tools\b/m);
|
|
37
43
|
// `chat` was a misread of the product shape — the TUI IS the chat,
|
|
38
44
|
// not a separate subcommand. `chat` must not appear in help.
|
|
39
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+
* The rule under test: when the named conversation cannot be resumed, this
|
|
5
|
+
* REFUSES and names the cause. It never falls back to a fresh session, and it
|
|
6
|
+
* never resumes with a partial history.
|
|
7
|
+
*
|
|
8
|
+
* Both fallbacks would be invisible from outside. The user asked for a specific
|
|
9
|
+
* conversation, would get something that looks like one, and would find out
|
|
10
|
+
* several turns later having already acted on it. A half-context is the worse
|
|
11
|
+
* of the two: it is not a degraded context, it is a different context that lies
|
|
12
|
+
* about being complete.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=resume.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume.test.d.ts","sourceRoot":"","sources":["../../../src/commands/__tests__/resume.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resuming a conversation, and — mostly — refusing to.
|
|
3
|
+
*
|
|
4
|
+
* The rule under test: when the named conversation cannot be resumed, this
|
|
5
|
+
* REFUSES and names the cause. It never falls back to a fresh session, and it
|
|
6
|
+
* never resumes with a partial history.
|
|
7
|
+
*
|
|
8
|
+
* Both fallbacks would be invisible from outside. The user asked for a specific
|
|
9
|
+
* conversation, would get something that looks like one, and would find out
|
|
10
|
+
* several turns later having already acted on it. A half-context is the worse
|
|
11
|
+
* of the two: it is not a degraded context, it is a different context that lies
|
|
12
|
+
* about being complete.
|
|
13
|
+
*/
|
|
14
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
15
|
+
import { listRecent, loadConversation } from '../../integrations/sessions/store.js';
|
|
16
|
+
import { resolveResume } from '../resume.js';
|
|
17
|
+
vi.mock('../../integrations/sessions/store.js', () => ({
|
|
18
|
+
listRecent: vi.fn(),
|
|
19
|
+
loadConversation: vi.fn(),
|
|
20
|
+
}));
|
|
21
|
+
const sessions = {};
|
|
22
|
+
const CWD = '/projects/foo';
|
|
23
|
+
function recent(...ids) {
|
|
24
|
+
vi.mocked(listRecent).mockResolvedValue(ids.map((id, i) => ({
|
|
25
|
+
id: id,
|
|
26
|
+
title: id,
|
|
27
|
+
updatedAt: `2026-08-0${i + 1}T00:00:00Z`,
|
|
28
|
+
count: 2,
|
|
29
|
+
})));
|
|
30
|
+
}
|
|
31
|
+
describe('asking for nothing', () => {
|
|
32
|
+
it('is a fresh run, not an error', async () => {
|
|
33
|
+
const out = await resolveResume(sessions, { continueLast: false, sessionId: null }, CWD);
|
|
34
|
+
expect(out.kind).toBe('fresh');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
describe('--continue', () => {
|
|
38
|
+
it('takes the most recent conversation', async () => {
|
|
39
|
+
recent('ses_new', 'ses_old');
|
|
40
|
+
vi.mocked(loadConversation).mockResolvedValue([
|
|
41
|
+
{ role: 'user', content: 'hi', timestamp: 0 },
|
|
42
|
+
]);
|
|
43
|
+
const out = await resolveResume(sessions, { continueLast: true, sessionId: null }, CWD);
|
|
44
|
+
expect(out).toMatchObject({ kind: 'resumed', sessionId: 'ses_new' });
|
|
45
|
+
});
|
|
46
|
+
it('refuses with its OWN sentence when there is nothing here', async () => {
|
|
47
|
+
// Not "cannot resume" — the cause is different and so is the fix. Someone
|
|
48
|
+
// with no conversation here is usually standing in the wrong directory,
|
|
49
|
+
// so the message has to point at --cwd rather than at a broken store.
|
|
50
|
+
recent();
|
|
51
|
+
const out = await resolveResume(sessions, { continueLast: true, sessionId: null }, CWD);
|
|
52
|
+
expect(out.kind).toBe('error');
|
|
53
|
+
expect(out).toMatchObject({ message: expect.stringContaining('no previous conversation') });
|
|
54
|
+
expect(out).toMatchObject({ message: expect.stringContaining(CWD) });
|
|
55
|
+
expect(out).toMatchObject({ message: expect.stringContaining('--cwd') });
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe('--resume <id>', () => {
|
|
59
|
+
it('takes the conversation it was given, not the most recent', async () => {
|
|
60
|
+
recent('ses_new', 'ses_wanted');
|
|
61
|
+
vi.mocked(loadConversation).mockResolvedValue([
|
|
62
|
+
{ role: 'user', content: 'hi', timestamp: 0 },
|
|
63
|
+
]);
|
|
64
|
+
const out = await resolveResume(sessions, { continueLast: false, sessionId: 'ses_wanted' }, CWD);
|
|
65
|
+
expect(out).toMatchObject({ kind: 'resumed', sessionId: 'ses_wanted' });
|
|
66
|
+
});
|
|
67
|
+
it('refuses an id that is not here, and says how many are', async () => {
|
|
68
|
+
// THE case. Starting fresh would hand back something indistinguishable
|
|
69
|
+
// from what was asked for.
|
|
70
|
+
recent('ses_a', 'ses_b');
|
|
71
|
+
const out = await resolveResume(sessions, { continueLast: false, sessionId: 'ses_gone' }, CWD);
|
|
72
|
+
expect(out.kind).toBe('error');
|
|
73
|
+
expect(out).toMatchObject({ message: expect.stringContaining('ses_gone') });
|
|
74
|
+
expect(out).toMatchObject({ message: expect.stringContaining('2 others') });
|
|
75
|
+
});
|
|
76
|
+
it('points at --cwd when the directory has nothing at all', async () => {
|
|
77
|
+
recent();
|
|
78
|
+
const out = await resolveResume(sessions, { continueLast: false, sessionId: 'ses_gone' }, CWD);
|
|
79
|
+
expect(out).toMatchObject({ message: expect.stringContaining('--cwd') });
|
|
80
|
+
});
|
|
81
|
+
it('refuses rather than resuming with a partial history', async () => {
|
|
82
|
+
// The half-context case. Carrying on with an empty transcript would look
|
|
83
|
+
// exactly like a resumed session to the user and to the model.
|
|
84
|
+
recent('ses_a');
|
|
85
|
+
vi.mocked(loadConversation).mockRejectedValue(new Error('transcript is corrupt'));
|
|
86
|
+
const out = await resolveResume(sessions, { continueLast: false, sessionId: 'ses_a' }, CWD);
|
|
87
|
+
expect(out.kind).toBe('error');
|
|
88
|
+
expect(out).toMatchObject({ message: expect.stringContaining('transcript is corrupt') });
|
|
89
|
+
});
|
|
90
|
+
it('refuses an empty transcript rather than calling it resumed', async () => {
|
|
91
|
+
recent('ses_a');
|
|
92
|
+
vi.mocked(loadConversation).mockResolvedValue([]);
|
|
93
|
+
const out = await resolveResume(sessions, { continueLast: false, sessionId: 'ses_a' }, CWD);
|
|
94
|
+
expect(out.kind).toBe('error');
|
|
95
|
+
expect(out).toMatchObject({ message: expect.stringContaining('no messages') });
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
describe('the two flags together', () => {
|
|
99
|
+
it('refuses, because they name different conversations', async () => {
|
|
100
|
+
const out = await resolveResume(sessions, { continueLast: true, sessionId: 'ses_a' }, CWD);
|
|
101
|
+
expect(out.kind).toBe('error');
|
|
102
|
+
expect(out).toMatchObject({ message: expect.stringContaining('Pass one') });
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
describe('no store at all', () => {
|
|
106
|
+
it('refuses instead of quietly starting fresh', async () => {
|
|
107
|
+
const out = await resolveResume(null, { continueLast: true, sessionId: null }, CWD);
|
|
108
|
+
expect(out.kind).toBe('error');
|
|
109
|
+
expect(out).toMatchObject({ message: expect.stringContaining('nothing to resume') });
|
|
110
|
+
});
|
|
111
|
+
it('still runs fresh when nothing was asked for', async () => {
|
|
112
|
+
const out = await resolveResume(null, { continueLast: false, sessionId: null }, CWD);
|
|
113
|
+
expect(out.kind).toBe('fresh');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=resume.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume.test.js","sourceRoot":"","sources":["../../../src/commands/__tests__/resume.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAGjD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,EAAE,CAAC,IAAI,CAAC,sCAAsC,EAAE,GAAG,EAAE,CAAC,CAAC;IACtD,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE;IACnB,gBAAgB,E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* `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
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=run-flags.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-flags.test.d.ts","sourceRoot":"","sources":["../../../src/commands/__tests__/run-flags.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|