@namzu/cli 11.0.0 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +390 -46
- package/dist/cli.d.ts +15 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +132 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/acp.d.ts +29 -0
- package/dist/commands/acp.d.ts.map +1 -0
- package/dist/commands/acp.js +156 -0
- package/dist/commands/acp.js.map +1 -0
- package/dist/commands/doctor.d.ts +12 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +18 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/drain.d.ts +2 -2
- package/dist/commands/drain.d.ts.map +1 -1
- package/dist/commands/drain.js +31 -8
- package/dist/commands/drain.js.map +1 -1
- package/dist/commands/run-flags.d.ts.map +1 -1
- package/dist/commands/run-flags.js +33 -0
- package/dist/commands/run-flags.js.map +1 -1
- package/dist/commands/run-stream.d.ts +3 -3
- package/dist/commands/run-stream.d.ts.map +1 -1
- package/dist/commands/run-stream.js +27 -10
- package/dist/commands/run-stream.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +50 -4
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/types.d.ts +10 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/config/load.d.ts +64 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +137 -20
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +51 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/context/capabilities.d.ts +88 -0
- package/dist/context/capabilities.d.ts.map +1 -0
- package/dist/context/capabilities.js +160 -0
- package/dist/context/capabilities.js.map +1 -0
- package/dist/context/sandbox.d.ts +13 -0
- package/dist/context/sandbox.d.ts.map +1 -1
- package/dist/context/sandbox.js +15 -0
- package/dist/context/sandbox.js.map +1 -1
- package/dist/doctor/checks/index.d.ts +6 -1
- package/dist/doctor/checks/index.d.ts.map +1 -1
- package/dist/doctor/checks/index.js +45 -2
- package/dist/doctor/checks/index.js.map +1 -1
- package/dist/doctor/checks/invariants.d.ts +23 -0
- package/dist/doctor/checks/invariants.d.ts.map +1 -0
- package/dist/doctor/checks/invariants.js +79 -0
- package/dist/doctor/checks/invariants.js.map +1 -0
- package/dist/doctor/checks/logging.d.ts +10 -0
- package/dist/doctor/checks/logging.d.ts.map +1 -0
- package/dist/doctor/checks/logging.js +69 -0
- package/dist/doctor/checks/logging.js.map +1 -0
- package/dist/doctor/checks/session-export.d.ts +21 -0
- package/dist/doctor/checks/session-export.d.ts.map +1 -0
- package/dist/doctor/checks/session-export.js +62 -0
- package/dist/doctor/checks/session-export.js.map +1 -0
- package/dist/doctor/checks/telemetry.d.ts +15 -28
- package/dist/doctor/checks/telemetry.d.ts.map +1 -1
- package/dist/doctor/checks/telemetry.js +34 -54
- package/dist/doctor/checks/telemetry.js.map +1 -1
- package/dist/doctor/checks/vault.d.ts +4 -20
- package/dist/doctor/checks/vault.d.ts.map +1 -1
- package/dist/doctor/checks/vault.js +58 -19
- package/dist/doctor/checks/vault.js.map +1 -1
- package/dist/doctor/registry.d.ts.map +1 -1
- package/dist/doctor/registry.js +13 -6
- package/dist/doctor/registry.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/integrations/files/attachment-store.d.ts +44 -0
- package/dist/integrations/files/attachment-store.d.ts.map +1 -0
- package/dist/integrations/files/attachment-store.js +86 -0
- package/dist/integrations/files/attachment-store.js.map +1 -0
- package/dist/integrations/providers/credential-provider.d.ts +39 -0
- package/dist/integrations/providers/credential-provider.d.ts.map +1 -0
- package/dist/integrations/providers/credential-provider.js +74 -0
- package/dist/integrations/providers/credential-provider.js.map +1 -0
- package/dist/integrations/providers/discover.d.ts.map +1 -1
- package/dist/integrations/providers/discover.js +15 -3
- package/dist/integrations/providers/discover.js.map +1 -1
- package/dist/integrations/providers/oauth.d.ts.map +1 -1
- package/dist/integrations/providers/oauth.js +24 -1
- package/dist/integrations/providers/oauth.js.map +1 -1
- package/dist/integrations/sessions/store.d.ts +2 -2
- package/dist/integrations/sessions/store.d.ts.map +1 -1
- package/dist/integrations/sessions/store.js +21 -9
- package/dist/integrations/sessions/store.js.map +1 -1
- package/dist/integrations/subagents/runtime.d.ts +3 -3
- package/dist/integrations/subagents/runtime.d.ts.map +1 -1
- package/dist/integrations/subagents/runtime.js +12 -12
- package/dist/integrations/subagents/runtime.js.map +1 -1
- package/dist/integrations/telemetry/session-export.d.ts +99 -0
- package/dist/integrations/telemetry/session-export.d.ts.map +1 -0
- package/dist/integrations/telemetry/session-export.js +119 -0
- package/dist/integrations/telemetry/session-export.js.map +1 -0
- package/dist/logging.d.ts +79 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +67 -0
- package/dist/logging.js.map +1 -0
- package/dist/permissions/rules.d.ts +3 -3
- package/dist/permissions/rules.d.ts.map +1 -1
- package/dist/permissions/rules.js +1 -1
- package/dist/permissions/rules.js.map +1 -1
- package/dist/skills/store.d.ts +1 -1
- package/dist/skills/store.js +1 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +92 -6
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/StatusBar.d.ts +1 -1
- package/dist/tui/StatusBar.d.ts.map +1 -1
- package/dist/tui/agent.d.ts +54 -24
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/agent.js +330 -127
- package/dist/tui/agent.js.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +17 -6
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/log-pane.d.ts +48 -0
- package/dist/tui/log-pane.d.ts.map +1 -0
- package/dist/tui/log-pane.js +106 -0
- package/dist/tui/log-pane.js.map +1 -0
- package/dist/tui/slashCommands.d.ts +134 -11
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/slashCommands.js +169 -15
- package/dist/tui/slashCommands.js.map +1 -1
- package/dist/tui/types.d.ts +11 -2
- package/dist/tui/types.d.ts.map +1 -1
- package/package.json +8 -6
package/dist/config/load.js
CHANGED
|
@@ -23,7 +23,18 @@ import { join, resolve } from 'node:path';
|
|
|
23
23
|
import { parse as yamlParse } from 'yaml';
|
|
24
24
|
import { isFormatName } from '../output/index.js';
|
|
25
25
|
import { DEFAULT_CONFIG } from './schema.js';
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* `loadConfig` plus the record of who won each key.
|
|
28
|
+
*
|
|
29
|
+
* A second entry point rather than widening `loadConfig` itself:
|
|
30
|
+
* `loadConfig` is exported from `../index.js` for embedded consumers, and
|
|
31
|
+
* `(opts?: LoadConfigOptions) => NamzuCliConfig` is a signature something out
|
|
32
|
+
* there may already depend on. `loadConfig` below is now defined in terms of
|
|
33
|
+
* this function precisely so the two cannot drift apart — there is one merge
|
|
34
|
+
* to reason about, not two copies of the same precedence logic kept in sync
|
|
35
|
+
* by hand.
|
|
36
|
+
*/
|
|
37
|
+
export function loadConfigWithProvenance(opts = {}) {
|
|
27
38
|
const home = opts.home ?? homedir();
|
|
28
39
|
const cwd = opts.cwd ?? process.cwd();
|
|
29
40
|
const env = opts.env ?? process.env;
|
|
@@ -31,8 +42,25 @@ export function loadConfig(opts = {}) {
|
|
|
31
42
|
const projectPath = resolve(cwd, 'namzu.config.json');
|
|
32
43
|
const userCfg = readYamlIfExists(userPath);
|
|
33
44
|
const projectCfg = readJsonIfExists(projectPath);
|
|
34
|
-
const envCfg = readEnv(env);
|
|
35
|
-
return mergeConfigs(DEFAULT_CONFIG, userCfg, projectCfg,
|
|
45
|
+
const { config: envCfg, variables: envVariables } = readEnv(env);
|
|
46
|
+
return mergeConfigs(constantLayer(DEFAULT_CONFIG, { kind: 'default' }), constantLayer(userCfg, { kind: 'user-file', path: userPath }), constantLayer(projectCfg, { kind: 'project-file', path: projectPath }), {
|
|
47
|
+
config: envCfg,
|
|
48
|
+
sourceFor: (key) => {
|
|
49
|
+
const variable = envVariables[key];
|
|
50
|
+
// `readEnv` sets `variables[key]` in the same branch it sets
|
|
51
|
+
// `config[key]` — see `ENV_VARIABLE_NAMES` — so this is defined
|
|
52
|
+
// for every key this layer's config actually carries. Reaching
|
|
53
|
+
// `undefined` here means that pairing broke, which is a bug in
|
|
54
|
+
// this file, not a malformed environment.
|
|
55
|
+
if (variable === undefined) {
|
|
56
|
+
throw new Error(`no env variable recorded for config key '${key}'`);
|
|
57
|
+
}
|
|
58
|
+
return { kind: 'env', variable };
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export function loadConfig(opts = {}) {
|
|
63
|
+
return loadConfigWithProvenance(opts).config;
|
|
36
64
|
}
|
|
37
65
|
/**
|
|
38
66
|
* A config file namzu could not read.
|
|
@@ -162,19 +190,89 @@ const CONFIG_READERS = {
|
|
|
162
190
|
...(requireIsolation !== undefined ? { requireIsolation } : {}),
|
|
163
191
|
};
|
|
164
192
|
},
|
|
193
|
+
// Field by field, for the same reason as `sandbox` and one stronger:
|
|
194
|
+
// this one decides whether conversation content leaves the machine. A
|
|
195
|
+
// misspelled `redacters` read shape-only would become "no redactors"
|
|
196
|
+
// while the export still ran — redaction silently off, which is the one
|
|
197
|
+
// outcome a config typo must not be able to produce. So a malformed
|
|
198
|
+
// `redactors` drops the WHOLE sessionExport rather than the key, and the
|
|
199
|
+
// boot disclosure then reads "off" instead of "on with nothing
|
|
200
|
+
// installed".
|
|
201
|
+
telemetry: (v) => {
|
|
202
|
+
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
|
203
|
+
return undefined;
|
|
204
|
+
const raw = v;
|
|
205
|
+
if (raw.sessionExport === undefined)
|
|
206
|
+
return {};
|
|
207
|
+
const se = raw.sessionExport;
|
|
208
|
+
if (typeof se !== 'object' || se === null || Array.isArray(se))
|
|
209
|
+
return undefined;
|
|
210
|
+
const entry = se;
|
|
211
|
+
// No destination, no export. There is nothing to fall back to and
|
|
212
|
+
// nothing safe to guess.
|
|
213
|
+
if (typeof entry.destination !== 'string' || entry.destination.length === 0)
|
|
214
|
+
return undefined;
|
|
215
|
+
let eventTypes;
|
|
216
|
+
if (entry.eventTypes !== undefined) {
|
|
217
|
+
if (!Array.isArray(entry.eventTypes))
|
|
218
|
+
return undefined;
|
|
219
|
+
if (!entry.eventTypes.every((t) => typeof t === 'string'))
|
|
220
|
+
return undefined;
|
|
221
|
+
eventTypes = entry.eventTypes;
|
|
222
|
+
}
|
|
223
|
+
let redactors;
|
|
224
|
+
if (entry.redactors !== undefined) {
|
|
225
|
+
if (!Array.isArray(entry.redactors))
|
|
226
|
+
return undefined;
|
|
227
|
+
if (!entry.redactors.every((r) => r === 'secrets'))
|
|
228
|
+
return undefined;
|
|
229
|
+
redactors = entry.redactors;
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
sessionExport: {
|
|
233
|
+
destination: entry.destination,
|
|
234
|
+
...(eventTypes !== undefined ? { eventTypes } : {}),
|
|
235
|
+
...(redactors !== undefined ? { redactors } : {}),
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
export const ENV_VARIABLE_NAMES = {
|
|
241
|
+
format: 'NAMZU_FORMAT',
|
|
242
|
+
quiet: 'NAMZU_QUIET',
|
|
243
|
+
permissions: undefined,
|
|
244
|
+
mcpServers: undefined,
|
|
245
|
+
sandbox: undefined,
|
|
246
|
+
// Deliberately not env-settable. A `NAMZU_TELEMETRY_SESSION_EXPORT=/tmp/x`
|
|
247
|
+
// in a shell profile would start exporting conversation content with
|
|
248
|
+
// nothing in the config file to show for it — the disclosure would be
|
|
249
|
+
// honest and the *reason* would be invisible.
|
|
250
|
+
telemetry: undefined,
|
|
165
251
|
};
|
|
166
252
|
function readEnv(env) {
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
253
|
+
const config = {};
|
|
254
|
+
const variables = {};
|
|
255
|
+
const formatVar = ENV_VARIABLE_NAMES.format;
|
|
256
|
+
if (formatVar) {
|
|
257
|
+
const format = env[formatVar];
|
|
258
|
+
if (format && isFormatName(format)) {
|
|
259
|
+
config.format = format;
|
|
260
|
+
variables.format = formatVar;
|
|
261
|
+
}
|
|
171
262
|
}
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
263
|
+
const quietVar = ENV_VARIABLE_NAMES.quiet;
|
|
264
|
+
if (quietVar) {
|
|
265
|
+
const quiet = env[quietVar];
|
|
266
|
+
if (quiet === '1' || quiet === 'true') {
|
|
267
|
+
config.quiet = true;
|
|
268
|
+
variables.quiet = quietVar;
|
|
269
|
+
}
|
|
270
|
+
if (quiet === '0' || quiet === 'false') {
|
|
271
|
+
config.quiet = false;
|
|
272
|
+
variables.quiet = quietVar;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return { config, variables };
|
|
178
276
|
}
|
|
179
277
|
function sanitize(value) {
|
|
180
278
|
const v = value;
|
|
@@ -190,13 +288,32 @@ function sanitize(value) {
|
|
|
190
288
|
}
|
|
191
289
|
return out;
|
|
192
290
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
291
|
+
function constantLayer(config, source) {
|
|
292
|
+
return { config, sourceFor: () => source };
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Merges cascade layers lowest-precedence first onto `MutableConfig`, with no
|
|
296
|
+
* cast on the result — see that type's own doc comment for why the cast used
|
|
297
|
+
* to be the bug this shape prevents. Still a per-key loop rather than
|
|
298
|
+
* `Object.assign`, now for two reasons instead of one: the original reason (a
|
|
299
|
+
* key `MutableConfig` cannot carry must fail to compile, not vanish) plus
|
|
300
|
+
* recording `ConfigProvenance` in the same pass a key is written, so a key
|
|
301
|
+
* can never land in one map and not the other.
|
|
302
|
+
*/
|
|
303
|
+
function mergeConfigs(...layers) {
|
|
197
304
|
const out = {};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
305
|
+
const provenance = {};
|
|
306
|
+
for (const layer of layers) {
|
|
307
|
+
for (const key of Object.keys(layer.config)) {
|
|
308
|
+
// Same widened-view assignment as `sanitize`: a cast on the target,
|
|
309
|
+
// not the value, is what lets a generic key write onto a
|
|
310
|
+
// heterogeneous mapped type without silently dropping a field this
|
|
311
|
+
// function cannot carry.
|
|
312
|
+
;
|
|
313
|
+
out[key] = layer.config[key];
|
|
314
|
+
provenance[key] = layer.sourceFor(key);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return { config: out, provenance };
|
|
201
318
|
}
|
|
202
319
|
//# sourceMappingURL=load.js.map
|
package/dist/config/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAA;AAGzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAA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AAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QACvC,CAAC;IACF,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,CAAA;AACnC,CAAC"}
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -44,7 +44,58 @@ export interface NamzuCliConfig {
|
|
|
44
44
|
* ambiguous between "no sandbox" and "a sandbox that requires nothing".
|
|
45
45
|
*/
|
|
46
46
|
readonly sandbox?: SandboxConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Observability this CLI turns on for itself.
|
|
49
|
+
*
|
|
50
|
+
* Absent means none, which is what it meant before this existed —
|
|
51
|
+
* `sessionExport` in particular sends conversation content off the
|
|
52
|
+
* machine, so it is a thing an operator asks for by name and never
|
|
53
|
+
* something a default arranges.
|
|
54
|
+
*/
|
|
55
|
+
readonly telemetry?: TelemetryConfig;
|
|
56
|
+
}
|
|
57
|
+
export interface TelemetryConfig {
|
|
58
|
+
/**
|
|
59
|
+
* Write this session's run events somewhere.
|
|
60
|
+
*
|
|
61
|
+
* The disclosure `@namzu/telemetry`'s `describeSessionExport` builds
|
|
62
|
+
* from this is printed at boot, because the operator configuring it and
|
|
63
|
+
* the person whose conversation leaves the machine are frequently not
|
|
64
|
+
* the same person.
|
|
65
|
+
*/
|
|
66
|
+
readonly sessionExport?: SessionExportConfig;
|
|
67
|
+
}
|
|
68
|
+
export interface SessionExportConfig {
|
|
69
|
+
/**
|
|
70
|
+
* Absolute or cwd-relative path to a JSONL file, one record per line.
|
|
71
|
+
*
|
|
72
|
+
* A file, not a URL, and that is a limit rather than an oversight: a
|
|
73
|
+
* network destination needs retry, backpressure and a credential, and
|
|
74
|
+
* a CLI that shipped a half-built one would be offering an export that
|
|
75
|
+
* silently drops. A host that needs a collector builds a
|
|
76
|
+
* `SessionExportSink` and attaches the listener itself — that seam is
|
|
77
|
+
* the package's public surface.
|
|
78
|
+
*/
|
|
79
|
+
readonly destination: string;
|
|
80
|
+
/**
|
|
81
|
+
* Which run event types to export. Absent means all of them.
|
|
82
|
+
*
|
|
83
|
+
* Not validated against the event union here: a name that matches no
|
|
84
|
+
* event exports nothing under it, and the boot disclosure prints the
|
|
85
|
+
* list verbatim, so a typo is visible rather than silently widening.
|
|
86
|
+
*/
|
|
87
|
+
readonly eventTypes?: readonly string[];
|
|
88
|
+
/**
|
|
89
|
+
* Redactors to install, in order. `secrets` is the shipped one.
|
|
90
|
+
*
|
|
91
|
+
* An empty array means NO redaction, and it is spelled that way on
|
|
92
|
+
* purpose: omitting the key installs the default, so a config has to
|
|
93
|
+
* say `[]` to turn redaction off rather than reach it by forgetting.
|
|
94
|
+
*/
|
|
95
|
+
readonly redactors?: readonly SessionExportRedactorName[];
|
|
47
96
|
}
|
|
97
|
+
/** The redactors this CLI can install by name. */
|
|
98
|
+
export type SessionExportRedactorName = 'secrets';
|
|
48
99
|
export interface SandboxConfig {
|
|
49
100
|
/**
|
|
50
101
|
* Run commands inside a sandbox. Default `true`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,MAAM,WAAW,cAAc;IAC9B,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAA;IAC5B,0BAA0B;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAA;IACxC;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,gBAAgB,CAAA;IACtC;;;;;;;;;;;;OAYG;IACH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AC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC,EAAE,CAAA;CAC7E;AAED,eAAO,MAAM,cAAc,EAAE,cAG3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAyHH,MAAM,CAAC,MAAM,cAAc,GAAmB,MAAM,CAAC,MAAM,CAAC;IAC3D,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,KAAK;CACZ,CAAC,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tri-state probe for an optional package: not installed, installed and
|
|
3
|
+
* working, or installed and broken.
|
|
4
|
+
*
|
|
5
|
+
* Moved here from `doctor/checks/telemetry.ts`, where it was built once, for
|
|
6
|
+
* one package, and never generalised — so `namzu doctor` could tell a
|
|
7
|
+
* genuinely absent `@namzu/telemetry` from a broken one, but the BOOT PATH,
|
|
8
|
+
* which never called into `doctor/`, could not tell the same thing about
|
|
9
|
+
* `@namzu/sandbox`. A sandbox whose native binding fails to load in a
|
|
10
|
+
* container image resolves (`require.resolve` succeeds — the files are on
|
|
11
|
+
* disk) and then throws on import; with no probe at boot, that failure had
|
|
12
|
+
* no path to the operator except a stack trace from wherever the sandbox
|
|
13
|
+
* was first used, long after `namzu doctor` would have said `fail`.
|
|
14
|
+
*
|
|
15
|
+
* `probeOptionalPackage` and `probeCapabilities` are that probe, extracted
|
|
16
|
+
* so the doctor's checks and the boot narrative (NZ-BOOT-05) read the SAME
|
|
17
|
+
* answer instead of two implementations that can drift.
|
|
18
|
+
*
|
|
19
|
+
* ## Resolving and loading are asked separately, on purpose
|
|
20
|
+
*
|
|
21
|
+
* A `try { await import(pkg) } catch { present = false }` cannot tell "not
|
|
22
|
+
* installed" from "installed and broken" — both throw, and collapsing them
|
|
23
|
+
* silently turns a machine that would fail loudly into one that reports
|
|
24
|
+
* "optional, skip it" while running degraded with nothing in the log to say
|
|
25
|
+
* why. `an-optional-dependency-may-not-degrade-a-check` exists for exactly
|
|
26
|
+
* this shape of bug.
|
|
27
|
+
*
|
|
28
|
+
* A code check on the thrown error is not enough to separate them either: a
|
|
29
|
+
* TRANSITIVE dependency of the target package that cannot resolve raises
|
|
30
|
+
* `ERR_MODULE_NOT_FOUND` identically to the target package itself being
|
|
31
|
+
* missing, so matching the error code would report a broken installation as
|
|
32
|
+
* no installation. `require.resolve` asks only about THIS specifier — it
|
|
33
|
+
* either finds `specifier` on disk or it does not — so it separates the two
|
|
34
|
+
* questions by construction rather than by reading a message or a code that
|
|
35
|
+
* may be reworded or reused upstream.
|
|
36
|
+
*
|
|
37
|
+
* - `require.resolve` throws → not on disk at all → `absent`
|
|
38
|
+
* - resolves, then `import()` throws → on disk, unusable → `broken`
|
|
39
|
+
* - resolves, then `import()` succeeds → on disk, working → `present`
|
|
40
|
+
*/
|
|
41
|
+
export type CapabilityProbe = {
|
|
42
|
+
readonly state: 'present';
|
|
43
|
+
readonly specifier: string;
|
|
44
|
+
readonly version: string;
|
|
45
|
+
} | {
|
|
46
|
+
readonly state: 'absent';
|
|
47
|
+
readonly specifier: string;
|
|
48
|
+
} | {
|
|
49
|
+
readonly state: 'broken';
|
|
50
|
+
readonly specifier: string;
|
|
51
|
+
readonly error: Error;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The optional packages namzu runs without. Listed once so the doctor's
|
|
55
|
+
* per-package checks, the boot narrative's `capability` line (NZ-BOOT-05),
|
|
56
|
+
* and this module's own tests all read the SAME set — a capability added
|
|
57
|
+
* here with no check wired to it is exactly the gap
|
|
58
|
+
* `doctor/checks/__tests__/index.test.ts` fails the build on.
|
|
59
|
+
*/
|
|
60
|
+
export declare const NAMZU_OPTIONAL_CAPABILITIES: readonly ["@namzu/sandbox", "@namzu/files", "@namzu/computer-use", "@namzu/telemetry"];
|
|
61
|
+
/**
|
|
62
|
+
* The `DoctorCheck.id` a capability's probe is registered under —
|
|
63
|
+
* `@namzu/computer-use` → `computer-use.installed`, matching the id
|
|
64
|
+
* `telemetryInstalledCheck` already shipped under before this module
|
|
65
|
+
* existed. A function rather than a literal table so the registration site
|
|
66
|
+
* and the test that enumerates it derive the SAME id from the SAME rule;
|
|
67
|
+
* two hardcoded copies is how one of them goes stale.
|
|
68
|
+
*/
|
|
69
|
+
export declare function capabilityCheckId(specifier: string): string;
|
|
70
|
+
export declare function probeOptionalPackage(specifier: string): Promise<CapabilityProbe>;
|
|
71
|
+
/**
|
|
72
|
+
* Probe every optional capability namzu knows about.
|
|
73
|
+
*
|
|
74
|
+
* Re-exported from the package index as of NZ-BOOT-05: `createAgentSession`
|
|
75
|
+
* (`packages/cli/src/tui/agent.ts`) is its first consumer, calling it once
|
|
76
|
+
* per session and turning the tri-state result into the
|
|
77
|
+
* `namzu.capability.detected` / `.broken` rows of the boot narrative. Kept
|
|
78
|
+
* module-internal until that commit — an exported symbol with no caller is
|
|
79
|
+
* the shape `declared-but-undriven` is about — and joins the public surface
|
|
80
|
+
* in the same commit that consumes it, per that convention's own remedy.
|
|
81
|
+
*
|
|
82
|
+
* Never rejects: `probeOptionalPackage` already turns every resolve/import
|
|
83
|
+
* failure into a `broken` record rather than a thrown one, so this
|
|
84
|
+
* `Promise.all` has nothing to catch — a broken package can degrade what
|
|
85
|
+
* the boot narrative SAYS, never abort the boot itself.
|
|
86
|
+
*/
|
|
87
|
+
export declare function probeCapabilities(): Promise<readonly CapabilityProbe[]>;
|
|
88
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/context/capabilities.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,MAAM,eAAe,GACxB;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACnF;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAA;AAElF;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,wFAK9B,CAAA;AAEV;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAG3D;AA6ED,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA+BtF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAI7E"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, isAbsolute, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
|
+
/**
|
|
5
|
+
* The optional packages namzu runs without. Listed once so the doctor's
|
|
6
|
+
* per-package checks, the boot narrative's `capability` line (NZ-BOOT-05),
|
|
7
|
+
* and this module's own tests all read the SAME set — a capability added
|
|
8
|
+
* here with no check wired to it is exactly the gap
|
|
9
|
+
* `doctor/checks/__tests__/index.test.ts` fails the build on.
|
|
10
|
+
*/
|
|
11
|
+
export const NAMZU_OPTIONAL_CAPABILITIES = [
|
|
12
|
+
'@namzu/sandbox',
|
|
13
|
+
'@namzu/files',
|
|
14
|
+
'@namzu/computer-use',
|
|
15
|
+
'@namzu/telemetry',
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* The `DoctorCheck.id` a capability's probe is registered under —
|
|
19
|
+
* `@namzu/computer-use` → `computer-use.installed`, matching the id
|
|
20
|
+
* `telemetryInstalledCheck` already shipped under before this module
|
|
21
|
+
* existed. A function rather than a literal table so the registration site
|
|
22
|
+
* and the test that enumerates it derive the SAME id from the SAME rule;
|
|
23
|
+
* two hardcoded copies is how one of them goes stale.
|
|
24
|
+
*/
|
|
25
|
+
export function capabilityCheckId(specifier) {
|
|
26
|
+
const name = specifier.split('/').pop() ?? specifier;
|
|
27
|
+
return `${name}.installed`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Read the `version` of the package whose entry point resolved to
|
|
31
|
+
* `fromFile`, by walking UP the directory tree from that file to the
|
|
32
|
+
* nearest `package.json`.
|
|
33
|
+
*
|
|
34
|
+
* Not `require.resolve('<specifier>/package.json')`: a package built with a
|
|
35
|
+
* strict `exports` map does not expose its own manifest through that map —
|
|
36
|
+
* Node raises `ERR_PACKAGE_PATH_NOT_EXPORTED` — which would report an
|
|
37
|
+
* installed, loadable package as broken over a question nobody asked about
|
|
38
|
+
* its runtime behaviour. The entry file Node already resolved sits inside
|
|
39
|
+
* the package's own directory tree regardless of what the export map
|
|
40
|
+
* exposes, so climbing from there to the nearest manifest reads the version
|
|
41
|
+
* straight off disk without going through the map at all.
|
|
42
|
+
*/
|
|
43
|
+
function readVersionNear(fromFile) {
|
|
44
|
+
let dir = dirname(fromFile);
|
|
45
|
+
for (;;) {
|
|
46
|
+
const candidate = join(dir, 'package.json');
|
|
47
|
+
if (existsSync(candidate)) {
|
|
48
|
+
try {
|
|
49
|
+
const pkg = JSON.parse(readFileSync(candidate, 'utf8'));
|
|
50
|
+
if (typeof pkg.version === 'string')
|
|
51
|
+
return pkg.version;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// A malformed package.json this close to a resolved entry file is
|
|
55
|
+
// not this function's problem to diagnose — keep climbing in case
|
|
56
|
+
// an ancestor directory holds the real one.
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const parent = dirname(dir);
|
|
60
|
+
if (parent === dir)
|
|
61
|
+
return '0.0.0'; // hit the filesystem root; nothing found
|
|
62
|
+
dir = parent;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Whether `specifier` is installed, and whether it loads.
|
|
67
|
+
*
|
|
68
|
+
* Never throws — every failure mode below (unresolvable, throws on import,
|
|
69
|
+
* throws something that is not an `Error`) is turned into a
|
|
70
|
+
* `CapabilityProbe` value, which is what lets `probeCapabilities` await all
|
|
71
|
+
* four in parallel with nothing to catch.
|
|
72
|
+
*
|
|
73
|
+
* The import goes through the RESOLVED path rather than the specifier, so
|
|
74
|
+
* one code path serves both a package name and a fixture file — the same
|
|
75
|
+
* arrangement `doctor/checks/telemetry.ts` used this for, kept because it
|
|
76
|
+
* is what lets a test drive all three states without being able to
|
|
77
|
+
* uninstall or break a real optional package inside a test run.
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* Find a package's directory by walking `node_modules` upward, or null.
|
|
81
|
+
*
|
|
82
|
+
* This is the question the probe is actually asking — IS IT ON DISK — and
|
|
83
|
+
* neither module resolver answers it. `require.resolve` asks whether CJS may
|
|
84
|
+
* load the package's entry point, and every optional package here is
|
|
85
|
+
* ESM-only with an `exports` map that declares `import` and no `default`, so
|
|
86
|
+
* it throws `ERR_PACKAGE_PATH_NOT_EXPORTED` for a package that is installed
|
|
87
|
+
* and working. `import.meta.resolve` asks the right question but does not
|
|
88
|
+
* exist under the test runner's module transform, so a probe built on it
|
|
89
|
+
* cannot be exercised by the tests that are supposed to hold it.
|
|
90
|
+
*
|
|
91
|
+
* Walking for `<dir>/node_modules/<specifier>/package.json` is resolver-
|
|
92
|
+
* agnostic, works in both, and is what "installed" means. It follows pnpm's
|
|
93
|
+
* symlinked layout the same way Node does — `existsSync` resolves the link.
|
|
94
|
+
*/
|
|
95
|
+
function findPackageDir(specifier, fromFile) {
|
|
96
|
+
let dir = dirname(fromFile);
|
|
97
|
+
for (;;) {
|
|
98
|
+
const candidate = join(dir, 'node_modules', specifier, 'package.json');
|
|
99
|
+
if (existsSync(candidate))
|
|
100
|
+
return dirname(candidate);
|
|
101
|
+
const parent = dirname(dir);
|
|
102
|
+
if (parent === dir)
|
|
103
|
+
return null;
|
|
104
|
+
dir = parent;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export async function probeOptionalPackage(specifier) {
|
|
108
|
+
// A test drives all three states with a fixture FILE, because there is no
|
|
109
|
+
// way to uninstall or break a real optional package inside a test run.
|
|
110
|
+
if (isAbsolute(specifier)) {
|
|
111
|
+
try {
|
|
112
|
+
await import(pathToFileURL(specifier).href);
|
|
113
|
+
return { state: 'present', specifier, version: readVersionNear(specifier) };
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
return {
|
|
117
|
+
state: 'broken',
|
|
118
|
+
specifier,
|
|
119
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const packageDir = findPackageDir(specifier, fileURLToPath(import.meta.url));
|
|
124
|
+
if (!packageDir)
|
|
125
|
+
return { state: 'absent', specifier };
|
|
126
|
+
try {
|
|
127
|
+
await import(specifier);
|
|
128
|
+
return { state: 'present', specifier, version: readVersionNear(join(packageDir, 'index.js')) };
|
|
129
|
+
}
|
|
130
|
+
catch (err) {
|
|
131
|
+
// On disk and unusable. Kept apart from `absent` because the two send a
|
|
132
|
+
// reader to different places: "install it" is useless advice to
|
|
133
|
+
// somebody who already has.
|
|
134
|
+
return {
|
|
135
|
+
state: 'broken',
|
|
136
|
+
specifier,
|
|
137
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Probe every optional capability namzu knows about.
|
|
143
|
+
*
|
|
144
|
+
* Re-exported from the package index as of NZ-BOOT-05: `createAgentSession`
|
|
145
|
+
* (`packages/cli/src/tui/agent.ts`) is its first consumer, calling it once
|
|
146
|
+
* per session and turning the tri-state result into the
|
|
147
|
+
* `namzu.capability.detected` / `.broken` rows of the boot narrative. Kept
|
|
148
|
+
* module-internal until that commit — an exported symbol with no caller is
|
|
149
|
+
* the shape `declared-but-undriven` is about — and joins the public surface
|
|
150
|
+
* in the same commit that consumes it, per that convention's own remedy.
|
|
151
|
+
*
|
|
152
|
+
* Never rejects: `probeOptionalPackage` already turns every resolve/import
|
|
153
|
+
* failure into a `broken` record rather than a thrown one, so this
|
|
154
|
+
* `Promise.all` has nothing to catch — a broken package can degrade what
|
|
155
|
+
* the boot narrative SAYS, never abort the boot itself.
|
|
156
|
+
*/
|
|
157
|
+
export async function probeCapabilities() {
|
|
158
|
+
return Promise.all(NAMZU_OPTIONAL_CAPABILITIES.map((specifier) => probeOptionalPackage(specifier)));
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/context/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AA+CvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IAC1C,gBAAgB;IAChB,cAAc;IACd,qBAAqB;IACrB,kBAAkB;CACT,CAAA;AAEV;;;;;;;GA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QAC5B,OAAO;YACN,KAAK,EAAE,QAAQ;YACf,SAAS;YACT,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAC1D,CAAA;IACF,CAAC;AACF,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACtC,OAAO,OAAO,CAAC,GAAG,CACjB,2BAA2B,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAC/E,CAAA;AACF,CAAC"}
|
|
@@ -38,4 +38,17 @@ export interface ResolvedSandbox {
|
|
|
38
38
|
* answer than the true one.
|
|
39
39
|
*/
|
|
40
40
|
export declare function resolveSandbox(log: Logger, config: SandboxConfig | undefined): ResolvedSandbox;
|
|
41
|
+
/**
|
|
42
|
+
* `namzu.sandbox.resolved`'s severity: `warn` when nothing is confined,
|
|
43
|
+
* `info` otherwise. Extracted from the emit call site (`tui/agent.ts`) so
|
|
44
|
+
* this mapping — the one that decides whether an unconfined sandbox reads
|
|
45
|
+
* as routine or as something an operator should act on — is testable
|
|
46
|
+
* without depending on which isolation tier the test happens to run under.
|
|
47
|
+
* `resolveSandbox` reports whatever THIS machine actually enforces, and
|
|
48
|
+
* CI's machine is not every reader's; the existing tests in this file
|
|
49
|
+
* already work around that by branching at runtime on `resolved.unconfined`
|
|
50
|
+
* rather than asserting a fixed tier. A pure function over `ResolvedSandbox`
|
|
51
|
+
* sidesteps the need for that workaround entirely for this one property.
|
|
52
|
+
*/
|
|
53
|
+
export declare function sandboxResolvedSeverity(sandbox: ResolvedSandbox): 'info' | 'warn';
|
|
41
54
|
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/context/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,MAAM,EAGX,KAAK,eAAe,EAEpB,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,eAAe;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;IACnC,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,SAAS,GAAG,eAAe,CAuC9F"}
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/context/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,MAAM,EAGX,KAAK,eAAe,EAEpB,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,eAAe;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;IACnC,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,SAAS,GAAG,eAAe,CAuC9F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,GAAG,MAAM,CAEjF"}
|
package/dist/context/sandbox.js
CHANGED
|
@@ -43,4 +43,19 @@ export function resolveSandbox(log, config) {
|
|
|
43
43
|
unconfined: false,
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* `namzu.sandbox.resolved`'s severity: `warn` when nothing is confined,
|
|
48
|
+
* `info` otherwise. Extracted from the emit call site (`tui/agent.ts`) so
|
|
49
|
+
* this mapping — the one that decides whether an unconfined sandbox reads
|
|
50
|
+
* as routine or as something an operator should act on — is testable
|
|
51
|
+
* without depending on which isolation tier the test happens to run under.
|
|
52
|
+
* `resolveSandbox` reports whatever THIS machine actually enforces, and
|
|
53
|
+
* CI's machine is not every reader's; the existing tests in this file
|
|
54
|
+
* already work around that by branching at runtime on `resolved.unconfined`
|
|
55
|
+
* rather than asserting a fixed tier. A pure function over `ResolvedSandbox`
|
|
56
|
+
* sidesteps the need for that workaround entirely for this one property.
|
|
57
|
+
*/
|
|
58
|
+
export function sandboxResolvedSeverity(sandbox) {
|
|
59
|
+
return sandbox.unconfined ? 'warn' : 'info';
|
|
60
|
+
}
|
|
46
61
|
//# sourceMappingURL=sandbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../src/context/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EAEpB,0BAA0B,EAG1B,WAAW,GACX,MAAM,YAAY,CAAA;AAiCnB;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,MAAiC;IAC5E,IAAI,MAAM,EAAE,OAAO,KAAK,KAAK,EAAE,CAAC;QAC/B,OAAO;YACN,MAAM,EACL,gJAAgJ;YACjJ,UAAU,EAAE,IAAI;SAChB,CAAA;IACF,CAAC;IAED,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,gBAAgB,IAAI,EAAE,CAAuC,CAAA;IACvF,qEAAqE;IACrE,wEAAwE;IACxE,kEAAkE;IAClE,sCAAsC;IACtC,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,GAAG,E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AAC,GAAG;QAClH,UAAU,EAAE,KAAK;KACjB,CAAA;AACF,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAwB;IAC/D,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAA;AAC5C,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { DoctorCheck } from '@namzu/sdk';
|
|
2
2
|
import { providerChainCheck } from './chain.js';
|
|
3
3
|
import { credentialSourcesCheck } from './credentials.js';
|
|
4
|
+
import { invariantsCheck } from './invariants.js';
|
|
5
|
+
import { loggingPipelineCheck } from './logging.js';
|
|
4
6
|
import { providersRegisteredCheck } from './providers.js';
|
|
5
7
|
import { cwdWritableCheck, tmpdirWritableCheck } from './runtime.js';
|
|
6
8
|
import { sandboxPlatformCheck } from './sandbox.js';
|
|
7
9
|
import { telemetryInstalledCheck } from './telemetry.js';
|
|
8
10
|
import { vaultRegisteredCheck } from './vault.js';
|
|
9
|
-
export
|
|
11
|
+
export declare const sandboxInstalledCheck: DoctorCheck;
|
|
12
|
+
export declare const filesInstalledCheck: DoctorCheck;
|
|
13
|
+
export declare const computerUseInstalledCheck: DoctorCheck;
|
|
14
|
+
export { credentialSourcesCheck, providerChainCheck, providersRegisteredCheck, cwdWritableCheck, tmpdirWritableCheck, invariantsCheck, loggingPipelineCheck, sandboxPlatformCheck, telemetryInstalledCheck, vaultRegisteredCheck, };
|
|
10
15
|
export declare const builtInDoctorChecks: readonly DoctorCheck[];
|
|
11
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAA;AAGhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAA4B,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AA2BjD,eAAO,MAAM,qBAAqB,EAAE,WAAyD,CAAA;AAC7F,eAAO,MAAM,mBAAmB,EAAE,WAAsD,CAAA;AACxF,eAAO,MAAM,yBAAyB,EAAE,WAGvC,CAAA;AAOD,OAAO,EACN,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GACpB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAoBrD,CAAA"}
|