@dreamforgestudiollc/emet 0.3.5 → 0.3.7
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/.env.example +29 -0
- package/CHANGELOG.md +49 -11
- package/CHARTER.md +1 -1
- package/CONTRIBUTING.md +21 -0
- package/README.md +25 -10
- package/RELEASE_NOTES-0.2.6.md +43 -0
- package/RELEASE_NOTES-0.3.6.md +29 -0
- package/RELEASE_NOTES-0.3.7.md +19 -0
- package/SECURITY.md +13 -0
- package/docs/BOTS.md +4 -4
- package/docs/DEPLOY.md +23 -4
- package/docs/ERROR-CODES-SPEC.md +4 -0
- package/docs/ERROR-CODES.md +7 -0
- package/docs/GUIDED-SETUP.md +1 -1
- package/docs/ROADMAP.md +62 -49
- package/docs/SETUP.md +11 -1
- package/docs/SUBKEYS.md +3 -1
- package/docs/continuity-currency-statechart.md +34 -0
- package/docs/features/README.md +21 -0
- package/docs/features/access.md +28 -0
- package/docs/features/documents.md +35 -0
- package/docs/features/errors.md +32 -0
- package/docs/features/gems.md +31 -0
- package/docs/features/memory.md +29 -0
- package/docs/features/pages.md +28 -0
- package/docs/features/record.md +27 -0
- package/docs/features/search.md +27 -0
- package/docs/features/startup.md +29 -0
- package/docs/features/subkeys.md +30 -0
- package/docs/features/transcripts.md +33 -0
- package/docs/per-tag-handoff-statechart.md +147 -0
- package/docs/subkey-session-statechart.md +57 -0
- package/package.json +6 -2
- package/server.json +27 -2
- package/src/annotations.js +5 -3
- package/src/attribution.js +2 -2
- package/src/carry-forward-close.js +1 -1
- package/src/chooser.js +74 -3
- package/src/conformance.js +2 -0
- package/src/continuity-currency-statechart.js +139 -0
- package/src/continuity-currency.js +869 -0
- package/src/database.js +1 -1
- package/src/dispatch.js +1 -1
- package/src/error-codes.js +7 -0
- package/src/gem-check.js +4 -1
- package/src/grants.js +28 -5
- package/src/host-reach.js +1 -1
- package/src/http-remote.js +29 -5
- package/src/index.js +3 -2
- package/src/invites.js +2 -2
- package/src/owl.js +12 -11
- package/src/pages.js +15 -0
- package/src/per-tag-handoff-statechart.js +264 -0
- package/src/per-tag-handoff.js +988 -0
- package/src/persons.js +16 -0
- package/src/session-graph.js +123 -12
- package/src/session.js +56 -12
- package/src/setup.js +32 -11
- package/src/startup-pages.js +13 -2
- package/src/subkey-lifecycle.js +105 -0
- package/src/subkey-session-statechart.js +253 -0
- package/src/subkeys.js +648 -89
- package/src/tools.js +171 -51
- package/src/transcript-session.js +2 -2
- package/src/version.js +1 -1
- package/templates/INDEX.md +1 -0
- package/templates/SESSIONDISPOSITION.md +2 -2
- package/templates/TAGHANDOFF.md +45 -0
- package/verification/continuity-currency/ContinuityCurrency.cfg +12 -0
- package/verification/continuity-currency/ContinuityCurrency.tla +239 -0
- package/verification/continuity-currency/tlc-output.txt +32 -0
- package/verification/continuity-currency/view.mjs +54 -0
- package/verification/load-gate/load-gate.mjs +1 -1
- package/verification/per-tag-handoff/PerTagHandoff.cfg +10 -0
- package/verification/per-tag-handoff/PerTagHandoff.tla +191 -0
- package/verification/per-tag-handoff/StampCounter.cfg +10 -0
- package/verification/per-tag-handoff/out/report.md +6 -0
- package/verification/per-tag-handoff/out-counter/chart.mmd +30 -0
- package/verification/per-tag-handoff/out-counter/report.md +15 -0
- package/verification/per-tag-handoff/out-counter/tlc.out +130 -0
- package/verification/per-tag-handoff/split/PerTagConflict.cfg +6 -0
- package/verification/per-tag-handoff/split/PerTagConflict.tla +104 -0
- package/verification/per-tag-handoff/split/PerTagTime.cfg +8 -0
- package/verification/per-tag-handoff/split/PerTagTime.tla +100 -0
- package/verification/per-tag-handoff/split/conflict-chart.mmd +47 -0
- package/verification/per-tag-handoff/split/conflict-report.md +8 -0
- package/verification/per-tag-handoff/split/conflict-tlc.txt +19 -0
- package/verification/per-tag-handoff/split/conflict-view.mjs +34 -0
- package/verification/per-tag-handoff/split/time-chart.mmd +44 -0
- package/verification/per-tag-handoff/split/time-report.md +8 -0
- package/verification/per-tag-handoff/split/time-tlc.txt +19 -0
- package/verification/per-tag-handoff/split/time-view.mjs +33 -0
- package/verification/per-tag-handoff/tlc-output.txt +19 -0
- package/verification/per-tag-handoff/v1-draft/PerTagHandoff.cfg +5 -0
- package/verification/per-tag-handoff/v1-draft/PerTagHandoff.tla +94 -0
- package/verification/per-tag-handoff/v1-draft/out/chart.mmd +37 -0
- package/verification/per-tag-handoff/v1-draft/out/report.md +7 -0
- package/verification/per-tag-handoff/v1-draft/out/tlc.out +19 -0
- package/verification/per-tag-handoff/v1-draft/view.mjs +20 -0
- package/verification/per-tag-handoff/view.mjs +31 -0
- package/verification/subkey-session/SubkeySession.cfg +11 -0
- package/verification/subkey-session/SubkeySession.tla +254 -0
- package/verification/subkey-session/tlc-output.txt +13 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EMET - Enduring Memory & Epistemic Tiers
|
|
3
|
+
* Copyright (c) 2026 Dreamforge Studio LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the MIT License - see LICENSE
|
|
6
|
+
*
|
|
7
|
+
* Continuity-currency (tip-lag) statechart. Warn, current, documented
|
|
8
|
+
* no-op, no handoff, unreadable, or fallback-only. The gate does not rewrite
|
|
9
|
+
* HANDOFF or STATE and does not block. This is not the wiki page-currency
|
|
10
|
+
* diagram. Served on /statechart. The same picture is
|
|
11
|
+
* docs/continuity-currency-statechart.md. The model is
|
|
12
|
+
* verification/continuity-currency/ContinuityCurrency.tla. It does not
|
|
13
|
+
* enumerate episodic ids.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export const CONTINUITY_CURRENCY_MERMAID = `stateDiagram-v2
|
|
17
|
+
[*] --> GateOff
|
|
18
|
+
GateOff --> GateOff: warn flag stays off
|
|
19
|
+
GateOff --> Comparing: warn flag on
|
|
20
|
+
Comparing --> Current: handoff cites the live material tip
|
|
21
|
+
Comparing --> DocumentedNoOp: documented no-op, no newer material tip
|
|
22
|
+
Comparing --> Current: newer episodic is scratch or diagnosis only
|
|
23
|
+
Comparing --> Current: version number alone
|
|
24
|
+
Comparing --> Warning: material tip is newer
|
|
25
|
+
Comparing --> FallbackOnly: only a fallback tip is newer
|
|
26
|
+
Comparing --> NoHandoff: no handoff to compare
|
|
27
|
+
Comparing --> Unreadable: the comparison could not be read
|
|
28
|
+
Warning --> BlockHeld: block asked, still does not block
|
|
29
|
+
FallbackOnly --> FallbackHeld: block asked, still does not block
|
|
30
|
+
Warning --> Comparing: the next initialize compares again
|
|
31
|
+
Current --> Comparing: the next initialize compares again
|
|
32
|
+
DocumentedNoOp --> Comparing: the next initialize compares again
|
|
33
|
+
BlockHeld --> Comparing: the next initialize compares again
|
|
34
|
+
FallbackOnly --> Comparing: the next initialize compares again
|
|
35
|
+
FallbackHeld --> Comparing: the next initialize compares again
|
|
36
|
+
NoHandoff --> Comparing: the next initialize compares again
|
|
37
|
+
Unreadable --> Comparing: the next initialize compares again`;
|
|
38
|
+
|
|
39
|
+
export const CONTINUITY_CURRENCY_STEPS = Object.freeze([
|
|
40
|
+
'The warn flag starts off. Initialize serves HANDOFF as it does today and shows no continuity-currency warning.',
|
|
41
|
+
'With the warn flag on, initialize compares the served HANDOFF to the live material episodic tip. The comparison does not write.',
|
|
42
|
+
'A handoff that cites the live material tip is current. A newer scratch or diagnosis-only episodic does not warn. A version number alone does not warn.',
|
|
43
|
+
'A documented no-op has no newer material tip. The handoff version may stay where it is. That is not a warning.',
|
|
44
|
+
'When the material tip is newer, initialize returns a warning with the lag. The call is not blocked.',
|
|
45
|
+
'A fallback-only tip is a warning and is not block-eligible. Asking for the phase-2 block still does not block.',
|
|
46
|
+
'No handoff, or a comparison that could not be read, shows that status and does not warn. Nothing is written.',
|
|
47
|
+
'Asking for the phase-2 block leaves the warning in place and still does not block. HANDOFF and STATE stay untouched. The host rewrites HANDOFF whole.'
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
const PHASES = new Set([
|
|
51
|
+
'GateOff', 'Comparing', 'Current', 'DocumentedNoOp', 'Warning', 'BlockHeld',
|
|
52
|
+
'NoHandoff', 'Unreadable', 'FallbackOnly', 'FallbackHeld'
|
|
53
|
+
]);
|
|
54
|
+
const COMPARE_AGAIN = new Set([
|
|
55
|
+
'Current', 'DocumentedNoOp', 'Warning', 'BlockHeld',
|
|
56
|
+
'NoHandoff', 'Unreadable', 'FallbackOnly', 'FallbackHeld'
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
function blank(state, extra = {}) {
|
|
60
|
+
return {
|
|
61
|
+
phase: state.phase,
|
|
62
|
+
flag: state.flag,
|
|
63
|
+
newer: state.newer,
|
|
64
|
+
claim: state.claim,
|
|
65
|
+
blockEligible: false,
|
|
66
|
+
handoffMutated: false,
|
|
67
|
+
blocked: false,
|
|
68
|
+
warning: false,
|
|
69
|
+
...extra,
|
|
70
|
+
handoffMutated: false,
|
|
71
|
+
blocked: false
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* One step of the diagram. An event that cannot happen in this phase returns
|
|
77
|
+
* null. `handoffMutated` and `blocked` stay false on every step.
|
|
78
|
+
*/
|
|
79
|
+
export function continuityCurrencyStep(state, event) {
|
|
80
|
+
if (!state || !PHASES.has(state.phase)) return null;
|
|
81
|
+
if (!event || typeof event.type !== 'string') return null;
|
|
82
|
+
if (event.type === 'flag_off') {
|
|
83
|
+
if (state.flag !== 'off' || state.phase !== 'GateOff') return null;
|
|
84
|
+
return blank(state, { phase: 'GateOff', warning: false });
|
|
85
|
+
}
|
|
86
|
+
if (event.type === 'enable') {
|
|
87
|
+
if (state.flag !== 'off' || state.phase !== 'GateOff') return null;
|
|
88
|
+
return blank(state, { phase: 'Comparing', flag: 'warn', warning: false });
|
|
89
|
+
}
|
|
90
|
+
if (event.type === 'cite_tip' || event.type === 'scratch' || event.type === 'version_only' || event.type === 'no_op' || event.type === 'material_lag' || event.type === 'fallback_only' || event.type === 'no_handoff' || event.type === 'unreadable') {
|
|
91
|
+
if (state.flag !== 'warn' || state.phase !== 'Comparing') return null;
|
|
92
|
+
if (event.type === 'cite_tip') return blank(state, { phase: 'Current', newer: 'none', claim: 'at_tip' });
|
|
93
|
+
if (event.type === 'scratch') return blank(state, { phase: 'Current', newer: 'scratch', claim: 'at_tip' });
|
|
94
|
+
if (event.type === 'version_only') return blank(state, { phase: 'Current', newer: 'material', claim: 'version_only' });
|
|
95
|
+
if (event.type === 'no_op') return blank(state, { phase: 'DocumentedNoOp', newer: 'none', claim: 'at_tip' });
|
|
96
|
+
if (event.type === 'no_handoff') return blank(state, { phase: 'NoHandoff', newer: 'none', claim: 'at_tip' });
|
|
97
|
+
if (event.type === 'unreadable') return blank(state, { phase: 'Unreadable', newer: 'none', claim: 'at_tip' });
|
|
98
|
+
if (event.type === 'fallback_only') {
|
|
99
|
+
return blank(state, { phase: 'FallbackOnly', newer: 'fallback', claim: 'behind', warning: true, blockEligible: false });
|
|
100
|
+
}
|
|
101
|
+
return blank(state, { phase: 'Warning', newer: 'material', claim: 'behind', warning: true, blockEligible: true });
|
|
102
|
+
}
|
|
103
|
+
if (event.type === 'ask_block') {
|
|
104
|
+
if (state.phase === 'Warning') {
|
|
105
|
+
return blank(state, { phase: 'BlockHeld', newer: 'material', claim: 'behind', warning: true, blockEligible: true });
|
|
106
|
+
}
|
|
107
|
+
if (state.phase === 'FallbackOnly') {
|
|
108
|
+
return blank(state, { phase: 'FallbackHeld', newer: 'fallback', claim: 'behind', warning: true, blockEligible: false });
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
if (event.type === 'initialize_again') {
|
|
113
|
+
if (state.flag !== 'warn' || !COMPARE_AGAIN.has(state.phase)) return null;
|
|
114
|
+
return blank(state, { phase: 'Comparing', warning: false, blockEligible: false });
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** The rules the diagram states. A rewrite or a block breaks the invariant. */
|
|
120
|
+
export function continuityCurrencyInvariant(state) {
|
|
121
|
+
if (!state || state.handoffMutated !== false) return false;
|
|
122
|
+
if (state.blocked !== false) return false;
|
|
123
|
+
if (state.flag === 'off' && (state.phase !== 'GateOff' || state.warning !== false)) return false;
|
|
124
|
+
if (state.warning === true) {
|
|
125
|
+
const material = (state.phase === 'Warning' || state.phase === 'BlockHeld')
|
|
126
|
+
&& state.newer === 'material' && state.claim === 'behind' && state.blockEligible === true;
|
|
127
|
+
const fallback = (state.phase === 'FallbackOnly' || state.phase === 'FallbackHeld')
|
|
128
|
+
&& state.newer === 'fallback' && state.claim === 'behind' && state.blockEligible !== true;
|
|
129
|
+
if (!material && !fallback) return false;
|
|
130
|
+
}
|
|
131
|
+
if (state.phase === 'DocumentedNoOp' && state.warning !== false) return false;
|
|
132
|
+
if (state.phase === 'NoHandoff' && state.warning !== false) return false;
|
|
133
|
+
if (state.phase === 'Unreadable' && state.warning !== false) return false;
|
|
134
|
+
if (state.newer === 'scratch' && state.warning !== false) return false;
|
|
135
|
+
if (state.newer === 'fallback' && (state.blocked !== false || state.blockEligible === true)) return false;
|
|
136
|
+
if (state.claim === 'version_only' && state.warning !== false) return false;
|
|
137
|
+
if ((state.phase === 'Warning' || state.phase === 'BlockHeld' || state.phase === 'FallbackOnly' || state.phase === 'FallbackHeld') && state.blocked !== false) return false;
|
|
138
|
+
return true;
|
|
139
|
+
}
|