@visual-z/xeno 0.8.3 → 0.9.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 +24 -0
- package/README.md +31 -746
- package/bin/xeno.exe +26 -0
- package/install.cjs +88 -0
- package/package.json +18 -48
- package/docs/app-server.md +0 -115
- package/docs/foundations.md +0 -88
- package/docs/install.md +0 -244
- package/docs/providers.md +0 -172
- package/docs/research/foundation-clients-2026-10-09.md +0 -27
- package/docs/research/foundation-editing-2026-10-09.md +0 -56
- package/docs/research/foundation-network-2026-10-09.md +0 -37
- package/docs/research/foundation-workflow-2026-10-09.md +0 -37
- package/src/apps/acp-server.ts +0 -41
- package/src/apps/agent-profiles.ts +0 -19
- package/src/apps/app-server.ts +0 -30
- package/src/apps/approve.ts +0 -49
- package/src/apps/cli.ts +0 -99
- package/src/apps/commands.ts +0 -319
- package/src/apps/completions.ts +0 -87
- package/src/apps/control-transport.ts +0 -90
- package/src/apps/export-cli.ts +0 -24
- package/src/apps/goal-flow.ts +0 -70
- package/src/apps/image-draft.ts +0 -46
- package/src/apps/input.ts +0 -312
- package/src/apps/model-catalog.ts +0 -69
- package/src/apps/preferences.ts +0 -20
- package/src/apps/project-trust.ts +0 -9
- package/src/apps/provider-connect.ts +0 -346
- package/src/apps/question-ui.ts +0 -27
- package/src/apps/render.ts +0 -181
- package/src/apps/resources.ts +0 -66
- package/src/apps/review.ts +0 -109
- package/src/apps/session-hub.ts +0 -96
- package/src/apps/session-lifecycle.ts +0 -64
- package/src/apps/shell.ts +0 -2066
- package/src/apps/startup-input.ts +0 -135
- package/src/apps/startup.ts +0 -1677
- package/src/apps/ui/app.ts +0 -1713
- package/src/apps/ui/control-model.ts +0 -43
- package/src/apps/ui/extension-host.ts +0 -194
- package/src/apps/ui/image-cache.ts +0 -121
- package/src/apps/ui/palette.ts +0 -88
- package/src/apps/ui/project.ts +0 -127
- package/src/apps/ui/standalone.ts +0 -148
- package/src/apps/ui/status-model.ts +0 -68
- package/src/apps/ui/surface.ts +0 -91
- package/src/apps/ui/theme.ts +0 -86
- package/src/apps/update-check.ts +0 -112
- package/src/apps/workflow.ts +0 -58
- package/src/core/acceptance.ts +0 -139
- package/src/core/action-defaults.ts +0 -58
- package/src/core/activity-status.ts +0 -52
- package/src/core/agent-profile.ts +0 -130
- package/src/core/attachment-input.ts +0 -17
- package/src/core/blind-checks.ts +0 -72
- package/src/core/boundary.ts +0 -174
- package/src/core/branch-receipt.ts +0 -26
- package/src/core/catalog-merge.ts +0 -19
- package/src/core/checkpoints.ts +0 -85
- package/src/core/churn.ts +0 -61
- package/src/core/command-artifacts.ts +0 -94
- package/src/core/command-contract.ts +0 -151
- package/src/core/completion-action.ts +0 -20
- package/src/core/completion-review.ts +0 -98
- package/src/core/context-detail.ts +0 -37
- package/src/core/context-policy.ts +0 -133
- package/src/core/context-window.ts +0 -54
- package/src/core/continuation.ts +0 -130
- package/src/core/control-protocol.ts +0 -69
- package/src/core/control-view.ts +0 -39
- package/src/core/cycle.ts +0 -17
- package/src/core/data-query.ts +0 -201
- package/src/core/deadline.ts +0 -40
- package/src/core/derive.ts +0 -516
- package/src/core/draft-images.ts +0 -56
- package/src/core/edit-plan.ts +0 -200
- package/src/core/environment.ts +0 -181
- package/src/core/event-validation.ts +0 -220
- package/src/core/events.ts +0 -670
- package/src/core/evidence-ladder.ts +0 -62
- package/src/core/evidence-links.ts +0 -68
- package/src/core/evidence.ts +0 -240
- package/src/core/execution.ts +0 -18
- package/src/core/exhaustive.ts +0 -18
- package/src/core/export.ts +0 -179
- package/src/core/extension-flags.ts +0 -14
- package/src/core/external-effects.ts +0 -488
- package/src/core/failure-recovery.ts +0 -173
- package/src/core/file-precondition.ts +0 -78
- package/src/core/file-references.ts +0 -35
- package/src/core/frontmatter.ts +0 -213
- package/src/core/git-status.ts +0 -29
- package/src/core/goal-view.ts +0 -64
- package/src/core/goal.ts +0 -200
- package/src/core/handoff.ts +0 -479
- package/src/core/history-query.ts +0 -139
- package/src/core/history.ts +0 -237
- package/src/core/image-limits.ts +0 -72
- package/src/core/images.ts +0 -46
- package/src/core/integration-health.ts +0 -34
- package/src/core/json-event.ts +0 -131
- package/src/core/json-pointer.ts +0 -46
- package/src/core/keymap.ts +0 -153
- package/src/core/lsp-framing.ts +0 -34
- package/src/core/mcp-config.ts +0 -68
- package/src/core/model-picker.ts +0 -64
- package/src/core/model-preferences.ts +0 -28
- package/src/core/model-replay.ts +0 -22
- package/src/core/model-scope.ts +0 -53
- package/src/core/note-guidance.ts +0 -34
- package/src/core/oauth-fields.ts +0 -44
- package/src/core/observation-view.ts +0 -152
- package/src/core/outcome.ts +0 -44
- package/src/core/overflow.ts +0 -59
- package/src/core/packages.ts +0 -47
- package/src/core/patch.ts +0 -130
- package/src/core/path-suggestions.ts +0 -59
- package/src/core/permissions.ts +0 -410
- package/src/core/process-receipt.ts +0 -105
- package/src/core/process-state.ts +0 -37
- package/src/core/program-status.ts +0 -40
- package/src/core/progress.ts +0 -150
- package/src/core/project.ts +0 -431
- package/src/core/prompt-policy.ts +0 -46
- package/src/core/prompts.ts +0 -111
- package/src/core/question.ts +0 -94
- package/src/core/queue.ts +0 -78
- package/src/core/read-bounds.ts +0 -24
- package/src/core/read-observation.ts +0 -106
- package/src/core/recovery-sources.ts +0 -74
- package/src/core/regex-dialect.ts +0 -25
- package/src/core/request-budget.ts +0 -23
- package/src/core/request-progress.ts +0 -87
- package/src/core/request-state.ts +0 -273
- package/src/core/resource-selection.ts +0 -36
- package/src/core/response-recovery.ts +0 -59
- package/src/core/resume.ts +0 -59
- package/src/core/review.ts +0 -68
- package/src/core/ripgrep-release.ts +0 -64
- package/src/core/runtime-target.ts +0 -94
- package/src/core/scheduling.ts +0 -8
- package/src/core/search-observation.ts +0 -97
- package/src/core/secrets.ts +0 -188
- package/src/core/session-archive.ts +0 -4
- package/src/core/session-browser.ts +0 -82
- package/src/core/session-entry.ts +0 -61
- package/src/core/session-exit.ts +0 -42
- package/src/core/session-format.ts +0 -169
- package/src/core/session-position.ts +0 -26
- package/src/core/session-tree.ts +0 -147
- package/src/core/settings.ts +0 -192
- package/src/core/skills.ts +0 -165
- package/src/core/sql-query.ts +0 -211
- package/src/core/stall.ts +0 -128
- package/src/core/stop-report.ts +0 -68
- package/src/core/text-normalize.ts +0 -81
- package/src/core/theme.ts +0 -166
- package/src/core/thinking.ts +0 -26
- package/src/core/tokens.ts +0 -151
- package/src/core/tool-contract.ts +0 -153
- package/src/core/tool-discovery.ts +0 -87
- package/src/core/tool-failure.ts +0 -81
- package/src/core/tool-input.ts +0 -44
- package/src/core/transcript.ts +0 -108
- package/src/core/tui-mode.ts +0 -29
- package/src/core/update-check.ts +0 -157
- package/src/core/version.ts +0 -55
- package/src/core/web-content.ts +0 -80
- package/src/core/work-state.ts +0 -154
- package/src/core/workflow-mode.ts +0 -34
- package/src/core/working-set.ts +0 -119
- package/src/core/yaml.ts +0 -282
- package/src/runtime/acp-agent.ts +0 -289
- package/src/runtime/agent-profiles.ts +0 -21
- package/src/runtime/auth.ts +0 -367
- package/src/runtime/blind-check.ts +0 -36
- package/src/runtime/branch-jobs.ts +0 -36
- package/src/runtime/catalog.ts +0 -285
- package/src/runtime/clipboard.ts +0 -125
- package/src/runtime/command-artifacts.ts +0 -64
- package/src/runtime/connection-reuse.ts +0 -40
- package/src/runtime/control-client.ts +0 -149
- package/src/runtime/control-connection.ts +0 -139
- package/src/runtime/counter-check.ts +0 -74
- package/src/runtime/environment-tools.ts +0 -60
- package/src/runtime/evidence-notes.ts +0 -35
- package/src/runtime/exec-sessions.ts +0 -456
- package/src/runtime/execution-control.ts +0 -40
- package/src/runtime/extension-loader.ts +0 -37
- package/src/runtime/extension-ui.ts +0 -47
- package/src/runtime/extensions.ts +0 -370
- package/src/runtime/formatter-tool.ts +0 -38
- package/src/runtime/formatter.ts +0 -50
- package/src/runtime/foundation.ts +0 -116
- package/src/runtime/history-cache.ts +0 -57
- package/src/runtime/history-tools.ts +0 -168
- package/src/runtime/images.ts +0 -80
- package/src/runtime/integrations.ts +0 -216
- package/src/runtime/loop.ts +0 -3001
- package/src/runtime/lsp-client.ts +0 -201
- package/src/runtime/mcp-client.ts +0 -264
- package/src/runtime/mcp-oauth.ts +0 -168
- package/src/runtime/mcp-schema.ts +0 -51
- package/src/runtime/model-config.ts +0 -232
- package/src/runtime/model-data.LICENSE +0 -27
- package/src/runtime/model-data.ts +0 -21
- package/src/runtime/model-discovery.ts +0 -208
- package/src/runtime/model-replay.ts +0 -10
- package/src/runtime/model-scope.ts +0 -20
- package/src/runtime/model-sources.ts +0 -151
- package/src/runtime/model.ts +0 -686
- package/src/runtime/models-fetch.ts +0 -57
- package/src/runtime/oauth-device.ts +0 -86
- package/src/runtime/oauth.ts +0 -853
- package/src/runtime/open-image.ts +0 -42
- package/src/runtime/openai-responses.ts +0 -304
- package/src/runtime/openai.ts +0 -697
- package/src/runtime/output-schema.ts +0 -26
- package/src/runtime/package-manager.ts +0 -125
- package/src/runtime/patch-tool.ts +0 -38
- package/src/runtime/permission-resources.ts +0 -18
- package/src/runtime/pi-provider.ts +0 -423
- package/src/runtime/program-status.ts +0 -38
- package/src/runtime/progress.ts +0 -26
- package/src/runtime/provider-access.ts +0 -21
- package/src/runtime/provider-connect.ts +0 -109
- package/src/runtime/provider-presets.ts +0 -98
- package/src/runtime/provider-protocols.ts +0 -29
- package/src/runtime/provider-request.ts +0 -87
- package/src/runtime/provider-tool-policy.ts +0 -33
- package/src/runtime/provider.ts +0 -580
- package/src/runtime/question-tool.ts +0 -62
- package/src/runtime/retry.ts +0 -447
- package/src/runtime/review-tool.ts +0 -48
- package/src/runtime/rich-text.ts +0 -36
- package/src/runtime/runtime-target.ts +0 -149
- package/src/runtime/secrets.ts +0 -79
- package/src/runtime/self-update.ts +0 -74
- package/src/runtime/session-control.ts +0 -265
- package/src/runtime/session-hub.ts +0 -85
- package/src/runtime/stream-idle.ts +0 -80
- package/src/runtime/tool-broker.ts +0 -137
- package/src/runtime/tool-discovery.ts +0 -58
- package/src/runtime/tool-queue.ts +0 -77
- package/src/runtime/tools.ts +0 -1820
- package/src/runtime/turn-effects.ts +0 -31
- package/src/runtime/update-check.ts +0 -48
- package/src/runtime/usage.ts +0 -253
- package/src/runtime/version.ts +0 -12
- package/src/runtime/web-http.ts +0 -56
- package/src/runtime/web-tools.ts +0 -88
- package/src/runtime/working-notes.ts +0 -60
- package/src/runtime/workspace-lifecycle.ts +0 -141
- package/src/store/acceptance.ts +0 -15
- package/src/store/agent-profile-files.ts +0 -13
- package/src/store/atomic.ts +0 -31
- package/src/store/auth-store.ts +0 -50
- package/src/store/blind-checks.ts +0 -32
- package/src/store/blobs.ts +0 -143
- package/src/store/checkpoint-history.ts +0 -32
- package/src/store/command-artifacts.ts +0 -96
- package/src/store/command.ts +0 -111
- package/src/store/config.ts +0 -69
- package/src/store/context-files.ts +0 -436
- package/src/store/file-checkpoints.ts +0 -108
- package/src/store/file-index.ts +0 -174
- package/src/store/foundation-config.ts +0 -24
- package/src/store/git-checkpoints.ts +0 -67
- package/src/store/git-status.ts +0 -15
- package/src/store/history-search.ts +0 -19
- package/src/store/log.ts +0 -725
- package/src/store/lsp-document.ts +0 -30
- package/src/store/mcp-credentials.ts +0 -85
- package/src/store/models.ts +0 -60
- package/src/store/observations.ts +0 -224
- package/src/store/packages.ts +0 -98
- package/src/store/patch.ts +0 -92
- package/src/store/permission-paths.ts +0 -34
- package/src/store/process-receipts.ts +0 -34
- package/src/store/query-source.ts +0 -49
- package/src/store/recovery.ts +0 -44
- package/src/store/replay.ts +0 -76
- package/src/store/resource-index.ts +0 -170
- package/src/store/resources.ts +0 -285
- package/src/store/restore.ts +0 -110
- package/src/store/review.ts +0 -109
- package/src/store/runtime-target.ts +0 -64
- package/src/store/search.ts +0 -728
- package/src/store/secrets.ts +0 -44
- package/src/store/serial.ts +0 -13
- package/src/store/session-archive.ts +0 -165
- package/src/store/session-browser.ts +0 -68
- package/src/store/session-position.ts +0 -27
- package/src/store/sessions.ts +0 -525
- package/src/store/source-cancellation.ts +0 -6
- package/src/store/tool-binaries.ts +0 -90
- package/src/store/trust.ts +0 -82
- package/src/store/update-cache.ts +0 -36
- package/src/store/user-settings.ts +0 -30
- package/src/store/workspace-clone.ts +0 -42
- package/src/store/workspace-observation.ts +0 -113
- package/src/store/workspace.ts +0 -115
- package/src/store/worktree.ts +0 -278
- package/src/tui/ansi-spans.ts +0 -126
- package/src/tui/diff.ts +0 -160
- package/src/tui/exhaustive.ts +0 -14
- package/src/tui/fuzzy.ts +0 -75
- package/src/tui/style.ts +0 -208
- package/src/tui/ui/atomic-draft.ts +0 -121
- package/src/tui/ui/canvas.ts +0 -96
- package/src/tui/ui/colors.ts +0 -70
- package/src/tui/ui/composer.ts +0 -200
- package/src/tui/ui/control-panel.ts +0 -25
- package/src/tui/ui/control-sidebar.ts +0 -49
- package/src/tui/ui/dialog.ts +0 -398
- package/src/tui/ui/draft.ts +0 -23
- package/src/tui/ui/duration.ts +0 -16
- package/src/tui/ui/edge.ts +0 -186
- package/src/tui/ui/image-size.ts +0 -44
- package/src/tui/ui/ink.ts +0 -210
- package/src/tui/ui/items.ts +0 -42
- package/src/tui/ui/keys.ts +0 -40
- package/src/tui/ui/layout.ts +0 -74
- package/src/tui/ui/list-model.ts +0 -86
- package/src/tui/ui/list-view.ts +0 -172
- package/src/tui/ui/mascot.ts +0 -67
- package/src/tui/ui/messages.ts +0 -518
- package/src/tui/ui/motion.ts +0 -28
- package/src/tui/ui/paths.ts +0 -10
- package/src/tui/ui/pictures.ts +0 -108
- package/src/tui/ui/screen.ts +0 -548
- package/src/tui/ui/status.ts +0 -403
- package/src/tui/ui/styled.ts +0 -85
- package/src/tui/ui/tool-card.ts +0 -150
- package/src/tui/width.ts +0 -567
- package/src/vendor/pi-rich/LICENSE.upstream +0 -21
- package/src/vendor/pi-rich/UPSTREAM.json +0 -17
- package/src/vendor/pi-rich/clipboard-command.ts +0 -44
- package/src/vendor/pi-rich/exif-orientation.ts +0 -182
- package/src/vendor/pi-rich/html.ts +0 -51
- package/src/vendor/pi-rich/image-convert.ts +0 -49
- package/src/vendor/pi-rich/image-resize-core.ts +0 -164
- package/src/vendor/pi-rich/image-resize-worker.ts +0 -42
- package/src/vendor/pi-rich/image-resize.ts +0 -123
- package/src/vendor/pi-rich/mime.ts +0 -116
- package/src/vendor/pi-rich/photon.ts +0 -139
- package/src/vendor/pi-rich/syntax-highlight.ts +0 -214
package/src/core/events.ts
DELETED
|
@@ -1,670 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Append-only event log types.
|
|
3
|
-
*
|
|
4
|
-
* Two hard rules, both load-bearing:
|
|
5
|
-
*
|
|
6
|
-
* 1. APPEND REFERENCES, NEVER COPIES (decision D8). A `cut` event stores the id of
|
|
7
|
-
* the handoff it produced and a ref to its predecessor segment -- never the
|
|
8
|
-
* history it replaces. Codex CLI re-embeds the full `replacement_history` into
|
|
9
|
-
* its rollout JSONL on every compaction, which is O(n^2) on disk and has been
|
|
10
|
-
* reported to reach 42 GB (openai/codex#41806). The rule exists to make that
|
|
11
|
-
* shape unrepresentable.
|
|
12
|
-
*
|
|
13
|
-
* 2. HARNESS-DERIVED VS MODEL-ANNOTATED. Harness events are produced from things
|
|
14
|
-
* that cannot be wrong: the user typed this, the tool exited with this code.
|
|
15
|
-
* Model-annotated events are optional, may be wrong, and always have a
|
|
16
|
-
* deterministic fallback. Nothing load-bearing depends on the model's honesty --
|
|
17
|
-
* in particular, verification comes from exit codes, never from the model
|
|
18
|
-
* saying the tests passed.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
import type { ExecutionOutcome } from "./outcome.ts";
|
|
22
|
-
import type { ImageRef } from "./images.ts";
|
|
23
|
-
import type { JsonValue, ToolDiagnostic } from "./tool-contract.ts";
|
|
24
|
-
import type { AcceptanceContract } from "./acceptance.ts";
|
|
25
|
-
import type { CheckpointEvent, WorkspaceObservationEvent } from "./checkpoints.ts";
|
|
26
|
-
import type { ObservationReceipt } from "./read-observation.ts";
|
|
27
|
-
import type { CommandArtifactReceipt } from "./command-artifacts.ts";
|
|
28
|
-
import type { RuntimeTargetReceipt } from "./runtime-target.ts";
|
|
29
|
-
|
|
30
|
-
export type EventId = string;
|
|
31
|
-
export type Sha256 = string;
|
|
32
|
-
export type IsoTime = string;
|
|
33
|
-
|
|
34
|
-
/** Inclusive 1-indexed line range, matching how editors and tools report them. */
|
|
35
|
-
export type LineRange = readonly [start: number, end: number];
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* A pointer to one node of the session tree.
|
|
39
|
-
*
|
|
40
|
-
* A single parent pointer is what makes the log a tree rather than a list --
|
|
41
|
-
* the linear case is the degenerate tree where every node has exactly one
|
|
42
|
-
* child. `node` is the ALLOCATION number, not a position in the tree:
|
|
43
|
-
* structure lives only in parent pointers, the way a commit hash is an
|
|
44
|
-
* identity and the parent link is the shape.
|
|
45
|
-
*/
|
|
46
|
-
export type NodeRef = {
|
|
47
|
-
node: number;
|
|
48
|
-
log_ref: string;
|
|
49
|
-
sha256: Sha256;
|
|
50
|
-
/**
|
|
51
|
-
* Where in the parent this node branched off. Omitted means the parent's
|
|
52
|
-
* current end.
|
|
53
|
-
*
|
|
54
|
-
* An event id rather than a turn index. An index is only stable while
|
|
55
|
-
* nothing upstream can be inserted, edited or compacted, and while that
|
|
56
|
-
* holds inside a node today it is a property of the storage rather than of
|
|
57
|
-
* the pointer. The id already exists, is already unique, and gives one more
|
|
58
|
-
* thing for free: a pointer at an event that is not there can be detected,
|
|
59
|
-
* where an out-of-range index can only be range-checked.
|
|
60
|
-
*/
|
|
61
|
-
at_event?: EventId;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// ---------------------------------------------------------------------------
|
|
65
|
-
// Effects: what a tool call actually did, as classified by the tool registry.
|
|
66
|
-
// ---------------------------------------------------------------------------
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* `gate` is attached by the harness from configured gate patterns, not guessed
|
|
70
|
-
* from the command text. A command with no configured gate is still recorded --
|
|
71
|
-
* it just counts as weaker evidence than a named gate.
|
|
72
|
-
*/
|
|
73
|
-
export type Effect =
|
|
74
|
-
| { kind: "read"; path: string; sha256: Sha256; ranges?: readonly LineRange[] }
|
|
75
|
-
| { kind: "edit"; path: string; sha256_before: Sha256 | null; sha256_after: Sha256 }
|
|
76
|
-
| { kind: "command"; cmd: string; exit: number; gate?: string; workspace_sha256?: Sha256; workspace_observed?: boolean; workspace_scope?: "source-v1"; artifacts?: CommandArtifactReceipt };
|
|
77
|
-
|
|
78
|
-
// ---------------------------------------------------------------------------
|
|
79
|
-
// Harness-derived events
|
|
80
|
-
// ---------------------------------------------------------------------------
|
|
81
|
-
|
|
82
|
-
export interface UserEvent {
|
|
83
|
-
t: "user";
|
|
84
|
-
id: EventId;
|
|
85
|
-
at: IsoTime;
|
|
86
|
-
text: string;
|
|
87
|
-
/** Q23: in-flight steering belongs to this original user event; legacy events open a request. */
|
|
88
|
-
request?: EventId;
|
|
89
|
-
images?: readonly ImageRef[];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/** User-authorized shell execution is distinct from a model tool invocation (Pi !/!!). */
|
|
93
|
-
export interface UserBashEvent {
|
|
94
|
-
t: "user_bash";
|
|
95
|
-
id: EventId;
|
|
96
|
-
at: IsoTime;
|
|
97
|
-
command: string;
|
|
98
|
-
content: string;
|
|
99
|
-
exit: number;
|
|
100
|
-
excludeFromContext: boolean;
|
|
101
|
-
outcome: ExecutionOutcome;
|
|
102
|
-
content_ref: ArtifactRef;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/** A terminal execution fact; human history must not turn a truncated answer into success. */
|
|
106
|
-
export interface OutcomeEvent {
|
|
107
|
-
t: "outcome";
|
|
108
|
-
id: EventId;
|
|
109
|
-
at: IsoTime;
|
|
110
|
-
reason: string;
|
|
111
|
-
outcome: ExecutionOutcome;
|
|
112
|
-
/** Why a failed request failed; absent on success and in logs written before it existed. */
|
|
113
|
-
failure?: FailureCause;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Credential-free facts about a failure (PLAYBOOK: provider error text never
|
|
118
|
-
* reaches the log). `label` is a phrase from retry.ts's fixed vocabulary or an
|
|
119
|
-
* error class name -- both chosen by code, never copied from a response body.
|
|
120
|
-
*/
|
|
121
|
-
export interface FailureCause {
|
|
122
|
-
/** provider: the model request failed after its retries; harness: xeno itself threw. */
|
|
123
|
-
source: "provider" | "harness";
|
|
124
|
-
label: string;
|
|
125
|
-
status?: number;
|
|
126
|
-
/** Retries the adapter actually made before giving up. */
|
|
127
|
-
retries?: number;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** A factual harness notice, appended once rather than rewriting the prompt (N.1). */
|
|
131
|
-
export interface GuidanceEvent {
|
|
132
|
-
t: "guidance";
|
|
133
|
-
id: EventId;
|
|
134
|
-
at: IsoTime;
|
|
135
|
-
reason: "continuation" | "repetition" | "budget" | "boundary" | "stall" | "output_recovery" | "completion_review" | "churn" | "deadline" | "runtime_acceptance" | "goal" | "secret";
|
|
136
|
-
text: string;
|
|
137
|
-
sources: readonly EventId[];
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* The user cancelled the turn that `user_id` opened.
|
|
142
|
-
*
|
|
143
|
-
* A later record, not a flag on that user event: the cancel happened after
|
|
144
|
-
* the prompt was written, and rewriting a committed event would violate
|
|
145
|
-
* append-only (D8). Only harness-observable facts are stored -- which prompt
|
|
146
|
-
* and when -- never the partial assistant text, which was never delivered.
|
|
147
|
-
* A cancelled generation is not a conversation that happened (same rule as
|
|
148
|
-
* AGENT_PLAYBOOK "凭证与错误文本": a failed request is not a conversation).
|
|
149
|
-
*/
|
|
150
|
-
export interface InterruptEvent {
|
|
151
|
-
t: "interrupt";
|
|
152
|
-
id: EventId;
|
|
153
|
-
at: IsoTime;
|
|
154
|
-
/** The user event whose turn was cancelled. */
|
|
155
|
-
user_id: EventId;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Only the shapes the projection needs to replay a turn.
|
|
160
|
-
*
|
|
161
|
-
* A thinking block carries the provider's opaque fields alongside its text.
|
|
162
|
-
* They must be replayed byte-for-byte: the API rejects blocks whose content
|
|
163
|
-
* was modified, and a block whose text is empty still has to go back verbatim.
|
|
164
|
-
* Keeping only the text would drop the signature and fail the next request --
|
|
165
|
-
* so the raw block is kept under `raw` and replayed untouched, while `text` is
|
|
166
|
-
* what a UI renders.
|
|
167
|
-
*/
|
|
168
|
-
export type AssistantBlock =
|
|
169
|
-
| { type: "text"; text: string; wire?: unknown }
|
|
170
|
-
| { type: "thinking"; text: string; raw: unknown }
|
|
171
|
-
/**
|
|
172
|
-
* `wire` is the provider's own per-call data beyond id, name and arguments
|
|
173
|
-
* (Gemini's thought signature), replayed verbatim like a thinking block's raw.
|
|
174
|
-
*/
|
|
175
|
-
| { type: "tool_use"; call_id: string; name: string; input: unknown; wire?: unknown };
|
|
176
|
-
|
|
177
|
-
export interface AssistantEvent {
|
|
178
|
-
t: "assistant";
|
|
179
|
-
id: EventId;
|
|
180
|
-
at: IsoTime;
|
|
181
|
-
blocks: readonly AssistantBlock[];
|
|
182
|
-
/** N.12: provider-observed termination, never a claim of task completion. Legacy logs omit it. */
|
|
183
|
-
stop_reason?: string | null;
|
|
184
|
-
/** D8: opaque digest of the wire profile that produced signed blocks; no credentials. */
|
|
185
|
-
replay_key?: string;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export interface ToolResultEvent {
|
|
189
|
-
t: "tool_result";
|
|
190
|
-
id: EventId;
|
|
191
|
-
at: IsoTime;
|
|
192
|
-
call_id: string;
|
|
193
|
-
/** Trusted host execution has no provider tool_use and is excluded from provider replay. */
|
|
194
|
-
origin?: "extension";
|
|
195
|
-
/** Pi A: nested observations remain evidence without creating provider-visible tool pairs. */
|
|
196
|
-
parent_call_id?: string;
|
|
197
|
-
invocation_ref?: { node: number; event: EventId };
|
|
198
|
-
ok: boolean;
|
|
199
|
-
/** What the model sees. Large payloads belong on disk, referenced by effect. */
|
|
200
|
-
content: string;
|
|
201
|
-
images?: readonly ImageRef[];
|
|
202
|
-
/** Digest of the complete observation, even when it fits inline in the log. */
|
|
203
|
-
content_sha256?: Sha256;
|
|
204
|
-
/** O.3: semantic observation digest excludes presentation metadata. */
|
|
205
|
-
observation_sha256?: Sha256;
|
|
206
|
-
/** R2: exact preview coverage and immutable source identity; old logs omit this receipt. */
|
|
207
|
-
observation?: ObservationReceipt;
|
|
208
|
-
content_ref?: ArtifactRef;
|
|
209
|
-
effect?: Effect;
|
|
210
|
-
/** O.1: actual termination, independent of effect/verification; legacy logs omit it. */
|
|
211
|
-
outcome?: ExecutionOutcome;
|
|
212
|
-
/** O.3: machine-readable observations and recovery hints, not additional proof. */
|
|
213
|
-
data?: JsonValue;
|
|
214
|
-
/** Pi A: large structured results stay recoverable without bloating each JSONL event. */
|
|
215
|
-
data_ref?: ArtifactRef;
|
|
216
|
-
diagnostic?: ToolDiagnostic;
|
|
217
|
-
/** Post-operation observer failures cannot erase the operation's factual result. */
|
|
218
|
-
warnings?: readonly ToolDiagnostic[];
|
|
219
|
-
/**
|
|
220
|
-
* S.6 item 3: scoped instructions first discovered by this read-only call,
|
|
221
|
-
* shown after its content. Keys identify the accepted versions on resume.
|
|
222
|
-
*/
|
|
223
|
-
instructions?: { keys: readonly string[]; text: string };
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export type ArtifactRef = { sha256: Sha256; path: string; bytes: number };
|
|
227
|
-
|
|
228
|
-
/** Pi A: an invocation is durable before its admitted action may start. */
|
|
229
|
-
export interface ToolInvocationEvent {
|
|
230
|
-
t: "tool_invocation"; id: EventId; at: IsoTime;
|
|
231
|
-
call_id: string; name: string; parent_call_id?: string;
|
|
232
|
-
origin?: "extension";
|
|
233
|
-
parent_ref?: { node: number; event: EventId };
|
|
234
|
-
/** Original request and the exact declarative contract are independently recoverable. */
|
|
235
|
-
input_ref: ArtifactRef;
|
|
236
|
-
schema_ref: ArtifactRef | null;
|
|
237
|
-
/** Bounded actual arguments; absent for a direct unchanged request or an oversized refusal. */
|
|
238
|
-
input?: JsonValue;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/** Terminates the segment it appears in. Carries refs only -- see rule 1 above. */
|
|
242
|
-
export interface CutEvent {
|
|
243
|
-
t: "cut";
|
|
244
|
-
id: EventId;
|
|
245
|
-
at: IsoTime;
|
|
246
|
-
handoff_ref: string;
|
|
247
|
-
predecessor: NodeRef | null;
|
|
248
|
-
reason: CutReason;
|
|
249
|
-
/** Durable transition intent; recovery opens this exact successor. */
|
|
250
|
-
next_node?: number;
|
|
251
|
-
next_model?: string;
|
|
252
|
-
/** Paired with next_model so crash recovery preserves the selected provider. */
|
|
253
|
-
next_provider?: string;
|
|
254
|
-
/** The successor request effort is durable even if the adapter has not been installed. */
|
|
255
|
-
next_thinking?: string;
|
|
256
|
-
/** D6: resource reload activates this frozen context only in the successor. */
|
|
257
|
-
next_context_ref?: Sha256;
|
|
258
|
-
/** V2 carried-state budget, fixed in the log for identical replay. */
|
|
259
|
-
handoff_tokens?: number;
|
|
260
|
-
/** O.10: absent preserves the original D20 carried projection. */
|
|
261
|
-
/** R9: present when the source-priority working set was carried across this cut. */
|
|
262
|
-
/** 3: user turns are carried before other pages, with image references and one copy of each next action. */
|
|
263
|
-
working_set_version?: 2 | 3;
|
|
264
|
-
/** R10: declared builtin advice capabilities at this cut, not an authorization grant. Absent replays old text. */
|
|
265
|
-
guidance_tools?: readonly string[];
|
|
266
|
-
/** N.8: first retained event on the effective ancestry; no copied transcript. */
|
|
267
|
-
retained_from?: EventId;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export type CutReason = "hard_limit" | "trigger" | "model_checkpoint";
|
|
271
|
-
|
|
272
|
-
// ---------------------------------------------------------------------------
|
|
273
|
-
// Model-annotated events (optional; every consumer has a fallback)
|
|
274
|
-
// ---------------------------------------------------------------------------
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* How a completion claim points at its proof. Resolved against the log by
|
|
278
|
-
* deriveHandoff(); a claim whose evidence does not resolve to a zero exit is
|
|
279
|
-
* surfaced as unverified rather than accepted or silently dropped.
|
|
280
|
-
*/
|
|
281
|
-
export type EvidenceQuery =
|
|
282
|
-
| { gate: string }
|
|
283
|
-
| { command: string };
|
|
284
|
-
|
|
285
|
-
export interface ClaimEvent {
|
|
286
|
-
t: "claim";
|
|
287
|
-
id: EventId;
|
|
288
|
-
at: IsoTime;
|
|
289
|
-
what: string;
|
|
290
|
-
work_id?: string;
|
|
291
|
-
evidence: EvidenceQuery;
|
|
292
|
-
/** Set when an adopt moved this event from another node. */
|
|
293
|
-
carried_from?: CarriedFrom;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
export interface DecisionEvent {
|
|
297
|
-
t: "decision";
|
|
298
|
-
id: EventId;
|
|
299
|
-
at: IsoTime;
|
|
300
|
-
chose: string;
|
|
301
|
-
because: string;
|
|
302
|
-
rejected?: readonly string[];
|
|
303
|
-
work_id?: string;
|
|
304
|
-
/** Set when an adopt moved this event from another node. */
|
|
305
|
-
carried_from?: CarriedFrom;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
export interface PitfallEvent {
|
|
309
|
-
t: "pitfall";
|
|
310
|
-
id: EventId;
|
|
311
|
-
at: IsoTime;
|
|
312
|
-
tried: string;
|
|
313
|
-
failed_because: string;
|
|
314
|
-
work_id?: string;
|
|
315
|
-
/** Set when an adopt moved this event from another node. */
|
|
316
|
-
carried_from?: CarriedFrom;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export interface BlockedEvent {
|
|
320
|
-
t: "blocked";
|
|
321
|
-
id: EventId;
|
|
322
|
-
at: IsoTime;
|
|
323
|
-
what: string;
|
|
324
|
-
work_id?: string;
|
|
325
|
-
reason: string;
|
|
326
|
-
/** Set when an adopt moved this event from another node. */
|
|
327
|
-
carried_from?: CarriedFrom;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
export interface QuestionEvent {
|
|
331
|
-
t: "question";
|
|
332
|
-
id: EventId;
|
|
333
|
-
at: IsoTime;
|
|
334
|
-
text: string;
|
|
335
|
-
/** Set when an adopt moved this event from another node. */
|
|
336
|
-
carried_from?: CarriedFrom;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Which halves of a rewind moved.
|
|
341
|
-
*
|
|
342
|
-
* both the default. The conversation and the workspace go back
|
|
343
|
-
* together, so they still agree afterwards.
|
|
344
|
-
* files the workspace goes back, the conversation does not. The model's
|
|
345
|
-
* context describes edits that are no longer on disk.
|
|
346
|
-
* context the conversation goes back, the workspace does not. Files exist
|
|
347
|
-
* that the model has no memory of writing.
|
|
348
|
-
*/
|
|
349
|
-
export type RewindMode = "both" | "files" | "context";
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* The workspace and the conversation were moved relative to each other.
|
|
353
|
-
*
|
|
354
|
-
* Recorded because the workspace is a projection of the log: a restore is a
|
|
355
|
-
* change no tool claimed, so without this event the next turn-boundary scan
|
|
356
|
-
* reports the whole thing as undeclared damage and the handoff inherits it.
|
|
357
|
-
*
|
|
358
|
-
* WHETHER IT REPLAYS DEPENDS ON `mode`, and the rule is the same one the
|
|
359
|
-
* whole log follows: tell the model exactly when, and only when, its picture
|
|
360
|
-
* would otherwise be wrong.
|
|
361
|
-
*
|
|
362
|
-
* "both" does NOT replay. The context and the disk agree afterwards, and
|
|
363
|
-
* saying "you just rewound" would carry the undone work back in another
|
|
364
|
-
* form -- the exact thing being undone.
|
|
365
|
-
*
|
|
366
|
-
* "files" and "context" DO replay, naming paths. They leave the two
|
|
367
|
-
* disagreeing, and a model planning against the wrong picture is the
|
|
368
|
-
* documented failure: with a context-only restore it "starts from bad code
|
|
369
|
-
* with no memory of how it got there", which is worse than either state.
|
|
370
|
-
*/
|
|
371
|
-
export interface RewindEvent {
|
|
372
|
-
t: "rewind";
|
|
373
|
-
id: EventId;
|
|
374
|
-
at: IsoTime;
|
|
375
|
-
mode: RewindMode;
|
|
376
|
-
/** P.3: context navigation keeps the file history at this separate cursor. */
|
|
377
|
-
files_from?: NodeRef;
|
|
378
|
-
/** Where things were moved back to. */
|
|
379
|
-
from: NodeRef;
|
|
380
|
-
/** The prompt that opened the exchange moved back to, for a human reader. */
|
|
381
|
-
prompt: string;
|
|
382
|
-
restored: readonly string[];
|
|
383
|
-
removed: readonly string[];
|
|
384
|
-
/** Target files whose content is no longer in the blob store. */
|
|
385
|
-
unrecoverable: readonly string[];
|
|
386
|
-
/**
|
|
387
|
-
* Paths where the workspace and this conversation no longer agree, with
|
|
388
|
-
* which side is ahead. Computed from the plan, never described vaguely:
|
|
389
|
-
* "some files may differ" is not something a model can act on.
|
|
390
|
-
*/
|
|
391
|
-
divergence: readonly string[];
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
// --- branch lifecycle ------------------------------------------------------
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* The parent opened a branch. Carries a reference, never the branch itself.
|
|
398
|
-
*/
|
|
399
|
-
export interface SpawnEvent {
|
|
400
|
-
t: "spawn";
|
|
401
|
-
id: EventId;
|
|
402
|
-
at: IsoTime;
|
|
403
|
-
branch: NodeRef;
|
|
404
|
-
/** What the branch is for, in one line. */
|
|
405
|
-
purpose: string;
|
|
406
|
-
/** O.14: execution mode is durable; it never proves a live handle exists. */
|
|
407
|
-
background?: true;
|
|
408
|
-
/** The isolated checkout belongs to this branch, including after restart. */
|
|
409
|
-
workspace?: { path: string; branch: string };
|
|
410
|
-
/** O.4: a task input envelope references the original request, never copies history. */
|
|
411
|
-
input?: {
|
|
412
|
-
source_event: string;
|
|
413
|
-
tools: readonly string[];
|
|
414
|
-
max_turns: number;
|
|
415
|
-
workspace: { kind: "shared_readonly" } | { kind: "git_tree"; head: string; tree: string };
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* A branch finished and handed its state back.
|
|
421
|
-
*
|
|
422
|
-
* `handoff_ref` is a path, and `summary` is a line the branch wrote -- the
|
|
423
|
-
* handoff's contents are never inlined here (D8). The parent reads the file
|
|
424
|
-
* when it needs the detail.
|
|
425
|
-
*/
|
|
426
|
-
export interface JoinedEvent {
|
|
427
|
-
t: "joined";
|
|
428
|
-
id: EventId;
|
|
429
|
-
at: IsoTime;
|
|
430
|
-
branch: NodeRef;
|
|
431
|
-
handoff_ref: string;
|
|
432
|
-
summary: string;
|
|
433
|
-
/** O.9: artifact contains a deterministic evidence index, never raw history. */
|
|
434
|
-
receipt_ref?: Sha256;
|
|
435
|
-
/** A branch can cut before joining; its last node need not be its root. */
|
|
436
|
-
tip?: NodeRef;
|
|
437
|
-
model?: string;
|
|
438
|
-
/** Absence in a legacy join means unknown, never inferred success. */
|
|
439
|
-
outcome?: ExecutionOutcome;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/** The parent took this branch as the mainline. */
|
|
443
|
-
export interface AdoptEvent {
|
|
444
|
-
t: "adopt";
|
|
445
|
-
id: EventId;
|
|
446
|
-
at: IsoTime;
|
|
447
|
-
branch: NodeRef;
|
|
448
|
-
/** Commit intent after all parent tool results; recovery reuses this node. */
|
|
449
|
-
next_node?: number;
|
|
450
|
-
applied?: true;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
/** The parent rejected this branch. Resolution, not silence (D16). */
|
|
454
|
-
export interface DiscardEvent {
|
|
455
|
-
t: "discard";
|
|
456
|
-
id: EventId;
|
|
457
|
-
at: IsoTime;
|
|
458
|
-
branch: NodeRef;
|
|
459
|
-
reason: string;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Where an event was carried from, when an adopt moved it into a new node.
|
|
464
|
-
*
|
|
465
|
-
* Adopting a branch would otherwise lose the parent's post-fork annotations --
|
|
466
|
-
* including the decision that chose the branch, which is the least disposable
|
|
467
|
-
* record there is. Carrying them is free in context terms because model
|
|
468
|
-
* annotations never replay as messages; only the derivation sees them.
|
|
469
|
-
*/
|
|
470
|
-
export interface CarriedFrom {
|
|
471
|
-
node: number;
|
|
472
|
-
event: EventId;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* The one genuinely non-derivable field. "What was I doing" can be reconstructed
|
|
477
|
-
* from the log; "what should happen next" cannot. When absent, the handoff says
|
|
478
|
-
* so via continuation_valid rather than inventing one.
|
|
479
|
-
*/
|
|
480
|
-
export interface NextActionEvent {
|
|
481
|
-
t: "next_action";
|
|
482
|
-
id: EventId;
|
|
483
|
-
at: IsoTime;
|
|
484
|
-
what: string;
|
|
485
|
-
work_id?: string;
|
|
486
|
-
next_action: string;
|
|
487
|
-
depends_on?: readonly string[];
|
|
488
|
-
/** Set when an adopt moved this event from another node. */
|
|
489
|
-
carried_from?: CarriedFrom;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
/** O.2: lifecycle changes append facts; an old title is not a task identity. */
|
|
493
|
-
export interface WorkStatusEvent {
|
|
494
|
-
t: "work_status";
|
|
495
|
-
id: EventId;
|
|
496
|
-
at: IsoTime;
|
|
497
|
-
work_id: string;
|
|
498
|
-
what: string;
|
|
499
|
-
operation: "unblock" | "reopen" | "cancel";
|
|
500
|
-
next_action?: string;
|
|
501
|
-
reason?: string;
|
|
502
|
-
carried_from?: CarriedFrom;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
export interface WorkDependenciesEvent {
|
|
506
|
-
t: "work_dependencies"; id: EventId; at: IsoTime; work_id: string; what: string;
|
|
507
|
-
depends_on: readonly string[]; carried_from?: CarriedFrom;
|
|
508
|
-
}
|
|
509
|
-
export interface WorkOwnerEvent {
|
|
510
|
-
t: "work_owner"; id: EventId; at: IsoTime; work_id: string; what: string;
|
|
511
|
-
operation: "claim" | "release"; owner: string; carried_from?: CarriedFrom;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
/** O.6: a model associates an original observation with work; the runtime resolves its source. */
|
|
515
|
-
export interface EvidenceLinkEvent {
|
|
516
|
-
t: "evidence_link"; id: EventId; at: IsoTime;
|
|
517
|
-
work: string; what: string; source: EventId;
|
|
518
|
-
resource?: string; version?: string; supersedes?: EventId;
|
|
519
|
-
/** Last version observed by the harness when this association was recorded. */
|
|
520
|
-
observed_version?: string | null;
|
|
521
|
-
carried_from?: CarriedFrom;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
/** Extension state is append-only data; only explicit messages enter either projection (D1). */
|
|
525
|
-
export interface ExtensionEvent {
|
|
526
|
-
t: "extension"; id: string; at: string; customType: string;
|
|
527
|
-
content: string; display: boolean; inContext: boolean;
|
|
528
|
-
data?: import("./tool-contract.ts").JsonValue;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
export interface AcceptanceContractEvent {
|
|
532
|
-
t: "acceptance_contract"; id: EventId; at: IsoTime; request: EventId;
|
|
533
|
-
contract: AcceptanceContract;
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* S.2 / S.5: an explicit goal. `set` records exactly what the user accepted
|
|
537
|
-
* from a model draft -- the draft itself stays in the assistant event it came
|
|
538
|
-
* from -- and `clear` ends it. Only the user sets or clears one by command;
|
|
539
|
-
* the harness clears it when the request ledger is verified.
|
|
540
|
-
*/
|
|
541
|
-
/**
|
|
542
|
-
* The discriminating rung of the evidence ladder: one accepted check re-run in
|
|
543
|
-
* a disposable clone with this request's changes undone. Only what happened is
|
|
544
|
-
* recorded -- the exit code there, or why nothing ran (the revert could not be
|
|
545
|
-
* made exact, the check did not finish) -- with the role the criterion was
|
|
546
|
-
* declared with. What that means is derived by `counterVerdict` (S.7).
|
|
547
|
-
*/
|
|
548
|
-
export type CounterCheckEvent = { t: "counter_check"; id: EventId; at: IsoTime; request: EventId; criterion: string; command: string; guard?: true } &
|
|
549
|
-
({ exit: number } | { reason: string });
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* The independent rung: one blind check run after the goal ended, in a clone of
|
|
553
|
-
* the final workspace. `exposed` reports whether the log shows the model ever
|
|
554
|
-
* touched the blind checks; an exposed pass does not count as independent.
|
|
555
|
-
*/
|
|
556
|
-
export type BlindCheckEvent = { t: "blind_check"; id: EventId; at: IsoTime; request: EventId; check: string; exposed: boolean; exposure?: string } &
|
|
557
|
-
({ exit: number } | { reason: string });
|
|
558
|
-
|
|
559
|
-
export type GoalEvent =
|
|
560
|
-
| { t: "goal"; id: EventId; at: IsoTime; action: "set"; objective: string; contract: AcceptanceContract;
|
|
561
|
-
draft: EventId; accepted: readonly string[]; rejected: readonly string[] }
|
|
562
|
-
| { t: "goal"; id: EventId; at: IsoTime; action: "clear"; reason: "met" | "user" };
|
|
563
|
-
export interface AcceptanceDecisionEvent {
|
|
564
|
-
t: "acceptance_decision"; id: EventId; at: IsoTime; request: EventId;
|
|
565
|
-
contract_id: string; criterion: string; actor: "user";
|
|
566
|
-
target_binding?: string; target_observation?: EventId;
|
|
567
|
-
}
|
|
568
|
-
export interface TargetObservationEvent {
|
|
569
|
-
t: "target_observation"; id: EventId; at: IsoTime; observation: RuntimeTargetReceipt;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
export interface SkillLoadedEvent {
|
|
573
|
-
t: "skill_loaded"; id: EventId; at: IsoTime; name: string; path: string;
|
|
574
|
-
sha256: Sha256; artifact: Sha256; mode: "inline" | "fork" | "read"; origin: "user" | "model";
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
/** O.14: owner cleanup is an actual process observation, not a model claim. */
|
|
578
|
-
export interface ProcessExitEvent {
|
|
579
|
-
t: "process_exit"; id: EventId; at: IsoTime; session: number;
|
|
580
|
-
command: string; exit: number; output: ArtifactRef; reason: "disposed";
|
|
581
|
-
receipt?: import("./process-receipt.ts").ProcessReceipt;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Who let one call through the permission gate (feat-approval-events). A
|
|
586
|
-
* harness fact recorded between the call's invocation and its result, before
|
|
587
|
-
* the call starts; it never enters the model's context. `decision` is the
|
|
588
|
-
* person's prompt choice when `source` is `user`, otherwise the rule's own
|
|
589
|
-
* `allow` / `deny`. `rule` is the matched rule's text -- for `user`, the rule
|
|
590
|
-
* that asked. `no_prompt`: a rule asked and nobody could be asked.
|
|
591
|
-
*/
|
|
592
|
-
export interface ApprovalEvent {
|
|
593
|
-
t: "approval"; id: EventId; at: IsoTime;
|
|
594
|
-
call_id: string; tool: string;
|
|
595
|
-
decision: "once" | "command" | "tool" | "deny" | "allow";
|
|
596
|
-
source: "user" | "session_rule" | "config" | "auto" | "no_prompt";
|
|
597
|
-
command?: string;
|
|
598
|
-
rule?: string;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
export type LogEvent =
|
|
602
|
-
| ToolInvocationEvent
|
|
603
|
-
| ApprovalEvent
|
|
604
|
-
| ProcessExitEvent
|
|
605
|
-
| SkillLoadedEvent
|
|
606
|
-
| AcceptanceContractEvent
|
|
607
|
-
| GoalEvent
|
|
608
|
-
| CounterCheckEvent
|
|
609
|
-
| BlindCheckEvent
|
|
610
|
-
| AcceptanceDecisionEvent
|
|
611
|
-
| TargetObservationEvent
|
|
612
|
-
| ExtensionEvent
|
|
613
|
-
| UserEvent
|
|
614
|
-
| UserBashEvent
|
|
615
|
-
| OutcomeEvent
|
|
616
|
-
| GuidanceEvent
|
|
617
|
-
| InterruptEvent
|
|
618
|
-
| AssistantEvent
|
|
619
|
-
| ToolResultEvent
|
|
620
|
-
| EvidenceLinkEvent
|
|
621
|
-
| CutEvent
|
|
622
|
-
| CheckpointEvent
|
|
623
|
-
| WorkspaceObservationEvent
|
|
624
|
-
| RewindEvent
|
|
625
|
-
| SpawnEvent
|
|
626
|
-
| JoinedEvent
|
|
627
|
-
| AdoptEvent
|
|
628
|
-
| DiscardEvent
|
|
629
|
-
| ClaimEvent
|
|
630
|
-
| DecisionEvent
|
|
631
|
-
| PitfallEvent
|
|
632
|
-
| BlockedEvent
|
|
633
|
-
| QuestionEvent
|
|
634
|
-
| NextActionEvent
|
|
635
|
-
| WorkStatusEvent
|
|
636
|
-
| WorkDependenciesEvent
|
|
637
|
-
| WorkOwnerEvent;
|
|
638
|
-
// Work coordination is intent, never a substitute for command proof.
|
|
639
|
-
|
|
640
|
-
export const HARNESS_EVENTS = [
|
|
641
|
-
"checkpoint", "workspace_observation",
|
|
642
|
-
"target_observation",
|
|
643
|
-
"process_exit",
|
|
644
|
-
"approval",
|
|
645
|
-
"skill_loaded",
|
|
646
|
-
"acceptance_contract", "acceptance_decision", "goal", "counter_check", "blind_check",
|
|
647
|
-
"user", "user_bash", "outcome", "guidance", "interrupt", "assistant", "tool_result", "cut", "rewind", "extension",
|
|
648
|
-
] as const;
|
|
649
|
-
export const MODEL_EVENTS = [
|
|
650
|
-
"work_dependencies", "work_owner",
|
|
651
|
-
"claim", "decision", "pitfall", "blocked", "question", "next_action", "work_status", "evidence_link",
|
|
652
|
-
"spawn", "joined", "adopt", "discard",
|
|
653
|
-
] as const;
|
|
654
|
-
|
|
655
|
-
/**
|
|
656
|
-
* Events an adopt carries into the node it opens.
|
|
657
|
-
*
|
|
658
|
-
* Only annotations: harness events are either already in the branch's
|
|
659
|
-
* ancestry or are parent actions the branch should not inherit.
|
|
660
|
-
*/
|
|
661
|
-
export const CARRYABLE_EVENTS = [
|
|
662
|
-
"work_dependencies", "work_owner",
|
|
663
|
-
"claim", "decision", "pitfall", "blocked", "question", "next_action", "work_status", "evidence_link",
|
|
664
|
-
] as const;
|
|
665
|
-
|
|
666
|
-
export type CarryableEvent = Extract<LogEvent, { t: (typeof CARRYABLE_EVENTS)[number] }>;
|
|
667
|
-
|
|
668
|
-
export function isHarnessEvent(e: LogEvent): boolean {
|
|
669
|
-
return (HARNESS_EVENTS as readonly string[]).includes(e.t);
|
|
670
|
-
}
|