@mnemom/mnemom 0.17.34-next.1 → 0.17.34-next.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.
Files changed (195) hide show
  1. package/dist/base-url-proxy.mjs +18 -4
  2. package/dist/commands/agent-config.js +5 -1
  3. package/dist/commands/agent-doctor.d.ts +9 -0
  4. package/dist/commands/agent-doctor.js +4 -0
  5. package/dist/commands/agent-session.d.ts +1 -2
  6. package/dist/commands/agent-session.js +1 -2
  7. package/dist/commands/agent-setup.d.ts +6 -0
  8. package/dist/commands/agent-setup.js +12 -1
  9. package/dist/commands/agent.d.ts +11 -0
  10. package/dist/commands/agent.js +145 -46
  11. package/dist/commands/durable-doctor.d.ts +50 -0
  12. package/dist/commands/durable-doctor.js +186 -0
  13. package/dist/commands/durable-lock.d.ts +254 -0
  14. package/dist/commands/durable-lock.js +595 -0
  15. package/dist/commands/durable-sessions.d.ts +87 -0
  16. package/dist/commands/durable-sessions.js +303 -0
  17. package/dist/commands/durable-verbs.d.ts +116 -0
  18. package/dist/commands/durable-verbs.js +393 -0
  19. package/dist/durable/flock.d.ts +26 -0
  20. package/dist/durable/flock.js +80 -0
  21. package/dist/durable/launch-spec.d.ts +7 -1
  22. package/dist/durable/launch-spec.js +10 -3
  23. package/dist/durable/seat-proxy-entry.d.ts +11 -0
  24. package/dist/durable/seat-proxy-entry.js +25 -0
  25. package/dist/durable/seat-proxy.d.ts +107 -0
  26. package/dist/durable/seat-proxy.js +599 -0
  27. package/dist/durable/seat-socket.d.ts +46 -0
  28. package/dist/durable/seat-socket.js +179 -0
  29. package/dist/durable/seat-spec-validator.d.ts +28 -0
  30. package/dist/durable/seat-spec-validator.js +59 -0
  31. package/dist/durable/test-mode.mjs +81 -0
  32. package/dist/durable/turn-chain.d.ts +55 -0
  33. package/dist/durable/turn-chain.js +178 -0
  34. package/dist/host/auto-continue.d.ts +67 -0
  35. package/dist/host/auto-continue.js +118 -0
  36. package/dist/host/bootid.d.ts +13 -0
  37. package/dist/host/bootid.js +41 -0
  38. package/dist/host/client.d.ts +123 -0
  39. package/dist/host/client.js +171 -0
  40. package/dist/host/commands.d.ts +2 -0
  41. package/dist/host/commands.js +122 -0
  42. package/dist/host/control.d.ts +33 -0
  43. package/dist/host/control.js +144 -0
  44. package/dist/host/daemon.d.ts +217 -0
  45. package/dist/host/daemon.js +606 -0
  46. package/dist/host/gate.d.ts +46 -0
  47. package/dist/host/gate.js +82 -0
  48. package/dist/host/grant.d.ts +24 -0
  49. package/dist/host/grant.js +24 -0
  50. package/dist/host/instance.d.ts +35 -0
  51. package/dist/host/instance.js +62 -0
  52. package/dist/host/integrity.d.ts +35 -0
  53. package/dist/host/integrity.js +115 -0
  54. package/dist/host/launchd.d.ts +16 -0
  55. package/dist/host/launchd.js +45 -0
  56. package/dist/host/lock.d.ts +20 -0
  57. package/dist/host/lock.js +63 -0
  58. package/dist/host/owner.d.ts +55 -0
  59. package/dist/host/owner.js +121 -0
  60. package/dist/host/plist.d.ts +16 -0
  61. package/dist/host/plist.js +85 -0
  62. package/dist/host/procs.d.ts +27 -0
  63. package/dist/host/procs.js +105 -0
  64. package/dist/host/run.d.ts +66 -0
  65. package/dist/host/run.js +314 -0
  66. package/dist/host/runtime.d.ts +8 -0
  67. package/dist/host/runtime.js +22 -0
  68. package/dist/host/s1-names.d.ts +22 -0
  69. package/dist/host/s1-names.js +21 -0
  70. package/dist/host/seat-credential.d.ts +27 -0
  71. package/dist/host/seat-credential.js +41 -0
  72. package/dist/host/seat-launch-main.d.ts +1 -0
  73. package/dist/host/seat-launch-main.js +59 -0
  74. package/dist/host/seat-launch.d.ts +116 -0
  75. package/dist/host/seat-launch.js +302 -0
  76. package/dist/host/seat.d.ts +48 -0
  77. package/dist/host/seat.js +149 -0
  78. package/dist/host/state.d.ts +33 -0
  79. package/dist/host/state.js +117 -0
  80. package/dist/host/status.d.ts +101 -0
  81. package/dist/host/status.js +307 -0
  82. package/dist/host/tmux.d.ts +56 -0
  83. package/dist/host/tmux.js +182 -0
  84. package/dist/host/transcript.d.ts +30 -0
  85. package/dist/host/transcript.js +130 -0
  86. package/dist/host/verbs.d.ts +50 -0
  87. package/dist/host/verbs.js +271 -0
  88. package/dist/index.d.ts +8 -6
  89. package/dist/index.js +197 -35
  90. package/dist/lib/agent.d.ts +8 -26
  91. package/dist/lib/agent.js +11 -26
  92. package/dist/lib/claude-plugin.d.ts +11 -2
  93. package/dist/lib/claude-plugin.js +10 -1
  94. package/dist/lib/durable/api.d.ts +136 -0
  95. package/dist/lib/durable/api.js +220 -0
  96. package/dist/lib/durable/codes.d.ts +8 -0
  97. package/dist/lib/durable/codes.js +2 -0
  98. package/dist/lib/durable/first-turn.d.ts +50 -0
  99. package/dist/lib/durable/first-turn.js +102 -0
  100. package/dist/lib/durable/gate.d.ts +48 -0
  101. package/dist/lib/durable/gate.js +122 -0
  102. package/dist/lib/durable/handover.d.ts +101 -0
  103. package/dist/lib/durable/handover.js +175 -0
  104. package/dist/lib/durable/launch.d.ts +182 -0
  105. package/dist/lib/durable/launch.js +443 -0
  106. package/dist/lib/durable/launching.d.ts +15 -0
  107. package/dist/lib/durable/launching.js +70 -0
  108. package/dist/lib/durable/live.d.ts +194 -0
  109. package/dist/lib/durable/live.js +635 -0
  110. package/dist/lib/durable/refusal.d.ts +57 -0
  111. package/dist/lib/durable/refusal.js +78 -0
  112. package/dist/lib/durable/view.d.ts +83 -0
  113. package/dist/lib/durable/view.js +244 -0
  114. package/dist/lib/experimental.d.ts +0 -9
  115. package/dist/lib/experimental.js +18 -17
  116. package/dist/lib/launcher-config.d.ts +7 -0
  117. package/dist/lib/launcher-config.js +21 -0
  118. package/dist/lib/scan/report-email.d.ts +1 -1
  119. package/dist/lib/scan/report-email.js +9 -1
  120. package/dist/lib/subscription-login.d.ts +15 -0
  121. package/dist/lib/subscription-login.js +28 -1
  122. package/dist/vendor/durable-contract/index.js +240 -18
  123. package/dist/vendor/shared/durable-contract/admission.d.ts +240 -0
  124. package/dist/vendor/shared/durable-contract/admission.js +533 -0
  125. package/dist/vendor/shared/durable-contract/arm.d.ts +51 -0
  126. package/dist/vendor/shared/durable-contract/arm.js +133 -0
  127. package/dist/vendor/shared/durable-contract/canonical.d.ts +29 -0
  128. package/dist/vendor/shared/durable-contract/canonical.js +98 -0
  129. package/dist/vendor/shared/durable-contract/cell-id.d.ts +22 -0
  130. package/dist/vendor/shared/durable-contract/cell-id.js +38 -0
  131. package/dist/vendor/shared/durable-contract/cli-output.d.ts +342 -0
  132. package/dist/vendor/shared/durable-contract/cli-output.js +201 -0
  133. package/dist/vendor/shared/durable-contract/cli-surface.d.ts +119 -0
  134. package/dist/vendor/shared/durable-contract/cli-surface.js +270 -0
  135. package/dist/vendor/shared/durable-contract/codes.d.ts +537 -0
  136. package/dist/vendor/shared/durable-contract/codes.js +475 -0
  137. package/dist/vendor/shared/durable-contract/constants.d.ts +153 -0
  138. package/dist/vendor/shared/durable-contract/constants.js +179 -0
  139. package/dist/vendor/shared/durable-contract/doors.d.ts +119 -0
  140. package/dist/vendor/shared/durable-contract/doors.js +249 -0
  141. package/dist/vendor/shared/durable-contract/envelope.d.ts +103 -0
  142. package/dist/vendor/shared/durable-contract/envelope.js +317 -0
  143. package/dist/vendor/shared/durable-contract/events.d.ts +147 -0
  144. package/dist/vendor/shared/durable-contract/events.js +630 -0
  145. package/dist/vendor/shared/durable-contract/executor-state.d.ts +41 -0
  146. package/dist/vendor/shared/durable-contract/executor-state.js +32 -0
  147. package/dist/vendor/shared/durable-contract/fixlines.d.ts +318 -0
  148. package/dist/vendor/shared/durable-contract/fixlines.js +483 -0
  149. package/dist/vendor/shared/durable-contract/freeze-record.d.ts +787 -0
  150. package/dist/vendor/shared/durable-contract/freeze-record.js +361 -0
  151. package/dist/vendor/shared/durable-contract/index.d.ts +36 -0
  152. package/dist/vendor/shared/durable-contract/index.js +37 -0
  153. package/dist/vendor/shared/durable-contract/journal-approvals.d.ts +29 -0
  154. package/dist/vendor/shared/durable-contract/journal-approvals.js +60 -0
  155. package/dist/vendor/shared/durable-contract/keys.d.ts +24 -0
  156. package/dist/vendor/shared/durable-contract/keys.js +66 -0
  157. package/dist/vendor/shared/durable-contract/lock.d.ts +128 -0
  158. package/dist/vendor/shared/durable-contract/lock.js +151 -0
  159. package/dist/vendor/shared/durable-contract/names.d.ts +25 -0
  160. package/dist/vendor/shared/durable-contract/names.js +78 -0
  161. package/dist/vendor/shared/durable-contract/owner-verbs.d.ts +175 -0
  162. package/dist/vendor/shared/durable-contract/owner-verbs.js +403 -0
  163. package/dist/vendor/shared/durable-contract/paths.d.ts +23 -0
  164. package/dist/vendor/shared/durable-contract/paths.js +35 -0
  165. package/dist/vendor/shared/durable-contract/pure-fn.d.ts +48 -0
  166. package/dist/vendor/shared/durable-contract/pure-fn.js +89 -0
  167. package/dist/vendor/shared/durable-contract/routes.d.ts +205 -0
  168. package/dist/vendor/shared/durable-contract/routes.js +315 -0
  169. package/dist/vendor/shared/durable-contract/schema.d.ts +126 -0
  170. package/dist/vendor/shared/durable-contract/schema.js +441 -0
  171. package/dist/vendor/shared/durable-contract/seal.d.ts +54 -0
  172. package/dist/vendor/shared/durable-contract/seal.js +99 -0
  173. package/dist/vendor/shared/durable-contract/secret-scope.d.ts +28 -0
  174. package/dist/vendor/shared/durable-contract/secret-scope.js +76 -0
  175. package/dist/vendor/shared/durable-contract/session-id.d.ts +21 -0
  176. package/dist/vendor/shared/durable-contract/session-id.js +58 -0
  177. package/dist/vendor/shared/durable-contract/spec.d.ts +162 -0
  178. package/dist/vendor/shared/durable-contract/spec.js +286 -0
  179. package/dist/vendor/shared/durable-contract/states.d.ts +96 -0
  180. package/dist/vendor/shared/durable-contract/states.js +218 -0
  181. package/dist/vendor/shared/durable-contract/telemetry.d.ts +94 -0
  182. package/dist/vendor/shared/durable-contract/telemetry.js +180 -0
  183. package/dist/vendor/shared/durable-contract/test-mode.d.ts +62 -0
  184. package/dist/vendor/shared/durable-contract/test-mode.js +140 -0
  185. package/dist/vendor/shared/durable-contract/turn.d.ts +57 -0
  186. package/dist/vendor/shared/durable-contract/turn.js +81 -0
  187. package/dist/vendor/shared/durable-contract/vectors.d.ts +191 -0
  188. package/dist/vendor/shared/durable-contract/vectors.js +208 -0
  189. package/package.json +3 -2
  190. package/plugins/integrity-manifest.json +35 -0
  191. package/plugins/mnemom/hooks/hooks.json +15 -1
  192. package/plugins/mnemom/hooks/register.tsx +60 -2
  193. package/plugins/mnemom/hooks/seat-hello.mjs +116 -0
  194. package/dist/commands/agent-implicit-notice.d.ts +0 -31
  195. package/dist/commands/agent-implicit-notice.js +0 -73
