@mnemom/mnemom 0.17.34 → 0.17.36

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 (177) hide show
  1. package/dist/commands/agent-config.js +3 -0
  2. package/dist/commands/agent-goal.d.ts +8 -3
  3. package/dist/commands/agent-goal.js +22 -8
  4. package/dist/commands/agent-run.d.ts +14 -2
  5. package/dist/commands/agent-run.js +28 -7
  6. package/dist/commands/agent-share-render.js +1 -1
  7. package/dist/commands/agent-slack.js +32 -0
  8. package/dist/commands/durable-inbox.d.ts +51 -0
  9. package/dist/commands/durable-inbox.js +134 -0
  10. package/dist/commands/durable-questions.d.ts +64 -0
  11. package/dist/commands/durable-questions.js +161 -0
  12. package/dist/commands/scan.d.ts +13 -3
  13. package/dist/commands/scan.js +48 -10
  14. package/dist/durable/seat-proxy.d.ts +12 -1
  15. package/dist/durable/seat-proxy.js +55 -9
  16. package/dist/durable/seat-socket.d.ts +20 -2
  17. package/dist/durable/seat-socket.js +58 -0
  18. package/dist/durable/turn-chain.d.ts +8 -0
  19. package/dist/durable/turn-chain.js +25 -4
  20. package/dist/host/client.d.ts +41 -0
  21. package/dist/host/client.js +7 -0
  22. package/dist/host/control.d.ts +7 -0
  23. package/dist/host/control.js +15 -0
  24. package/dist/host/daemon.d.ts +20 -0
  25. package/dist/host/daemon.js +74 -1
  26. package/dist/host/inbox-delivery.d.ts +174 -0
  27. package/dist/host/inbox-delivery.js +453 -0
  28. package/dist/host/run.d.ts +18 -0
  29. package/dist/host/run.js +61 -0
  30. package/dist/host/s1-names.d.ts +2 -0
  31. package/dist/host/s1-names.js +2 -0
  32. package/dist/host/tmux.d.ts +7 -0
  33. package/dist/host/tmux.js +19 -0
  34. package/dist/index.js +62 -3
  35. package/dist/lib/api.d.ts +5 -0
  36. package/dist/lib/api.js +16 -0
  37. package/dist/lib/config.d.ts +7 -0
  38. package/dist/lib/config.js +21 -0
  39. package/dist/lib/durable/api.d.ts +11 -0
  40. package/dist/lib/durable/api.js +28 -3
  41. package/dist/lib/durable/gate.d.ts +1 -1
  42. package/dist/lib/durable/gate.js +8 -1
  43. package/dist/lib/durable/live.d.ts +5 -0
  44. package/dist/lib/durable/live.js +19 -0
  45. package/dist/lib/experimental.js +3 -0
  46. package/dist/lib/goal-api.d.ts +11 -4
  47. package/dist/lib/goal-api.js +4 -3
  48. package/dist/lib/launcher-config.d.ts +5 -0
  49. package/dist/lib/launcher-config.js +17 -2
  50. package/dist/lib/prompt.d.ts +4 -2
  51. package/dist/lib/prompt.js +15 -5
  52. package/dist/lib/runner/job.d.ts +2 -2
  53. package/dist/lib/runner/job.js +16 -3
  54. package/dist/lib/runner/pr-body.d.ts +17 -0
  55. package/dist/lib/runner/pr-body.js +42 -0
  56. package/dist/lib/runner/proxy.d.ts +18 -3
  57. package/dist/lib/runner/proxy.js +24 -5
  58. package/dist/lib/scan/pr-source.js +2 -0
  59. package/dist/lib/scan/record.d.ts +60 -9
  60. package/dist/lib/scan/record.js +157 -39
  61. package/dist/lib/scan/repo-picker.d.ts +32 -0
  62. package/dist/lib/scan/repo-picker.js +80 -0
  63. package/dist/lib/scan/report.d.ts +6 -8
  64. package/dist/lib/scan/report.js +21 -7
  65. package/dist/lib/scan/share.d.ts +5 -1
  66. package/dist/lib/scan/share.js +15 -5
  67. package/dist/lib/slack-durable.d.ts +123 -0
  68. package/dist/lib/slack-durable.js +237 -0
  69. package/dist/lib/slack-router.d.ts +7 -0
  70. package/dist/lib/slack-router.js +50 -4
  71. package/dist/vendor/durable-contract/index.js +992 -34
  72. package/dist/vendor/shared/durable-contract/admission.d.ts +81 -2
  73. package/dist/vendor/shared/durable-contract/admission.js +319 -2
  74. package/dist/vendor/shared/durable-contract/cli-surface.js +21 -0
  75. package/dist/vendor/shared/durable-contract/codes.d.ts +60 -0
  76. package/dist/vendor/shared/durable-contract/codes.js +22 -0
  77. package/dist/vendor/shared/durable-contract/events.d.ts +4 -2
  78. package/dist/vendor/shared/durable-contract/events.js +55 -1
  79. package/dist/vendor/shared/durable-contract/freeze-record.d.ts +14 -0
  80. package/dist/vendor/shared/durable-contract/inbox.d.ts +299 -0
  81. package/dist/vendor/shared/durable-contract/inbox.js +462 -0
  82. package/dist/vendor/shared/durable-contract/index.d.ts +2 -0
  83. package/dist/vendor/shared/durable-contract/index.js +2 -0
  84. package/dist/vendor/shared/durable-contract/question.d.ts +218 -0
  85. package/dist/vendor/shared/durable-contract/question.js +373 -0
  86. package/dist/vendor/shared/durable-contract/routes.d.ts +44 -2
  87. package/dist/vendor/shared/durable-contract/routes.js +43 -1
  88. package/dist/vendor/shared/durable-contract/turn.d.ts +15 -1
  89. package/dist/vendor/shared/durable-contract/turn.js +33 -1
  90. package/dist/vendor/shared/durable-contract/vectors.d.ts +45 -0
  91. package/dist/vendor/shared/durable-contract/vectors.js +49 -0
  92. package/node_modules/@mnemom/aip-verifier/LICENSE +190 -0
  93. package/node_modules/@mnemom/aip-verifier/dist/claim-lint-CVITIRcU.d.cts +478 -0
  94. package/node_modules/@mnemom/aip-verifier/dist/claim-lint-CVITIRcU.d.ts +478 -0
  95. package/node_modules/@mnemom/aip-verifier/dist/index.cjs +971 -0
  96. package/node_modules/@mnemom/aip-verifier/dist/index.cjs.map +1 -0
  97. package/node_modules/@mnemom/aip-verifier/dist/index.d.cts +330 -0
  98. package/node_modules/@mnemom/aip-verifier/dist/index.d.ts +330 -0
  99. package/node_modules/@mnemom/aip-verifier/dist/index.js +933 -0
  100. package/node_modules/@mnemom/aip-verifier/dist/index.js.map +1 -0
  101. package/node_modules/@mnemom/aip-verifier/dist/render-lines.cjs +879 -0
  102. package/node_modules/@mnemom/aip-verifier/dist/render-lines.cjs.map +1 -0
  103. package/node_modules/@mnemom/aip-verifier/dist/render-lines.d.cts +96 -0
  104. package/node_modules/@mnemom/aip-verifier/dist/render-lines.d.ts +96 -0
  105. package/node_modules/@mnemom/aip-verifier/dist/render-lines.js +875 -0
  106. package/node_modules/@mnemom/aip-verifier/dist/render-lines.js.map +1 -0
  107. package/node_modules/@mnemom/aip-verifier/package.json +86 -0
  108. package/node_modules/@noble/ed25519/LICENSE +21 -0
  109. package/node_modules/@noble/ed25519/README.md +371 -0
  110. package/node_modules/@noble/ed25519/index.d.ts +391 -0
  111. package/node_modules/@noble/ed25519/index.js +933 -0
  112. package/node_modules/@noble/ed25519/index.ts +1134 -0
  113. package/node_modules/@noble/ed25519/package.json +54 -0
  114. package/node_modules/@noble/hashes/LICENSE +21 -0
  115. package/node_modules/@noble/hashes/README.md +478 -0
  116. package/node_modules/@noble/hashes/_blake.d.ts +20 -0
  117. package/node_modules/@noble/hashes/_blake.js +59 -0
  118. package/node_modules/@noble/hashes/_md.d.ts +95 -0
  119. package/node_modules/@noble/hashes/_md.js +209 -0
  120. package/node_modules/@noble/hashes/_u64.d.ts +36 -0
  121. package/node_modules/@noble/hashes/_u64.js +77 -0
  122. package/node_modules/@noble/hashes/argon2.d.ts +148 -0
  123. package/node_modules/@noble/hashes/argon2.js +577 -0
  124. package/node_modules/@noble/hashes/blake1.d.ts +162 -0
  125. package/node_modules/@noble/hashes/blake1.js +630 -0
  126. package/node_modules/@noble/hashes/blake2.d.ts +203 -0
  127. package/node_modules/@noble/hashes/blake2.js +573 -0
  128. package/node_modules/@noble/hashes/blake3.d.ts +68 -0
  129. package/node_modules/@noble/hashes/blake3.js +310 -0
  130. package/node_modules/@noble/hashes/eskdf.d.ts +91 -0
  131. package/node_modules/@noble/hashes/eskdf.js +225 -0
  132. package/node_modules/@noble/hashes/hkdf.d.ts +70 -0
  133. package/node_modules/@noble/hashes/hkdf.js +152 -0
  134. package/node_modules/@noble/hashes/hmac.d.ts +50 -0
  135. package/node_modules/@noble/hashes/hmac.js +93 -0
  136. package/node_modules/@noble/hashes/index.d.ts +1 -0
  137. package/node_modules/@noble/hashes/index.js +34 -0
  138. package/node_modules/@noble/hashes/legacy.d.ts +107 -0
  139. package/node_modules/@noble/hashes/legacy.js +348 -0
  140. package/node_modules/@noble/hashes/package.json +91 -0
  141. package/node_modules/@noble/hashes/pbkdf2.d.ts +66 -0
  142. package/node_modules/@noble/hashes/pbkdf2.js +176 -0
  143. package/node_modules/@noble/hashes/scrypt.d.ts +98 -0
  144. package/node_modules/@noble/hashes/scrypt.js +304 -0
  145. package/node_modules/@noble/hashes/sha2.d.ts +176 -0
  146. package/node_modules/@noble/hashes/sha2.js +446 -0
  147. package/node_modules/@noble/hashes/sha3-addons.d.ts +533 -0
  148. package/node_modules/@noble/hashes/sha3-addons.js +973 -0
  149. package/node_modules/@noble/hashes/sha3.d.ts +208 -0
  150. package/node_modules/@noble/hashes/sha3.js +475 -0
  151. package/node_modules/@noble/hashes/src/_blake.ts +67 -0
  152. package/node_modules/@noble/hashes/src/_md.ts +227 -0
  153. package/node_modules/@noble/hashes/src/_u64.ts +111 -0
  154. package/node_modules/@noble/hashes/src/argon2.ts +693 -0
  155. package/node_modules/@noble/hashes/src/blake1.ts +677 -0
  156. package/node_modules/@noble/hashes/src/blake2.ts +648 -0
  157. package/node_modules/@noble/hashes/src/blake3.ts +344 -0
  158. package/node_modules/@noble/hashes/src/eskdf.ts +265 -0
  159. package/node_modules/@noble/hashes/src/hkdf.ts +161 -0
  160. package/node_modules/@noble/hashes/src/hmac.ts +130 -0
  161. package/node_modules/@noble/hashes/src/index.ts +33 -0
  162. package/node_modules/@noble/hashes/src/legacy.ts +361 -0
  163. package/node_modules/@noble/hashes/src/pbkdf2.ts +219 -0
  164. package/node_modules/@noble/hashes/src/scrypt.ts +375 -0
  165. package/node_modules/@noble/hashes/src/sha2.ts +486 -0
  166. package/node_modules/@noble/hashes/src/sha3-addons.ts +1157 -0
  167. package/node_modules/@noble/hashes/src/sha3.ts +525 -0
  168. package/node_modules/@noble/hashes/src/utils.ts +978 -0
  169. package/node_modules/@noble/hashes/src/webcrypto.ts +283 -0
  170. package/node_modules/@noble/hashes/utils.d.ts +560 -0
  171. package/node_modules/@noble/hashes/utils.js +687 -0
  172. package/node_modules/@noble/hashes/webcrypto.d.ts +121 -0
  173. package/node_modules/@noble/hashes/webcrypto.js +228 -0
  174. package/package.json +5 -2
  175. package/plugins/integrity-manifest.json +6 -2
  176. package/plugins/mnemom/hooks/hooks.json +12 -0
  177. package/plugins/mnemom/hooks/seat-ask.mjs +221 -0
