@ours.network/notifications 0.1.1 → 0.3.1-nightly.1

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 (116) hide show
  1. package/README.md +122 -225
  2. package/dist/chat-target.d.ts +9 -0
  3. package/dist/chat-target.js +12 -0
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.js +13 -445
  6. package/dist/presence.d.ts +12 -0
  7. package/dist/presence.js +55 -145
  8. package/dist/server.d.ts +26 -0
  9. package/dist/server.js +145 -0
  10. package/dist/store.d.ts +63 -0
  11. package/dist/store.js +181 -0
  12. package/dist/validation.d.ts +9 -0
  13. package/dist/validation.js +60 -0
  14. package/package.json +14 -24
  15. package/dist/config.js +0 -104
  16. package/dist/daemon.js +0 -353
  17. package/dist/http.js +0 -31
  18. package/dist/log-store.js +0 -48
  19. package/dist/provision.js +0 -29
  20. package/dist/push.js +0 -6
  21. package/dist/web-push-sender.js +0 -41
  22. package/mufl_code/20E39399689579D5AFA5132C59DEDDD328C3BCA1A74D546F2193B36585DDD283.muflo +0 -0
  23. package/mufl_code/config.mufl +0 -21
  24. package/mufl_code/core/.github/FUNDING.yml +0 -3
  25. package/mufl_code/core/.github/workflows/docs.yml +0 -39
  26. package/mufl_code/core/.github/workflows/tests.yml +0 -66
  27. package/mufl_code/core/COMMERCIAL-LICENCE.md +0 -25
  28. package/mufl_code/core/COMPATIBILITY.md +0 -221
  29. package/mufl_code/core/CONTRIBUTING.md +0 -37
  30. package/mufl_code/core/LICENSE +0 -98
  31. package/mufl_code/core/NOTIFICATIONS_CONTRACT.md +0 -290
  32. package/mufl_code/core/README.md +0 -91
  33. package/mufl_code/core/SECURITY.md +0 -40
  34. package/mufl_code/core/TRADEMARKS.md +0 -24
  35. package/mufl_code/core/a2a_capabilities.mm +0 -449
  36. package/mufl_code/core/a2a_cluster.mm +0 -601
  37. package/mufl_code/core/a2a_control.mm +0 -90
  38. package/mufl_code/core/a2a_messaging.mm +0 -4817
  39. package/mufl_code/core/a2a_monitoring.mm +0 -94
  40. package/mufl_code/core/a2a_notification_integration.mm +0 -144
  41. package/mufl_code/core/a2a_notifications.mm +0 -1127
  42. package/mufl_code/core/a2a_protocol.mm +0 -246
  43. package/mufl_code/core/a2a_versions.mm +0 -801
  44. package/mufl_code/core/config.mufl +0 -29
  45. package/mufl_code/core/docs/.vitepress/config.mts +0 -58
  46. package/mufl_code/core/docs/citations.json +0 -688
  47. package/mufl_code/core/docs/guide/01-vendor-the-core.md +0 -50
  48. package/mufl_code/core/docs/guide/02-configure-and-compile.md +0 -100
  49. package/mufl_code/core/docs/guide/03-wire-the-host.md +0 -154
  50. package/mufl_code/core/docs/guide/04-connect-and-message.md +0 -156
  51. package/mufl_code/core/docs/guide/05-test-your-app.md +0 -75
  52. package/mufl_code/core/docs/guide/index.md +0 -63
  53. package/mufl_code/core/docs/how-it-works/capabilities-and-control.md +0 -77
  54. package/mufl_code/core/docs/how-it-works/cluster.md +0 -65
  55. package/mufl_code/core/docs/how-it-works/identity.md +0 -56
  56. package/mufl_code/core/docs/how-it-works/invites-and-contacts.md +0 -76
  57. package/mufl_code/core/docs/how-it-works/messaging.md +0 -55
  58. package/mufl_code/core/docs/how-it-works/monitoring-and-config.md +0 -72
  59. package/mufl_code/core/docs/how-it-works/overview.md +0 -45
  60. package/mufl_code/core/docs/how-it-works/versioning.md +0 -116
  61. package/mufl_code/core/docs/index.md +0 -27
  62. package/mufl_code/core/docs/package-lock.json +0 -3467
  63. package/mufl_code/core/docs/package.json +0 -15
  64. package/mufl_code/core/docs/reference/contributing.md +0 -26
  65. package/mufl_code/core/docs/reference/glossary.md +0 -108
  66. package/mufl_code/core/docs/reference/implementations.md +0 -23
  67. package/mufl_code/core/docs/reference/modules.md +0 -19
  68. package/mufl_code/core/docs/scripts/check-citations.mjs +0 -36
  69. package/mufl_code/core/docs/scripts/check-denylist.mjs +0 -30
  70. package/mufl_code/core/docs/scripts/gen-llms.mjs +0 -32
  71. package/mufl_code/core/docs/workflows/cluster.md +0 -89
  72. package/mufl_code/core/docs/workflows/contact-exchange.md +0 -60
  73. package/mufl_code/core/docs/workflows/contact-restore.md +0 -60
  74. package/mufl_code/core/docs/workflows/control-verbs.md +0 -70
  75. package/mufl_code/core/docs/workflows/index.md +0 -57
  76. package/mufl_code/core/docs/workflows/introductions.md +0 -60
  77. package/mufl_code/core/docs/workflows/messaging.md +0 -75
  78. package/mufl_code/core/docs/workflows/monitoring.md +0 -84
  79. package/mufl_code/core/docs/workflows/notifications.md +0 -109
  80. package/mufl_code/core/release-notes/0.1.md +0 -60
  81. package/mufl_code/core/release-notes/0.3.md +0 -22
  82. package/mufl_code/core/release-notes/0.4.md +0 -97
  83. package/mufl_code/core/tests/README.md +0 -83
  84. package/mufl_code/core/tests/compat/README.md +0 -82
  85. package/mufl_code/core/tests/compat/compat.mjs +0 -245
  86. package/mufl_code/core/tests/compat/compat_peer.mjs +0 -146
  87. package/mufl_code/core/tests/compat/run_compat.sh +0 -96
  88. package/mufl_code/core/tests/corpus.mjs +0 -139
  89. package/mufl_code/core/tests/corpus_actor.mu +0 -242
  90. package/mufl_code/core/tests/fatcompile_actor.mu +0 -52
  91. package/mufl_code/core/tests/mig.mjs +0 -805
  92. package/mufl_code/core/tests/mig_actor.mu +0 -518
  93. package/mufl_code/core/tests/migapp.mjs +0 -431
  94. package/mufl_code/core/tests/migapp_actor.mu +0 -294
  95. package/mufl_code/core/tests/mufl_semantics/run.sh +0 -69
  96. package/mufl_code/core/tests/mufl_semantics/t11_three_version.mufl +0 -47
  97. package/mufl_code/core/tests/mufl_semantics/t2_extra_fields.mufl +0 -11
  98. package/mufl_code/core/tests/mufl_semantics/t7_runtime.mufl +0 -30
  99. package/mufl_code/core/tests/mufl_semantics/t9_passthrough.mufl +0 -19
  100. package/mufl_code/core/tests/mufl_semantics/t_str_order.mufl +0 -19
  101. package/mufl_code/core/tests/notif.mjs +0 -755
  102. package/mufl_code/core/tests/notif_actor.mu +0 -450
  103. package/mufl_code/core/tests/protocol_container.mm +0 -18
  104. package/mufl_code/core/tests/run.sh +0 -65
  105. package/mufl_code/core/tests/run_corpus.sh +0 -51
  106. package/mufl_code/core/tests/run_fatcompile.sh +0 -40
  107. package/mufl_code/core/tests/run_mig.sh +0 -51
  108. package/mufl_code/core/tests/run_migapp.sh +0 -51
  109. package/mufl_code/core/tests/run_notif.sh +0 -57
  110. package/mufl_code/core/tests/test.mjs +0 -750
  111. package/mufl_code/core/tests/test_actor.mu +0 -564
  112. package/mufl_code/core/tests/test_common.mjs +0 -93
  113. package/mufl_code/core/version.mm +0 -24
  114. package/mufl_code/packet.mu +0 -170
  115. package/mufl_code/protocol_container.mm +0 -18
  116. package/scripts/gen-vapid.mjs +0 -16