@@ -0,0 +1,361 @@
1
+ // GENERATED from shared/durable-contract/src/freeze-record.ts by cli/scripts/sync-durable-contract.mjs; do not edit.
2
+ /**
3
+ * The freeze record: every frozen value by name, as the eval runner reads `$S1.<NAME>` and
4
+ * `$S1.<NAME>.<path>` (CASE-DSL section 5.2). Built from the modules, never restated.
5
+ *
6
+ * FREEZE_RECORD scalars (string, number, boolean, or null while a calibration is pending)
7
+ * FREEZE_STRUCTURED frozen lists, tables and maps (JSON values)
8
+ * FREEZE_ALIASES the DSL spellings datasets already use, each naming one canonical entry
9
+ *
10
+ * A name lives in exactly one of the three. Names the datasets cite that are not S1 values (lane
11
+ * URLs, installed versions, baselines, module paths of other lanes) are not here on purpose: they
12
+ * are lane or case bindings.
13
+ */
14
+ import * as C from "./constants.js";
15
+ import { API_CELL_ID_VECTORS_SHA256, CANONICAL_CELL_IDS } from "./cell-id.js";
16
+ import { LEASE_KEY_PREFIX } from "./keys.js";
17
+ import { ARM_HEADER, ARM_VERSION } from "./arm.js";
18
+ import { CHARTER_BY_HASH_BODY_KEYS, CHARTER_BY_HASH_RESPONSE, CHARTER_SEALED_AT_RE, CLAIM_BODY_KEYS, EXEC_SESSIONS_RESPONSE, OWNER_SESSION_VIEW_FIELDS, GATEWAY_EVENTS_BODY_KEYS, EXECUTOR_KEY_HEADER, HEARTBEAT_REQUEST_KEYS, INTERNAL_KEY_HEADER, ROUTES, } from "./routes.js";
19
+ import * as D from "./doors.js";
20
+ import { JOURNAL_APPROVAL_KINDS } from "./journal-approvals.js";
21
+ import { PARKED_ONLY_WAIT_REASONS, READY_USER_TEXT, WAIT_REASONS } from "./states.js";
22
+ import { SECRET_SCOPE } from "./secret-scope.js";
23
+ import { EXECUTOR_STATE_DIR, EXECUTOR_STATE_DIR_MODE, EXECUTOR_STATE_FILE, EXECUTOR_STATE_FILE_MODE, } from "./paths.js";
24
+ import { ATTRIBUTE_VALUES, DEVICE_VERIFY_AAL_DEFAULT, M1_SPAN_NAMES, SPAN_ATTRIBUTE_KEYS, SPAN_DEVICE_VERIFY_WOULD_REFUSE, SPAN_DURABLE_ADMISSION, SPAN_DURABLE_CLAIM, SPAN_DURABLE_ENROLLMENT, SPAN_DURABLE_SEAT_HELLO, SPAN_DURABLE_SWEEP, SWEEP_LOG_NAME, } from "./telemetry.js";
25
+ import { EVENT_PREIMAGE_FIELDS, EXECUTOR_WRITABLE_KINDS, GATEWAY_EVENTS_ROUTE, GATEWAY_WRITABLE_KINDS, GENESIS_PREV_HASH, READY_CAUSES, TERMINAL_EVENT_KINDS, } from "./events.js";
26
+ import { CLAIM_INELIGIBLE_DETAILS, CLAIM_INELIGIBLE_REASONS, CLAIM_LOST_RACE_REASONS, CLAIM_OUTCOMES, DURABLE_CODES, PARK_REFUSAL_REASONS, HEARTBEAT_ENTRY_FIELDS, HEARTBEAT_RESULT_FIELDS, ENROLL_POLL_ERROR_STATUS, ENROLL_POLL_ERRORS, } from "./codes.js";
27
+ import { DEVICE_PAGE_MARKERS, FIX_LINES, RISK_LINE_TEXT, RISK_SENTENCE_ID_HOST, STOPPED_FIX, STOPPED_REASON_TEXT, U05_CHECK_TEXT_ATTESTATION_FAILED, U05_CHECK_TEXT_RESPAWN_FAILED, U05_FIXTURE_CHECK, } from "./fixlines.js";
28
+ import { PLUGIN_DIR, PLUGIN_MANIFEST_FAILURES, PLUGIN_MANIFEST_PATH, PLUGIN_MANIFEST_SCHEMA, } from "./spec.js";
29
+ import { AGENT_EXECUTORS_SCOPE_CHECK, AGENT_SESSIONS_READY_CHECK, AGENT_SESSIONS_WAIT_PARKED_CHECK, DURABLE_APPROVAL_SESSIONLESS_SUBJECTS, DURABLE_APPROVAL_SUBJECTS, DURABLE_APPROVALS_TARGET_CHECK, EXECUTE_EXCEPTIONS, M1_ARBITERS, M1_COLUMNS, M1_FUNCTIONS, M1_TABLES, } from "./schema.js";
30
+ import { ADMIT_SWEEP_VALUES, ADMIT_SWEEP_VECTORS_PATH, GUARD_STATE_FAULT, GUARD_STATE_OK, RESOLVER_SCHEMA, } from "./admission.js";
31
+ import { GUARD_LISTS, TEST_ALLOWLIST, TEST_FLAKY_RUNS, TEST_MODE_ENV, TEST_MODE_MODULE, } from "./test-mode.js";
32
+ import { KEY_EFFECT_OF_TRANSITION, OLD_ROUTE_BRANCH, OLD_ROUTE_REFRESH, REVOKING_TRANSITIONS, } from "./owner-verbs.js";
33
+ import { RESERVED_SESSION_VERBS, SESSION_NAME_MAX_CHARS } from "./names.js";
34
+ import { CLI_REFUSAL_EXIT, CLI_USAGE_EXIT, FINGERPRINT_HEX_CHARS, HOST_STATUS_JSON, HOST_STATUS_JSON_VECTORS, } from "./cli-output.js";
35
+ import { M1_CLI_SURFACE, PRE_M1_LAUNCHER_SUBVERBS } from "./cli-surface.js";
36
+ import { PURE_FN_EXPORTS, PURE_FN_M1_PENDING } from "./pure-fn.js";
37
+ import { EXECUTOR_STATE_SCHEMA } from "./executor-state.js";
38
+ import { CHARTER_HASH_EXCLUDED_COLUMNS, CHARTER_PREIMAGE_FIELDS, CHARTER_PREIMAGE_VERSION, PIN_KEYS, } from "./envelope.js";
39
+ export const FREEZE_RECORD = Object.freeze({
40
+ DURABLE_CONTRACT_VERSION: C.DURABLE_CONTRACT_VERSION,
41
+ DURABLE_SCHEMA_VERSION: C.DURABLE_SCHEMA_VERSION,
42
+ LEASE_SECONDS_DEFAULT: C.LEASE_SECONDS_DEFAULT,
43
+ LEASE_SECONDS_MIN: C.LEASE_SECONDS_MIN,
44
+ LEASE_SECONDS_MAX: C.LEASE_SECONDS_MAX,
45
+ RESUME_RESET_SECONDS_DEFAULT: C.RESUME_RESET_SECONDS_DEFAULT,
46
+ RESUME_RESET_SECONDS_MIN: C.RESUME_RESET_SECONDS_MIN,
47
+ RESUME_RESET_SECONDS_MAX: C.RESUME_RESET_SECONDS_MAX,
48
+ HEARTBEAT_DIVISOR: C.HEARTBEAT_DIVISOR,
49
+ RESPAWN_FAILURES_SUSPEND_AT: C.RESPAWN_FAILURES_SUSPEND_AT,
50
+ RESPAWN_CONCURRENCY: C.RESPAWN_CONCURRENCY,
51
+ LEASE_KEY_TOUCH_SECONDS: C.LEASE_KEY_TOUCH_SECONDS,
52
+ STALE_SERVE_M1: C.STALE_SERVE_M1,
53
+ NOFENCE_M1: C.NOFENCE_M1,
54
+ NOFENCE_ADMIT_VALUE: C.NOFENCE_ADMIT_VALUE,
55
+ RESOLVER_TIMEOUT_MS: C.RESOLVER_TIMEOUT_MS,
56
+ ARM_PROBE_TIMEOUT_MS: C.ARM_PROBE_TIMEOUT_MS,
57
+ ARM_PROBE_TTL_S: C.ARM_PROBE_TTL_S,
58
+ PROTECTION_CACHE_S: C.PROTECTION_CACHE_S,
59
+ GRANT_TTL_S: C.GRANT_TTL_S,
60
+ GRANT_WARNING_S: C.GRANT_WARNING_S,
61
+ CLEAN_EXIT_MAX: C.CLEAN_EXIT_MAX,
62
+ CLEAN_EXIT_WINDOW_S: C.CLEAN_EXIT_WINDOW_S,
63
+ EXECUTOR_POLL_S: C.EXECUTOR_POLL_S,
64
+ EXECUTOR_LIVE_S: C.EXECUTOR_LIVE_S,
65
+ ATTACH_WAIT_S: C.ATTACH_WAIT_S,
66
+ CLAIM_BACKOFF_BASE_S: C.CLAIM_BACKOFF_BASE_S,
67
+ CLAIM_BACKOFF_MAX_S: C.CLAIM_BACKOFF_MAX_S,
68
+ CLAIM_BACKOFF_JITTER: C.CLAIM_BACKOFF_JITTER,
69
+ CLAIM_UNAVAILABLE_SURFACE_N: C.CLAIM_UNAVAILABLE_SURFACE_N,
70
+ TRACKED_STOP_GRACE_S: C.TRACKED_STOP_GRACE_S,
71
+ SEAT_MAX_ATTEMPTS_NONRETRY: C.SEAT_MAX_ATTEMPTS_NONRETRY,
72
+ TURN_WAIT_MS: C.TURN_WAIT_MS,
73
+ TURN_HEADER_MAX_LEN: C.TURN_HEADER_MAX_LEN,
74
+ TURN_ENTRIES_MAX: C.TURN_ENTRIES_MAX,
75
+ SWEEP_MAX_ROWS: C.SWEEP_MAX_ROWS,
76
+ SWEEP_BATCH_SIZE: C.SWEEP_BATCH_SIZE,
77
+ SWEEP_TIME_BUDGET_MS: C.SWEEP_TIME_BUDGET_MS,
78
+ SWEEP_CRON: C.SWEEP_CRON,
79
+ PER_SESSION_BUDGET_LIMIT_USD: C.PER_SESSION_BUDGET_LIMIT_USD,
80
+ CONTRACT_STATEMENT_MAX_CHARS: C.CONTRACT_STATEMENT_MAX_CHARS,
81
+ CONTRACT_JSON_MAX_BYTES: C.CONTRACT_JSON_MAX_BYTES,
82
+ EVENT_DETAIL_MAX_CHARS: C.EVENT_DETAIL_MAX_CHARS,
83
+ CONTRACT_PURGE_AFTER_S: C.CONTRACT_PURGE_AFTER_S,
84
+ DEVICE_STEP_FRESHNESS_S: C.DEVICE_STEP_FRESHNESS_S,
85
+ STEP_UP_BLOB_FIELD: C.STEP_UP_BLOB_FIELD,
86
+ /** test_integrity baseline runs and flaky retry cap (ruling 31.1). */
87
+ TEST_FLAKY_RUNS,
88
+ /** durable_approvals target CHECK text A1 mirrors (ruling 32.12). */
89
+ DURABLE_APPROVALS_TARGET_CHECK,
90
+ OWNER_MUTATION_APPROVAL_TTL_S: C.OWNER_MUTATION_APPROVAL_TTL_S,
91
+ DEVICE_POLL_INTERVAL_S: C.DEVICE_POLL_INTERVAL_S,
92
+ RISK_LINE_VERSION: C.RISK_LINE_VERSION,
93
+ RISK_LINE_VERSION_TEXT: C.RISK_LINE_VERSION_TEXT,
94
+ RENDERER_VERSION: C.RENDERER_VERSION,
95
+ PLUGIN_HASH_RECIPE_VERSION: C.PLUGIN_HASH_RECIPE_VERSION,
96
+ ADMIT_SWEEP_VECTORS_PATH,
97
+ FINGERPRINT_HEX_CHARS,
98
+ PLUGIN_DIR,
99
+ PLUGIN_MANIFEST_PATH,
100
+ EVENT_PREIMAGE_VERSION: C.EVENT_PREIMAGE_VERSION,
101
+ /** The calibrated names (CALIBRATED_PENDING) carry the DSL spelling; L_SPAWN / T_HELLO_S are aliases. */
102
+ L_spawn: C.L_SPAWN,
103
+ T_hello: C.T_HELLO_S,
104
+ L_SPAWN_MIN: C.L_SPAWN_MIN,
105
+ L_SPAWN_MAX: C.L_SPAWN_MAX,
106
+ API_CELL_ID_VECTORS_SHA256,
107
+ LEASE_KEY_PREFIX,
108
+ ARM_HEADER,
109
+ ARM_VERSION,
110
+ GENESIS_PREV_HASH,
111
+ GATEWAY_EVENTS_ROUTE,
112
+ CHARTER_PREIMAGE_VERSION,
113
+ SESSION_NAME_MAX_CHARS,
114
+ RISK_LINE_TEXT,
115
+ TEST_MODE_ENV,
116
+ DEVICE_VERIFY_AAL_DEFAULT,
117
+ SPAN_DURABLE_ADMISSION,
118
+ SPAN_DURABLE_CLAIM,
119
+ SPAN_DURABLE_SEAT_HELLO,
120
+ SPAN_DURABLE_SWEEP,
121
+ SPAN_DEVICE_VERIFY_WOULD_REFUSE,
122
+ SWEEP_LOG_NAME,
123
+ // ---- wave-0 fix amendment ----
124
+ OWNER_MUTATION_CLIENT_ID: C.OWNER_MUTATION_CLIENT_ID,
125
+ EXECUTOR_STATE_DIR,
126
+ EXECUTOR_STATE_FILE,
127
+ EXECUTOR_STATE_DIR_MODE,
128
+ EXECUTOR_STATE_FILE_MODE,
129
+ OLD_ROUTE_BRANCH,
130
+ OLD_ROUTE_REFRESH,
131
+ U05_FIXTURE_CHECK,
132
+ U05_CHECK_TEXT_RESPAWN_FAILED,
133
+ U05_CHECK_TEXT_ATTESTATION_FAILED,
134
+ RISK_SENTENCE_ID_HOST,
135
+ SPAN_DURABLE_ENROLLMENT,
136
+ ENROLL_POLL_ERROR_STATUS,
137
+ /** Ruling 19: every refusal exits 1 (with or without --json); usage errors and the gate exit 2. */
138
+ CLI_REFUSAL_EXIT,
139
+ CLI_USAGE_EXIT,
140
+ // ---- executor wire (rulings 33.28, 33.28.1) ----
141
+ EXECUTOR_KEY_HEADER,
142
+ // ---- charter by hash (ruling 33.32) ----
143
+ INTERNAL_KEY_HEADER,
144
+ CHARTER_SEALED_AT_PATTERN: CHARTER_SEALED_AT_RE.source,
145
+ // ---- Doors amendment (rulings 34.01-34.12) ----
146
+ DURABLE_POOL_CLAIM_FLAG: D.DURABLE_POOL_CLAIM_FLAG,
147
+ OIDC_EXCHANGE_AUDIENCE: D.OIDC_EXCHANGE_AUDIENCE,
148
+ LIVE_LEASE_CAP_MIN: D.LIVE_LEASE_CAP_MIN,
149
+ LIVE_LEASE_CAP_MAX: D.LIVE_LEASE_CAP_MAX,
150
+ ORG_CAP_LOCK_PREFIX: D.ORG_CAP_LOCK_PREFIX,
151
+ DEFAULT_LEASE_CAP_ENV: D.DEFAULT_LEASE_CAP_ENV,
152
+ DISPATCH_SESSION_CID_PREFIX: D.DISPATCH_SESSION_CID_PREFIX,
153
+ DISPATCH_SESSION_NAME_PREFIX: D.DISPATCH_SESSION_NAME_PREFIX,
154
+ READY_SESSIONS_LIMIT_MIN: D.READY_SESSIONS_LIMIT_MIN,
155
+ READY_SESSIONS_LIMIT_MAX: D.READY_SESSIONS_LIMIT_MAX,
156
+ READY_USER_TEXT,
157
+ RUNNER_FAILED_PHASE_PATTERN: D.RUNNER_FAILED_PHASE_RE.source,
158
+ AGENT_SESSIONS_READY_CHECK,
159
+ AGENT_SESSIONS_WAIT_PARKED_CHECK,
160
+ AGENT_EXECUTORS_SCOPE_CHECK,
161
+ });
162
+ const identityMap = (keys) => Object.freeze(Object.fromEntries(keys.map((k) => [k, k])));
163
+ export const FREEZE_STRUCTURED = Object.freeze({
164
+ /** Every frozen error code, keyed by itself (`$S1.CODES.durable_lease_fenced` is the code). */
165
+ CODES: identityMap(Object.keys(DURABLE_CODES)),
166
+ /** durable_claim_outcome values, keyed by themselves. */
167
+ CLAIM_OUTCOME: identityMap(CLAIM_OUTCOMES),
168
+ /**
169
+ * The C10-R0 (i)-(k) journal refusals by role, as C10 cases cite them
170
+ * (`$S1.JOURNAL_CODES.unknown_kind`). No "not homed" entry: S1 freezes no such code.
171
+ */
172
+ JOURNAL_CODES: Object.freeze({
173
+ append_conflict: "durable_append_conflict",
174
+ idempotency_conflict: "durable_idempotency_conflict",
175
+ unknown_kind: "durable_unknown_kind",
176
+ writer_class: "durable_writer_refused",
177
+ refs_invalid: "durable_refs_invalid",
178
+ }),
179
+ EXECUTOR_WRITABLE_KINDS,
180
+ GATEWAY_WRITABLE_KINDS,
181
+ EVENT_PREIMAGE_FIELDS,
182
+ CHARTER_PREIMAGE_FIELDS,
183
+ CHARTER_HASH_EXCLUDED_COLUMNS,
184
+ PIN_KEYS,
185
+ M1_SPAN_NAMES,
186
+ SPAN_ATTRIBUTE_KEYS,
187
+ ATTRIBUTE_VALUES,
188
+ M1_TABLES,
189
+ M1_COLUMNS,
190
+ M1_FUNCTIONS,
191
+ M1_ARBITERS,
192
+ EXECUTE_EXCEPTIONS,
193
+ /** durable_approvals subjects and target rule (ruling 32.12). */
194
+ DURABLE_APPROVAL_SUBJECTS,
195
+ DURABLE_APPROVAL_SESSIONLESS_SUBJECTS,
196
+ FIX_LINES,
197
+ RESERVED_SESSION_VERBS,
198
+ CANONICAL_CELL_IDS,
199
+ KEY_EFFECT_OF_TRANSITION,
200
+ REVOKING_TRANSITIONS,
201
+ TEST_MODE_GUARD_LISTS: GUARD_LISTS,
202
+ TEST_MODE_MODULE,
203
+ /** The C17-R18 integrity allowlist (ruling 31(2)). */
204
+ TEST_ALLOWLIST,
205
+ /** M1 CLI command paths and long options (ruling 32.01; E4 D1 product_missing). */
206
+ M1_CLI_SURFACE,
207
+ /** Pre-M1 `mnemom agent` launcher sub-verbs, first word only (ruling 32.35). */
208
+ PRE_M1_LAUNCHER_SUBVERBS,
209
+ /** The exports a pure_fn step may call (ruling 32.34; CASE-DSL rule 30). */
210
+ PURE_FN_EXPORTS,
211
+ /** M1 exports a pure_fn step may name before they land (ruling 33.01; E4 detector D4). */
212
+ PURE_FN_M1_PENDING,
213
+ /** The resolver per-field schema (C06-R15). */
214
+ RESOLVER_SCHEMA,
215
+ /** guard_state fixtures (jsonb) the datasets write: passes guardStateOk / the shape fault. */
216
+ GUARD_STATE_OK,
217
+ GUARD_STATE_FAULT,
218
+ // ---- wave-0 fix amendment ----
219
+ /** Executor and internal routes: `$S1.ROUTES.<name>.path`, or `.pre` + id + `.post`. */
220
+ ROUTES,
221
+ /**
222
+ * The closed list of freeze-record names allowed to be null (ruling 1.03): null until ruling 34.17.
223
+ * Empty since the ruling 34.17 calibration set L_spawn and T_hello.
224
+ */
225
+ CALIBRATED_PENDING: Object.freeze([]),
226
+ TERMINAL_EVENT_KINDS,
227
+ SECRET_SCOPE,
228
+ ENROLL_POLL_ERRORS,
229
+ DEVICE_PAGE_MARKERS,
230
+ STOPPED_FIX,
231
+ STOPPED_REASON_TEXT,
232
+ // ---- batch-24 freeze (ruling 24.0) ----
233
+ /** executor-state.json: closed {version: 1, executor_id, executor_key, nonce, boot_id} (24.14). */
234
+ EXECUTOR_STATE_SCHEMA,
235
+ /** Heartbeat request entry / response entry keys; match results by session_id (24.15). */
236
+ HEARTBEAT_ENTRY_FIELDS,
237
+ HEARTBEAT_RESULT_FIELDS,
238
+ /** GET exec_sessions body: only sessions[] and each item's uuid id are frozen (24.16). */
239
+ EXEC_SESSIONS_RESPONSE,
240
+ /** Owner session view: cc_session_id present, string or null; the view is otherwise open (#1085). */
241
+ OWNER_SESSION_VIEW_FIELDS,
242
+ /** Claim refusal details (24.22.1): lost_race reasons, ineligible reasons and their presence rules. */
243
+ CLAIM_LOST_RACE_REASONS,
244
+ CLAIM_INELIGIBLE_REASONS,
245
+ CLAIM_INELIGIBLE_DETAILS,
246
+ /** durable_refs_invalid details.reason for a refused park (34.06.3.1). */
247
+ PARK_REFUSAL_REASONS,
248
+ /** host status --json, closed: top level, seats[] and sessions[] (rulings 26, 24.12). */
249
+ HOST_STATUS_JSON,
250
+ /** host status --json for no state file, enrolled with no nonce, uninstalled with a state file (26.1). */
251
+ HOST_STATUS_JSON_VECTORS,
252
+ /** C06 sweep dimension vocabulary admitSweepDigest accepts; dims arrive ordered (24.11.1). */
253
+ ADMIT_SWEEP_VALUES,
254
+ /** Pack-time plugin integrity manifest, closed (ruling 25). */
255
+ PLUGIN_MANIFEST_SCHEMA,
256
+ PLUGIN_MANIFEST_FAILURES,
257
+ // ---- executor wire (rulings 33.28, 33.28.1) ----
258
+ HEARTBEAT_REQUEST_KEYS,
259
+ CLAIM_BODY_KEYS,
260
+ // ---- charter by hash (ruling 33.32) ----
261
+ CHARTER_BY_HASH_BODY_KEYS,
262
+ CHARTER_BY_HASH_RESPONSE,
263
+ GATEWAY_EVENTS_BODY_KEYS,
264
+ // ---- Doors amendment (rulings 34.01-34.12) ----
265
+ READY_CAUSES,
266
+ WAIT_REASONS,
267
+ PARKED_ONLY_WAIT_REASONS,
268
+ WAIT_REF_KEYS: D.WAIT_REF_KEYS,
269
+ CLEAR_WAIT_OUTCOMES: D.CLEAR_WAIT_OUTCOMES,
270
+ EXECUTOR_SCOPES: D.EXECUTOR_SCOPES,
271
+ ORG_SCOPE_EXECUTOR_KINDS: D.ORG_SCOPE_EXECUTOR_KINDS,
272
+ OIDC_EXCHANGE_REFUSALS: D.OIDC_EXCHANGE_REFUSALS,
273
+ ORG_POLICY_LIMIT_KEYS: D.ORG_POLICY_LIMIT_KEYS,
274
+ POOL_CLAIM_FIELDS: D.POOL_CLAIM_FIELDS,
275
+ CREATE_READY_SESSION_REFUSALS: D.CREATE_READY_SESSION_REFUSALS,
276
+ CREATE_READY_SESSION_OUTCOMES: D.CREATE_READY_SESSION_OUTCOMES,
277
+ CREATE_READY_SESSION_ANSWERS: D.CREATE_READY_SESSION_ANSWERS,
278
+ JOURNAL_APPROVAL_KINDS,
279
+ RUNNER_OUTCOMES: D.RUNNER_OUTCOMES,
280
+ RUNNER_OUTCOME_FIELDS: D.RUNNER_OUTCOME_FIELDS,
281
+ RUNNER_EXIT_CODES: D.RUNNER_EXIT_CODES,
282
+ RUNNER_FAILED_REASONS: D.RUNNER_FAILED_REASONS,
283
+ RUNNER_REFUSED_REASONS: D.RUNNER_REFUSED_REASONS,
284
+ RUNNER_OPEN_MODE_TOLERATED: D.RUNNER_OPEN_MODE_TOLERATED,
285
+ RUNNER_MERGE_STRATEGIES: D.RUNNER_MERGE_STRATEGIES,
286
+ });
287
+ /** DSL spellings already in the case files (CASE-DSL section 5.2 names $S1.L_spawn), each to one canonical name. */
288
+ export const FREEZE_ALIASES = Object.freeze({
289
+ L_SPAWN: "L_spawn",
290
+ T_HELLO_S: "T_hello",
291
+ PER_SESSION_BUDGET_LIMIT: "PER_SESSION_BUDGET_LIMIT_USD",
292
+ PER_SESSION_LIMIT: "PER_SESSION_BUDGET_LIMIT_USD",
293
+ DEFAULT_LEASE_SECONDS: "LEASE_SECONDS_DEFAULT",
294
+ STATEMENT_MAX: "CONTRACT_STATEMENT_MAX_CHARS",
295
+ GATEWAY_EVENTS_PATH: "GATEWAY_EVENTS_ROUTE",
296
+ SPAN_NAME_HELLO: "SPAN_DURABLE_SEAT_HELLO",
297
+ DEVICE_VERIFY_WOULD_REFUSE_SPAN: "SPAN_DEVICE_VERIFY_WOULD_REFUSE",
298
+ SPAN_NAMES_M1: "M1_SPAN_NAMES",
299
+ SPAN_KEYS_M1: "SPAN_ATTRIBUTE_KEYS",
300
+ ARBITERS: "M1_ARBITERS",
301
+ FUNCTION_EXECUTE_EXCEPTIONS: "EXECUTE_EXCEPTIONS",
302
+ TEST_MODE_GUARD_URLS: "TEST_MODE_GUARD_LISTS",
303
+ });
304
+ const own = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
305
+ /** True when `name` is a frozen S1 name (canonical or alias), set or not. */
306
+ export function s1Has(name) {
307
+ return own(FREEZE_RECORD, name) || own(FREEZE_STRUCTURED, name) || own(FREEZE_ALIASES, name);
308
+ }
309
+ /**
310
+ * True when `name` (canonical or alias) is a CALIBRATED_PENDING name whose value is still null: the
311
+ * G4 resolution check counts it RESOLVED_PENDING and the runner reports a case reading it NOT_RUN
312
+ * (s1_uncalibrated:<name>), never substituting a default (ruling 1.03).
313
+ */
314
+ export function s1Pending(name) {
315
+ const canonical = own(FREEZE_ALIASES, name)
316
+ ? FREEZE_ALIASES[name]
317
+ : name;
318
+ return pendingIn(FREEZE_RECORD, FREEZE_STRUCTURED.CALIBRATED_PENDING, canonical);
319
+ }
320
+ /**
321
+ * The ruling 1.03 test behind s1Pending: `canonical` is listed in `pending` and still null in
322
+ * `record`. Kept apart so the rule stays tested while CALIBRATED_PENDING is empty (ruling 34.17).
323
+ */
324
+ export function pendingIn(record, pending, canonical) {
325
+ return pending.includes(canonical) && record[canonical] === null;
326
+ }
327
+ /**
328
+ * `record[canonical]` for s1Value: throws on an unknown name or an unset (null) value, naming the
329
+ * spelling the case used. Kept apart for the same reason as pendingIn.
330
+ */
331
+ export function recordValueIn(record, canonical, name) {
332
+ if (!own(record, canonical))
333
+ throw new RangeError(`unknown S1 name: ${name}`);
334
+ const v = record[canonical];
335
+ if (v === null)
336
+ throw new RangeError(`S1 ${name} is not set yet`);
337
+ return v;
338
+ }
339
+ /** `$S1.<NAME>` lookup for the case runner; throws on an unknown name or an unset (null) value. */
340
+ export function s1Value(name) {
341
+ const canonical = own(FREEZE_ALIASES, name)
342
+ ? FREEZE_ALIASES[name]
343
+ : name;
344
+ if (own(FREEZE_STRUCTURED, canonical))
345
+ return FREEZE_STRUCTURED[canonical];
346
+ return recordValueIn(FREEZE_RECORD, canonical, name);
347
+ }
348
+ /** `$S1.<NAME>.<path>` lookup: `.field` segments and `[n]` indexes; throws on any missing segment. */
349
+ export function s1Resolve(ref) {
350
+ const m = /^([A-Za-z0-9_]+)((?:\.[A-Za-z0-9_]+|\[\d+\])*)$/.exec(ref);
351
+ if (!m)
352
+ throw new RangeError(`malformed S1 reference: ${ref}`);
353
+ let v = s1Value(m[1]);
354
+ for (const seg of m[2].match(/\.[A-Za-z0-9_]+|\[\d+\]/g) ?? []) {
355
+ const key = seg.startsWith(".") ? seg.slice(1) : seg.slice(1, -1);
356
+ if (v === null || typeof v !== "object" || !own(v, key))
357
+ throw new RangeError(`S1 reference ${ref}: no ${seg}`);
358
+ v = v[key];
359
+ }
360
+ return v;
361
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @mnemom/durable-contract (S1): the frozen shared contract for durable governed agents, M1.
3
+ * Every export is listed in FREEZE.json; adding, removing or changing one is an S1 amendment.
4
+ */
5
+ export * from "./canonical.js";
6
+ export * from "./constants.js";
7
+ export * from "./states.js";
8
+ export * from "./codes.js";
9
+ export * from "./cli-output.js";
10
+ export * from "./cli-surface.js";
11
+ export * from "./pure-fn.js";
12
+ export * from "./fixlines.js";
13
+ export * from "./events.js";
14
+ export * from "./admission.js";
15
+ export * from "./owner-verbs.js";
16
+ export * from "./cell-id.js";
17
+ export * from "./session-id.js";
18
+ export * from "./keys.js";
19
+ export * from "./arm.js";
20
+ export * from "./turn.js";
21
+ export * from "./telemetry.js";
22
+ export * from "./test-mode.js";
23
+ export * from "./schema.js";
24
+ export * from "./spec.js";
25
+ export * from "./envelope.js";
26
+ export * from "./seal.js";
27
+ export * from "./paths.js";
28
+ export * from "./executor-state.js";
29
+ export * from "./routes.js";
30
+ export * from "./doors.js";
31
+ export * from "./journal-approvals.js";
32
+ export * from "./secret-scope.js";
33
+ export * from "./names.js";
34
+ export * from "./lock.js";
35
+ export * from "./freeze-record.js";
36
+ export * from "./vectors.js";
@@ -0,0 +1,37 @@
1
+ // GENERATED from shared/durable-contract/src/index.ts by cli/scripts/sync-durable-contract.mjs; do not edit.
2
+ /**
3
+ * @mnemom/durable-contract (S1): the frozen shared contract for durable governed agents, M1.
4
+ * Every export is listed in FREEZE.json; adding, removing or changing one is an S1 amendment.
5
+ */
6
+ export * from "./canonical.js";
7
+ export * from "./constants.js";
8
+ export * from "./states.js";
9
+ export * from "./codes.js";
10
+ export * from "./cli-output.js";
11
+ export * from "./cli-surface.js";
12
+ export * from "./pure-fn.js";
13
+ export * from "./fixlines.js";
14
+ export * from "./events.js";
15
+ export * from "./admission.js";
16
+ export * from "./owner-verbs.js";
17
+ export * from "./cell-id.js";
18
+ export * from "./session-id.js";
19
+ export * from "./keys.js";
20
+ export * from "./arm.js";
21
+ export * from "./turn.js";
22
+ export * from "./telemetry.js";
23
+ export * from "./test-mode.js";
24
+ export * from "./schema.js";
25
+ export * from "./spec.js";
26
+ export * from "./envelope.js";
27
+ export * from "./seal.js";
28
+ export * from "./paths.js";
29
+ export * from "./executor-state.js";
30
+ export * from "./routes.js";
31
+ export * from "./doors.js";
32
+ export * from "./journal-approvals.js";
33
+ export * from "./secret-scope.js";
34
+ export * from "./names.js";
35
+ export * from "./lock.js";
36
+ export * from "./freeze-record.js";
37
+ export * from "./vectors.js";
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Record's "approved" line (ruling 34.07; design T11): which approvals the durable journal holds
3
+ * as approved. Record imports countJournalApprovals and never re-derives the rule.
4
+ */
5
+ import { APPROVAL_KINDS } from "./events.js";
6
+ /** The two kinds whose pairing makes an approval count as approved (34.07 (1)). */
7
+ export declare const JOURNAL_APPROVAL_KINDS: readonly ["approval.resolved", "approval.consumed"];
8
+ export interface JournalApprovalEvent {
9
+ readonly seq: number;
10
+ readonly kind: string;
11
+ readonly refs: Readonly<Record<string, unknown>> | null;
12
+ }
13
+ export interface JournalApprovalCount {
14
+ /** resolved {decision: approved} and consumed, same approval_id. */
15
+ approved: number;
16
+ /** resolved approved with no consumed. */
17
+ approved_not_used: number;
18
+ /** approval.single_person_override events, counted apart and never as approved. */
19
+ single_person_overrides: number;
20
+ /** approved, per approval_kind. */
21
+ by_kind: Record<(typeof APPROVAL_KINDS)[number], number>;
22
+ }
23
+ /**
24
+ * Counts a verified chain's approvals up to and including `tipSeq` (34.07 (2)). Reads only seq,
25
+ * kind and refs; order-independent; each approval_id counts at most once. The caller verifies the
26
+ * chain (C10) first: this function judges no hash. Throws RangeError on a second approval.resolved
27
+ * or a second approval.consumed for one approval_id (34.14 (7)).
28
+ */
29
+ export declare function countJournalApprovals(events: readonly JournalApprovalEvent[], tipSeq: number): JournalApprovalCount;
@@ -0,0 +1,60 @@
1
+ // GENERATED from shared/durable-contract/src/journal-approvals.ts by cli/scripts/sync-durable-contract.mjs; do not edit.
2
+ /**
3
+ * Record's "approved" line (ruling 34.07; design T11): which approvals the durable journal holds
4
+ * as approved. Record imports countJournalApprovals and never re-derives the rule.
5
+ */
6
+ import { APPROVAL_KINDS } from "./events.js";
7
+ /** The two kinds whose pairing makes an approval count as approved (34.07 (1)). */
8
+ export const JOURNAL_APPROVAL_KINDS = ["approval.resolved", "approval.consumed"];
9
+ const idOf = (e) => e.refs !== null && typeof e.refs.approval_id === "string" ? e.refs.approval_id : null;
10
+ /**
11
+ * Counts a verified chain's approvals up to and including `tipSeq` (34.07 (2)). Reads only seq,
12
+ * kind and refs; order-independent; each approval_id counts at most once. The caller verifies the
13
+ * chain (C10) first: this function judges no hash. Throws RangeError on a second approval.resolved
14
+ * or a second approval.consumed for one approval_id (34.14 (7)).
15
+ */
16
+ export function countJournalApprovals(events, tipSeq) {
17
+ const resolvedIds = new Set();
18
+ const resolved = new Map();
19
+ const consumed = new Set();
20
+ const overrides = new Set();
21
+ for (const e of events) {
22
+ if (e.seq > tipSeq)
23
+ continue;
24
+ const id = idOf(e);
25
+ // single_person_override is a P0b kind with no frozen refs: one with no approval_id counts once per event
26
+ if (e.kind === "approval.single_person_override")
27
+ overrides.add(id ?? `seq:${e.seq}`);
28
+ if (id === null)
29
+ continue;
30
+ // one approval resolves, and is consumed, exactly once: a second is a writer bug or a forgery,
31
+ // refused as a chain error so the count never depends on event order (ruling 34.14 (7))
32
+ if (e.kind === "approval.resolved") {
33
+ if (resolvedIds.has(id))
34
+ throw new RangeError(`approval ${id} resolved twice`);
35
+ resolvedIds.add(id);
36
+ if (e.refs?.decision === "approved")
37
+ resolved.set(id, String(e.refs.approval_kind));
38
+ }
39
+ else if (e.kind === "approval.consumed") {
40
+ if (consumed.has(id))
41
+ throw new RangeError(`approval ${id} consumed twice`);
42
+ consumed.add(id);
43
+ }
44
+ }
45
+ const by_kind = Object.fromEntries(APPROVAL_KINDS.map((k) => [k, 0]));
46
+ let approved = 0;
47
+ for (const [id, kind] of resolved) {
48
+ if (!consumed.has(id))
49
+ continue;
50
+ approved++;
51
+ if (Object.prototype.hasOwnProperty.call(by_kind, kind))
52
+ by_kind[kind]++;
53
+ }
54
+ return {
55
+ approved,
56
+ approved_not_used: resolved.size - approved,
57
+ single_person_overrides: overrides.size,
58
+ by_kind,
59
+ };
60
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Key prefix helpers (BACKBONE S1; C06-R01). Every gateway caller of a Mnemom key branches on
3
+ * the exact, case-sensitive `mnm_ds_` prefix BEFORE hashing, resolve_mnemom_api_key,
4
+ * classifyInvalidMnemomKeyForLog or agent-hash derivation; the shared resolver never sees one.
5
+ */
6
+ export declare const LEASE_KEY_PREFIX = "mnm_ds_";
7
+ export declare const MNEMOM_KEY_PREFIX = "mnm_";
8
+ export declare const LEASE_KEY_SCOPE = "gateway:durable";
9
+ export declare const EXECUTOR_KEY_SCOPES: readonly ["durable:*"];
10
+ export declare const EXECUTOR_KEY_KIND = "executor";
11
+ /** Random part of a minted lease key: 32 bytes, base64url, 43 chars. */
12
+ export declare const LEASE_KEY_RANDOM_BYTES = 32;
13
+ export declare const LEASE_KEY_BODY_RE: RegExp;
14
+ export type KeyClass = "lease" | "mnemom" | "other";
15
+ /** Exact, case-sensitive classification; no trimming (a padded key is "other"). */
16
+ export declare function classifyKey(key: unknown): KeyClass;
17
+ export declare function isLeaseKey(key: unknown): key is string;
18
+ /** A lease key in the minted shape: prefix plus 43 base64url chars. Shape only, never validity. */
19
+ export declare function isWellFormedLeaseKey(key: unknown): boolean;
20
+ /** Prefix vectors: the input and its class (C06 dataset (a), 32 prefix vectors). */
21
+ export declare const KEY_PREFIX_VECTORS: readonly {
22
+ key: unknown;
23
+ class: KeyClass;
24
+ }[];
@@ -0,0 +1,66 @@
1
+ // GENERATED from shared/durable-contract/src/keys.ts by cli/scripts/sync-durable-contract.mjs; do not edit.
2
+ /**
3
+ * Key prefix helpers (BACKBONE S1; C06-R01). Every gateway caller of a Mnemom key branches on
4
+ * the exact, case-sensitive `mnm_ds_` prefix BEFORE hashing, resolve_mnemom_api_key,
5
+ * classifyInvalidMnemomKeyForLog or agent-hash derivation; the shared resolver never sees one.
6
+ */
7
+ export const LEASE_KEY_PREFIX = "mnm_ds_";
8
+ export const MNEMOM_KEY_PREFIX = "mnm_";
9
+ export const LEASE_KEY_SCOPE = "gateway:durable";
10
+ export const EXECUTOR_KEY_SCOPES = ["durable:*"];
11
+ export const EXECUTOR_KEY_KIND = "executor";
12
+ /** Random part of a minted lease key: 32 bytes, base64url, 43 chars. */
13
+ export const LEASE_KEY_RANDOM_BYTES = 32;
14
+ export const LEASE_KEY_BODY_RE = /^[A-Za-z0-9_-]{43}$/;
15
+ /** Exact, case-sensitive classification; no trimming (a padded key is "other"). */
16
+ export function classifyKey(key) {
17
+ if (typeof key !== "string")
18
+ return "other";
19
+ if (key.startsWith(LEASE_KEY_PREFIX))
20
+ return "lease";
21
+ if (key.startsWith(MNEMOM_KEY_PREFIX))
22
+ return "mnemom";
23
+ return "other";
24
+ }
25
+ export function isLeaseKey(key) {
26
+ return classifyKey(key) === "lease";
27
+ }
28
+ /** A lease key in the minted shape: prefix plus 43 base64url chars. Shape only, never validity. */
29
+ export function isWellFormedLeaseKey(key) {
30
+ return isLeaseKey(key) && LEASE_KEY_BODY_RE.test(key.slice(LEASE_KEY_PREFIX.length));
31
+ }
32
+ /** Prefix vectors: the input and its class (C06 dataset (a), 32 prefix vectors). */
33
+ export const KEY_PREFIX_VECTORS = [
34
+ { key: "mnm_ds_" + "A".repeat(43), class: "lease" },
35
+ { key: "mnm_ds_", class: "lease" },
36
+ { key: "mnm_ds_x", class: "lease" },
37
+ { key: "mnm_abc", class: "mnemom" },
38
+ { key: "mnm_", class: "mnemom" },
39
+ { key: "mnm_d", class: "mnemom" },
40
+ { key: "mnm_dsx", class: "mnemom" },
41
+ { key: "mnm_ds", class: "mnemom" },
42
+ { key: "mnm-ds_abc", class: "other" },
43
+ { key: "MNM_DS_abc", class: "other" },
44
+ { key: "Mnm_ds_abc", class: "other" },
45
+ { key: "mnm_DS_abc", class: "mnemom" },
46
+ { key: " mnm_ds_abc", class: "other" },
47
+ { key: "\tmnm_ds_abc", class: "other" },
48
+ { key: "mnm_ds_abc ", class: "lease" },
49
+ { key: "\u200bmnm_ds_abc", class: "other" },
50
+ { key: "\ufeffmnm_ds_abc", class: "other" },
51
+ { key: "\uff4dnm_ds_abc", class: "other" },
52
+ { key: "mnm‐ds_abc", class: "other" },
53
+ { key: "sk-ant-api03-abc", class: "other" },
54
+ { key: "Bearer mnm_ds_abc", class: "other" },
55
+ { key: "", class: "other" },
56
+ { key: "m", class: "other" },
57
+ { key: "mnm", class: "other" },
58
+ { key: "mn_ds_abc", class: "other" },
59
+ { key: "xmnm_ds_abc", class: "other" },
60
+ { key: "mnm__ds_abc", class: "mnemom" },
61
+ { key: "mnm_ds_mnm_ds_abc", class: "lease" },
62
+ { key: null, class: "other" },
63
+ { key: undefined, class: "other" },
64
+ { key: 42, class: "other" },
65
+ { key: ["mnm_ds_abc"], class: "other" },
66
+ ];