@ours.network/tg-connector 0.1.7 → 0.1.8-nightly.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 (99) hide show
  1. package/dist/connector.js +74 -0
  2. package/dist/mufl_code/D812C6070397B0EB11D66D6D33D931C35E9442ACC141C35C51A7904A082B19E0.muflo +0 -0
  3. package/dist/mufl_code/actor.mu +27 -0
  4. package/dist/mufl_code/core/COMMERCIAL-LICENCE.md +25 -0
  5. package/dist/mufl_code/core/COMPATIBILITY.md +221 -0
  6. package/dist/mufl_code/core/CONTRIBUTING.md +37 -0
  7. package/dist/mufl_code/core/LICENSE +1 -1
  8. package/dist/mufl_code/core/NOTIFICATIONS_CONTRACT.md +290 -0
  9. package/dist/mufl_code/core/README.md +64 -49
  10. package/dist/mufl_code/core/SECURITY.md +40 -0
  11. package/dist/mufl_code/core/TRADEMARKS.md +24 -0
  12. package/dist/mufl_code/core/a2a_capabilities.mm +76 -1
  13. package/dist/mufl_code/core/a2a_control.mm +2 -1
  14. package/dist/mufl_code/core/a2a_messaging.mm +1677 -25
  15. package/dist/mufl_code/core/a2a_notifications.mm +1102 -0
  16. package/dist/mufl_code/core/a2a_protocol.mm +16 -1
  17. package/dist/mufl_code/core/a2a_versions.mm +801 -0
  18. package/dist/mufl_code/core/config.mufl +2 -0
  19. package/dist/mufl_code/core/docs/.vitepress/config.mts +58 -0
  20. package/dist/mufl_code/core/docs/citations.json +688 -0
  21. package/dist/mufl_code/core/docs/guide/01-vendor-the-core.md +50 -0
  22. package/dist/mufl_code/core/docs/guide/02-configure-and-compile.md +100 -0
  23. package/dist/mufl_code/core/docs/guide/03-wire-the-host.md +154 -0
  24. package/dist/mufl_code/core/docs/guide/04-connect-and-message.md +156 -0
  25. package/dist/mufl_code/core/docs/guide/05-test-your-app.md +75 -0
  26. package/dist/mufl_code/core/docs/guide/index.md +63 -0
  27. package/dist/mufl_code/core/docs/how-it-works/capabilities-and-control.md +77 -0
  28. package/dist/mufl_code/core/docs/how-it-works/cluster.md +65 -0
  29. package/dist/mufl_code/core/docs/how-it-works/identity.md +56 -0
  30. package/dist/mufl_code/core/docs/how-it-works/invites-and-contacts.md +76 -0
  31. package/dist/mufl_code/core/docs/how-it-works/messaging.md +55 -0
  32. package/dist/mufl_code/core/docs/how-it-works/monitoring-and-config.md +72 -0
  33. package/dist/mufl_code/core/docs/how-it-works/overview.md +45 -0
  34. package/dist/mufl_code/core/docs/how-it-works/versioning.md +116 -0
  35. package/dist/mufl_code/core/docs/index.md +27 -0
  36. package/dist/mufl_code/core/docs/package-lock.json +3467 -0
  37. package/dist/mufl_code/core/docs/package.json +15 -0
  38. package/dist/mufl_code/core/docs/reference/contributing.md +26 -0
  39. package/dist/mufl_code/core/docs/reference/glossary.md +108 -0
  40. package/dist/mufl_code/core/docs/reference/implementations.md +23 -0
  41. package/dist/mufl_code/core/docs/reference/modules.md +19 -0
  42. package/dist/mufl_code/core/docs/scripts/check-citations.mjs +36 -0
  43. package/dist/mufl_code/core/docs/scripts/check-denylist.mjs +30 -0
  44. package/dist/mufl_code/core/docs/scripts/gen-llms.mjs +32 -0
  45. package/dist/mufl_code/core/docs/workflows/cluster.md +89 -0
  46. package/dist/mufl_code/core/docs/workflows/contact-exchange.md +60 -0
  47. package/dist/mufl_code/core/docs/workflows/contact-restore.md +60 -0
  48. package/dist/mufl_code/core/docs/workflows/control-verbs.md +70 -0
  49. package/dist/mufl_code/core/docs/workflows/index.md +57 -0
  50. package/dist/mufl_code/core/docs/workflows/introductions.md +60 -0
  51. package/dist/mufl_code/core/docs/workflows/messaging.md +75 -0
  52. package/dist/mufl_code/core/docs/workflows/monitoring.md +84 -0
  53. package/dist/mufl_code/core/docs/workflows/notifications.md +109 -0
  54. package/dist/mufl_code/core/release-notes/0.1.md +60 -0
  55. package/dist/mufl_code/core/release-notes/0.3.md +22 -0
  56. package/dist/mufl_code/core/release-notes/0.4.md +97 -0
  57. package/dist/mufl_code/core/tests/README.md +17 -0
  58. package/dist/mufl_code/core/tests/corpus.mjs +139 -0
  59. package/dist/mufl_code/core/tests/corpus_actor.mu +242 -0
  60. package/dist/mufl_code/core/tests/fatcompile_actor.mu +52 -0
  61. package/dist/mufl_code/core/tests/mig.mjs +664 -0
  62. package/dist/mufl_code/core/tests/mig_actor.mu +466 -0
  63. package/dist/mufl_code/core/tests/migapp.mjs +431 -0
  64. package/dist/mufl_code/core/tests/migapp_actor.mu +294 -0
  65. package/dist/mufl_code/core/tests/mufl_semantics/run.sh +69 -0
  66. package/dist/mufl_code/core/tests/mufl_semantics/t11_three_version.mufl +47 -0
  67. package/dist/mufl_code/core/tests/mufl_semantics/t2_extra_fields.mufl +11 -0
  68. package/dist/mufl_code/core/tests/mufl_semantics/t7_runtime.mufl +30 -0
  69. package/dist/mufl_code/core/tests/mufl_semantics/t9_passthrough.mufl +19 -0
  70. package/dist/mufl_code/core/tests/mufl_semantics/t_str_order.mufl +19 -0
  71. package/dist/mufl_code/core/tests/notif.mjs +689 -0
  72. package/dist/mufl_code/core/tests/notif_actor.mu +458 -0
  73. package/dist/mufl_code/core/tests/protocol_container.mm +18 -0
  74. package/dist/mufl_code/core/tests/run.sh +8 -10
  75. package/dist/mufl_code/core/tests/run_corpus.sh +51 -0
  76. package/dist/mufl_code/core/tests/run_fatcompile.sh +40 -0
  77. package/dist/mufl_code/core/tests/run_mig.sh +51 -0
  78. package/dist/mufl_code/core/tests/run_migapp.sh +51 -0
  79. package/dist/mufl_code/core/tests/run_notif.sh +55 -0
  80. package/dist/mufl_code/core/tests/test.mjs +291 -49
  81. package/dist/mufl_code/core/tests/test_actor.mu +240 -7
  82. package/dist/mufl_code/core/tests/test_common.mjs +93 -0
  83. package/dist/mufl_code/core/version.mm +1 -1
  84. package/package.json +4 -4
  85. package/dist/mufl_code/2DA1D5F860E42C605D92F1E24E2466C70EFDDBF057BBCBA52F0ECC639EFCA387.muflo +0 -0
  86. package/dist/mufl_code/core/CLUSTER_API.md +0 -640
  87. package/dist/mufl_code/core/CLUSTER_CONTRACT.md +0 -121
  88. package/dist/mufl_code/core/CLUSTER_INTRODUCTION_PLAN.md +0 -200
  89. package/dist/mufl_code/core/CONFIGURATION_DESIGN.md +0 -35
  90. package/dist/mufl_code/core/CONFIGURATION_PLAN.md +0 -394
  91. package/dist/mufl_code/core/DEVELOPMENT.md +0 -168
  92. package/dist/mufl_code/core/EPHEMERAL_INVITE_PLAN.md +0 -465
  93. package/dist/mufl_code/core/GROUP_CHAT_DESIGN.md +0 -520
  94. package/dist/mufl_code/core/release-notes/2.0.md +0 -268
  95. package/dist/mufl_code/core/release-notes/2.1.md +0 -92
  96. package/dist/mufl_code/core/release-notes/2.2.md +0 -94
  97. package/dist/mufl_code/core/release-notes/3.0.md +0 -162
  98. package/dist/mufl_code/core/release-notes/3.1.md +0 -43
  99. package/dist/mufl_code/core/release-notes/README.md +0 -32
