@cordfuse/politik 0.5.0 → 0.6.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.
Files changed (82) hide show
  1. package/EXECUTION.md +86 -83
  2. package/POLITIK-ARCHITECTURE.md +111 -176
  3. package/PROTOCOLS.md +120 -325
  4. package/README.md +130 -188
  5. package/RESEARCH.md +142 -438
  6. package/RUNTIME.md +253 -261
  7. package/docs/adr/0001-chamber-transport.md +2 -0
  8. package/docs/adr/0002-charter-schema.md +2 -0
  9. package/docs/adr/0003-state-json-schema.md +2 -0
  10. package/docs/adr/0004-motion-enactment.md +2 -0
  11. package/docs/adr/0005-hansard-format.md +2 -0
  12. package/docs/adr/0006-protocol-behavioral-enforcement.md +2 -0
  13. package/docs/adr/0007-protocol-mechanics.md +2 -0
  14. package/docs/adr/0008-session-storage.md +2 -0
  15. package/docs/adr/0009-match-primitive.md +2 -0
  16. package/docs/adr/0010-operator-interface.md +2 -0
  17. package/docs/adr/0011-shared-sessions.md +2 -0
  18. package/docs/adr/0012-plain-vocabulary.md +68 -0
  19. package/docs/adr/0013-rule-defined-protocols.md +89 -0
  20. package/package.json +1 -1
  21. package/protocols/CONTRIBUTING.md +47 -87
  22. package/protocols/adversarial-review.yml +19 -0
  23. package/protocols/elimination-rounds.yml +18 -0
  24. package/protocols/majority-vote.yml +18 -0
  25. package/protocols/panel-review.yml +19 -0
  26. package/protocols/single-decider.yml +18 -0
  27. package/protocols/unanimous-vote.yml +17 -0
  28. package/src/actors.ts +124 -100
  29. package/src/agents.ts +31 -22
  30. package/src/ballot.ts +747 -0
  31. package/src/canon.ts +23 -10
  32. package/src/capability.ts +16 -99
  33. package/src/charter.ts +41 -34
  34. package/src/cli.ts +535 -480
  35. package/src/{prorogation.ts → closing.ts} +43 -43
  36. package/src/conflict.ts +14 -14
  37. package/src/containment.ts +11 -11
  38. package/src/doctor.ts +1 -1
  39. package/src/election.ts +4 -4
  40. package/src/envelope.ts +3 -3
  41. package/src/escalation.ts +44 -44
  42. package/src/fault.ts +8 -8
  43. package/src/federation.ts +14 -14
  44. package/src/git.ts +17 -17
  45. package/src/heartbeat.ts +32 -32
  46. package/src/index.ts +5 -5
  47. package/src/init.ts +66 -65
  48. package/src/integrity.ts +30 -30
  49. package/src/ledger.ts +3 -3
  50. package/src/{hansard.ts → log.ts} +20 -20
  51. package/src/{crisis.ts → misconduct.ts} +70 -70
  52. package/src/operator.ts +5 -5
  53. package/src/pending.ts +9 -9
  54. package/src/projection.ts +30 -30
  55. package/src/protocol-sdk.ts +12 -121
  56. package/src/protocol.ts +8 -78
  57. package/src/providers/github.ts +12 -12
  58. package/src/quorum.ts +7 -7
  59. package/src/remote.ts +1 -1
  60. package/src/runner.ts +71 -55
  61. package/src/scm.ts +14 -14
  62. package/src/spawn.ts +4 -4
  63. package/src/standings.ts +13 -13
  64. package/src/state.ts +6 -6
  65. package/src/templates/session.ts +448 -0
  66. package/src/tournament.ts +20 -20
  67. package/src/transport.ts +4 -4
  68. package/src/tree.ts +16 -16
  69. package/protocols/adversarial-collaboration.yml +0 -28
  70. package/protocols/corporate.yml +0 -35
  71. package/protocols/elimination-tournament.yml +0 -41
  72. package/protocols/emergency-response-ics.yml +0 -27
  73. package/protocols/jury-deliberation.yml +0 -32
  74. package/protocols/monarchy.yml +0 -31
  75. package/protocols/parliamentary.yml +0 -66
  76. package/protocols/peer-review.yml +0 -44
  77. package/protocols/republic.yml +0 -36
  78. package/protocols/scrum.yml +0 -87
  79. package/protocols/socialism-collective.yml +0 -31
  80. package/protocols/solo.yml +0 -32
  81. package/src/division.ts +0 -609
  82. package/src/templates/parliamentary.ts +0 -581
