@intutic/cli 1.10.0 → 2.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 +1 -0
- package/dist/cli.js +868 -30
- package/dist/cli.js.map +1 -1
- package/dist/commands/attenuate.d.ts +39 -0
- package/dist/commands/attenuate.d.ts.map +1 -0
- package/dist/commands/attenuate.js +98 -0
- package/dist/commands/attenuate.js.map +1 -0
- package/dist/commands/budget.d.ts +80 -0
- package/dist/commands/budget.d.ts.map +1 -1
- package/dist/commands/budget.js +119 -3
- package/dist/commands/budget.js.map +1 -1
- package/dist/commands/connect.d.ts +10 -0
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +358 -48
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/credentials.d.ts +31 -0
- package/dist/commands/credentials.d.ts.map +1 -0
- package/dist/commands/credentials.js +134 -0
- package/dist/commands/credentials.js.map +1 -0
- package/dist/commands/decision.d.ts +37 -0
- package/dist/commands/decision.d.ts.map +1 -0
- package/dist/commands/decision.js +56 -0
- package/dist/commands/decision.js.map +1 -0
- package/dist/commands/doctor.d.ts +38 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +228 -18
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/enforce.d.ts +33 -0
- package/dist/commands/enforce.d.ts.map +1 -0
- package/dist/commands/enforce.js +150 -0
- package/dist/commands/enforce.js.map +1 -0
- package/dist/commands/enterprise.d.ts +29 -0
- package/dist/commands/enterprise.d.ts.map +1 -0
- package/dist/commands/enterprise.js +141 -0
- package/dist/commands/enterprise.js.map +1 -0
- package/dist/commands/env.d.ts +7 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +55 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/exec.d.ts +38 -2
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/exec.js +247 -10
- package/dist/commands/exec.js.map +1 -1
- package/dist/commands/findings.d.ts +84 -0
- package/dist/commands/findings.d.ts.map +1 -0
- package/dist/commands/findings.js +329 -0
- package/dist/commands/findings.js.map +1 -0
- package/dist/commands/gateway.d.ts +62 -0
- package/dist/commands/gateway.d.ts.map +1 -0
- package/dist/commands/gateway.js +298 -0
- package/dist/commands/gateway.js.map +1 -0
- package/dist/commands/guardrails.d.ts +81 -0
- package/dist/commands/guardrails.d.ts.map +1 -0
- package/dist/commands/guardrails.js +735 -0
- package/dist/commands/guardrails.js.map +1 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +14 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install-daemon.d.ts +70 -3
- package/dist/commands/install-daemon.d.ts.map +1 -1
- package/dist/commands/install-daemon.js +482 -47
- package/dist/commands/install-daemon.js.map +1 -1
- package/dist/commands/integrity.d.ts +205 -0
- package/dist/commands/integrity.d.ts.map +1 -0
- package/dist/commands/integrity.js +620 -0
- package/dist/commands/integrity.js.map +1 -0
- package/dist/commands/judge.d.ts +31 -0
- package/dist/commands/judge.d.ts.map +1 -0
- package/dist/commands/judge.js +118 -0
- package/dist/commands/judge.js.map +1 -0
- package/dist/commands/org.d.ts +31 -0
- package/dist/commands/org.d.ts.map +1 -0
- package/dist/commands/org.js +159 -0
- package/dist/commands/org.js.map +1 -0
- package/dist/commands/policy.d.ts +138 -4
- package/dist/commands/policy.d.ts.map +1 -1
- package/dist/commands/policy.js +538 -97
- package/dist/commands/policy.js.map +1 -1
- package/dist/commands/predict-cost.d.ts +45 -0
- package/dist/commands/predict-cost.d.ts.map +1 -0
- package/dist/commands/predict-cost.js +123 -0
- package/dist/commands/predict-cost.js.map +1 -0
- package/dist/commands/rollback.d.ts +5 -0
- package/dist/commands/rollback.d.ts.map +1 -0
- package/dist/commands/rollback.js +142 -0
- package/dist/commands/rollback.js.map +1 -0
- package/dist/commands/routing.d.ts +62 -0
- package/dist/commands/routing.d.ts.map +1 -0
- package/dist/commands/routing.js +121 -0
- package/dist/commands/routing.js.map +1 -0
- package/dist/commands/setup.d.ts +62 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +238 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/skill.d.ts +268 -1
- package/dist/commands/skill.d.ts.map +1 -1
- package/dist/commands/skill.js +744 -39
- package/dist/commands/skill.js.map +1 -1
- package/dist/commands/sops.d.ts +95 -0
- package/dist/commands/sops.d.ts.map +1 -1
- package/dist/commands/sops.js +334 -34
- package/dist/commands/sops.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +1 -18
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +44 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team.d.ts +38 -0
- package/dist/commands/team.d.ts.map +1 -0
- package/dist/commands/team.js +140 -0
- package/dist/commands/team.js.map +1 -0
- package/dist/commands/traces.d.ts +8 -1
- package/dist/commands/traces.d.ts.map +1 -1
- package/dist/commands/traces.js +114 -15
- package/dist/commands/traces.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +2 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/config/keychain.d.ts +10 -2
- package/dist/config/keychain.d.ts.map +1 -1
- package/dist/config/keychain.js +83 -14
- package/dist/config/keychain.js.map +1 -1
- package/dist/config/paths.d.ts +27 -0
- package/dist/config/paths.d.ts.map +1 -1
- package/dist/config/paths.js +37 -6
- package/dist/config/paths.js.map +1 -1
- package/dist/config/store.d.ts.map +1 -1
- package/dist/config/store.js +19 -3
- package/dist/config/store.js.map +1 -1
- package/dist/harness/ag2.d.ts +22 -0
- package/dist/harness/ag2.d.ts.map +1 -0
- package/dist/harness/ag2.js +34 -0
- package/dist/harness/ag2.js.map +1 -0
- package/dist/harness/agentcore.d.ts +55 -0
- package/dist/harness/agentcore.d.ts.map +1 -0
- package/dist/harness/agentcore.js +119 -0
- package/dist/harness/agentcore.js.map +1 -0
- package/dist/harness/agenticOrchestrator.d.ts +52 -0
- package/dist/harness/agenticOrchestrator.d.ts.map +1 -0
- package/dist/harness/agenticOrchestrator.js +115 -0
- package/dist/harness/agenticOrchestrator.js.map +1 -0
- package/dist/harness/aiSdkHarness.d.ts +30 -0
- package/dist/harness/aiSdkHarness.d.ts.map +1 -0
- package/dist/harness/aiSdkHarness.js +51 -0
- package/dist/harness/aiSdkHarness.js.map +1 -0
- package/dist/harness/aiSdkWorkflow.d.ts +26 -0
- package/dist/harness/aiSdkWorkflow.d.ts.map +1 -0
- package/dist/harness/aiSdkWorkflow.js +39 -0
- package/dist/harness/aiSdkWorkflow.js.map +1 -0
- package/dist/harness/autogen.d.ts +24 -0
- package/dist/harness/autogen.d.ts.map +1 -0
- package/dist/harness/autogen.js +36 -0
- package/dist/harness/autogen.js.map +1 -0
- package/dist/harness/base.js.map +1 -1
- package/dist/harness/continue.d.ts.map +1 -1
- package/dist/harness/continue.js +2 -1
- package/dist/harness/continue.js.map +1 -1
- package/dist/harness/crewai.d.ts +15 -0
- package/dist/harness/crewai.d.ts.map +1 -0
- package/dist/harness/crewai.js +26 -0
- package/dist/harness/crewai.js.map +1 -0
- package/dist/harness/detector.d.ts +1 -1
- package/dist/harness/detector.d.ts.map +1 -1
- package/dist/harness/detector.js +47 -1
- package/dist/harness/detector.js.map +1 -1
- package/dist/harness/dsh.d.ts +19 -0
- package/dist/harness/dsh.d.ts.map +1 -0
- package/dist/harness/dsh.js +93 -0
- package/dist/harness/dsh.js.map +1 -0
- package/dist/harness/eve.d.ts +40 -0
- package/dist/harness/eve.d.ts.map +1 -0
- package/dist/harness/eve.js +67 -0
- package/dist/harness/eve.js.map +1 -0
- package/dist/harness/googleAdk.d.ts +18 -0
- package/dist/harness/googleAdk.d.ts.map +1 -0
- package/dist/harness/googleAdk.js +29 -0
- package/dist/harness/googleAdk.js.map +1 -0
- package/dist/harness/goose.d.ts.map +1 -1
- package/dist/harness/goose.js +5 -1
- package/dist/harness/goose.js.map +1 -1
- package/dist/harness/grok.d.ts +16 -0
- package/dist/harness/grok.d.ts.map +1 -0
- package/dist/harness/grok.js +78 -0
- package/dist/harness/grok.js.map +1 -0
- package/dist/harness/jsSdkGatedAdapter.d.ts +102 -0
- package/dist/harness/jsSdkGatedAdapter.d.ts.map +1 -0
- package/dist/harness/jsSdkGatedAdapter.js +139 -0
- package/dist/harness/jsSdkGatedAdapter.js.map +1 -0
- package/dist/harness/langchain.d.ts +22 -0
- package/dist/harness/langchain.d.ts.map +1 -0
- package/dist/harness/langchain.js +33 -0
- package/dist/harness/langchain.js.map +1 -0
- package/dist/harness/langgraph.d.ts +22 -0
- package/dist/harness/langgraph.d.ts.map +1 -0
- package/dist/harness/langgraph.js +80 -0
- package/dist/harness/langgraph.js.map +1 -0
- package/dist/harness/mastra.d.ts +21 -0
- package/dist/harness/mastra.d.ts.map +1 -0
- package/dist/harness/mastra.js +33 -0
- package/dist/harness/mastra.js.map +1 -0
- package/dist/harness/muse.d.ts +22 -0
- package/dist/harness/muse.d.ts.map +1 -0
- package/dist/harness/muse.js +92 -0
- package/dist/harness/muse.js.map +1 -0
- package/dist/harness/n8n.d.ts.map +1 -1
- package/dist/harness/n8n.js +36 -11
- package/dist/harness/n8n.js.map +1 -1
- package/dist/harness/openaiAgents.d.ts +40 -0
- package/dist/harness/openaiAgents.d.ts.map +1 -0
- package/dist/harness/openaiAgents.js +107 -0
- package/dist/harness/openaiAgents.js.map +1 -0
- package/dist/harness/opencode.d.ts +24 -0
- package/dist/harness/opencode.d.ts.map +1 -0
- package/dist/harness/opencode.js +97 -0
- package/dist/harness/opencode.js.map +1 -0
- package/dist/harness/pydanticAi.d.ts +19 -0
- package/dist/harness/pydanticAi.d.ts.map +1 -0
- package/dist/harness/pydanticAi.js +30 -0
- package/dist/harness/pydanticAi.js.map +1 -0
- package/dist/harness/sdkGatedAdapter.d.ts +55 -0
- package/dist/harness/sdkGatedAdapter.d.ts.map +1 -0
- package/dist/harness/sdkGatedAdapter.js +85 -0
- package/dist/harness/sdkGatedAdapter.js.map +1 -0
- package/dist/harness/smolagents.d.ts +22 -0
- package/dist/harness/smolagents.d.ts.map +1 -0
- package/dist/harness/smolagents.js +33 -0
- package/dist/harness/smolagents.js.map +1 -0
- package/dist/harness/strands.d.ts +22 -0
- package/dist/harness/strands.d.ts.map +1 -0
- package/dist/harness/strands.js +35 -0
- package/dist/harness/strands.js.map +1 -0
- package/dist/harness/trueforge.d.ts +25 -0
- package/dist/harness/trueforge.d.ts.map +1 -0
- package/dist/harness/trueforge.js +40 -0
- package/dist/harness/trueforge.js.map +1 -0
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/types.js +70 -0
- package/dist/harness/types.js.map +1 -1
- package/dist/harness/vercelAiSdk.d.ts +31 -0
- package/dist/harness/vercelAiSdk.d.ts.map +1 -0
- package/dist/harness/vercelAiSdk.js +44 -0
- package/dist/harness/vercelAiSdk.js.map +1 -0
- package/dist/harness/xirp.d.ts +43 -0
- package/dist/harness/xirp.d.ts.map +1 -0
- package/dist/harness/xirp.js +95 -0
- package/dist/harness/xirp.js.map +1 -0
- package/dist/lib/api.d.ts +68 -0
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +108 -67
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/authMessages.d.ts +19 -0
- package/dist/lib/authMessages.d.ts.map +1 -0
- package/dist/lib/authMessages.js +20 -0
- package/dist/lib/authMessages.js.map +1 -0
- package/dist/lib/binaryChecksum.d.ts +12 -0
- package/dist/lib/binaryChecksum.d.ts.map +1 -0
- package/dist/lib/binaryChecksum.js +45 -0
- package/dist/lib/binaryChecksum.js.map +1 -0
- package/dist/lib/binaryOnPath.d.ts +24 -0
- package/dist/lib/binaryOnPath.d.ts.map +1 -0
- package/dist/lib/binaryOnPath.js +31 -0
- package/dist/lib/binaryOnPath.js.map +1 -0
- package/dist/lib/caTrust.d.ts +69 -0
- package/dist/lib/caTrust.d.ts.map +1 -0
- package/dist/lib/caTrust.js +169 -0
- package/dist/lib/caTrust.js.map +1 -0
- package/dist/lib/ciscoScanner.d.ts +178 -0
- package/dist/lib/ciscoScanner.d.ts.map +1 -0
- package/dist/lib/ciscoScanner.js +292 -0
- package/dist/lib/ciscoScanner.js.map +1 -0
- package/dist/lib/decisionsLogRefresh.d.ts +28 -0
- package/dist/lib/decisionsLogRefresh.d.ts.map +1 -0
- package/dist/lib/decisionsLogRefresh.js +54 -0
- package/dist/lib/decisionsLogRefresh.js.map +1 -0
- package/dist/lib/deviceReport.d.ts +26 -0
- package/dist/lib/deviceReport.d.ts.map +1 -0
- package/dist/lib/deviceReport.js +55 -0
- package/dist/lib/deviceReport.js.map +1 -0
- package/dist/lib/elevation.d.ts +58 -0
- package/dist/lib/elevation.d.ts.map +1 -0
- package/dist/lib/elevation.js +83 -0
- package/dist/lib/elevation.js.map +1 -0
- package/dist/lib/enforcementState.d.ts +69 -0
- package/dist/lib/enforcementState.d.ts.map +1 -0
- package/dist/lib/enforcementState.js +113 -0
- package/dist/lib/enforcementState.js.map +1 -0
- package/dist/lib/ensureValkey.d.ts.map +1 -1
- package/dist/lib/ensureValkey.js +2 -2
- package/dist/lib/ensureValkey.js.map +1 -1
- package/dist/lib/envInjector.d.ts.map +1 -1
- package/dist/lib/envInjector.js +22 -4
- package/dist/lib/envInjector.js.map +1 -1
- package/dist/lib/gitHooks.d.ts +7 -2
- package/dist/lib/gitHooks.d.ts.map +1 -1
- package/dist/lib/gitHooks.js +180 -13
- package/dist/lib/gitHooks.js.map +1 -1
- package/dist/lib/gracefulShutdown.d.ts +37 -0
- package/dist/lib/gracefulShutdown.d.ts.map +1 -0
- package/dist/lib/gracefulShutdown.js +57 -0
- package/dist/lib/gracefulShutdown.js.map +1 -0
- package/dist/lib/graphIdentity.d.ts +80 -0
- package/dist/lib/graphIdentity.d.ts.map +1 -0
- package/dist/lib/graphIdentity.js +120 -0
- package/dist/lib/graphIdentity.js.map +1 -0
- package/dist/lib/localTraces.d.ts +61 -0
- package/dist/lib/localTraces.d.ts.map +1 -0
- package/dist/lib/localTraces.js +173 -0
- package/dist/lib/localTraces.js.map +1 -0
- package/dist/lib/mdmManifest.d.ts +73 -0
- package/dist/lib/mdmManifest.d.ts.map +1 -0
- package/dist/lib/mdmManifest.js +190 -0
- package/dist/lib/mdmManifest.js.map +1 -0
- package/dist/lib/onboarding.d.ts.map +1 -1
- package/dist/lib/onboarding.js +60 -1
- package/dist/lib/onboarding.js.map +1 -1
- package/dist/lib/otelPropagation.d.ts +26 -0
- package/dist/lib/otelPropagation.d.ts.map +1 -0
- package/dist/lib/otelPropagation.js +40 -0
- package/dist/lib/otelPropagation.js.map +1 -0
- package/dist/lib/policySnapshot.d.ts +92 -0
- package/dist/lib/policySnapshot.d.ts.map +1 -0
- package/dist/lib/policySnapshot.js +173 -0
- package/dist/lib/policySnapshot.js.map +1 -0
- package/dist/lib/process.d.ts.map +1 -1
- package/dist/lib/process.js +60 -0
- package/dist/lib/process.js.map +1 -1
- package/dist/lib/providerProbe.d.ts +28 -0
- package/dist/lib/providerProbe.d.ts.map +1 -0
- package/dist/lib/providerProbe.js +57 -0
- package/dist/lib/providerProbe.js.map +1 -0
- package/dist/lib/proxyBinary.d.ts +19 -0
- package/dist/lib/proxyBinary.d.ts.map +1 -0
- package/dist/lib/proxyBinary.js +30 -0
- package/dist/lib/proxyBinary.js.map +1 -0
- package/dist/lib/sandbox/firecracker.d.ts +89 -0
- package/dist/lib/sandbox/firecracker.d.ts.map +1 -0
- package/dist/lib/sandbox/firecracker.js +135 -0
- package/dist/lib/sandbox/firecracker.js.map +1 -0
- package/dist/lib/sandbox/index.d.ts +34 -0
- package/dist/lib/sandbox/index.d.ts.map +1 -0
- package/dist/lib/sandbox/index.js +54 -0
- package/dist/lib/sandbox/index.js.map +1 -0
- package/dist/lib/sandbox/oci.d.ts +38 -0
- package/dist/lib/sandbox/oci.d.ts.map +1 -0
- package/dist/lib/sandbox/oci.js +108 -0
- package/dist/lib/sandbox/oci.js.map +1 -0
- package/dist/lib/sandbox/types.d.ts +48 -0
- package/dist/lib/sandbox/types.d.ts.map +1 -0
- package/dist/lib/sandbox/types.js +12 -0
- package/dist/lib/sandbox/types.js.map +1 -0
- package/dist/lib/sopFrontMatter.d.ts +50 -0
- package/dist/lib/sopFrontMatter.d.ts.map +1 -0
- package/dist/lib/sopFrontMatter.js +129 -0
- package/dist/lib/sopFrontMatter.js.map +1 -0
- package/package.json +11 -6
package/dist/lib/api.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* LLD #8 — Sync Daemon / CLI
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
+
import { toonDecode as sharedToonDecode } from '@intutic/shared-types';
|
|
11
|
+
import { injectTraceHeaders } from './otelPropagation.js';
|
|
10
12
|
/**
|
|
11
13
|
* Create an API client bound to a control plane URL and API key.
|
|
12
14
|
*
|
|
@@ -14,12 +16,16 @@
|
|
|
14
16
|
* @param apiKey - API key (vk_*) or JWT access token
|
|
15
17
|
*/
|
|
16
18
|
export function createApiClient(controlPlaneUrl, apiKey) {
|
|
17
|
-
const
|
|
19
|
+
const baseHeaders = {
|
|
18
20
|
'Content-Type': 'application/json',
|
|
19
21
|
'Authorization': `Bearer ${apiKey}`,
|
|
20
22
|
};
|
|
21
23
|
async function request(method, path, body) {
|
|
22
24
|
const url = `${controlPlaneUrl}${path}`;
|
|
25
|
+
// Per-request copy: injectTraceHeaders mutates in place, and baseHeaders
|
|
26
|
+
// is shared across every call this client makes.
|
|
27
|
+
const headers = { ...baseHeaders };
|
|
28
|
+
injectTraceHeaders(headers);
|
|
23
29
|
const res = await fetch(url, {
|
|
24
30
|
method,
|
|
25
31
|
headers,
|
|
@@ -29,20 +35,7 @@ export function createApiClient(controlPlaneUrl, apiKey) {
|
|
|
29
35
|
const text = await res.text().catch(() => 'Unknown error');
|
|
30
36
|
throw new Error(`API ${method} ${path} failed (${res.status}): ${text}`);
|
|
31
37
|
}
|
|
32
|
-
|
|
33
|
-
if (data &&
|
|
34
|
-
typeof data === 'object' &&
|
|
35
|
-
'format' in data &&
|
|
36
|
-
data.format === 'toon' &&
|
|
37
|
-
typeof data.data === 'string' &&
|
|
38
|
-
typeof data.listProperty === 'string') {
|
|
39
|
-
const decoded = toonDecode(data.data);
|
|
40
|
-
data[data.listProperty] = decoded;
|
|
41
|
-
delete data.format;
|
|
42
|
-
delete data.data;
|
|
43
|
-
delete data.listProperty;
|
|
44
|
-
}
|
|
45
|
-
return data;
|
|
38
|
+
return unwrapToonEnvelope(await res.json());
|
|
46
39
|
}
|
|
47
40
|
return {
|
|
48
41
|
async fetchConfig(workspaceId) {
|
|
@@ -63,66 +56,114 @@ export function createApiClient(controlPlaneUrl, apiKey) {
|
|
|
63
56
|
async get(path) {
|
|
64
57
|
return request('GET', path);
|
|
65
58
|
},
|
|
59
|
+
async getWithStatus(path) {
|
|
60
|
+
const headers = { ...baseHeaders };
|
|
61
|
+
injectTraceHeaders(headers);
|
|
62
|
+
const res = await fetch(`${controlPlaneUrl}${path}`, { method: 'GET', headers });
|
|
63
|
+
const text = await res.text();
|
|
64
|
+
let body;
|
|
65
|
+
try {
|
|
66
|
+
body = JSON.parse(text);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// Kept rather than discarded: a proxy's HTML error page is the thing
|
|
70
|
+
// that explains a status the caller did not expect.
|
|
71
|
+
body = { error: text };
|
|
72
|
+
}
|
|
73
|
+
return { status: res.status, body: body };
|
|
74
|
+
},
|
|
66
75
|
async post(path, body) {
|
|
67
76
|
return request('POST', path, body);
|
|
68
77
|
},
|
|
78
|
+
async postWithStatus(path, body) {
|
|
79
|
+
const headers = { ...baseHeaders };
|
|
80
|
+
injectTraceHeaders(headers);
|
|
81
|
+
const res = await fetch(`${controlPlaneUrl}${path}`, {
|
|
82
|
+
method: 'POST',
|
|
83
|
+
headers,
|
|
84
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
85
|
+
});
|
|
86
|
+
const text = await res.text();
|
|
87
|
+
let parsed;
|
|
88
|
+
try {
|
|
89
|
+
parsed = JSON.parse(text);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
parsed = { error: text };
|
|
93
|
+
}
|
|
94
|
+
return { status: res.status, body: unwrapToonEnvelope(parsed) };
|
|
95
|
+
},
|
|
96
|
+
async postForm(path, form) {
|
|
97
|
+
const headers = { Authorization: baseHeaders.Authorization };
|
|
98
|
+
injectTraceHeaders(headers);
|
|
99
|
+
const res = await fetch(`${controlPlaneUrl}${path}`, { method: 'POST', headers, body: form });
|
|
100
|
+
const text = await res.text();
|
|
101
|
+
let parsed;
|
|
102
|
+
try {
|
|
103
|
+
parsed = JSON.parse(text);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
parsed = { error: text };
|
|
107
|
+
}
|
|
108
|
+
return { status: res.status, body: unwrapToonEnvelope(parsed) };
|
|
109
|
+
},
|
|
69
110
|
async put(path, body) {
|
|
70
111
|
return request('PUT', path, body);
|
|
71
112
|
},
|
|
113
|
+
async patch(path, body) {
|
|
114
|
+
return request('PATCH', path, body);
|
|
115
|
+
},
|
|
116
|
+
async del(path, body) {
|
|
117
|
+
return request('DELETE', path, body);
|
|
118
|
+
},
|
|
72
119
|
};
|
|
73
120
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
obj[cols[i]] = num;
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
if (raw.startsWith('{') || raw.startsWith('[')) {
|
|
114
|
-
try {
|
|
115
|
-
obj[cols[i]] = JSON.parse(raw);
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
catch {
|
|
119
|
-
/* fall through */
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
obj[cols[i]] = raw;
|
|
123
|
-
}
|
|
124
|
-
rows.push(obj);
|
|
121
|
+
/**
|
|
122
|
+
* Decodes a TOON payload, normalising "not TOON" to an empty list.
|
|
123
|
+
*
|
|
124
|
+
* The format lives in `@intutic/shared-types`, imported rather than copied. It
|
|
125
|
+
* used to be a private `splitCells` here, byte-identical to one in the dashboard
|
|
126
|
+
* and a third in the control plane, with a comment in each saying they must not
|
|
127
|
+
* diverge. They did — an escaping fix reached the encoder and the control
|
|
128
|
+
* plane's own decoder, which nothing calls, while these two kept the old code
|
|
129
|
+
* and a CRITICAL incident carried on printing as its trace id.
|
|
130
|
+
*
|
|
131
|
+
* The shared decoder returns `null` for input that is not TOON; this surface has
|
|
132
|
+
* always returned a list, and its caller assigns the result straight onto the
|
|
133
|
+
* response object, so the shape is preserved here rather than pushed outward.
|
|
134
|
+
*/
|
|
135
|
+
export function toonDecode(toon) {
|
|
136
|
+
return sharedToonDecode(toon) ?? [];
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Move a TOON-encoded list out of its envelope and onto `listProperty`.
|
|
140
|
+
*
|
|
141
|
+
* Extracted from `request` because it was inline and therefore untestable, and
|
|
142
|
+
* it was wrong: the old code assigned the decoded rows and only THEN deleted
|
|
143
|
+
* `data`. `listProperty` names where the rows should land, and for
|
|
144
|
+
* `/api/v1/incidents` that name IS `data` — so the rows were written and
|
|
145
|
+
* immediately deleted, and any incidents response over the 20-row TOON
|
|
146
|
+
* threshold arrived as `{meta:{total:22}}`. Zero rows, no error.
|
|
147
|
+
* `/api/v1/traces` escaped only because its listProperty is `traces`.
|
|
148
|
+
*
|
|
149
|
+
* Non-TOON bodies pass through untouched.
|
|
150
|
+
*/
|
|
151
|
+
export function unwrapToonEnvelope(data) {
|
|
152
|
+
if (!data ||
|
|
153
|
+
typeof data !== 'object' ||
|
|
154
|
+
!('format' in data) ||
|
|
155
|
+
data['format'] !== 'toon') {
|
|
156
|
+
return data;
|
|
125
157
|
}
|
|
126
|
-
|
|
158
|
+
const body = data;
|
|
159
|
+
const listProperty = body['listProperty'];
|
|
160
|
+
if (typeof body['data'] !== 'string' || typeof listProperty !== 'string')
|
|
161
|
+
return data;
|
|
162
|
+
const decoded = toonDecode(body['data']);
|
|
163
|
+
delete body['format'];
|
|
164
|
+
delete body['data'];
|
|
165
|
+
delete body['listProperty'];
|
|
166
|
+
body[listProperty] = decoded;
|
|
167
|
+
return body;
|
|
127
168
|
}
|
|
128
169
|
//# sourceMappingURL=api.js.map
|
package/dist/lib/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AA+CzD;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,eAAuB,EAAE,MAAc;IACrE,MAAM,WAAW,GAAG;QAClB,cAAc,EAAE,kBAAkB;QAClC,eAAe,EAAE,UAAU,MAAM,EAAE;KACpC,CAAA;IAED,KAAK,UAAU,OAAO,CAAI,MAAc,EAAE,IAAY,EAAE,IAAc;QACpE,MAAM,GAAG,GAAG,GAAG,eAAe,GAAG,IAAI,EAAE,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|
|
|
1
|
+
/**
|
|
2
|
+
* The refusal a control-plane command prints when no credentials are set.
|
|
3
|
+
*
|
|
4
|
+
* Nine command files carried this exact string as an independent literal —
|
|
5
|
+
* `skill.ts`'s `getClient()` a tenth, `integrity.ts` an eleventh (its own
|
|
6
|
+
* file-local const, reused four times internally) — with zero drift between
|
|
7
|
+
* them, which is the good case of a message that should have been one
|
|
8
|
+
* constant from the start. Extracted here rather than left duplicated.
|
|
9
|
+
*
|
|
10
|
+
* `init.ts`, `connect.ts` and `traces.ts` deliberately do NOT use this: each
|
|
11
|
+
* has its own more specific message (`connect.ts`'s carries an inline
|
|
12
|
+
* comment explaining why the generic "run `intutic login`" framing sent
|
|
13
|
+
* standalone users looking for an account that doesn't exist). Do not fold
|
|
14
|
+
* those in.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
export declare const NOT_AUTHENTICATED: string;
|
|
19
|
+
//# sourceMappingURL=authMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authMessages.d.ts","sourceRoot":"","sources":["../../src/lib/authMessages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,iBAAiB,QAEgG,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The refusal a control-plane command prints when no credentials are set.
|
|
3
|
+
*
|
|
4
|
+
* Nine command files carried this exact string as an independent literal —
|
|
5
|
+
* `skill.ts`'s `getClient()` a tenth, `integrity.ts` an eleventh (its own
|
|
6
|
+
* file-local const, reused four times internally) — with zero drift between
|
|
7
|
+
* them, which is the good case of a message that should have been one
|
|
8
|
+
* constant from the start. Extracted here rather than left duplicated.
|
|
9
|
+
*
|
|
10
|
+
* `init.ts`, `connect.ts` and `traces.ts` deliberately do NOT use this: each
|
|
11
|
+
* has its own more specific message (`connect.ts`'s carries an inline
|
|
12
|
+
* comment explaining why the generic "run `intutic login`" framing sent
|
|
13
|
+
* standalone users looking for an account that doesn't exist). Do not fold
|
|
14
|
+
* those in.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
export const NOT_AUTHENTICATED = 'Not authenticated. This command needs an Intutic control plane, which open core does not include. ' +
|
|
19
|
+
'To run the proxy without one: `intutic start`. See https://docs.intutic.ai/guide/tier-matrix for what standalone includes.';
|
|
20
|
+
//# sourceMappingURL=authMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authMessages.js","sourceRoot":"","sources":["../../src/lib/authMessages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAC5B,oGAAoG;IACpG,4HAA4H,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** `sha256:<hex>` of `buffer` — the shape publish.yml's checksums.json values use. */
|
|
2
|
+
export declare function sha256Hex(buffer: Buffer): string;
|
|
3
|
+
/** Parses a checksums.json body into a plain name→digest map. Throws on any other shape. */
|
|
4
|
+
export declare function parseChecksums(text: string): Record<string, string>;
|
|
5
|
+
/**
|
|
6
|
+
* Throws unless `buffer`'s digest matches `checksums[assetName]`. A missing entry
|
|
7
|
+
* fails the same as a mismatch — an asset absent from the manifest is exactly as
|
|
8
|
+
* unverifiable as one that fails it, and treating it as "nothing to check" would
|
|
9
|
+
* make the whole guard optional for any release that forgot to list an asset.
|
|
10
|
+
*/
|
|
11
|
+
export declare function verifyChecksum(buffer: Buffer, checksums: Record<string, string>, assetName: string): void;
|
|
12
|
+
//# sourceMappingURL=binaryChecksum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binaryChecksum.d.ts","sourceRoot":"","sources":["../../src/lib/binaryChecksum.ts"],"names":[],"mappings":"AAcA,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMnE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAczG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checksum verification for downloaded release binaries.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors packages/proxy/bin/proxy.js's own copy of these three functions
|
|
5
|
+
* (same names, same behavior, same `sha256:<hex>` digest shape) — that file
|
|
6
|
+
* has no build step and deliberately no dependencies beyond Node builtins, so
|
|
7
|
+
* it cannot import this package; the logic is kept in lockstep by hand
|
|
8
|
+
* instead, same as this file's caller already mirrors that one's asset-name
|
|
9
|
+
* resolution and download flow.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { createHash } from 'node:crypto';
|
|
14
|
+
/** `sha256:<hex>` of `buffer` — the shape publish.yml's checksums.json values use. */
|
|
15
|
+
export function sha256Hex(buffer) {
|
|
16
|
+
return 'sha256:' + createHash('sha256').update(buffer).digest('hex');
|
|
17
|
+
}
|
|
18
|
+
/** Parses a checksums.json body into a plain name→digest map. Throws on any other shape. */
|
|
19
|
+
export function parseChecksums(text) {
|
|
20
|
+
const data = JSON.parse(text);
|
|
21
|
+
if (typeof data !== 'object' || data === null || Array.isArray(data)) {
|
|
22
|
+
throw new Error('checksums.json did not parse to an object');
|
|
23
|
+
}
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Throws unless `buffer`'s digest matches `checksums[assetName]`. A missing entry
|
|
28
|
+
* fails the same as a mismatch — an asset absent from the manifest is exactly as
|
|
29
|
+
* unverifiable as one that fails it, and treating it as "nothing to check" would
|
|
30
|
+
* make the whole guard optional for any release that forgot to list an asset.
|
|
31
|
+
*/
|
|
32
|
+
export function verifyChecksum(buffer, checksums, assetName) {
|
|
33
|
+
const expected = checksums[assetName];
|
|
34
|
+
const actual = sha256Hex(buffer);
|
|
35
|
+
if (!expected) {
|
|
36
|
+
throw new Error(`checksums.json has no entry for ${assetName} — refusing to install an unverified binary.`);
|
|
37
|
+
}
|
|
38
|
+
if (actual !== expected) {
|
|
39
|
+
throw new Error(`Checksum mismatch for ${assetName}:\n` +
|
|
40
|
+
` expected: ${expected}\n` +
|
|
41
|
+
` actual: ${actual}\n` +
|
|
42
|
+
`This could mean a corrupted download or a tampered release asset — refusing to install it. Do not retry blindly.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=binaryChecksum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binaryChecksum.js","sourceRoot":"","sources":["../../src/lib/binaryChecksum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,sFAAsF;AACtF,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,OAAO,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACtE,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,IAAI,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACtC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;IAC9D,CAAC;IACD,OAAO,IAA8B,CAAA;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,SAAiC,EAAE,SAAiB;IACjG,MAAM,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,CAAA;IACrC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;IAChC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,mCAAmC,SAAS,8CAA8C,CAAC,CAAA;IAC7G,CAAC;IACD,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,yBAAyB,SAAS,KAAK;YACrC,eAAe,QAAQ,IAAI;YAC3B,eAAe,MAAM,IAAI;YACzB,kHAAkH,CACrH,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform "is this binary on PATH" check, without invoking the binary
|
|
3
|
+
* itself.
|
|
4
|
+
*
|
|
5
|
+
* Hoisted out of `sandbox/firecracker.ts` — originally a private helper
|
|
6
|
+
* there, checking for the `firecracker` binary — once a second external-tool
|
|
7
|
+
* integration (`ciscoScanner.ts`, the opt-in Cisco `skill-scanner`
|
|
8
|
+
* integration, Phase S3) needed the identical check. A shared, single
|
|
9
|
+
* implementation here, rather than a second copy that could quietly drift
|
|
10
|
+
* from the first (different shell quoting, different exit-code handling).
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Resolves `true` iff `bin` is found on PATH.
|
|
16
|
+
*
|
|
17
|
+
* Uses `command -v`, a POSIX shell builtin, via `sh -c` rather than spawning
|
|
18
|
+
* `bin` itself with `--version` or similar — a lookup-only check must never
|
|
19
|
+
* actually execute the tool being probed. `bin` is expected to be a fixed,
|
|
20
|
+
* code-controlled binary name (`firecracker`, `skill-scanner`), never
|
|
21
|
+
* user-supplied input threaded into this shell string.
|
|
22
|
+
*/
|
|
23
|
+
export declare function binaryOnPath(bin: string): Promise<boolean>;
|
|
24
|
+
//# sourceMappingURL=binaryOnPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binaryOnPath.d.ts","sourceRoot":"","sources":["../../src/lib/binaryOnPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAM1D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform "is this binary on PATH" check, without invoking the binary
|
|
3
|
+
* itself.
|
|
4
|
+
*
|
|
5
|
+
* Hoisted out of `sandbox/firecracker.ts` — originally a private helper
|
|
6
|
+
* there, checking for the `firecracker` binary — once a second external-tool
|
|
7
|
+
* integration (`ciscoScanner.ts`, the opt-in Cisco `skill-scanner`
|
|
8
|
+
* integration, Phase S3) needed the identical check. A shared, single
|
|
9
|
+
* implementation here, rather than a second copy that could quietly drift
|
|
10
|
+
* from the first (different shell quoting, different exit-code handling).
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import { spawn } from 'node:child_process';
|
|
15
|
+
/**
|
|
16
|
+
* Resolves `true` iff `bin` is found on PATH.
|
|
17
|
+
*
|
|
18
|
+
* Uses `command -v`, a POSIX shell builtin, via `sh -c` rather than spawning
|
|
19
|
+
* `bin` itself with `--version` or similar — a lookup-only check must never
|
|
20
|
+
* actually execute the tool being probed. `bin` is expected to be a fixed,
|
|
21
|
+
* code-controlled binary name (`firecracker`, `skill-scanner`), never
|
|
22
|
+
* user-supplied input threaded into this shell string.
|
|
23
|
+
*/
|
|
24
|
+
export function binaryOnPath(bin) {
|
|
25
|
+
return new Promise((resolve) => {
|
|
26
|
+
const child = spawn('sh', ['-c', `command -v ${bin}`], { stdio: 'ignore' });
|
|
27
|
+
child.on('error', () => resolve(false));
|
|
28
|
+
child.on('exit', (code) => resolve(code === 0));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=binaryOnPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binaryOnPath.js","sourceRoot":"","sources":["../../src/lib/binaryOnPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,cAAc,GAAG,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;QAC3E,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;QACvC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OS trust-store injection for the Intutic proxy CA certificate.
|
|
3
|
+
*
|
|
4
|
+
* Two trust scopes:
|
|
5
|
+
* - `'user'` — per-user, non-elevated. Already shipping today via
|
|
6
|
+
* `commands/connect.ts` (macOS login keychain, Windows `certutil`), run
|
|
7
|
+
* silently on every `intutic connect`.
|
|
8
|
+
* - `'system'` — machine-wide, requires root/admin. New here — this is the
|
|
9
|
+
* half `enterprise install` (`commands/enterprise.ts`) needs and the
|
|
10
|
+
* deleted `enterprise-install.ts` (commit `8481b5d9`) used to provide.
|
|
11
|
+
*
|
|
12
|
+
* `caTrustCommandFor` is exported specifically so `doctor.ts`'s remediation
|
|
13
|
+
* strings can be generated from the same source as what actually runs here,
|
|
14
|
+
* rather than hand-duplicated — which is exactly how they already drifted
|
|
15
|
+
* once (the check there looks in three Linux cert-anchor directories; the
|
|
16
|
+
* remediation only ever names one).
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
export type TrustScope = 'user' | 'system';
|
|
21
|
+
export interface CaTrustCommand {
|
|
22
|
+
/** A short label for what this step does, used in logs. */
|
|
23
|
+
step: string;
|
|
24
|
+
cmd: string;
|
|
25
|
+
args: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface CaTrustResult {
|
|
28
|
+
installed: boolean;
|
|
29
|
+
scope: TrustScope;
|
|
30
|
+
/** e.g. 'security', 'update-ca-certificates', 'update-ca-trust', 'certutil'. */
|
|
31
|
+
mechanism: string;
|
|
32
|
+
detail: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The command(s) that trust `caCertPath` at the given scope, for the given
|
|
36
|
+
* platform. Pure — no I/O — so it doubles as the source of truth for
|
|
37
|
+
* `doctor.ts`'s remediation text.
|
|
38
|
+
*
|
|
39
|
+
* Linux `'user'` scope returns `null`: there is no single per-user NSS/OS
|
|
40
|
+
* trust-store equivalent worth building (each browser/runtime keeps its
|
|
41
|
+
* own), unlike macOS (login keychain) and Windows (`certutil`, which is
|
|
42
|
+
* elevation-agnostic — the same command works either way).
|
|
43
|
+
*
|
|
44
|
+
* Linux returns TWO commands (copy, then update) rather than one, since
|
|
45
|
+
* `execFile` can't run a shell pipeline — callers must run both in order.
|
|
46
|
+
*/
|
|
47
|
+
export declare function caTrustCommandFor(platform: NodeJS.Platform, scope: TrustScope, caCertPath: string): CaTrustCommand[] | null;
|
|
48
|
+
/**
|
|
49
|
+
* Installs `caCertPath` into the OS trust store at `scope`.
|
|
50
|
+
*
|
|
51
|
+
* Uses `execFile` with array arguments throughout — never `execSync` with
|
|
52
|
+
* string interpolation, which `connect.ts`'s existing per-user calls use and
|
|
53
|
+
* which is unsafe if a path ever contained a shell metacharacter. Does not
|
|
54
|
+
* throw on a failed underlying command; surfaces it as `installed: false`
|
|
55
|
+
* with the OS error text in `detail`, so a caller (e.g. `enterprise install`)
|
|
56
|
+
* can report it and continue rather than crashing the whole run over one
|
|
57
|
+
* platform-specific step.
|
|
58
|
+
*/
|
|
59
|
+
export declare function installCaTrust(caCertPath: string, scope: TrustScope): Promise<CaTrustResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Best-effort check for whether `caCertPath` is already trusted — read-only,
|
|
62
|
+
* never installs anything. Used to skip a redundant (and log-noisy)
|
|
63
|
+
* re-install. Only implemented where a cheap, real check exists (macOS
|
|
64
|
+
* `security verify-cert`); returns `false` elsewhere rather than guessing,
|
|
65
|
+
* so a caller falls through to attempting installation, which is itself
|
|
66
|
+
* idempotent.
|
|
67
|
+
*/
|
|
68
|
+
export declare function verifyCaTrust(caCertPath: string): Promise<boolean>;
|
|
69
|
+
//# sourceMappingURL=caTrust.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caTrust.d.ts","sourceRoot":"","sources":["../../src/lib/caTrust.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAQH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAA;AAE1C,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,UAAU,CAAA;IACjB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;CACf;AAKD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,MAAM,GACjB,cAAc,EAAE,GAAG,IAAI,CA8BzB;AAkCD;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CA8BlG;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBxE"}
|