@@ -0,0 +1,458 @@
1
+ // Notifications test actor for the a2a_notifications N-series (tests/notif.mjs).
2
+ //
3
+ // SPLIT from test_actor.mu deliberately: the compiler bounds meta-stage
4
+ // type-level reduction PER COMPILED UNIT (adapt src/eval/meta_reduction_fuel.h,
5
+ // 1M steps — a consensus-deterministic compile-time DoS guard). test_actor loads
6
+ // BOTH heavy libraries a2a_messaging (139KB) AND a2a_notifications (57KB) and,
7
+ // after the 0.9.0 migration surface landed in a2a_messaging, tips OVER the
8
+ // per-unit ceiling. a2a_messaging has ZERO references to a2a_notifications (the
9
+ // dep is one-way: notifications -> messaging), so the fix is to move the
10
+ // notifications tests into THEIR OWN unit and drop a2a_notifications from
11
+ // test_actor. This unit loads BOTH libraries (a2a_notifications needs
12
+ // a2a_messaging's contact machinery) but exercises ONLY the N-series
13
+ // notification transactions, so it too fits under the per-unit budget.
14
+ //
15
+ // It carries the SHARED host wiring the notify flows need (a2a_messaging::init
16
+ // storage hooks for the invite/contact machinery the N-series set-up uses; a
17
+ // tiny inbox; the identity helpers) PLUS everything notification-specific: the
18
+ // a2a_notifications::init block, the notify hook logs, and the notify qa probes.
19
+ // The COMBINED core+notify export_state/import_state round-trip lives HERE (this
20
+ // is the only unit that loads both libraries) — see qa export_state/import_state.
21
+
22
+ application actor loads libraries
23
+ identity_proof_document,
24
+ attestation_document,
25
+ native_attestation_document,
26
+ transaction_message_decoder,
27
+ address_document,
28
+ address_document_types,
29
+ key_utils,
30
+ key_storage,
31
+ continuation,
32
+ encrypted_channel,
33
+ a2a_versions,
34
+ a2a_capabilities,
35
+ a2a_protocol,
36
+ a2a_messaging,
37
+ a2a_notifications,
38
+ current_transaction_info,
39
+ protocol_container,
40
+ version
41
+ uses transactions
42
+ {
43
+ hidden
44
+ {
45
+ // Minimal inbox (the app owns message storage; the core calls the hook).
46
+ metadef msg_t: ($sender -> global_id, $text -> str, $wire_id -> str, $reply_wire -> str).
47
+ inbox is msg_t[] = [].
48
+
49
+ // Minimal file store (the app owns file storage; the core calls the hook).
50
+ metadef file_t: ($sender -> global_id, $filename -> str, $mime -> str, $wire_id -> str, $reply_wire -> str).
51
+ files is file_t[] = [].
52
+
53
+ // Wire the deserialization primitive into the libraries that need it.
54
+ _read_or_abort = grab( _read_or_abort ).
55
+ key_storage::init ($_read_or_abort -> _read_or_abort).
56
+ encrypted_channel::init ($_read_or_abort -> _read_or_abort).
57
+
58
+ // Host-protocol action helpers (the driver resolves on kind "data").
59
+ fn _save_state (_) = (transaction::action::return_data ($kind -> $save_state)).
60
+ fn _return_data (payload: any) = (transaction::action::return_data ($kind -> $data, $payload -> payload)).
61
+ fn _notify_agent (payload: any) = (transaction::action::return_data ($kind -> $notify_agent, $payload -> payload)).
62
+
63
+ // Receipt consumer log (core 0.7.0) — unused by the N-series but the
64
+ // a2a_messaging::init hook requires it.
65
+ receipts_log is any[] = [].
66
+
67
+ // Storage hooks: deposit inbound messages; send/remove are no-ops.
68
+ a2a_messaging::init (
69
+ $_read_or_abort -> _read_or_abort,
70
+ $on_message_received -> fn (arg: any) -> transaction::action::type[]
71
+ {
72
+ sid = (arg $sender_id) safe global_id.
73
+ txt = (arg $text) safe str.
74
+ wid is str = "".
75
+ if (arg $wire_id) != NIL { wid -> (arg $wire_id) safe str. }
76
+ rw is str = "".
77
+ if (arg $reply_to) != NIL { rw -> ((arg $reply_to) $wire_id) safe str. }
78
+ inbox (_count inbox|) -> ($sender -> sid, $text -> txt, $wire_id -> wid, $reply_wire -> rw).
79
+ return [ _notify_agent ($event -> $message_received), _save_state NIL ].
80
+ },
81
+ $on_message_sent -> fn (_: any) -> transaction::action::type[] { return []. },
82
+ $on_contact_removed -> fn (_: any) -> transaction::action::type[] { return []. },
83
+ $on_file_received -> fn (arg: any) -> transaction::action::type[]
84
+ {
85
+ sid = (arg $sender_id) safe global_id.
86
+ fname = (arg $filename) safe str.
87
+ mt = (arg $mime) safe str.
88
+ wid is str = "".
89
+ if (arg $wire_id) != NIL { wid -> (arg $wire_id) safe str. }
90
+ rw is str = "".
91
+ if (arg $reply_to) != NIL { rw -> ((arg $reply_to) $wire_id) safe str. }
92
+ files (_count files|) -> ($sender -> sid, $filename -> fname, $mime -> mt, $wire_id -> wid, $reply_wire -> rw).
93
+ return [ _notify_agent ($event -> $file_received), _save_state NIL ].
94
+ },
95
+ $on_file_sent -> fn (_: any) -> transaction::action::type[] { return []. },
96
+ $on_receipt_received -> fn (arg: any) -> transaction::action::type[]
97
+ {
98
+ receipts_log (_count receipts_log|) -> arg.
99
+ return [ _notify_agent ($event -> $receipt_received), _save_state NIL ].
100
+ }
101
+ ).
102
+
103
+ // Notification hook logs (the app owns notification storage; the core
104
+ // calls the hooks). Plain observable lists the qa probes expose.
105
+ notif_log is any[] = [].
106
+ marks_log is any[] = [].
107
+ unregs_log is any[] = [].
108
+ regconfirm_log is any[] = [].
109
+
110
+ // Deployed-messenger emulation (LEGACY receive_notify_address): stores
111
+ // the blob, counts receipts, sends NO ack — exactly the pre-engine peer
112
+ // shape. Feeds the control-plane engine rig's byte-compat + retry-cap
113
+ // tests.
114
+ notify_addr_store is (global_id ->> bin) = (,).
115
+ notify_addr_recv_count is int = 0.
116
+
117
+ a2a_notifications::init (
118
+ $_read_or_abort -> _read_or_abort,
119
+ $on_notification_posted -> fn (arg: any) -> transaction::action::type[]
120
+ {
121
+ notif_log (_count notif_log|) -> arg.
122
+ return [ _notify_agent ($event -> $notification_posted), _save_state NIL ].
123
+ },
124
+ $on_notifications_marked_read -> fn (arg: any) -> transaction::action::type[]
125
+ {
126
+ marks_log (_count marks_log|) -> arg.
127
+ return [ _save_state NIL ].
128
+ },
129
+ $on_unregistered -> fn (arg: any) -> transaction::action::type[]
130
+ {
131
+ unregs_log (_count unregs_log|) -> arg.
132
+ return [ _save_state NIL ].
133
+ },
134
+ $on_notify_registration -> fn (arg: any) -> transaction::action::type[]
135
+ {
136
+ regconfirm_log (_count regconfirm_log|) -> arg.
137
+ return [ _save_state NIL ].
138
+ }
139
+ ).
140
+ }
141
+
142
+ // ---- minimal host surface used by the driver ----
143
+ // The core's send_message delivers to the legacy ::actor::receive_message name;
144
+ // this shim routes it into the core receive handler (→ on_message_received hook).
145
+ trn receive_message args: any { return a2a_messaging::handle_receive_message args. }
146
+ trn readonly list_incoming_messages _ { return ($inbox -> inbox). }
147
+ trn readonly list_incoming_files _ { return ($files -> files). }
148
+
149
+ // export/import wrappers: this UNIT loads BOTH libraries, so the COMBINED
150
+ // core+notify round-trip lives here (test_actor keeps only the core half).
151
+ // The "both halves coexist in one blob and both restore" coverage (N7/N16)
152
+ // is asserted against these.
153
+ trn readonly export_state _ { return ($core -> (a2a_messaging::export_core_state NIL), $notify -> (a2a_notifications::export_notify_state NIL)). }
154
+ trn import_state data: any
155
+ {
156
+ current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
157
+ a2a_messaging::import_core_state (data $core).
158
+ if (data $notify) != NIL { a2a_notifications::import_notify_state (data $notify). }
159
+ return transaction::success [ _return_data ($imported -> TRUE), _save_state NIL ].
160
+ }
161
+
162
+ // Inject a learned capability set for a contact — drives the V5 CAP-1 gate
163
+ // test (positive-evidence denial vs unknown/empty pass-through).
164
+ trn qa_set_contact_caps _:($cid -> cid: global_id, $caps -> caps: str[])
165
+ {
166
+ current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
167
+ a2a_messaging::contact_caps cid -> caps.
168
+ return transaction::success [ _return_data ($set -> TRUE), _save_state NIL ].
169
+ }
170
+
171
+ // ================= NOTIFICATION TEST PROBES =================
172
+
173
+ // LEGACY notify-address receiver — byte-for-byte the DEPLOYED messenger
174
+ // targ shape ($address only, required bin). Stores + counts, never acks.
175
+ // An engine sender's additive $gen field must route here unchanged
176
+ // (byte-compat obligation). Feeds the control-plane engine rig (no driver
177
+ // in notif.mjs exercises it, but it is notification-plane surface).
178
+ trn receive_notify_address _:($address -> blob: bin)
179
+ {
180
+ current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::external,).
181
+ encrypted_channel::check_encrypted_or_abort ().
182
+
183
+ from = current_transaction_info::get_external_envelope_or_abort() $from.
184
+ notify_addr_store from -> blob.
185
+ notify_addr_recv_count -> notify_addr_recv_count + 1.
186
+ return transaction::success [ _save_state NIL ].
187
+ }
188
+ trn readonly qa_notify_addr_store _
189
+ {
190
+ return ($store -> notify_addr_store, $count -> notify_addr_recv_count).
191
+ }
192
+ // LEGACY notify-address SENDER — byte-for-byte the deployed fan-out targ
193
+ // shape ($address only, no $gen). Lets the engine rig prove a pre-engine
194
+ // peer's handout still lands at a v2 messenger (which must store it and
195
+ // send no ack).
196
+ trn qa_send_legacy_notify_address _:($target -> tgt: global_id, $address -> blob: bin)
197
+ {
198
+ current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
199
+ return encrypted_channel::execute_transaction tgt (fn (_) -> transaction::results::type {
200
+ return transaction::success [
201
+ encrypted_channel::send_encrypted_tx tgt (
202
+ $name -> "::actor::receive_notify_address",
203
+ $targ -> ($address -> blob)
204
+ ),
205
+ _return_data ($sent_to -> tgt)
206
+ ].
207
+ }).
208
+ }
209
+
210
+ // Notification state + hook logs — for receiver-side assertions (N-series).
211
+ trn readonly qa_notify_state _
212
+ {
213
+ return (
214
+ $registrations -> a2a_notifications::notify_registrations,
215
+ $token_index -> a2a_notifications::notify_token_index,
216
+ $my_regs -> a2a_notifications::my_notify_registrations,
217
+ $pending -> a2a_notifications::pending_notify_registers,
218
+ $vapid_pub -> a2a_notifications::vapid_public_key,
219
+ $notif_log -> notif_log,
220
+ $marks_log -> marks_log,
221
+ $unregs_log -> unregs_log,
222
+ $regconfirm_log -> regconfirm_log
223
+ ).
224
+ }
225
+
226
+ // v2: per-sender token maps + contact-token mirror (N9-series probes).
227
+ trn readonly qa_notify_state_v2 _
228
+ {
229
+ return (
230
+ $sender_tokens -> a2a_notifications::notify_sender_tokens,
231
+ $sender_muted -> a2a_notifications::notify_sender_muted,
232
+ $contact_tokens -> a2a_notifications::my_notify_contact_tokens
233
+ ).
234
+ }
235
+
236
+ // Extract the scoped token_id for a specific (recipient, sender) pair from
237
+ // notify_sender_tokens. Used in N10 to prove handle_issue_tokens indexes scoped
238
+ // tokens into notify_token_index (revocation mechanism): the returned token_id
239
+ // must appear as a key in notify_token_index; if the indexing line were removed
240
+ // from handle_issue_tokens the token would exist in sender_tokens but be absent
241
+ // from the index and the N10 assertion would fail.
242
+ trn readonly qa_scoped_token_id _:($recipient -> r: global_id, $sender -> s: global_id)
243
+ {
244
+ outer = a2a_notifications::notify_sender_tokens r.
245
+ abort "No sender tokens for recipient." when outer == NIL.
246
+ inner_map = outer?.
247
+ tok = inner_map s.
248
+ abort "No token for this sender." when tok == NIL.
249
+ return ($token_id -> (tok? $c $token_id)).
250
+ }
251
+
252
+ // Send a raw issue_tokens directly to a service (bypasses client-side paging —
253
+ // used to probe the batch-cap gate and the registered-recipient gate).
254
+ trn qa_issue_tokens_direct _:($service -> svc: global_id, $senders -> senders: any)
255
+ {
256
+ return encrypted_channel::execute_transaction svc (fn (_) -> transaction::results::type {
257
+ return transaction::success [
258
+ encrypted_channel::send_encrypted_tx svc (
259
+ $name -> "::a2a_notifications::issue_tokens",
260
+ $targ -> ($senders -> senders)
261
+ ),
262
+ _return_data ($sent_to -> svc)
263
+ ].
264
+ }).
265
+ }
266
+
267
+ // Import a v1-era notify record (fields $notify_sender_tokens/$notify_sender_muted/
268
+ // $my_notify_contact_tokens absent) and return the post-import map state.
269
+ // Used for the v1-era import fixture: verifies import_notify_state handles missing v2 fields
270
+ // by leaving the defaults (empty maps) in place.
271
+ trn qa_import_v1_notify_state _:($vapid -> vapid: str)
272
+ {
273
+ current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
274
+ a2a_notifications::import_notify_state (
275
+ $my_notify_registrations -> (,),
276
+ $notify_registrations -> (,),
277
+ $notify_token_index -> (,),
278
+ $vapid_public_key -> vapid
279
+ // $notify_sender_tokens, $notify_sender_muted, $my_notify_contact_tokens
280
+ // intentionally absent — simulates a v1-era export record shape.
281
+ ).
282
+ return transaction::success [
283
+ _return_data (
284
+ $sender_tokens -> a2a_notifications::notify_sender_tokens,
285
+ $sender_muted -> a2a_notifications::notify_sender_muted,
286
+ $contact_tokens -> a2a_notifications::my_notify_contact_tokens
287
+ ),
288
+ _save_state NIL
289
+ ].
290
+ }
291
+
292
+ // ---- adversarial notification senders (N3/N8) ----
293
+ // Emit the SAME bare send send_notification emits, with a corrupted artifact.
294
+ // modes: flip_recipient (different $recipient_cid, old $s — dies on the index
295
+ // match), fake_token_id (dies on the index lookup), foreign_service (dies on
296
+ // the minted-by-me check), flip_scope ($scope flipped, id/recipient intact —
297
+ // dies ONLY on the _value_id byte-equality), oversize (valid token, 4096-char
298
+ // payload — dies on the service-side cap).
299
+ trn qa_post_tampered _:($address -> blob: bin, $mode -> mode: str)
300
+ {
301
+ addr = (_read_or_abort blob) safe a2a_notifications::notify_address_t.
302
+ token is a2a_notifications::notify_token_t = addr $token.
303
+ old = token $c.
304
+ payload is str = "tampered".
305
+ if mode == "flip_recipient"
306
+ {
307
+ core is a2a_notifications::notify_token_core_t = (
308
+ $version -> (old $version), $service_cid -> (old $service_cid),
309
+ $recipient_cid -> _get_container_id(),
310
+ $token_id -> (old $token_id), $scope -> (old $scope), $iat -> (old $iat)
311
+ ).
312
+ token -> ($c -> core, $s -> (token $s)).
313
+ }
314
+ if mode == "fake_token_id"
315
+ {
316
+ core is a2a_notifications::notify_token_core_t = (
317
+ $version -> (old $version), $service_cid -> (old $service_cid),
318
+ $recipient_cid -> (old $recipient_cid),
319
+ $token_id -> _new_id "qa fake token id", $scope -> (old $scope), $iat -> (old $iat)
320
+ ).
321
+ token -> ($c -> core, $s -> (token $s)).
322
+ }
323
+ if mode == "foreign_service"
324
+ {
325
+ core is a2a_notifications::notify_token_core_t = (
326
+ $version -> (old $version), $service_cid -> _get_container_id(),
327
+ $recipient_cid -> (old $recipient_cid),
328
+ $token_id -> (old $token_id), $scope -> (old $scope), $iat -> (old $iat)
329
+ ).
330
+ token -> ($c -> core, $s -> (token $s)).
331
+ }
332
+ if mode == "flip_scope"
333
+ {
334
+ core is a2a_notifications::notify_token_core_t = (
335
+ $version -> (old $version), $service_cid -> (old $service_cid),
336
+ $recipient_cid -> (old $recipient_cid),
337
+ $token_id -> (old $token_id), $scope -> "evil", $iat -> (old $iat)
338
+ ).
339
+ token -> ($c -> core, $s -> (token $s)).
340
+ }
341
+ if mode == "oversize"
342
+ {
343
+ big is str = "x".
344
+ big -> big + big. big -> big + big. big -> big + big. big -> big + big.
345
+ big -> big + big. big -> big + big. big -> big + big. big -> big + big.
346
+ big -> big + big. big -> big + big. big -> big + big. big -> big + big.
347
+ payload -> big. // 4096 chars > payload_max_bytes
348
+ }
349
+ return transaction::success [
350
+ transaction::action::send (addr $service_cid) (
351
+ $name -> "::a2a_notifications::post_notification",
352
+ $targ -> ($token -> token, $payload -> payload, $wire_id -> "qa-tamper")
353
+ ),
354
+ _return_data ($sent -> TRUE)
355
+ ].
356
+ }
357
+
358
+ // ---- N17+ probes (per-contact validation) ----
359
+
360
+ // Export a notify_address_t blob using a scoped (per-sender) token from
361
+ // my_notify_contact_tokens[service][sender]. Lets a sender post via the
362
+ // UNCHANGED send_notification trn using a scoped-token handout (N17).
363
+ trn readonly qa_export_contact_notify_address _:($service -> svc: global_id, $sender -> s: global_id)
364
+ {
365
+ outer = a2a_notifications::my_notify_contact_tokens svc.
366
+ abort "No contact tokens for this service." when outer == NIL.
367
+ inner_map = outer?.
368
+ tok = inner_map s.
369
+ abort "No token for this sender." when tok == NIL.
370
+ addr is a2a_notifications::notify_address_t = (
371
+ $version -> 1,
372
+ $service_cid -> svc,
373
+ $service_name -> "",
374
+ $token -> tok?
375
+ ).
376
+ return ($blob -> (_write addr)).
377
+ }
378
+
379
+ // Set mute: write FALSE (= muted per §4.1) into notify_sender_muted[recipient][sender].
380
+ // Stand-in for set_sender_muted until that service inbound lands (a later task).
381
+ trn qa_notify_set_muted _:($recipient -> r: global_id, $sender -> s: global_id)
382
+ {
383
+ current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
384
+ inner is (global_id ->> bool) = (,).
385
+ if (a2a_notifications::notify_sender_muted r) != NIL { inner -> (a2a_notifications::notify_sender_muted r)?. }
386
+ inner s -> FALSE.
387
+ a2a_notifications::notify_sender_muted r -> inner.
388
+ return transaction::success [ _return_data ($muted -> TRUE), _save_state NIL ].
389
+ }
390
+
391
+ // Clear mute: delete the entry — absent = enabled per §7.
392
+ trn qa_notify_clear_muted _:($recipient -> r: global_id, $sender -> s: global_id)
393
+ {
394
+ current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
395
+ if (a2a_notifications::notify_sender_muted r) != NIL
396
+ {
397
+ inner is (global_id ->> bool) = (a2a_notifications::notify_sender_muted r)?.
398
+ if (inner s) != NIL { delete inner s. a2a_notifications::notify_sender_muted r -> inner. }
399
+ }
400
+ return transaction::success [ _return_data ($cleared -> TRUE), _save_state NIL ].
401
+ }
402
+
403
+ // Clear sender slot: delete notify_sender_tokens[recipient][sender].
404
+ // Used in N21 to create the absent-slot abort condition.
405
+ trn qa_notify_clear_sender_slot _:($recipient -> r: global_id, $sender -> s: global_id)
406
+ {
407
+ current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
408
+ if (a2a_notifications::notify_sender_tokens r) != NIL
409
+ {
410
+ inner is (global_id ->> a2a_notifications::notify_token_t) = (a2a_notifications::notify_sender_tokens r)?.
411
+ if (inner s) != NIL { delete inner s. a2a_notifications::notify_sender_tokens r -> inner. }
412
+ }
413
+ return transaction::success [ _return_data ($cleared -> TRUE), _save_state NIL ].
414
+ }
415
+
416
+ // Return exactly the $sender_muted map the LAST on_notify_registration hook
417
+ // call carried (the engine-mirror feed). Precise probe — avoids grepping
418
+ // the whole regconfirm_log dump.
419
+ trn readonly qa_last_confirm_muted _
420
+ {
421
+ found is any = NIL.
422
+ sc regconfirm_log -- ( -> entry) { found -> entry. }
423
+ abort "No confirms logged." when found == NIL.
424
+ return ($sender_muted -> (found $sender_muted)).
425
+ }
426
+
427
+ // Send set_sender_muted directly to the service without going through the
428
+ // client-side wrapper (bypasses the client's registration check). Used in N26
429
+ // to probe the service-side registered-recipient gate.
430
+ trn qa_set_sender_muted_direct _:($service -> svc: global_id, $sender -> s: global_id, $muted -> m: bool)
431
+ {
432
+ current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
433
+ return encrypted_channel::execute_transaction svc (fn (_) -> transaction::results::type {
434
+ return transaction::success [
435
+ encrypted_channel::send_encrypted_tx svc (
436
+ $name -> "::a2a_notifications::set_sender_muted",
437
+ $targ -> ($sender -> s, $muted -> m)
438
+ ),
439
+ _return_data ($sent_to -> svc)
440
+ ].
441
+ }).
442
+ }
443
+
444
+ // E9: a well-formed confirm_registration over a REAL channel, from a contact
445
+ // that is neither a pending nor a registered service of the target.
446
+ trn qa_send_fake_confirm _:($target -> target: global_id)
447
+ {
448
+ return encrypted_channel::execute_transaction target (fn (_) -> transaction::results::type {
449
+ return transaction::success [
450
+ encrypted_channel::send_encrypted_tx target (
451
+ $name -> "::a2a_notifications::confirm_registration",
452
+ $targ -> ($vapid_pub -> "EVIL_VAPID", $bindings -> NIL, $sender_tokens -> (,), $sender_muted -> (,))
453
+ ),
454
+ _return_data ($sent -> TRUE)
455
+ ].
456
+ }).
457
+ }
458
+ }
@@ -0,0 +1,18 @@
1
+ // Minimal protocol_container library — provides ::protocol_container::init_my_ipd,
2
+ // which the ADAPT wrapper runs on every packet during broker registration
3
+ // (possession-proof / identity-proof-document setup, adapt #77). Mirrors the
4
+ // toolkit's per-unit protocol_container stub; deps resolve from the stdlib.
5
+ library protocol_container loads libraries
6
+ identity_proof_document,
7
+ identity_proof_document_types,
8
+ native_attestation_document,
9
+ browser_attestation_document,
10
+ current_transaction_info
11
+ uses transactions
12
+ {
13
+ trn init_my_ipd _ {
14
+ current_transaction_info::validate_origin (::transaction::envelope::origin::user,).
15
+ identity_proof_document_types::set_my_ipd(identity_proof_document::create()).
16
+ return ::transaction::success [].
17
+ }
18
+ }
@@ -16,12 +16,13 @@ set -u
16
16
  HERE=$(cd "$(dirname "$0")" && pwd)
