@dreamforgestudiollc/emet 0.2.4 → 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.
- package/.env.example +63 -0
- package/CHANGELOG.md +84 -3
- package/CHARTER.md +19 -7
- package/README.md +130 -21
- package/areas/emet.md +18 -0
- package/areas/garden.md +18 -0
- package/areas/health.md +18 -0
- package/areas/home.md +18 -0
- package/areas/learning.md +18 -0
- package/areas/state.md +18 -0
- package/docs/AUTHORSHIP.md +3 -3
- package/docs/BOTS.md +4 -0
- package/docs/COVERAGE.md +2 -2
- package/docs/DEPLOY.md +41 -5
- package/docs/ERROR-CODES-SPEC.md +43 -0
- package/docs/ERROR-CODES.md +332 -0
- package/docs/GUARDRAILS-AND-MONORAILS.md +2 -1
- package/docs/GUIDED-SETUP.md +24 -3
- package/docs/PERMISSIONS.md +13 -7
- package/docs/ROADMAP.md +18 -15
- package/docs/SETUP.md +123 -14
- 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/{guides → gems/neurendipity/guides}/NEURODIVERGENT_SUPPORT.md +17 -8
- package/guides/README.md +3 -0
- package/package.json +12 -5
- package/server.json +48 -4
- package/src/aleph.js +18 -12
- package/src/annotations.js +45 -5
- package/src/atlas-role.js +9 -4
- package/src/attribution.js +555 -0
- package/src/conformance.js +7 -5
- package/src/database.js +34 -17
- package/src/dispatch.js +136 -16
- package/src/env.js +54 -9
- package/src/error-codes.js +394 -0
- package/src/error-log.js +273 -0
- package/src/error-report.js +245 -0
- package/src/floor.js +84 -41
- package/src/gaps.js +41 -8
- package/src/gem-check.js +1360 -0
- package/src/guides.js +31 -4
- package/src/host-reach.js +23 -0
- package/src/http-remote.js +47 -2
- package/src/index.js +10 -2
- package/src/invites.js +6 -5
- package/src/layers.js +9 -8
- package/src/lessons-to-checks.js +3 -3
- package/src/logger.js +2 -1
- package/src/mongo-connect.js +50 -2
- package/src/oauth-provider.js +30 -29
- package/src/owner-approvals.js +281 -0
- package/src/pages.js +806 -0
- package/src/persons.js +22 -1
- package/src/provenance.js +10 -10
- package/src/redact.js +10 -4
- package/src/request-log.js +1 -1
- 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 +3 -0
- package/src/session-graph.js +15 -12
- package/src/session.js +10 -10
- package/src/setup.js +307 -36
- package/src/socket.js +545 -0
- package/src/startup-pages.js +26 -8
- package/src/startup-payload.js +12 -8
- package/src/subkey-store.js +358 -0
- package/src/subkeys.js +947 -0
- package/src/tools.js +518 -204
- package/src/transcript-session.js +1 -1
- package/src/validation.js +85 -52
- package/src/version.js +1 -1
- package/templates/AREA.md +35 -0
- package/templates/BOARD.md +2 -2
- package/templates/BOTHANDOFF.md +2 -2
- package/templates/CHARACTER.md +1 -1
- package/templates/HANDOFF.md +1 -1
- package/templates/IDENTITY.md +1 -1
- package/templates/INDEX.md +21 -20
- package/templates/INSTALL.md +1 -1
- package/templates/PROCEDURE.md +1 -1
- package/templates/ROSTER.md +2 -2
- package/templates/SEED.md +2 -2
- package/templates/STAGING.md +2 -2
- package/templates/STANDARD.md +5 -5
- package/templates/THREAD.md +1 -1
- package/templates/USER.md +4 -1
- package/verification/load-gate/corpus.json +1765 -0
- package/verification/load-gate/load-gate.mjs +1246 -0
package/src/session-graph.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* EMET - the session graph: the monorail under the guardrails (2026-09-29
|
|
3
|
-
*
|
|
2
|
+
* EMET - the session graph: the monorail under the guardrails (2026-09-29,
|
|
3
|
+
* board board 120, design staging/emet-session-graph.md; the practice is
|
|
4
|
+
* docs/GUARDRAILS-AND-MONORAILS.md).
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
+
* Alex: "guardrails give a field of movement and execution to allow an AI to do
|
|
6
7
|
* processes where rails guide the AI through a process flow without it
|
|
7
|
-
* processing" (
|
|
8
|
+
* processing" (semantic ref 297). The floor, the character and the served
|
|
8
9
|
* instructions are the guardrails. This file is the monorail - the car cannot
|
|
9
10
|
* leave the beam; where a flow forks, a small switch owned by the track (never
|
|
10
11
|
* the model) picks the branch (designed 2026-09-29, not yet built): the next step of a
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
*/
|
|
50
51
|
|
|
51
52
|
import { setting } from './env.js';
|
|
53
|
+
import { CodedError } from './error-codes.js';
|
|
52
54
|
|
|
53
55
|
export const GRAPH_MODES = Object.freeze(['enforce']);
|
|
54
56
|
|
|
@@ -68,18 +70,19 @@ export const HANDOFF_DOC = 'HANDOFF.md';
|
|
|
68
70
|
export const BOARD_DOC = 'STATE.md';
|
|
69
71
|
|
|
70
72
|
/**
|
|
71
|
-
* Per-bot close records (C1, 2026-10-01;
|
|
73
|
+
* Per-bot close records (C1, 2026-10-01; review note "C1: per-bot close
|
|
74
|
+
* records", the owner's decisions 1-7). The rule, stated once: a session written
|
|
72
75
|
* under a bot's source tag closes against that bot's own records
|
|
73
76
|
* (bots/<tag>/HANDOFF.md); only that tag's own revisions in the session window
|
|
74
77
|
* count; a bot tag never writes or cites the main HANDOFF.md or STATE.md.
|
|
75
78
|
*
|
|
76
79
|
* A tag T is a BOT TAG when bots/T/HANDOFF.md is listed in EMET_RECORD_DOCS,
|
|
77
80
|
* the list that already marks ids as supersede-only records (tools.js
|
|
78
|
-
* recordDocIds). No new setting:
|
|
81
|
+
* recordDocIds). No new setting: Alex adds one id per bot, and removing it
|
|
79
82
|
* puts that tag back on the host rules. Bot records are named by the source
|
|
80
83
|
* tag itself (decision 1), so no tag-to-name mapping exists. These are pure
|
|
81
84
|
* reads of settings - no database - so the graph can key its bot-handoff gate
|
|
82
|
-
* on a write's `source` without an extra read.
|
|
85
|
+
* on a write's `source` without an extra read (review note section 5).
|
|
83
86
|
*/
|
|
84
87
|
export function botRecordDir(tag) { return `bots/${tag}/`; }
|
|
85
88
|
export function botHandoffDoc(tag) { return `bots/${tag}/HANDOFF.md`; }
|
|
@@ -101,7 +104,7 @@ export function mainRecordIds() {
|
|
|
101
104
|
* The source tag a write names, read as dispatch.js sourceOf reads it
|
|
102
105
|
* (`source`, then the older aliases). Repeated here because dispatch imports
|
|
103
106
|
* this module. No default: a write with no source takes the host path in the
|
|
104
|
-
* graph.
|
|
107
|
+
* graph (review note section 5).
|
|
105
108
|
*/
|
|
106
109
|
export function writeSourceOf(args = {}) {
|
|
107
110
|
const v = args.source ?? args.updated_by ?? args.retired_by ?? args.accepted_by ?? args.channel ?? null;
|
|
@@ -163,7 +166,7 @@ export function groupedUnder(sessionId, base) {
|
|
|
163
166
|
/**
|
|
164
167
|
* The session a call names: `session_id`, else the transcript span in
|
|
165
168
|
* `metadata.derived_from` (revise_memory refuses metadata.session_id and names
|
|
166
|
-
* its session there - live-caught 2026-09-29,
|
|
169
|
+
* its session there - live-caught 2026-09-29, semantic ref 295), else - for
|
|
167
170
|
* emet_session_close, the only tool that takes `receipts` -
|
|
168
171
|
* `receipts.transcript_session_id`. The close tool's description documents
|
|
169
172
|
* that shape ("receipts.transcript_session_id is used when this is omitted")
|
|
@@ -208,7 +211,7 @@ export function normalizeExchangeNumber(v) {
|
|
|
208
211
|
let n = v;
|
|
209
212
|
if (typeof n === 'string' && /^\s*\d+\s*$/.test(n)) n = Number(n);
|
|
210
213
|
if (typeof n === 'number' && Number.isInteger(n) && n >= 1) return { value: n };
|
|
211
|
-
return { error: `exchange_index must be a whole number, 1 or more (got ${JSON.stringify(v)})
|
|
214
|
+
return { error: `exchange_index must be a whole number, 1 or more (got ${JSON.stringify(v)})`, emet_code: 'EMET-TRN-010' };
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
/** The exchange a call declares, if any: `exchange` on writes, `exchange_index` on an append. */
|
|
@@ -553,7 +556,7 @@ export async function closedSessionGuard(tool, args = {}, dbManager, now = new D
|
|
|
553
556
|
let pos;
|
|
554
557
|
try {
|
|
555
558
|
pos = typeof dbManager.transcriptPosition === 'function' ? await dbManager.transcriptPosition(base) : null;
|
|
556
|
-
if (!pos || typeof pos.highest !== 'number') throw new
|
|
559
|
+
if (!pos || typeof pos.highest !== 'number') throw new CodedError('the transcript position is not available', { code: 'EMET-SESS-001' });
|
|
557
560
|
} catch (e) { throw await unreadable(tool, base, 'the transcript position', e); }
|
|
558
561
|
const highest = pos.highest;
|
|
559
562
|
const declared = declaredExchange(tool, args);
|
|
@@ -767,7 +770,7 @@ export async function graphBefore(tool, args, dbManager, now = new Date()) {
|
|
|
767
770
|
}
|
|
768
771
|
|
|
769
772
|
// ---------------------------------------------------------------------------
|
|
770
|
-
// Lab results (2026-09-29,
|
|
773
|
+
// Lab results (2026-09-29, Alex: "a 'lab results' location for storing the
|
|
771
774
|
// results in real time with time stamps so we can have a resource to look at
|
|
772
775
|
// after the probationary period"). Every check the monorail makes - ok,
|
|
773
776
|
// refuse, unknown (would_refuse in rows from before enforce-only) - is one timestamped row in
|
package/src/session.js
CHANGED
|
@@ -95,7 +95,7 @@ export const CLOSE_PROTOCOL = Object.freeze([
|
|
|
95
95
|
async function connect() {
|
|
96
96
|
const { testClientActive } = await import('./mongo-connect.js');
|
|
97
97
|
if (!MONGODB_URI && !testClientActive()) {
|
|
98
|
-
throw new DatabaseError('MONGODB_URI is not set; cannot verify session artifacts.');
|
|
98
|
+
throw new DatabaseError('MONGODB_URI is not set; cannot verify session artifacts.', { code: 'EMET-DB-001' });
|
|
99
99
|
}
|
|
100
100
|
const client = await connectMongo(MONGODB_URI || 'mongodb://test', { serverSelectionTimeoutMS: 15000 });
|
|
101
101
|
return { client, db: client.db(MONGODB_DB) };
|
|
@@ -322,7 +322,7 @@ export async function corroborateCoverage(db, baseId) {
|
|
|
322
322
|
// correction makes the check permanently worse, and the flag can never
|
|
323
323
|
// clear because superseded entries cannot be edited. Found live at the
|
|
324
324
|
// 2026-09-11 close: nine entries superseded with correct spans, and the
|
|
325
|
-
// check still read the old
|
|
325
|
+
// check still read the old ref 314's 31-33 against a 27-exchange session.
|
|
326
326
|
// Every other read in EMET hides superseded entries by default; this one
|
|
327
327
|
// now does too - and says how many it set aside, because dropping
|
|
328
328
|
// evidence silently is the other half of the same mistake.
|
|
@@ -354,7 +354,7 @@ export async function corroborateCoverage(db, baseId) {
|
|
|
354
354
|
* The store check above answers "do the artifacts exist". It could not answer
|
|
355
355
|
* "did the host actually do each step", and a host that skipped a step, or
|
|
356
356
|
* never read the transcript back, could still walk away with `complete`
|
|
357
|
-
* because the store happened to look fine.
|
|
357
|
+
* because the store happened to look fine. the owner's requirement (procedural ref 388,
|
|
358
358
|
* 389, 391): the wrap steps HAVE TO BE FOLLOWED, whichever model is hosting,
|
|
359
359
|
* and a skipped step blocks the close the same way a skipped opening is caught
|
|
360
360
|
* at initialize.
|
|
@@ -387,7 +387,7 @@ export const RECEIPT_FIELDS = Object.freeze({
|
|
|
387
387
|
});
|
|
388
388
|
|
|
389
389
|
/**
|
|
390
|
-
* A bot session's receipts (C1, 2026-10-01).
|
|
390
|
+
* A bot session's receipts (C1, 2026-10-01; review note section 3.3).
|
|
391
391
|
* Seven: no board is required - a bot that keeps one lists it under
|
|
392
392
|
* bots/<tag>/ as board_doc (checked when given) or as a working document - and
|
|
393
393
|
* handoff_doc names the bot's own handoff. Host receipts stay at the eight
|
|
@@ -403,7 +403,7 @@ export const BOT_RECEIPT_FIELDS = Object.freeze({
|
|
|
403
403
|
handoff_version: RECEIPT_FIELDS.handoff_version
|
|
404
404
|
});
|
|
405
405
|
|
|
406
|
-
/** The message every bot-records refusal carries. */
|
|
406
|
+
/** The message every bot-records refusal carries (review note section 3.5). */
|
|
407
407
|
export function hubRecordsMessage(tag) {
|
|
408
408
|
return `a bot session closes against ${botRecordDir(tag)} records; the main handoff and board are the hub's`;
|
|
409
409
|
}
|
|
@@ -429,7 +429,7 @@ export function sessionTagOf(rows = []) {
|
|
|
429
429
|
* Hosts do not all pass an object argument the same way. A client working from
|
|
430
430
|
* a cached tool list that predates `receipts` - or a host that serialises every
|
|
431
431
|
* nested argument - sends the receipts as JSON TEXT. Found live at the first
|
|
432
|
-
* close under the new rule (2026-09-26, cloud
|
|
432
|
+
* close under the new rule (2026-09-26, cowork-cloud): every artifact present,
|
|
433
433
|
* receipts sent, and the server saw none. Consistent execution across hosts
|
|
434
434
|
* means accepting both forms. Text that does not parse is treated as absent,
|
|
435
435
|
* so it still blocks - it is never guessed at.
|
|
@@ -485,7 +485,7 @@ export function checkReceipts(receipts, observed) {
|
|
|
485
485
|
|
|
486
486
|
const docs = new Map((observed.documents || []).map((d) => [d.doc_id, d]));
|
|
487
487
|
|
|
488
|
-
// A bot session never names the main records: any
|
|
488
|
+
// A bot session never names the main records (review note section 3.5): any
|
|
489
489
|
// receipt that does is refused here, and those ids get no other check.
|
|
490
490
|
const mainIds = bot ? (bot.main_records || []) : [];
|
|
491
491
|
const isMain = (id) => mainIds.includes(id);
|
|
@@ -852,7 +852,7 @@ export async function sessionClose(options = {}) {
|
|
|
852
852
|
if (row && ms !== null && ms >= startMs) {
|
|
853
853
|
receiptEpisodicSource = parseMetadata(row.metadata).source || null;
|
|
854
854
|
if (bot) {
|
|
855
|
-
// A bot's session record is its own and cites this session.
|
|
855
|
+
// A bot's session record is its own and cites this session (review note 3.2).
|
|
856
856
|
const cited = typeof row.source_session_id === 'string' && row.source_session_id ? row.source_session_id : null;
|
|
857
857
|
if (receiptEpisodicSource !== bot.tag) {
|
|
858
858
|
episodicRejected = `its metadata.source is ${receiptEpisodicSource || '(none)'}, not ${bot.tag}`;
|
|
@@ -968,8 +968,8 @@ export async function sessionClose(options = {}) {
|
|
|
968
968
|
}
|
|
969
969
|
|
|
970
970
|
// Store-level gaps make the session incomplete. Receipt problems, and a
|
|
971
|
-
// transcript nothing independently corroborates, BLOCK it (
|
|
972
|
-
//
|
|
971
|
+
// transcript nothing independently corroborates, BLOCK it (Alex 2026-09-26,
|
|
972
|
+
// procedural ref 391: receipts required from the first deploy; the former
|
|
973
973
|
// `unconfirmed` state is blocked, not passed).
|
|
974
974
|
const storeMissing = [...missing];
|
|
975
975
|
const receiptCheck = checkReceipts(receipts, {
|