@@ -12,7 +12,7 @@
12
12
  *
13
13
  * Owner session verbs (ruling 33.22; design-v3 section 3.5, BACKBONE A2): scoped on the
14
14
  * conversation id under /v1/agent/sessions/; the `?agent_id=` query is not part of the match. Not
15
- * frozen: move, inbox, triggers and profiles (not in A2), the pre-existing GET /{cid} and POST
15
+ * frozen: move, triggers and profiles (not in A2), the pre-existing GET /{cid} and POST
16
16
  * /{cid}/contract, and create and list (their methods are not spelled in the sources).
17
17
  *
18
18
  * Doors amendment (ruling 34.03): exec_ready_list (the pool discovery read) and exec_oidc_exchange
@@ -23,10 +23,24 @@
23
23
  * Internal): int_charter is the api route the gateway's durable seal calls on a cold charter LRU.
24
24
  * The api serves it (A2: only the api holds the charter DEK); the gateway sends
25
25
  * CHARTER_BY_HASH_BODY_KEYS with INTERNAL_KEY_HEADER and reads CHARTER_BY_HASH_RESPONSE.
26
+ *
27
+ * Inbox (S1 amendment 60, signed off by Wassim 2026-11-02): the owner's send, list and allowlist routes
28
+ * under /v1/agent/sessions/{cid}/inbox, and the executor's summary, take and ack routes under
29
+ * /v1/executor/sessions/{id}/inbox. Bodies and answers are inbox.ts's closed shapes. A route takes
30
+ * one id, so the allowlist's agent_id and the acked inbox_id ride in the body.
31
+ *
32
+ * Questions (S1 amendment 61, signed off by Wassim 2026-11-02): the executor's ask, poll and release
33
+ * routes under /v1/executor/sessions/{id}/questions, the owner's list and answer routes under
34
+ * /v1/agent/sessions/{cid}/questions. Bodies and answers are question.ts's closed shapes; the
35
+ * approval_id rides in the body.
26
36
  */
