@namzu/cli 10.0.0 → 12.0.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/README.md +390 -46
- package/dist/cli.d.ts +15 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +133 -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 +156 -20
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +88 -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 +54 -0
- package/dist/context/sandbox.d.ts.map +1 -0
- package/dist/context/sandbox.js +61 -0
- package/dist/context/sandbox.js.map +1 -0
- 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 +11 -11
- 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 +93 -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 +65 -24
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/agent.js +337 -122
- 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 +18 -2
- package/dist/tui/types.d.ts.map +1 -1
- package/package.json +8 -6
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { pathToFileURL } from 'node:url';
|
|
1
|
+
import { probeOptionalPackage } from '../../context/capabilities.js';
|
|
3
2
|
const TELEMETRY = '@namzu/telemetry';
|
|
4
3
|
/**
|
|
5
4
|
* Telemetry presence probe.
|
|
@@ -10,64 +9,45 @@ const TELEMETRY = '@namzu/telemetry';
|
|
|
10
9
|
* deferred to a follow-up check that the consumer can register
|
|
11
10
|
* themselves once their telemetry config is known.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* Splitting the question is what makes each answer honest, and a code check on
|
|
22
|
-
* the thrown error is not enough to do it: a transitive dependency that cannot
|
|
23
|
-
* resolve raises `ERR_MODULE_NOT_FOUND` exactly as a missing `@namzu/telemetry`
|
|
24
|
-
* does, so matching on the code would report a broken installation as no
|
|
25
|
-
* installation. `resolve` asks only about THIS specifier, so it separates the
|
|
26
|
-
* two by construction rather than by reading a message that may be reworded.
|
|
27
|
-
*
|
|
28
|
-
* - cannot resolve → the package is not here → `skipped`
|
|
29
|
-
* - resolves, import throws → it is here and unusable → `fail`
|
|
12
|
+
* The three-state resolve-then-import probe this used to do inline now
|
|
13
|
+
* lives at `context/capabilities.ts` as `probeOptionalPackage` (NZ-BOOT-02),
|
|
14
|
+
* extracted so the boot path can report the SAME answer about
|
|
15
|
+
* `@namzu/sandbox`, `@namzu/files` and `@namzu/computer-use` that this file
|
|
16
|
+
* has always given about telemetry, instead of inventing its own. What
|
|
17
|
+
* stays here is the one thing the doctor still owns: turning that answer
|
|
18
|
+
* into the prose and remediation a `DoctorCheckResult` carries.
|
|
30
19
|
*/
|
|
31
20
|
/**
|
|
32
|
-
*
|
|
21
|
+
* `specifier`'s `CapabilityProbe`, read as a `DoctorCheckResult`.
|
|
33
22
|
*
|
|
34
23
|
* Exported separately from the `DoctorCheck` so all three outcomes can be
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* code path serves a package name and a file, which is what lets the
|
|
43
|
-
* present-but-broken case be reached at all. Resolution has already applied the
|
|
44
|
-
* package's export map by that point.
|
|
24
|
+
* asserted directly — there is no way to uninstall or break a real optional
|
|
25
|
+
* package from inside a test run, so `capabilities.test.ts` drives
|
|
26
|
+
* `probeOptionalPackage` with fixtures and this function's own tests only
|
|
27
|
+
* need to check the mapping. The check itself is still exercised through
|
|
28
|
+
* `telemetryInstalledCheck.run`, because a helper proven in isolation says
|
|
29
|
+
* nothing about whether the check reaches it. Same arrangement, and the
|
|
30
|
+
* same reason, as `describeProviderChain`.
|
|
45
31
|
*/
|
|
46
32
|
export async function describeInstalledPackage(specifier) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
message: `${specifier}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// The reason is the whole value of separating these: "installed but
|
|
66
|
-
// will not load" sends the reader somewhere, and "not installed" would
|
|
67
|
-
// have sent them to install what is already there.
|
|
68
|
-
message: `${specifier} is installed but failed to load: ${err instanceof Error ? err.message : String(err)}`,
|
|
69
|
-
remediation: `Reinstall ${specifier}, or remove it if you are not using telemetry — it is optional and namzu runs without it.`,
|
|
70
|
-
};
|
|
33
|
+
const probe = await probeOptionalPackage(specifier);
|
|
34
|
+
switch (probe.state) {
|
|
35
|
+
case 'absent':
|
|
36
|
+
return {
|
|
37
|
+
status: 'skipped',
|
|
38
|
+
message: `${specifier} not installed (optional package)`,
|
|
39
|
+
};
|
|
40
|
+
case 'present':
|
|
41
|
+
return { status: 'pass', message: `${specifier} is installed` };
|
|
42
|
+
case 'broken':
|
|
43
|
+
return {
|
|
44
|
+
status: 'fail',
|
|
45
|
+
// The reason is the whole value of separating these: "installed but
|
|
46
|
+
// will not load" sends the reader somewhere, and "not installed" would
|
|
47
|
+
// have sent them to install what is already there.
|
|
48
|
+
message: `${specifier} is installed but failed to load: ${probe.error.message}`,
|
|
49
|
+
remediation: `Reinstall ${specifier}, or remove it if you are not using it — it is optional and namzu runs without it.`,
|
|
50
|
+
};
|
|
71
51
|
}
|
|
72
52
|
}
|
|
73
53
|
export const telemetryInstalledCheck = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../../src/doctor/checks/telemetry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../../src/doctor/checks/telemetry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AAEpE,MAAM,SAAS,GAAG,kBAAkB,CAAA;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,SAAiB;IAC/D,MAAM,KAAK,GAAG,MAAM,oBAAoB,CAAC,SAAS,CAAC,CAAA;IACnD,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;QACrB,KAAK,QAAQ;YACZ,OAAO;gBACN,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,GAAG,SAAS,mCAAmC;aACxD,CAAA;QACF,KAAK,SAAS;YACb,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,eAAe,EAAE,CAAA;QAChE,KAAK,QAAQ;YACZ,OAAO;gBACN,MAAM,EAAE,MAAM;gBACd,oEAAoE;gBACpE,uEAAuE;gBACvE,mDAAmD;gBACnD,OAAO,EAAE,GAAG,SAAS,qCAAqC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE;gBAC/E,WAAW,EAAE,aAAa,SAAS,oFAAoF;aACvH,CAAA;IACH,CAAC;AACF,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAgB;IACnD,EAAE,EAAE,qBAAqB;IACzB,QAAQ,EAAE,WAAW;IACrB,GAAG,EAAE,GAA+B,EAAE,CAAC,wBAAwB,CAAC,SAAS,CAAC;CAC1E,CAAA"}
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
import type { DoctorCheck } from '@namzu/sdk';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* `CredentialVault` is an interface, not a globally-discoverable
|
|
6
|
-
* registry — consumers instantiate their own (`InMemoryCredentialVault`,
|
|
7
|
-
* file-backed, env-backed, KMS-backed, …). The doctor cannot enumerate
|
|
8
|
-
* vaults it doesn't know about. To get a real vault healthcheck, the
|
|
9
|
-
* consumer registers a custom check via `registerDoctorCheck` that
|
|
10
|
-
* exercises their specific vault wiring.
|
|
11
|
-
*
|
|
12
|
-
* `skipped`, not `inconclusive`, and the difference is the whole point of the
|
|
13
|
-
* split: `inconclusive` means a check tried and could not answer, which is a
|
|
14
|
-
* gap in the report and now carries a non-zero exit code. This check has no
|
|
15
|
-
* subject to answer about — there is no discovery mechanism to fail — and that
|
|
16
|
-
* is true on every machine, permanently, by design. Reporting a permanent
|
|
17
|
-
* design decision as an unanswered question would make `namzu doctor` non-zero
|
|
18
|
-
* on every healthy machine, and a diagnostic that always complains is one
|
|
19
|
-
* nobody reads.
|
|
20
|
-
*/
|
|
1
|
+
import type { CredentialProvider, DoctorCheck } from '@namzu/sdk';
|
|
2
|
+
export declare function registerCredentialProvider(provider: CredentialProvider, label: string, refs: readonly string[]): () => void;
|
|
3
|
+
/** For tests, and for a host rebuilding its wiring. */
|
|
4
|
+
export declare function clearRegisteredCredentialProviders(): void;
|
|
21
5
|
export declare const vaultRegisteredCheck: DoctorCheck;
|
|
22
6
|
//# sourceMappingURL=vault.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/vault.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/vault.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAA;AAmBpF,wBAAgB,0BAA0B,CACzC,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,SAAS,MAAM,EAAE,GACrB,MAAM,IAAI,CAOZ;AAED,uDAAuD;AACvD,wBAAgB,kCAAkC,IAAI,IAAI,CAEzD;AAED,eAAO,MAAM,oBAAoB,EAAE,WA0ClC,CAAA"}
|
|
@@ -1,28 +1,67 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* What this machine can answer about its credentials.
|
|
3
3
|
*
|
|
4
|
-
* `
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* exercises their specific vault wiring.
|
|
4
|
+
* This check used to return `skipped` unconditionally, with the message
|
|
5
|
+
* "no vault auto-discovery in v1" — an answer that was the same on every
|
|
6
|
+
* machine, forever, which is the shape `a-check-that-cannot-fail` warns
|
|
7
|
+
* about. It was honest about the world at the time: `CredentialVault` was
|
|
8
|
+
* an interface nobody registered, so there was nothing to enumerate.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* subject to answer about — there is no discovery mechanism to fail — and that
|
|
15
|
-
* is true on every machine, permanently, by design. Reporting a permanent
|
|
16
|
-
* design decision as an unanswered question would make `namzu doctor` non-zero
|
|
17
|
-
* on every healthy machine, and a diagnostic that always complains is one
|
|
18
|
-
* nobody reads.
|
|
10
|
+
* There is now. The check reads what the registered providers report and
|
|
11
|
+
* returns `skipped` only when NONE is registered — which is a real state a
|
|
12
|
+
* host can be in, and now the only one that produces it.
|
|
19
13
|
*/
|
|
14
|
+
/** Providers this process knows about. Registered by whoever builds them. */
|
|
15
|
+
const registered = [];
|
|
16
|
+
export function registerCredentialProvider(provider, label, refs) {
|
|
17
|
+
const entry = { provider, label, refs };
|
|
18
|
+
registered.push(entry);
|
|
19
|
+
return () => {
|
|
20
|
+
const i = registered.indexOf(entry);
|
|
21
|
+
if (i >= 0)
|
|
22
|
+
registered.splice(i, 1);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** For tests, and for a host rebuilding its wiring. */
|
|
26
|
+
export function clearRegisteredCredentialProviders() {
|
|
27
|
+
registered.length = 0;
|
|
28
|
+
}
|
|
20
29
|
export const vaultRegisteredCheck = {
|
|
21
30
|
id: 'vault.registered',
|
|
22
31
|
category: 'vault',
|
|
23
|
-
run: async () =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
run: async () => {
|
|
33
|
+
if (registered.length === 0) {
|
|
34
|
+
// `skipped`, not `inconclusive`, and the difference is the whole
|
|
35
|
+
// point of the split: `inconclusive` means a check tried and could
|
|
36
|
+
// not answer, which is a gap in the report and carries a non-zero
|
|
37
|
+
// exit. A host that registered no provider has no subject here,
|
|
38
|
+
// and reporting that as an unanswered question would make
|
|
39
|
+
// `namzu doctor` non-zero on a perfectly healthy machine.
|
|
40
|
+
return {
|
|
41
|
+
status: 'skipped',
|
|
42
|
+
message: 'No credential provider is registered, so there is nothing to report on.',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const lines = [];
|
|
46
|
+
let anyConfigured = false;
|
|
47
|
+
for (const entry of registered) {
|
|
48
|
+
for (const ref of entry.refs) {
|
|
49
|
+
// `describe`, never `resolve`. This runs in a diagnostic whose
|
|
50
|
+
// output an operator pastes into an issue, and a check that
|
|
51
|
+
// read the value to report on it would be the leak.
|
|
52
|
+
const described = await entry.provider.describe(ref);
|
|
53
|
+
if (described.configured)
|
|
54
|
+
anyConfigured = true;
|
|
55
|
+
lines.push(`${entry.label}: ${ref} — ${described.configured ? 'configured' : 'not set'}${described.source ? ` (${described.source})` : ''}, ${described.writable ? 'writable' : 'read-only'}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
// A provider registered and nothing configured is a real answer,
|
|
60
|
+
// not a failure: an operator who has not logged in yet is in a
|
|
61
|
+
// state the doctor should describe rather than complain about.
|
|
62
|
+
status: anyConfigured ? 'pass' : 'warn',
|
|
63
|
+
message: lines.join('\n'),
|
|
64
|
+
};
|
|
65
|
+
},
|
|
27
66
|
};
|
|
28
67
|
//# sourceMappingURL=vault.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vault.js","sourceRoot":"","sources":["../../../src/doctor/checks/vault.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"vault.js","sourceRoot":"","sources":["../../../src/doctor/checks/vault.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,6EAA6E;AAC7E,MAAM,UAAU,GAA+E,EAAE,CAAA;AAEjG,MAAM,UAAU,0BAA0B,CACzC,QAA4B,EAC5B,KAAa,EACb,IAAuB;IAEvB,MAAM,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;IACvC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACtB,OAAO,GAAG,EAAE;QACX,MAAM,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,CAAC;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AW,EAAE,CACpD,CAAA;YACF,CAAC;QACF,CAAC;QAED,OAAO;YACN,iEAAiE;YACjE,+DAA+D;YAC/D,+DAA+D;YAC/D,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;YACvC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;SACzB,CAAA;IACF,CAAC;CACD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/doctor/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,WAAW,EAEX,iBAAiB,EAEjB,YAAY,EAEZ,MAAM,EACN,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/doctor/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,WAAW,EAEX,iBAAiB,EAEjB,YAAY,EAEZ,MAAM,EACN,MAAM,YAAY,CAAA;AAMnB,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,WAAW,CAAC,UAAU,CAAC,EAAE,CAAA;IACxD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IACnC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;IAC3D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAA;IAClC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACpD;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAA;IAC9D;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAC7B;AAED,qBAAa,cAAc;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;IAC7D,OAAO,CAAC,GAAG,CAAC,CAAQ;IAEpB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI5B,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IASlC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI/B,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,SAAS,WAAW,EAAE;IAIxB,GAAG,CAAC,IAAI,GAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IA4H/E;;;;;OAKG;IACH,OAAO,CAAC,cAAc;CAWtB;AAED,eAAO,MAAM,MAAM,EAAE,cAAqC,CAAA;AAE1D,wBAAgB,oBAAoB,IAAI,cAAc,CAErD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAE5D;AAED,wBAAgB,SAAS,CAAC,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,YAAY,CAAC,CAc5E"}
|
package/dist/doctor/registry.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { SCOPE_ATTRIBUTE } from '@namzu/sdk';
|
|
1
2
|
const DEFAULT_PER_CHECK_TIMEOUT_MS = 5_000;
|
|
2
3
|
const DEFAULT_WALL_CLOCK_TIMEOUT_MS = 10_000;
|
|
3
4
|
export class DoctorRegistry {
|
|
4
5
|
checks = new Map();
|
|
5
6
|
log;
|
|
6
7
|
setLogger(log) {
|
|
7
|
-
this.log = log.child({
|
|
8
|
+
this.log = log.child({ [SCOPE_ATTRIBUTE]: 'doctor' });
|
|
8
9
|
}
|
|
9
10
|
register(check) {
|
|
10
11
|
if (this.checks.has(check.id)) {
|
|
@@ -66,7 +67,10 @@ export class DoctorRegistry {
|
|
|
66
67
|
}
|
|
67
68
|
catch (error) {
|
|
68
69
|
const message = error instanceof Error ? error.message : String(error);
|
|
69
|
-
this.log?.warn('doctor check threw', {
|
|
70
|
+
this.log?.warn('doctor check threw', {
|
|
71
|
+
'namzu.doctor.id': check.id,
|
|
72
|
+
'namzu.doctor.message': message,
|
|
73
|
+
});
|
|
70
74
|
result = { status: 'fail', message: `check threw: ${message}` };
|
|
71
75
|
}
|
|
72
76
|
recordCompletion({
|
|
@@ -87,9 +91,9 @@ export class DoctorRegistry {
|
|
|
87
91
|
: `wall-clock timeout (${wall}ms) reached before this check completed`;
|
|
88
92
|
const unfinished = filteredChecks.filter((c) => !completed.has(c.id));
|
|
89
93
|
this.log?.warn(raceWinner === 'aborted' ? 'doctor aborted by signal' : 'doctor wall-clock timeout', {
|
|
90
|
-
wall,
|
|
91
|
-
total: filteredChecks.length,
|
|
92
|
-
unfinished: unfinished.length,
|
|
94
|
+
'namzu.doctor.wall': wall,
|
|
95
|
+
'namzu.doctor.total': filteredChecks.length,
|
|
96
|
+
'namzu.doctor.unfinished': unfinished.length,
|
|
93
97
|
});
|
|
94
98
|
records = filteredChecks.map((check) => {
|
|
95
99
|
const existing = completed.get(check.id);
|
|
@@ -143,7 +147,10 @@ export class DoctorRegistry {
|
|
|
143
147
|
}
|
|
144
148
|
catch (error) {
|
|
145
149
|
const message = error instanceof Error ? error.message : String(error);
|
|
146
|
-
this.log?.warn('doctor callback threw', {
|
|
150
|
+
this.log?.warn('doctor callback threw', {
|
|
151
|
+
'namzu.doctor.phase': phase,
|
|
152
|
+
'namzu.doctor.message': message,
|
|
153
|
+
});
|
|
147
154
|
}
|
|
148
155
|
}
|
|
149
156
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/doctor/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/doctor/registry.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,4BAA4B,GAAG,KAAK,CAAA;AAC1C,MAAM,6BAA6B,GAAG,MAAM,CAAA;AAmC5C,MAAM,OAAO,cAAc;IACT,MAAM,GAA6B,IAAI,GAAG,EAAE,CAAA;IACrD,GAAG,CAAS;IAEpB,SAAS,CAAC,GAAW;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;IACtD,CAAC;IAED,QAAQ,CAAC,KAAkB;QAC1B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CACd,yBAAyB,KAAK,CAAC,EAAE,qEAAqE,CACtG,CAAA;QACF,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;IACjC,CAAC;IAED,UAAU,CAAC,EAAU;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAC9B,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;IAED,IAAI;QACH,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;IACxC,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,OAA2C,EAAE;QACtD,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;QAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,IAAI,4BAA4B,CAAA;QACvE,M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C,MAAM,EAAE,OAAO;QACf,OAAO;QACP,IAAI;KACJ,CAAC,CAAA;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAC7E,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { createDoctorRegistry, doctor, DoctorRegistry, registerDoctorCheck, runDoctor, } from './doctor/registry.js';
|
|
7
7
|
export type { RunDoctorOptions } from './doctor/registry.js';
|
|
8
|
-
export { builtInDoctorChecks, credentialSourcesCheck, cwdWritableCheck, providerChainCheck, providersRegisteredCheck, sandboxPlatformCheck, telemetryInstalledCheck, tmpdirWritableCheck, vaultRegisteredCheck, } from './doctor/checks/index.js';
|
|
8
|
+
export { builtInDoctorChecks, computerUseInstalledCheck, credentialSourcesCheck, cwdWritableCheck, filesInstalledCheck, providerChainCheck, providersRegisteredCheck, sandboxInstalledCheck, sandboxPlatformCheck, telemetryInstalledCheck, tmpdirWritableCheck, vaultRegisteredCheck, } from './doctor/checks/index.js';
|
|
9
|
+
export { type CapabilityProbe, NAMZU_OPTIONAL_CAPABILITIES, probeCapabilities, probeOptionalPackage, } from './context/capabilities.js';
|
|
9
10
|
export { runDoctorCommand } from './commands/doctor.js';
|
|
10
11
|
export { runCli, type RunCliOptions } from './cli.js';
|
|
11
12
|
export type { CommandContext, CommandDef, CommandHandler, CommandHandlerArgs, } from './commands/types.js';
|
|
12
13
|
export { registerAll, registerCommand, type RegisterOptions, } from './commands/registry.js';
|
|
13
14
|
export { createFormatter, type FormatName, type Formatter, type FormatterOptions, isFormatName, } from './output/index.js';
|
|
14
|
-
export { ConfigLoadError, loadConfig, type LoadConfigOptions } from './config/load.js';
|
|
15
|
+
export { ConfigLoadError, loadConfig, loadConfigWithProvenance, type ConfigProvenance, type ConfigSource, type LoadConfigOptions, } from './config/load.js';
|
|
15
16
|
export { DEFAULT_CONFIG, type NamzuCliConfig } from './config/schema.js';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACN,oBAAoB,EACpB,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,SAAS,GACT,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EACN,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAA;AACrD,YAAY,EACX,cAAc,EACd,UAAU,EACV,cAAc,EACd,kBAAkB,GAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACN,WAAW,EACX,eAAe,EACf,KAAK,eAAe,GACpB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACN,eAAe,EACf,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,YAAY,GACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACN,oBAAoB,EACpB,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,SAAS,GACT,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EACN,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EACN,KAAK,eAAe,EACpB,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,GACpB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAA;AACrD,YAAY,EACX,cAAc,EACd,UAAU,EACV,cAAc,EACd,kBAAkB,GAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACN,WAAW,EACX,eAAe,EACf,KAAK,eAAe,GACpB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACN,eAAe,EACf,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,YAAY,GACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACN,eAAe,EACf,UAAU,EACV,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,iBAAiB,GACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
// Doctor library API (pre-M0; preserved for embedded consumers).
|
|
7
7
|
export { createDoctorRegistry, doctor, DoctorRegistry, registerDoctorCheck, runDoctor, } from './doctor/registry.js';
|
|
8
|
-
export { builtInDoctorChecks, credentialSourcesCheck, cwdWritableCheck, providerChainCheck, providersRegisteredCheck, sandboxPlatformCheck, telemetryInstalledCheck, tmpdirWritableCheck, vaultRegisteredCheck, } from './doctor/checks/index.js';
|
|
8
|
+
export { builtInDoctorChecks, computerUseInstalledCheck, credentialSourcesCheck, cwdWritableCheck, filesInstalledCheck, providerChainCheck, providersRegisteredCheck, sandboxInstalledCheck, sandboxPlatformCheck, telemetryInstalledCheck, tmpdirWritableCheck, vaultRegisteredCheck, } from './doctor/checks/index.js';
|
|
9
|
+
export { NAMZU_OPTIONAL_CAPABILITIES, probeCapabilities, probeOptionalPackage, } from './context/capabilities.js';
|
|
9
10
|
export { runDoctorCommand } from './commands/doctor.js';
|
|
10
11
|
// Shell + extension surface for the CLI.
|
|
11
12
|
export { runCli } from './cli.js';
|
|
12
13
|
export { registerAll, registerCommand, } from './commands/registry.js';
|
|
13
14
|
export { createFormatter, isFormatName, } from './output/index.js';
|
|
14
|
-
export { ConfigLoadError, loadConfig } from './config/load.js';
|
|
15
|
+
export { ConfigLoadError, loadConfig, loadConfigWithProvenance, } from './config/load.js';
|
|
15
16
|
export { DEFAULT_CONFIG } from './config/schema.js';
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,iEAAiE;AACjE,OAAO,EACN,oBAAoB,EACpB,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,SAAS,GACT,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EACN,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,yCAAyC;AACzC,OAAO,EAAE,MAAM,EAAsB,MAAM,UAAU,CAAA;AAOrD,OAAO,EACN,WAAW,EACX,eAAe,GAEf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACN,eAAe,EAIf,YAAY,GACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,iEAAiE;AACjE,OAAO,EACN,oBAAoB,EACpB,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,SAAS,GACT,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EACN,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAEN,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,GACpB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,yCAAyC;AACzC,OAAO,EAAE,MAAM,EAAsB,MAAM,UAAU,CAAA;AAOrD,OAAO,EACN,WAAW,EACX,eAAe,GAEf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACN,eAAe,EAIf,YAAY,GACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACN,eAAe,EACf,UAAU,EACV,wBAAwB,GAIxB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,cAAc,EAAuB,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { BlobStore } from '@namzu/files';
|
|
2
|
+
import type { AttachmentStore, StoredBytes } from '@namzu/sdk';
|
|
3
|
+
/**
|
|
4
|
+
* The CLI's attachment store, content-addressed, over a real blob driver.
|
|
5
|
+
*
|
|
6
|
+
* `@namzu/files` shipped six drivers and had no consumer in this repo — a
|
|
7
|
+
* package the estate could import and nothing here could point at. This is
|
|
8
|
+
* the pointing: the local driver, wired to the seam the SDK added for
|
|
9
|
+
* attachments, in the one host that actually attaches things.
|
|
10
|
+
*
|
|
11
|
+
* **Addressed by content AND media type**, not by content alone. The same
|
|
12
|
+
* bytes declared `image/png` once and `application/pdf` later are two
|
|
13
|
+
* different claims about what they are, and the SDK's resolver refuses a
|
|
14
|
+
* ref whose stored media type disagrees with the message. Keying on bytes
|
|
15
|
+
* alone would make the second `put` return the first ref, and every message
|
|
16
|
+
* using it would then be refused — a dedup that manufactures the exact
|
|
17
|
+
* mismatch the resolver exists to catch. Folding the media type into the
|
|
18
|
+
* digest keeps dedup for the common case (the same file attached twice) and
|
|
19
|
+
* gives an honest ref for the uncommon one.
|
|
20
|
+
*/
|
|
21
|
+
/** `<home>/.namzu/attachments`, beside the credential store. */
|
|
22
|
+
export declare function attachmentsDir(home?: string): string;
|
|
23
|
+
export interface BlobAttachmentStoreOptions {
|
|
24
|
+
/** Injectable for tests; defaults to the local driver under `~/.namzu`. */
|
|
25
|
+
readonly blobs?: BlobStore;
|
|
26
|
+
readonly home?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class BlobAttachmentStore implements AttachmentStore {
|
|
29
|
+
private readonly blobs;
|
|
30
|
+
constructor(options?: BlobAttachmentStoreOptions);
|
|
31
|
+
/**
|
|
32
|
+
* The key for these bytes under this media type.
|
|
33
|
+
*
|
|
34
|
+
* Two files rather than one: the bytes, and a sibling holding the media
|
|
35
|
+
* type. The blob store stores bytes and nothing else, and the SDK's
|
|
36
|
+
* resolver needs the store to be able to REPORT what it holds — a store
|
|
37
|
+
* that could only echo back what the caller claimed could never catch a
|
|
38
|
+
* mismatch, which is the check that keeps a PDF from being sent as a PNG.
|
|
39
|
+
*/
|
|
40
|
+
private key;
|
|
41
|
+
put(bytes: StoredBytes): Promise<string>;
|
|
42
|
+
get(ref: string): Promise<StoredBytes | undefined>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=attachment-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-store.d.ts","sourceRoot":"","sources":["../../../src/integrations/files/attachment-store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE9D;;;;;;;;;;;;;;;;;GAiBG;AAEH,gEAAgE;AAChE,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAAkB,GAAG,MAAM,CAE/D;AAED,MAAM,WAAW,0BAA0B;IAC1C,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,qBAAa,mBAAoB,YAAW,eAAe;IAC1D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;gBAErB,OAAO,GAAE,0BAA+B;IAIpD;;;;;;;;OAQG;IACH,OAAO,CAAC,GAAG;IAOL,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBxC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;CAoBxD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { LocalFsBlobStore } from '@namzu/files/local';
|
|
5
|
+
/**
|
|
6
|
+
* The CLI's attachment store, content-addressed, over a real blob driver.
|
|
7
|
+
*
|
|
8
|
+
* `@namzu/files` shipped six drivers and had no consumer in this repo — a
|
|
9
|
+
* package the estate could import and nothing here could point at. This is
|
|
10
|
+
* the pointing: the local driver, wired to the seam the SDK added for
|
|
11
|
+
* attachments, in the one host that actually attaches things.
|
|
12
|
+
*
|
|
13
|
+
* **Addressed by content AND media type**, not by content alone. The same
|
|
14
|
+
* bytes declared `image/png` once and `application/pdf` later are two
|
|
15
|
+
* different claims about what they are, and the SDK's resolver refuses a
|
|
16
|
+
* ref whose stored media type disagrees with the message. Keying on bytes
|
|
17
|
+
* alone would make the second `put` return the first ref, and every message
|
|
18
|
+
* using it would then be refused — a dedup that manufactures the exact
|
|
19
|
+
* mismatch the resolver exists to catch. Folding the media type into the
|
|
20
|
+
* digest keeps dedup for the common case (the same file attached twice) and
|
|
21
|
+
* gives an honest ref for the uncommon one.
|
|
22
|
+
*/
|
|
23
|
+
/** `<home>/.namzu/attachments`, beside the credential store. */
|
|
24
|
+
export function attachmentsDir(home = homedir()) {
|
|
25
|
+
return join(home, '.namzu', 'attachments');
|
|
26
|
+
}
|
|
27
|
+
export class BlobAttachmentStore {
|
|
28
|
+
blobs;
|
|
29
|
+
constructor(options = {}) {
|
|
30
|
+
this.blobs = options.blobs ?? new LocalFsBlobStore({ root: attachmentsDir(options.home) });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The key for these bytes under this media type.
|
|
34
|
+
*
|
|
35
|
+
* Two files rather than one: the bytes, and a sibling holding the media
|
|
36
|
+
* type. The blob store stores bytes and nothing else, and the SDK's
|
|
37
|
+
* resolver needs the store to be able to REPORT what it holds — a store
|
|
38
|
+
* that could only echo back what the caller claimed could never catch a
|
|
39
|
+
* mismatch, which is the check that keeps a PDF from being sent as a PNG.
|
|
40
|
+
*/
|
|
41
|
+
key(mediaType, data) {
|
|
42
|
+
const digest = createHash('sha256').update(mediaType).update('\0').update(data).digest('hex');
|
|
43
|
+
// Two levels, because a flat directory of every attachment a machine
|
|
44
|
+
// has ever seen is a directory nothing enumerates twice.
|
|
45
|
+
return `${digest.slice(0, 2)}/${digest.slice(2)}`;
|
|
46
|
+
}
|
|
47
|
+
async put(bytes) {
|
|
48
|
+
const key = this.key(bytes.mediaType, bytes.data);
|
|
49
|
+
// Written every time rather than checked first. A `get` before every
|
|
50
|
+
// `put` doubles the syscalls to avoid rewriting identical bytes to an
|
|
51
|
+
// identical path, and the write is what makes the ref valid — skipping
|
|
52
|
+
// it on a stale "exists" answer is how a ref points at nothing.
|
|
53
|
+
await this.blobs.put({
|
|
54
|
+
key: `${key}.bin`,
|
|
55
|
+
bytes: Buffer.from(bytes.data, 'base64'),
|
|
56
|
+
mimeType: bytes.mediaType,
|
|
57
|
+
});
|
|
58
|
+
await this.blobs.put({
|
|
59
|
+
key: `${key}.type`,
|
|
60
|
+
bytes: Buffer.from(bytes.mediaType, 'utf-8'),
|
|
61
|
+
mimeType: 'text/plain',
|
|
62
|
+
});
|
|
63
|
+
return key;
|
|
64
|
+
}
|
|
65
|
+
async get(ref) {
|
|
66
|
+
// The blob store validates the key against path traversal, and this
|
|
67
|
+
// passes the caller's ref through unchanged so that check is the one
|
|
68
|
+
// that runs. Sanitising here as well would mean two rules that can
|
|
69
|
+
// disagree, and the weaker one would be the one nobody reads.
|
|
70
|
+
const [blob, type] = await Promise.all([
|
|
71
|
+
this.blobs.get({ provider: 'local-fs', key: `${ref}.bin` }),
|
|
72
|
+
this.blobs.get({ provider: 'local-fs', key: `${ref}.type` }),
|
|
73
|
+
]);
|
|
74
|
+
if (!blob || !type) {
|
|
75
|
+
// BOTH, or nothing. A ref with bytes and no media type is a
|
|
76
|
+
// half-written attachment, and answering with a guessed type is how
|
|
77
|
+
// a PDF reaches a provider labelled as an image.
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
data: Buffer.from(blob.bytes).toString('base64'),
|
|
82
|
+
mediaType: Buffer.from(type.bytes).toString('utf-8'),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=attachment-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-store.js","sourceRoot":"","sources":["../../../src/integrations/files/attachment-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAA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ialProvider, ResolvedCredential } from '@namzu/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The CLI's hardened credential file, as a writable `CredentialProvider`.
|
|
4
|
+
*
|
|
5
|
+
* The seam had no writable implementation, so `describe()` reported
|
|
6
|
+
* `writable: false` everywhere and nothing could rotate a credential
|
|
7
|
+
* through it — the OAuth refresh wrote straight into this store, invisibly
|
|
8
|
+
* to the kernel.
|
|
9
|
+
*
|
|
10
|
+
* **This adapter adds no file logic of its own.** The store already owns
|
|
11
|
+
* the `wx` open, the `0600`, the read-back that proves the mode landed and
|
|
12
|
+
* the refusal that leaves no file when it did not. Reimplementing any of
|
|
13
|
+
* that here would be a second, weaker copy of a guarantee this repo has a
|
|
14
|
+
* ratified rule about, and the copy is the one that would drift.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The one credential this store holds.
|
|
18
|
+
*
|
|
19
|
+
* A single ref rather than a namespace, because the file has exactly one
|
|
20
|
+
* subscription credential in it. A provider that accepted any name would
|
|
21
|
+
* report `configured: false` for every other one — indistinguishable from
|
|
22
|
+
* "this name is not set here" — while quietly answering only for this one.
|
|
23
|
+
*/
|
|
24
|
+
export declare const SUBSCRIPTION_CREDENTIAL_REF = "namzu.subscription.accessToken";
|
|
25
|
+
export interface FileCredentialProviderOptions {
|
|
26
|
+
/** Home directory the store resolves its path under. Injectable for tests. */
|
|
27
|
+
readonly home?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class FileCredentialProvider implements CredentialProvider {
|
|
30
|
+
private readonly options;
|
|
31
|
+
constructor(options?: FileCredentialProviderOptions);
|
|
32
|
+
private get source();
|
|
33
|
+
private refused;
|
|
34
|
+
resolve(ref: string): Promise<ResolvedCredential | undefined>;
|
|
35
|
+
describe(ref: string): Promise<CredentialDescription>;
|
|
36
|
+
set(ref: string, value: string): Promise<void>;
|
|
37
|
+
unset(ref: string): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=credential-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-provider.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/credential-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAU/F;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,mCAAmC,CAAA;AAE3E,MAAM,WAAW,6BAA6B;IAC7C,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,qBAAa,sBAAuB,YAAW,kBAAkB;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,GAAE,6BAAkC;IAExE,OAAO,KAAK,MAAM,GAEjB;IAED,OAAO,CAAC,OAAO;IAST,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAQ7D,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAYrD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc9C,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMvC"}
|