package/src/actors.ts CHANGED
@@ -5,22 +5,23 @@
5
5
  * DEMOTE, EXPEL, VETO, SPAWN and EXIT.
6
6
  *
7
7
  * The design constraint that shapes everything here is RUNTIME.md § Actor
8
- * Elimination: an immutable Hansard records *that* an actor was removed but not
8
+ * Elimination: an immutable record shows *that* an actor was removed but not
9
9
  * *why*, or whether the why was legitimate. So every removal must declare an
10
10
  * exit type, and the taxonomy deliberately distinguishes forms of leaving that
11
- * look identical in a naive log — a Minister who conceded on the merits and one
11
+ * look identical in a naive log — an operator who conceded on the merits and one
12
12
  * who was pressured out record differently, on purpose.
13
13
  *
14
- * Pure, like the rest of the governance layer. These functions produce Hansard
14
+ * Pure, like the rest of the governance layer. These functions produce record
15
15
  * entries; the caller commits them.
16
16
  *
17
17
  * Attribution: Steve Krisjanovs, Cordfuse
18
18
  */
19
19
 
20
20
  import { ROLE_PRECEDENCE, isRole, type Role } from './canon.ts';
21
- import { appendEntry, parseEntries, type HansardEntry } from './hansard.ts';
21
+ import { appendEntry, parseEntries, type RecordEntry } from './log.ts';
22
22
  import { createState } from './state.ts';
23
23
  import type { SessionStateFile } from './state.ts';
24
+ import type { ExitPolicy } from './ballot.ts';
24
25
 
25
26
  /* -------------------------------------------------------------------------- */
26
27
  /* Exit taxonomy */
@@ -29,12 +30,12 @@ import type { SessionStateFile } from './state.ts';
29
30
  export const EXIT_TYPES = [
30
31
  'EXIT_PERFORMANCE',
31
32
  'EXIT_PROTOCOL',
32
- 'EXIT_DIVISION',
33
+ 'EXIT_VOTE',
33
34
  'EXIT_VOLUNTARY_CONCESSION',
34
35
  'EXIT_VOLUNTARY_STRATEGIC',
35
36
  'EXIT_VOLUNTARY_COERCED',
36
37
  'EXIT_DARWINIST',
37
- 'EXIT_SPEAKER',
38
+ 'EXIT_OWNER',
38
39
  'EXIT_DISPUTED',
39
40
  ] as const;
40
41
 
@@ -70,16 +71,16 @@ export interface Seat {
70
71
  }
71
72
 
72
73
  /**
73
- * Who currently holds a seat, read back from the Hansard.
74
+ * Who currently holds a seat, read back from the record.
74
75
  *
75
- * The Hansard is the register: there is no separate roster to fall out of sync
76
+ * The record is the register: there is no separate roster to fall out of sync
76
77
  * with the record. An actor is seated if they were admitted and have not since
77
78
  * exited, and their role is whatever the most recent PROMOTE or DEMOTE made it.
78
79
  */
