@openrig/cli 0.3.1 → 0.3.2
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/daemon/assets/plugins/openrig-core/skills/forming-an-openrig-mental-model/SKILL.md +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +2 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +36 -0
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +66 -0
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.d.ts +5 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.d.ts.map +1 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.js +5 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.js.map +1 -1
- package/daemon/dist/db/migrations/041_rig_policy.d.ts +32 -0
- package/daemon/dist/db/migrations/041_rig_policy.d.ts.map +1 -0
- package/daemon/dist/db/migrations/041_rig_policy.js +47 -0
- package/daemon/dist/db/migrations/041_rig_policy.js.map +1 -0
- package/daemon/dist/domain/agent-images/resume-token-discovery.js +1 -1
- package/daemon/dist/domain/agent-images/resume-token-discovery.js.map +1 -1
- package/daemon/dist/domain/agent-images/snapshot-capturer.d.ts.map +1 -1
- package/daemon/dist/domain/agent-images/snapshot-capturer.js +2 -1
- package/daemon/dist/domain/agent-images/snapshot-capturer.js.map +1 -1
- package/daemon/dist/domain/agent-manifest.js +27 -0
- package/daemon/dist/domain/agent-manifest.js.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.js +86 -6
- package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
- package/daemon/dist/domain/bundle-agent-images-router.d.ts +95 -0
- package/daemon/dist/domain/bundle-agent-images-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-agent-images-router.js +140 -0
- package/daemon/dist/domain/bundle-agent-images-router.js.map +1 -0
- package/daemon/dist/domain/bundle-assembler.d.ts +18 -1
- package/daemon/dist/domain/bundle-assembler.d.ts.map +1 -1
- package/daemon/dist/domain/bundle-assembler.js +11 -1
- package/daemon/dist/domain/bundle-assembler.js.map +1 -1
- package/daemon/dist/domain/bundle-audit.d.ts +89 -0
- package/daemon/dist/domain/bundle-audit.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-audit.js +87 -0
- package/daemon/dist/domain/bundle-audit.js.map +1 -0
- package/daemon/dist/domain/bundle-conflict-detector.d.ts +57 -0
- package/daemon/dist/domain/bundle-conflict-detector.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-conflict-detector.js +49 -0
- package/daemon/dist/domain/bundle-conflict-detector.js.map +1 -0
- package/daemon/dist/domain/bundle-context-packs-router.d.ts +100 -0
- package/daemon/dist/domain/bundle-context-packs-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-context-packs-router.js +158 -0
- package/daemon/dist/domain/bundle-context-packs-router.js.map +1 -0
- package/daemon/dist/domain/bundle-plugins-router.d.ts +69 -0
- package/daemon/dist/domain/bundle-plugins-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-plugins-router.js +87 -0
- package/daemon/dist/domain/bundle-plugins-router.js.map +1 -0
- package/daemon/dist/domain/bundle-skills-router.d.ts +62 -0
- package/daemon/dist/domain/bundle-skills-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-skills-router.js +90 -0
- package/daemon/dist/domain/bundle-skills-router.js.map +1 -0
- package/daemon/dist/domain/bundle-types.d.ts +106 -0
- package/daemon/dist/domain/bundle-types.d.ts.map +1 -1
- package/daemon/dist/domain/bundle-types.js +375 -0
- package/daemon/dist/domain/bundle-types.js.map +1 -1
- package/daemon/dist/domain/bundle-workflow-specs-router.d.ts +94 -0
- package/daemon/dist/domain/bundle-workflow-specs-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-workflow-specs-router.js +144 -0
- package/daemon/dist/domain/bundle-workflow-specs-router.js.map +1 -0
- package/daemon/dist/domain/context-monitor.d.ts +5 -1
- package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/context-monitor.js +28 -15
- package/daemon/dist/domain/context-monitor.js.map +1 -1
- package/daemon/dist/domain/graph-projection.d.ts +6 -0
- package/daemon/dist/domain/graph-projection.d.ts.map +1 -1
- package/daemon/dist/domain/graph-projection.js +6 -0
- package/daemon/dist/domain/graph-projection.js.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +7 -7
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts +18 -0
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +98 -0
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +12 -0
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +25 -1
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/pod-bundle-assembler.d.ts +16 -1
- package/daemon/dist/domain/pod-bundle-assembler.d.ts.map +1 -1
- package/daemon/dist/domain/pod-bundle-assembler.js +11 -1
- package/daemon/dist/domain/pod-bundle-assembler.js.map +1 -1
- package/daemon/dist/domain/profile-resolver.d.ts +10 -0
- package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/profile-resolver.js +4 -0
- package/daemon/dist/domain/profile-resolver.js.map +1 -1
- package/daemon/dist/domain/ps-projection.d.ts +22 -0
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +57 -0
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +37 -1
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +99 -2
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/restore-check-service.d.ts +4 -0
- package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
- package/daemon/dist/domain/restore-check-service.js +16 -7
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.d.ts +48 -0
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.js +96 -0
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.js.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.d.ts +46 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.js +171 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.js.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.d.ts +145 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.js +52 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.js.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.d.ts +58 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.js +211 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.js.map +1 -0
- package/daemon/dist/domain/rigspec-instantiator.d.ts +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +109 -18
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/seat-activity-service.d.ts +79 -0
- package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -0
- package/daemon/dist/domain/seat-activity-service.js +123 -0
- package/daemon/dist/domain/seat-activity-service.js.map +1 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts +12 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.js +23 -0
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
- package/daemon/dist/domain/spec-library-service.d.ts.map +1 -1
- package/daemon/dist/domain/spec-library-service.js +19 -0
- package/daemon/dist/domain/spec-library-service.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +79 -3
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts +22 -0
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +37 -0
- package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts +7 -0
- package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js +156 -3
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
- package/daemon/dist/domain/workspace/workspace-doctor.d.ts +197 -0
- package/daemon/dist/domain/workspace/workspace-doctor.d.ts.map +1 -0
- package/daemon/dist/domain/workspace/workspace-doctor.js +448 -0
- package/daemon/dist/domain/workspace/workspace-doctor.js.map +1 -0
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +11 -0
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/routes/bundles.d.ts.map +1 -1
- package/daemon/dist/routes/bundles.js +966 -7
- package/daemon/dist/routes/bundles.js.map +1 -1
- package/daemon/dist/routes/config.d.ts.map +1 -1
- package/daemon/dist/routes/config.js +19 -2
- package/daemon/dist/routes/config.js.map +1 -1
- package/daemon/dist/routes/info.d.ts +3 -0
- package/daemon/dist/routes/info.d.ts.map +1 -0
- package/daemon/dist/routes/info.js +20 -0
- package/daemon/dist/routes/info.js.map +1 -0
- package/daemon/dist/routes/queue.d.ts +18 -0
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +97 -5
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/rig-policy.d.ts +9 -0
- package/daemon/dist/routes/rig-policy.d.ts.map +1 -0
- package/daemon/dist/routes/rig-policy.js +174 -0
- package/daemon/dist/routes/rig-policy.js.map +1 -0
- package/daemon/dist/routes/rigs.d.ts.map +1 -1
- package/daemon/dist/routes/rigs.js +10 -2
- package/daemon/dist/routes/rigs.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +26 -3
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/up.d.ts +25 -0
- package/daemon/dist/routes/up.d.ts.map +1 -1
- package/daemon/dist/routes/up.js +70 -3
- package/daemon/dist/routes/up.js.map +1 -1
- package/daemon/dist/routes/workspace.d.ts.map +1 -1
- package/daemon/dist/routes/workspace.js +80 -1
- package/daemon/dist/routes/workspace.js.map +1 -1
- package/daemon/dist/server.d.ts +10 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +11 -0
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +45 -4
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +28 -4
- package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +285 -8
- package/daemon/specs/agents/shared/skills/core/rig-lifecycle/SKILL.md +2 -2
- package/daemon/specs/rigs/launch/conveyor/rig.yaml +1 -1
- package/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +13 -1
- package/dist/client.js.map +1 -1
- package/dist/commands/bundle.d.ts.map +1 -1
- package/dist/commands/bundle.js +123 -2
- package/dist/commands/bundle.js.map +1 -1
- package/dist/commands/config-init-workspace.d.ts.map +1 -1
- package/dist/commands/config-init-workspace.js +40 -5
- package/dist/commands/config-init-workspace.js.map +1 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +51 -8
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue.d.ts +6 -0
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +103 -5
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/rig-policy.d.ts +48 -0
- package/dist/commands/rig-policy.d.ts.map +1 -0
- package/dist/commands/rig-policy.js +429 -0
- package/dist/commands/rig-policy.js.map +1 -0
- package/dist/commands/scope.d.ts +6 -0
- package/dist/commands/scope.d.ts.map +1 -0
- package/dist/commands/scope.js +659 -0
- package/dist/commands/scope.js.map +1 -0
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +47 -0
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/workflow.d.ts +9 -0
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +139 -1
- package/dist/commands/workflow.js.map +1 -1
- package/dist/commands/workspace.d.ts +20 -0
- package/dist/commands/workspace.d.ts.map +1 -1
- package/dist/commands/workspace.js +138 -7
- package/dist/commands/workspace.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +25 -1
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +33 -2
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/scope/dot-id.d.ts +43 -0
- package/dist/lib/scope/dot-id.d.ts.map +1 -0
- package/dist/lib/scope/dot-id.js +165 -0
- package/dist/lib/scope/dot-id.js.map +1 -0
- package/dist/lib/scope/scope-fs.d.ts +79 -0
- package/dist/lib/scope/scope-fs.d.ts.map +1 -0
- package/dist/lib/scope/scope-fs.js +468 -0
- package/dist/lib/scope/scope-fs.js.map +1 -0
- package/dist/lib/scope/templates.d.ts +38 -0
- package/dist/lib/scope/templates.d.ts.map +1 -0
- package/dist/lib/scope/templates.js +109 -0
- package/dist/lib/scope/templates.js.map +1 -0
- package/dist/lib/scope/types.d.ts +61 -0
- package/dist/lib/scope/types.d.ts.map +1 -0
- package/dist/lib/scope/types.js +38 -0
- package/dist/lib/scope/types.js.map +1 -0
- package/dist/lib/scope-templates/backlog-deprecation.md +26 -0
- package/dist/lib/scope-templates/backlog-tech-debt.md +22 -0
- package/dist/lib/scope-templates/bug-fix.md +30 -0
- package/dist/lib/scope-templates/mission-notes.md +97 -0
- package/dist/lib/scope-templates/mission-placeholder.md +20 -0
- package/dist/lib/scope-templates/mission-release.md +25 -0
- package/dist/lib/scope-templates/placeholder.md +30 -0
- package/dist/lib/scope-templates/release-feature.md +26 -0
- package/dist/lib/scope-templates/research.md +22 -0
- package/package.json +2 -2
- package/ui/dist/assets/index-GjTxfi9S.js +547 -0
- package/ui/dist/index.html +1 -1
- package/ui/dist/assets/index-Rl3ZBrUg.js +0 -547
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Slice 09 — recommended per-mode defaults + per-mode default scope.
|
|
2
|
+
//
|
|
3
|
+
// Component 3 — Recommended Per-Mode Defaults (the 6×7 matrix).
|
|
4
|
+
// Component 4 — Recommended Default Scopes Per Mode.
|
|
5
|
+
//
|
|
6
|
+
// "RECOMMENDED, operator-overridable per field" — these are the
|
|
7
|
+
// fall-back values the CLI / HTTP set route applies when the operator
|
|
8
|
+
// invokes a bare mode (e.g., `rig policy set debug`) without
|
|
9
|
+
// specifying individual fields. Operator-supplied per-field overrides
|
|
10
|
+
// merge over the defaults.
|
|
11
|
+
export const RECOMMENDED_MODE_DEFAULTS = {
|
|
12
|
+
sleep: {
|
|
13
|
+
autonomy_scope: "pre_approved_only",
|
|
14
|
+
heartbeat_cadence: "sparse",
|
|
15
|
+
inspection_depth: "normal",
|
|
16
|
+
update_detail: "compact",
|
|
17
|
+
escalation_threshold: "blocker_only",
|
|
18
|
+
concurrency_limit: "serial",
|
|
19
|
+
permission_prompt_posture: "batch_for_human",
|
|
20
|
+
},
|
|
21
|
+
desk: {
|
|
22
|
+
autonomy_scope: "full_autonomy_within_workstream",
|
|
23
|
+
heartbeat_cadence: "normal",
|
|
24
|
+
inspection_depth: "normal",
|
|
25
|
+
update_detail: "normal",
|
|
26
|
+
escalation_threshold: "normal",
|
|
27
|
+
concurrency_limit: "unlimited", // "normal" in the convention table; v0 maps "normal" concurrency to unlimited (the existing OpenRig default — agents fan out per workstream-mode discipline)
|
|
28
|
+
permission_prompt_posture: "normal",
|
|
29
|
+
},
|
|
30
|
+
mobile: {
|
|
31
|
+
autonomy_scope: "bounded_continuation",
|
|
32
|
+
heartbeat_cadence: "normal",
|
|
33
|
+
inspection_depth: "surface",
|
|
34
|
+
update_detail: "compact",
|
|
35
|
+
escalation_threshold: "low",
|
|
36
|
+
concurrency_limit: "unlimited",
|
|
37
|
+
permission_prompt_posture: "batch_for_human",
|
|
38
|
+
},
|
|
39
|
+
away: {
|
|
40
|
+
autonomy_scope: "pre_approved_only",
|
|
41
|
+
heartbeat_cadence: "sparse",
|
|
42
|
+
inspection_depth: "normal",
|
|
43
|
+
update_detail: "compact",
|
|
44
|
+
escalation_threshold: "blocker_only",
|
|
45
|
+
concurrency_limit: "serial",
|
|
46
|
+
permission_prompt_posture: "batch_for_human",
|
|
47
|
+
},
|
|
48
|
+
focus: {
|
|
49
|
+
autonomy_scope: "full_autonomy_within_workstream",
|
|
50
|
+
heartbeat_cadence: "normal",
|
|
51
|
+
inspection_depth: "normal",
|
|
52
|
+
update_detail: "compact",
|
|
53
|
+
escalation_threshold: "blocker_only",
|
|
54
|
+
concurrency_limit: "unlimited",
|
|
55
|
+
permission_prompt_posture: "batch_for_human",
|
|
56
|
+
},
|
|
57
|
+
debug: {
|
|
58
|
+
autonomy_scope: "bounded_continuation",
|
|
59
|
+
heartbeat_cadence: "fast",
|
|
60
|
+
inspection_depth: "forensic",
|
|
61
|
+
update_detail: "verbose",
|
|
62
|
+
escalation_threshold: "low",
|
|
63
|
+
concurrency_limit: "serial",
|
|
64
|
+
permission_prompt_posture: "normal",
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Component 4 — Recommended Default Scopes Per Mode.
|
|
69
|
+
*
|
|
70
|
+
* Used during restate-and-confirm: when the operator's invocation
|
|
71
|
+
* omits an explicit scope, the agent restates with this recommendation
|
|
72
|
+
* and awaits confirmation/correction. The operator's confirmation is
|
|
73
|
+
* authoritative.
|
|
74
|
+
*/
|
|
75
|
+
export const RECOMMENDED_DEFAULT_SCOPE = {
|
|
76
|
+
sleep: "global_host",
|
|
77
|
+
away: "global_host",
|
|
78
|
+
desk: "global_host",
|
|
79
|
+
mobile: "global_host",
|
|
80
|
+
focus: "workstream",
|
|
81
|
+
debug: "qitem",
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Conservative default for `expiry_or_stale_rule`. Per convention Q3,
|
|
85
|
+
* the numeric threshold is deferred to a Mode 2 helper slice;
|
|
86
|
+
* `re_confirm_on_long_gap` is the rule kind selected here as the
|
|
87
|
+
* safest default (it prompts re-confirmation rather than silent
|
|
88
|
+
* continuation when the operator has been away for an extended
|
|
89
|
+
* period).
|
|
90
|
+
*
|
|
91
|
+
* Operators may override per-binding via the `expiry_or_stale_rule`
|
|
92
|
+
* field of the OperatorContextModeRecord; v0 does not auto-tune the
|
|
93
|
+
* threshold.
|
|
94
|
+
*/
|
|
95
|
+
export const DEFAULT_STALE_RULE = "re_confirm_on_long_gap";
|
|
96
|
+
//# sourceMappingURL=rig-policy-defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rig-policy-defaults.js","sourceRoot":"","sources":["../../../src/domain/rig-policy/rig-policy-defaults.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,gEAAgE;AAChE,qDAAqD;AACrD,EAAE;AACF,gEAAgE;AAChE,sEAAsE;AACtE,6DAA6D;AAC7D,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,gBAAgB,EAAE,UAAU;QAC5B,aAAa,EAAE,SAAS;QACxB,oBAAoB,EAAE,KAAK;QAC3B,iBAAiB,EAAE,QAAQ;QAC3B,yBAAyB,EAAE,QAAQ;KACpC;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsD;IAC1F,KAAK,EAAE,aAAa;IACpB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,aAAa;IACrB,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA6B,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
import { type EffectiveOperatorContextMode, type OperatorContextModeBinding, type OperatorContextReadContext, type OperatorContextScope } from "./rig-policy-types.js";
|
|
3
|
+
export interface SetBindingResult {
|
|
4
|
+
ok: true;
|
|
5
|
+
binding: OperatorContextModeBinding;
|
|
6
|
+
}
|
|
7
|
+
export interface SetBindingError {
|
|
8
|
+
ok: false;
|
|
9
|
+
errors: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface RigPolicyStoreOpts {
|
|
12
|
+
/** Override the clock for tests; defaults to new Date(). */
|
|
13
|
+
now?: () => Date;
|
|
14
|
+
}
|
|
15
|
+
export declare class RigPolicyStore {
|
|
16
|
+
private readonly db;
|
|
17
|
+
private readonly now;
|
|
18
|
+
constructor(db: Database.Database, opts?: RigPolicyStoreOpts);
|
|
19
|
+
/**
|
|
20
|
+
* Operator-only set. Validates the candidate record + the
|
|
21
|
+
* scope/qualifier shape, then upserts. Returns the typed binding
|
|
22
|
+
* on success.
|
|
23
|
+
*
|
|
24
|
+
* scope == 'global_host' REQUIRES qualifier === null;
|
|
25
|
+
* scope != 'global_host' REQUIRES a non-empty qualifier string.
|
|
26
|
+
* Both are operator/host invariants — the route validates and
|
|
27
|
+
* the store rejects on disagreement.
|
|
28
|
+
*/
|
|
29
|
+
setBinding(scope: OperatorContextScope, qualifier: string | null, mode: unknown, candidateRecord: unknown): SetBindingResult | SetBindingError;
|
|
30
|
+
getBinding(scope: OperatorContextScope, qualifier: string | null): OperatorContextModeBinding | null;
|
|
31
|
+
listBindings(): OperatorContextModeBinding[];
|
|
32
|
+
deleteBinding(scope: OperatorContextScope, qualifier: string | null): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the most-specific applicable binding for a read context.
|
|
35
|
+
* Returns null when no binding matches — callers MUST treat null as
|
|
36
|
+
* `unknown_posture` per convention §Q6 (do NOT default to `desk`).
|
|
37
|
+
*
|
|
38
|
+
* Specificity ranks (qitem > workstream > rig > global_host) are
|
|
39
|
+
* defined in rig-policy-types.SCOPE_SPECIFICITY. For each scope the
|
|
40
|
+
* resolver picks the binding whose qualifier matches the read
|
|
41
|
+
* context. Among multiple matching bindings, the most-specific
|
|
42
|
+
* scope wins.
|
|
43
|
+
*/
|
|
44
|
+
resolveEffective(ctx: OperatorContextReadContext): EffectiveOperatorContextMode | null;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=rig-policy-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rig-policy-store.d.ts","sourceRoot":"","sources":["../../../src/domain/rig-policy/rig-policy-store.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,KAAK,4BAA4B,EAEjC,KAAK,0BAA0B,EAE/B,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EAE1B,MAAM,uBAAuB,CAAC;AA4B/B,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,IAAI,CAAC;IACT,OAAO,EAAE,0BAA0B,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;IACvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAa;gBAErB,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,kBAAkB;IAK5D;;;;;;;;;OASG;IACH,UAAU,CACR,KAAK,EAAE,oBAAoB,EAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,IAAI,EAAE,OAAO,EACb,eAAe,EAAE,OAAO,GACvB,gBAAgB,GAAG,eAAe;IAsDrC,UAAU,CACR,KAAK,EAAE,oBAAoB,EAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,0BAA0B,GAAG,IAAI;IASpC,YAAY,IAAI,0BAA0B,EAAE;IAS5C,aAAa,CAAC,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAO7E;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,GAAG,EAAE,0BAA0B,GAAG,4BAA4B,GAAG,IAAI;CA4BvF"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// Slice 09 — daemon-persisted typed primitive (SQLite-backed).
|
|
2
|
+
//
|
|
3
|
+
// Follows the workspace-primitive precedent: structured table,
|
|
4
|
+
// JSON column for the 10-field record (validator owns integrity at
|
|
5
|
+
// write time). NO parallel/forked store (HG-5).
|
|
6
|
+
//
|
|
7
|
+
// The store exposes:
|
|
8
|
+
// - setBinding(scope, qualifier, mode, record) → upserts a row
|
|
9
|
+
// (mode is binding-level
|
|
10
|
+
// Component-2 identity;
|
|
11
|
+
// record is the frozen
|
|
12
|
+
// 10-field Component-3
|
|
13
|
+
// settings)
|
|
14
|
+
// - getBinding(scope, qualifier) → reads one row
|
|
15
|
+
// - listBindings() → all rows (for show)
|
|
16
|
+
// - resolveEffective(readContext) → most-specific binding
|
|
17
|
+
// - deleteBinding(scope, qualifier) → unset
|
|
18
|
+
//
|
|
19
|
+
// Update authority is operator-only: setBinding hard-codes
|
|
20
|
+
// `set_by = 'operator'`. The HTTP route + CLI are the only authoring
|
|
21
|
+
// surfaces; agent code paths read but never write. (HG-4)
|
|
22
|
+
//
|
|
23
|
+
// HG-SAFE preserved here: this store NEVER writes to permission
|
|
24
|
+
// allowlists / runtime configs / auth / tmux / lifecycle. It writes
|
|
25
|
+
// to ONE table (operator_context_mode_bindings) and reads JSON. A
|
|
26
|
+
// future contributor cannot widen permission authority via this
|
|
27
|
+
// service because the surface area is the bindings table only.
|
|
28
|
+
import { SCOPE_SPECIFICITY, } from "./rig-policy-types.js";
|
|
29
|
+
import { validateModeName, validateRecord } from "./rig-policy-validator.js";
|
|
30
|
+
function rowToBinding(row) {
|
|
31
|
+
return {
|
|
32
|
+
id: row.id,
|
|
33
|
+
mode: row.mode,
|
|
34
|
+
record: JSON.parse(row.record_json),
|
|
35
|
+
qualifier: row.qualifier,
|
|
36
|
+
setAt: row.set_at,
|
|
37
|
+
setBy: "operator",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function bindingId(scope, qualifier) {
|
|
41
|
+
return `${scope}:${qualifier ?? "host"}`;
|
|
42
|
+
}
|
|
43
|
+
export class RigPolicyStore {
|
|
44
|
+
db;
|
|
45
|
+
now;
|
|
46
|
+
constructor(db, opts) {
|
|
47
|
+
this.db = db;
|
|
48
|
+
this.now = opts?.now ?? (() => new Date());
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Operator-only set. Validates the candidate record + the
|
|
52
|
+
* scope/qualifier shape, then upserts. Returns the typed binding
|
|
53
|
+
* on success.
|
|
54
|
+
*
|
|
55
|
+
* scope == 'global_host' REQUIRES qualifier === null;
|
|
56
|
+
* scope != 'global_host' REQUIRES a non-empty qualifier string.
|
|
57
|
+
* Both are operator/host invariants — the route validates and
|
|
58
|
+
* the store rejects on disagreement.
|
|
59
|
+
*/
|
|
60
|
+
setBinding(scope, qualifier, mode, candidateRecord) {
|
|
61
|
+
const errors = [];
|
|
62
|
+
if (scope === "global_host" && qualifier !== null) {
|
|
63
|
+
errors.push(`Global-host bindings cannot carry a qualifier (got ${JSON.stringify(qualifier)}). Pass null for the global_host scope.`);
|
|
64
|
+
}
|
|
65
|
+
if (scope !== "global_host" && (typeof qualifier !== "string" || qualifier.length === 0)) {
|
|
66
|
+
errors.push(`${scope} bindings require a qualifier (rigId / workstreamId / qitemId). Got ${JSON.stringify(qualifier)}.`);
|
|
67
|
+
}
|
|
68
|
+
const modeCheck = validateModeName(mode);
|
|
69
|
+
if (!modeCheck.ok)
|
|
70
|
+
errors.push(modeCheck.error);
|
|
71
|
+
const validation = validateRecord(candidateRecord);
|
|
72
|
+
if (!validation.ok)
|
|
73
|
+
errors.push(...validation.errors);
|
|
74
|
+
if (errors.length > 0 || !modeCheck.ok || !validation.ok) {
|
|
75
|
+
return { ok: false, errors };
|
|
76
|
+
}
|
|
77
|
+
const record = validation.record;
|
|
78
|
+
if (record.scope !== scope) {
|
|
79
|
+
return {
|
|
80
|
+
ok: false,
|
|
81
|
+
errors: [
|
|
82
|
+
`Record scope mismatch: binding scope is "${scope}" but record.scope is "${record.scope}". The record's scope field MUST agree with the binding scope.`,
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const id = bindingId(scope, qualifier);
|
|
87
|
+
const setAt = this.now().toISOString();
|
|
88
|
+
this.db.prepare(`
|
|
89
|
+
INSERT INTO operator_context_mode_bindings (id, scope, qualifier, mode, record_json, set_at, set_by)
|
|
90
|
+
VALUES (?, ?, ?, ?, ?, ?, 'operator')
|
|
91
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
92
|
+
mode = excluded.mode,
|
|
93
|
+
record_json = excluded.record_json,
|
|
94
|
+
set_at = excluded.set_at
|
|
95
|
+
`).run(id, scope, qualifier, modeCheck.mode, JSON.stringify(record), setAt);
|
|
96
|
+
return {
|
|
97
|
+
ok: true,
|
|
98
|
+
binding: {
|
|
99
|
+
id,
|
|
100
|
+
mode: modeCheck.mode,
|
|
101
|
+
record,
|
|
102
|
+
qualifier,
|
|
103
|
+
setAt,
|
|
104
|
+
setBy: "operator",
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
getBinding(scope, qualifier) {
|
|
109
|
+
const row = this.db.prepare(`
|
|
110
|
+
SELECT id, scope, qualifier, mode, record_json, set_at, set_by
|
|
111
|
+
FROM operator_context_mode_bindings
|
|
112
|
+
WHERE id = ?
|
|
113
|
+
`).get(bindingId(scope, qualifier));
|
|
114
|
+
return row ? rowToBinding(row) : null;
|
|
115
|
+
}
|
|
116
|
+
listBindings() {
|
|
117
|
+
const rows = this.db.prepare(`
|
|
118
|
+
SELECT id, scope, qualifier, mode, record_json, set_at, set_by
|
|
119
|
+
FROM operator_context_mode_bindings
|
|
120
|
+
ORDER BY scope, qualifier NULLS FIRST, id
|
|
121
|
+
`).all();
|
|
122
|
+
return rows.map(rowToBinding);
|
|
123
|
+
}
|
|
124
|
+
deleteBinding(scope, qualifier) {
|
|
125
|
+
const info = this.db.prepare(`
|
|
126
|
+
DELETE FROM operator_context_mode_bindings WHERE id = ?
|
|
127
|
+
`).run(bindingId(scope, qualifier));
|
|
128
|
+
return info.changes > 0;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Resolve the most-specific applicable binding for a read context.
|
|
132
|
+
* Returns null when no binding matches — callers MUST treat null as
|
|
133
|
+
* `unknown_posture` per convention §Q6 (do NOT default to `desk`).
|
|
134
|
+
*
|
|
135
|
+
* Specificity ranks (qitem > workstream > rig > global_host) are
|
|
136
|
+
* defined in rig-policy-types.SCOPE_SPECIFICITY. For each scope the
|
|
137
|
+
* resolver picks the binding whose qualifier matches the read
|
|
138
|
+
* context. Among multiple matching bindings, the most-specific
|
|
139
|
+
* scope wins.
|
|
140
|
+
*/
|
|
141
|
+
resolveEffective(ctx) {
|
|
142
|
+
const candidates = [];
|
|
143
|
+
if (ctx.qitemId) {
|
|
144
|
+
const b = this.getBinding("qitem", ctx.qitemId);
|
|
145
|
+
if (b)
|
|
146
|
+
candidates.push(b);
|
|
147
|
+
}
|
|
148
|
+
if (ctx.workstreamId) {
|
|
149
|
+
const b = this.getBinding("workstream", ctx.workstreamId);
|
|
150
|
+
if (b)
|
|
151
|
+
candidates.push(b);
|
|
152
|
+
}
|
|
153
|
+
if (ctx.rigId) {
|
|
154
|
+
const b = this.getBinding("rig", ctx.rigId);
|
|
155
|
+
if (b)
|
|
156
|
+
candidates.push(b);
|
|
157
|
+
}
|
|
158
|
+
const host = this.getBinding("global_host", null);
|
|
159
|
+
if (host)
|
|
160
|
+
candidates.push(host);
|
|
161
|
+
if (candidates.length === 0)
|
|
162
|
+
return null;
|
|
163
|
+
candidates.sort((a, b) => SCOPE_SPECIFICITY[b.record.scope] - SCOPE_SPECIFICITY[a.record.scope]);
|
|
164
|
+
const winner = candidates[0];
|
|
165
|
+
return {
|
|
166
|
+
binding: winner,
|
|
167
|
+
resolvedScope: winner.record.scope,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=rig-policy-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rig-policy-store.js","sourceRoot":"","sources":["../../../src/domain/rig-policy/rig-policy-store.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,+DAA+D;AAC/D,mEAAmE;AACnE,gDAAgD;AAChD,EAAE;AACF,qBAAqB;AACrB,kEAAkE;AAClE,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,0EAA0E;AAC1E,+DAA+D;AAC/D,kEAAkE;AAClE,wEAAwE;AACxE,0EAA0E;AAC1E,0DAA0D;AAC1D,EAAE;AACF,2DAA2D;AAC3D,qEAAqE;AACrE,0DAA0D;AAC1D,EAA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AE,CAAC;YACrB,MAAM,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;YAC1D,IAAI,CAAC;gBAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;QACD,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACd,MAAM,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;YAC5C,IAAI,CAAC;gBAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAClD,IAAI,IAAI;YAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEhC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAEzC,UAAU,CAAC,IAAI,CACb,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAChF,CAAC;QACF,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC;QAC9B,OAAO;YACL,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;SACnC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component 2 — six reserved mode names. Lowercase single English
|
|
3
|
+
* words; synonyms and numeric aliases (`L0`–`L3`, `operator:L<n>`)
|
|
4
|
+
* are explicitly forbidden by the convention. The L0–L3 collision
|
|
5
|
+
* warning at `conventions/operator-context-mode-system/README.md`
|
|
6
|
+
* §"L0–L3 Collision Warning" is load-bearing.
|
|
7
|
+
*/
|
|
8
|
+
export type OperatorContextMode = "sleep" | "desk" | "mobile" | "away" | "focus" | "debug";
|
|
9
|
+
export declare const OPERATOR_CONTEXT_MODES: readonly ["sleep", "desk", "mobile", "away", "focus", "debug"];
|
|
10
|
+
/**
|
|
11
|
+
* Component 4 — four scopes. More-specific overrides less-specific
|
|
12
|
+
* when multiple modes coexist (Scope hierarchy: qitem > workstream >
|
|
13
|
+
* rig > global_host).
|
|
14
|
+
*/
|
|
15
|
+
export type OperatorContextScope = "global_host" | "rig" | "workstream" | "qitem";
|
|
16
|
+
export declare const OPERATOR_CONTEXT_SCOPES: readonly ["global_host", "rig", "workstream", "qitem"];
|
|
17
|
+
/**
|
|
18
|
+
* Scope specificity ranks; higher number = more specific. Used by the
|
|
19
|
+
* store's effective-mode resolver. NOT operator-facing.
|
|
20
|
+
*/
|
|
21
|
+
export declare const SCOPE_SPECIFICITY: Record<OperatorContextScope, number>;
|
|
22
|
+
export type AutonomyScope = "pre_approved_only" | "bounded_continuation" | "full_autonomy_within_workstream" | "full_autonomy";
|
|
23
|
+
export type HeartbeatCadence = "sparse" | "normal" | "fast";
|
|
24
|
+
export type InspectionDepth = "surface" | "normal" | "forensic";
|
|
25
|
+
export type UpdateDetail = "compact" | "normal" | "verbose";
|
|
26
|
+
export type EscalationThreshold = "low" | "normal" | "high" | "blocker_only";
|
|
27
|
+
/**
|
|
28
|
+
* Component 3 — concurrency_limit. Suggested values include the enum
|
|
29
|
+
* forms below + structured integer values (1..N). v0 ships the enum
|
|
30
|
+
* subset for simplicity; an integer specialization can graduate via
|
|
31
|
+
* Mode 1.5 amendment when fixture-backed evidence appears.
|
|
32
|
+
*/
|
|
33
|
+
export type ConcurrencyLimit = "serial" | "2" | "4" | "unlimited";
|
|
34
|
+
/**
|
|
35
|
+
* Component 6 — Safety Policy load-bearing rule:
|
|
36
|
+
* `permission_prompt_posture` MUST NOT include auto-accept in v0 or
|
|
37
|
+
* any descendant. The safe values are exactly these three.
|
|
38
|
+
*
|
|
39
|
+
* The enum is STRUCTURALLY closed: no auto-accept literal exists in
|
|
40
|
+
* the union. A contributor cannot "set permissionPromptPosture =
|
|
41
|
+
* 'auto_accept'" because the literal isn't a member; TypeScript
|
|
42
|
+
* rejects at compile time. The validator additionally rejects any
|
|
43
|
+
* non-member string at runtime (defense-in-depth for inputs that
|
|
44
|
+
* bypass typing — JSON file, env var, etc).
|
|
45
|
+
*
|
|
46
|
+
* If a future amendment proposes auto-accept, it MUST first amend
|
|
47
|
+
* the permission-posture canon at
|
|
48
|
+
* `conventions/permission-posture/README.md` AND the FROZEN
|
|
49
|
+
* operator-context-mode safety policy. This slice and its
|
|
50
|
+
* descendants reject auto-accept independently of any caller intent.
|
|
51
|
+
*/
|
|
52
|
+
export type PermissionPromptPosture = "normal" | "batch_for_human" | "do_not_prompt_unless_blocked";
|
|
53
|
+
export declare const SAFE_PERMISSION_PROMPT_POSTURES: readonly ["normal", "batch_for_human", "do_not_prompt_unless_blocked"];
|
|
54
|
+
/**
|
|
55
|
+
* Component 4 — citation source. Free-text in v0 (operator may cite
|
|
56
|
+
* `current-mode.md`, a qitem id, a chatroom topic, or a convention-only
|
|
57
|
+
* declaration). Structured citations are a Mode 1.5 amendment per
|
|
58
|
+
* the convention.
|
|
59
|
+
*/
|
|
60
|
+
export type EvidenceCitation = string;
|
|
61
|
+
/**
|
|
62
|
+
* Component 4 — expiry_or_stale_rule. v0 declares the field with a
|
|
63
|
+
* conservative default ("re_confirm_on_long_gap"); the numeric
|
|
64
|
+
* threshold is deferred per convention Q3 to a Mode 2 helper slice.
|
|
65
|
+
* The rule values below enumerate the supported re-confirmation
|
|
66
|
+
* triggers. NO silent-switch value exists — drift is always a
|
|
67
|
+
* question, never an auto-mode-change.
|
|
68
|
+
*/
|
|
69
|
+
export type ExpiryOrStaleRule = "none" | "re_confirm_on_long_gap" | "re_confirm_on_day_boundary" | "re_confirm_on_observed_conflict";
|
|
70
|
+
export declare const STALE_RULES: readonly ["none", "re_confirm_on_long_gap", "re_confirm_on_day_boundary", "re_confirm_on_observed_conflict"];
|
|
71
|
+
/**
|
|
72
|
+
* Component 3 — the 10-field SETTINGS schema. ALL fields are required
|
|
73
|
+
* by the validator; none may be merged or dropped. Reviewer field-set
|
|
74
|
+
* integrity check (HG-2).
|
|
75
|
+
*
|
|
76
|
+
* **`mode` is NOT in this record.** Mode is the binding's identity
|
|
77
|
+
* (Component 2 — the name of the named bundle); the record parameterizes
|
|
78
|
+
* how that named mode shapes ergonomics. The binding wrapper
|
|
79
|
+
* (OperatorContextModeBinding) carries `mode` at the top level so the
|
|
80
|
+
* frozen 10-field settings record stays exactly 10 fields, as declared
|
|
81
|
+
* by the convention's §Component 3 table.
|
|
82
|
+
*/
|
|
83
|
+
export interface OperatorContextModeRecord {
|
|
84
|
+
autonomy_scope: AutonomyScope;
|
|
85
|
+
heartbeat_cadence: HeartbeatCadence;
|
|
86
|
+
inspection_depth: InspectionDepth;
|
|
87
|
+
update_detail: UpdateDetail;
|
|
88
|
+
escalation_threshold: EscalationThreshold;
|
|
89
|
+
concurrency_limit: ConcurrencyLimit;
|
|
90
|
+
permission_prompt_posture: PermissionPromptPosture;
|
|
91
|
+
scope: OperatorContextScope;
|
|
92
|
+
expiry_or_stale_rule: ExpiryOrStaleRule;
|
|
93
|
+
evidence_citation: EvidenceCitation;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A scoped binding of a mode to a target context. The store keys rows
|
|
97
|
+
* by (scope, qualifier) so the same scope can hold many bindings
|
|
98
|
+
* (e.g., multiple rig-scoped modes), and the effective-mode resolver
|
|
99
|
+
* picks the right one for the (rig, workstream, qitem) read context.
|
|
100
|
+
*
|
|
101
|
+
* - `global_host` bindings have a null qualifier.
|
|
102
|
+
* - `rig` bindings carry the rig id as qualifier.
|
|
103
|
+
* - `workstream` bindings carry the workstream id as qualifier.
|
|
104
|
+
* - `qitem` bindings carry the qitem id as qualifier.
|
|
105
|
+
*/
|
|
106
|
+
export interface OperatorContextModeBinding {
|
|
107
|
+
/** Stable identifier — `${scope}:${qualifier ?? "host"}` v0. */
|
|
108
|
+
id: string;
|
|
109
|
+
/** Component 2 — the named mode this binding selects. Lives at the
|
|
110
|
+
* binding (not in the 10-field settings record) so the frozen
|
|
111
|
+
* Component-3 record stays exactly 10 fields. */
|
|
112
|
+
mode: OperatorContextMode;
|
|
113
|
+
record: OperatorContextModeRecord;
|
|
114
|
+
/** Qualifier value (rigId, workstreamId, qitemId) — null when scope is global_host. */
|
|
115
|
+
qualifier: string | null;
|
|
116
|
+
/** ISO timestamp of last set. Used by drift-rule consumers. */
|
|
117
|
+
setAt: string;
|
|
118
|
+
/** Who set it. Operator-only by contract — see update authority. */
|
|
119
|
+
setBy: "operator";
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The effective-mode read result. The resolver returns the most
|
|
123
|
+
* specific binding for a (rig?, workstream?, qitem?) context, or
|
|
124
|
+
* `null` when no binding exists at any matching scope.
|
|
125
|
+
*
|
|
126
|
+
* Per convention §"Q6 — Absent mode is unknown_posture, NOT desk":
|
|
127
|
+
* callers MUST treat a null effective mode as `unknown_posture` and
|
|
128
|
+
* re-confirm to a real mode explicitly. The resolver does NOT default
|
|
129
|
+
* to `desk` and never invents a binding.
|
|
130
|
+
*/
|
|
131
|
+
export interface EffectiveOperatorContextMode {
|
|
132
|
+
binding: OperatorContextModeBinding;
|
|
133
|
+
/** Why this binding won (which scope; for debug + UI surfacing). */
|
|
134
|
+
resolvedScope: OperatorContextScope;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Read context for the resolver. All fields optional; the resolver
|
|
138
|
+
* picks the most-specific applicable binding.
|
|
139
|
+
*/
|
|
140
|
+
export interface OperatorContextReadContext {
|
|
141
|
+
rigId?: string;
|
|
142
|
+
workstreamId?: string;
|
|
143
|
+
qitemId?: string;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=rig-policy-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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
|
+
// convention at conventions/operator-context-mode-system/README.md is
|
|
5
|
+
// the FROZEN spec; types below mirror it as closed enums + a 10-field
|
|
6
|
+
// schema. None of these fields may be silently merged or dropped — the
|
|
7
|
+
// validator enforces field-set integrity.
|
|
8
|
+
//
|
|
9
|
+
// GATE-ZERO (HG-SAFE): this primitive is permission-ADJACENT but NEVER
|
|
10
|
+
// permission-modifying. `permission_prompt_posture` is a descriptive
|
|
11
|
+
// operator-set ergonomic hint. The enum below is STRUCTURALLY
|
|
12
|
+
// incapable of expressing auto-accept: there is no auto-accept member
|
|
13
|
+
// in the union, and the validator further rejects unknown values. Any
|
|
14
|
+
// future contributor who tries to add an auto-accept value here MUST
|
|
15
|
+
// also amend the permission-posture convention + safety policy in the
|
|
16
|
+
// FROZEN contract — review will reject otherwise.
|
|
17
|
+
export const OPERATOR_CONTEXT_MODES = [
|
|
18
|
+
"sleep",
|
|
19
|
+
"desk",
|
|
20
|
+
"mobile",
|
|
21
|
+
"away",
|
|
22
|
+
"focus",
|
|
23
|
+
"debug",
|
|
24
|
+
];
|
|
25
|
+
export const OPERATOR_CONTEXT_SCOPES = [
|
|
26
|
+
"global_host",
|
|
27
|
+
"rig",
|
|
28
|
+
"workstream",
|
|
29
|
+
"qitem",
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* Scope specificity ranks; higher number = more specific. Used by the
|
|
33
|
+
* store's effective-mode resolver. NOT operator-facing.
|
|
34
|
+
*/
|
|
35
|
+
export const SCOPE_SPECIFICITY = {
|
|
36
|
+
global_host: 0,
|
|
37
|
+
rig: 1,
|
|
38
|
+
workstream: 2,
|
|
39
|
+
qitem: 3,
|
|
40
|
+
};
|
|
41
|
+
export const SAFE_PERMISSION_PROMPT_POSTURES = [
|
|
42
|
+
"normal",
|
|
43
|
+
"batch_for_human",
|
|
44
|
+
"do_not_prompt_unless_blocked",
|
|
45
|
+
];
|
|
46
|
+
export const STALE_RULES = [
|
|
47
|
+
"none",
|
|
48
|
+
"re_confirm_on_long_gap",
|
|
49
|
+
"re_confirm_on_day_boundary",
|
|
50
|
+
"re_confirm_on_observed_conflict",
|
|
51
|
+
];
|
|
52
|
+
//# sourceMappingURL=rig-policy-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rig-policy-types.js","sourceRoot":"","sources":["../../../src/domain/rig-policy/rig-policy-types.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,sEAAsE;AACtE,uEAAuE;AACvE,0CAA0C;AAC1C,EAAE;AACF,uEAAuE;AACvE,qEAAqE;AACrE,8DAA8D;AAC9D,sEAAsE;AACtE,sEAAsE;AACtE,qEAAqE;AACrE,sEAAsE;AACtE,kDAAkD;AAWlD,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;CAC0C,CAAC;AASpD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,aAAa;IACb,KAAK;IACL,YAAY;IACZ,OAAO;CAC2C,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAyC;IACrE,WAAW,EAAE,CAAC;IACd,GAAG,EAAE,CAAC;IACN,UAAU,EAAE,CAAC;IACb,KAAK,EAAE,CAAC;CACT,CAAC;AAiDF,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,QAAQ;IACR,iBAAiB;IACjB,8BAA8B;CACuB,CAAC;AAwBxD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM;IACN,wBAAwB;IACxB,4BAA4B;IAC5B,iCAAiC;CACc,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type OperatorContextMode, type OperatorContextModeRecord } from "./rig-policy-types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The 10 required fields of an OperatorContextModeRecord. Used by
|
|
4
|
+
* validateRecord to enumerate field-set integrity (HG-2) — both
|
|
5
|
+
* presence and exhaustiveness.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: `mode` is NOT in this list. Mode is the binding selector
|
|
8
|
+
* (Component 2 vocabulary), not part of the Component-3 settings
|
|
9
|
+
* record. The store/route validate mode separately at the binding
|
|
10
|
+
* boundary; this validator enforces only the 10 Component-3 fields.
|
|
11
|
+
*/
|
|
12
|
+
export declare const REQUIRED_RECORD_FIELDS: readonly (keyof OperatorContextModeRecord)[];
|
|
13
|
+
export interface ValidationOk {
|
|
14
|
+
ok: true;
|
|
15
|
+
record: OperatorContextModeRecord;
|
|
16
|
+
}
|
|
17
|
+
export interface ValidationError {
|
|
18
|
+
ok: false;
|
|
19
|
+
errors: string[];
|
|
20
|
+
}
|
|
21
|
+
export type ValidationResult = ValidationOk | ValidationError;
|
|
22
|
+
/**
|
|
23
|
+
* Validate a candidate record against the FROZEN contract. Returns
|
|
24
|
+
* the typed record on success OR a list of 3-part error messages on
|
|
25
|
+
* failure (one per offending field; report all at once so an
|
|
26
|
+
* operator doesn't have to retry per error).
|
|
27
|
+
*
|
|
28
|
+
* Strict: any field outside REQUIRED_RECORD_FIELDS is rejected
|
|
29
|
+
* (HG-2 — field-set integrity; "no merged/dropped fields").
|
|
30
|
+
*/
|
|
31
|
+
export declare function validateRecord(raw: unknown): ValidationResult;
|
|
32
|
+
/**
|
|
33
|
+
* Validate an operator-supplied mode name. Mode lives outside the
|
|
34
|
+
* 10-field record (Component 2 vocabulary, not Component 3 settings).
|
|
35
|
+
* The route + store call this at the binding boundary; the
|
|
36
|
+
* disambiguator below (for invocation parsing) is separate.
|
|
37
|
+
*/
|
|
38
|
+
export declare function validateModeName(raw: unknown): {
|
|
39
|
+
ok: true;
|
|
40
|
+
mode: OperatorContextMode;
|
|
41
|
+
} | {
|
|
42
|
+
ok: false;
|
|
43
|
+
error: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Disambiguate operator-supplied mode input. Per convention §Component 4
|
|
47
|
+
* "Bare-Word Disambiguation":
|
|
48
|
+
*
|
|
49
|
+
* - A bare word that is one of the six reserved modes → invocation
|
|
50
|
+
* - An explicit `mode:` prefix → invocation
|
|
51
|
+
* - A word embedded in a sentence → NOT invocation (caller treats as topic)
|
|
52
|
+
*
|
|
53
|
+
* Returns the canonical mode name when the input is unambiguously an
|
|
54
|
+
* invocation; null otherwise. Caller emits a clarification question
|
|
55
|
+
* for null+bare-multi-word inputs (per convention "ask once").
|
|
56
|
+
*/
|
|
57
|
+
export declare function disambiguateModeInvocation(rawInput: string): OperatorContextMode | null;
|
|
58
|
+
//# sourceMappingURL=rig-policy-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rig-policy-validator.d.ts","sourceRoot":"","sources":["../../../src/domain/rig-policy/rig-policy-validator.ts"],"names":[],"mappings":"AAgBA,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAQ/B,MAAM,uBAAuB,CAAC;AAwB/B;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,CAAC,MAAM,yBAAyB,CAAC,EAW9E,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,yBAAyB,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,eAAe,CAAC;AAuC9D;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAgK7D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,mBAAmB,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAQrH;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAyBvF"}
|