@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/annotations.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CodedError } from './error-codes.js';
|
|
1
2
|
/**
|
|
2
3
|
* EMET - Enduring Memory & Epistemic Tiers
|
|
3
4
|
* Copyright (c) 2026 Dreamforge Studio LLC
|
|
@@ -53,7 +54,11 @@ const READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true,
|
|
|
53
54
|
const ADD = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
54
55
|
const REPLACE = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
const SUBKEY_ANNOTATION_NAMES = new Set([
|
|
58
|
+
'emet_subkey_request', 'emet_subkey_claim', 'emet_subkey_revoke', 'emet_subkey_end_session'
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
const ANNOTATION_TABLE = {
|
|
57
62
|
// --- Reads. Nothing in this group can change the store. -------------------
|
|
58
63
|
emet_initialize: { title: 'Start session', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
59
64
|
recall: { title: 'Search memory', ...READ },
|
|
@@ -65,6 +70,10 @@ export const TOOL_ANNOTATIONS = Object.freeze({
|
|
|
65
70
|
read_doc_history: { title: 'Read a retained document revision', ...READ },
|
|
66
71
|
list_docs: { title: 'List documents', ...READ },
|
|
67
72
|
emet_gaps: { title: 'Count the record\'s gaps', ...READ },
|
|
73
|
+
emet_page: { title: 'Read a topic page', ...READ },
|
|
74
|
+
emet_pages: { title: 'List topic pages', ...READ },
|
|
75
|
+
emet_page_lint: { title: 'Lint topic pages', ...READ },
|
|
76
|
+
emet_error_report: { title: 'Error report', ...READ },
|
|
68
77
|
emet_floor: { title: 'Read the floor', ...READ },
|
|
69
78
|
// Checks a document against its template and writes nothing - not even the
|
|
70
79
|
// verdict. The write path stores that; this is the same check, borrowed.
|
|
@@ -72,9 +81,14 @@ export const TOOL_ANNOTATIONS = Object.freeze({
|
|
|
72
81
|
|
|
73
82
|
// --- Additive writes. These add; they do not remove or replace. -----------
|
|
74
83
|
// Was READ until 2026-09-27: "it does not write anything itself". Since the
|
|
75
|
-
// blocked-close cap
|
|
84
|
+
// blocked-close cap it records each blocked attempt in
|
|
76
85
|
// close_attempts, so a read-only hint would be untrue (code audit, 1.3).
|
|
77
86
|
emet_session_close: { title: 'Check session is saved', ...ADD },
|
|
87
|
+
emet_client_approve: { title: 'Approve a new client', ...REPLACE },
|
|
88
|
+
emet_subkey_request: { title: 'Request a client sub-key', ...ADD },
|
|
89
|
+
emet_subkey_claim: { title: 'Claim a client sub-key', ...ADD },
|
|
90
|
+
emet_subkey_revoke: { title: 'Revoke a client sub-key', ...REPLACE },
|
|
91
|
+
emet_subkey_end_session: { title: 'End a sub-key session', ...ADD },
|
|
78
92
|
emet_invite_create: { title: 'EMET Guest Access', ...REPLACE },
|
|
79
93
|
emet_member_access_create: { title: 'EMET Member Access', ...REPLACE },
|
|
80
94
|
save_to_layer: { title: 'Save to a memory layer', ...ADD },
|
|
@@ -109,8 +123,34 @@ export const TOOL_ANNOTATIONS = Object.freeze({
|
|
|
109
123
|
// probe document and removes it again, so it is not declared read-only -
|
|
110
124
|
// a health check that only reads cannot detect a broken write path.
|
|
111
125
|
// Replaced emet_setup_status, get_status and emet_verify_connection on
|
|
112
|
-
// 2026-09-27 (
|
|
126
|
+
// 2026-09-27 (Alex: consolidate overlapping tools). -----------------------
|
|
113
127
|
emet_status: { title: 'Store status and write-path probe', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
function subkeyAnnotationsHidden() {
|
|
131
|
+
return process.env.EMET_SUBKEYS !== '1' && process.env.CASCADE_SUBKEYS !== '1';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The four sub-key annotations are visible only when EMET_SUBKEYS=1, so a
|
|
136
|
+
* flag-off process has the same annotation set as before those tools existed.
|
|
137
|
+
*/
|
|
138
|
+
export const TOOL_ANNOTATIONS = new Proxy(ANNOTATION_TABLE, {
|
|
139
|
+
get(target, prop, receiver) {
|
|
140
|
+
if (typeof prop === 'string' && SUBKEY_ANNOTATION_NAMES.has(prop) && subkeyAnnotationsHidden()) return undefined;
|
|
141
|
+
return Reflect.get(target, prop, receiver);
|
|
142
|
+
},
|
|
143
|
+
has(target, prop) {
|
|
144
|
+
if (typeof prop === 'string' && SUBKEY_ANNOTATION_NAMES.has(prop) && subkeyAnnotationsHidden()) return false;
|
|
145
|
+
return Reflect.has(target, prop);
|
|
146
|
+
},
|
|
147
|
+
ownKeys(target) {
|
|
148
|
+
return Reflect.ownKeys(target).filter((k) => !(typeof k === 'string' && SUBKEY_ANNOTATION_NAMES.has(k) && subkeyAnnotationsHidden()));
|
|
149
|
+
},
|
|
150
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
151
|
+
if (typeof prop === 'string' && SUBKEY_ANNOTATION_NAMES.has(prop) && subkeyAnnotationsHidden()) return undefined;
|
|
152
|
+
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
153
|
+
}
|
|
114
154
|
});
|
|
115
155
|
|
|
116
156
|
/**
|
|
@@ -124,10 +164,10 @@ export const TOOL_ANNOTATIONS = Object.freeze({
|
|
|
124
164
|
export function annotate(tools) {
|
|
125
165
|
const missing = tools.filter((tool) => !TOOL_ANNOTATIONS[tool.name]).map((tool) => tool.name);
|
|
126
166
|
if (missing.length > 0) {
|
|
127
|
-
throw new
|
|
167
|
+
throw new CodedError(
|
|
128
168
|
`Tools declared with no annotation entry: ${missing.join(', ')}. ` +
|
|
129
169
|
`Add them to TOOL_ANNOTATIONS in src/annotations.js.`
|
|
130
|
-
);
|
|
170
|
+
, { code: 'EMET-TOOL-001' });
|
|
131
171
|
}
|
|
132
172
|
return tools.map((tool) => ({ ...tool, annotations: TOOL_ANNOTATIONS[tool.name] }));
|
|
133
173
|
}
|
package/src/atlas-role.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { CodedError } from './error-codes.js';
|
|
1
2
|
/**
|
|
2
3
|
* EMET - the least-privilege MongoDB Atlas role for the server's own login
|
|
3
|
-
* (2026-09-29; security audit question 9).
|
|
4
|
+
* (2026-09-29; security audit question 9, staging/emet-security-audit.md).
|
|
4
5
|
*
|
|
5
6
|
* The record is retained, never deleted (the owner's rule, 2026-09-08). Until
|
|
6
7
|
* this role existed that rule lived only in the code: the server's login held
|
|
@@ -18,6 +19,8 @@
|
|
|
18
19
|
* are credentials, not the record.
|
|
19
20
|
* - _emet_verify: the status probe writes one document, reads it back, and
|
|
20
21
|
* deletes that document (setup.js verifyConnection). The collection stays.
|
|
22
|
+
* - error_log: rotation removes old operational rows after a daily summary
|
|
23
|
+
* is kept (error-log.js rotateErrorLog). This is bookkeeping, not the record.
|
|
21
24
|
* Everything else - memory layers, documents, their history, transcripts - is
|
|
22
25
|
* find / insert / update only.
|
|
23
26
|
*/
|
|
@@ -41,13 +44,15 @@ export const DATABASE_ACTIONS = Object.freeze([
|
|
|
41
44
|
*/
|
|
42
45
|
export const DELETE_ALLOWED = Object.freeze({
|
|
43
46
|
'{prefix}oauth_tokens': Object.freeze(['REMOVE']),
|
|
44
|
-
_emet_verify: Object.freeze(['REMOVE'])
|
|
47
|
+
_emet_verify: Object.freeze(['REMOVE']),
|
|
48
|
+
// Unprefixed, like the probe. Operational error log, not the record.
|
|
49
|
+
error_log: Object.freeze(['REMOVE'])
|
|
45
50
|
});
|
|
46
51
|
|
|
47
52
|
/** Privileges in the Atlas CLI form ACTION@db or ACTION@db.collection. */
|
|
48
53
|
export function atlasPrivileges(dbName, prefix = 'emet_') {
|
|
49
|
-
if (!dbName || typeof dbName !== 'string' || /[\s@.]/.test(dbName)) throw new
|
|
50
|
-
if (typeof prefix !== 'string' || /[\s@.]/.test(prefix)) throw new
|
|
54
|
+
if (!dbName || typeof dbName !== 'string' || /[\s@.]/.test(dbName)) throw new CodedError('database name must be a plain name', { code: 'EMET-CFG-001' });
|
|
55
|
+
if (typeof prefix !== 'string' || /[\s@.]/.test(prefix)) throw new CodedError('prefix must be a plain name', { code: 'EMET-CFG-002' });
|
|
51
56
|
const out = DATABASE_ACTIONS.map((a) => `${a}@${dbName}`);
|
|
52
57
|
for (const [col, actions] of Object.entries(DELETE_ALLOWED)) {
|
|
53
58
|
for (const a of actions) out.push(`${a}@${dbName}.${col.replace('{prefix}', prefix)}`);
|