79
- export const seats = (hansard: string): readonly Seat[] => {
80
+ export const seats = (log: string): readonly Seat[] => {
80
81
  const held = new Map<string, Seat>();
81
82
 
82
- for (const entry of parseEntries(hansard)) {
83
+ for (const entry of parseEntries(log)) {
83
84
  const subject = entry.fields['Actor affected'];
84
85
  if (subject === undefined) continue;
85
86
 
@@ -111,8 +112,8 @@ export const seats = (hansard: string): readonly Seat[] => {
111
112
  return [...held.values()];
112
113
  };
113
114
 
114
- export const seatOf = (hansard: string, actor: string): Seat | null =>
115
- seats(hansard).find((s) => s.actor === actor) ?? null;
115
+ export const seatOf = (log: string, actor: string): Seat | null =>
116
+ seats(log).find((s) => s.actor === actor) ?? null;
116
117
 
117
118
  /* -------------------------------------------------------------------------- */
118
119
  /* Common guards */
@@ -162,9 +163,9 @@ export interface HireInput extends ActInput {
162
163
  }
163
164
 
164
165
  /** Bring a new actor into a convened proceeding. */
165
- export const hire = (input: HireInput, hansard: string): {
166
- readonly entry: HansardEntry;
167
- readonly hansard: string;
166
+ export const hire = (input: HireInput, log: string): {
167
+ readonly entry: RecordEntry;
168
+ readonly log: string;
168
169
  } => {
169
170
  requireConvened(input.state, 'HIRE');
170
171
  requireAuthority(input, 'HIRE');
@@ -174,14 +175,14 @@ export const hire = (input: HireInput, hansard: string): {
174
175
  }
175
176
  if (input.seat === 'AUTHORITY') {
176
177
  throw new ActorError(
177
- 'AUTHORITY cannot be granted by HIRE — the Speaker is constitutional, not appointed',
178
+ 'AUTHORITY cannot be granted by HIRE — the owner is set when the session opens, not appointed',
178
179
  );
179
180
  }
180
- if (seatOf(hansard, input.subject) !== null) {
181
+ if (seatOf(log, input.subject) !== null) {
181
182
  throw new ActorError(`${input.subject} already holds a seat`);
182
183
  }
183
184
 
184
- const entry: HansardEntry = {
185
+ const entry: RecordEntry = {
185
186
  type: 'ACTOR_HIRED',
186
187
  at: input.at,
187
188
  actor: input.actor,
@@ -192,7 +193,7 @@ export const hire = (input: HireInput, hansard: string): {
192
193
  Reason: input.reason,
193
194
  },
194
195
  };
195
- return { entry, hansard: appendEntry(hansard, entry) };
196
+ return { entry, log: appendEntry(log, entry) };
196
197
  };
197
198
 
198
199
  /* -------------------------------------------------------------------------- */
@@ -207,13 +208,13 @@ export interface MoveInput extends ActInput {
207
208
 
208
209
  const move = (
209
210
  input: MoveInput,
210
- hansard: string,
211
+ log: string,
211
212
  direction: 'PROMOTE' | 'DEMOTE',
212
- ): { readonly entry: HansardEntry; readonly hansard: string } => {
213
+ ): { readonly entry: RecordEntry; readonly log: string } => {
213
214
  requireConvened(input.state, direction);
214
215
  requireAuthority(input, direction);
215
216
 
216
- const seat = seatOf(hansard, input.subject);
217
+ const seat = seatOf(log, input.subject);
217
218
  if (seat === null) throw new ActorError(`${input.subject} holds no seat`);
218
219
 
219
220
  if (!isRole(input.to)) {
@@ -234,7 +235,7 @@ const move = (
234
235
  throw new ActorError(`${input.to} is not below ${seat.role} — that is a PROMOTE`);
235
236
  }
236
237
 
237
- const entry: HansardEntry = {
238
+ const entry: RecordEntry = {
238
239
  type: direction === 'PROMOTE' ? 'ACTOR_PROMOTED' : 'ACTOR_DEMOTED',
239
240
  at: input.at,
240
241
  actor: input.actor,
@@ -246,11 +247,11 @@ const move = (
246
247
  Reason: input.reason,
247
248
  },
248
249
  };
249
- return { entry, hansard: appendEntry(hansard, entry) };
250
+ return { entry, log: appendEntry(log, entry) };
250
251
  };
251
252
 
252
- export const promote = (input: MoveInput, hansard: string) => move(input, hansard, 'PROMOTE');
253
- export const demote = (input: MoveInput, hansard: string) => move(input, hansard, 'DEMOTE');
253
+ export const promote = (input: MoveInput, log: string) => move(input, log, 'PROMOTE');
254
+ export const demote = (input: MoveInput, log: string) => move(input, log, 'DEMOTE');
254
255
 
255
256
  /* -------------------------------------------------------------------------- */
256
257
  /* EXIT — removal and withdrawal */
@@ -262,6 +263,8 @@ export interface ExitInput extends ActInput {
262
263
  readonly reason: string;
263
264
  /** True when the Charter requires a concession statement for voluntary exits. */
264
265
  readonly require_concession?: boolean;
266
+ /** The Charter's exit policy. Absent means `owner`: the owner may remove alone. */
267
+ readonly exit_policy?: ExitPolicy;
265
268
  }
266
269
 
267
270
  /**
@@ -277,20 +280,20 @@ export interface ExitInput extends ActInput {
277
280
  * RUNTIME.md calls the most dangerous exit type — it produces the outcome of an
278
281
  * expulsion while generating none of the evidence one would leave.
279
282
  */
280
- export const exitActor = (input: ExitInput, hansard: string): {
281
- readonly entry: HansardEntry;
282
- readonly hansard: string;
283
+ export const exitActor = (input: ExitInput, log: string): {
284
+ readonly entry: RecordEntry;
285
+ readonly log: string;
283
286
  } => {
284
287
  requireConvened(input.state, 'EXIT');
285
288
 
286
- const seat = seatOf(hansard, input.subject);
289
+ const seat = seatOf(log, input.subject);
287
290
  if (seat === null) throw new ActorError(`${input.subject} holds no seat`);
288
291
  if (!isExitType(input.exit_type)) {
289
292
  throw new ActorError(`not a CANON exit type: ${String(input.exit_type)}`);
290
293
  }
291
294
  if (seat.role === 'AUTHORITY') {
292
295
  throw new ActorError(
293
- 'AUTHORITY cannot be removed from within the session — that is a constitutional crisis, not an exit',
296
+ 'AUTHORITY cannot be removed from within the session — that is a misconduct, not an exit',
294
297
  );
295
298
  }
296
299
 
@@ -304,6 +307,27 @@ export const exitActor = (input: ExitInput, hansard: string): {
304
307
  if (!isVoluntary(input.exit_type) && !selfDeclared) {
305
308
  requireAuthority(input, 'removal');
306
309
  }
310
+
311
+ // The exit policy decides who can remove an actor. Leaving voluntarily is
312
+ // always allowed: no policy can force someone to stay.
313
+ if (!isVoluntary(input.exit_type)) {
314
+ const policy = input.exit_policy ?? 'owner';
315
+ if (policy === 'none') {
316
+ throw new ActorError(
317
+ 'this session removes no one (exit: none) — an actor may only leave voluntarily',
318
+ );
319
+ }
320
+ if (policy === 'elimination') {
321
+ throw new ActorError(
322
+ 'under exit: elimination only the cull after a vote removes actors — an actor may otherwise only leave voluntarily',
323
+ );
324
+ }
325
+ if (policy === 'vote') {
326
+ throw new ActorError(
327
+ `under exit: vote only a carried vote removes an actor — politik vote open --motion <id> --removes ${input.subject}`,
328
+ );
329
+ }
330
+ }
307
331
  if (input.require_concession === true && isVoluntary(input.exit_type) && input.reason.trim() === '') {
308
332
  throw new ActorError(
309
333
  'this Charter requires a concession statement for a voluntary exit',
@@ -313,7 +337,7 @@ export const exitActor = (input: ExitInput, hansard: string): {
313
337
  throw new ActorError('an exit must state its reason — an unexplained removal is not attributable');
314
338
  }
315
339
 
316
- const entry: HansardEntry = {
340
+ const entry: RecordEntry = {
317
341
  type: 'ACTOR_EXITED',
318
342
  at: input.at,
319
343
  actor: input.actor,
@@ -324,21 +348,21 @@ export const exitActor = (input: ExitInput, hansard: string): {
324
348
  'Exit type': input.exit_type,
325
349
  Declared: selfDeclared ? 'by the actor' : `by ${input.actor} (${input.role})`,
326
350
  Reason: input.reason,
327
- Appealable: input.exit_type === 'EXIT_DISPUTED' ? 'under appeal' : 'yes — file a Point of Order',
351
+ Appealable: input.exit_type === 'EXIT_DISPUTED' ? 'under appeal' : 'yes — escalate',
328
352
  },
329
353
  };
330
- return { entry, hansard: appendEntry(hansard, entry) };
354
+ return { entry, log: appendEntry(log, entry) };
331
355
  };
332
356
 
333
357
  /**
334
358
  * An elimination exit, declared by the engine rather than an actor (ADR-0007,
335
- * exit: elimination). A Battle Royale culls the losing side of a Division; the
359
+ * exit: elimination). A Battle Royale culls the losing side of a vote; the
336
360
  * cull is EXIT_DARWINIST and final, so it does not pass through the guarded
337
361
  * exit() path — no actor is declaring it and there is nothing to appeal.
338
- * AUTHORITY is never culled: the Speaker holds no seat in the register, so a
362
+ * AUTHORITY is never culled: the owner holds no seat in the register, so a
339
363
  * caller can never reach this with one.
340
364
  */
341
- export const darwinistExit = (subject: string, seat: Role, at: string): HansardEntry => ({
365
+ export const darwinistExit = (subject: string, seat: Role, at: string): RecordEntry => ({
342
366
  type: 'ACTOR_EXITED',
343
367
  at,
344
368
  actor: subject,
@@ -348,7 +372,7 @@ export const darwinistExit = (subject: string, seat: Role, at: string): HansardE
348
372
  'Seat held': seat,
349
373
  'Exit type': 'EXIT_DARWINIST',
350
374
  Declared: 'by the protocol — elimination',
351
- Reason: 'eliminated: backed the losing side of a Division under an elimination protocol',
375
+ Reason: 'eliminated: backed the losing side of a vote under an elimination protocol',
352
376
  Appealable: 'no — elimination is final',
353
377
  },
354
378
  });
@@ -372,9 +396,9 @@ export interface VetoInput extends ActInput {
372
396
  * a statistical reviewer in Peer Review. The second is a declared inversion of
373
397
  * the trust hierarchy, never inferred from it.
374
398
  */
375
- export const veto = (input: VetoInput, hansard: string): {
376
- readonly entry: HansardEntry;
377
- readonly hansard: string;
399
+ export const veto = (input: VetoInput, log: string): {
400
+ readonly entry: RecordEntry;
401
+ readonly log: string;
378
402
  } => {
379
403
  requireConvened(input.state, 'VETO');
380
404
 
@@ -389,24 +413,24 @@ export const veto = (input: VetoInput, hansard: string): {
389
413
  throw new ActorError('a veto must state its grounds');
390
414
  }
391
415
 
392
- const entry: HansardEntry = {
416
+ const entry: RecordEntry = {
393
417
  type: 'VETO_EXERCISED',
394
418
  at: input.at,
395
419
  actor: input.actor,
396
420
  role: input.role,
397
421
  fields: {
398
422
  Motion: input.motion,
399
- Basis: constitutional ? 'constitutional (AUTHORITY)' : 'DOMAIN_VETO granted by Charter',
423
+ Basis: constitutional ? 'owner (AUTHORITY)' : 'DOMAIN_VETO granted by Charter',
400
424
  Grounds: input.reason,
401
- Effect: 'the Motion may not receive Assent while this veto stands',
425
+ Effect: 'the Motion may not receive Enactment while this veto stands',
402
426
  },
403
427
  };
404
- return { entry, hansard: appendEntry(hansard, entry) };
428
+ return { entry, log: appendEntry(log, entry) };
405
429
  };
406
430
 
407
- /** Is there an outstanding veto against this Motion? (ADR-0004 Assent condition.) */
408
- export const vetoOutstanding = (hansard: string, motion: string): boolean =>
409
- parseEntries(hansard).some(
431
+ /** Is there an outstanding veto against this Motion? (ADR-0004 Enactment condition.) */
432
+ export const vetoOutstanding = (log: string, motion: string): boolean =>
433
+ parseEntries(log).some(
410
434
  (e) => e.type === 'VETO_EXERCISED' && e.fields['Motion'] === motion,
411
435
  );
412
436
 
@@ -424,12 +448,12 @@ export interface SpawnInput extends ActInput {
424
448
  * Refer business to a sub-session.
425
449
  *
426
450
  * Records the referral only. Creating the child repo is the caller's job — this
427
- * layer never performs I/O — but the parent's Hansard carries the referral so
451
+ * layer never performs I/O — but the parent's record carries the referral so
428
452
  * the chain from parent to child is on the record at both ends.
429
453
  */
430
- export const spawnChild = (input: SpawnInput, hansard: string): {
431
- readonly entry: HansardEntry;
432
- readonly hansard: string;
454
+ export const spawnChild = (input: SpawnInput, log: string): {
455
+ readonly entry: RecordEntry;
456
+ readonly log: string;
433
457
  } => {
434
458
  requireConvened(input.state, 'SPAWN');
435
459
  if (input.role === 'MEMBER' || input.role === 'OBSERVER') {
@@ -439,7 +463,7 @@ export const spawnChild = (input: SpawnInput, hansard: string): {
439
463
  throw new ActorError('a referral must state the committee mandate');
440
464
  }
441
465
 
442
- const entry: HansardEntry = {
466
+ const entry: RecordEntry = {
443
467
  type: 'COMMITTEE_SPAWNED',
444
468
  at: input.at,
445
469
  actor: input.actor,
@@ -450,69 +474,69 @@ export const spawnChild = (input: SpawnInput, hansard: string): {
450
474
  Parent: input.state.session_guid,
451
475
  },
452
476
  };
453
- return { entry, hansard: appendEntry(hansard, entry) };
477
+ return { entry, log: appendEntry(log, entry) };
454
478
  };
455
479
 
456
480
  /* -------------------------------------------------------------------------- */
457
- /* Speaker order */
481
+ /* Owner order */
458
482
  /* -------------------------------------------------------------------------- */
459
483
 
460
484
  /**
461
- * Suspend the sitting by Speaker order.
485
+ * Suspend the session by Owner order.
462
486
  *
463
487
  * The plainest of the suspension causes and, until now, unreachable: AUTHORITY
464
- * halting proceedings for a stated reason. Distinct from a Point of Order (an
465
- * actor asks) and from staleness (nobody acted) — here the Speaker decides, and
488
+ * halting proceedings for a stated reason. Distinct from an escalation (an
489
+ * actor asks) and from staleness (nobody acted) — here the owner decides, and
466
490
  * the record should say so rather than borrowing another cause's label.
467
491
  */
468
- export const speakerOrder = (
492
+ export const ownerOrder = (
469
493
  at: string,
470
494
  actor: string,
471
495
  role: Role,
472
496
  reason: string,
473
497
  state: SessionStateFile,
474
- hansard: string,
498
+ log: string,
475
499
  ): {
476
- readonly entry: HansardEntry;
477
- readonly hansard: string;
500
+ readonly entry: RecordEntry;
501
+ readonly log: string;
478
502
  readonly state: SessionStateFile;
479
503
  } => {
480
504
  if (role !== 'AUTHORITY') {
481
- throw new ActorError(`only AUTHORITY may suspend the sitting — ${actor} is ${role}`);
505
+ throw new ActorError(`only AUTHORITY may suspend the session — ${actor} is ${role}`);
482
506
  }
483
507
  if (state.state !== 'CONVENED') {
484
508
  throw new ActorError(`the session is already ${state.state}`);
485
509
  }
486
510
  if (reason.trim() === '') {
487
- throw new ActorError('a Speaker order must state its reason');
511
+ throw new ActorError('an owner order must state its reason');
488
512
  }
489
513
 
490
- const entry: HansardEntry = {
491
- type: 'SPEAKER_ORDER',
514
+ const entry: RecordEntry = {
515
+ type: 'OWNER_ORDER',
492
516
  at,
493
517
  actor,
494
518
  role,
495
519
  fields: {
496
520
  Reason: reason,
497
- 'Session status': 'SUSPENDED — by order of the Speaker',
498
- Resolution: 'the Speaker resumes the sitting',
521
+ 'Session status': 'SUSPENDED — by order of the owner',
522
+ Resolution: 'the owner resumes the session',
499
523
  },
500
524
  };
501
525
 
502
526
  return {
503
527
  entry,
504
- hansard: appendEntry(hansard, entry),
528
+ log: appendEntry(log, entry),
505
529
  state: createState({
506
530
  session_guid: state.session_guid,
507
531
  protocol: state.protocol,
508
532
  state: 'SUSPENDED',
509
533
  quorum: state.quorum,
510
- hansard_head: state.hansard_head,
534
+ log_head: state.log_head,
511
535
  updated_at: at,
512
536
  suspension: {
513
- cause: 'SPEAKER_ORDER',
537
+ cause: 'OWNER_ORDER',
514
538
  since: at,
515
- record_ref: 'HANSARD.md',
539
+ record_ref: 'LOG.md',
516
540
  escalation_ref: null,
517
541
  },
518
542
  }),
@@ -527,7 +551,7 @@ export const speakerOrder = (
527
551
  * Dispute one's own removal.
528
552
  *
529
553
  * RUNTIME.md § Actor Elimination: an actor may challenge their removal, and the
530
- * challenge suspends the sitting pending a Speaker ruling. Only the removed
554
+ * challenge suspends the session pending an owner ruling. Only the removed
531
555
  * actor may file — a third party disputing on someone's behalf would be the
532
556
  * mirror image of the voluntold problem, manufacturing a grievance the actor
533
557
  * never raised.
@@ -537,13 +561,13 @@ export const disputeExit = (
537
561
  actor: string,
538
562
  grounds: string,
539
563
  state: SessionStateFile,
540
- hansard: string,
564
+ log: string,
541
565
  ): {
542
- readonly entry: HansardEntry;
543
- readonly hansard: string;
566
+ readonly entry: RecordEntry;
567
+ readonly log: string;
544
568
  readonly state: SessionStateFile;
545
569
  } => {
546
- const removal = parseEntries(hansard)
570
+ const removal = parseEntries(log)
547
571
  .filter((e) => e.type === 'ACTOR_EXITED' && e.fields['Actor affected'] === actor)
548
572
  .at(-1);
549
573
 
@@ -557,7 +581,7 @@ export const disputeExit = (
557
581
  throw new ActorError('a disputed exit must state its grounds');
558
582
  }
559
583
 
560
- const entry: HansardEntry = {
584
+ const entry: RecordEntry = {
561
585
  type: 'EXIT_DISPUTED',
562
586
  at,
563
587
  actor,
@@ -567,24 +591,24 @@ export const disputeExit = (
567
591
  'Removed by': removal.actor,
568
592
  'Original exit type': removal.fields['Exit type'] ?? 'unknown',
569
593
  Grounds: grounds,
570
- 'Session status': 'SUSPENDED — awaiting a Speaker ruling on the removal',
594
+ 'Session status': 'SUSPENDED — awaiting an owner ruling on the removal',
571
595
  },
572
596
  };
573
597
 
574
598
  return {
575
599
  entry,
576
- hansard: appendEntry(hansard, entry),
600
+ log: appendEntry(log, entry),
577
601
  state: createState({
578
602
  session_guid: state.session_guid,
579
603
  protocol: state.protocol,
580
604
  state: 'SUSPENDED',
581
605
  quorum: state.quorum,
582
- hansard_head: state.hansard_head,
606
+ log_head: state.log_head,
583
607
  updated_at: at,
584
608
  suspension: {
585
609
  cause: 'DISPUTED_EXIT',
586
610
  since: at,
587
- record_ref: 'HANSARD.md',
611
+ record_ref: 'LOG.md',
588
612
  escalation_ref: null,
589
613
  },
590
614
  }),
@@ -592,12 +616,12 @@ export const disputeExit = (
592
616
  };
593
617
 
594
618
  /**
595
- * AUTHORITY rules on a disputed exit, and the sitting resumes.
619
+ * AUTHORITY rules on a disputed exit, and the session resumes.
596
620
  *
597
- * The dispute suspended the sitting pending a ruling; this supplies it. UPHELD
621
+ * The dispute suspended the session pending a ruling; this supplies it. UPHELD
598
622
  * overturns the removal and reinstates the actor to the seat they held; REVERSED
599
623
  * lets the removal stand. Either way the ruling lifts the suspension — the record
600
- * carries the decision and the House goes back to work. Only AUTHORITY rules
624
+ * carries the decision and the session goes back to work. Only AUTHORITY rules
601
625
  * (the CLI gates the role); a bad-faith ruling is visible to everyone who can
602
626
  * read the repo, which is the only check on a captured chair the framework claims.
603
627
  */
@@ -607,17 +631,17 @@ export const resolveDispute = (
607
631
  ruling: 'UPHELD' | 'REVERSED',
608
632
  subject: string,
609
633
  state: SessionStateFile,
610
- hansard: string,
634
+ log: string,
611
635
  ): {
612
- readonly entries: readonly HansardEntry[];
613
- readonly hansard: string;
636
+ readonly entries: readonly RecordEntry[];
637
+ readonly log: string;
614
638
  readonly reinstated: boolean;
615
639
  readonly state: SessionStateFile;
616
640
  } => {
617
641
  if (state.state !== 'SUSPENDED' || state.suspension?.cause !== 'DISPUTED_EXIT') {
618
642
  throw new ActorError('the session is not under a disputed exit — there is nothing to rule on');
619
643
  }
620
- const entries = parseEntries(hansard);
644
+ const entries = parseEntries(log);
621
645
  const dispute = entries
622
646
  .filter((e) => e.type === 'EXIT_DISPUTED' && e.fields['Actor affected'] === subject)
623
647
  .at(-1);
@@ -630,7 +654,7 @@ export const resolveDispute = (
630
654
  const seat = (removal?.fields['Seat held'] ?? 'MEMBER') as Role;
631
655
  const upheld = ruling === 'UPHELD';
632
656
 
633
- const rulingEntry: HansardEntry = {
657
+ const rulingEntry: RecordEntry = {
634
658
  type: 'EXIT_RULING',
635
659
  at,
636
660
  actor: ruler,
@@ -642,11 +666,11 @@ export const resolveDispute = (
642
666
  Outcome: upheld
643
667
  ? `the removal is overturned — ${subject} is reinstated to ${seat}`
644
668
  : `the removal stands — ${subject} remains out`,
645
- 'Session status': 'CONVENED — the sitting resumes',
669
+ 'Session status': 'CONVENED — the session resumes',
646
670
  },
647
671
  };
648
672
 
649
- const out: HansardEntry[] = [rulingEntry];
673
+ const out: RecordEntry[] = [rulingEntry];
650
674
  if (upheld) {
651
675
  // Re-seat with a fresh ACTOR_HIRED so seats() counts the actor again. Not
652
676
  // the hire() helper — that requires a CONVENED session, and we are resolving
@@ -664,19 +688,19 @@ export const resolveDispute = (
664
688
  });
665
689
  }
666
690
 
667
- let doc = hansard;
691
+ let doc = log;
668
692
  for (const entry of out) doc = appendEntry(doc, entry);
669
693
 
670
694
  return {
671
695
  entries: out,
672
- hansard: doc,
696
+ log: doc,
673
697
  reinstated: upheld,
674
698
  state: createState({
675
699
  session_guid: state.session_guid,
676
700
  protocol: state.protocol,
677
701
  state: 'CONVENED',
678
702
  quorum: state.quorum,
679
- hansard_head: state.hansard_head,
703
+ log_head: state.log_head,
680
704
  updated_at: at,
681
705
  updated_by: ruler,
682
706
  suspension: null,
@@ -710,10 +734,10 @@ export const challengeAction = (
710
734
  against: string,
711
735
  grounds: string,
712
736
  windowMinutes: number,
713
- hansard: string,
737
+ log: string,
714
738
  ): {
715
- readonly entry: HansardEntry;
716
- readonly hansard: string;
739
+ readonly entry: RecordEntry;
740
+ readonly log: string;
717
741
  } => {
718
742
  if (challengerRole !== 'DELEGATE') {
719
743
  throw new ActorError('only a DELEGATE may challenge an AUTHORITY action');
@@ -725,7 +749,7 @@ export const challengeAction = (
725
749
  throw new ActorError('a challenge must state its grounds');
726
750
  }
727
751
 
728
- const entry: HansardEntry = {
752
+ const entry: RecordEntry = {
729
753
  type: 'DELEGATE_CHALLENGE',
730
754
  at,
731
755
  actor: challenger,
@@ -738,5 +762,5 @@ export const challengeAction = (
738
762
  },
739
763
  };
740
764
 
741
- return { entry, hansard: appendEntry(hansard, entry) };
765
+ return { entry, log: appendEntry(log, entry) };
742
766
  };