@intutic/cli 1.9.0 → 1.10.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 +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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** The complete local verdict vocabulary — see this file's module doc. */
|
|
2
|
+
export declare const LOCAL_VERDICTS: readonly ["allowed", "killed", "upstream_error", "reasked", "hijacked"];
|
|
3
|
+
export type LocalVerdict = (typeof LOCAL_VERDICTS)[number];
|
|
4
|
+
/**
|
|
5
|
+
* A trace row read from the local JSONL log, narrowed to what the `list`
|
|
6
|
+
* table and `--json` output actually use. Field names are camelCase here —
|
|
7
|
+
* the on-disk JSONL is the proxy's own snake_case `ExecutionTrace` — this
|
|
8
|
+
* module is the one place that translates between them.
|
|
9
|
+
*/
|
|
10
|
+
export interface LocalTraceRow {
|
|
11
|
+
traceId: string;
|
|
12
|
+
timestamp: string;
|
|
13
|
+
requestedModel: string;
|
|
14
|
+
actualModelRouted: string;
|
|
15
|
+
verdict: string;
|
|
16
|
+
rawCostUsd: number;
|
|
17
|
+
actualCostUsd: number;
|
|
18
|
+
harnessType: string;
|
|
19
|
+
latencyMs: number;
|
|
20
|
+
cacheHit: boolean;
|
|
21
|
+
breakGlass: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface LocalTracesResult {
|
|
24
|
+
traces: LocalTraceRow[];
|
|
25
|
+
/** Every trace found within the window, before `limit` truncation — not a fabricated estimate. */
|
|
26
|
+
total: number;
|
|
27
|
+
/** Lines that failed to parse or were missing a required field — counted, not silenced. */
|
|
28
|
+
malformedLines: number;
|
|
29
|
+
/**
|
|
30
|
+
* Day-files that had already reached the proxy's 64MB write cap
|
|
31
|
+
* (`MAX_TRACE_LOG_BYTES`, `local_spend.rs`) at read time. Writes past
|
|
32
|
+
* that size are silently dropped by the proxy, so a capped day's trace
|
|
33
|
+
* count is a floor, not a complete record — this is the only place a
|
|
34
|
+
* user can learn that.
|
|
35
|
+
*/
|
|
36
|
+
cappedFiles: string[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Reads every trace in `[since, now]` from the local daily-sharded log,
|
|
40
|
+
* walking day-files newest-first and, within each file, lines newest-first
|
|
41
|
+
* (append-only, so the last line of a day is that day's most recent trace).
|
|
42
|
+
* Stops scanning a file (and every earlier file) as soon as a line's
|
|
43
|
+
* timestamp falls before `since` — traces only get older from there.
|
|
44
|
+
*/
|
|
45
|
+
export declare function readLocalTraces(opts: {
|
|
46
|
+
logsDir: string;
|
|
47
|
+
since: Date;
|
|
48
|
+
limit: number;
|
|
49
|
+
/** Exact match against LocalTraceRow.verdict, applied before `limit`. */
|
|
50
|
+
verdict?: string;
|
|
51
|
+
/** Exact match against LocalTraceRow.requestedModel, applied before `limit`. */
|
|
52
|
+
model?: string;
|
|
53
|
+
}): Promise<LocalTracesResult>;
|
|
54
|
+
/**
|
|
55
|
+
* Finds one trace by id across every local day-file, newest day first, and
|
|
56
|
+
* returns its RAW parsed JSON (not narrowed to `LocalTraceRow`) — `inspect`
|
|
57
|
+
* shows everything the proxy recorded, not just the list-table's columns.
|
|
58
|
+
* Returns `null` if no day-file has a matching `trace_id`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function findLocalTraceById(logsDir: string, traceId: string): Promise<Record<string, unknown> | null>;
|
|
61
|
+
//# sourceMappingURL=localTraces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localTraces.d.ts","sourceRoot":"","sources":["../../src/lib/localTraces.ts"],"names":[],"mappings":"AA8BA,0EAA0E;AAC1E,eAAO,MAAM,cAAc,yEAA0E,CAAA;AACrG,MAAM,MAAM,YAA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` used to require a connected control plane
|
|
5
|
+
* and exit(1) with no fallback, even though the proxy has been writing every
|
|
6
|
+
* trace to `~/.intutic/logs/traces-YYYY-MM-DD.jsonl` all along (see
|
|
7
|
+
* `packages/proxy/src/local_spend.rs`'s `log_offline_trace`). This is the
|
|
8
|
+
* reader for that log — the only place a standalone user can see their own
|
|
9
|
+
* traffic without a control plane.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately its own narrow type (`LocalTraceRow`), not `TraceSummary`
|
|
12
|
+
* (`@intutic/shared-types`): that type's `complianceScore` is a required,
|
|
13
|
+
* non-optional field, and there is no compliance score locally — a
|
|
14
|
+
* standalone proxy's `response_integrity` is documented as explicitly not a
|
|
15
|
+
* quality or compliance measure. Reusing `TraceSummary` here would force
|
|
16
|
+
* either a fabricated score or a type-level lie; a narrower type that
|
|
17
|
+
* doesn't have the field at all is the honest option.
|
|
18
|
+
*
|
|
19
|
+
* The verdict vocabulary is also narrower than connected mode's
|
|
20
|
+
* BYPASS/ENHANCE/HIJACK/KILL (a control-plane PCAS concept). Locally,
|
|
21
|
+
* `ExecutionTrace.verdict` is exactly one of: allowed, killed,
|
|
22
|
+
* upstream_error, reasked, hijacked — see LOCAL_VERDICTS below, kept in
|
|
23
|
+
* sync with `telemetry.rs`'s construction sites by
|
|
24
|
+
* `localTracesFieldParity.test.ts`.
|
|
25
|
+
*/
|
|
26
|
+
import { readdir, stat } from 'node:fs/promises';
|
|
27
|
+
import { createReadStream, existsSync } from 'node:fs';
|
|
28
|
+
import { createInterface } from 'node:readline';
|
|
29
|
+
import { join } from 'node:path';
|
|
30
|
+
/** The complete local verdict vocabulary — see this file's module doc. */
|
|
31
|
+
export const LOCAL_VERDICTS = ['allowed', 'killed', 'upstream_error', 'reasked', 'hijacked'];
|
|
32
|
+
/** Matches the proxy's own filename shape from `log_offline_trace`. */
|
|
33
|
+
const TRACE_FILE_RE = /^traces-(\d{4}-\d{2}-\d{2})\.jsonl$/;
|
|
34
|
+
/** `local_spend.rs`'s `MAX_TRACE_LOG_BYTES` — kept in sync by localTracesFieldParity.test.ts. */
|
|
35
|
+
const MAX_TRACE_LOG_BYTES = 64 * 1024 * 1024;
|
|
36
|
+
function toLocalTraceRow(raw) {
|
|
37
|
+
if (typeof raw.trace_id !== 'string' ||
|
|
38
|
+
typeof raw.created_at !== 'string' ||
|
|
39
|
+
typeof raw.requested_model !== 'string' ||
|
|
40
|
+
typeof raw.actual_model_routed !== 'string' ||
|
|
41
|
+
typeof raw.verdict !== 'string') {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
traceId: raw.trace_id,
|
|
46
|
+
timestamp: raw.created_at,
|
|
47
|
+
requestedModel: raw.requested_model,
|
|
48
|
+
actualModelRouted: raw.actual_model_routed,
|
|
49
|
+
verdict: raw.verdict,
|
|
50
|
+
rawCostUsd: typeof raw.raw_cost_usd === 'number' ? raw.raw_cost_usd : 0,
|
|
51
|
+
actualCostUsd: typeof raw.actual_cost_usd === 'number' ? raw.actual_cost_usd : 0,
|
|
52
|
+
harnessType: typeof raw.harness_type === 'string' ? raw.harness_type : 'unknown',
|
|
53
|
+
latencyMs: typeof raw.latency_ms === 'number' ? raw.latency_ms : 0,
|
|
54
|
+
cacheHit: raw.cache_hit === true,
|
|
55
|
+
breakGlass: raw.break_glass === true,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** Day-shard filenames under `logsDir`, most recent day first. */
|
|
59
|
+
async function dayFilesDescending(logsDir) {
|
|
60
|
+
if (!existsSync(logsDir))
|
|
61
|
+
return [];
|
|
62
|
+
const entries = await readdir(logsDir);
|
|
63
|
+
return entries
|
|
64
|
+
.filter((name) => TRACE_FILE_RE.test(name))
|
|
65
|
+
.sort()
|
|
66
|
+
.reverse();
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Reads every trace in `[since, now]` from the local daily-sharded log,
|
|
70
|
+
* walking day-files newest-first and, within each file, lines newest-first
|
|
71
|
+
* (append-only, so the last line of a day is that day's most recent trace).
|
|
72
|
+
* Stops scanning a file (and every earlier file) as soon as a line's
|
|
73
|
+
* timestamp falls before `since` — traces only get older from there.
|
|
74
|
+
*/
|
|
75
|
+
export async function readLocalTraces(opts) {
|
|
76
|
+
const { logsDir, since, limit, verdict, model } = opts;
|
|
77
|
+
const files = await dayFilesDescending(logsDir);
|
|
78
|
+
const collected = [];
|
|
79
|
+
let malformedLines = 0;
|
|
80
|
+
const cappedFiles = [];
|
|
81
|
+
for (const file of files) {
|
|
82
|
+
const path = join(logsDir, file);
|
|
83
|
+
try {
|
|
84
|
+
const { size } = await stat(path);
|
|
85
|
+
if (size >= MAX_TRACE_LOG_BYTES)
|
|
86
|
+
cappedFiles.push(file);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const lines = [];
|
|
92
|
+
const rl = createInterface({ input: createReadStream(path, 'utf-8'), crlfDelay: Infinity });
|
|
93
|
+
for await (const line of rl) {
|
|
94
|
+
if (line.trim().length > 0)
|
|
95
|
+
lines.push(line);
|
|
96
|
+
}
|
|
97
|
+
let dayExhausted = false;
|
|
98
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
99
|
+
let parsed;
|
|
100
|
+
try {
|
|
101
|
+
parsed = JSON.parse(lines[i]);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
malformedLines++;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (typeof parsed !== 'object' || parsed === null) {
|
|
108
|
+
malformedLines++;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const row = toLocalTraceRow(parsed);
|
|
112
|
+
if (!row) {
|
|
113
|
+
malformedLines++;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const ts = new Date(row.timestamp);
|
|
117
|
+
if (Number.isNaN(ts.getTime())) {
|
|
118
|
+
malformedLines++;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (ts < since) {
|
|
122
|
+
// Lines before this one in the file, and every earlier day-file,
|
|
123
|
+
// are only older — nothing left in the window.
|
|
124
|
+
dayExhausted = true;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
if (verdict !== undefined && row.verdict !== verdict)
|
|
128
|
+
continue;
|
|
129
|
+
if (model !== undefined && row.requestedModel !== model)
|
|
130
|
+
continue;
|
|
131
|
+
collected.push(row);
|
|
132
|
+
}
|
|
133
|
+
if (dayExhausted)
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
// Newest-first overall — collected is already in that order per file, and
|
|
137
|
+
// files were walked newest-day-first, so no re-sort is needed.
|
|
138
|
+
return {
|
|
139
|
+
traces: collected.slice(0, limit),
|
|
140
|
+
total: collected.length,
|
|
141
|
+
malformedLines,
|
|
142
|
+
cappedFiles,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Finds one trace by id across every local day-file, newest day first, and
|
|
147
|
+
* returns its RAW parsed JSON (not narrowed to `LocalTraceRow`) — `inspect`
|
|
148
|
+
* shows everything the proxy recorded, not just the list-table's columns.
|
|
149
|
+
* Returns `null` if no day-file has a matching `trace_id`.
|
|
150
|
+
*/
|
|
151
|
+
export async function findLocalTraceById(logsDir, traceId) {
|
|
152
|
+
const files = await dayFilesDescending(logsDir);
|
|
153
|
+
for (const file of files) {
|
|
154
|
+
const path = join(logsDir, file);
|
|
155
|
+
const rl = createInterface({ input: createReadStream(path, 'utf-8'), crlfDelay: Infinity });
|
|
156
|
+
for await (const line of rl) {
|
|
157
|
+
if (line.trim().length === 0)
|
|
158
|
+
continue;
|
|
159
|
+
try {
|
|
160
|
+
const parsed = JSON.parse(line);
|
|
161
|
+
if (parsed.trace_id === traceId) {
|
|
162
|
+
rl.close();
|
|
163
|
+
return parsed;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=localTraces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localTraces.js","sourceRoot":"","sources":["../../src/lib/localTraces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,CAAU,CAAA;AAuCrG,uEAAuE;AACvE,MAAM,aAAa,GAAG,qCAAqC,CAAA;AAE3D,iGAAiG;AACjG,MAAM,mBAAmB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AAE5C,SAAS,eAAe,CAAC,GAA4B;IACnD,IACE,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ;QAChC,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ;QAClC,OAAO,GAAG,CAAC,eAAe,KAAK,QAAQ;QACvC,OAAO,GAAG,CAAC,mBAAmB,KAAK,QAAQ;QAC3C,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAC/B,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,cAAc,EAAE,GAAG,CAAC,eAAe;QACnC,iBAAiB,EAAE,GAAG,CAAC,mBAAmB;QAC1C,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,UAAU,EAAE,OAAO,GA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E,CAAC,CAAA;QAC3F,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,EAAE,EAAE,CAAC;YAC5B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAQ;YACtC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAA4B,CAAA;gBAC1D,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;oBAChC,EAAE,CAAC,KAAK,EAAE,CAAA;oBACV,OAAO,MAAM,CAAA;gBACf,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,SAAQ;YACV,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MDM rollout artifact generators — CA-trust `.mobileconfig` and the
|
|
3
|
+
* Cursor system-hooks manifests handed to Jamf/Intune.
|
|
4
|
+
*
|
|
5
|
+
* Pure `params -> string` generators, same shape as
|
|
6
|
+
* `apps/dashboard/src/lib/gatewayManifest.ts` — no I/O here. `enterprise.ts`
|
|
7
|
+
* (`commands/enterprise.ts`) reads `~/.intutic/ca.crt` and calls these.
|
|
8
|
+
*
|
|
9
|
+
* Fixes over both the deleted `enterprise-install.ts` and the three static
|
|
10
|
+
* files that used to be checked into `resources/mdm/`: the `.mobileconfig`
|
|
11
|
+
* now actually embeds the CA certificate bytes (the old payload had no
|
|
12
|
+
* `PayloadContent` data key at all, so profiles installed but trusted
|
|
13
|
+
* nothing), UUIDs are fresh per call instead of baked in from one past
|
|
14
|
+
* invocation, and the non-functional `com.apple.proxy.http` payload is
|
|
15
|
+
* dropped rather than shipped as if it did something on an unsupervised
|
|
16
|
+
* device.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* A PEM certificate's body IS base64(DER) — stripping the armor lines and
|
|
22
|
+
* whitespace is the entire transform, no decode/re-encode required.
|
|
23
|
+
*/
|
|
24
|
+
export declare function pemToBase64Der(pem: string): string;
|
|
25
|
+
export interface MobileconfigParams {
|
|
26
|
+
/** PEM-armored CA certificate, e.g. read from `~/.intutic/ca.crt`. */
|
|
27
|
+
caCertPem: string;
|
|
28
|
+
/** Optional label folded into the payload display names — XML-escaped. */
|
|
29
|
+
workspaceName?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* CA-trust-only configuration profile. Deliberately does not include an
|
|
33
|
+
* `com.apple.proxy.http` payload — that mechanism only takes effect on a
|
|
34
|
+
* supervised device, so shipping it as if it configures the system proxy on
|
|
35
|
+
* an ordinary Mac would be silently misleading.
|
|
36
|
+
*/
|
|
37
|
+
export declare function generateMobileconfig(params: MobileconfigParams): string;
|
|
38
|
+
export interface HooksManifestParams {
|
|
39
|
+
/** Absolute path to the governance hook script on the TARGET machine, e.g. `/opt/intutic/hooks/cursor-check.js`. */
|
|
40
|
+
hookScriptPath: string;
|
|
41
|
+
/** Where the MDM tool should place the generated hooks.json. Defaults to the real system-hooks path for `platform` — see `systemHooksDirFor`. */
|
|
42
|
+
targetPath?: string;
|
|
43
|
+
/** Platform the default `targetPath` is resolved for. Defaults to this process's own platform. */
|
|
44
|
+
platform?: NodeJS.Platform;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Jamf-flavored deployment manifest wrapping the real `buildHooksConfig()`
|
|
48
|
+
* shape — not a hand-retyped literal, which is exactly how the deleted
|
|
49
|
+
* version drifted (it named `pre-tool-check.js`; the real script this repo
|
|
50
|
+
* writes is `cursor-check.js`).
|
|
51
|
+
*/
|
|
52
|
+
export declare function generateJamfManifest(params: HooksManifestParams): string;
|
|
53
|
+
/** Same content as {@link generateJamfManifest}, Intune-flavored deployment notes. */
|
|
54
|
+
export declare function generateIntuneManifest(params: HooksManifestParams): string;
|
|
55
|
+
export interface FirewallDeploymentParams {
|
|
56
|
+
/** Absolute path to the intutic CLI binary on the TARGET machine, e.g. `/usr/local/bin/intutic`. */
|
|
57
|
+
cliBinaryPath: string;
|
|
58
|
+
/** Optional label folded into descriptions. */
|
|
59
|
+
workspaceName?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Jamf-flavored managed-script deployment manifest for the egress firewall.
|
|
63
|
+
* Wraps `intutic enforce apply` as a recurring managed script — recurrence is
|
|
64
|
+
* what survives a local `intutic enforce remove`, not a static rules file.
|
|
65
|
+
* Deliberately does NOT embed generated pf/nftables/iptables rule content:
|
|
66
|
+
* the target machine's own `enforce apply` generates platform-correct rules
|
|
67
|
+
* at run time (see firewall.rs) — a snapshot here would drift exactly like
|
|
68
|
+
* the hand-retyped hooks.json this module already fixed once (see header).
|
|
69
|
+
*/
|
|
70
|
+
export declare function generateJamfFirewallManifest(params: FirewallDeploymentParams): string;
|
|
71
|
+
/** Same content as {@link generateJamfFirewallManifest}, Intune-flavored deployment notes. */
|
|
72
|
+
export declare function generateIntuneFirewallManifest(params: FirewallDeploymentParams): string;
|
|
73
|
+
//# sourceMappingURL=mdmManifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdmManifest.d.ts","sourceRoot":"","sources":["../../src/lib/mdmManifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAcH;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMlD;AAUD,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAA;IACjB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CA+CvE;AAED,MAAM,WAAW,mBAAmB;IAClC,oHAAoH;IACpH,cAAc,EAAE,MAAM,CAAA;IACtB,iJAAiJ;IACjJ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kGAAkG;IAClG,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAA;CAC3B;AAOD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAcxE;AAED,sFAAsF;AACtF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAc1E;AAED,MAAM,WAAW,wBAAwB;IACvC,oGAAoG;IACpG,aAAa,EAAE,MAAM,CAAA;IACrB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAqBD;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,wBAAwB,GAAG,MAAM,CAkBrF;AAED,8FAA8F;AAC9F,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,wBAAwB,GAAG,MAAM,CAmBvF"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MDM rollout artifact generators — CA-trust `.mobileconfig` and the
|
|
3
|
+
* Cursor system-hooks manifests handed to Jamf/Intune.
|
|
4
|
+
*
|
|
5
|
+
* Pure `params -> string` generators, same shape as
|
|
6
|
+
* `apps/dashboard/src/lib/gatewayManifest.ts` — no I/O here. `enterprise.ts`
|
|
7
|
+
* (`commands/enterprise.ts`) reads `~/.intutic/ca.crt` and calls these.
|
|
8
|
+
*
|
|
9
|
+
* Fixes over both the deleted `enterprise-install.ts` and the three static
|
|
10
|
+
* files that used to be checked into `resources/mdm/`: the `.mobileconfig`
|
|
11
|
+
* now actually embeds the CA certificate bytes (the old payload had no
|
|
12
|
+
* `PayloadContent` data key at all, so profiles installed but trusted
|
|
13
|
+
* nothing), UUIDs are fresh per call instead of baked in from one past
|
|
14
|
+
* invocation, and the non-functional `com.apple.proxy.http` payload is
|
|
15
|
+
* dropped rather than shipped as if it did something on an unsupervised
|
|
16
|
+
* device.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { randomUUID } from 'node:crypto';
|
|
21
|
+
import { buildHooksConfig, systemHooksDirFor } from '@intutic/sync-daemon/harness/cursorHooks';
|
|
22
|
+
function escapeXml(value) {
|
|
23
|
+
return value
|
|
24
|
+
.replace(/&/g, '&')
|
|
25
|
+
.replace(/</g, '<')
|
|
26
|
+
.replace(/>/g, '>')
|
|
27
|
+
.replace(/"/g, '"')
|
|
28
|
+
.replace(/'/g, ''');
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A PEM certificate's body IS base64(DER) — stripping the armor lines and
|
|
32
|
+
* whitespace is the entire transform, no decode/re-encode required.
|
|
33
|
+
*/
|
|
34
|
+
export function pemToBase64Der(pem) {
|
|
35
|
+
return pem
|
|
36
|
+
.split('\n')
|
|
37
|
+
.filter((line) => !line.startsWith('-----'))
|
|
38
|
+
.join('')
|
|
39
|
+
.replace(/\s+/g, '');
|
|
40
|
+
}
|
|
41
|
+
function wrapBase64(b64, lineLength = 76) {
|
|
42
|
+
const lines = [];
|
|
43
|
+
for (let i = 0; i < b64.length; i += lineLength) {
|
|
44
|
+
lines.push(b64.slice(i, i + lineLength));
|
|
45
|
+
}
|
|
46
|
+
return lines.join('\n');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* CA-trust-only configuration profile. Deliberately does not include an
|
|
50
|
+
* `com.apple.proxy.http` payload — that mechanism only takes effect on a
|
|
51
|
+
* supervised device, so shipping it as if it configures the system proxy on
|
|
52
|
+
* an ordinary Mac would be silently misleading.
|
|
53
|
+
*/
|
|
54
|
+
export function generateMobileconfig(params) {
|
|
55
|
+
const caPayloadUuid = randomUUID().toUpperCase();
|
|
56
|
+
const topLevelUuid = randomUUID().toUpperCase();
|
|
57
|
+
const derBase64 = wrapBase64(pemToBase64Der(params.caCertPem));
|
|
58
|
+
const suffix = params.workspaceName ? ` (${escapeXml(params.workspaceName)})` : '';
|
|
59
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
60
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
61
|
+
<!-- Intutic Governance Proxy CA Trust Profile -->
|
|
62
|
+
<!-- Deploy via Jamf, Apple Business Manager, or \`profiles install\` -->
|
|
63
|
+
<!-- Generated: ${new Date().toISOString()} -->
|
|
64
|
+
<plist version="1.0">
|
|
65
|
+
<dict>
|
|
66
|
+
<key>PayloadContent</key>
|
|
67
|
+
<array>
|
|
68
|
+
<dict>
|
|
69
|
+
<key>PayloadType</key>
|
|
70
|
+
<string>com.apple.security.root</string>
|
|
71
|
+
<key>PayloadIdentifier</key>
|
|
72
|
+
<string>ai.intutic.governance.ca</string>
|
|
73
|
+
<key>PayloadDisplayName</key>
|
|
74
|
+
<string>Intutic Governance Proxy CA${suffix}</string>
|
|
75
|
+
<key>PayloadDescription</key>
|
|
76
|
+
<string>Trusts the Intutic local CA for AI traffic governance</string>
|
|
77
|
+
<key>PayloadVersion</key>
|
|
78
|
+
<integer>1</integer>
|
|
79
|
+
<key>PayloadUUID</key>
|
|
80
|
+
<string>${caPayloadUuid}</string>
|
|
81
|
+
<key>PayloadContent</key>
|
|
82
|
+
<data>
|
|
83
|
+
${derBase64}
|
|
84
|
+
</data>
|
|
85
|
+
</dict>
|
|
86
|
+
</array>
|
|
87
|
+
<key>PayloadDisplayName</key>
|
|
88
|
+
<string>Intutic AI Governance Proxy Configuration${suffix}</string>
|
|
89
|
+
<key>PayloadIdentifier</key>
|
|
90
|
+
<string>ai.intutic.governance</string>
|
|
91
|
+
<key>PayloadType</key>
|
|
92
|
+
<string>Configuration</string>
|
|
93
|
+
<key>PayloadVersion</key>
|
|
94
|
+
<integer>1</integer>
|
|
95
|
+
<key>PayloadUUID</key>
|
|
96
|
+
<string>${topLevelUuid}</string>
|
|
97
|
+
</dict>
|
|
98
|
+
</plist>
|
|
99
|
+
`;
|
|
100
|
+
}
|
|
101
|
+
function resolveTargetPath(params) {
|
|
102
|
+
if (params.targetPath)
|
|
103
|
+
return params.targetPath;
|
|
104
|
+
return `${systemHooksDirFor(params.platform ?? process.platform)}/hooks.json`;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Jamf-flavored deployment manifest wrapping the real `buildHooksConfig()`
|
|
108
|
+
* shape — not a hand-retyped literal, which is exactly how the deleted
|
|
109
|
+
* version drifted (it named `pre-tool-check.js`; the real script this repo
|
|
110
|
+
* writes is `cursor-check.js`).
|
|
111
|
+
*/
|
|
112
|
+
export function generateJamfManifest(params) {
|
|
113
|
+
return JSON.stringify({
|
|
114
|
+
_comment: 'Intutic Governance — Cursor system-level hooks.json for Jamf deployment',
|
|
115
|
+
_generated: new Date().toISOString(),
|
|
116
|
+
target_path: resolveTargetPath(params),
|
|
117
|
+
content: buildHooksConfig(params.hookScriptPath),
|
|
118
|
+
deployment: {
|
|
119
|
+
jamf: 'Deploy via Configuration Profile > Files & Processes (custom script), writing `content` to target_path.',
|
|
120
|
+
},
|
|
121
|
+
}, null, 2) + '\n';
|
|
122
|
+
}
|
|
123
|
+
/** Same content as {@link generateJamfManifest}, Intune-flavored deployment notes. */
|
|
124
|
+
export function generateIntuneManifest(params) {
|
|
125
|
+
return JSON.stringify({
|
|
126
|
+
_comment: 'Intutic Governance — Cursor system-level hooks.json for Intune deployment',
|
|
127
|
+
_generated: new Date().toISOString(),
|
|
128
|
+
target_path: resolveTargetPath(params),
|
|
129
|
+
content: buildHooksConfig(params.hookScriptPath),
|
|
130
|
+
deployment: {
|
|
131
|
+
intune: 'Deploy via a Custom Configuration Profile (macOS: Files) or a Win32 app install script, writing `content` to target_path.',
|
|
132
|
+
},
|
|
133
|
+
}, null, 2) + '\n';
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Shared body for the two firewall-deployment manifests below — same
|
|
137
|
+
* `content`/`schedule`/`prerequisites`/`honesty` fields, only the
|
|
138
|
+
* `_comment` and `deployment` note differ per MDM flavor.
|
|
139
|
+
*/
|
|
140
|
+
function buildFirewallManifestBody(params) {
|
|
141
|
+
const suffix = params.workspaceName ? ` (${params.workspaceName})` : '';
|
|
142
|
+
return {
|
|
143
|
+
suffix,
|
|
144
|
+
content: `${params.cliBinaryPath} enforce apply`,
|
|
145
|
+
prerequisites: [
|
|
146
|
+
`intutic CLI installed at ${params.cliBinaryPath} on the target machine`,
|
|
147
|
+
'MDM agent executes the script with root (macOS/Linux) or administrator (Windows) privilege — `enforce apply` needs that to write firewall rules',
|
|
148
|
+
],
|
|
149
|
+
honesty: 'This re-asserts the firewall on the configured cadence; a user with root/administrator access can still run `intutic enforce remove` and stay unenforced until the next check-in. It is not tamper-proof, it is tamper-resistant on a schedule.',
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Jamf-flavored managed-script deployment manifest for the egress firewall.
|
|
154
|
+
* Wraps `intutic enforce apply` as a recurring managed script — recurrence is
|
|
155
|
+
* what survives a local `intutic enforce remove`, not a static rules file.
|
|
156
|
+
* Deliberately does NOT embed generated pf/nftables/iptables rule content:
|
|
157
|
+
* the target machine's own `enforce apply` generates platform-correct rules
|
|
158
|
+
* at run time (see firewall.rs) — a snapshot here would drift exactly like
|
|
159
|
+
* the hand-retyped hooks.json this module already fixed once (see header).
|
|
160
|
+
*/
|
|
161
|
+
export function generateJamfFirewallManifest(params) {
|
|
162
|
+
const body = buildFirewallManifestBody(params);
|
|
163
|
+
return JSON.stringify({
|
|
164
|
+
_comment: `Intutic Governance — egress firewall re-assertion for Jamf deployment${body.suffix}`,
|
|
165
|
+
_generated: new Date().toISOString(),
|
|
166
|
+
content: body.content,
|
|
167
|
+
schedule: "Every 15 minutes via a Jamf policy with a Recurring Check-in trigger (or a Custom Trigger fired by a launchd job at the desired interval). Frequent re-assertion is the point — it's what survives a local `intutic enforce remove` between runs.",
|
|
168
|
+
prerequisites: body.prerequisites,
|
|
169
|
+
deployment: {
|
|
170
|
+
jamf: 'Deploy via Configuration Profile > Files & Processes, or a Jamf Policy with a Script payload and a recurring trigger (recommend \'Recurring Check-in\' or a Custom Trigger fired by a launchd job at the desired interval).',
|
|
171
|
+
},
|
|
172
|
+
honesty: body.honesty,
|
|
173
|
+
}, null, 2) + '\n';
|
|
174
|
+
}
|
|
175
|
+
/** Same content as {@link generateJamfFirewallManifest}, Intune-flavored deployment notes. */
|
|
176
|
+
export function generateIntuneFirewallManifest(params) {
|
|
177
|
+
const body = buildFirewallManifestBody(params);
|
|
178
|
+
return JSON.stringify({
|
|
179
|
+
_comment: `Intutic Governance — egress firewall re-assertion for Intune deployment${body.suffix}`,
|
|
180
|
+
_generated: new Date().toISOString(),
|
|
181
|
+
content: body.content,
|
|
182
|
+
schedule: 'Daily platform script schedule, or trigger-on-checkin if the Intune script policy configuration supports it. Daily is the practical floor for a scripted policy run; tighten it if the Intune tenant supports more frequent check-ins.',
|
|
183
|
+
prerequisites: body.prerequisites,
|
|
184
|
+
deployment: {
|
|
185
|
+
intune: "Deploy via a macOS Shell script (Devices > Scripts) with 'Run script using signed-in credentials' as needed for root context, and a policy schedule; on Windows this would need an equivalent scheduled task — note this manifest's shell command is macOS/Linux-oriented since `enforce apply` is a Rust CLI subcommand available cross-platform but the recurring-execution mechanism differs by OS, and Windows Task Scheduler wiring is left to the operator.",
|
|
186
|
+
},
|
|
187
|
+
honesty: body.honesty,
|
|
188
|
+
}, null, 2) + '\n';
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=mdmManifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdmManifest.js","sourceRoot":"","sources":["../../src/lib/mdmManifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAA;AAE9F,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK;SACT,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V,MAAM,EACJ,mcAAmc;SACtc;QACD,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,EACD,IAAI,EACJ,CAAC,CACF,GAAG,IAAI,CAAA;AACV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../src/lib/onboarding.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../src/lib/onboarding.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAyCH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,IAAI,CA2NvG"}
|
package/dist/lib/onboarding.js
CHANGED
|
@@ -20,6 +20,18 @@ function maskUserToken(tokenVal) {
|
|
|
20
20
|
return '<YOUR_INTUTIC_API_KEY>';
|
|
21
21
|
return `${tokenVal.substring(0, 4)}...${tokenVal.substring(tokenVal.length - 4)}`;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Trims trailing `/` characters without a regex — see the identical helper
|
|
25
|
+
* in `commands/exec.ts` for why: `/\/+$/` is flagged by static analysis as a
|
|
26
|
+
* polynomial-time pattern on external input, and a loop sidesteps the whole
|
|
27
|
+
* category rather than needing an exemption.
|
|
28
|
+
*/
|
|
29
|
+
function trimTrailingSlashes(s) {
|
|
30
|
+
let end = s.length;
|
|
31
|
+
while (end > 0 && s.charCodeAt(end - 1) === 47 /* '/' */)
|
|
32
|
+
end--;
|
|
33
|
+
return s.slice(0, end);
|
|
34
|
+
}
|
|
23
35
|
function writeCliOutput(line) {
|
|
24
36
|
process.stdout.write(line + '\n');
|
|
25
37
|
}
|
|
@@ -36,7 +48,7 @@ export function printOnboardingGuide(harnesses, userAuthToken, devMode = false)
|
|
|
36
48
|
// send their agent traffic somewhere other than the proxy they had just
|
|
37
49
|
// started. Set INTUTIC_PROXY_URL to override.
|
|
38
50
|
void devMode;
|
|
39
|
-
const proxyHost = (process.env.INTUTIC_PROXY_URL ?? 'http://localhost:4000')
|
|
51
|
+
const proxyHost = trimTrailingSlashes(process.env.INTUTIC_PROXY_URL ?? 'http://localhost:4000');
|
|
40
52
|
const proxyUrl = `${proxyHost}/v1`;
|
|
41
53
|
writeCliOutput('');
|
|
42
54
|
log.header('Intutic — Setup & Integration Instructions');
|
|
@@ -169,6 +181,53 @@ export function printOnboardingGuide(harnesses, userAuthToken, devMode = false)
|
|
|
169
181
|
case 'windsurf':
|
|
170
182
|
writeCliOutput(` Set the custom API base URL and key in the Windsurf settings tab.`);
|
|
171
183
|
break;
|
|
184
|
+
case 'dsh':
|
|
185
|
+
writeCliOutput(` Every sync registers the Intutic gate into each EXISTING dsh profile`);
|
|
186
|
+
writeCliOutput(` (${pc.bold('cordis.patch.yml')} + the ${pc.bold('@intutic/gate')} package.json dependency) and`);
|
|
187
|
+
writeCliOutput(` redirects both the llm-deepseek (default) and llm-pi-ai (selectable) LLM`);
|
|
188
|
+
writeCliOutput(` routes in ${pc.bold('settings.yaml')} through the Intutic proxy — no manual config edit.`);
|
|
189
|
+
writeCliOutput(` `);
|
|
190
|
+
writeCliOutput(` One manual step remains, PER PROFILE: this daemon cannot run a package`);
|
|
191
|
+
writeCliOutput(` manager in a directory it does not own, so finish activation with:`);
|
|
192
|
+
writeCliOutput(` ${pc.bold('dsh plugin --profile <name> add @intutic/gate')}`);
|
|
193
|
+
writeCliOutput(` See ${pc.cyan('$DSH_HOME/INSTALL.md')} (auto-generated, lists your current profiles).`);
|
|
194
|
+
writeCliOutput(` `);
|
|
195
|
+
writeCliOutput(` Nothing is governed until your FIRST \`dsh --profile <name>\` run creates a`);
|
|
196
|
+
writeCliOutput(` profile to register into.`);
|
|
197
|
+
break;
|
|
198
|
+
case 'xirp':
|
|
199
|
+
// Xirp is not itself an AI agent and writes no config of its own —
|
|
200
|
+
// see gateRegistry.ts's NO_GATE row. The generic `intutic exec`
|
|
201
|
+
// wrapper below does not apply (Xirp is a GUI .app you launch
|
|
202
|
+
// normally, not a CLI you'd wrap), so this replaces the default
|
|
203
|
+
// fallback rather than falling through to it.
|
|
204
|
+
writeCliOutput(` Xirp orchestrates other harnesses (Claude Code, Codex, ...) — connect`);
|
|
205
|
+
writeCliOutput(` THAT harness normally, against the repo's main checkout. Intutic's sync`);
|
|
206
|
+
writeCliOutput(` daemon automatically propagates that harness's own gate/config into every`);
|
|
207
|
+
writeCliOutput(` git worktree Xirp creates, every sync cycle — no separate Xirp setup step.`);
|
|
208
|
+
writeCliOutput(` See: ${pc.cyan('apps/docs/integrations/xirp.md')}`);
|
|
209
|
+
break;
|
|
210
|
+
case 'opencode':
|
|
211
|
+
// The plugin is the gate; the only thing OpenCode cannot pick up from
|
|
212
|
+
// Intutic's files is where its model traffic goes.
|
|
213
|
+
writeCliOutput(` OpenCode loads ${pc.cyan('.opencode/plugins/intutic-governance.js')} on its next start —`);
|
|
214
|
+
writeCliOutput(` every tool call is checked before it runs. To route model traffic through`);
|
|
215
|
+
writeCliOutput(` the proxy, set your provider's base URL in ${pc.cyan('opencode.json')}:`);
|
|
216
|
+
writeCliOutput(` "provider": { "<id>": { "options": { "baseURL": "${proxyUrl}" } } }`);
|
|
217
|
+
writeCliOutput(` (or the same JSON in ${pc.cyan('OPENCODE_CONFIG_CONTENT')}). See: ${pc.cyan('apps/docs/integrations/opencode.md')}`);
|
|
218
|
+
break;
|
|
219
|
+
case 'agentic-orchestrator':
|
|
220
|
+
// Same "orchestrator, not an agent, writes no config of its own"
|
|
221
|
+
// shape as xirp above — see gateRegistry.ts's NO_GATE row. All three
|
|
222
|
+
// wrapped backends are gated by their own adapters (OpenCode since
|
|
223
|
+
// TD-397 closed).
|
|
224
|
+
writeCliOutput(` Agentic Orchestrator orchestrates other CLI backends (Claude Code, Codex,`);
|
|
225
|
+
writeCliOutput(` and OpenCode) — connect the backend(s) you use normally, against the`);
|
|
226
|
+
writeCliOutput(` repo's main checkout. Intutic's sync daemon automatically propagates each`);
|
|
227
|
+
writeCliOutput(` backend's own gate/config into every git worktree Agentic Orchestrator`);
|
|
228
|
+
writeCliOutput(` creates, every sync cycle — no separate setup step for it.`);
|
|
229
|
+
writeCliOutput(` See: ${pc.cyan('apps/docs/integrations/agentic-orchestrator.md')}`);
|
|
230
|
+
break;
|
|
172
231
|
default:
|
|
173
232
|
writeCliOutput(` Launch your agent using the Intutic exec wrapper:`);
|
|
174
233
|
writeCliOutput(` ${pc.bold(`intutic exec -- <your-agent-command>`)}`);
|