@ours.network/notifications 0.1.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.
- package/LICENSE +98 -0
- package/README.md +231 -0
- package/dist/cli.js +446 -0
- package/dist/config.js +104 -0
- package/dist/daemon.js +353 -0
- package/dist/http.js +31 -0
- package/dist/log-store.js +48 -0
- package/dist/presence.js +157 -0
- package/dist/provision.js +29 -0
- package/dist/push.js +6 -0
- package/dist/web-push-sender.js +41 -0
- package/mufl_code/20E39399689579D5AFA5132C59DEDDD328C3BCA1A74D546F2193B36585DDD283.muflo +0 -0
- package/mufl_code/config.mufl +21 -0
- package/mufl_code/core/.github/FUNDING.yml +3 -0
- package/mufl_code/core/.github/workflows/docs.yml +39 -0
- package/mufl_code/core/.github/workflows/tests.yml +66 -0
- package/mufl_code/core/COMMERCIAL-LICENCE.md +25 -0
- package/mufl_code/core/COMPATIBILITY.md +221 -0
- package/mufl_code/core/CONTRIBUTING.md +37 -0
- package/mufl_code/core/LICENSE +98 -0
- package/mufl_code/core/NOTIFICATIONS_CONTRACT.md +290 -0
- package/mufl_code/core/README.md +91 -0
- package/mufl_code/core/SECURITY.md +40 -0
- package/mufl_code/core/TRADEMARKS.md +24 -0
- package/mufl_code/core/a2a_capabilities.mm +449 -0
- package/mufl_code/core/a2a_cluster.mm +601 -0
- package/mufl_code/core/a2a_control.mm +90 -0
- package/mufl_code/core/a2a_messaging.mm +4817 -0
- package/mufl_code/core/a2a_monitoring.mm +94 -0
- package/mufl_code/core/a2a_notification_integration.mm +144 -0
- package/mufl_code/core/a2a_notifications.mm +1127 -0
- package/mufl_code/core/a2a_protocol.mm +246 -0
- package/mufl_code/core/a2a_versions.mm +801 -0
- package/mufl_code/core/config.mufl +29 -0
- package/mufl_code/core/docs/.vitepress/config.mts +58 -0
- package/mufl_code/core/docs/citations.json +688 -0
- package/mufl_code/core/docs/guide/01-vendor-the-core.md +50 -0
- package/mufl_code/core/docs/guide/02-configure-and-compile.md +100 -0
- package/mufl_code/core/docs/guide/03-wire-the-host.md +154 -0
- package/mufl_code/core/docs/guide/04-connect-and-message.md +156 -0
- package/mufl_code/core/docs/guide/05-test-your-app.md +75 -0
- package/mufl_code/core/docs/guide/index.md +63 -0
- package/mufl_code/core/docs/how-it-works/capabilities-and-control.md +77 -0
- package/mufl_code/core/docs/how-it-works/cluster.md +65 -0
- package/mufl_code/core/docs/how-it-works/identity.md +56 -0
- package/mufl_code/core/docs/how-it-works/invites-and-contacts.md +76 -0
- package/mufl_code/core/docs/how-it-works/messaging.md +55 -0
- package/mufl_code/core/docs/how-it-works/monitoring-and-config.md +72 -0
- package/mufl_code/core/docs/how-it-works/overview.md +45 -0
- package/mufl_code/core/docs/how-it-works/versioning.md +116 -0
- package/mufl_code/core/docs/index.md +27 -0
- package/mufl_code/core/docs/package-lock.json +3467 -0
- package/mufl_code/core/docs/package.json +15 -0
- package/mufl_code/core/docs/reference/contributing.md +26 -0
- package/mufl_code/core/docs/reference/glossary.md +108 -0
- package/mufl_code/core/docs/reference/implementations.md +23 -0
- package/mufl_code/core/docs/reference/modules.md +19 -0
- package/mufl_code/core/docs/scripts/check-citations.mjs +36 -0
- package/mufl_code/core/docs/scripts/check-denylist.mjs +30 -0
- package/mufl_code/core/docs/scripts/gen-llms.mjs +32 -0
- package/mufl_code/core/docs/workflows/cluster.md +89 -0
- package/mufl_code/core/docs/workflows/contact-exchange.md +60 -0
- package/mufl_code/core/docs/workflows/contact-restore.md +60 -0
- package/mufl_code/core/docs/workflows/control-verbs.md +70 -0
- package/mufl_code/core/docs/workflows/index.md +57 -0
- package/mufl_code/core/docs/workflows/introductions.md +60 -0
- package/mufl_code/core/docs/workflows/messaging.md +75 -0
- package/mufl_code/core/docs/workflows/monitoring.md +84 -0
- package/mufl_code/core/docs/workflows/notifications.md +109 -0
- package/mufl_code/core/release-notes/0.1.md +60 -0
- package/mufl_code/core/release-notes/0.3.md +22 -0
- package/mufl_code/core/release-notes/0.4.md +97 -0
- package/mufl_code/core/tests/README.md +83 -0
- package/mufl_code/core/tests/compat/README.md +82 -0
- package/mufl_code/core/tests/compat/compat.mjs +245 -0
- package/mufl_code/core/tests/compat/compat_peer.mjs +146 -0
- package/mufl_code/core/tests/compat/run_compat.sh +96 -0
- package/mufl_code/core/tests/corpus.mjs +139 -0
- package/mufl_code/core/tests/corpus_actor.mu +242 -0
- package/mufl_code/core/tests/fatcompile_actor.mu +52 -0
- package/mufl_code/core/tests/mig.mjs +805 -0
- package/mufl_code/core/tests/mig_actor.mu +518 -0
- package/mufl_code/core/tests/migapp.mjs +431 -0
- package/mufl_code/core/tests/migapp_actor.mu +294 -0
- package/mufl_code/core/tests/mufl_semantics/run.sh +69 -0
- package/mufl_code/core/tests/mufl_semantics/t11_three_version.mufl +47 -0
- package/mufl_code/core/tests/mufl_semantics/t2_extra_fields.mufl +11 -0
- package/mufl_code/core/tests/mufl_semantics/t7_runtime.mufl +30 -0
- package/mufl_code/core/tests/mufl_semantics/t9_passthrough.mufl +19 -0
- package/mufl_code/core/tests/mufl_semantics/t_str_order.mufl +19 -0
- package/mufl_code/core/tests/notif.mjs +755 -0
- package/mufl_code/core/tests/notif_actor.mu +450 -0
- package/mufl_code/core/tests/protocol_container.mm +18 -0
- package/mufl_code/core/tests/run.sh +65 -0
- package/mufl_code/core/tests/run_corpus.sh +51 -0
- package/mufl_code/core/tests/run_fatcompile.sh +40 -0
- package/mufl_code/core/tests/run_mig.sh +51 -0
- package/mufl_code/core/tests/run_migapp.sh +51 -0
- package/mufl_code/core/tests/run_notif.sh +57 -0
- package/mufl_code/core/tests/test.mjs +750 -0
- package/mufl_code/core/tests/test_actor.mu +564 -0
- package/mufl_code/core/tests/test_common.mjs +93 -0
- package/mufl_code/core/version.mm +24 -0
- package/mufl_code/packet.mu +170 -0
- package/mufl_code/protocol_container.mm +18 -0
- package/package.json +43 -0
- package/scripts/gen-vapid.mjs +16 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Shared ours control-plane library.
|
|
2
|
+
//
|
|
3
|
+
// One symmetric, end-to-end-encrypted control transaction shared by every
|
|
4
|
+
// ours client: the MCP daemon's root packet receives control REQUESTS from
|
|
5
|
+
// its bound browser proxy, and the browser messenger receives control EVENTS
|
|
6
|
+
// (responses + monitoring batches) back from the root. Payloads are opaque
|
|
7
|
+
// strings (JSON by convention, see MONITORING-AND-SHARED-LIBRARY-DESIGN.md
|
|
8
|
+
// Part 4); the packet validates origin + sender only and delegates storage to
|
|
9
|
+
// the app through the on_control_received hook.
|
|
10
|
+
//
|
|
11
|
+
// Routing: this is a NEW protocol surface with no legacy clients, so both the
|
|
12
|
+
// inbound trn and the sender use the library-routed name directly — no
|
|
13
|
+
// ::actor:: compat shims.
|
|
14
|
+
library a2a_control loads libraries
|
|
15
|
+
current_transaction_info,
|
|
16
|
+
encrypted_channel,
|
|
17
|
+
a2a_versions,
|
|
18
|
+
a2a_messaging
|
|
19
|
+
uses transactions
|
|
20
|
+
{
|
|
21
|
+
control_message_tx = "::a2a_control::control_message".
|
|
22
|
+
|
|
23
|
+
hidden
|
|
24
|
+
{
|
|
25
|
+
// App-injected hook: on_control_received ($sender_id, $sender_name,
|
|
26
|
+
// $payload, $app_id, $date) -> actions. Only fires for known contacts.
|
|
27
|
+
on_control_received is (any -> transaction::action::type[]) = fn (_: any) -> transaction::action::type[] { abort "on_control_received hook is unset in a2a_control (call a2a_control::init)." when TRUE. return []. }
|
|
28
|
+
// App-declared application id, set once via init and auto-stamped onto
|
|
29
|
+
// every outgoing control message so the receiver can trust which app it
|
|
30
|
+
// is talking to without parsing the opaque payload. Plain string, no
|
|
31
|
+
// format enforced yet; a controller (e.g. the browser messenger) passes
|
|
32
|
+
// "" since it is not itself a configurable app.
|
|
33
|
+
app_id is str = "".
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
init = fn (_:(
|
|
37
|
+
$on_control_received -> received_cb: (any -> transaction::action::type[]),
|
|
38
|
+
$app_id -> app_id_arg: str
|
|
39
|
+
))
|
|
40
|
+
{
|
|
41
|
+
on_control_received -> received_cb.
|
|
42
|
+
app_id -> app_id_arg.
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Send an opaque control payload to a known contact over the encrypted
|
|
46
|
+
// channel (handshake runs transparently on first contact).
|
|
47
|
+
trn send_control _:($contact -> contact_ref: str, $payload -> payload: str)
|
|
48
|
+
{
|
|
49
|
+
current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::user,).
|
|
50
|
+
|
|
51
|
+
target_id = a2a_messaging::resolve_contact contact_ref.
|
|
52
|
+
abort "Contact is awaiting key restore (degraded) — control messages resume once the contact is restored." when (a2a_messaging::peer_ads target_id) == NIL.
|
|
53
|
+
return encrypted_channel::execute_transaction target_id (fn (_) -> transaction::results::type {
|
|
54
|
+
return transaction::success [
|
|
55
|
+
encrypted_channel::send_encrypted_tx target_id (
|
|
56
|
+
$name -> control_message_tx,
|
|
57
|
+
$targ -> ($payload -> payload, $app_id -> app_id, $pv -> a2a_versions::wire_version)
|
|
58
|
+
),
|
|
59
|
+
transaction::action::return_data ($kind -> $data, $payload -> ($sent_to -> target_id))
|
|
60
|
+
].
|
|
61
|
+
}).
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
trn control_message args: any
|
|
65
|
+
{
|
|
66
|
+
current_transaction_info::validate_origin_or_abort (transaction::envelope::origin::external,).
|
|
67
|
+
encrypted_channel::check_encrypted_or_abort().
|
|
68
|
+
|
|
69
|
+
payload = (args $payload) safe str.
|
|
70
|
+
|
|
71
|
+
// Optional on the wire, absent from pre-1.5 senders: the sender app's
|
|
72
|
+
// self-declared application id. Default "" so old payloads and hooks
|
|
73
|
+
// that do not read it behave exactly as before.
|
|
74
|
+
app_id is str = "".
|
|
75
|
+
if (args $app_id) != NIL { app_id -> (args $app_id) safe str. }
|
|
76
|
+
|
|
77
|
+
sender_id = current_transaction_info::get_external_envelope_or_abort() $from.
|
|
78
|
+
sender = a2a_messaging::contacts sender_id.
|
|
79
|
+
abort "Control message from an unknown sender was rejected." when sender == NIL.
|
|
80
|
+
msg_date = (current_transaction_info::get_transaction_time())?.
|
|
81
|
+
|
|
82
|
+
return transaction::success (on_control_received (
|
|
83
|
+
$sender_id -> sender_id,
|
|
84
|
+
$sender_name -> sender? $name,
|
|
85
|
+
$payload -> payload,
|
|
86
|
+
$app_id -> app_id,
|
|
87
|
+
$date -> msg_date
|
|
88
|
+
)).
|
|
89
|
+
}
|
|
90
|
+
}
|