@mnemom/mnemom 0.17.39-next.0 → 0.17.39-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.
@@ -41,7 +41,7 @@
41
41
  import { canonicalJson, sha256Hex, UUID_RE } from "./canonical.js";
42
42
  import { CANONICAL_CELL_IDS } from "./cell-id.js";
43
43
  import { LEASE_SECONDS_DEFAULT, RESUME_RESET_SECONDS_DEFAULT } from "./constants.js";
44
- import { PARKED_ONLY_WAIT_REASONS } from "./states.js";
44
+ import { DISPATCH_PARK_WAIT_REASONS, PARKED_ONLY_WAIT_REASONS } from "./states.js";
45
45
  export const M1_TABLES = [
46
46
  "agent_sessions",
47
47
  "durable_lease_keys",
@@ -430,11 +430,12 @@ export async function approvalSubjectHash(subject) {
430
430
  export const AGENT_SESSIONS_READY_CHECK = "state <> 'ready' OR (durable_mode = 'locked' AND state_reason IS NULL AND home_executor_id IS NULL" +
431
431
  " AND lease_executor_id IS NULL AND lease_expires_at IS NULL AND spawn_id IS NULL AND hello_at IS NULL)";
432
432
  /**
433
- * agent_sessions_wait_parked_ck (ruling 34.06 (1), (2)): ci, question and budget are valid only with
434
- * state 'parked', and wait_ref is set exactly when wait_reason is one of them. The wait_reason
435
- * CHECK lists WAIT_REASONS.
433
+ * agent_sessions_wait_parked_ck (ruling 34.06 (1), (2); amendment 64): every PARKED_ONLY_WAIT_REASONS
434
+ * value is valid only with state 'parked'. wait_ref is set exactly when wait_reason is ci, question
435
+ * or budget; the DISPATCH_PARK_WAIT_REASONS carry none. The wait_reason CHECK lists WAIT_REASONS.
436
436
  */
437
437
  export const AGENT_SESSIONS_WAIT_PARKED_CHECK = "CASE WHEN wait_reason IN ('ci','question','budget') THEN state = 'parked' AND wait_ref IS NOT NULL" +
438
+ " WHEN wait_reason IN ('awaiting_issue_run','repo_arm_unreadable') THEN state = 'parked' AND wait_ref IS NULL" +
438
439
  " ELSE wait_ref IS NULL END";
439
440
  /** agent_executors.scope CHECK (ruling 34.03 (1)). */
440
441
  export const AGENT_EXECUTORS_SCOPE_CHECK = "scope IN ('user','org')";
@@ -451,6 +452,8 @@ export function readyRowOk(row) {
451
452
  }
452
453
  /** The wait-parked CHECK as a predicate. */
453
454
  export function waitParkedRowOk(row) {
455
+ if (row.wait_reason !== null && DISPATCH_PARK_WAIT_REASONS.includes(row.wait_reason))
456
+ return row.state === "parked" && row.wait_ref === null;
454
457
  return row.wait_reason !== null &&
455
458
  PARKED_ONLY_WAIT_REASONS.includes(row.wait_reason)
456
459
  ? row.state === "parked" && row.wait_ref !== null
@@ -31,15 +31,28 @@ export declare const STATE_REASONS: {
31
31
  export declare const ALL_STATE_REASONS: readonly StateReason[];
32
32
  /** M1 writers exist for these suspended reasons; the others are fixture-only (P0a-B / P0b writers). */
33
33
  export declare const M1_WRITTEN_SUSPENDED_REASONS: readonly ["budget_reached", "identity_mismatch", "attestation_failed", "respawn_failed", "grant_expired", "approval_expired", "approval_denied"];
34
- /** M1's three wait reasons, then ruling 34.06's ci, question and budget (appended). */
35
- export declare const WAIT_REASONS: readonly ["approval", "moving", "mnemom_unavailable", "ci", "question", "budget"];
34
+ /**
35
+ * M1's three wait reasons, then ruling 34.06's ci, question and budget, then amendment 64's two
36
+ * dispatch parks (appended).
37
+ */
38
+ export declare const WAIT_REASONS: readonly ["approval", "moving", "mnemom_unavailable", "ci", "question", "budget", "awaiting_issue_run", "repo_arm_unreadable"];
36
39
  export type WaitReason = (typeof WAIT_REASONS)[number];
37
40
  /**
38
41
  * The wait reasons valid only with state 'parked' (ruling 34.06 (1), agent_sessions_wait_parked_ck).
39
42
  * While wait_reason is one of these, every claim answers ineligible `waiting` (34.06 (3)).
40
43
  */
41
- export declare const PARKED_ONLY_WAIT_REASONS: readonly ["ci", "question", "budget"];
44
+ export declare const PARKED_ONLY_WAIT_REASONS: readonly ["ci", "question", "budget", "awaiting_issue_run", "repo_arm_unreadable"];
42
45
  export type ParkedOnlyWaitReason = (typeof PARKED_ONLY_WAIT_REASONS)[number];
46
+ /**
47
+ * Amendment 64 (mnemom-test#1336): the parks dispatch writes when it creates a pool session, never an
48
+ * executor. `awaiting_issue_run`: the seal's repo is served-arm, so only the seal's own issue run may
49
+ * adopt it. `repo_arm_unreadable`: the repo's arm could not be read, so the session is held visible
50
+ * instead of going ready. Both are PARKED_ONLY_WAIT_REASONS (state 'parked', claims answer
51
+ * ineligible `waiting`) and carry no wait_ref: they have no WAIT_REF_KEYS entry, so waitRefOk
52
+ * refuses them and the executor park body can never write one.
53
+ */
54
+ export declare const DISPATCH_PARK_WAIT_REASONS: readonly ["awaiting_issue_run", "repo_arm_unreadable"];
55
+ export type DispatchParkWaitReason = (typeof DISPATCH_PARK_WAIT_REASONS)[number];
43
56
  export declare function isSessionState(v: unknown): v is SessionState;
44
57
  export declare function isTerminalState(s: SessionState): boolean;
45
58
  /** Whether `reason` is allowed with `state` by the closed enum. */
@@ -92,7 +92,10 @@ export const M1_WRITTEN_SUSPENDED_REASONS = [
92
92
  "approval_expired",
93
93
  "approval_denied",
94
94
  ];
95
- /** M1's three wait reasons, then ruling 34.06's ci, question and budget (appended). */
95
+ /**
96
+ * M1's three wait reasons, then ruling 34.06's ci, question and budget, then amendment 64's two
97
+ * dispatch parks (appended).
98
+ */
96
99
  export const WAIT_REASONS = [
97
100
  "approval",
98
101
  "moving",
@@ -100,6 +103,8 @@ export const WAIT_REASONS = [
100
103
  "ci",
101
104
  "question",
102
105
  "budget",
106
+ "awaiting_issue_run",
107
+ "repo_arm_unreadable",
103
108
  ];
104
109
  /**
105
110
  * The wait reasons valid only with state 'parked' (ruling 34.06 (1), agent_sessions_wait_parked_ck).
@@ -109,6 +114,20 @@ export const PARKED_ONLY_WAIT_REASONS = [
109
114
  "ci",
110
115
  "question",
111
116
  "budget",
117
+ "awaiting_issue_run",
118
+ "repo_arm_unreadable",
119
+ ];
120
+ /**
121
+ * Amendment 64 (mnemom-test#1336): the parks dispatch writes when it creates a pool session, never an
122
+ * executor. `awaiting_issue_run`: the seal's repo is served-arm, so only the seal's own issue run may
123
+ * adopt it. `repo_arm_unreadable`: the repo's arm could not be read, so the session is held visible
124
+ * instead of going ready. Both are PARKED_ONLY_WAIT_REASONS (state 'parked', claims answer
125
+ * ineligible `waiting`) and carry no wait_ref: they have no WAIT_REF_KEYS entry, so waitRefOk
126
+ * refuses them and the executor park body can never write one.
127
+ */
128
+ export const DISPATCH_PARK_WAIT_REASONS = [
129
+ "awaiting_issue_run",
130
+ "repo_arm_unreadable",
112
131
  ];
113
132
  export function isSessionState(v) {
114
133
  return typeof v === "string" && SESSION_STATES.includes(v);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mnemom/mnemom",
3
- "version": "0.17.39-next.0",
3
+ "version": "0.17.39-next.2",
4
4
  "description": "Transparent AI agent tracing",
5
5
  "type": "module",
6
6
  "bin": {