17
17
  CORE_DIR=$(cd "$HERE/.." && pwd)
18
18
  AT=${ADAPT_TOOLKIT:-/home/shakhvit/work/adapt/adapt-toolkit}
19
+ STDLIB=${MUFL_STDLIB_OVERRIDE:-$AT/mufl_stdlib} # Phase-B: point at the adapt worktree stdlib to pick up e2e.mm staged API
19
20
  SDK_NM=${OURS_SDK_NODE_MODULES:-/home/shakhvit/work/adapt/ours/ours-mcp/node_modules}
20
21
  DEV_BROKER=${DEV_BROKER:-/home/shakhvit/work/adapt/ours/ours-mcp/scripts/dev-broker.mjs}
21
22
  PORT=${PORT:-9799}
22
23
  COMPILE="$AT/build.linux.release/mufl-compile"
23
24
 
24
- for p in "$COMPILE" "$AT/mufl_stdlib" "$SDK_NM/@adapt-toolkit" "$DEV_BROKER"; do
25
+ for p in "$COMPILE" "$STDLIB" "$SDK_NM/@adapt-toolkit" "$DEV_BROKER"; do
25
26
  [ -e "$p" ] || { echo "MISSING: $p (set ADAPT_TOOLKIT / OURS_SDK_NODE_MODULES / DEV_BROKER)"; exit 2; }
