@ours.network/notifications 0.1.1 → 0.3.0

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,24 +0,0 @@
1
- /*
2
- This library provides a simple version tracking mechanism for the shared
3
- ours mufl core. It contains a hardcoded read-only version that can be
4
- accessed by any library or application that loads it.
5
- This library has no dependencies and can be included in any packet.
6
- */
7
- library version
8
- {
9
- metadef version_t: (
10
- $MAJ -> int,
11
- $MIN -> int,
12
- $PATCH -> int
13
- ).
14
-
15
- fn create_version (maj: int, min: int, patch: int) = ($MIN -> min, $MAJ -> maj, $PATCH -> patch).
16
-
17
-
18
- // This MUST be updated every time we update ANY code in the shared core.
19
- hidden {
20
- core_version = create_version 0 9 0.
21
- }
22
-
23
- fn get_core_version(_) = core_version.
24
- }
@@ -1,170 +0,0 @@
1
- // ours-notifications service packet — the Notifications-as-a-Service node.
2
- //
3
- // Plays the SERVICE half of a2a_notifications (registration + token state,
4
- // post_notification ingest) plus the ordinary a2a_messaging surface so
5
- // recipients can connect via invites. Storage and WebPush egress live in the
6
- // HOST DAEMON (src/daemon.ts): the notification hooks below emit $notify_agent
7
- // events the daemon consumes ("notification_posted" / "marked_read" /
8
- // "unregistered"); the daemon owns notifications.json and the web-push calls.
9
- //
10
- // The manifest advertises core.notifications (a2a_capabilities), with a no-op
11
- // verb handler — the capability defines no control verbs in v1
12
- // (NOTIFICATIONS_CONTRACT.md in the shared core).
13
- application actor loads libraries
14
- identity_proof_document,
15
- attestation_document,
16
- native_attestation_document,
17
- transaction_message_decoder,
18
- address_document,
19
- address_document_types,
20
- key_utils,
21
- key_storage,
22
- continuation,
23
- encrypted_channel,
24
- a2a_protocol,
25
- a2a_messaging,
26
- a2a_notifications,
27
- a2a_capabilities,
28
- current_transaction_info,
29
- protocol_container,
30
- registration_proof,
31
- version
32
- uses transactions
33
- {
34
- hidden
35
- {
36
- // Minimal inbox — the service is not a chat endpoint, but the core's
37
- // receive path requires a storage hook; kept for operator debugging.
38
- metadef msg_t: ($sender -> global_id, $text -> str, $wire_id -> str).
39
- inbox is msg_t[] = [].
40
-
41
- _read_or_abort = grab( _read_or_abort ).
42
- key_storage::init ($_read_or_abort -> _read_or_abort).
43
- encrypted_channel::init ($_read_or_abort -> _read_or_abort).
44
-
45
- fn _save_state (_) = (transaction::action::return_data ($kind -> $save_state)).
46
- fn _return_data (payload: any) = (transaction::action::return_data ($kind -> $data, $payload -> payload)).
47
- fn _notify_agent (payload: any) = (transaction::action::return_data ($kind -> $notify_agent, $payload -> payload)).
48
-
49
- // Messaging hooks: storage-minimum (deposit inbound text, no-ops else).
50
- a2a_messaging::init (
51
- $_read_or_abort -> _read_or_abort,
52
- $on_message_received -> fn (arg: any) -> transaction::action::type[]
53
- {
54
- sid = (arg $sender_id) safe global_id.
55
- txt = (arg $text) safe str.
56
- wid is str = "".
57
- if (arg $wire_id) != NIL { wid -> (arg $wire_id) safe str. }
58
- inbox (_count inbox|) -> ($sender -> sid, $text -> txt, $wire_id -> wid).
59
- return [ _notify_agent ($event -> "message_received"), _save_state NIL ].
60
- },
61
- $on_message_sent -> fn (_: any) -> transaction::action::type[] { return []. },
62
- $on_contact_removed -> fn (_: any) -> transaction::action::type[] { return []. },
63
- $on_file_received -> fn (_: any) -> transaction::action::type[] { return []. },
64
- $on_file_sent -> fn (_: any) -> transaction::action::type[] { return []. }
65
- ).
66
-
67
- // Notification hooks: hand each event to the daemon (the app-side
68
- // storage/egress owner) as a $notify_agent action.
69
- a2a_notifications::init (
70
- $_read_or_abort -> _read_or_abort,
71
- $on_notification_posted -> fn (arg: any) -> transaction::action::type[]
72
- {
73
- return [ _notify_agent (
74
- $event -> "notification_posted",
75
- $notification -> (arg $notification),
76
- $bindings -> (arg $bindings)
77
- ) ].
78
- },
79
- $on_notifications_marked_read -> fn (arg: any) -> transaction::action::type[]
80
- {
81
- return [ _notify_agent (
82
- $event -> "marked_read",
83
- $recipient_cid -> (arg $recipient_cid),
84
- $notif_ids -> (arg $notif_ids)
85
- ) ].
86
- },
87
- $on_unregistered -> fn (arg: any) -> transaction::action::type[]
88
- {
89
- return [ _notify_agent (
90
- $event -> "unregistered",
91
- $recipient_cid -> (arg $recipient_cid)
92
- ) ].
93
- },
94
- // Client-side hook — this packet never registers WITH a service.
95
- $on_notify_registration -> fn (_: any) -> transaction::action::type[] { return []. }
96
- ).
97
-
98
- // Manifest: advertise core.notifications. No control verbs in v1, so
99
- // the handler is a declared no-op (init fail-fasts without one).
100
- cap_handlers is (str ->> (any -> transaction::action::type[])) = (,).
101
- cap_handlers (a2a_capabilities::cap_notifications) -> fn (_: any) -> transaction::action::type[] { return []. }
102
- cap_supported is str[] = [ a2a_capabilities::cap_notifications ].
103
-
104
- a2a_capabilities::init (
105
- $describe -> fn (_: any) -> a2a_capabilities::app_manifest_t {
106
- caps is (str ->> a2a_capabilities::capability_t) = (,).
107
- caps (a2a_capabilities::cap_notifications) -> (
108
- $cap -> a2a_capabilities::cap_notifications, $version -> 1, $params -> "", $secrets -> (,)
109
- ).
110
- return (
111
- $version -> 1,
112
- $app_id -> "network.ours.notifications",
113
- $name -> "ours notifications service",
114
- $description -> "Notifications-as-a-Service node: accepts token-authorized notification posts and pushes them out-of-band (WebPush).",
115
- $monitoring_status -> "off",
116
- $capabilities -> caps
117
- ).
118
- },
119
- $authorizer -> a2a_messaging::authorize_control,
120
- $supported -> cap_supported,
121
- $handlers -> cap_handlers,
122
- $on_unknown -> fn (_: any) -> transaction::action::type[] { return []. }
123
- ).
124
- }
125
-
126
- // On recreation the daemon injects the persisted SIGN secret as init_arg
127
- // (Serialize()-hex of the secretkey_sign); reseeding restores the container
128
- // id so registrations/tokens survive a restart (adapt #77).
129
- trn __init arg
130
- {
131
- if _typeof arg == "STRING" {
132
- key_storage::reseed_identity_from_secret
133
- ((_read_or_abort (_hex_string_to_binary (arg SAFE(str)))) SAFE(secretkey_sign)).
134
- }
135
- return ::transaction::success[].
136
- }
137
-
138
- // ---- host surface (daemon-driven) ------------------------------------
139
-
140
- trn readonly get_version _ { return version::get_core_version NIL. }
141
- trn readonly export_address_document _ { return (_write address_document::get_my_address_document()). }
142
-
143
- // Identity persistence: the daemon stores this beside the state blob and
144
- // reinjects it via __init on restart.
145
- trn readonly export_signing_secret _
146
- {
147
- return key_storage::export_identity_signing_secret().
148
- }
149
-
150
- // The core's send_message delivers to the legacy ::actor::receive_message
151
- // name; route it into the shared handler (→ inbox hook above).
152
- trn receive_message args: any { return a2a_messaging::handle_receive_message args. }
153
- trn readonly list_incoming_messages _ { return ($inbox -> inbox). }
154
-
155
- // Full persisted state: BOTH the messaging core half and the notify half.
156
- trn readonly export_state _
157
- {
158
- return (
159
- $core -> (a2a_messaging::export_core_state NIL),
160
- $notify -> (a2a_notifications::export_notify_state NIL)
161
- ).
162
- }
163
- trn import_state data: any
164
- {
165
- current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
166
- a2a_messaging::import_core_state (data $core).
167
- if (data $notify) != NIL { a2a_notifications::import_notify_state (data $notify). }
168
- return transaction::success [ _return_data ($imported -> TRUE), _save_state NIL ].
169
- }
170
- }
@@ -1,18 +0,0 @@
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
- }
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- // Generate a VAPID keypair for this service instance.
3
- // node scripts/gen-vapid.mjs [outdir] (default: ./vapid)
4
- // Writes outdir/vapid.public (0644) and outdir/vapid.private (0600).
5
- // The PRIVATE key is daemon-side only — it must never reach packet state
6
- // (the daemon injects only the public half via set_vapid_public_key).
7
- import webpush from 'web-push';
8
- import * as fs from 'node:fs';
9
- import { resolve } from 'node:path';
10
-
11
- const outDir = resolve(process.argv[2] || 'vapid');
12
- fs.mkdirSync(outDir, { recursive: true });
13
- const { publicKey, privateKey } = webpush.generateVAPIDKeys();
14
- fs.writeFileSync(resolve(outDir, 'vapid.public'), publicKey + '\n', { mode: 0o644 });
15
- fs.writeFileSync(resolve(outDir, 'vapid.private'), privateKey + '\n', { mode: 0o600 });
16
- console.log(`VAPID keypair written to ${outDir}/vapid.public + ${outDir}/vapid.private (0600)`);