27
37
  export type RouteMethod = "GET" | "POST" | "DELETE";
28
38
  /** github_oidc (ruling 34.03 (1)): a GitHub Actions workflow OIDC token, in the body, exchanged for a one-lease key. */
29
- export type RouteAuth = "owner_jwt" | "owner" | "poll_secret" | "executor_key" | "internal" | "github_oidc";
39
+ /**
40
+ * inbox_sender (S1 amendment 60): an `owner` credential, or an agent-bound credential (the agent's
41
+ * mnm_ds_ lease key or its session key) whose agent is on the recipient agent's inbox allowlist.
42
+ */
43
+ export type RouteAuth = "owner_jwt" | "owner" | "poll_secret" | "executor_key" | "internal" | "github_oidc" | "inbox_sender";
30
44
  export interface FixedRoute {
31
45
  readonly method: RouteMethod;
32
46
  readonly auth: RouteAuth;
@@ -61,6 +75,20 @@ export declare const ROUTES: Readonly<{
61
75
  exec_ready_list: FixedRoute;
62
76
  /** Body {oidc_token}; answers a one-lease org-scope executor key or an OIDC_EXCHANGE_REFUSALS refusal. */
63
77
  exec_oidc_exchange: FixedRoute;
78
+ /** Content-free summary {admitted, delivered, oldest_admitted_at} (inboxSummaryResponseOk); marks nothing. */
79
+ exec_inbox: ScopedRoute;
80
+ /** Body {epoch, nonce, limit?}: marks up to limit messages delivered at the live epoch, journals inbox.delivered, answers their delivery text. */
81
+ exec_inbox_take: ScopedRoute;
82
+ /** Body {epoch, nonce, inbox_id, sha}: acks a message delivered at this epoch, journals inbox.acked. */
83
+ exec_inbox_ack: ScopedRoute;
84
+ /** Body {epoch, nonce, inbox_id, sha, reason}: hands a delivered message back undone (admitted again, or dead at the limit), journals inbox.reverted. */
85
+ exec_inbox_release: ScopedRoute;
86
+ /** Body {epoch, nonce, tool_use_id, questions}: opens the session's question approval (or returns it when the open one has this question_sha), journals question.asked. */
87
+ exec_question: ScopedRoute;
88
+ /** Body {epoch, nonce, approval_id}: the question's state; an answer is handed over once (marked taken). */
89
+ exec_question_poll: ScopedRoute;
90
+ /** Body {epoch, nonce, approval_id}: the seat stopped waiting; the answer (now or later) goes to the inbox. */
91
+ exec_question_release: ScopedRoute;
64
92
  own_lock: ScopedRoute;
65
93
  own_unlock: ScopedRoute;
66
94
  own_pause: ScopedRoute;
@@ -70,6 +98,20 @@ export declare const ROUTES: Readonly<{
70
98
  own_amend: ScopedRoute;
71
99
  own_fail: ScopedRoute;
72
100
  own_events: ScopedRoute;
101
+ /** Body {text, idempotency_key} (inboxSendBodyOk); answer INBOX_SEND_RESPONSE or an INBOX_REJECT_CODES refusal. */
102
+ own_inbox_send: ScopedRoute;
103
+ /** {messages: [INBOX_LIST_ITEM, ...]}, newest first, content-free. */
104
+ own_inbox_list: ScopedRoute;
105
+ /** {recipient_agent_id, senders: [INBOX_SENDER_ITEM, ...]}: the session's agent's live allowlist. */
106
+ own_inbox_senders: ScopedRoute;
107
+ /** Body {agent_id, label?}: allowlists one of the owner's own agents in the same org. */
108
+ own_inbox_sender_add: ScopedRoute;
109
+ /** Body {agent_id}: revokes it (the row keeps revoked_at and revoked_by). */
110
+ own_inbox_sender_remove: ScopedRoute;
111
+ /** {questions: [QUESTION_LIST_ITEM, ...]}, newest first; the owner reads the question text. */
112
+ own_questions: ScopedRoute;
113
+ /** Body {approval_id, via, answers | dismiss: true}: answers or dismisses, journals question.answered. */
114
+ own_answer: ScopedRoute;
73
115
  int_events: FixedRoute;
74
116
  int_arm: FixedRoute;
75
117
  int_sweep: FixedRoute;
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * Owner session verbs (ruling 33.22; design-v3 section 3.5, BACKBONE A2): scoped on the
15
15
  * conversation id under /v1/agent/sessions/; the `?agent_id=` query is not part of the match. Not
16
- * frozen: move, inbox, triggers and profiles (not in A2), the pre-existing GET /{cid} and POST
16
+ * frozen: move, triggers and profiles (not in A2), the pre-existing GET /{cid} and POST
17
17
  * /{cid}/contract, and create and list (their methods are not spelled in the sources).
18
18
  *
19
19
  * Doors amendment (ruling 34.03): exec_ready_list (the pool discovery read) and exec_oidc_exchange
@@ -24,6 +24,16 @@
24
24
  * Internal): int_charter is the api route the gateway's durable seal calls on a cold charter LRU.
25
25
  * The api serves it (A2: only the api holds the charter DEK); the gateway sends
26
26
  * CHARTER_BY_HASH_BODY_KEYS with INTERNAL_KEY_HEADER and reads CHARTER_BY_HASH_RESPONSE.
27
+ *
28
+ * Inbox (S1 amendment 60, signed off by Wassim 2026-11-02): the owner's send, list and allowlist routes
29
+ * under /v1/agent/sessions/{cid}/inbox, and the executor's summary, take and ack routes under
30
+ * /v1/executor/sessions/{id}/inbox. Bodies and answers are inbox.ts's closed shapes. A route takes
31
+ * one id, so the allowlist's agent_id and the acked inbox_id ride in the body.
32
+ *
33
+ * Questions (S1 amendment 61, signed off by Wassim 2026-11-02): the executor's ask, poll and release
34
+ * routes under /v1/executor/sessions/{id}/questions, the owner's list and answer routes under
35
+ * /v1/agent/sessions/{cid}/questions. Bodies and answers are question.ts's closed shapes; the
36
+ * approval_id rides in the body.
27
37
  */
28
38
  import { ARM_ROUTE } from "./arm.js";
29
39
  import { fieldOk } from "./admission.js";
@@ -64,6 +74,22 @@ export const ROUTES = Object.freeze({
64
74
  exec_ready_list: fixed("GET", "executor_key", "/v1/executor/ready"),
65
75
  /** Body {oidc_token}; answers a one-lease org-scope executor key or an OIDC_EXCHANGE_REFUSALS refusal. */
66
76
  exec_oidc_exchange: fixed("POST", "github_oidc", "/v1/executor/oidc/exchange"),
77
+ // ---- inbox, executor side (S1 amendment 60) ----
78
+ /** Content-free summary {admitted, delivered, oldest_admitted_at} (inboxSummaryResponseOk); marks nothing. */
79
+ exec_inbox: scoped("GET", "executor_key", EXEC_SESSION_PRE, "/inbox"),
80
+ /** Body {epoch, nonce, limit?}: marks up to limit messages delivered at the live epoch, journals inbox.delivered, answers their delivery text. */
81
+ exec_inbox_take: scoped("POST", "executor_key", EXEC_SESSION_PRE, "/inbox/take"),
82
+ /** Body {epoch, nonce, inbox_id, sha}: acks a message delivered at this epoch, journals inbox.acked. */
83
+ exec_inbox_ack: scoped("POST", "executor_key", EXEC_SESSION_PRE, "/inbox/ack"),
84
+ /** Body {epoch, nonce, inbox_id, sha, reason}: hands a delivered message back undone (admitted again, or dead at the limit), journals inbox.reverted. */
85
+ exec_inbox_release: scoped("POST", "executor_key", EXEC_SESSION_PRE, "/inbox/release"),
86
+ // ---- questions, executor side (S1 amendment 61) ----
87
+ /** Body {epoch, nonce, tool_use_id, questions}: opens the session's question approval (or returns it when the open one has this question_sha), journals question.asked. */
88
+ exec_question: scoped("POST", "executor_key", EXEC_SESSION_PRE, "/questions"),
89
+ /** Body {epoch, nonce, approval_id}: the question's state; an answer is handed over once (marked taken). */
90
+ exec_question_poll: scoped("POST", "executor_key", EXEC_SESSION_PRE, "/questions/poll"),
91
+ /** Body {epoch, nonce, approval_id}: the seat stopped waiting; the answer (now or later) goes to the inbox. */
92
+ exec_question_release: scoped("POST", "executor_key", EXEC_SESSION_PRE, "/questions/release"),
67
93
  // ---- owner session verbs (ruling 33.22) ----
68
94
  own_lock: scoped("POST", "owner", OWNER_SESSION_PRE, "/lock"),
69
95
  own_unlock: scoped("POST", "owner", OWNER_SESSION_PRE, "/unlock"),
@@ -74,6 +100,22 @@ export const ROUTES = Object.freeze({
74
100
  own_amend: scoped("POST", "owner", OWNER_SESSION_PRE, "/amend"),
75
101
  own_fail: scoped("POST", "owner", OWNER_SESSION_PRE, "/fail"),
76
102
  own_events: scoped("GET", "owner", OWNER_SESSION_PRE, "/events"),
103
+ // ---- inbox, owner side (S1 amendment 60) ----
104
+ /** Body {text, idempotency_key} (inboxSendBodyOk); answer INBOX_SEND_RESPONSE or an INBOX_REJECT_CODES refusal. */
105
+ own_inbox_send: scoped("POST", "inbox_sender", OWNER_SESSION_PRE, "/inbox"),
106
+ /** {messages: [INBOX_LIST_ITEM, ...]}, newest first, content-free. */
107
+ own_inbox_list: scoped("GET", "owner", OWNER_SESSION_PRE, "/inbox"),
108
+ /** {recipient_agent_id, senders: [INBOX_SENDER_ITEM, ...]}: the session's agent's live allowlist. */
109
+ own_inbox_senders: scoped("GET", "owner", OWNER_SESSION_PRE, "/inbox/senders"),
110
+ /** Body {agent_id, label?}: allowlists one of the owner's own agents in the same org. */
111
+ own_inbox_sender_add: scoped("POST", "owner", OWNER_SESSION_PRE, "/inbox/senders"),
112
+ /** Body {agent_id}: revokes it (the row keeps revoked_at and revoked_by). */
113
+ own_inbox_sender_remove: scoped("DELETE", "owner", OWNER_SESSION_PRE, "/inbox/senders"),
114
+ // ---- questions, owner side (S1 amendment 61) ----
115
+ /** {questions: [QUESTION_LIST_ITEM, ...]}, newest first; the owner reads the question text. */
116
+ own_questions: scoped("GET", "owner", OWNER_SESSION_PRE, "/questions"),
117
+ /** Body {approval_id, via, answers | dismiss: true}: answers or dismisses, journals question.answered. */
118
+ own_answer: scoped("POST", "owner", OWNER_SESSION_PRE, "/questions/answer"),
77
119
  // ---- gateway internal ----
78
120
  int_events: fixed("POST", "internal", GATEWAY_EVENTS_ROUTE),
79
121
  int_arm: fixed("GET", "internal", ARM_ROUTE),
@@ -13,7 +13,10 @@ export type TurnOrigin = (typeof TURN_ORIGINS)[number];
13
13
  export declare const TURN_SOURCES: readonly ["typed", "queued", "system", "sdk"];
14
14
  export type TurnSource = (typeof TURN_SOURCES)[number];
15
15
  export declare const CHAIN_KEY = "chain";
16
- /** Reserved entry key; no M1 emitter (P0a-B). Any entry carrying it is unattended. */
16
+ /**
17
+ * Entry key `inbox=<sha256 hex>`: the turn answers that inbox message. Any entry carrying it is
18
+ * unattended. Its emitter is the seat proxy (amendment 60); admission reads the newest entry's value.
19
+ */
17
20
  export declare const INBOX_KEY = "inbox";
18
21
  export declare const TURN_HASH_RE: RegExp;
19
22
  export interface TurnEntryFacts {
@@ -23,6 +26,8 @@ export interface TurnEntryFacts {
23
26
  producer?: string;
24
27
  /** True when the entry carried `inbox=<sha256 hex>`. */
25
28
  inbox: boolean;
29
+ /** The entry's `inbox=<sha256 hex>` value when it carried a well-formed one (amendment 60). */
30
+ inboxSha?: string;
26
31
  }
27
32
  /** Sources that keep a human entry attended: absent, typed, queued (queued attended is a recorded departure). */
28
33
  export declare const ATTENDED_SOURCES: readonly (TurnSource | undefined)[];
@@ -44,6 +49,15 @@ export declare const ATTENDED_TASK_PRODUCER = "session-task";
44
49
  * `schemaKnown=false` (schema=unknown with a well-formed chain, F07) is unattended.
45
50
  */
46
51
  export declare function candidatePosture(entries: readonly TurnEntryFacts[], schemaKnown?: boolean): "attended" | "unattended";
52
+ /**
53
+ * Amendment 60 (e): the inbox message the newest entry answers, or null. The newest entry's own
54
+ * `inbox=<sha>`; else, when the newest entry is a session-task notification (a background command or
55
+ * agent this session started, the amendment 56 continuation shape), the sha of the turn that started
56
+ * it: walking back over session-task entries, the first other entry's `inbox=<sha>`, if it has one.
57
+ * So a background task an inbox turn launched finishes inside that turn's admission, and nothing
58
+ * else does: a human, scheduled, peer or channel entry in between ends the walk with null.
59
+ */
60
+ export declare function inboxShaOf(entries: readonly TurnEntryFacts[]): string | null;
47
61
  /** chain = sha256 hex of the root promptId (UTF-8). */
48
62
  export declare function chainIdOf(rootPromptId: string): Promise<string>;
49
63
  /** Request classes (day-1 spike vocabulary) and whether each waits for its transcript entry. */
@@ -13,7 +13,10 @@ import { sha256Hex } from "./canonical.js";
13
13
  export const TURN_ORIGINS = ["human", "channel", "scheduled", "peer", "task", "meta"];
14
14
  export const TURN_SOURCES = ["typed", "queued", "system", "sdk"];
15
15
  export const CHAIN_KEY = "chain";
16
- /** Reserved entry key; no M1 emitter (P0a-B). Any entry carrying it is unattended. */
16
+ /**
17
+ * Entry key `inbox=<sha256 hex>`: the turn answers that inbox message. Any entry carrying it is
18
+ * unattended. Its emitter is the seat proxy (amendment 60); admission reads the newest entry's value.
19
+ */
17
20
  export const INBOX_KEY = "inbox";
18
21
  export const TURN_HASH_RE = /^[0-9a-f]{64}$/;
19
22
  /** Sources that keep a human entry attended: absent, typed, queued (queued attended is a recorded departure). */
@@ -51,6 +54,35 @@ export function candidatePosture(entries, schemaKnown = true) {
51
54
  entries.slice(0, -1).some(attendedHuman);
52
55
  return continuation ? "attended" : "unattended";
53
56
  }
57
+ const sessionTaskContinuation = (e) => e.origin === "task" &&
58
+ e.source === "system" &&
59
+ e.producer === ATTENDED_TASK_PRODUCER &&
60
+ !e.inbox;
61
+ /**
62
+ * Amendment 60 (e): the inbox message the newest entry answers, or null. The newest entry's own
63
+ * `inbox=<sha>`; else, when the newest entry is a session-task notification (a background command or
64
+ * agent this session started, the amendment 56 continuation shape), the sha of the turn that started
65
+ * it: walking back over session-task entries, the first other entry's `inbox=<sha>`, if it has one.
66
+ * So a background task an inbox turn launched finishes inside that turn's admission, and nothing
67
+ * else does: a human, scheduled, peer or channel entry in between ends the walk with null.
68
+ */
69
+ export function inboxShaOf(entries) {
70
+ const newest = entries[entries.length - 1];
71
+ if (newest === undefined)
72
+ return null;
73
+ const own = (e) => e.inbox && typeof e.inboxSha === "string" && TURN_HASH_RE.test(e.inboxSha) ? e.inboxSha : null;
74
+ if (newest.inbox)
75
+ return own(newest);
76
+ if (!sessionTaskContinuation(newest))
77
+ return null;
78
+ for (let i = entries.length - 2; i >= 0; i--) {
79
+ const e = entries[i];
80
+ if (sessionTaskContinuation(e))
81
+ continue;
82
+ return own(e);
83
+ }
84
+ return null;
85
+ }
54
86
  /** chain = sha256 hex of the root promptId (UTF-8). */
55
87
  export async function chainIdOf(rootPromptId) {
56
88
  if (typeof rootPromptId !== "string" || rootPromptId.length === 0)
@@ -189,3 +189,48 @@ export declare const SEAL_VECTORS: {
189
189
  readonly hash: "5a3bb041c155d67e50d18ee9afb0e6903f7a64988c881ab6373d3447fd5906f5";
190
190
  };
191
191
  };
192
+ /**
193
+ * S1 amendment 60: inboxSha golden vectors (sha256 of the canonical identity with `v: 1`), computed
194
+ * independently with node:crypto over a hand-sorted JSON preimage. `text` is the delivery text the
195
+ * api renders for the message (inboxDeliveryText), with the sender label shown.
196
+ */
197
+ export declare const INBOX_SHA_VECTORS: readonly [{
198
+ readonly identity: {
199
+ readonly session_id: "11111111-2222-4333-8444-555555555555";
200
+ readonly sender_kind: "owner";
201
+ readonly sender_agent_id: null;
202
+ readonly on_behalf_of: null;
203
+ readonly in_reply_to: null;
204
+ readonly body: "Please rebase PR 3220 and rerun the contract tests.";
205
+ };
206
+ readonly sender_label: null;
207
+ readonly preimage: "{\"body\":\"Please rebase PR 3220 and rerun the contract tests.\",\"in_reply_to\":null,\"on_behalf_of\":null,\"sender_agent_id\":null,\"sender_kind\":\"owner\",\"session_id\":\"11111111-2222-4333-8444-555555555555\",\"v\":1}";
208
+ readonly sha: "87fc04e971ee9fde7c3db3536772f4a7402c30a911111eff9fb37cbd3927c72f";
209
+ readonly text: "[mnemom inbox 87fc04e971ee9fde7c3db3536772f4a7402c30a911111eff9fb37cbd3927c72f] from the owner\n\nPlease rebase PR 3220 and rerun the contract tests.";
210
+ }, {
211
+ readonly identity: {
212
+ readonly session_id: "11111111-2222-4333-8444-555555555555";
213
+ readonly sender_kind: "agent";
214
+ readonly sender_agent_id: "mnm-chief01";
215
+ readonly on_behalf_of: "user_owner_1";
216
+ readonly in_reply_to: null;
217
+ readonly body: "Wassim asks: status on the inbox migration?";
218
+ };
219
+ readonly sender_label: "chief";
220
+ readonly preimage: "{\"body\":\"Wassim asks: status on the inbox migration?\",\"in_reply_to\":null,\"on_behalf_of\":\"user_owner_1\",\"sender_agent_id\":\"mnm-chief01\",\"sender_kind\":\"agent\",\"session_id\":\"11111111-2222-4333-8444-555555555555\",\"v\":1}";
221
+ readonly sha: "8a955bd0811770262fa0d400472472b9cd8bc1cff8a41abb2955a2c1582eea54";
222
+ readonly text: "[mnemom inbox 8a955bd0811770262fa0d400472472b9cd8bc1cff8a41abb2955a2c1582eea54] from agent chief on behalf of the owner\n\nWassim asks: status on the inbox migration?";
223
+ }, {
224
+ readonly identity: {
225
+ readonly session_id: "11111111-2222-4333-8444-555555555555";
226
+ readonly sender_kind: "owner";
227
+ readonly sender_agent_id: null;
228
+ readonly on_behalf_of: null;
229
+ readonly in_reply_to: "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee";
230
+ readonly body: "Yes, ship it as a draft. — W ✓";
231
+ };
232
+ readonly sender_label: null;
233
+ readonly preimage: "{\"body\":\"Yes, ship it as a draft. — W ✓\",\"in_reply_to\":\"aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee\",\"on_behalf_of\":null,\"sender_agent_id\":null,\"sender_kind\":\"owner\",\"session_id\":\"11111111-2222-4333-8444-555555555555\",\"v\":1}";
234
+ readonly sha: "f79c83ca6fd83b8b918fe6464479c79ba4abea1ec30f43fd62b9b6d5950cc218";
235
+ readonly text: "[mnemom inbox f79c83ca6fd83b8b918fe6464479c79ba4abea1ec30f43fd62b9b6d5950cc218] from the owner (answer to question aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee)\n\nYes, ship it as a draft. — W ✓";
236
+ }];
@@ -206,3 +206,52 @@ export const SEAL_VECTORS = {
206
206
  "hash": "5a3bb041c155d67e50d18ee9afb0e6903f7a64988c881ab6373d3447fd5906f5"
207
207
  }
208
208
  };
209
+ /**
210
+ * S1 amendment 60: inboxSha golden vectors (sha256 of the canonical identity with `v: 1`), computed
211
+ * independently with node:crypto over a hand-sorted JSON preimage. `text` is the delivery text the
212
+ * api renders for the message (inboxDeliveryText), with the sender label shown.
213
+ */
214
+ export const INBOX_SHA_VECTORS = [
215
+ {
216
+ identity: {
217
+ session_id: "11111111-2222-4333-8444-555555555555",
218
+ sender_kind: "owner",
219
+ sender_agent_id: null,
220
+ on_behalf_of: null,
221
+ in_reply_to: null,
222
+ body: "Please rebase PR 3220 and rerun the contract tests.",
223
+ },
224
+ sender_label: null,
225
+ preimage: '{"body":"Please rebase PR 3220 and rerun the contract tests.","in_reply_to":null,"on_behalf_of":null,"sender_agent_id":null,"sender_kind":"owner","session_id":"11111111-2222-4333-8444-555555555555","v":1}',
226
+ sha: "87fc04e971ee9fde7c3db3536772f4a7402c30a911111eff9fb37cbd3927c72f",
227
+ text: "[mnemom inbox 87fc04e971ee9fde7c3db3536772f4a7402c30a911111eff9fb37cbd3927c72f] from the owner\n\nPlease rebase PR 3220 and rerun the contract tests.",
228
+ },
229
+ {
230
+ identity: {
231
+ session_id: "11111111-2222-4333-8444-555555555555",
232
+ sender_kind: "agent",
233
+ sender_agent_id: "mnm-chief01",
234
+ on_behalf_of: "user_owner_1",
235
+ in_reply_to: null,
236
+ body: "Wassim asks: status on the inbox migration?",
237
+ },
238
+ sender_label: "chief",
239
+ preimage: '{"body":"Wassim asks: status on the inbox migration?","in_reply_to":null,"on_behalf_of":"user_owner_1","sender_agent_id":"mnm-chief01","sender_kind":"agent","session_id":"11111111-2222-4333-8444-555555555555","v":1}',
240
+ sha: "8a955bd0811770262fa0d400472472b9cd8bc1cff8a41abb2955a2c1582eea54",
241
+ text: "[mnemom inbox 8a955bd0811770262fa0d400472472b9cd8bc1cff8a41abb2955a2c1582eea54] from agent chief on behalf of the owner\n\nWassim asks: status on the inbox migration?",
242
+ },
243
+ {
244
+ identity: {
245
+ session_id: "11111111-2222-4333-8444-555555555555",
246
+ sender_kind: "owner",
247
+ sender_agent_id: null,
248
+ on_behalf_of: null,
249
+ in_reply_to: "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee",
250
+ body: "Yes, ship it as a draft. — W ✓",
251
+ },
252
+ sender_label: null,
253
+ preimage: '{"body":"Yes, ship it as a draft. — W ✓","in_reply_to":"aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee","on_behalf_of":null,"sender_agent_id":null,"sender_kind":"owner","session_id":"11111111-2222-4333-8444-555555555555","v":1}',
254
+ sha: "f79c83ca6fd83b8b918fe6464479c79ba4abea1ec30f43fd62b9b6d5950cc218",
255
+ text: "[mnemom inbox f79c83ca6fd83b8b918fe6464479c79ba4abea1ec30f43fd62b9b6d5950cc218] from the owner (answer to question aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee)\n\nYes, ship it as a draft. — W ✓",
256
+ },
257
+ ];
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Mnemon
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.