@941design/marmot-engine 0.0.0-stage → 0.2.0-alpha.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/CHANGELOG.md +477 -0
- package/LICENSE +53 -0
- package/README.md +33 -2
- package/dist/audit/emitter.d.ts +17 -0
- package/dist/audit/emitter.js +30 -0
- package/dist/audit/helpers.d.ts +16 -0
- package/dist/audit/helpers.js +103 -0
- package/dist/audit/index.d.ts +6 -0
- package/dist/audit/index.js +6 -0
- package/dist/audit/recorder.d.ts +13 -0
- package/dist/audit/recorder.js +24 -0
- package/dist/audit/sink.d.ts +16 -0
- package/dist/audit/sink.js +27 -0
- package/dist/audit/types-internal.d.ts +7 -0
- package/dist/audit/types-internal.js +1 -0
- package/dist/audit/types.d.ts +289 -0
- package/dist/audit/types.js +2 -0
- package/dist/core/account-identity-proof.d.ts +165 -0
- package/dist/core/account-identity-proof.js +277 -0
- package/dist/core/application-rumor.d.ts +45 -0
- package/dist/core/application-rumor.js +120 -0
- package/dist/core/auth-service.d.ts +2 -0
- package/dist/core/auth-service.js +52 -0
- package/dist/core/binary.d.ts +142 -0
- package/dist/core/binary.js +363 -0
- package/dist/core/capabilities.d.ts +51 -0
- package/dist/core/capabilities.js +102 -0
- package/dist/core/client-state.d.ts +119 -0
- package/dist/core/client-state.js +226 -0
- package/dist/core/commit-authorization.d.ts +26 -0
- package/dist/core/commit-authorization.js +26 -0
- package/dist/core/components/admin-policy.d.ts +4 -0
- package/dist/core/components/admin-policy.js +69 -0
- package/dist/core/components/agent-text-stream.d.ts +51 -0
- package/dist/core/components/agent-text-stream.js +112 -0
- package/dist/core/components/app-components-list.d.ts +17 -0
- package/dist/core/components/app-components-list.js +35 -0
- package/dist/core/components/avatar-url.d.ts +12 -0
- package/dist/core/components/avatar-url.js +85 -0
- package/dist/core/components/bytes.d.ts +5 -0
- package/dist/core/components/bytes.js +18 -0
- package/dist/core/components/dictionary.d.ts +80 -0
- package/dist/core/components/dictionary.js +175 -0
- package/dist/core/components/disband-validation.d.ts +21 -0
- package/dist/core/components/disband-validation.js +173 -0
- package/dist/core/components/encrypted-media.d.ts +44 -0
- package/dist/core/components/encrypted-media.js +210 -0
- package/dist/core/components/group-lifecycle.d.ts +10 -0
- package/dist/core/components/group-lifecycle.js +32 -0
- package/dist/core/components/group-profile.d.ts +24 -0
- package/dist/core/components/group-profile.js +35 -0
- package/dist/core/components/host-safety.d.ts +9 -0
- package/dist/core/components/host-safety.js +148 -0
- package/dist/core/components/ids.d.ts +93 -0
- package/dist/core/components/ids.js +92 -0
- package/dist/core/components/index.d.ts +14 -0
- package/dist/core/components/index.js +14 -0
- package/dist/core/components/integrity.d.ts +141 -0
- package/dist/core/components/integrity.js +293 -0
- package/dist/core/components/message-retention.d.ts +17 -0
- package/dist/core/components/message-retention.js +26 -0
- package/dist/core/components/nostr-routing.d.ts +8 -0
- package/dist/core/components/nostr-routing.js +92 -0
- package/dist/core/components/url.d.ts +26 -0
- package/dist/core/components/url.js +44 -0
- package/dist/core/convergence-status.d.ts +84 -0
- package/dist/core/convergence-status.js +82 -0
- package/dist/core/convergence.d.ts +567 -0
- package/dist/core/convergence.js +1150 -0
- package/dist/core/credential.d.ts +16 -0
- package/dist/core/credential.js +64 -0
- package/dist/core/default-capabilities.d.ts +9 -0
- package/dist/core/default-capabilities.js +34 -0
- package/dist/core/extensions.d.ts +9 -0
- package/dist/core/extensions.js +5 -0
- package/dist/core/grease.d.ts +2 -0
- package/dist/core/grease.js +6 -0
- package/dist/core/group-event.d.ts +18 -0
- package/dist/core/group-event.js +30 -0
- package/dist/core/group-lifecycle.d.ts +42 -0
- package/dist/core/group-lifecycle.js +66 -0
- package/dist/core/group-members.d.ts +37 -0
- package/dist/core/group-members.js +99 -0
- package/dist/core/group-message-classify.d.ts +42 -0
- package/dist/core/group-message-classify.js +57 -0
- package/dist/core/group-message-crypto.d.ts +53 -0
- package/dist/core/group-message-crypto.js +140 -0
- package/dist/core/group-message.d.ts +5 -0
- package/dist/core/group-message.js +11 -0
- package/dist/core/group.d.ts +56 -0
- package/dist/core/group.js +95 -0
- package/dist/core/inbound.d.ts +102 -0
- package/dist/core/inbound.js +79 -0
- package/dist/core/index.d.ts +29 -0
- package/dist/core/index.js +27 -0
- package/dist/core/key-package-eligibility.d.ts +31 -0
- package/dist/core/key-package-eligibility.js +116 -0
- package/dist/core/key-package-event-decode.d.ts +43 -0
- package/dist/core/key-package-event-decode.js +118 -0
- package/dist/core/key-package-event-delete.d.ts +16 -0
- package/dist/core/key-package-event-delete.js +46 -0
- package/dist/core/key-package-event-encode.d.ts +28 -0
- package/dist/core/key-package-event-encode.js +117 -0
- package/dist/core/key-package-event.d.ts +4 -0
- package/dist/core/key-package-event.js +8 -0
- package/dist/core/key-package.d.ts +66 -0
- package/dist/core/key-package.js +147 -0
- package/dist/core/leaf-succession.d.ts +83 -0
- package/dist/core/leaf-succession.js +97 -0
- package/dist/core/media/canonical.d.ts +34 -0
- package/dist/core/media/canonical.js +57 -0
- package/dist/core/media/crypto.d.ts +79 -0
- package/dist/core/media/crypto.js +215 -0
- package/dist/core/media/imeta.d.ts +33 -0
- package/dist/core/media/imeta.js +188 -0
- package/dist/core/media/locator.d.ts +44 -0
- package/dist/core/media/locator.js +69 -0
- package/dist/core/media/types.d.ts +83 -0
- package/dist/core/media/types.js +12 -0
- package/dist/core/media.d.ts +6 -0
- package/dist/core/media.js +12 -0
- package/dist/core/protocol-profile.d.ts +262 -0
- package/dist/core/protocol-profile.js +535 -0
- package/dist/core/protocol.d.ts +51 -0
- package/dist/core/protocol.js +41 -0
- package/dist/core/relay-lists.d.ts +52 -0
- package/dist/core/relay-lists.js +86 -0
- package/dist/core/retained-history.d.ts +78 -0
- package/dist/core/retained-history.js +59 -0
- package/dist/core/transport.d.ts +43 -0
- package/dist/core/transport.js +21 -0
- package/dist/core/welcome-event.d.ts +61 -0
- package/dist/core/welcome-event.js +116 -0
- package/dist/core/welcome-join.d.ts +155 -0
- package/dist/core/welcome-join.js +243 -0
- package/dist/core/welcome.d.ts +3 -0
- package/dist/core/welcome.js +6 -0
- package/dist/engine/admin-policy.d.ts +75 -0
- package/dist/engine/admin-policy.js +137 -0
- package/dist/engine/auto-committer.d.ts +39 -0
- package/dist/engine/auto-committer.js +42 -0
- package/dist/engine/delivered-payloads.d.ts +61 -0
- package/dist/engine/delivered-payloads.js +84 -0
- package/dist/engine/disband-request.d.ts +41 -0
- package/dist/engine/disband-request.js +86 -0
- package/dist/engine/disband-tombstone.d.ts +14 -0
- package/dist/engine/disband-tombstone.js +66 -0
- package/dist/engine/fork-recovery.d.ts +672 -0
- package/dist/engine/fork-recovery.js +1615 -0
- package/dist/engine/group-engine.d.ts +571 -0
- package/dist/engine/group-engine.js +5134 -0
- package/dist/engine/history-tree.d.ts +232 -0
- package/dist/engine/history-tree.js +651 -0
- package/dist/engine/index.d.ts +16 -0
- package/dist/engine/index.js +15 -0
- package/dist/engine/ingest-disposition.d.ts +5 -0
- package/dist/engine/ingest-disposition.js +63 -0
- package/dist/engine/ingest.d.ts +390 -0
- package/dist/engine/ingest.js +1258 -0
- package/dist/engine/ingestion-pool.d.ts +74 -0
- package/dist/engine/ingestion-pool.js +95 -0
- package/dist/engine/message-dedup.d.ts +16 -0
- package/dist/engine/message-dedup.js +20 -0
- package/dist/engine/own-commit-stamp.d.ts +30 -0
- package/dist/engine/own-commit-stamp.js +71 -0
- package/dist/engine/retained-store.d.ts +79 -0
- package/dist/engine/retained-store.js +133 -0
- package/dist/engine/sender-ratchet.d.ts +50 -0
- package/dist/engine/sender-ratchet.js +196 -0
- package/dist/engine/state-notifications.d.ts +122 -0
- package/dist/engine/state-notifications.js +173 -0
- package/dist/engine/tree-convergence.d.ts +41 -0
- package/dist/engine/tree-convergence.js +90 -0
- package/dist/engine/types.d.ts +366 -0
- package/dist/engine/types.js +14 -0
- package/dist/engine/wire-format.d.ts +77 -0
- package/dist/engine/wire-format.js +120 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1 -0
- package/dist/mls.d.ts +11 -0
- package/dist/mls.js +11 -0
- package/dist/utils/debug.d.ts +3 -0
- package/dist/utils/debug.js +3 -0
- package/dist/utils/encoding.d.ts +38 -0
- package/dist/utils/encoding.js +91 -0
- package/dist/utils/key-value.d.ts +18 -0
- package/dist/utils/key-value.js +2 -0
- package/dist/utils/nostr.d.ts +35 -0
- package/dist/utils/nostr.js +26 -0
- package/dist/utils/relay-url.d.ts +10 -0
- package/dist/utils/relay-url.js +23 -0
- package/dist/utils/tag-cardinality.d.ts +50 -0
- package/dist/utils/tag-cardinality.js +91 -0
- package/dist/utils/timestamp.d.ts +50 -0
- package/dist/utils/timestamp.js +95 -0
- package/dist/version.d.ts +112 -0
- package/dist/version.js +112 -0
- package/package.json +68 -3
package/dist/version.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @category Build identity
|
|
3
|
+
*
|
|
4
|
+
* Locally authored (not vendored from marmot-ts; listed in VENDOR.md's
|
|
5
|
+
* "Locally authored (not vendored)" section). The constants identify the
|
|
6
|
+
* engine build that wrote a stored artifact: `@941design/marmot`'s storage
|
|
7
|
+
* envelope (ADR-007 §3, epic-marmot-client AC-STORE-2) stamps
|
|
8
|
+
* `ENGINE_VERSION` and `TS_MLS_PIN` on every write and refuses any envelope
|
|
9
|
+
* whose stamp differs.
|
|
10
|
+
*
|
|
11
|
+
* `ENGINE_VERSION` is the compared stamp: `state.<ENGINE_STATE_FORMAT>`, a
|
|
12
|
+
* hand-maintained state-format number (BACKLOG
|
|
13
|
+
* `engine-version-digest-overtriggers`, 2026-11-09). It must change whenever
|
|
14
|
+
* an engine change could make a stored artifact read differently: a
|
|
15
|
+
* serialized format, a selection/convergence rule whose decisions marmot
|
|
16
|
+
* persists (rewind tree, terminal ledger, held set, own-commit stamps), or a
|
|
17
|
+
* decoder of stored bytes. It need not change for an edit that touches none of
|
|
18
|
+
* these (a comment, a new read-only accessor), so such an edit no longer
|
|
19
|
+
* refuses every existing store.
|
|
20
|
+
*
|
|
21
|
+
* The decision is forced, not optional: the digests below still identify the
|
|
22
|
+
* engine code, and `state-format-ledger.json` (package root) records, per
|
|
23
|
+
* digest pair, the state format it was judged to be. Its last entry must
|
|
24
|
+
* match the digests on disk (`packages/marmot/test/engine-version.test.ts`),
|
|
25
|
+
* so every code change makes the author either bump `ENGINE_STATE_FORMAT` or
|
|
26
|
+
* append a same-format entry whose `note` says why nothing stored reads
|
|
27
|
+
* differently. When in doubt, bump. `ENGINE_BUILD` keeps the full code
|
|
28
|
+
* identity for diagnostics.
|
|
29
|
+
*
|
|
30
|
+
* The digests change whenever the engine code changes. The vendored source is
|
|
31
|
+
* upstream `marmot-ts` at the VENDOR.md pin plus `patches/*.diff`; the
|
|
32
|
+
* locally-authored (never-vendored) source is VENDOR.md's "Locally
|
|
33
|
+
* authored (not vendored)" list. `ENGINE_BUILD` folds in all three: the
|
|
34
|
+
* package version, `PATCHSET_DIGEST` (the vendored+patched side), and
|
|
35
|
+
* `LOCAL_SOURCE_DIGEST` (the locally-authored side). Changes that must
|
|
36
|
+
* update this file (and, for a digest, the ledger):
|
|
37
|
+
* - a package.json `version` bump → `ENGINE_PACKAGE_VERSION`;
|
|
38
|
+
* - any added, removed, renamed or edited `patches/*.diff` that touches a
|
|
39
|
+
* non-test engine source file, or a move of the marmot-ts pin in
|
|
40
|
+
* VENDOR.md → `PATCHSET_DIGEST`;
|
|
41
|
+
* - an edit to a non-test file in VENDOR.md's "Locally authored (not
|
|
42
|
+
* vendored)" list (other than this file itself — see below) →
|
|
43
|
+
* `LOCAL_SOURCE_DIGEST`;
|
|
44
|
+
* - a move of the `ts-mls` git+SHA pin → `TS_MLS_PIN` (compared separately).
|
|
45
|
+
*
|
|
46
|
+
* A patch is test-only — and excluded from `PATCHSET_DIGEST` — when every
|
|
47
|
+
* file it touches sits under a `__tests__/` directory: a `*.test.ts` spec, a
|
|
48
|
+
* test-only helper, or a test fixture. A file's target path is read from
|
|
49
|
+
* every `---`/`+++` header (so deletions count) AND every `rename from`/
|
|
50
|
+
* `rename to`/`copy from`/`copy to` header — a pure rename or copy carries
|
|
51
|
+
* no `---`/`+++` lines of its own, so a patch that combines a pure rename of
|
|
52
|
+
* a production file with a genuinely test-only hunk would otherwise be
|
|
53
|
+
* misclassified as test-only by the `---`/`+++` paths alone. Such a patch
|
|
54
|
+
* can never change the shape of state the engine serializes, so folding it
|
|
55
|
+
* into the stamp would force spurious envelope-mismatch churn on stored
|
|
56
|
+
* artifacts whenever a test or conformance/flake patch is touched. A patch
|
|
57
|
+
* that touches even one non-test file (source under `core/`, `engine/`,
|
|
58
|
+
* `audit/`, `utils/`, `index.ts`, `mls.ts`, …) is hashed in full, in the
|
|
59
|
+
* order below.
|
|
60
|
+
*
|
|
61
|
+
* `LOCAL_SOURCE_DIGEST` covers the other half of locally-authored source
|
|
62
|
+
* that `PATCHSET_DIGEST` cannot see: files in VENDOR.md's "Locally authored
|
|
63
|
+
* (not vendored)" list have no `patches/*.diff` entry (they were never
|
|
64
|
+
* vendored, so there is nothing to diff against upstream), so an edit to
|
|
65
|
+
* one is otherwise invisible to the stamp. It is a digest over every listed
|
|
66
|
+
* path that is (a) not itself under a `__tests__/` directory and (b) not
|
|
67
|
+
* this file (`src/version.ts` folding itself in would be circular — a
|
|
68
|
+
* change to this file already bumps `ENGINE_VERSION` directly, since the
|
|
69
|
+
* literals live here). Today the one such path is `src/core/leaf-succession.ts`
|
|
70
|
+
* (every other listed path is a test path), so the digest covers that file;
|
|
71
|
+
* it closes the gap for each non-test locally-authored file added to that
|
|
72
|
+
* list, without a second remediation round.
|
|
73
|
+
*
|
|
74
|
+
* Literals rather than a runtime read so the value is fixed at build time and
|
|
75
|
+
* needs no JSON or fs import. `packages/marmot/test/engine-version.test.ts`
|
|
76
|
+
* recomputes each from disk and fails — printing the expected value — when
|
|
77
|
+
* any drifts, so a patch or locally-authored-source change cannot ship with
|
|
78
|
+
* a stale stamp.
|
|
79
|
+
*/
|
|
80
|
+
/** `@941design/marmot-engine` package version. */
|
|
81
|
+
export const ENGINE_PACKAGE_VERSION = "0.2.0-alpha.1";
|
|
82
|
+
/**
|
|
83
|
+
* First 16 hex chars of SHA-256 over `marmot-ts@<pin SHA>\n` followed by,
|
|
84
|
+
* for each non-test `patches/*.diff` (a patch excluded only when every one
|
|
85
|
+
* of its diff's `---`/`+++`/`rename from`/`rename to`/`copy from`/`copy to`
|
|
86
|
+
* paths sits under a `__tests__/` directory) in code-unit order,
|
|
87
|
+
* `<file name>\n<byte length>\n<bytes>`.
|
|
88
|
+
*
|
|
89
|
+
* Blind spot: it hashes the patch files, not the vendored tree, so a direct
|
|
90
|
+
* edit to a vendored file (bypassing `patches/`) or a new production file not
|
|
91
|
+
* listed as locally authored moves neither digest. `scripts/vendor/verify.sh`'s
|
|
92
|
+
* full re-derivation is the authoritative guard for that.
|
|
93
|
+
*/
|
|
94
|
+
export const PATCHSET_DIGEST = "e5ef81e07ff92b85";
|
|
95
|
+
/**
|
|
96
|
+
* First 16 hex chars of SHA-256 over `local-source\n` followed by, for each
|
|
97
|
+
* non-test, non-`src/version.ts` path in VENDOR.md's "Locally authored (not
|
|
98
|
+
* vendored)" list, in code-unit order, `<path>\n<byte length>\n<bytes>`.
|
|
99
|
+
*/
|
|
100
|
+
export const LOCAL_SOURCE_DIGEST = "ed610401e629ac7c";
|
|
101
|
+
/**
|
|
102
|
+
* The engine's stored-state format. Bump it for any change that could make a
|
|
103
|
+
* stored artifact read differently (see the module doc); record each digest
|
|
104
|
+
* move in `state-format-ledger.json` either way.
|
|
105
|
+
*/
|
|
106
|
+
export const ENGINE_STATE_FORMAT = 1;
|
|
107
|
+
/** The envelope's engine stamp (compared on every read): the state format. */
|
|
108
|
+
export const ENGINE_VERSION = `state.${ENGINE_STATE_FORMAT}`;
|
|
109
|
+
/** The engine build's full code identity (diagnostics): package version plus the vendored patch set and the locally-authored source. */
|
|
110
|
+
export const ENGINE_BUILD = `${ENGINE_PACKAGE_VERSION}+patches.${PATCHSET_DIGEST}.local.${LOCAL_SOURCE_DIGEST}`;
|
|
111
|
+
/** Commit SHA of the `941design/ts-mls` pin recorded in VENDOR.md (consumed via the `@941design/ts-mls` registry alias). */
|
|
112
|
+
export const TS_MLS_PIN = "26afb1d69fd4c5a613b8319610a69e4f4239e5b5";
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@941design/marmot-engine",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0-alpha.1",
|
|
4
|
+
"description": "MLS convergence engine for Marmot groups, vendored from marmot-ts (https://github.com/marmot-protocol/marmot-ts) at commit 50192e117e986d894c16ea1f8922600dc33a0db3 and ported to the ts-mls API. Re-exports the pinned ts-mls surface at ./mls.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/941design/nostr-events.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/941design/nostr-events#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/941design/nostr-events/issues"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"CHANGELOG.md"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
"./core": {
|
|
23
|
+
"types": "./dist/core/index.d.ts",
|
|
24
|
+
"import": "./dist/core/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./engine": {
|
|
27
|
+
"types": "./dist/engine/index.d.ts",
|
|
28
|
+
"import": "./dist/engine/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./audit": {
|
|
31
|
+
"types": "./dist/audit/index.d.ts",
|
|
32
|
+
"import": "./dist/audit/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./mls": {
|
|
35
|
+
"types": "./dist/mls.d.ts",
|
|
36
|
+
"import": "./dist/mls.js"
|
|
37
|
+
},
|
|
38
|
+
"./version": {
|
|
39
|
+
"types": "./dist/version.d.ts",
|
|
40
|
+
"import": "./dist/version.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@noble/ciphers": "^2.2.0",
|
|
45
|
+
"@noble/curves": "^2.2.0",
|
|
46
|
+
"@noble/hashes": "^2.2.0",
|
|
47
|
+
"@scure/base": "^2.2.0",
|
|
48
|
+
"debug": "^4.4.3",
|
|
49
|
+
"nostr-tools": "2.23.3",
|
|
50
|
+
"ts-mls": "npm:@941design/ts-mls@2.0.0-rc.16-941design.1"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@stryker-mutator/core": "^9.6.1",
|
|
54
|
+
"@stryker-mutator/vitest-runner": "^9.6.1",
|
|
55
|
+
"@types/debug": "^4.1.13",
|
|
56
|
+
"@types/node": "^25.6.0",
|
|
57
|
+
"fast-check": "3.23.2",
|
|
58
|
+
"typescript": "5.7.3",
|
|
59
|
+
"vitest": "2.1.8"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
66
|
+
"build": "pnpm run clean && tsc --project tsconfig.build.json",
|
|
67
|
+
"typecheck": "tsc --noEmit",
|
|
68
|
+
"test": "vitest run",
|
|
69
|
+
"mutation": "stryker run"
|
|
70
|
+
}
|
|
6
71
|
}
|