26
27
  done
27
28
 
@@ -29,15 +30,12 @@ BUILD=$(mktemp -d)
29
30
  trap 'rm -rf "$BUILD"' EXIT
30
31
  mkdir -p "$BUILD/core"
31
32
  cp "$CORE_DIR"/*.mm "$CORE_DIR"/config.mufl "$BUILD/core/"
32
- cp "$HERE/test_actor.mu" "$HERE/test.mjs" "$BUILD/"
33
- # SDK 0.6.x (adapt #77) runs ::protocol_container::init_my_ipd on every packet
34
- # during broker registration — the harness needs the same stub the consumers
35
- # ship. Prefer a checkout-local copy; fall back to the ours-mcp one.
36
- PC_STUB=${PROTOCOL_CONTAINER_MM:-/home/shakhvit/work/adapt/ours.network/ours-mcp/packages/core/mufl_code/protocol_container.mm}
37
- [ -e "$PC_STUB" ] || { echo "MISSING: $PC_STUB (set PROTOCOL_CONTAINER_MM)"; exit 2; }
38
- cp "$PC_STUB" "$BUILD/protocol_container.mm"
33
+ # test.mjs imports ./test_common.mjs, so copy it alongside into the build dir.
34
+ cp "$HERE/test_actor.mu" "$HERE/test.mjs" "$HERE/test_common.mjs" "$HERE/protocol_container.mm" "$BUILD/"
39
35
  ln -sfn "$SDK_NM" "$BUILD/node_modules"
40
- # Top-level compile config: merge the stdlib with this repo's core (the core/ subdir).
36
+ # Top-level compile config: merge the stdlib with this repo's core (the core/ subdir),
37
+ # plus the local protocol_container stub the ADAPT wrapper needs at packet boot
38
+ # (::protocol_container::init_my_ipd — same stub every consumer carries, e.g. ours-mcp).
41
39
  cat > "$BUILD/config.mufl" <<'CFG'
42
40
  config script
43
41
  {
@@ -52,7 +50,7 @@ CFG
52
50
 
53
51
  cd "$BUILD"
54
52
  echo "compiling test actor against $CORE_DIR core…"
55
- MUFL_STDLIB_PATH="$AT/mufl_stdlib" "$COMPILE" -mp "$AT/meta" -mp "$AT/transactions" test_actor.mu 2>&1 \
53
+ MUFL_STDLIB_PATH="$STDLIB" "$COMPILE" -mp "$AT/meta" -mp "$AT/transactions" test_actor.mu 2>&1 \
56
54
  | grep -vE "Unused symbol|browser_attestation|identity_proof_document_impl" | tail -4
57
55
  ls ./*.muflo >/dev/null 2>&1 || { echo "COMPILE FAILED"; exit 1; }
58
56
 
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env bash
2
+ # Fast golden-wire corpus gate: compile the test actor against THIS core, boot a
3
+ # local broker, run ONLY tests/corpus.mjs (single packet, no peer traffic).
4
+ # Same env knobs as run.sh: ADAPT_TOOLKIT / OURS_SDK_NODE_MODULES / DEV_BROKER / PORT.
5
+ set -u
6
+ HERE=$(cd "$(dirname "$0")" && pwd)
7
+ CORE_DIR=$(cd "$HERE/.." && pwd)
8
+ AT=${ADAPT_TOOLKIT:-/home/shakhvit/work/adapt/adapt-toolkit}
9
+ STDLIB=${MUFL_STDLIB_OVERRIDE:-$AT/mufl_stdlib} # Phase-B: point at the adapt worktree stdlib to pick up e2e.mm staged API
10
+ SDK_NM=${OURS_SDK_NODE_MODULES:-/home/shakhvit/work/adapt/ours/ours-mcp/node_modules}
11
+ DEV_BROKER=${DEV_BROKER:-/home/shakhvit/work/adapt/ours/ours-mcp/scripts/dev-broker.mjs}
12
+ PORT=${PORT:-9798}
13
+ COMPILE="$AT/build.linux.release/mufl-compile"
14
+
15
+ for p in "$COMPILE" "$STDLIB" "$SDK_NM/@adapt-toolkit" "$DEV_BROKER"; do
16
+ [ -e "$p" ] || { echo "MISSING: $p (set ADAPT_TOOLKIT / OURS_SDK_NODE_MODULES / DEV_BROKER)"; exit 2; }
17
+ done
18
+
19
+ BUILD=$(mktemp -d)
20
+ trap 'rm -rf "$BUILD"' EXIT
21
+ mkdir -p "$BUILD/core"
22
+ cp "$CORE_DIR"/*.mm "$CORE_DIR"/config.mufl "$BUILD/core/"
23
+ cp "$HERE/corpus_actor.mu" "$HERE/corpus.mjs" "$HERE/protocol_container.mm" "$BUILD/"
24
+ ln -sfn "$SDK_NM" "$BUILD/node_modules"
25
+ cat > "$BUILD/config.mufl" <<'CFG'
26
+ config script
27
+ {
28
+ stdlib_config = (config_load #$MUFL_STDLIB_PATH).
29
+ core_config = (config_load #"core").
30
+ (
31
+ $imports -> ( $libraries -> (stdlib_config $exports $libraries)'(core_config $exports $libraries)'($protocol_container -> #"protocol_container.mm"), ),
32
+ $exports -> ( $libraries -> (,), $applications -> (,) )
33
+ ).
34
+ }
35
+ CFG
36
+
37
+ cd "$BUILD"
38
+ echo "compiling test actor against $CORE_DIR core…"
39
+ MUFL_STDLIB_PATH="$STDLIB" "$COMPILE" -mp "$AT/meta" -mp "$AT/transactions" corpus_actor.mu 2>&1 \
40
+ | grep -vE "Unused symbol|browser_attestation|identity_proof_document_impl" | tail -4
41
+ ls ./*.muflo >/dev/null 2>&1 || { echo "COMPILE FAILED"; exit 1; }
42
+
43
+ node "$DEV_BROKER" --host 127.0.0.1 --port "$PORT" --test_mode >broker.log 2>&1 &
44
+ BPID=$!
45
+ sleep 2.5
46
+ kill -0 "$BPID" 2>/dev/null || { echo "BROKER FAILED TO START:"; cat broker.log; exit 3; }
47
+
48
+ BROKER_URL="ws://127.0.0.1:$PORT" node corpus.mjs 2> >(grep -E 'DRIVER ERR' >&2)
49
+ RC=$?
50
+ kill "$BPID" 2>/dev/null
51
+ exit $RC
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env bash
2
+ # COMPILE-ONLY regression guard (no broker, no driver): compile fatcompile_actor.mu — which loads
3
+ # the heavy daemon-side libs TOGETHER (a2a_messaging migration surface + a2a_cluster) through the
4
+ # __t_wrapper meta path — against THIS core. Producing a .muflo IS the pass. Guards against a
5
+ # migration-core change re-inflating per-unit meta-stage reduction past the 1M-step ceiling for a
6
+ # multi-heavy-lib packet (the class of failure that broke the ours-mcp daemon build @ 7a14d65 via
7
+ # the dead 5th transaction::type union variant). NOTE: the FULL daemon actor.mu (messaging+cluster+
8
+ # its app trns) is the authoritative check and lives in the daemon repo's CI; this is the in-core
9
+ # early-warning for the heavy-lib combo. Same env knobs as run_mig.sh.
10
+ set -u
11
+ HERE=$(cd "$(dirname "$0")" && pwd)
12
+ CORE_DIR=$(cd "$HERE/.." && pwd)
13
+ AT=${ADAPT_TOOLKIT:-/home/shakhvit/work/adapt/adapt-toolkit}
14
+ STDLIB=${MUFL_STDLIB_OVERRIDE:-$AT/mufl_stdlib}
15
+ COMPILE="$AT/build.linux.release/mufl-compile"
16
+ for p in "$COMPILE" "$STDLIB"; do
17
+ [ -e "$p" ] || { echo "MISSING: $p (set ADAPT_TOOLKIT)"; exit 2; }
18
+ done
19
+ BUILD=$(mktemp -d)
20
+ trap 'rm -rf "$BUILD"' EXIT
21
+ mkdir -p "$BUILD/core"
22
+ cp "$CORE_DIR"/*.mm "$CORE_DIR"/config.mufl "$BUILD/core/"
23
+ cp "$HERE/fatcompile_actor.mu" "$HERE/protocol_container.mm" "$BUILD/"
24
+ cat > "$BUILD/config.mufl" <<'CFG'
25
+ config script
26
+ {
27
+ stdlib_config = (config_load #$MUFL_STDLIB_PATH).
28
+ core_config = (config_load #"core").
29
+ (
30
+ $imports -> ( $libraries -> (stdlib_config $exports $libraries)'(core_config $exports $libraries)'($protocol_container -> #"protocol_container.mm"), ),
31
+ $exports -> ( $libraries -> (,), $applications -> (,) )
32
+ ).
33
+ }
34
+ CFG
35
+ cd "$BUILD"
36
+ echo "compiling fatcompile_actor (a2a_messaging + a2a_cluster) against $CORE_DIR core…"
37
+ MUFL_STDLIB_PATH="$STDLIB" "$COMPILE" -mp "$AT/meta" -mp "$AT/transactions" fatcompile_actor.mu 2>&1 \
38
+ | grep -vE "Unused symbol|browser_attestation|identity_proof_document_impl" | tail -6
39
+ if ls ./*.muflo >/dev/null 2>&1; then echo "FATCOMPILE: OK (heavy-lib combo compiles under the meta-fuel ceiling)"; exit 0
40
+ else echo "FATCOMPILE: FAILED (meta-fuel ceiling — a migration-core change re-inflated the daemon build path)"; exit 1; fi
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env bash
2
+ # Phase-A migration store + export/import gate: compile the test actor against THIS core, boot a
3
+ # local broker, run ONLY tests/mig.mjs (single packet, no peer traffic).
4
+ # Same env knobs as run.sh: ADAPT_TOOLKIT / OURS_SDK_NODE_MODULES / DEV_BROKER / PORT.
5
+ set -u
6
+ HERE=$(cd "$(dirname "$0")" && pwd)
7
+ CORE_DIR=$(cd "$HERE/.." && pwd)
8
+ AT=${ADAPT_TOOLKIT:-/home/shakhvit/work/adapt/adapt-toolkit}
9
+ STDLIB=${MUFL_STDLIB_OVERRIDE:-$AT/mufl_stdlib} # Phase-B: point at the adapt worktree stdlib to pick up e2e.mm staged API
10
+ SDK_NM=${OURS_SDK_NODE_MODULES:-/home/shakhvit/work/adapt/ours/ours-mcp/node_modules}
11
+ DEV_BROKER=${DEV_BROKER:-/home/shakhvit/work/adapt/ours/ours-mcp/scripts/dev-broker.mjs}
12
+ PORT=${PORT:-9798}
13
+ COMPILE="$AT/build.linux.release/mufl-compile"
14
+
15
+ for p in "$COMPILE" "$STDLIB" "$SDK_NM/@adapt-toolkit" "$DEV_BROKER"; do
16
+ [ -e "$p" ] || { echo "MISSING: $p (set ADAPT_TOOLKIT / OURS_SDK_NODE_MODULES / DEV_BROKER)"; exit 2; }
17
+ done
18
+
19
+ BUILD=$(mktemp -d)
20
+ trap 'rm -rf "$BUILD"' EXIT
21
+ mkdir -p "$BUILD/core"
22
+ cp "$CORE_DIR"/*.mm "$CORE_DIR"/config.mufl "$BUILD/core/"
23
+ cp "$HERE/mig_actor.mu" "$HERE/mig.mjs" "$HERE/protocol_container.mm" "$BUILD/"
24
+ ln -sfn "$SDK_NM" "$BUILD/node_modules"
25
+ cat > "$BUILD/config.mufl" <<'CFG'
26
+ config script
27
+ {
28
+ stdlib_config = (config_load #$MUFL_STDLIB_PATH).
29
+ core_config = (config_load #"core").
30
+ (
31
+ $imports -> ( $libraries -> (stdlib_config $exports $libraries)'(core_config $exports $libraries)'($protocol_container -> #"protocol_container.mm"), ),
32
+ $exports -> ( $libraries -> (,), $applications -> (,) )
33
+ ).
34
+ }
35
+ CFG
36
+
37
+ cd "$BUILD"
38
+ echo "compiling test actor against $CORE_DIR core…"
39
+ MUFL_STDLIB_PATH="$STDLIB" "$COMPILE" -mp "$AT/meta" -mp "$AT/transactions" mig_actor.mu 2>&1 \
40
+ | grep -vE "Unused symbol|browser_attestation|identity_proof_document_impl" | tail -4
41
+ ls ./*.muflo >/dev/null 2>&1 || { echo "COMPILE FAILED"; exit 1; }
42
+
43
+ node "$DEV_BROKER" --host 127.0.0.1 --port "$PORT" --test_mode >broker.log 2>&1 &
44
+ BPID=$!
45
+ sleep 2.5
46
+ kill -0 "$BPID" 2>/dev/null || { echo "BROKER FAILED TO START:"; cat broker.log; exit 3; }
47
+
48
+ BROKER_URL="ws://127.0.0.1:$PORT" node mig.mjs 2> >(grep -E 'DRIVER ERR' >&2)
49
+ RC=$?
50
+ kill "$BPID" 2>/dev/null
51
+ exit $RC