@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
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { SessionTitles } from './types/transcript.types.js';
|
|
2
|
+
import type { AgentProcessRecord, InheritedCheckoutMemo, SessionActivity, TurnRecord, TurnStateEntry, WorkCheckoutMemo } from './types/turn-state.types.js';
|
|
3
|
+
export type { CheckoutRecord, PromptRecord, ResponseRecord, SessionModelRecord, ToolRecord, TurnRecord, TurnStateEntry } from './types/turn-state.types.js';
|
|
3
4
|
/**
|
|
4
5
|
* Per-session accumulator for turn summaries.
|
|
5
6
|
*
|
|
@@ -67,7 +68,206 @@ export declare class TurnStateStore {
|
|
|
67
68
|
*/
|
|
68
69
|
claimedMessageIds(sessionId: string): Promise<Set<string>>;
|
|
69
70
|
/**
|
|
70
|
-
*
|
|
71
|
+
* Remember what model this session is on.
|
|
72
|
+
*
|
|
73
|
+
* Claude Code names its model on SessionStart alone, so the hook that gates a
|
|
74
|
+
* later prompt has no way to learn it from its own payload; the agents that do
|
|
75
|
+
* name it on every hook simply rewrite the same file. One file per session,
|
|
76
|
+
* beside the records, cleared with them.
|
|
77
|
+
*
|
|
78
|
+
* No timestamp: the sweep ages a session by its files' mtimes, and nothing
|
|
79
|
+
* else has a use for when the agent said it.
|
|
80
|
+
*
|
|
81
|
+
* @param sessionId - Provider session id.
|
|
82
|
+
* @param model - Model exactly as the collector spells it in reported usage.
|
|
83
|
+
*/
|
|
84
|
+
rememberModel(sessionId: string, model: string): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Forget which model a session was on.
|
|
87
|
+
*
|
|
88
|
+
* Called when a session starts naming no model, which is the one moment this
|
|
89
|
+
* store knows the memo must not be inherited. `clear` at SessionEnd swallows
|
|
90
|
+
* only ENOENT, so a cleanup that failed on anything else — EACCES, EBUSY, a
|
|
91
|
+
* full disk — leaves the memo behind; a session id that is then reused, as
|
|
92
|
+
* `--resume` does, would have its gate state the *previous* session's model.
|
|
93
|
+
* That is worse than stating none: it is a confident wrong answer on a path
|
|
94
|
+
* whose whole contract is that anything short of certainty allows the turn.
|
|
95
|
+
*
|
|
96
|
+
* @param sessionId - Provider session id.
|
|
97
|
+
*/
|
|
98
|
+
forgetModel(sessionId: string): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* The model last remembered for a session.
|
|
101
|
+
*
|
|
102
|
+
* Read on the gate path, where an answer is worth more than completeness: a
|
|
103
|
+
* file that is missing, unreadable or no longer the shape this code knows
|
|
104
|
+
* means the gate states no model, never that it waits or throws.
|
|
105
|
+
*
|
|
106
|
+
* @param sessionId - Provider session id.
|
|
107
|
+
* @returns The model, or undefined when none was usably remembered.
|
|
108
|
+
*/
|
|
109
|
+
readModel(sessionId: string): Promise<string | undefined>;
|
|
110
|
+
/**
|
|
111
|
+
* The names of a session's files, and nothing read: how a tool hook learns
|
|
112
|
+
* which checkouts its turn already named, for the price of one `readdir`.
|
|
113
|
+
*
|
|
114
|
+
* @param sessionId - Provider session id.
|
|
115
|
+
* @returns The file names; empty when the session has none.
|
|
116
|
+
*/
|
|
117
|
+
names(sessionId: string): Promise<string[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Remember the folder the session started in, once.
|
|
120
|
+
*
|
|
121
|
+
* The tenant and the no-roots boundary are asked of it, and the cwd each
|
|
122
|
+
* later hook reports follows the agent's `cd`. The first hook of a session
|
|
123
|
+
* writes it; every later one finds it there (`wx` fails, which is the point).
|
|
124
|
+
*
|
|
125
|
+
* @param sessionId - Provider session id.
|
|
126
|
+
* @param cwd - The first hook's cwd.
|
|
127
|
+
* @returns Whether this call created it, that is, whether this is the session's first hook.
|
|
128
|
+
*/
|
|
129
|
+
rememberStart(sessionId: string, cwd: string): Promise<boolean>;
|
|
130
|
+
/**
|
|
131
|
+
* Take the session's one billing fact.
|
|
132
|
+
*
|
|
133
|
+
* @param sessionId - Provider session id.
|
|
134
|
+
* @returns Whether this call took it, that is, whether the fact is still unsent.
|
|
135
|
+
*/
|
|
136
|
+
takeBillingFact(sessionId: string): Promise<boolean>;
|
|
137
|
+
/**
|
|
138
|
+
* Take the session's one notice for a checkout.
|
|
139
|
+
*
|
|
140
|
+
* @param sessionId - Provider session id.
|
|
141
|
+
* @param rootHash - Hash of the checkout root.
|
|
142
|
+
* @returns Whether this call took it, that is, whether the notice is still unshown.
|
|
143
|
+
*/
|
|
144
|
+
takeNotice(sessionId: string, rootHash: string): Promise<boolean>;
|
|
145
|
+
/**
|
|
146
|
+
* Remember the agent process the session runs in, and index it by pid.
|
|
147
|
+
*
|
|
148
|
+
* @param sessionId - Provider session id.
|
|
149
|
+
* @param agent - The agent's pid and start time.
|
|
150
|
+
*/
|
|
151
|
+
rememberAgentProcess(sessionId: string, agent: AgentProcessRecord): Promise<void>;
|
|
152
|
+
/**
|
|
153
|
+
* The session whose agent process this is.
|
|
154
|
+
*
|
|
155
|
+
* @param pid - A process id found among a child's ancestors.
|
|
156
|
+
* @returns The session id and the start time remembered with it, or undefined
|
|
157
|
+
* when none runs there. The caller compares the start time: a pid whose
|
|
158
|
+
* process started at another time is a reused pid, not that agent.
|
|
159
|
+
*/
|
|
160
|
+
sessionOfAgent(pid: number): Promise<{
|
|
161
|
+
sessionId: string;
|
|
162
|
+
started?: string;
|
|
163
|
+
} | undefined>;
|
|
164
|
+
/**
|
|
165
|
+
* Whether a session has been written to within `maxAgeMs`: not ended, not expired.
|
|
166
|
+
*
|
|
167
|
+
* @param sessionId - Provider session id.
|
|
168
|
+
* @param maxAgeMs - How recent its newest file must be.
|
|
169
|
+
* @returns True when the session's state is there and fresh.
|
|
170
|
+
*/
|
|
171
|
+
isLive(sessionId: string, maxAgeMs: number): Promise<boolean>;
|
|
172
|
+
/**
|
|
173
|
+
* Remember what this session inherited from the process that started it.
|
|
174
|
+
*
|
|
175
|
+
* @param sessionId - Provider session id.
|
|
176
|
+
* @param memo - The parent session and the nearest ancestor checkout.
|
|
177
|
+
*/
|
|
178
|
+
rememberInherited(sessionId: string, memo: InheritedCheckoutMemo): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* What this session inherited.
|
|
181
|
+
*
|
|
182
|
+
* @param sessionId - Provider session id.
|
|
183
|
+
* @returns The memo, or undefined when the first hook found nothing to inherit. A memo can hold no answer: `cuts` while a walk is to be tried again, or nothing after a retry found nothing.
|
|
184
|
+
*/
|
|
185
|
+
readInherited(sessionId: string): Promise<InheritedCheckoutMemo | undefined>;
|
|
186
|
+
/**
|
|
187
|
+
* The folder the session started in.
|
|
188
|
+
*
|
|
189
|
+
* @param sessionId - Provider session id.
|
|
190
|
+
* @returns The folder, or undefined when none was usably remembered.
|
|
191
|
+
*/
|
|
192
|
+
readStart(sessionId: string): Promise<string | undefined>;
|
|
193
|
+
/**
|
|
194
|
+
* Remember the session's titles, for a turn whose transcript tail no longer
|
|
195
|
+
* reaches a title entry.
|
|
196
|
+
*
|
|
197
|
+
* @param sessionId - Provider session id.
|
|
198
|
+
* @param titles - The custom and generated titles as the transcript holds them.
|
|
199
|
+
*/
|
|
200
|
+
rememberSessionTitles(sessionId: string, titles: SessionTitles): Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* The titles this session last had.
|
|
203
|
+
*
|
|
204
|
+
* @param sessionId - Provider session id.
|
|
205
|
+
* @returns The titles; empty when none were usably remembered.
|
|
206
|
+
*/
|
|
207
|
+
readSessionTitles(sessionId: string): Promise<SessionTitles>;
|
|
208
|
+
/**
|
|
209
|
+
* Remember the checkout this session's turn just changed.
|
|
210
|
+
*
|
|
211
|
+
* @param sessionId - Provider session id.
|
|
212
|
+
* @param memo - Its root, repository and when.
|
|
213
|
+
*/
|
|
214
|
+
rememberWorkCheckout(sessionId: string, memo: WorkCheckoutMemo): Promise<void>;
|
|
215
|
+
/**
|
|
216
|
+
* The checkout this session last changed.
|
|
217
|
+
*
|
|
218
|
+
* @param sessionId - Provider session id.
|
|
219
|
+
* @returns The memo, or undefined when none was usably remembered.
|
|
220
|
+
*/
|
|
221
|
+
readWorkCheckout(sessionId: string): Promise<WorkCheckoutMemo | undefined>;
|
|
222
|
+
/**
|
|
223
|
+
* What every other session still active on this machine has changed, for a
|
|
224
|
+
* turn that shares a checkout with them (SPEC §3a): the files its open turn's
|
|
225
|
+
* edit tools named, the branch each checkout its newest open turn named was
|
|
226
|
+
* on at first sight, and its last changed checkout with that turn's branch and
|
|
227
|
+
* files.
|
|
228
|
+
*
|
|
229
|
+
* Active means written to within `maxAgeMs` and not ended, the same test as
|
|
230
|
+
* {@link isLive}. A session whose state cannot be read counts as not active,
|
|
231
|
+
* so the turn behaves as it did before shared checkouts were told apart.
|
|
232
|
+
*
|
|
233
|
+
* ponytail: reads every live session's open records on each close — a
|
|
234
|
+
* `readdir` and a small file per record, no git. Upgrade path: an edit index
|
|
235
|
+
* per checkout root, written by the tool hooks.
|
|
236
|
+
*
|
|
237
|
+
* @param sessionId - The closing session, left out.
|
|
238
|
+
* @param maxAgeMs - How recent a session's newest file must be.
|
|
239
|
+
* @returns One entry per other active session.
|
|
240
|
+
*/
|
|
241
|
+
othersActivity(sessionId: string, maxAgeMs: number): Promise<SessionActivity[]>;
|
|
242
|
+
/**
|
|
243
|
+
* Remember the ticket keys the session's opening prompt named, once.
|
|
244
|
+
*
|
|
245
|
+
* Created exclusively, like the start folder: concurrent hooks cannot
|
|
246
|
+
* overwrite it, and a later prompt finds it there (`wx` fails, which is the
|
|
247
|
+
* point). An empty list is written too, so a session whose first prompt named
|
|
248
|
+
* no ticket is never claimed by a later one.
|
|
249
|
+
*
|
|
250
|
+
* @param sessionId - Provider session id.
|
|
251
|
+
* @param keys - The opening prompt's keys, possibly none.
|
|
252
|
+
* @returns Whether this call wrote it, that is, whether this was the opening prompt.
|
|
253
|
+
*/
|
|
254
|
+
rememberPromptTickets(sessionId: string, keys: readonly string[]): Promise<boolean>;
|
|
255
|
+
/**
|
|
256
|
+
* The ticket keys the session's opening prompt named.
|
|
257
|
+
*
|
|
258
|
+
* @param sessionId - Provider session id.
|
|
259
|
+
* @returns The string keys, at most `MAX_TICKET_KEYS`; empty when none was usably remembered.
|
|
260
|
+
*/
|
|
261
|
+
readPromptTickets(sessionId: string): Promise<readonly string[]>;
|
|
262
|
+
/**
|
|
263
|
+
* Drop a session's state at SessionEnd, all but its opening prompt's keys.
|
|
264
|
+
*
|
|
265
|
+
* `--resume` reuses the session id, and without the memo the resumed
|
|
266
|
+
* session's first prompt ("continue") would become its opening prompt and
|
|
267
|
+
* claim it with no keys. The memo holds keys only, never prompt text, and the
|
|
268
|
+
* expiry sweep removes it with the directory once it ages out — counted from
|
|
269
|
+
* SessionEnd, not from the opening prompt, so a session that ran all day can
|
|
270
|
+
* still be resumed the next morning.
|
|
71
271
|
*
|
|
72
272
|
* @param sessionId - Provider session id.
|
|
73
273
|
*/
|
|
@@ -78,9 +278,30 @@ export declare class TurnStateStore {
|
|
|
78
278
|
* Crashed or abandoned sessions never see a Stop or SessionEnd, and their
|
|
79
279
|
* raw prompt text must not sit on disk indefinitely.
|
|
80
280
|
*
|
|
281
|
+
* The session's model memo is one more file in that directory, and the age is
|
|
282
|
+
* the newest mtime in it, so remembering a model can only ever make a session
|
|
283
|
+
* look younger than its records — never older, and never sweepable while it is
|
|
284
|
+
* still being written to.
|
|
285
|
+
*
|
|
286
|
+
* Throttled by a marker in the state root: the walk used to run on every
|
|
287
|
+
* closing turn, which is hundreds of syscalls to learn that nothing had aged
|
|
288
|
+
* out. Removal now happens within the TTL plus the sweep interval, which is
|
|
289
|
+
* what the retention window's tolerance allows.
|
|
290
|
+
*
|
|
81
291
|
* @param maxAgeMs - Age past which a session is considered abandoned.
|
|
82
292
|
*/
|
|
83
293
|
sweep(maxAgeMs: number): Promise<void>;
|
|
294
|
+
/**
|
|
295
|
+
* Drop the pid entries whose session is gone or idle past the cutoff.
|
|
296
|
+
*
|
|
297
|
+
* By the session's own freshness, not the entry's: the entry is written once,
|
|
298
|
+
* by the session's first hook, and a long-lived parent outlasts its mtime.
|
|
299
|
+
*
|
|
300
|
+
* @param dir - The agent pid index.
|
|
301
|
+
* @param cutoff - Epoch milliseconds; a session idle since before this is abandoned.
|
|
302
|
+
*/
|
|
303
|
+
private pruneAgentPids;
|
|
304
|
+
private pidFile;
|
|
84
305
|
/**
|
|
85
306
|
* Directory holding one session's state.
|
|
86
307
|
*
|