@@ -1,139 +0,0 @@
1
- #!/usr/bin/env node
2
- // Golden-wire corpus gate (COMPATIBILITY.md §corpus): replay one fixture per
3
- // REGISTERED version per registry through the a2a_versions try_narrow_* dispatch
4
- // and assert the branch taken. Fast (single packet, no peer traffic) — run it
5
- // via tests/run_corpus.sh, or as part of the full suite via tests/run.sh.
6
- import { resolve } from 'node:path';
7
- import * as fs from 'node:fs';
8
- import { adapt_wrapper } from '@adapt-toolkit/sdk/executables';
9
- import { PacketWrapperConfigurator } from '@adapt-toolkit/sdk/wrappers';
10
- import { object_to_adapt_value } from '@adapt-toolkit/sdk/wrapper';
11
-
12
- const BROKER_URL = process.env.BROKER_URL || 'ws://127.0.0.1:9790';
13
- const UNIT_DIR = resolve('.');
14
- const unitHash = fs.readdirSync(UNIT_DIR).find((f) => f.endsWith('.muflo')).slice(0, -'.muflo'.length);
15
- const UNIT = new Uint8Array(fs.readFileSync(resolve(UNIT_DIR, `${unitHash}.muflo`)));
16
- const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
17
- const log = (...a) => process.stderr.write(`[corpus] ${a.join(' ')}\n`);
18
- const scorecard = [];
19
- const ok = (c, m) => { if (!c) { scorecard.push(`✗ ${m}`); console.log(` ✗ FAIL: ${m}`); } else { console.log(` ✓ ${m}`); } };
20
-
21
- async function main() {
22
- const wrapper = await adapt_wrapper.start(['--broker_address', BROKER_URL, '--test_mode',
23
- '--logger_config', '--level', 'WARNING', '--stdout', 'stderr', '--logger_config_end']);
24
- wrapper.start();
25
- await sleep(1500);
26
-
27
- const id = { name: 'C', pw: null, pending: [], rejects: [] };
28
- id.wire = () => {
29
- id.pw.on_return_data = (d) => {
30
- const kind = d.Reduce('kind').Visualize();
31
- if (kind === 'notify_agent' || kind === 'save_state') return;
32
- const p = id.pending.shift(); if (!p) return;
33
- clearTimeout(p.timer); p.resolve(d.Reduce('payload'));
34
- };
35
- id.pw.on_transaction_failure = (msg) => {
36
- const p = id.pending.shift();
37
- if (p) { clearTimeout(p.timer); p.reject(new Error(msg)); }
38
- else { id.rejects.push(String(msg)); }
39
- };
40
- };
41
- const cfg = new PacketWrapperConfigurator();
42
- cfg.process_arguments(['--unit_hash', unitHash, '--seed_phrase', 'corpus-gate-01', '--unit_dir_path', UNIT_DIR]);
43
- await new Promise((res, rej) => {
44
- const t = setTimeout(() => rej(new Error('packet create timeout')), 30000);
45
- wrapper.packet_manager.create_packet(cfg, (pw) => { clearTimeout(t); id.pw = pw; id.wire(); res(); }, UNIT);
46
- });
47
- await sleep(800);
48
- const mutate = (name, targ) => new Promise((res, rej) => {
49
- const timer = setTimeout(() => rej(new Error(`${name} timed out`)), 20000);
50
- id.pending.push({ resolve: res, reject: rej, timer });
51
- id.pw.add_client_message(object_to_adapt_value({ name, targ }));
52
- });
53
-
54
- const r = await mutate('::actor::qa_corpus_narrow', {});
55
- const g = (path) => path.split('.').reduce((v, k) => v.Reduce(k), r).Visualize();
56
- const T = (s) => /true/i.test(String(s));
57
-
58
- console.log('=== corpus: registry sir (v2/v3/v5 + floor + shape + future) ===');
59
- ok(T(g('sir.v2.ok')) && g('sir.v2.v') === '2' && g('sir.v2.name') === '', 'sir v2: ok, dispatched v2, joiner_name empty (cid fallback branch)');
60
- ok(T(g('sir.v3.ok')) && g('sir.v3.v') === '3' && g('sir.v3.name') === 'Bob', 'sir v3: ok, dispatched v3, $name honored');
61
- ok(T(g('sir.v5.ok')) && g('sir.v5.v') === '5' && g('sir.v5.name') === 'Carol', 'sir v5: ok, dispatched v5, $name honored');
62
- ok(!T(g('sir.old.ok')) && g('sir.old.code') === 'peer_version_unsupported', 'sir $pv=1 (below floor): error-as-data peer_version_unsupported');
63
- ok(g('sir.old.peer_v') === '1' && g('sir.old.min') === '2', `sir too-old error carries peer_version=1 min_supported=2`);
64
- ok(/too old/.test(g('sir.old.msg')) && /update/.test(g('sir.old.msg')), 'sir too-old error message is human-readable ("too old", "update")');
65
- ok(!T(g('sir.bad.ok')) && g('sir.bad.code') === 'payload_shape_unrecognized', 'sir unrecognized shape: error-as-data payload_shape_unrecognized');
66
- ok(!/too old/.test(g('sir.bad.msg')) && /no supported wire shape/.test(g('sir.bad.msg')), 'sir shape error message is DISTINCT from the too-old message (R2)');
67
- ok(T(g('sir.fut.ok')) && g('sir.fut.name') === 'Dee' && T(g('sir.fut.stripped_future')), 'sir $pv=7 (future): narrows as newest registered (v5), unknown field stripped');
68
- ok(!T(g('sir.wid.ok')) && g('sir.wid.code') === 'payload_shape_unrecognized', 'sir mistyped $invite_id (int): shape error-as-data, no cast abort (M1)');
69
- ok(!T(g('sir.wnm.ok')) && g('sir.wnm.code') === 'payload_shape_unrecognized', 'sir mistyped $name (int): shape error-as-data, no cast abort (M1)');
70
- ok(T(g('sir.wpv.ok')) && g('sir.wpv.v') === '3' && g('sir.wpv.name') === 'Eve', 'sir mistyped $pv (str): tolerated as unstamped, shape-inferred v3 (M1)');
71
- ok(T(g('sir.pv4.ok')) && g('sir.pv4.name') === 'Fay', 'sir synthetic $pv=4 (dead 0.4 line): narrows as v3, $name honored (R3)');
72
-
73
- console.log('=== corpus: registry cin (v2/v5 + floor) ===');
74
- ok(T(g('cin.v2.ok')), 'cin v2: ok');
75
- ok(T(g('cin.v5.ok')), 'cin v5: ok');
76
- ok(!T(g('cin.old.ok')) && g('cin.old.code') === 'peer_version_unsupported', 'cin below floor: error-as-data');
77
-
78
- console.log('=== corpus: registry rst (v2/v5 + floor) ===');
79
- ok(T(g('rst.v2.ok')), 'rst v2: ok');
80
- ok(T(g('rst.v5.ok')), 'rst v5: ok');
81
- ok(!T(g('rst.old.ok')) && g('rst.old.code') === 'peer_version_unsupported', 'rst below floor: error-as-data');
82
-
83
- console.log('=== corpus: registry acc (v2/v3 + floor) ===');
84
- ok(T(g('acc.v2.ok')) && g('acc.v2.name') === '', 'acc v2: ok, joiner_name empty (cid fallback branch)');
85
- ok(T(g('acc.v3.ok')) && g('acc.v3.name') === 'Joi', 'acc v3: ok, $joiner_name honored');
86
- ok(!T(g('acc.old.ok')) && g('acc.old.code') === 'peer_version_unsupported', 'acc below floor: error-as-data');
87
-
88
- console.log('=== corpus: registry e2e (v1 + floor + shape + M1 wrong-domain + future) ===');
89
- ok(T(g('e2e.pre.ok')) && g('e2e.pre.v') === '8' && g('e2e.pre.ot') === '0', 'e2e pre-key: ok, dispatched v8, $olm_type=0 round-trips');
90
- ok(T(g('e2e.nrm.ok')) && g('e2e.nrm.ot') === '1', 'e2e normal ratchet: ok, $olm_type=1 round-trips');
91
- ok(!T(g('e2e.old.ok')) && g('e2e.old.code') === 'peer_version_unsupported', 'e2e $pv=1 (below floor): error-as-data peer_version_unsupported');
92
- ok(g('e2e.old.peer_v') === '1' && g('e2e.old.min') === '2' && /too old/.test(g('e2e.old.msg')), 'e2e too-old error carries peer_version=1 min=2, human-readable');
93
- ok(!T(g('e2e.bad.ok')) && g('e2e.bad.code') === 'payload_shape_unrecognized' && /no supported wire shape/.test(g('e2e.bad.msg')), 'e2e no $e2e_envelope marker: error-as-data payload_shape_unrecognized (distinct msg)');
94
- ok(!T(g('e2e.nos.ok')) && g('e2e.nos.code') === 'payload_shape_unrecognized', 'e2e missing $emsignature: shape error-as-data (variant requires the outer sig)');
95
- ok(!T(g('e2e.wsid.ok')) && g('e2e.wsid.code') === 'payload_shape_unrecognized', 'e2e mistyped $session_id (int): shape error-as-data, no cast abort (M1)');
96
- ok(!T(g('e2e.wot.ok')) && g('e2e.wot.code') === 'payload_shape_unrecognized', 'e2e mistyped $olm_type (str): shape error-as-data, no cast abort (M1)');
97
- ok(!T(g('e2e.wct.ok')) && g('e2e.wct.code') === 'payload_shape_unrecognized', 'e2e mistyped $ciphertext (str): shape error-as-data, no cast abort (M1)');
98
- ok(!T(g('e2e.wpv.ok')) && g('e2e.wpv.code') === 'payload_shape_unrecognized', 'e2e mistyped $pv (str): malformed discriminator -> shape error-as-data, no cast abort (M1)');
99
- ok(T(g('e2e.uns.ok')) && g('e2e.uns.v') === '8' && g('e2e.uns.ot') === '0', 'e2e unstamped (no $pv): tolerated absent-discriminator, defaults to v8, ok (M1)');
100
- ok(T(g('e2e.fut.ok')) && g('e2e.fut.ot') === '1', 'e2e $pv=99 (future): narrows as v1 (single registered version), ok');
101
- ok(T(g('e2e.bin.ok')) && g('e2e.bin.ot') === '1', 'e2e BINARY $session_id (the shipped adapt wire): dual-accept, narrows ok (§5.9-1)');
102
-
103
- console.log('=== corpus: registry mgb (offer/ack + floor + shape + unstamped + future) ===');
104
- ok(T(g('mgb.off.ok')) && g('mgb.off.v') === '9' && T(g('mgb.off.pn_absent')), 'mgb offer: ok, dispatched v9, $peer_nonce absent (offer form)');
105
- ok(T(g('mgb.ack.ok')) && T(g('mgb.ack.pn_present')), 'mgb ack: ok, $peer_nonce present (echoes offer nonce)');
106
- ok(!T(g('mgb.old.ok')) && g('mgb.old.code') === 'peer_version_unsupported' && g('mgb.old.peer_v') === '1' && g('mgb.old.min') === '2', 'mgb $pv=1 (below floor): error-as-data peer_version_unsupported');
107
- ok(!T(g('mgb.wn.ok')) && g('mgb.wn.code') === 'payload_shape_unrecognized', 'mgb mistyped $nonce (str): shape error-as-data, no cast abort (M1)');
108
- ok(!T(g('mgb.uns.ok')) && g('mgb.uns.code') === 'payload_shape_unrecognized', 'mgb unstamped (no $pv): shape error-as-data (surface requires the $pv stamp)');
109
- ok(T(g('mgb.fut.ok')) && g('mgb.fut.v') === '10', 'mgb $pv=10 (future): narrows as v1 (single registered version), ok');
110
-
111
- console.log('=== corpus: registry mgc (commit/confirm + floor + epoch-domain + M1) ===');
112
- ok(T(g('mgc.com.ok')) && T(g('mgc.com.has_sid')), 'mgc commit: ok, $session_id present (commit form)');
113
- ok(T(g('mgc.con.ok')) && T(g('mgc.con.no_sid')), 'mgc confirm: ok, $session_id absent (confirm form)');
114
- ok(!T(g('mgc.old.ok')) && g('mgc.old.code') === 'peer_version_unsupported', 'mgc $pv=1 (below floor): error-as-data peer_version_unsupported');
115
- ok(!T(g('mgc.ne.ok')) && g('mgc.ne.code') === 'payload_shape_unrecognized', 'mgc no $epoch: shape error-as-data (epoch-domain required)');
116
- ok(!T(g('mgc.we.ok')) && g('mgc.we.code') === 'payload_shape_unrecognized', 'mgc mistyped $epoch (str): shape error-as-data, no cast abort (M1)');
117
- ok(!T(g('mgc.ws.ok')) && g('mgc.ws.code') === 'payload_shape_unrecognized', 'mgc mistyped $session_id (int): shape error-as-data, no cast abort (M1)');
118
- ok(T(g('mgc.uns.ok')), 'mgc unstamped (no $pv): tolerated (E2E session authenticates), narrows v1');
119
-
120
- console.log('=== corpus: strict narrow aborts with the stable message ===');
121
- let strictMsg = '';
122
- try { await mutate('::actor::qa_corpus_narrow_strict_old', {}); } catch (e) { strictMsg = String(e.message); }
123
- ok(/too old/.test(strictMsg) && /minimum supported is v2/.test(strictMsg),
124
- `strict narrow on below-floor payload aborts with the registry message (got: ${strictMsg.split('\n')[0].slice(0, 120)})`);
125
-
126
- // NOTE: the e2e caps/anti-downgrade routing (a2a_messaging::e2e_route) is
127
- // production code that compiles clean, but its MUFL unit test cannot live in
128
- // the corpus unit — corpus_actor.mu deliberately does not load a2a_messaging
129
- // (the meta-stage type-reduction fuel is per compiled unit; see the header
130
- // comment in corpus_actor.mu). Routing is covered by the scenario suite
131
- // (test_actor.mu / test.mjs), which owns all state-touching trns.
132
-
133
- console.log('\n================ CORPUS ================');
134
- if (scorecard.length === 0) console.log('CORPUS: ALL GREEN');
135
- else { console.log(`${scorecard.length} FAILURE(S):`); scorecard.forEach((s) => console.log(' ' + s)); }
136
- await sleep(300);
137
- process.exit(scorecard.length === 0 ? 0 : 1);
138
- }
139
- main().catch((e) => { log('DRIVER ERR:', e.stack ?? e.message); process.exit(1); });
@@ -1,242 +0,0 @@
1
- // Corpus actor for the golden-wire registry gate (tests/corpus.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). AD-v2 embeds
6
- // t_e2e_bundle inside t_container_identity, which deepens every type reduction
7
- // that touches t_address_document; test_actor plus the corpus fixtures no
8
- // longer fits a single unit's budget (and Phase-A adds mgb/mgc fixtures here).
9
- // Two units = two budgets; the corpus unit stays small and cheap by loading
10
- // only what try_narrow_* dispatch needs (no a2a_messaging/a2a_protocol).
11
- application actor loads libraries
12
- address_document,
13
- address_document_types,
14
- key_utils,
15
- key_storage,
16
- a2a_versions,
17
- current_transaction_info,
18
- protocol_container,
19
- version
20
- uses transactions
21
- {
22
- hidden
23
- {
24
- fn _return_data (payload: any) = (transaction::action::return_data ($kind -> $data, $payload -> payload)).
25
- }
26
-
27
- // ---- golden-wire corpus probes (COMPATIBILITY.md release gate) ----
28
- // One fixture per REGISTERED version per registry, built as the EXACT wire
29
- // shape that version's sender emits (fixtures-as-code: the payloads carry
30
- // real global_ids + a real AD, which JSON fixtures cannot encode), replayed
31
- // through the registry try_narrow_* dispatch. The driver asserts the branch
32
- // taken for every registered version — a release is green only if all pass.
33
- trn qa_corpus_narrow _
34
- {
35
- current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
36
- // Upcast once: AD-v2 embeds t_e2e_bundle, making the full t_address_document
37
- // type deep enough that ~40 fixture record literals carrying it exhaust the
38
- // compiler's meta-stage type-reduction budget. Fixtures only ever feed
39
- // try_narrow_* as `any`; binding my_ad as any keeps every literal's type flat.
40
- my_ad = (address_document::get_my_address_document()) as any.
41
- iid = _new_id "qa corpus invite".
42
- rid = _new_id "qa corpus rid".
43
-
44
- // registry "sir" — leg-1 boxed bundle: v2 (no $name), v3 (+$name),
45
- // v5 (+$pv/$caps), a below-floor dialect ($pv -> 1), an unrecognized
46
- // shape, and a FUTURE dialect ($pv -> 7, v5 shape + unknown field).
47
- sir_v2 = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid).
48
- sir_v3 = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid, $name -> "Bob").
49
- sir_v5 = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid, $name -> "Carol", $pv -> 5, $caps -> ["core.notifications"]).
50
- sir_old = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid, $pv -> 1).
51
- sir_bad = ($nope -> 1).
52
- sir_fut = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid, $name -> "Dee", $pv -> 7, $caps -> ["core.notifications"], $future_field -> "F").
53
- // M1 wrong-domain fixtures: present-but-mistyped NON-nullable fields
54
- // must classify as shape errors (error-as-data), never abort the cast.
55
- sir_wid = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> 42).
56
- sir_wnm = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid, $name -> 42).
57
- // Mistyped $pv: tolerated as UNSTAMPED (shape inference applies) — this
58
- // one carries $name so it dispatches v3.
59
- sir_wpv = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid, $name -> "Eve", $pv -> "five").
60
- // Synthetic $pv=4 (dead 0.4 line, wire-identical to 0.3): narrows as v3.
61
- sir_pv4 = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid, $name -> "Fay", $pv -> 4).
62
-
63
- r2 = a2a_versions::try_narrow_sir (sir_v2 as any).
64
- r3 = a2a_versions::try_narrow_sir (sir_v3 as any).
65
- r5 = a2a_versions::try_narrow_sir (sir_v5 as any).
66
- ro = a2a_versions::try_narrow_sir (sir_old as any).
67
- rb = a2a_versions::try_narrow_sir (sir_bad as any).
68
- rf = a2a_versions::try_narrow_sir (sir_fut as any).
69
- rwid = a2a_versions::try_narrow_sir (sir_wid as any).
70
- rwnm = a2a_versions::try_narrow_sir (sir_wnm as any).
71
- rwpv = a2a_versions::try_narrow_sir (sir_wpv as any).
72
- rpv4 = a2a_versions::try_narrow_sir (sir_pv4 as any).
73
-
74
- // registry "cin" — leg-3 boxed bundle: v2 / v5.
75
- c2 = a2a_versions::try_narrow_cin ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid).
76
- c5 = a2a_versions::try_narrow_cin ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid, $pv -> 5, $caps -> []).
77
- co = a2a_versions::try_narrow_cin ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid, $pv -> 1).
78
-
79
- // registry "rst" — restore boxed bundle: v2 / v5.
80
- s2 = a2a_versions::try_narrow_rst ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $rid -> rid).
81
- s5 = a2a_versions::try_narrow_rst ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $rid -> rid, $pv -> 5, $caps -> []).
82
- so = a2a_versions::try_narrow_rst ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $rid -> rid, $pv -> 1).
83
-
84
- // registry "acc" — legacy accept_contact args: v2 (no $joiner_name) / v3.
85
- a2 = a2a_versions::try_narrow_acc ($invite_id -> iid, $joiner_ad -> my_ad).
86
- a3 = a2a_versions::try_narrow_acc ($invite_id -> iid, $joiner_ad -> my_ad, $joiner_name -> "Joi").
87
- ao = a2a_versions::try_narrow_acc ($invite_id -> iid, $joiner_ad -> my_ad, $pv -> 1).
88
-
89
- // registry "e2e" — e2e_signed_message VARIANT ($e2e_envelope -> t_e2e_envelope,
90
- // $emsignature): single version, LOAD-BEARING (sir-style payload cast). The $pv
91
- // discriminator rides inside $e2e_envelope. Cases mirror sir's abort-free (M1) matrix.
92
- ct = _hex_string_to_binary "00112233445566778899aabbccddeeff".
93
- sid = _new_id "qa e2e session".
94
- sig = key_storage::default_sign (_value_id sid).
95
- e_pre = ($e2e_envelope -> ($session_id -> sid, $olm_type -> 0, $ciphertext -> ct, $pv -> 8), $emsignature -> sig). // PRE_KEY
96
- e_nrm = ($e2e_envelope -> ($session_id -> sid, $olm_type -> 1, $ciphertext -> ct, $pv -> 8), $emsignature -> sig). // normal ratchet
97
- e_old = ($e2e_envelope -> ($session_id -> sid, $olm_type -> 1, $ciphertext -> ct, $pv -> 1), $emsignature -> sig). // inner $pv below floor
98
- e_bad = ($nope -> 1). // no $e2e_envelope marker
99
- e_nos = ($e2e_envelope -> ($session_id -> sid, $olm_type -> 0, $ciphertext -> ct, $pv -> 8)). // missing $emsignature
100
- // M1 wrong-domain: present-but-mistyped NON-nullable inner fields -> shape error, never a cast abort.
101
- e_wsid = ($e2e_envelope -> ($session_id -> 42, $olm_type -> 1, $ciphertext -> ct, $pv -> 8), $emsignature -> sig). // $session_id int
102
- e_wot = ($e2e_envelope -> ($session_id -> sid, $olm_type -> "one", $ciphertext -> ct, $pv -> 8), $emsignature -> sig). // $olm_type str
103
- e_wct = ($e2e_envelope -> ($session_id -> sid, $olm_type -> 1, $ciphertext -> "notbin", $pv -> 8), $emsignature -> sig). // $ciphertext str
104
- // Mistyped inner $pv (str): every e2e sender stamps an int $pv, so a present-non-int is
105
- // malformed -> shape_error (error-as-data, abort-free), NOT tolerated as unstamped.
106
- e_wpv = ($e2e_envelope -> ($session_id -> sid, $olm_type -> 0, $ciphertext -> ct, $pv -> "eight"), $emsignature -> sig).
107
- // Unstamped inner (no $pv): the tolerated absent-discriminator path -> defaults to v8, ok.
108
- e_uns = ($e2e_envelope -> ($session_id -> sid, $olm_type -> 0, $ciphertext -> ct), $emsignature -> sig).
109
- // Future dialect (inner $pv=99): single registered version -> narrows as v1 (class-A forward compat).
110
- e_fut = ($e2e_envelope -> ($session_id -> sid, $olm_type -> 1, $ciphertext -> ct, $pv -> 99), $emsignature -> sig).
111
- // §5.9-1 dual-accept: the SHIPPED adapt wire carries a BINARY $session_id (session_id()
112
- // bytes), NOT a hex string. The core registry must classify it as OK (was is_str-only).
113
- bsid = _hex_string_to_binary "cafebabecafebabecafebabecafebabe".
114
- e_bin = ($e2e_envelope -> ($session_id -> bsid, $olm_type -> 1, $ciphertext -> ct, $pv -> 8), $emsignature -> sig).
115
-
116
- ep = a2a_versions::try_narrow_e2e (e_pre as any).
117
- en = a2a_versions::try_narrow_e2e (e_nrm as any).
118
- eo = a2a_versions::try_narrow_e2e (e_old as any).
119
- eb = a2a_versions::try_narrow_e2e (e_bad as any).
120
- ens = a2a_versions::try_narrow_e2e (e_nos as any).
121
- ews = a2a_versions::try_narrow_e2e (e_wsid as any).
122
- ewo = a2a_versions::try_narrow_e2e (e_wot as any).
123
- ewc = a2a_versions::try_narrow_e2e (e_wct as any).
124
- ewp = a2a_versions::try_narrow_e2e (e_wpv as any).
125
- eu = a2a_versions::try_narrow_e2e (e_uns as any).
126
- ef = a2a_versions::try_narrow_e2e (e_fut as any).
127
- ebin = a2a_versions::try_narrow_e2e (e_bin as any).
128
-
129
- // registry "mgb" — e2e-migration offer/ack bundle (wire 9, single version).
130
- // sir-shape identity bundle ($ad any) + agreement fields: the offer omits
131
- // $peer_nonce, the ack echoes the offer nonce. Introduction dialect 9, so
132
- // an unstamped body (no $pv) is malformed on this surface -> shape error.
133
- mna = _hex_string_to_binary "a0a1a2a3a4a5a6a7a8a9aaabacadaeaf". // offer nonce (bin)
134
- mnb = _hex_string_to_binary "b0b1b2b3b4b5b6b7b8b9babbbcbdbebf". // ack nonce (bin)
135
- mgb_off = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $nonce -> mna, $peer_nonce -> NIL, $pv -> 9, $caps -> ["core.e2e.migrate"]). // offer form
136
- mgb_ack = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $nonce -> mnb, $peer_nonce -> mna, $pv -> 9, $caps -> ["core.e2e.migrate"]). // ack form (echoes offer nonce)
137
- mgb_old = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $nonce -> mna, $peer_nonce -> NIL, $pv -> 1, $caps -> []). // below floor
138
- mgb_wn = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $nonce -> "notbin", $peer_nonce -> NIL, $pv -> 9, $caps -> []). // mistyped $nonce (str)
139
- mgb_uns = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $nonce -> mna, $peer_nonce -> NIL, $caps -> []). // unstamped (no $pv)
140
- mgb_fut = ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $nonce -> mna, $peer_nonce -> NIL, $pv -> 10, $caps -> []). // future dialect
141
-
142
- gmo = a2a_versions::try_narrow_mgb (mgb_off as any).
143
- gma = a2a_versions::try_narrow_mgb (mgb_ack as any).
144
- gmold = a2a_versions::try_narrow_mgb (mgb_old as any).
145
- gmwn = a2a_versions::try_narrow_mgb (mgb_wn as any).
146
- gmuns = a2a_versions::try_narrow_mgb (mgb_uns as any).
147
- gmfut = a2a_versions::try_narrow_mgb (mgb_fut as any).
148
-
149
- // registry "mgc" — e2e-migration commit/confirm inner $targ (wire 9). The
150
- // commit carries $session_id; the confirm omits it. $epoch is the required
151
- // domain-checked field; $pv is nullable (the E2E session authenticates).
152
- mep = _hex_string_to_binary "c0c1c2c3c4c5c6c7c8c9cacbcccdcecf". // epoch (bin)
153
- msd = _hex_string_to_binary "d0d1d2d3d4d5d6d7d8d9dadbdcdddedf". // session_id (bin)
154
- mgc_com = ($epoch -> mep, $session_id -> msd, $pv -> 9). // COMMIT form
155
- mgc_con = ($epoch -> mep, $pv -> 9). // CONFIRM form (no $session_id)
156
- mgc_old = ($epoch -> mep, $session_id -> msd, $pv -> 1). // below floor
157
- mgc_ne = ($session_id -> msd, $pv -> 9). // no $epoch -> shape err (epoch-domain)
158
- mgc_we = ($epoch -> "notbin", $session_id -> msd, $pv -> 9). // mistyped $epoch (str) -> shape err
159
- mgc_ws = ($epoch -> mep, $session_id -> 42, $pv -> 9). // mistyped $session_id (int) -> shape err (M1)
160
- mgc_uns = ($epoch -> mep, $session_id -> msd). // unstamped (no $pv) -> tolerated, ok
161
-
162
- cco = a2a_versions::try_narrow_mgc (mgc_com as any).
163
- ccn = a2a_versions::try_narrow_mgc (mgc_con as any).
164
- ccold = a2a_versions::try_narrow_mgc (mgc_old as any).
165
- ccne = a2a_versions::try_narrow_mgc (mgc_ne as any).
166
- ccwe = a2a_versions::try_narrow_mgc (mgc_we as any).
167
- ccws = a2a_versions::try_narrow_mgc (mgc_ws as any).
168
- ccuns = a2a_versions::try_narrow_mgc (mgc_uns as any).
169
-
170
- return transaction::success [ _return_data (
171
- $sir -> (
172
- $v2 -> ($ok -> (r2 $ok), $v -> (a2a_versions::sir_version_of (sir_v2 as any)), $name -> (a2a_versions::sir_joiner_name ((r2 $payload)?))),
173
- $v3 -> ($ok -> (r3 $ok), $v -> (a2a_versions::sir_version_of (sir_v3 as any)), $name -> (a2a_versions::sir_joiner_name ((r3 $payload)?))),
174
- $v5 -> ($ok -> (r5 $ok), $v -> (a2a_versions::sir_version_of (sir_v5 as any)), $name -> (a2a_versions::sir_joiner_name ((r5 $payload)?))),
175
- $old -> ($ok -> (ro $ok), $code -> (((ro $err)?) $code), $msg -> (((ro $err)?) $message), $peer_v -> (((ro $err)?) $peer_version), $min -> (((ro $err)?) $min_supported)),
176
- $bad -> ($ok -> (rb $ok), $code -> (((rb $err)?) $code), $msg -> (((rb $err)?) $message)),
177
- $fut -> ($ok -> (rf $ok), $name -> (a2a_versions::sir_joiner_name ((rf $payload)?)), $stripped_future -> ((((rf $payload)?) as any) $future_field == NIL)),
178
- $wid -> ($ok -> (rwid $ok), $code -> (((rwid $err)?) $code)),
179
- $wnm -> ($ok -> (rwnm $ok), $code -> (((rwnm $err)?) $code)),
180
- $wpv -> ($ok -> (rwpv $ok), $name -> (a2a_versions::sir_joiner_name ((rwpv $payload)?)), $v -> (a2a_versions::sir_version_of (sir_wpv as any))),
181
- $pv4 -> ($ok -> (rpv4 $ok), $name -> (a2a_versions::sir_joiner_name ((rpv4 $payload)?)))
182
- ),
183
- $cin -> (
184
- $v2 -> ($ok -> (c2 $ok)),
185
- $v5 -> ($ok -> (c5 $ok)),
186
- $old -> ($ok -> (co $ok), $code -> (((co $err)?) $code))
187
- ),
188
- $rst -> (
189
- $v2 -> ($ok -> (s2 $ok)),
190
- $v5 -> ($ok -> (s5 $ok)),
191
- $old -> ($ok -> (so $ok), $code -> (((so $err)?) $code))
192
- ),
193
- $acc -> (
194
- $v2 -> ($ok -> (a2 $ok), $name -> (a2a_versions::acc_joiner_name ((a2 $payload)?))),
195
- $v3 -> ($ok -> (a3 $ok), $name -> (a2a_versions::acc_joiner_name ((a3 $payload)?))),
196
- $old -> ($ok -> (ao $ok), $code -> (((ao $err)?) $code))
197
- ),
198
- $e2e -> (
199
- $pre -> ($ok -> (ep $ok), $v -> (a2a_versions::e2e_version_of (e_pre as any)), $ot -> (((ep $payload)?) $e2e_envelope $olm_type)),
200
- $nrm -> ($ok -> (en $ok), $ot -> (((en $payload)?) $e2e_envelope $olm_type)),
201
- $old -> ($ok -> (eo $ok), $code -> (((eo $err)?) $code), $peer_v -> (((eo $err)?) $peer_version), $min -> (((eo $err)?) $min_supported), $msg -> (((eo $err)?) $message)),
202
- $bad -> ($ok -> (eb $ok), $code -> (((eb $err)?) $code), $msg -> (((eb $err)?) $message)),
203
- $nos -> ($ok -> (ens $ok), $code -> (((ens $err)?) $code)),
204
- $wsid -> ($ok -> (ews $ok), $code -> (((ews $err)?) $code)),
205
- $wot -> ($ok -> (ewo $ok), $code -> (((ewo $err)?) $code)),
206
- $wct -> ($ok -> (ewc $ok), $code -> (((ewc $err)?) $code)),
207
- $wpv -> ($ok -> (ewp $ok), $code -> (((ewp $err)?) $code)),
208
- $uns -> ($ok -> (eu $ok), $v -> (a2a_versions::e2e_version_of (e_uns as any)), $ot -> (((eu $payload)?) $e2e_envelope $olm_type)),
209
- $fut -> ($ok -> (ef $ok), $ot -> (((ef $payload)?) $e2e_envelope $olm_type)),
210
- $bin -> ($ok -> (ebin $ok), $ot -> (((ebin $payload)?) $e2e_envelope $olm_type))
211
- ),
212
- $mgb -> (
213
- $off -> ($ok -> (gmo $ok), $v -> (a2a_versions::mgb_version_of (mgb_off as any)), $pn_absent -> ((((gmo $payload)?) as any) $peer_nonce == NIL)),
214
- $ack -> ($ok -> (gma $ok), $pn_present -> ((((gma $payload)?) as any) $peer_nonce != NIL)),
215
- $old -> ($ok -> (gmold $ok), $code -> (((gmold $err)?) $code), $peer_v -> (((gmold $err)?) $peer_version), $min -> (((gmold $err)?) $min_supported)),
216
- $wn -> ($ok -> (gmwn $ok), $code -> (((gmwn $err)?) $code)),
217
- $uns -> ($ok -> (gmuns $ok), $code -> (((gmuns $err)?) $code)),
218
- $fut -> ($ok -> (gmfut $ok), $v -> (a2a_versions::mgb_version_of (mgb_fut as any)))
219
- ),
220
- $mgc -> (
221
- $com -> ($ok -> (cco $ok), $has_sid -> ((((cco $payload)?) as any) $session_id != NIL)),
222
- $con -> ($ok -> (ccn $ok), $no_sid -> ((((ccn $payload)?) as any) $session_id == NIL)),
223
- $old -> ($ok -> (ccold $ok), $code -> (((ccold $err)?) $code)),
224
- $ne -> ($ok -> (ccne $ok), $code -> (((ccne $err)?) $code)),
225
- $we -> ($ok -> (ccwe $ok), $code -> (((ccwe $err)?) $code)),
226
- $ws -> ($ok -> (ccws $ok), $code -> (((ccws $err)?) $code)),
227
- $uns -> ($ok -> (ccuns $ok))
228
- )
229
- ) ].
230
- }
231
-
232
- // The STRICT narrow on a below-floor payload must abort with the stable
233
- // error message (never a raw NIL-cast EVAL_ERROR) — driver asserts the text.
234
- trn qa_corpus_narrow_strict_old _
235
- {
236
- current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
237
- my_ad = address_document::get_my_address_document().
238
- iid = _new_id "qa strict".
239
- p = a2a_versions::narrow_sir ($ad -> my_ad, $cert -> NIL, $root_profile -> NIL, $cp_binding -> NIL, $invite_id -> iid, $pv -> 1).
240
- return transaction::success [ _return_data ($unreachable -> ((p as any) $invite_id)) ].
241
- }
242
- }
@@ -1,52 +0,0 @@
1
- // COMPILE-ONLY regression guard for the daemon build path (issue: the migration core
2
- // overflowed the per-unit meta-stage reduction fuel — adapt src/eval/meta_reduction_fuel.h,
3
- // 1M steps — when compiled into a FULL ours-mcp daemon packet, because a dead 5th
4
- // transaction::type wire-union variant (e2e_signed_message, Option A) inflated __t_wrapper's
5
- // per-transaction body SAFE-cast reduction; fixed by dropping the variant → 4 variants).
6
- //
7
- // This actor deliberately loads the HEAVY daemon-side libraries TOGETHER —
8
- // a2a_messaging (the migration surface) + a2a_cluster + a2a_capabilities —
9
- // which is the composition the real ours-mcp daemon actor.mu uses (per its compile trace: it loads
10
- // a2a_messaging + a2a_cluster). It goes through the SAME __t_wrapper meta path at ~daemon
11
- // transaction-count scale that no other test unit exercised (mig/migapp/test/notif each load a
12
- // SUBSET, and none combine messaging+cluster). If the migration core ever re-inflates __t_wrapper's
13
- // per-transaction body SAFE-cast reduction past the ceiling, THIS compile fails — catching it in-repo
14
- // instead of at the daemon. It defines NO qa probes and runs no driver; producing a .muflo IS the
15
- // whole test (see run_fatcompile.sh). Keep it lean: it stresses type-level reduction, not runtime.
16
- application actor loads libraries
17
- identity_proof_document,
18
- attestation_document,
19
- native_attestation_document,
20
- transaction_message_decoder,
21
- address_document,
22
- address_document_types,
23
- key_utils,
24
- key_storage,
25
- continuation,
26
- encrypted_channel,
27
- a2a_versions,
28
- a2a_capabilities,
29
- a2a_protocol,
30
- a2a_messaging,
31
- a2a_cluster,
32
- current_transaction_info,
33
- protocol_container,
34
- version
35
- uses transactions
36
- {
37
- hidden
38
- {
39
- _read_or_abort = grab( _read_or_abort ).
40
- key_storage::init ($_read_or_abort -> _read_or_abort).
41
- encrypted_channel::init ($_read_or_abort -> _read_or_abort).
42
- a2a_messaging::init (
43
- $_read_or_abort -> _read_or_abort,
44
- $on_message_received -> fn (_: any) -> transaction::action::type[] { return []. },
45
- $on_message_sent -> fn (_: any) -> transaction::action::type[] { return []. },
46
- $on_contact_removed -> fn (_: any) -> transaction::action::type[] { return []. },
47
- $on_file_received -> fn (_: any) -> transaction::action::type[] { return []. },
48
- $on_file_sent -> fn (_: any) -> transaction::action::type[] { return []. },
49
- $on_receipt_received -> fn (_: any) -> transaction::action::type[] { return []. }
50
- ).
51
- }
52
- }