@dreamforgestudiollc/emet 0.0.0-stage → 0.2.6
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 +189 -0
- package/CHANGELOG.md +360 -0
- package/CHARTER.md +137 -0
- package/LICENSE +22 -0
- package/README.md +868 -2
- package/docs/AUTHORSHIP.md +26 -0
- package/docs/BENCHMARKS.md +261 -0
- package/docs/BOOTSTRAP.md +127 -0
- package/docs/BOTS.md +83 -0
- package/docs/COVERAGE.md +64 -0
- package/docs/DEPLOY.md +251 -0
- package/docs/DISCIPLINES.md +29 -0
- package/docs/GUARDRAILS-AND-MONORAILS.md +108 -0
- package/docs/GUIDED-SETUP.md +301 -0
- package/docs/PERMISSIONS.md +121 -0
- package/docs/ROADMAP.md +62 -0
- package/docs/SETUP.md +265 -0
- package/docs/SUBKEYS.md +59 -0
- package/gems/artifact-index.json +12 -0
- package/gems/bot-team-backup/floor.json +15 -0
- package/gems/bot-team-backup/gem.json +43 -0
- package/gems/bot-team-backup/guides/BOT_TEAM_BACKUP.md +27 -0
- package/gems/bot-team-backup/guides/BOT_TEAM_RECOVERY.md +23 -0
- package/gems/fieldnote/floor.json +14 -0
- package/gems/fieldnote/gem.json +70 -0
- package/gems/fieldnote/runes/fieldnote.js +4 -0
- package/gems/lean-six-sigma/CHANGELOG.md +10 -0
- package/gems/lean-six-sigma/README.md +92 -0
- package/gems/lean-six-sigma/floor.json +31 -0
- package/gems/lean-six-sigma/gem.json +1296 -0
- package/gems/lean-six-sigma/guides/ASSUMPTIONS.md +45 -0
- package/gems/lean-six-sigma/guides/BELTS.md +52 -0
- package/gems/lean-six-sigma/guides/DMADV.md +56 -0
- package/gems/lean-six-sigma/guides/DMAIC.md +127 -0
- package/gems/lean-six-sigma/guides/FORMULAS.md +330 -0
- package/gems/lean-six-sigma/guides/LEAN.md +97 -0
- package/gems/lean-six-sigma/guides/TEMPLATES.md +279 -0
- package/gems/lean-six-sigma/runes/lss_capability.js +132 -0
- package/gems/lean-six-sigma/runes/lss_control_limits.js +240 -0
- package/gems/lean-six-sigma/runes/lss_dpmo_sigma.js +81 -0
- package/gems/lean-six-sigma/runes/lss_hypothesis.js +298 -0
- package/gems/lean-six-sigma/runes/lss_sample_size.js +81 -0
- package/gems/neurendipity/floor.json +65 -0
- package/gems/neurendipity/gem.json +42 -0
- package/gems/neurendipity/guides/AUTISTIC_BURNOUT.md +81 -0
- package/gems/neurendipity/guides/NEURODIVERGENT_SUPPORT.md +287 -0
- package/guides/README.md +3 -0
- package/package.json +76 -4
- package/server.json +79 -0
- package/src/aleph.js +395 -0
- package/src/annotations.js +170 -0
- package/src/approve-throttle.js +54 -0
- package/src/atlas-role.js +58 -0
- package/src/attribution.js +555 -0
- package/src/conformance.js +688 -0
- package/src/content_analyzer.js +450 -0
- package/src/database.js +812 -0
- package/src/disciplines.js +26 -0
- package/src/dispatch.js +382 -0
- package/src/env.js +97 -0
- package/src/floor.js +228 -0
- package/src/gaps.js +509 -0
- package/src/gem-check.js +1359 -0
- package/src/guides.js +75 -0
- package/src/host-reach.js +23 -0
- package/src/http-remote.js +313 -0
- package/src/index.js +397 -0
- package/src/invites.js +167 -0
- package/src/layers.js +449 -0
- package/src/lessons-to-checks.js +366 -0
- package/src/logger.js +300 -0
- package/src/metadata.js +61 -0
- package/src/module-path.js +32 -0
- package/src/mongo-connect.js +91 -0
- package/src/named-items.js +208 -0
- package/src/oauth-provider.js +838 -0
- package/src/owner-approvals.js +281 -0
- package/src/persons.js +136 -0
- package/src/provenance.js +257 -0
- package/src/redact.js +237 -0
- package/src/request-log.js +124 -0
- package/src/rune-dispatch.js +360 -0
- package/src/rune-registry.js +71 -0
- package/src/rune-scope.js +42 -0
- package/src/scopes.js +100 -0
- package/src/security-headers.js +26 -0
- package/src/session-graph.js +947 -0
- package/src/session.js +1097 -0
- package/src/setup.js +1580 -0
- package/src/socket.js +545 -0
- package/src/startup-pages.js +371 -0
- package/src/startup-payload.js +129 -0
- package/src/subkey-store.js +357 -0
- package/src/subkeys.js +947 -0
- package/src/tools.js +4508 -0
- package/src/transcript-session.js +106 -0
- package/src/validation.js +1187 -0
- package/src/version.js +2 -0
- package/templates/BOARD.md +72 -0
- package/templates/BOTHANDOFF.md +57 -0
- package/templates/CHARACTER.md +30 -0
- package/templates/HANDOFF.md +63 -0
- package/templates/IDENTITY.md +29 -0
- package/templates/INDEX.md +82 -0
- package/templates/INSTALL.md +29 -0
- package/templates/PROCEDURE.md +39 -0
- package/templates/ROSTER.md +43 -0
- package/templates/SEED.md +65 -0
- package/templates/STAGING.md +37 -0
- package/templates/STANDARD.md +99 -0
- package/templates/THREAD.md +43 -0
- package/templates/USER.md +32 -0
- package/verification/load-gate/corpus.json +1765 -0
- package/verification/load-gate/load-gate.mjs +1246 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/** Session transcript: one exchange at a time. No end-of-day dump. */
|
|
2
|
+
|
|
3
|
+
import { setting } from './env.js';
|
|
4
|
+
|
|
5
|
+
export const EXCHANGES_PER_PART = 8;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The zone a session id is dated in (2026-10-01, the owner's approval; dev team plan
|
|
9
|
+
* Part B, fix 1). Ids were dated from UTC, so an evening session in New York
|
|
10
|
+
* carried the next day's date (episodic ref 600: `2026-10-01_grok-init` minted on
|
|
11
|
+
* the night of 9/30). The day is now the user's local day: EMET_TIMEZONE, an
|
|
12
|
+
* IANA zone name, default America/New_York. A name the runtime does not know
|
|
13
|
+
* falls back to the default and says so - marked, never guessed at.
|
|
14
|
+
*/
|
|
15
|
+
export const DEFAULT_TIME_ZONE = 'America/New_York';
|
|
16
|
+
|
|
17
|
+
export function sessionTimeZone(raw = setting('TIMEZONE')) {
|
|
18
|
+
const wanted = typeof raw === 'string' ? raw.trim() : '';
|
|
19
|
+
if (!wanted) return { zone: DEFAULT_TIME_ZONE, note: null };
|
|
20
|
+
try {
|
|
21
|
+
new Intl.DateTimeFormat('en-US', { timeZone: wanted });
|
|
22
|
+
return { zone: wanted, note: null };
|
|
23
|
+
} catch {
|
|
24
|
+
return {
|
|
25
|
+
zone: DEFAULT_TIME_ZONE,
|
|
26
|
+
note: `EMET_TIMEZONE "${wanted}" is not a time zone this server knows; session ids are dated in ${DEFAULT_TIME_ZONE}.`
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The calendar day of `date` in `timeZone`, as YYYY-MM-DD. */
|
|
32
|
+
export function localDate(date = new Date(), timeZone = DEFAULT_TIME_ZONE) {
|
|
33
|
+
const parts = new Intl.DateTimeFormat('en-US', {
|
|
34
|
+
timeZone, year: 'numeric', month: '2-digit', day: '2-digit'
|
|
35
|
+
}).formatToParts(date);
|
|
36
|
+
const get = (type) => parts.find((p) => p.type === type).value;
|
|
37
|
+
return `${get('year')}-${get('month')}-${get('day')}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function sessionBaseId(date = new Date(), slug = 'session', timeZone = sessionTimeZone().zone) {
|
|
41
|
+
const day = localDate(date, timeZone);
|
|
42
|
+
const clean = String(slug || 'session').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 40) || 'session';
|
|
43
|
+
return `${day}_${clean}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function partId(base, n) {
|
|
47
|
+
return `${base}_verbatim_part${n}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function partNumber(session_id) {
|
|
51
|
+
const m = String(session_id || '').match(/_verbatim_part(\d+)$/);
|
|
52
|
+
return m ? Number(m[1]) : 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function baseFromPart(session_id) {
|
|
56
|
+
return String(session_id || '').replace(/_verbatim_part\d+$/, '') || session_id;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function nextExchangeIndex(exchanges) {
|
|
60
|
+
if (!Array.isArray(exchanges) || exchanges.length === 0) return 1;
|
|
61
|
+
const max = exchanges.reduce((m, e) => Math.max(m, Number(e.exchange_index) || 0), 0);
|
|
62
|
+
return max + 1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function shouldStartNewPart(exchangeCount) {
|
|
66
|
+
return Number(exchangeCount) >= EXCHANGES_PER_PART;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A closed session is never reopened (2026-10-01, the owner's approval; episodic
|
|
71
|
+
* 598: a session_open returned the previous night's CLOSED id and the next
|
|
72
|
+
* append landed in it as exchange 9). Returns the first of base, base-2,
|
|
73
|
+
* base-3, ... that is free, and the ids it passed over with the reason.
|
|
74
|
+
*
|
|
75
|
+
* `statusOf(id)` is async (a store read) and returns the id's session state
|
|
76
|
+
* {exists, closed, suffix_of} - or null/{} when there is none. An id is passed
|
|
77
|
+
* over when:
|
|
78
|
+
* - it is closed;
|
|
79
|
+
* - it is the plain id asked for, but it was minted as another session's
|
|
80
|
+
* suffix (a real slug `fix-2` must not join `fix`'s `-2` session);
|
|
81
|
+
* - it is a suffix candidate already in use by some other session (a real
|
|
82
|
+
* slug `fix-2`, say) - only a suffix minted for THIS base is resumed.
|
|
83
|
+
* A read that throws propagates, so an unchecked id is never handed out.
|
|
84
|
+
* The `-N` suffix keeps the ids apart for every reader that groups transcript
|
|
85
|
+
* parts by `<base>_...`.
|
|
86
|
+
*/
|
|
87
|
+
export const MAX_SESSION_SUFFIX = 99;
|
|
88
|
+
|
|
89
|
+
export async function firstUnclosedBase(base, statusOf) {
|
|
90
|
+
const skipped = [];
|
|
91
|
+
for (let n = 1; n <= MAX_SESSION_SUFFIX; n++) {
|
|
92
|
+
const candidate = n === 1 ? base : `${base}-${n}`;
|
|
93
|
+
const s = (await statusOf(candidate)) || {};
|
|
94
|
+
const reason = s.closed ? 'closed'
|
|
95
|
+
: (n === 1 && s.suffix_of && s.suffix_of !== base) ? `in use as a suffixed id of ${s.suffix_of}`
|
|
96
|
+
: (n > 1 && s.exists && s.suffix_of !== base) ? 'in use by a session under another slug'
|
|
97
|
+
: null;
|
|
98
|
+
if (!reason) {
|
|
99
|
+
return { base: candidate, skipped, closed: skipped.filter((x) => x.reason === 'closed').map((x) => x.id) };
|
|
100
|
+
}
|
|
101
|
+
skipped.push({ id: candidate, reason });
|
|
102
|
+
}
|
|
103
|
+
const err = new Error(`${base} and its suffixes -2 to -${MAX_SESSION_SUFFIX} are all closed or in use; open the session under a new slug.`);
|
|
104
|
+
err.allClosed = true;
|
|
105
|
+
throw err;
|
|
106
|
+
}
|