@agent-watch-ai/edge 0.2.5 → 0.4.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/CHANGELOG.md +558 -0
- package/README.md +222 -97
- package/SECURITY.md +72 -0
- package/dist/billing/session-billing.d.ts +19 -0
- package/dist/billing/session-billing.js +52 -0
- package/dist/cli/args.d.ts +10 -0
- package/dist/cli/args.js +20 -0
- package/dist/cli/constants/cli.constants.d.ts +52 -4
- package/dist/cli/constants/cli.constants.js +56 -5
- package/dist/cli/context.d.ts +33 -2
- package/dist/cli/context.js +84 -14
- package/dist/cli/doctor.js +321 -33
- package/dist/cli/hook-check.d.ts +23 -0
- package/dist/cli/hook-check.js +114 -0
- package/dist/cli/hook.js +118 -7
- package/dist/cli/index.d.ts +3 -1
- package/dist/cli/index.js +3 -1
- package/dist/cli/misc.d.ts +11 -0
- package/dist/cli/misc.js +80 -4
- package/dist/cli/npx-install.d.ts +37 -0
- package/dist/cli/npx-install.js +79 -0
- package/dist/cli/open-browser.d.ts +39 -0
- package/dist/cli/open-browser.js +62 -0
- package/dist/cli/setup.d.ts +17 -8
- package/dist/cli/setup.js +553 -103
- package/dist/cli/status.js +82 -13
- package/dist/cli/toggle.d.ts +9 -0
- package/dist/cli/toggle.js +117 -0
- package/dist/cli/types/cli.types.d.ts +43 -3
- package/dist/cli/ui.d.ts +7 -0
- package/dist/cli/ui.js +10 -1
- package/dist/cli/uninstall.js +39 -2
- package/dist/cli/update.d.ts +17 -0
- package/dist/cli/update.js +76 -0
- package/dist/cli.js +110 -12
- package/dist/config/config-store.d.ts +57 -0
- package/dist/config/config-store.js +250 -12
- package/dist/config/config.d.ts +53 -6
- package/dist/config/config.js +66 -6
- package/dist/config/constants/config.constants.d.ts +116 -6
- package/dist/config/constants/config.constants.js +131 -8
- package/dist/config/destination.d.ts +24 -0
- package/dist/config/destination.js +33 -0
- package/dist/config/index.d.ts +7 -4
- package/dist/config/index.js +5 -3
- package/dist/config/repo-config.d.ts +11 -7
- package/dist/config/repo-config.js +64 -15
- package/dist/config/root-config.d.ts +72 -0
- package/dist/config/root-config.js +170 -0
- package/dist/config/schemas/config.schema.d.ts +831 -84
- package/dist/config/schemas/config.schema.js +398 -16
- package/dist/config/types/config.types.d.ts +15 -1
- package/dist/config/types/destination.types.d.ts +8 -0
- package/dist/core/async.d.ts +36 -0
- package/dist/core/async.js +68 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/object.d.ts +5 -0
- package/dist/core/object.js +9 -4
- package/dist/core/pipe.d.ts +0 -13
- package/dist/core/pipe.js +1 -9
- package/dist/core/types/core.types.d.ts +9 -0
- package/dist/core/types/core.types.js +0 -3
- package/dist/core/which.d.ts +14 -0
- package/dist/core/which.js +43 -3
- package/dist/credentials/budget.d.ts +9 -0
- package/dist/credentials/budget.js +16 -0
- package/dist/credentials/command-runner.d.ts +16 -0
- package/dist/credentials/command-runner.js +37 -0
- package/dist/credentials/constants/credentials.constants.d.ts +119 -0
- package/dist/credentials/constants/credentials.constants.js +120 -0
- package/dist/credentials/credential-status.d.ts +14 -0
- package/dist/credentials/credential-status.js +38 -0
- package/dist/credentials/credentials.d.ts +86 -0
- package/dist/credentials/credentials.js +278 -0
- package/dist/credentials/device-api.d.ts +73 -0
- package/dist/credentials/device-api.js +161 -0
- package/dist/credentials/device-state.d.ts +31 -0
- package/dist/credentials/device-state.js +51 -0
- package/dist/credentials/identity.d.ts +73 -0
- package/dist/credentials/identity.js +101 -0
- package/dist/credentials/index.d.ts +7 -0
- package/dist/credentials/index.js +5 -0
- package/dist/credentials/migration.d.ts +46 -0
- package/dist/credentials/migration.js +164 -0
- package/dist/credentials/schemas/device-api.schema.d.ts +77 -0
- package/dist/credentials/schemas/device-api.schema.js +33 -0
- package/dist/credentials/schemas/device-state.schema.d.ts +51 -0
- package/dist/credentials/schemas/device-state.schema.js +20 -0
- package/dist/credentials/secret-store.d.ts +54 -0
- package/dist/credentials/secret-store.js +217 -0
- package/dist/credentials/sign-in.d.ts +31 -0
- package/dist/credentials/sign-in.js +105 -0
- package/dist/credentials/token-refresher.d.ts +39 -0
- package/dist/credentials/token-refresher.js +185 -0
- package/dist/credentials/types/credentials.types.d.ts +206 -0
- package/dist/credentials/types/credentials.types.js +1 -0
- package/dist/enforcement/constants/enforcement.constants.d.ts +47 -1
- package/dist/enforcement/constants/enforcement.constants.js +56 -0
- package/dist/enforcement/decision-cache.d.ts +20 -1
- package/dist/enforcement/decision-cache.js +65 -2
- package/dist/enforcement/decision-client.d.ts +9 -8
- package/dist/enforcement/decision-client.js +64 -17
- package/dist/enforcement/enforcement.d.ts +23 -2
- package/dist/enforcement/enforcement.js +107 -17
- package/dist/enforcement/index.d.ts +4 -3
- package/dist/enforcement/index.js +3 -2
- package/dist/enforcement/types/enforcement.types.d.ts +66 -2
- package/dist/enrollment/constants/enrollment.constants.d.ts +2 -6
- package/dist/enrollment/constants/enrollment.constants.js +2 -6
- package/dist/enrollment/enrollment.d.ts +16 -0
- package/dist/enrollment/enrollment.js +54 -0
- package/dist/enrollment/index.d.ts +3 -7
- package/dist/enrollment/index.js +1 -1
- package/dist/enrollment/types/enrollment.types.d.ts +9 -13
- package/dist/events/constants/enrich.constants.d.ts +15 -0
- package/dist/events/constants/enrich.constants.js +15 -0
- package/dist/events/constants/events.constants.d.ts +6 -2
- package/dist/events/constants/events.constants.js +5 -1
- package/dist/events/enrich.js +92 -10
- package/dist/events/event-id.d.ts +0 -8
- package/dist/events/event-id.js +0 -10
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.js +1 -1
- package/dist/events/product-event.d.ts +9 -6
- package/dist/events/types/repo-snapshot.types.d.ts +7 -0
- package/dist/events/types/session-billing.types.d.ts +16 -0
- package/dist/events/types/session-billing.types.js +1 -0
- package/dist/feature/constants/feature.constants.d.ts +7 -0
- package/dist/feature/constants/feature.constants.js +7 -0
- package/dist/feature/index.d.ts +1 -1
- package/dist/feature/index.js +1 -1
- package/dist/feature/ticket-candidates.d.ts +14 -0
- package/dist/feature/ticket-candidates.js +26 -8
- package/dist/git/blob-hash.d.ts +21 -0
- package/dist/git/blob-hash.js +69 -0
- package/dist/git/checkout-root.d.ts +27 -0
- package/dist/git/checkout-root.js +75 -0
- package/dist/git/constants/git.constants.d.ts +160 -0
- package/dist/git/constants/git.constants.js +181 -0
- package/dist/git/fingerprint.d.ts +74 -0
- package/dist/git/fingerprint.js +219 -0
- package/dist/git/gate-checkout.d.ts +44 -0
- package/dist/git/gate-checkout.js +201 -0
- package/dist/git/git-context.d.ts +45 -0
- package/dist/git/git-context.js +61 -3
- package/dist/git/index.d.ts +4 -2
- package/dist/git/index.js +2 -1
- package/dist/git/manifest-repository.d.ts +13 -0
- package/dist/git/manifest-repository.js +92 -0
- package/dist/git/repo-snapshot.d.ts +29 -3
- package/dist/git/repo-snapshot.js +110 -7
- package/dist/git/repository-root.d.ts +39 -0
- package/dist/git/repository-root.js +131 -0
- package/dist/git/types/git.types.d.ts +55 -0
- package/dist/git/types/repository-root.types.d.ts +11 -0
- package/dist/git/types/repository-root.types.js +1 -0
- package/dist/git/types/snapshot.types.d.ts +9 -0
- package/dist/pipeline/constants/pipeline.constants.d.ts +10 -0
- package/dist/pipeline/constants/pipeline.constants.js +10 -0
- package/dist/pipeline/hook-pipeline.js +410 -33
- package/dist/pipeline/types/pipeline.types.d.ts +39 -4
- package/dist/privacy/constants/privacy.constants.js +15 -1
- package/dist/privacy/index.d.ts +1 -0
- package/dist/privacy/index.js +1 -0
- package/dist/privacy/product-capture.d.ts +12 -0
- package/dist/privacy/product-capture.js +75 -0
- package/dist/privacy/sanitizer.d.ts +21 -3
- package/dist/privacy/sanitizer.js +52 -8
- package/dist/process/ancestors.d.ts +39 -0
- package/dist/process/ancestors.js +121 -0
- package/dist/process/constants/process.constants.d.ts +34 -0
- package/dist/process/constants/process.constants.js +34 -0
- package/dist/process/index.d.ts +7 -0
- package/dist/process/index.js +2 -0
- package/dist/process/types/process.types.d.ts +23 -0
- package/dist/process/types/process.types.js +1 -0
- package/dist/providers/antigravity/antigravity.adapter.d.ts +12 -1
- package/dist/providers/antigravity/antigravity.adapter.js +21 -3
- package/dist/providers/antigravity/antigravity.detect.d.ts +0 -9
- package/dist/providers/antigravity/antigravity.detect.js +1 -1
- package/dist/providers/antigravity/antigravity.provider.js +3 -2
- package/dist/providers/antigravity/constants/antigravity.constants.d.ts +2 -0
- package/dist/providers/antigravity/constants/antigravity.constants.js +2 -0
- package/dist/providers/claude/claude.adapter.d.ts +11 -1
- package/dist/providers/claude/claude.adapter.js +26 -5
- package/dist/providers/claude/claude.otel.d.ts +32 -18
- package/dist/providers/claude/claude.otel.js +81 -6
- package/dist/providers/claude/claude.provider.js +5 -2
- package/dist/providers/claude/constants/claude.constants.d.ts +2 -0
- package/dist/providers/claude/constants/claude.constants.js +2 -0
- package/dist/providers/claude/constants/claude.otel.constants.d.ts +4 -0
- package/dist/providers/claude/constants/claude.otel.constants.js +8 -0
- package/dist/providers/codex/codex.adapter.d.ts +15 -1
- package/dist/providers/codex/codex.adapter.js +29 -5
- package/dist/providers/codex/codex.otel.d.ts +36 -3
- package/dist/providers/codex/codex.otel.js +199 -32
- package/dist/providers/codex/codex.provider.js +5 -2
- package/dist/providers/codex/constants/codex.constants.d.ts +2 -0
- package/dist/providers/codex/constants/codex.constants.js +16 -0
- package/dist/providers/codex/constants/codex.otel.constants.d.ts +10 -0
- package/dist/providers/codex/constants/codex.otel.constants.js +10 -0
- package/dist/providers/constants/provider.constants.d.ts +8 -3
- package/dist/providers/constants/provider.constants.js +8 -3
- package/dist/providers/cursor/constants/cursor.constants.d.ts +9 -0
- package/dist/providers/cursor/constants/cursor.constants.js +9 -0
- package/dist/providers/cursor/cursor.adapter.d.ts +33 -1
- package/dist/providers/cursor/cursor.adapter.js +129 -4
- package/dist/providers/cursor/cursor.detect.d.ts +0 -7
- package/dist/providers/cursor/cursor.detect.js +1 -1
- package/dist/providers/cursor/cursor.provider.js +5 -2
- package/dist/providers/gemini/constants/gemini.constants.d.ts +9 -0
- package/dist/providers/gemini/constants/gemini.constants.js +9 -0
- package/dist/providers/gemini/constants/gemini.otel.constants.d.ts +9 -1
- package/dist/providers/gemini/constants/gemini.otel.constants.js +9 -0
- package/dist/providers/gemini/gemini.adapter.d.ts +14 -1
- package/dist/providers/gemini/gemini.adapter.js +25 -5
- package/dist/providers/gemini/gemini.detect.d.ts +0 -7
- package/dist/providers/gemini/gemini.detect.js +1 -1
- package/dist/providers/gemini/gemini.otel.d.ts +30 -21
- package/dist/providers/gemini/gemini.otel.js +166 -22
- package/dist/providers/gemini/gemini.provider.js +2 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +1 -1
- package/dist/providers/loaders.d.ts +10 -0
- package/dist/providers/loaders.js +40 -0
- package/dist/providers/provider.d.ts +11 -0
- package/dist/providers/provider.js +1 -1
- package/dist/providers/registry.d.ts +11 -8
- package/dist/providers/registry.js +11 -15
- package/dist/providers/shared/bearer-rewrite.d.ts +19 -0
- package/dist/providers/shared/bearer-rewrite.js +46 -0
- package/dist/providers/shared/constants/hook-refusal.constants.d.ts +7 -0
- package/dist/providers/shared/constants/hook-refusal.constants.js +7 -0
- package/dist/providers/shared/constants/shell-directories.constants.d.ts +30 -0
- package/dist/providers/shared/constants/shell-directories.constants.js +39 -0
- package/dist/providers/shared/constants/tooling.constants.d.ts +24 -2
- package/dist/providers/shared/constants/tooling.constants.js +25 -3
- package/dist/providers/shared/event-builder.d.ts +12 -14
- package/dist/providers/shared/event-builder.js +20 -14
- package/dist/providers/shared/exporter-allowlist.d.ts +20 -0
- package/dist/providers/shared/exporter-allowlist.js +49 -0
- package/dist/providers/shared/hook-config.d.ts +2 -21
- package/dist/providers/shared/hook-config.js +5 -4
- package/dist/providers/shared/hook-refusal.d.ts +12 -0
- package/dist/providers/shared/hook-refusal.js +17 -1
- package/dist/providers/shared/install-record.d.ts +12 -2
- package/dist/providers/shared/install-record.js +5 -2
- package/dist/providers/shared/shell-directories.d.ts +24 -0
- package/dist/providers/shared/shell-directories.js +90 -0
- package/dist/providers/shared/tooling.d.ts +40 -1
- package/dist/providers/shared/tooling.js +70 -1
- package/dist/providers/shared/types/adapter.types.d.ts +1 -2
- package/dist/providers/types/provider.types.d.ts +81 -1
- package/dist/snapshot/constants/snapshot.constants.d.ts +32 -0
- package/dist/snapshot/constants/snapshot.constants.js +33 -0
- package/dist/snapshot/snapshot-event.js +52 -11
- package/dist/snapshot/snapshot-pipeline.js +1 -1
- package/dist/snapshot/types/snapshot.types.d.ts +2 -0
- package/dist/storage/atomic-file.d.ts +21 -0
- package/dist/storage/atomic-file.js +20 -1
- package/dist/storage/constants/storage.constants.d.ts +19 -0
- package/dist/storage/constants/storage.constants.js +19 -0
- package/dist/storage/disabled.d.ts +13 -0
- package/dist/storage/disabled.js +24 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/paths.js +3 -2
- package/dist/storage/schemas/storage.schema.d.ts +72 -0
- package/dist/storage/schemas/storage.schema.js +6 -0
- package/dist/storage/sweep-marker.d.ts +19 -0
- package/dist/storage/sweep-marker.js +55 -0
- package/dist/storage/types/storage.types.d.ts +2 -0
- package/dist/storage/uninstalled.d.ts +58 -0
- package/dist/storage/uninstalled.js +107 -0
- package/dist/transport/auth-block.d.ts +66 -0
- package/dist/transport/auth-block.js +129 -0
- package/dist/transport/constants/transport.constants.d.ts +82 -3
- package/dist/transport/constants/transport.constants.js +83 -4
- package/dist/transport/cooldown.js +8 -1
- package/dist/transport/delivery.d.ts +14 -6
- package/dist/transport/delivery.js +80 -55
- package/dist/transport/http-transport.d.ts +1 -0
- package/dist/transport/http-transport.js +52 -10
- package/dist/transport/index.d.ts +6 -3
- package/dist/transport/index.js +3 -0
- package/dist/transport/queue-partition.d.ts +91 -0
- package/dist/transport/queue-partition.js +143 -0
- package/dist/transport/queue.d.ts +99 -20
- package/dist/transport/queue.js +210 -69
- package/dist/transport/response-body.d.ts +25 -0
- package/dist/transport/response-body.js +64 -0
- package/dist/transport/send.d.ts +11 -0
- package/dist/transport/send.js +17 -0
- package/dist/transport/types/delivery-flow.types.d.ts +19 -0
- package/dist/transport/types/delivery-flow.types.js +1 -0
- package/dist/transport/types/transport.types.d.ts +45 -0
- package/dist/turns/claude-transcript.d.ts +19 -1
- package/dist/turns/claude-transcript.js +46 -1
- package/dist/turns/codex-originator.d.ts +11 -0
- package/dist/turns/codex-originator.js +31 -0
- package/dist/turns/codex-transcript.d.ts +30 -0
- package/dist/turns/codex-transcript.js +88 -0
- package/dist/turns/constants/turns.constants.d.ts +141 -5
- package/dist/turns/constants/turns.constants.js +155 -5
- package/dist/turns/file-identity.d.ts +27 -0
- package/dist/turns/file-identity.js +48 -0
- package/dist/turns/gemini-transcript.d.ts +30 -0
- package/dist/turns/gemini-transcript.js +96 -0
- package/dist/turns/index.d.ts +3 -3
- package/dist/turns/index.js +1 -1
- package/dist/turns/inherited-checkout.d.ts +54 -0
- package/dist/turns/inherited-checkout.js +155 -0
- package/dist/turns/native-session-titles.d.ts +26 -0
- package/dist/turns/native-session-titles.js +102 -0
- package/dist/turns/transcript.d.ts +3 -2
- package/dist/turns/transcript.js +5 -1
- package/dist/turns/turn-state.d.ts +224 -3
- package/dist/turns/turn-state.js +456 -21
- package/dist/turns/turn-summary.d.ts +1 -14
- package/dist/turns/turn-summary.js +87 -51
- package/dist/turns/turn-tracker.d.ts +21 -2
- package/dist/turns/turn-tracker.js +379 -56
- package/dist/turns/types/transcript.types.d.ts +5 -0
- package/dist/turns/types/turn-state.types.d.ts +116 -5
- package/dist/turns/types/turn-summary.types.d.ts +64 -14
- package/dist/turns/types/turn-tracker.types.d.ts +27 -1
- package/dist/turns/work-checkout.d.ts +67 -0
- package/dist/turns/work-checkout.js +700 -0
- package/dist/untraced/constants/untraced.constants.d.ts +31 -0
- package/dist/untraced/constants/untraced.constants.js +63 -0
- package/dist/untraced/untraced.d.ts +35 -0
- package/dist/untraced/untraced.js +105 -0
- package/dist/update/constants/update.constants.d.ts +18 -0
- package/dist/update/constants/update.constants.js +20 -0
- package/dist/update/update-check.d.ts +52 -0
- package/dist/update/update-check.js +113 -0
- package/docs/AUDIT_PROMPT.md +129 -0
- package/docs/DATA_HANDLING.md +655 -0
- package/docs/ENTERPRISE_DEPLOYMENT.md +194 -0
- package/docs/PERFORMANCE.md +81 -0
- package/package.json +14 -4
- package/dist/enrollment/enrollment-provider.d.ts +0 -5
- package/dist/enrollment/manual-enrollment.d.ts +0 -32
- package/dist/enrollment/manual-enrollment.js +0 -72
- package/example/README.md +0 -43
- package/example/server.mjs +0 -240
- /package/dist/{enrollment/enrollment-provider.js → config/types/destination.types.js} +0 -0
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const VALUE_FLAGS: ReadonlySet<string>;
|
|
9
9
|
export declare const FLAG_PREFIX = "--";
|
|
10
|
-
/**
|
|
11
|
-
export declare const
|
|
12
|
-
/**
|
|
13
|
-
export declare const
|
|
10
|
+
/** `--enrollment-code -`: read the code from stdin. The only value the flag takes. */
|
|
11
|
+
export declare const ENROLLMENT_CODE_STDIN = "-";
|
|
12
|
+
/** The directory npx unpacks packages into, under the npm cache. */
|
|
13
|
+
export declare const NPX_CACHE_SEGMENT = "_npx";
|
|
14
|
+
/** Set on the handed-off setup, so it never hands off again. */
|
|
15
|
+
export declare const NPX_HANDOFF_VAR = "AGENTWATCH_NPX_HANDOFF";
|
|
14
16
|
/** Doctor's name for the identity every per-developer decision is keyed on. */
|
|
15
17
|
export declare const DEVELOPER_IDENTITY_CHECK = "developer identity";
|
|
16
18
|
/**
|
|
@@ -22,6 +24,16 @@ export declare const DEVELOPER_IDENTITY_CHECK = "developer identity";
|
|
|
22
24
|
*/
|
|
23
25
|
export declare const NO_DEVELOPER_IDENTITY = "no developer identity: `git config user.email` is unset here and --developer-email was not given";
|
|
24
26
|
export declare const DEVELOPER_IDENTITY_REMEDIES = "set one with `git config --global user.email you@company.com`, or re-run setup with `--developer-email you@company.com`";
|
|
27
|
+
/**
|
|
28
|
+
* What doctor says when the install works but every view will print an address.
|
|
29
|
+
*
|
|
30
|
+
* Not a failure: a nameless install ships turns and nothing depends on the
|
|
31
|
+
* name. It is reported because otherwise the condition is invisible — turns
|
|
32
|
+
* come out labelled by email indefinitely with nothing on this machine saying
|
|
33
|
+
* why.
|
|
34
|
+
*/
|
|
35
|
+
export declare const NO_DEVELOPER_NAME = "no display name; turns will be labelled by address";
|
|
36
|
+
export declare const DEVELOPER_NAME_REMEDIES = "set one with `git config --global user.name \"Your Name\"`, or re-run setup with `--developer-name \"Your Name\"`";
|
|
25
37
|
/** Said on the failure path, because a half-written config is worse than none. */
|
|
26
38
|
export declare const NO_CONFIG_WRITTEN = "no configuration was written; re-run setup once the identity resolves";
|
|
27
39
|
/** Ceiling on a hook payload; beyond this the hook refuses rather than buffers. */
|
|
@@ -35,8 +47,16 @@ export declare const MIN_NODE_MAJOR = 20;
|
|
|
35
47
|
* versions fall back to session-scoped turn tracking with an empty turn_id.
|
|
36
48
|
*/
|
|
37
49
|
export declare const CLAUDE_MIN_VERSION_FOR_PROMPT_ID = "2.1.196";
|
|
50
|
+
/**
|
|
51
|
+
* Name of the one check an administrator's install script greps for: it carries
|
|
52
|
+
* all four backend states — accepted, credential rejected, unreachable, and not
|
|
53
|
+
* configured yet — so a rollout can be judged from one line.
|
|
54
|
+
*/
|
|
55
|
+
export declare const BACKEND_CONNECTIVITY_CHECK = "backend connectivity";
|
|
38
56
|
/** Budgets for the diagnostics that shell out or reach the network. */
|
|
39
57
|
export declare const BACKEND_PROBE_TIMEOUT_MS = 4000;
|
|
58
|
+
/** What the gateway answers an authenticated `{ events: [] }`: it checks the credential first. */
|
|
59
|
+
export declare const EMPTY_BATCH_REFUSED_STATUS = 422;
|
|
40
60
|
export declare const CLAUDE_VERSION_TIMEOUT_MS = 5000;
|
|
41
61
|
export declare const GIT_VERSION_TIMEOUT_MS = 2000;
|
|
42
62
|
/** Longer than the hook path's budget: status is not on anyone's critical path. */
|
|
@@ -58,3 +78,31 @@ export declare const RE_NEEDS_QUOTING: RegExp;
|
|
|
58
78
|
export declare const RE_QUOTE_ESCAPE: RegExp;
|
|
59
79
|
/** Redaction placeholder in the `config` command's output. */
|
|
60
80
|
export declare const REDACTED_TOKEN = "<redacted>";
|
|
81
|
+
/** Ceiling for each step of setup's install-key exchange: a keychain write or the gateway call. */
|
|
82
|
+
export declare const SETUP_EXCHANGE_TIMEOUT_MS = 5000;
|
|
83
|
+
/**
|
|
84
|
+
* How long Claude Code keeps what `otel-headers` printed before it asks again:
|
|
85
|
+
* its CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS default (29 minutes), plus a
|
|
86
|
+
* margin. A token with less left than this is refreshed before it is printed,
|
|
87
|
+
* so no export goes out with an expired bearer.
|
|
88
|
+
*/
|
|
89
|
+
export declare const OTEL_HEADERS_MIN_TOKEN_LIFE_MS: number;
|
|
90
|
+
/**
|
|
91
|
+
* Follows the trusted origins in the one line `setup`, `status` and `doctor`
|
|
92
|
+
* all print while this machine trusts a backend outside the Agent Watch hosts.
|
|
93
|
+
* Evidence for an auditor (SPEC R9): the override is never silent.
|
|
94
|
+
*/
|
|
95
|
+
export declare const CUSTOM_ENDPOINT_OVERRIDE = "trusted outside the Agent Watch hosts (set by setup --allow-custom-endpoint, or kept from a config older than the allowlist)";
|
|
96
|
+
/**
|
|
97
|
+
* The hook path's check of the agents' native exporters against the allowlist:
|
|
98
|
+
* at most once a day per machine, by this marker's mtime in the data directory,
|
|
99
|
+
* and never longer than the budget on the agent's critical path.
|
|
100
|
+
*/
|
|
101
|
+
export declare const EXPORTER_SWEEP_MARKER_FILE = ".exporter-allowlist-sweep";
|
|
102
|
+
export declare const EXPORTER_SWEEP_INTERVAL_MS: number;
|
|
103
|
+
export declare const EXPORTER_SWEEP_BUDGET_MS = 500;
|
|
104
|
+
/** Each platform's browser opener, run without a shell; anything else is assumed to have xdg-open. */
|
|
105
|
+
export declare const BROWSER_OPENERS: Partial<Record<NodeJS.Platform, readonly string[]>>;
|
|
106
|
+
export declare const DEFAULT_BROWSER_OPENER: readonly string[];
|
|
107
|
+
/** The only link schemes setup hands to a browser opener: the gateway chose the link. */
|
|
108
|
+
export declare const OPENABLE_PROTOCOLS: ReadonlySet<string>;
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
* itself into a boolean — which is how `--otel none` once ignored the selection
|
|
6
6
|
* entirely.
|
|
7
7
|
*/
|
|
8
|
-
export const VALUE_FLAGS = new Set(['agent', 'endpoint', 'token', 'developer-email', 'otel']);
|
|
8
|
+
export const VALUE_FLAGS = new Set(['agent', 'endpoint', 'token', 'enrollment-code', 'developer-email', 'developer-name', 'otel', 'root']);
|
|
9
9
|
export const FLAG_PREFIX = '--';
|
|
10
|
-
/**
|
|
11
|
-
export const
|
|
12
|
-
/**
|
|
13
|
-
export const
|
|
10
|
+
/** `--enrollment-code -`: read the code from stdin. The only value the flag takes. */
|
|
11
|
+
export const ENROLLMENT_CODE_STDIN = '-';
|
|
12
|
+
/** The directory npx unpacks packages into, under the npm cache. */
|
|
13
|
+
export const NPX_CACHE_SEGMENT = '_npx';
|
|
14
|
+
/** Set on the handed-off setup, so it never hands off again. */
|
|
15
|
+
export const NPX_HANDOFF_VAR = 'AGENTWATCH_NPX_HANDOFF';
|
|
14
16
|
/** Doctor's name for the identity every per-developer decision is keyed on. */
|
|
15
17
|
export const DEVELOPER_IDENTITY_CHECK = 'developer identity';
|
|
16
18
|
/**
|
|
@@ -22,6 +24,16 @@ export const DEVELOPER_IDENTITY_CHECK = 'developer identity';
|
|
|
22
24
|
*/
|
|
23
25
|
export const NO_DEVELOPER_IDENTITY = 'no developer identity: `git config user.email` is unset here and --developer-email was not given';
|
|
24
26
|
export const DEVELOPER_IDENTITY_REMEDIES = 'set one with `git config --global user.email you@company.com`, or re-run setup with `--developer-email you@company.com`';
|
|
27
|
+
/**
|
|
28
|
+
* What doctor says when the install works but every view will print an address.
|
|
29
|
+
*
|
|
30
|
+
* Not a failure: a nameless install ships turns and nothing depends on the
|
|
31
|
+
* name. It is reported because otherwise the condition is invisible — turns
|
|
32
|
+
* come out labelled by email indefinitely with nothing on this machine saying
|
|
33
|
+
* why.
|
|
34
|
+
*/
|
|
35
|
+
export const NO_DEVELOPER_NAME = 'no display name; turns will be labelled by address';
|
|
36
|
+
export const DEVELOPER_NAME_REMEDIES = 'set one with `git config --global user.name "Your Name"`, or re-run setup with `--developer-name "Your Name"`';
|
|
25
37
|
/** Said on the failure path, because a half-written config is worse than none. */
|
|
26
38
|
export const NO_CONFIG_WRITTEN = 'no configuration was written; re-run setup once the identity resolves';
|
|
27
39
|
/** Ceiling on a hook payload; beyond this the hook refuses rather than buffers. */
|
|
@@ -35,8 +47,16 @@ export const MIN_NODE_MAJOR = 20;
|
|
|
35
47
|
* versions fall back to session-scoped turn tracking with an empty turn_id.
|
|
36
48
|
*/
|
|
37
49
|
export const CLAUDE_MIN_VERSION_FOR_PROMPT_ID = '2.1.196';
|
|
50
|
+
/**
|
|
51
|
+
* Name of the one check an administrator's install script greps for: it carries
|
|
52
|
+
* all four backend states — accepted, credential rejected, unreachable, and not
|
|
53
|
+
* configured yet — so a rollout can be judged from one line.
|
|
54
|
+
*/
|
|
55
|
+
export const BACKEND_CONNECTIVITY_CHECK = 'backend connectivity';
|
|
38
56
|
/** Budgets for the diagnostics that shell out or reach the network. */
|
|
39
57
|
export const BACKEND_PROBE_TIMEOUT_MS = 4_000;
|
|
58
|
+
/** What the gateway answers an authenticated `{ events: [] }`: it checks the credential first. */
|
|
59
|
+
export const EMPTY_BATCH_REFUSED_STATUS = 422;
|
|
40
60
|
export const CLAUDE_VERSION_TIMEOUT_MS = 5_000;
|
|
41
61
|
export const GIT_VERSION_TIMEOUT_MS = 2_000;
|
|
42
62
|
/** Longer than the hook path's budget: status is not on anyone's critical path. */
|
|
@@ -58,3 +78,34 @@ export const RE_NEEDS_QUOTING = /[\s"'\\$`]/;
|
|
|
58
78
|
export const RE_QUOTE_ESCAPE = /(["\\$`])/g;
|
|
59
79
|
/** Redaction placeholder in the `config` command's output. */
|
|
60
80
|
export const REDACTED_TOKEN = '<redacted>';
|
|
81
|
+
/** Ceiling for each step of setup's install-key exchange: a keychain write or the gateway call. */
|
|
82
|
+
export const SETUP_EXCHANGE_TIMEOUT_MS = 5_000;
|
|
83
|
+
/**
|
|
84
|
+
* How long Claude Code keeps what `otel-headers` printed before it asks again:
|
|
85
|
+
* its CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS default (29 minutes), plus a
|
|
86
|
+
* margin. A token with less left than this is refreshed before it is printed,
|
|
87
|
+
* so no export goes out with an expired bearer.
|
|
88
|
+
*/
|
|
89
|
+
export const OTEL_HEADERS_MIN_TOKEN_LIFE_MS = 34 * 60_000;
|
|
90
|
+
/**
|
|
91
|
+
* Follows the trusted origins in the one line `setup`, `status` and `doctor`
|
|
92
|
+
* all print while this machine trusts a backend outside the Agent Watch hosts.
|
|
93
|
+
* Evidence for an auditor (SPEC R9): the override is never silent.
|
|
94
|
+
*/
|
|
95
|
+
export const CUSTOM_ENDPOINT_OVERRIDE = 'trusted outside the Agent Watch hosts (set by setup --allow-custom-endpoint, or kept from a config older than the allowlist)';
|
|
96
|
+
/**
|
|
97
|
+
* The hook path's check of the agents' native exporters against the allowlist:
|
|
98
|
+
* at most once a day per machine, by this marker's mtime in the data directory,
|
|
99
|
+
* and never longer than the budget on the agent's critical path.
|
|
100
|
+
*/
|
|
101
|
+
export const EXPORTER_SWEEP_MARKER_FILE = '.exporter-allowlist-sweep';
|
|
102
|
+
export const EXPORTER_SWEEP_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
103
|
+
export const EXPORTER_SWEEP_BUDGET_MS = 500;
|
|
104
|
+
/** Each platform's browser opener, run without a shell; anything else is assumed to have xdg-open. */
|
|
105
|
+
export const BROWSER_OPENERS = {
|
|
106
|
+
darwin: ['open'],
|
|
107
|
+
win32: ['rundll32', 'url.dll,FileProtocolHandler']
|
|
108
|
+
};
|
|
109
|
+
export const DEFAULT_BROWSER_OPENER = ['xdg-open'];
|
|
110
|
+
/** The only link schemes setup hands to a browser opener: the gateway chose the link. */
|
|
111
|
+
export const OPENABLE_PROTOCOLS = new Set(['http:', 'https:']);
|
package/dist/cli/context.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Env } from '../core/types/core.types.js';
|
|
2
|
+
import { BackendAuthBlock } from '../transport/auth-block.js';
|
|
2
3
|
import { DeliveryStats } from '../transport/delivery-stats.js';
|
|
3
4
|
import { EventQueue } from '../transport/queue.js';
|
|
4
5
|
import type { EventTransport } from '../transport/types/transport.types.js';
|
|
@@ -17,10 +18,22 @@ export declare function buildCliContext(env: Env): Promise<CliContext>;
|
|
|
17
18
|
/**
|
|
18
19
|
* The offline queue for this context.
|
|
19
20
|
*
|
|
21
|
+
* Partitioned by the same token `buildTransport` signs with, so a command can
|
|
22
|
+
* only ever drain the backlog belonging to the identity it is sending as. A
|
|
23
|
+
* backlog written by a pre-partition edge is settled first, so `status`,
|
|
24
|
+
* `doctor` and setup's backlog report agree about what is in the partition.
|
|
25
|
+
*
|
|
20
26
|
* @param context - Resolved CLI context.
|
|
21
27
|
* @returns The queue.
|
|
22
28
|
*/
|
|
23
|
-
export declare function buildQueue(context: CliContext): EventQueue
|
|
29
|
+
export declare function buildQueue(context: CliContext): Promise<EventQueue>;
|
|
30
|
+
/**
|
|
31
|
+
* Open the selected partition without adopting or moving legacy records.
|
|
32
|
+
* Setup can inspect ownership and ask for consent without changing the queue.
|
|
33
|
+
* @param context - Resolved identity and storage paths.
|
|
34
|
+
* @returns A queue handle; construction performs no filesystem writes.
|
|
35
|
+
*/
|
|
36
|
+
export declare function openIdentityQueue(context: CliContext): EventQueue;
|
|
24
37
|
/**
|
|
25
38
|
* The delivery-loss tally for this context.
|
|
26
39
|
*
|
|
@@ -28,6 +41,13 @@ export declare function buildQueue(context: CliContext): EventQueue;
|
|
|
28
41
|
* @returns The tally.
|
|
29
42
|
*/
|
|
30
43
|
export declare function buildDeliveryStats(context: CliContext): DeliveryStats;
|
|
44
|
+
/**
|
|
45
|
+
* The standing credential refusal for this context.
|
|
46
|
+
*
|
|
47
|
+
* @param context - Resolved CLI context.
|
|
48
|
+
* @returns The block.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildAuthBlock(context: CliContext): BackendAuthBlock;
|
|
31
51
|
/**
|
|
32
52
|
* The transport for this context, when a backend is configured.
|
|
33
53
|
*
|
|
@@ -35,7 +55,18 @@ export declare function buildDeliveryStats(context: CliContext): DeliveryStats;
|
|
|
35
55
|
* @param timeoutMs - Override for the configured send timeout.
|
|
36
56
|
* @returns The transport, or undefined before setup has run.
|
|
37
57
|
*/
|
|
38
|
-
export declare function buildTransport(context: CliContext, timeoutMs?: number): EventTransport | undefined;
|
|
58
|
+
export declare function buildTransport(context: CliContext, timeoutMs?: number, bearer?: string): EventTransport | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* The bearer this directory's hooks send, refreshed or exchanged when due.
|
|
61
|
+
*
|
|
62
|
+
* Separate from `buildCliContext` because only the commands that talk to the
|
|
63
|
+
* backend should pay for a keychain read or a gateway call.
|
|
64
|
+
*
|
|
65
|
+
* @param context - Resolved CLI context.
|
|
66
|
+
* @param timeoutMs - Ceiling for one keychain read or gateway call.
|
|
67
|
+
* @returns The bearer, or undefined when there is none to send.
|
|
68
|
+
*/
|
|
69
|
+
export declare function resolveContextBearer(context: CliContext, timeoutMs: number): Promise<string | undefined>;
|
|
39
70
|
/**
|
|
40
71
|
* The command agents should invoke for hook callbacks.
|
|
41
72
|
*
|
package/dist/cli/context.js
CHANGED
|
@@ -2,13 +2,18 @@ import path from 'node:path';
|
|
|
2
2
|
import process from 'node:process';
|
|
3
3
|
import { eventsUrl } from '../config/config.js';
|
|
4
4
|
import { loadConfig } from '../config/config-store.js';
|
|
5
|
+
import { resolveBearer } from '../credentials/credentials.js';
|
|
6
|
+
import { hasCredential, identityOf } from '../credentials/identity.js';
|
|
5
7
|
import { findExecutable } from '../core/which.js';
|
|
8
|
+
import { isDisabled } from '../storage/disabled.js';
|
|
6
9
|
import { loadInstallState } from '../storage/install-state.js';
|
|
7
10
|
import { resolvePaths } from '../storage/paths.js';
|
|
11
|
+
import { BackendAuthBlock } from '../transport/auth-block.js';
|
|
8
12
|
import { DeliveryStats } from '../transport/delivery-stats.js';
|
|
9
13
|
import { HttpTransport } from '../transport/http-transport.js';
|
|
10
14
|
import { EventQueue } from '../transport/queue.js';
|
|
11
|
-
import {
|
|
15
|
+
import { identityPaths, settleLegacyQueue } from '../transport/queue-partition.js';
|
|
16
|
+
import { applyRootOverride, credentialScope, servesMultipleIdentities } from '../config/root-config.js';
|
|
12
17
|
import { RE_NEEDS_QUOTING, RE_QUOTE_ESCAPE } from './constants/cli.constants.js';
|
|
13
18
|
/**
|
|
14
19
|
* Resolve everything a command needs from the environment.
|
|
@@ -22,29 +27,64 @@ import { RE_NEEDS_QUOTING, RE_QUOTE_ESCAPE } from './constants/cli.constants.js'
|
|
|
22
27
|
export async function buildCliContext(env) {
|
|
23
28
|
const paths = resolvePaths(env);
|
|
24
29
|
const configResult = await loadConfig(paths);
|
|
30
|
+
// Resolved once, here, because every identity-scoped file a command touches is
|
|
31
|
+
// named after the token the *hooks in this directory* use. `buildAuthBlock`
|
|
32
|
+
// reading the global token was a per-root block nothing could see or lift: a
|
|
33
|
+
// 401 under a root's own token wrote a block file under that token's
|
|
34
|
+
// fingerprint, `status` read the global one and printed nothing, and `doctor`
|
|
35
|
+
// proved the global credential good and cleared a block that was never the
|
|
36
|
+
// one standing. That root's telemetry stayed suspended with no diagnostic and
|
|
37
|
+
// no remedy, and a block only ends when a re-probe is accepted.
|
|
38
|
+
const rooted = applyRootOverride(configResult.config, env.cwd);
|
|
39
|
+
const scope = credentialScope(rooted.root);
|
|
25
40
|
return {
|
|
26
41
|
env,
|
|
42
|
+
disabled: await isDisabled(paths),
|
|
27
43
|
paths,
|
|
28
44
|
config: configResult.config,
|
|
45
|
+
identityConfig: rooted.config,
|
|
46
|
+
...(rooted.root === undefined ? {} : { identityRoot: rooted.root.path }),
|
|
47
|
+
...(scope === undefined ? {} : { credentialScope: scope }),
|
|
29
48
|
configState: configResult.state,
|
|
30
49
|
configError: configResult.state === 'invalid' ? configResult.error : undefined,
|
|
50
|
+
configWarnings: configResult.warnings,
|
|
31
51
|
installState: await loadInstallState(paths)
|
|
32
52
|
};
|
|
33
53
|
}
|
|
34
54
|
/**
|
|
35
55
|
* The offline queue for this context.
|
|
36
56
|
*
|
|
57
|
+
* Partitioned by the same token `buildTransport` signs with, so a command can
|
|
58
|
+
* only ever drain the backlog belonging to the identity it is sending as. A
|
|
59
|
+
* backlog written by a pre-partition edge is settled first, so `status`,
|
|
60
|
+
* `doctor` and setup's backlog report agree about what is in the partition.
|
|
61
|
+
*
|
|
37
62
|
* @param context - Resolved CLI context.
|
|
38
63
|
* @returns The queue.
|
|
39
64
|
*/
|
|
40
|
-
export function buildQueue(context) {
|
|
65
|
+
export async function buildQueue(context) {
|
|
66
|
+
// `config` for the multi-identity question and `identityConfig` for the
|
|
67
|
+
// partition, exactly as the hook path does it: whether the machine serves two
|
|
68
|
+
// bearers is a fact about the whole file, and which partition this command
|
|
69
|
+
// owns is a fact about where it was run.
|
|
70
|
+
await settleLegacyQueue(context.paths.queueDir, identityOf(context.identityConfig), servesMultipleIdentities(context.config));
|
|
71
|
+
return openIdentityQueue(context);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Open the selected partition without adopting or moving legacy records.
|
|
75
|
+
* Setup can inspect ownership and ask for consent without changing the queue.
|
|
76
|
+
* @param context - Resolved identity and storage paths.
|
|
77
|
+
* @returns A queue handle; construction performs no filesystem writes.
|
|
78
|
+
*/
|
|
79
|
+
export function openIdentityQueue(context) {
|
|
41
80
|
return new EventQueue({
|
|
42
|
-
queueDir: context.paths.queueDir,
|
|
81
|
+
queueDir: identityPaths(context.paths, identityOf(context.identityConfig)).queueDir,
|
|
43
82
|
locksDir: context.paths.locksDir,
|
|
44
|
-
maxEvents: context.
|
|
45
|
-
maxAttempts: context.
|
|
46
|
-
maxEventAgeDays: context.
|
|
47
|
-
now: context.env.now
|
|
83
|
+
maxEvents: context.identityConfig.delivery.maxQueueEvents,
|
|
84
|
+
maxAttempts: context.identityConfig.delivery.maxAttempts,
|
|
85
|
+
maxEventAgeDays: context.identityConfig.delivery.maxEventAgeDays,
|
|
86
|
+
now: context.env.now,
|
|
87
|
+
stats: buildDeliveryStats(context)
|
|
48
88
|
});
|
|
49
89
|
}
|
|
50
90
|
/**
|
|
@@ -54,7 +94,16 @@ export function buildQueue(context) {
|
|
|
54
94
|
* @returns The tally.
|
|
55
95
|
*/
|
|
56
96
|
export function buildDeliveryStats(context) {
|
|
57
|
-
return new DeliveryStats(
|
|
97
|
+
return new DeliveryStats(identityPaths(context.paths, identityOf(context.identityConfig)).statsFile, context.env.now, context.paths.locksDir);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The standing credential refusal for this context.
|
|
101
|
+
*
|
|
102
|
+
* @param context - Resolved CLI context.
|
|
103
|
+
* @returns The block.
|
|
104
|
+
*/
|
|
105
|
+
export function buildAuthBlock(context) {
|
|
106
|
+
return new BackendAuthBlock(identityPaths(context.paths, identityOf(context.identityConfig)).authBlockFile, context.env.now);
|
|
58
107
|
}
|
|
59
108
|
/**
|
|
60
109
|
* The transport for this context, when a backend is configured.
|
|
@@ -63,17 +112,38 @@ export function buildDeliveryStats(context) {
|
|
|
63
112
|
* @param timeoutMs - Override for the configured send timeout.
|
|
64
113
|
* @returns The transport, or undefined before setup has run.
|
|
65
114
|
*/
|
|
66
|
-
export function buildTransport(context, timeoutMs) {
|
|
67
|
-
|
|
68
|
-
|
|
115
|
+
export function buildTransport(context, timeoutMs, bearer) {
|
|
116
|
+
// The rooted identity throughout, so `doctor` probes the credential the hooks
|
|
117
|
+
// in this directory present and `status` drains the partition they fill. Only
|
|
118
|
+
// that credential can prove itself good, and only that proof may lift the
|
|
119
|
+
// block standing against it.
|
|
120
|
+
const url = eventsUrl(context.identityConfig);
|
|
121
|
+
if (!url || context.disabled)
|
|
69
122
|
return undefined;
|
|
70
123
|
return new HttpTransport({
|
|
71
124
|
eventsUrl: url,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
125
|
+
capture: context.identityConfig.capture,
|
|
126
|
+
token: bearer,
|
|
127
|
+
credentialPending: hasCredential(context.identityConfig) && !bearer,
|
|
128
|
+
installationId: context.identityConfig.installationId,
|
|
129
|
+
timeoutMs: timeoutMs ?? context.identityConfig.delivery.timeoutMs
|
|
75
130
|
});
|
|
76
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* The bearer this directory's hooks send, refreshed or exchanged when due.
|
|
134
|
+
*
|
|
135
|
+
* Separate from `buildCliContext` because only the commands that talk to the
|
|
136
|
+
* backend should pay for a keychain read or a gateway call.
|
|
137
|
+
*
|
|
138
|
+
* @param context - Resolved CLI context.
|
|
139
|
+
* @param timeoutMs - Ceiling for one keychain read or gateway call.
|
|
140
|
+
* @returns The bearer, or undefined when there is none to send.
|
|
141
|
+
*/
|
|
142
|
+
export async function resolveContextBearer(context, timeoutMs) {
|
|
143
|
+
if (context.disabled)
|
|
144
|
+
return undefined;
|
|
145
|
+
return resolveBearer({ env: context.env, paths: context.paths, timeoutMs, scope: context.credentialScope }, context.identityConfig);
|
|
146
|
+
}
|
|
77
147
|
/**
|
|
78
148
|
* The command agents should invoke for hook callbacks.
|
|
79
149
|
*
|