@dreamforgestudiollc/emet 0.3.4 → 0.3.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.
Files changed (48) hide show
  1. package/.env.example +18 -1
  2. package/CHANGELOG.md +42 -12
  3. package/CHARTER.md +2 -2
  4. package/CONTRIBUTING.md +21 -0
  5. package/README.md +25 -14
  6. package/RELEASE_NOTES-0.2.6.md +43 -0
  7. package/RELEASE_NOTES-0.3.6.md +29 -0
  8. package/SECURITY.md +13 -0
  9. package/docs/BOTS.md +3 -3
  10. package/docs/DEPLOY.md +53 -14
  11. package/docs/ERROR-CODES-SPEC.md +1 -1
  12. package/docs/ERROR-CODES.md +1 -0
  13. package/docs/GUIDED-SETUP.md +1 -1
  14. package/docs/ROADMAP.md +62 -49
  15. package/docs/SETUP.md +30 -7
  16. package/package.json +5 -2
  17. package/server.json +2 -2
  18. package/src/annotations.js +1 -0
  19. package/src/attribution.js +9 -9
  20. package/src/bound-door.js +75 -42
  21. package/src/break-glass.js +7 -1
  22. package/src/carry-forward-close.js +1 -1
  23. package/src/chooser.js +15 -8
  24. package/src/claimed-tag.js +1 -1
  25. package/src/database.js +1 -1
  26. package/src/dispatch.js +2 -2
  27. package/src/error-codes.js +1 -0
  28. package/src/error-report.js +1 -1
  29. package/src/gem-check.js +4 -1
  30. package/src/grants.js +29 -6
  31. package/src/host-reach.js +1 -1
  32. package/src/http-remote.js +18 -8
  33. package/src/index.js +2 -2
  34. package/src/invites.js +2 -2
  35. package/src/owl.js +18 -18
  36. package/src/owner-approvals.js +1 -1
  37. package/src/proof-run.js +2 -2
  38. package/src/rotate.js +1 -1
  39. package/src/session-graph.js +5 -5
  40. package/src/session.js +2 -2
  41. package/src/setup.js +14 -10
  42. package/src/subkeys.js +4 -1
  43. package/src/tools.js +29 -28
  44. package/src/transcript-session.js +2 -2
  45. package/src/version.js +1 -1
  46. package/src/writer-approval.js +11 -6
  47. package/templates/SESSIONDISPOSITION.md +2 -2
  48. package/verification/load-gate/load-gate.mjs +1 -1
@@ -6,7 +6,7 @@
6
6
  * match, the close stays blocked, and retries used to count toward the
7
7
  * three-close cap.
8
8
  *
9
- * A records/ session disposition (templates/SESSIONDISPOSITION.md, #95)
9
+ * A records/ session disposition (templates/SESSIONDISPOSITION.md)
10
10
  * documents that fact. The row does not close the graph and it is not a
11
11
  * receipt. This path closes the graph only when the owner door, or the
12
12
  * credential that wrote the session, cites that current row and the later
package/src/chooser.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * Pending sub-keys from the retired /owner/approvals path are listed here.
10
10
  * Their records stay in the sub-key store.
11
11
  *
12
- * Prepared writer requests are listed here too. Master Hub prepares.
12
+ * Prepared writer requests are listed here too. The hub login prepares.
13
13
  * The server validates. This owner session decides. The request row stays.
14
14
  */
15
15
 
@@ -25,6 +25,7 @@ import {
25
25
  esc, sendHtml, loginForm, ownerPageActor, ownerMayGrant, mountOwnerLogin, readCookie, createOwnerGate
26
26
  } from './owner-session.js';
27
27
  import { rotationForms } from './rotate.js';
28
+ import { boundHostListingAfterWriterIssue, isBoundHostTag, isLegacyBoundHostSpelling, CLAIM_TAG } from './bound-door.js';
28
29
 
29
30
  const CHOOSER_COOKIE = 'emet_chooser';
30
31
  const REASON_MAX = 500;
@@ -83,7 +84,7 @@ function writerSection(session, writers) {
83
84
  return `<tr><td>${esc(row.claimed_tag)}</td><td>${esc(row.door)}</td><td>${esc(row.status)}</td><td>${esc(row.preparer)}</td><td>${esc(row.validator)}</td><td>${esc(row.correlation_id)}</td><td>${buttons}</td></tr>`;
84
85
  }).join('\n');
85
86
  return `<h2>Writer requests</h2>
86
- <p>Master Hub prepares. The server validates. Only this owner session decides.</p>
87
+ <p>The hub login prepares. The server validates. Only this owner session decides.</p>
87
88
  <table><thead><tr><th>Tag</th><th>Door</th><th>Status</th><th>Preparer</th><th>Validator</th><th>Correlation</th><th></th></tr></thead><tbody>${body}</tbody></table>`;
88
89
  }
89
90
 
@@ -362,6 +363,11 @@ export function mountChooser(app, options = {}) {
362
363
  sendHtml(res, 400, '<p>A tag is required for member or guest. Nothing was granted.</p>', 'EMET chooser');
363
364
  return;
364
365
  }
366
+ if (isLegacyBoundHostSpelling(tag)) {
367
+ res.locals.reason = 'legacy_bound_tag';
368
+ sendHtml(res, 400, '<p>use bound-host (EMET-AUTH-045). Nothing was granted.</p>', 'EMET chooser');
369
+ return;
370
+ }
365
371
  let db = null;
366
372
  try { db = dbOf() || null; } catch { db = null; }
367
373
  const issued = await issueDoor(db, decision, tag === 'unknown' ? 'owner' : tag, personId);
@@ -527,16 +533,17 @@ export function mountChooser(app, options = {}) {
527
533
  const bits = [`Recorded ${decision} for ${recorded.claimed_tag}.`];
528
534
  if (issued.note) bits.push(issued.note);
529
535
  if (issued.invite && issued.invite.code) bits.push(`Invite code, shown once: ${issued.invite.code}`);
530
- if (issued.issued && recorded.claimed_tag === 'grok-project') {
531
- let sophiaNote = 'The BOUND door listing was not written. The invite code above is still the door.';
536
+ // A request already stored under the previous spelling still lists the door.
537
+ // prepareWriterRequest refuses that spelling when it is newly chosen.
538
+ if (issued.issued && isBoundHostTag(recorded.claimed_tag)) {
539
+ let boundHostNote = 'The BOUND door listing was not written. The invite code above is still the door.';
532
540
  try {
533
- const { sophiaListingAfterWriterIssue } = await import('./bound-door.js');
534
- const listing = await sophiaListingAfterWriterIssue({
541
+ const listing = await boundHostListingAfterWriterIssue({
535
542
  recorded, issued, deps: depsOf(), by: personId, now: new Date(now())
536
543
  });
537
- if (listing.written) sophiaNote = 'Listed grok-project as its own door.';
544
+ if (listing.written) boundHostNote = `Listed ${CLAIM_TAG} as its own door.`;
538
545
  } catch { /* the invite still stands */ }
539
- bits.push(sophiaNote);
546
+ bits.push(boundHostNote);
540
547
  }
541
548
  await render(req, res, bits.join(' '));
542
549
  }
@@ -9,7 +9,7 @@
9
9
  * the write is kept and the receipt warns. On that day and after, the write
10
10
  * is refused. Unset uses PROPOSED_CLAIMED_TAG_KILL_DATE.
11
11
  *
12
- * The traffic counter is this process. Railway EMET is one long-lived process.
12
+ * The traffic counter is this process. A hosted deployment is one long-lived process.
13
13
  * It is not a backfill of older rows.
14
14
  */
15
15
 
package/src/database.js CHANGED
@@ -454,7 +454,7 @@ export class EmetDatabase {
454
454
  }
455
455
 
456
456
  /**
457
- * THE layer insert, native (2026-09-27, code audit 1.7 stage 1 - Alex: "if SQL
457
+ * THE layer insert, native (2026-09-27, code audit 1.7 stage 1 - the owner: "if SQL
458
458
  * is the old and needs to be updated then update it"). Takes the document as
459
459
  * a document. Every key must be a known layer field; the id is allocated
460
460
  * here. The INSERT-string shim it replaced went with the SQL translator in
package/src/dispatch.js CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  resolvedSourceTag,
34
34
  TOOLS
35
35
  } from './tools.js';
36
- import { refuseSophiaDoor, sophiaActor } from './bound-door.js';
36
+ import { refuseBoundHostDoor, boundHostActor } from './bound-door.js';
37
37
  import { beginStagedDoc, appendStagedChunk, commitStagedDoc, abortStagedDoc } from './staged-write.js';
38
38
  import { reserveToolNames } from './rune-registry.js';
39
39
  import { applyCheckpoint, checkpointOnError, checkpointStatus } from './checkpoint.js';
@@ -59,7 +59,7 @@ export function sourceOf(args) {
59
59
  // Stdio still reads the argument, and requireRegisteredSource checks the registry.
60
60
  const caller = args.source ?? args.updated_by ?? args.retired_by ?? args.accepted_by ?? args.channel ?? null;
61
61
  const decision = resolvedSourceTag(caller);
62
- if (decision.from === 'bound-door') refuseSophiaDoor(sophiaActor());
62
+ if (decision.from === 'bound-door') refuseBoundHostDoor(boundHostActor());
63
63
  return decision.tag;
64
64
  }
65
65
 
@@ -79,6 +79,7 @@ export const ERROR_CODES = Object.freeze({
79
79
  'EMET-AUTH-042': Object.freeze({ area: 'AUTH', summary: "A retired owl credential was refused", status: 'active', internal: false }),
80
80
  'EMET-AUTH-043': Object.freeze({ area: 'AUTH', summary: "A writer approval step was refused", status: 'active', internal: false }),
81
81
  'EMET-AUTH-044': Object.freeze({ area: 'AUTH', summary: "A bound login cannot stamp another tag", status: 'active', internal: false }),
82
+ 'EMET-AUTH-045': Object.freeze({ area: 'AUTH', summary: "The previous bound-door spelling is refused for a new choice", status: 'active', internal: false }),
82
83
  'EMET-CFG-001': Object.freeze({ area: 'CFG', summary: "Database name must be a plain name", status: 'active', internal: true }),
83
84
  'EMET-CFG-002': Object.freeze({ area: 'CFG', summary: "Collection prefix must be a plain name", status: 'active', internal: true }),
84
85
  'EMET-CFG-004': Object.freeze({ area: 'CFG', summary: "Hosted setup cannot turn sub-keys on from here", status: 'active', internal: false }),
@@ -14,7 +14,7 @@ import { logClientId, logDoor, logGrantId } from './grants.js';
14
14
  import { queryErrorLog, logSessionId } from './error-log.js';
15
15
 
16
16
  export const SEND_INSTRUCTION = 'The calling assistant may send this report only after showing the report to its user and getting their OK.';
17
- export const DEFAULT_REPORT_EMAIL = 'dreamforgestudio@mail.hubbot.com';
17
+ export const DEFAULT_REPORT_EMAIL = 'dreamforgestudio@mail.grokbot.com';
18
18
  export const MAILTO_MAX = 1800;
19
19
 
20
20
  /**
package/src/gem-check.js CHANGED
@@ -96,6 +96,9 @@ const SECRET_PATTERNS = Object.freeze([
96
96
  /(api[_-]?key|secret|token|password)\s*[:=]\s*['"][^\s'"]{12,}/i
97
97
  ]);
98
98
 
99
+ /** In-repo schema id. Not a URL. The bundled schema and this check use the same string. */
100
+ export const GEM_SCHEMA_ID = 'emet:gem-library/gem.schema.json';
101
+
99
102
  const SECTION_KEY = /^[a-z][a-z0-9_]{0,40}$/;
100
103
  const FORBIDDEN_SECTIONS = new Set(['voice', 'engagement', 'persistence', 'corpus_discipline', 'operating_discipline']);
101
104
 
@@ -114,7 +117,7 @@ function loadSchema(explicit) {
114
117
  if (schemaCache) return schemaCache;
115
118
  const text = fs.readFileSync(schemaPath(), 'utf8');
116
119
  const parsed = JSON.parse(text);
117
- if (!parsed || parsed.$id !== 'https://github.com/dreamforgestudiollc/EMET-GEMs/raw/main/gem.schema.json') {
120
+ if (!parsed || parsed.$id !== GEM_SCHEMA_ID) {
118
121
  throw new CodedError('schema id', { code: 'EMET-GEM-013' });
119
122
  }
120
123
  schemaCache = parsed;
package/src/grants.js CHANGED
@@ -1,3 +1,5 @@
1
+ import crypto from 'node:crypto';
2
+
1
3
  /**
2
4
  * Door grants (R2 design scaffolding, 2026-10-26).
3
5
  *
@@ -140,20 +142,41 @@ export const MEMBER_REVOKE = Object.freeze({
140
142
  path: '/owner/break-glass/revoke-member'
141
143
  });
142
144
 
143
- /** The owl MCP clone account. Exact string. A substring is not this account. */
144
- export const OWL_ACCOUNT = 'user-EMET--owl';
145
+ /**
146
+ * Public label for logs and the retirement marker. Not compared to stored
147
+ * client ids. The retired account id is matched by digest so this package
148
+ * does not spell it. A substring is not that account.
149
+ */
150
+ export const OWL_ACCOUNT_LABEL = 'retired-owl-account';
151
+ /** sha256 of the retired account id, utf8. Exact match only. */
152
+ export const OWL_ACCOUNT_DIGEST = 'd2f8d11e0e331afd1315642e613b3f2d4c864904767c0a420761a40f81e01b0f';
153
+
154
+ export function isRetiredOwlAccount(value) {
155
+ if (typeof value !== 'string' || value.length === 0) return false;
156
+ const digest = crypto.createHash('sha256').update(value, 'utf8').digest('hex');
157
+ if (digest.length !== OWL_ACCOUNT_DIGEST.length) return false;
158
+ return crypto.timingSafeEqual(Buffer.from(digest), Buffer.from(OWL_ACCOUNT_DIGEST));
159
+ }
160
+
161
+ export function owlRetirementFailureLine(active = 'unknown') {
162
+ return `[emet] OWL RETIREMENT CHECK FAILED account=${OWL_ACCOUNT_LABEL} active=${active} rung=R6 pointer=/owner/chooser`;
163
+ }
164
+
165
+ export function owlRetirementPassLine() {
166
+ return `[emet] owl-retirement check=pass account=${OWL_ACCOUNT_LABEL} active=0 rung=R6`;
167
+ }
145
168
 
146
169
  /**
147
170
  * R6. The owl MCP clone account was a second OAuth client used only to get a
148
171
  * different client_id. R6 retires it. the owner decides a new writer on the
149
- * chooser. Master Hub prepares. The server validates. Rows stay.
172
+ * chooser. The hub login prepares. The server validates. Rows stay.
150
173
  * delete_wiring stays false: the name and the historical grants are retained.
151
174
  */
152
175
  export const OWL_KILL = Object.freeze({
153
176
  rung: 'R6',
154
177
  implemented: true,
155
178
  delete_wiring: false,
156
- account: OWL_ACCOUNT,
179
+ account: OWL_ACCOUNT_LABEL,
157
180
  status: 'retired',
158
181
  superseded_by: 'R6',
159
182
  retained: true,
@@ -170,9 +193,9 @@ export const OWL_KILL = Object.freeze({
170
193
  export const WRITER_VALIDATOR = Object.freeze({
171
194
  rung: 'R6a',
172
195
  implemented: 'server',
173
- alex_choice_open: true,
196
+ owner_choice_open: true,
174
197
  options: Object.freeze(['server', 'existing-reviewer-credential']),
175
- not_an_option: OWL_ACCOUNT,
198
+ not_an_option: OWL_ACCOUNT_LABEL,
176
199
  note: 'The server-side check is what runs. the owner can later name another existing reviewer credential. The owl account is not a choice.'
177
200
  });
178
201
 
package/src/host-reach.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * Licensed under the MIT License - see LICENSE
6
6
  *
7
7
  * The RUNE load gate lives in verification/load-gate/load-gate.mjs so
8
- * EMET-GEMs can vendor that file and its corpus byte-for-byte. This module
8
+ * A library checkout can vendor that file and its corpus byte-for-byte. This module
9
9
  * is the import path gem-check already uses. There is no second scan.
10
10
  */
11
11
 
@@ -33,6 +33,7 @@ import { requireBearerAuth } from '@modelcontextprotocol/sdk/server/auth/middlew
33
33
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
34
34
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
35
35
  import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
36
+ import { owlRetirementFailureLine } from './grants.js';
36
37
  import { EMET_VERSION } from './version.js';
37
38
 
38
39
 
@@ -254,6 +255,11 @@ app.post('/oauth/approve', express.urlencoded({ extended: false }), async (req,
254
255
  res.locals.reason = 'bad_source';
255
256
  return res.status(400).end('source tag is not registered');
256
257
  }
258
+ const { isLegacyBoundHostSpelling } = await import('./bound-door.js');
259
+ if (isLegacyBoundHostSpelling(requested)) {
260
+ res.locals.reason = 'legacy_bound_tag';
261
+ return res.status(400).end('use bound-host (EMET-AUTH-045)');
262
+ }
257
263
  sourceTag = requested || null;
258
264
  }
259
265
  const { isOwlIdentity } = await import('./owl.js');
@@ -291,13 +297,17 @@ app.post('/oauth/approve', express.urlencoded({ extended: false }), async (req,
291
297
  issued_via: inviteSubject ? (inviteDoor === 'member' ? 'member' : 'invite') : 'owner',
292
298
  source_tag: sourceTag,
293
299
  });
294
- if (sourceTag === 'grok-project') {
295
- try {
296
- const { recordSophiaCredential } = await import('./bound-door.js');
297
- const door = inviteSubject ? (inviteDoor === 'member' ? 'member' : 'guest') : 'owner';
298
- await recordSophiaCredential(t.approvalsDeps, { client_id, door, grant_id: null, by: 'consent' });
299
- } catch {
300
- console.error('[emet] bound door listing was not written');
300
+ if (sourceTag) {
301
+ const { recordBoundHostCredential, CLAIM_TAG } = await import('./bound-door.js');
302
+ // A new consent lists the door only for the current tag. The previous
303
+ // spelling is refused above, before a token is issued.
304
+ if (sourceTag === CLAIM_TAG) {
305
+ try {
306
+ const door = inviteSubject ? (inviteDoor === 'member' ? 'member' : 'guest') : 'owner';
307
+ await recordBoundHostCredential(t.approvalsDeps, { client_id, door, grant_id: null, by: 'consent' });
308
+ } catch {
309
+ console.error('[emet] bound door listing was not written');
310
+ }
301
311
  }
302
312
  }
303
313
  const u = new URL(redirect_uri);
@@ -340,7 +350,7 @@ if (process.env.EMET_HTTP_LISTEN !== '0') (async () => {
340
350
  await runStartupChecks(dbManager.db, { prefix: provider.prefix, log: (line) => console.error(line) });
341
351
  }
342
352
  } catch {
343
- console.error('[emet] OWL RETIREMENT CHECK FAILED account=user-EMET--owl active=unknown rung=R6 pointer=/owner/chooser');
353
+ console.error(owlRetirementFailureLine());
344
354
  }
345
355
  try {
346
356
  const { proofStartupLine } = await import('./proof-run.js');
package/src/index.js CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
27
27
  import { setting } from './env.js';
28
- import { toolCallAuditDetails } from './grants.js';
28
+ import { owlRetirementFailureLine, toolCallAuditDetails } from './grants.js';
29
29
  import { redactText } from './redact.js';
30
30
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
31
31
  import {
@@ -267,7 +267,7 @@ async function main() {
267
267
  const { runStartupChecks } = await import('./owl.js');
268
268
  await runStartupChecks(dbManager.db, { log: (line) => logger.error(line) });
269
269
  } catch {
270
- logger.error('[emet] OWL RETIREMENT CHECK FAILED account=user-EMET--owl active=unknown rung=R6 pointer=/owner/chooser');
270
+ logger.error(owlRetirementFailureLine());
271
271
  }
272
272
  }
273
273
  try {
package/src/invites.js CHANGED
@@ -87,8 +87,8 @@ export async function createMemberAccess(db, { created_by, display_name, days =
87
87
  * A redeemed invite always gets a NEW person (multi-user report v2, defect 2,
88
88
  * 2026-10-01). Until then the guest's id was the slug of the display name the
89
89
  * invite carried, and an existing person with that slug was silently reused:
90
- * an invite named "Alex" (or "ALEX", "Aléx") redeemed as the owner, wrote as
91
- * the owner and passed the owner-only invite check. A display name is a label,
90
+ * an invite named "Member" (or "MEMBER", "Mémber") redeemed as the owner, wrote as
91
+ * the owner, and passed checks that only the owner should pass. A display name is a label,
92
92
  * not a credential, so it never selects an existing identity:
93
93
  * - the slug is a starting point; if any person already holds it, or it is a
94
94
  * reserved subject ('owner', the legacy owner subject and slugPersonId's
package/src/owl.js CHANGED
@@ -1,26 +1,25 @@
1
1
  /**
2
2
  * Owl MCP clone account (R6).
3
3
  *
4
- * The account `user-EMET--owl` was a second OAuth client so an approval
5
- * queued by one grant could be decided by another client_id. R6 retires
6
- * that role. the owner decides a new writer on /owner/chooser. Master Hub
7
- * prepares the request. The server validates it. This account does not
8
- * approve.
4
+ * A second OAuth client account (the owl clone) let an approval queued by
5
+ * one grant be decided by another client_id. R6 retires that role. The
6
+ * owner decides a new writer on /owner/chooser. The request is prepared.
7
+ * The server validates it. This account does not approve.
9
8
  *
10
9
  * ISO 9001 7.5.3 / ISO 13485 4.2.5: supersede, retire, retain. Rows are
11
10
  * not deleted. A startup check fails loudly (stderr and the owl
12
11
  * retirement metric; the process does not exit) when an owl grant is
13
12
  * active again. Rotate-all (R5) already revokes every grant; the invite step
14
13
  * skips this account so a rotation does not hand it a fresh code. This
15
- * module does not call Railway EMET and does not run a rotation.
14
+ * module does not call a hosted deployment and does not run a rotation.
16
15
  */
17
16
 
18
17
  import { COLLECTION_PREFIX } from './database.js';
19
18
  import { assignCode, newCorrelationId } from './error-codes.js';
20
- import { OWL_ACCOUNT, doorFromIssuedVia, grantIdFromFamily, logClientId, logDoor, logGrantId } from './grants.js';
19
+ import { OWL_ACCOUNT_LABEL, doorFromIssuedVia, grantIdFromFamily, isRetiredOwlAccount, logClientId, logDoor, logGrantId, owlRetirementFailureLine, owlRetirementPassLine } from './grants.js';
21
20
  import { InvalidGrantError, InvalidTokenError } from '@modelcontextprotocol/sdk/server/auth/errors.js';
22
21
 
23
- const POINTER = 'this owl MCP clone account was retired by R6. A new writer is prepared by Master Hub, validated on the server, and decided by the owner at /owner/chooser. This account cannot approve. Records are retained.';
22
+ const POINTER = 'this owl MCP clone account was retired by R6. A new writer is prepared by the hub login, validated on the server, and decided by the owner at /owner/chooser. This account cannot approve. Records are retained.';
24
23
  const MARKER_ID = 'owl-mcp-clone';
25
24
 
26
25
  const metric = {
@@ -40,7 +39,7 @@ export function _resetOwlForTests() {
40
39
  export function owlRetirementMetric() {
41
40
  return {
42
41
  rung: 'R6',
43
- account: OWL_ACCOUNT,
42
+ account: OWL_ACCOUNT_LABEL,
44
43
  status: 'retired',
45
44
  retained: true,
46
45
  deleted: false,
@@ -57,13 +56,13 @@ export function owlRetirementMetric() {
57
56
  /** Exact account identity. A substring is not a match. */
58
57
  export function isOwlIdentity(value) {
59
58
  if (value == null) return false;
60
- if (typeof value === 'string') return value === OWL_ACCOUNT;
59
+ if (typeof value === 'string') return isRetiredOwlAccount(value);
61
60
  if (typeof value !== 'object') return false;
62
61
  const fields = [
63
62
  value.clientId, value.client_id, value.sourceTag, value.source_tag,
64
63
  value.effectiveTag, value.client_name, value.clientName, value.tag
65
64
  ];
66
- return fields.some((field) => field === OWL_ACCOUNT);
65
+ return fields.some((field) => isRetiredOwlAccount(field));
67
66
  }
68
67
 
69
68
  function notRetired(doc) {
@@ -92,11 +91,12 @@ async function readAll(db, name) {
92
91
  }
93
92
 
94
93
  /**
95
- * The account id, plus any registered client whose name or id is that
96
- * account. A token may carry an opaque registration id.
94
+ * Client ids of registered OAuth clients that are the retired account.
95
+ * A token may carry only an opaque registration id. The account string
96
+ * itself is matched by isOwlIdentity and is not stored in this set.
97
97
  */
98
98
  export async function owlClientIds(db, prefix = COLLECTION_PREFIX) {
99
- const ids = new Set([OWL_ACCOUNT]);
99
+ const ids = new Set();
100
100
  const clients = await readAll(db, `${prefix}oauth_clients`);
101
101
  for (const client of clients) {
102
102
  if (client && isOwlIdentity(client) && typeof client.client_id === 'string' && client.client_id) {
@@ -141,7 +141,7 @@ export async function ensureOwlRetirementMarker(db, prefix = COLLECTION_PREFIX,
141
141
  if (existing) return existing;
142
142
  const row = {
143
143
  _id: MARKER_ID,
144
- account: OWL_ACCOUNT,
144
+ account: OWL_ACCOUNT_LABEL,
145
145
  status: 'retired',
146
146
  superseded_by: 'R6',
147
147
  rung: 'R6',
@@ -168,8 +168,8 @@ export async function owlStartupCheck(db, prefix = COLLECTION_PREFIX, now = new
168
168
  }
169
169
  const ok = !failed && active.length === 0;
170
170
  const line = ok
171
- ? `[emet] owl-retirement check=pass account=${OWL_ACCOUNT} active=0 rung=R6`
172
- : `[emet] OWL RETIREMENT CHECK FAILED account=${OWL_ACCOUNT} active=${failed ? 'unknown' : active.length} rung=R6 pointer=/owner/chooser`;
171
+ ? owlRetirementPassLine()
172
+ : owlRetirementFailureLine(failed ? 'unknown' : active.length);
173
173
  metric.ok = ok;
174
174
  metric.active = failed ? null : active.length;
175
175
  metric.last_line = line;
@@ -195,7 +195,7 @@ export async function runStartupChecks(db, { prefix = COLLECTION_PREFIX, log } =
195
195
  const owl = await owlStartupCheck(db, prefix);
196
196
  line = owl.line;
197
197
  } catch {
198
- line = `[emet] OWL RETIREMENT CHECK FAILED account=${OWL_ACCOUNT} active=unknown rung=R6 pointer=/owner/chooser`;
198
+ line = owlRetirementFailureLine();
199
199
  }
200
200
  write(line);
201
201
  return { line, exited: false };
@@ -29,7 +29,7 @@ function retired(req, res) {
29
29
 
30
30
  /**
31
31
  * @param {import('express').Express} app
32
- * @param {object} [_options] kept so the Railway EMET mount stays the same call.
32
+ * @param {object} [_options] kept so a hosted deployment mount stays the same call.
33
33
  */
34
34
  export function mountOwnerApprovals(app, _options = {}) {
35
35
  app.get('/owner/approvals', retired);
package/src/proof-run.js CHANGED
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * Operational metric for this process, in the same family as the owl
5
5
  * retirement and rotate-all lines. The controlled record is the proof pack
6
- * under docs/proof/R7/ in the EMET-private repo. This module does not write
6
+ * under docs/proof/R7/ in the private operator repository. This module does not write
7
7
  * the memory store, does not mint a grant, and does not rotate credentials.
8
- * A fresh process reports not_run. Railway EMET therefore reports not_run
8
+ * A fresh process reports not_run. A hosted deployment therefore reports not_run
9
9
  * until a harness run is recorded in that process.
10
10
  *
11
11
  * ISO 9001 7.5.3 / ISO 13485 4.2.5: a later run does not delete an earlier
package/src/rotate.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * inside this generation or marked superseded. Fresh invites are new rows.
10
10
  * An old grant is never made live again.
11
11
  *
12
- * Railway EMET checks the generation on the next token request. This module
12
+ * A hosted deployment checks the generation on the next token request. This module
13
13
  * does not call a deploy target.
14
14
  */
15
15
 
@@ -3,7 +3,7 @@
3
3
  * board board 120, design the staging note; the practice is
4
4
  * docs/GUARDRAILS-AND-MONORAILS.md).
5
5
  *
6
- * Alex: "guardrails give a field of movement and execution to allow an AI to do
6
+ * the owner: "guardrails give a field of movement and execution to allow an AI to do
7
7
  * processes where rails guide the AI through a process flow without it
8
8
  * processing" (semantic ref 297). The floor, the character and the served
9
9
  * instructions are the guardrails. This file is the monorail - the car cannot
@@ -72,14 +72,14 @@ export const BOARD_DOC = 'STATE.md';
72
72
 
73
73
  /**
74
74
  * Per-bot close records (C1, 2026-10-01; review note "C1: per-bot close
75
- * records", Alex's decisions 1-7). The rule, stated once: a session written
75
+ * records", the owner's decisions 1-7). The rule, stated once: a session written
76
76
  * under a bot's source tag closes against that bot's own records
77
77
  * (bots/<tag>/HANDOFF.md); only that tag's own revisions in the session window
78
78
  * count; a bot tag never writes or cites the main HANDOFF.md or STATE.md.
79
79
  *
80
80
  * A tag T is a BOT TAG when bots/T/HANDOFF.md is listed in EMET_RECORD_DOCS,
81
81
  * the list that already marks ids as supersede-only records (tools.js
82
- * recordDocIds). No new setting: Alex adds one id per bot, and removing it
82
+ * recordDocIds). No new setting: the owner adds one id per bot, and removing it
83
83
  * puts that tag back on the host rules. Bot records are named by the source
84
84
  * tag itself (decision 1), so no tag-to-name mapping exists. These are pure
85
85
  * reads of settings - no database - so the graph can key its bot-handoff gate
@@ -361,7 +361,7 @@ export async function isSessionClosed(base, dbManager) {
361
361
  }
362
362
 
363
363
  /**
364
- * The closing exchange (2026-10-01, Alex's decision). In the closing turn the
364
+ * The closing exchange (2026-10-01, the owner's decision). In the closing turn the
365
365
  * assistant writes the handoff, gets `complete` from emet_session_close, and
366
366
  * only then replies - so the append of that last exchange always arrives
367
367
  * after the close. A closed session therefore takes exactly ONE more append:
@@ -786,7 +786,7 @@ export async function graphBefore(tool, args, dbManager, now = new Date()) {
786
786
  }
787
787
 
788
788
  // ---------------------------------------------------------------------------
789
- // Lab results (2026-09-29, Alex: "a 'lab results' location for storing the
789
+ // Lab results (2026-09-29, the owner: "a 'lab results' location for storing the
790
790
  // results in real time with time stamps so we can have a resource to look at
791
791
  // after the probationary period"). Every check the monorail makes - ok,
792
792
  // refuse, unknown (would_refuse in rows from before enforce-only) - is one timestamped row in
package/src/session.js CHANGED
@@ -355,7 +355,7 @@ export async function corroborateCoverage(db, baseId) {
355
355
  * The store check above answers "do the artifacts exist". It could not answer
356
356
  * "did the host actually do each step", and a host that skipped a step, or
357
357
  * never read the transcript back, could still walk away with `complete`
358
- * because the store happened to look fine. Alex's requirement (procedural ref 388,
358
+ * because the store happened to look fine. the owner's requirement (procedural ref 388,
359
359
  * 389, 391): the wrap steps HAVE TO BE FOLLOWED, whichever model is hosting,
360
360
  * and a skipped step blocks the close the same way a skipped opening is caught
361
361
  * at initialize.
@@ -975,7 +975,7 @@ export async function sessionClose(options = {}) {
975
975
  }
976
976
 
977
977
  // Store-level gaps make the session incomplete. Receipt problems, and a
978
- // transcript nothing independently corroborates, BLOCK it (Alex 2026-09-26,
978
+ // transcript nothing independently corroborates, BLOCK it (the owner 2026-09-26,
979
979
  // procedural ref 391: receipts required from the first deploy; the former
980
980
  // `unconfirmed` state is blocked, not passed).
981
981
  const storeMissing = [...missing];
package/src/setup.js CHANGED
@@ -250,7 +250,7 @@ export function registeredSourceTags() {
250
250
  return env.length ? [...new Set([...env, ...approvedTags()])] : env;
251
251
  }
252
252
 
253
- /** Attribution v2: the caller's real tag, not the server-wide default (Alex 2026-10-12 (c)).
253
+ /** Attribution v2: the caller's real tag, not the server-wide default (the owner 2026-10-12 (c)).
254
254
  * R2 adds the credential: grant_id (the token family) and door. Stdio has no grant. */
255
255
  export function callerAttribution() {
256
256
  const d = declaredAttribution();
@@ -335,7 +335,7 @@ export function summarizeSeed(doc_id, text, today = new Date().toISOString().sli
335
335
  }
336
336
 
337
337
  /**
338
- * One line per seed for the initialize payload (Alex, 2026-09-27, code audit
338
+ * One line per seed for the initialize payload (the owner, 2026-09-27, code audit
339
339
  * 2.3: "seeds can be one line since follow-up inquiry by the user will expand
340
340
  * it"). Before this every trigger's full test text was served - 13K characters
341
341
  * for 21 seeds with none due. The line keeps what a startup scan needs: the
@@ -876,7 +876,7 @@ export async function initialize(options = {}, hooks = {}) {
876
876
  if (late && late.length && typeof hooks.onLate === 'function') { try { hooks.onLate(late); } catch { /* recording never fails a page */ } }
877
877
  return late;
878
878
  };
879
- // Paged startup (2026-10-03, Alex approved paging; src/startup-pages.js).
879
+ // Paged startup (2026-10-03, the owner approved paging; src/startup-pages.js).
880
880
  // The full payload is built exactly as before; only its delivery changes.
881
881
  const raw = options.page;
882
882
  const wantAll = typeof raw === 'string' && raw.trim().toLowerCase() === 'all';
@@ -1130,9 +1130,9 @@ async function buildStartup(options = {}) {
1130
1130
  lessonsPending = { assessed: false, error: e && e.message ? e.message : String(e), pending: [] };
1131
1131
  }
1132
1132
 
1133
- // Stage 1 of the ref 358 startup amendment (2026-10-02; Alex's decision 2,
1133
+ // Stage 1 of the ref 358 startup amendment (2026-10-02; the owner's decision 2,
1134
1134
  // procedural ref 407: "emet_initialize is the startup doorway every bot
1135
- // calls; only first-time setup stays Alex's"). Initialize no longer creates
1135
+ // calls; only first-time setup stays the owner's"). Initialize no longer creates
1136
1136
  // the owner person: that write moved to setupComplete, the owner's
1137
1137
  // first-time setup, so initialize is read-only in every branch and matches
1138
1138
  // its annotation (annotations.js, READ) for every caller. A store with no
@@ -1168,7 +1168,7 @@ async function buildStartup(options = {}) {
1168
1168
  // and connection; the user's name does the animating.
1169
1169
  emet_line: EMET_LINE,
1170
1170
  emet_line_if_unanswered: EMET_LINE_UNANSWERED,
1171
- // 2026-09-26 Alex: prune may not drop the close-order tool. These two
1171
+ // 2026-09-26 the owner: prune may not drop the close-order tool. These two
1172
1172
  // fields MUST precede identity/character/user so a 20k host truncate
1173
1173
  // still receives them. The charter text may stay pointed; the steps may not.
1174
1174
  tools_in_force: {
@@ -1181,7 +1181,7 @@ async function buildStartup(options = {}) {
1181
1181
  'source tag on every write'
1182
1182
  ],
1183
1183
  on_wrap: ['working documents', 'episodic session record', 'board', 'verbatim transcript', 'HANDOFF last one write'],
1184
- // 2026-09-26 Alex (procedural ref 391): close is blocked without receipts.
1184
+ // 2026-09-26 the owner (procedural ref 391): close is blocked without receipts.
1185
1185
  confirm: 'emet_session_close with receipts for all four items and the handoff; say its speak lines in order; saved only when state is complete'
1186
1186
  },
1187
1187
  // Code audit 2026-09-27 (2.1): the short instructions ride up front with
@@ -1208,7 +1208,7 @@ async function buildStartup(options = {}) {
1208
1208
  ...retirementFields(installNotes)
1209
1209
  } : null,
1210
1210
  install_notes_doc_id: installDoc(),
1211
- // One line each since 2026-09-27 (Alex); the full seed is one read_doc away.
1211
+ // One line each since 2026-09-27 (the owner); the full seed is one read_doc away.
1212
1212
  seeds: seeds.map((s) => seedLine(s)),
1213
1213
  seeds_due: seeds.filter((s) => s.due && s.retired !== true).map((s) => s.doc_id),
1214
1214
  seeds_evaluated_on: today,
@@ -1354,8 +1354,8 @@ export async function setupComplete(answers = {}, logger = null, options = {}) {
1354
1354
  // guards (2026-10-02, Reviewer's stage 1 admission, conditions S1-S2):
1355
1355
  // - refused under a configured bot tag. The tag is self-declared and
1356
1356
  // emet_initialize takes no source until stage 2, so this is inert until a
1357
- // caller declares a bot tag that Alex has configured (stage 3);
1358
- // - refused on a store that is already set up unless `reissue: true` (Alex's
1357
+ // caller declares a bot tag that the owner has configured (stage 3);
1358
+ // - refused on a store that is already set up unless `reissue: true` (the owner's
1359
1359
  // answer 5): a re-run replaces the user's identity documents with new
1360
1360
  // versions, so it needs the owner's explicit word. Nothing is written
1361
1361
  // when either refusal fires.
@@ -1365,6 +1365,7 @@ export async function setupComplete(answers = {}, logger = null, options = {}) {
1365
1365
  // write the identity documents as the bot. The tag that would be written
1366
1366
  // (with its service-wide fallback) is checked too.
1367
1367
  const { isBotTag } = await import('./session-graph.js');
1368
+ const { isLegacyBoundHostSpelling } = await import('./bound-door.js');
1368
1369
  // ONE tag, used for this check and for every write below (setup's own
1369
1370
  // records name it), so the checked tag and the written tag cannot differ.
1370
1371
  const tag = String(answers.source_tag || options.source || setting('SOURCE_TAG') || 'setup').trim();
@@ -1376,6 +1377,9 @@ export async function setupComplete(answers = {}, logger = null, options = {}) {
1376
1377
  `First-time setup is the owner's: ${declared} is a bot tag. Stop and tell the user. Nothing was written.`
1377
1378
  , { code: 'EMET-CFG-009' });
1378
1379
  }
1380
+ if (declared && isLegacyBoundHostSpelling(declared)) {
1381
+ throw new ValidationError(field, 'use bound-host. Nothing was written.', { code: 'EMET-AUTH-045' });
1382
+ }
1379
1383
  }
1380
1384
  const missing = SETUP_INTERVIEW.filter(q => q.required && !String(answers[q.key] || '').trim())
1381
1385
  .map(q => q.key);
package/src/subkeys.js CHANGED
@@ -21,6 +21,8 @@ import {
21
21
  } from './attribution.js';
22
22
  import { isOwlIdentity } from './owl.js';
23
23
  import { isMasterBlasterActor } from './writer-approval.js';
24
+ import { isLegacyBoundHostSpelling } from './bound-door.js';
25
+ import { assignCode } from './error-codes.js';
24
26
  import { parseReceipts } from './session.js';
25
27
  import { storeFor, sweepFlagOffLiveSessions } from './subkey-store.js';
26
28
 
@@ -384,6 +386,7 @@ export async function requestSubkey(deps, actor, { tag } = {}, registry = [], no
384
386
  const list = registryOf(registry);
385
387
  const t = tagAllowed(tag, list);
386
388
  if (!t) throw refusal('emet_subkey_request: "tag" must be an exact member of EMET_SOURCE_TAGS. Nothing was changed.');
389
+ if (isLegacyBoundHostSpelling(t)) throw assignCode(refusal('emet_subkey_request: use bound-host. Nothing was changed.'), 'EMET-AUTH-045');
387
390
  const nonce = `${NONCE_PREFIX}${b64(32)}`;
388
391
  const key_id = hexId();
389
392
  let created = null;
@@ -432,7 +435,7 @@ export async function decideSubkeyIfPending(deps, actor, ownerId, { tag, decisio
432
435
  if (!(ownerOk || cosOk)) throw refusal(`emet_client_approve: only the owner${cosTag() ? ` or the chief of staff (${cosTag()})` : ''} may decide a sub-key. Nothing was changed.`);
433
436
  if (isOwlIdentity(actor)) throw refusal('emet_client_approve: the owl MCP clone account was retired by R6 and cannot approve. the owner decides a new writer on /owner/chooser. Nothing was changed.');
434
437
  if (decision === 'approve' && (cosOk || isMasterBlasterActor(actor)) && actor.sourceTag !== 'owner') {
435
- throw refusal('emet_client_approve: an AI cannot grant a writer. Master Hub prepares a request. the owner decides it on /owner/chooser. Nothing was changed.');
438
+ throw refusal('emet_client_approve: an AI cannot grant a writer. The hub login prepares a request. the owner decides it on /owner/chooser. Nothing was changed.');
436
439
  }
437
440
  const why = typeof reason === 'string' ? reason.trim() : '';
438
441
  const channel = typeof via === 'string' ? via.trim() : '';