@cordfuse/politik 0.5.0 → 0.6.1
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/EXECUTION.md +86 -83
- package/POLITIK-ARCHITECTURE.md +111 -176
- package/PROTOCOLS.md +120 -325
- package/README.md +135 -188
- package/RESEARCH.md +142 -438
- package/RUNTIME.md +254 -262
- package/docs/adr/0001-chamber-transport.md +2 -0
- package/docs/adr/0002-charter-schema.md +2 -0
- package/docs/adr/0003-state-json-schema.md +2 -0
- package/docs/adr/0004-motion-enactment.md +2 -0
- package/docs/adr/0005-hansard-format.md +2 -0
- package/docs/adr/0006-protocol-behavioral-enforcement.md +2 -0
- package/docs/adr/0007-protocol-mechanics.md +2 -0
- package/docs/adr/0008-session-storage.md +2 -0
- package/docs/adr/0009-match-primitive.md +2 -0
- package/docs/adr/0010-operator-interface.md +2 -0
- package/docs/adr/0011-shared-sessions.md +2 -0
- package/docs/adr/0012-plain-vocabulary.md +68 -0
- package/docs/adr/0013-rule-defined-protocols.md +90 -0
- package/package.json +1 -1
- package/protocols/CONTRIBUTING.md +47 -87
- package/protocols/adversarial-review.yml +19 -0
- package/protocols/elimination-rounds.yml +18 -0
- package/protocols/majority-vote.yml +18 -0
- package/protocols/panel-review.yml +19 -0
- package/protocols/single-decider.yml +18 -0
- package/protocols/unanimous-vote.yml +17 -0
- package/src/actors.ts +127 -103
- package/src/agents.ts +39 -27
- package/src/ballot.ts +747 -0
- package/src/canon.ts +23 -10
- package/src/capability.ts +16 -99
- package/src/charter.ts +41 -34
- package/src/cli.ts +535 -480
- package/src/{prorogation.ts → closing.ts} +43 -43
- package/src/conflict.ts +14 -14
- package/src/containment.ts +11 -11
- package/src/doctor.ts +1 -1
- package/src/election.ts +4 -4
- package/src/envelope.ts +3 -3
- package/src/escalation.ts +45 -45
- package/src/fault.ts +8 -8
- package/src/federation.ts +14 -14
- package/src/git.ts +17 -17
- package/src/heartbeat.ts +32 -32
- package/src/index.ts +5 -5
- package/src/init.ts +66 -65
- package/src/integrity.ts +30 -30
- package/src/ledger.ts +3 -3
- package/src/{hansard.ts → log.ts} +20 -20
- package/src/{crisis.ts → misconduct.ts} +70 -70
- package/src/operator.ts +5 -5
- package/src/pending.ts +9 -9
- package/src/projection.ts +30 -30
- package/src/protocol-sdk.ts +12 -121
- package/src/protocol.ts +8 -78
- package/src/providers/github.ts +12 -12
- package/src/quorum.ts +7 -7
- package/src/remote.ts +1 -1
- package/src/runner.ts +73 -56
- package/src/scm.ts +14 -14
- package/src/spawn.ts +4 -4
- package/src/standings.ts +13 -13
- package/src/state.ts +6 -6
- package/src/templates/session.ts +448 -0
- package/src/tournament.ts +20 -20
- package/src/transport.ts +4 -4
- package/src/tree.ts +16 -16
- package/protocols/adversarial-collaboration.yml +0 -28
- package/protocols/corporate.yml +0 -35
- package/protocols/elimination-tournament.yml +0 -41
- package/protocols/emergency-response-ics.yml +0 -27
- package/protocols/jury-deliberation.yml +0 -32
- package/protocols/monarchy.yml +0 -31
- package/protocols/parliamentary.yml +0 -66
- package/protocols/peer-review.yml +0 -44
- package/protocols/republic.yml +0 -36
- package/protocols/scrum.yml +0 -87
- package/protocols/socialism-collective.yml +0 -31
- package/protocols/solo.yml +0 -32
- package/src/division.ts +0 -609
- package/src/templates/parliamentary.ts +0 -581
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Closing — permanent close of a proceeding.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Closed means the record is sealed and the repo archived
|
|
5
5
|
* (POLITIK-ARCHITECTURE.md § Session States). It is terminal: unlike a
|
|
6
|
-
* SUSPENDED session, a
|
|
6
|
+
* SUSPENDED session, a closed one does not resume.
|
|
7
7
|
*
|
|
8
8
|
* Four triggers end a proceeding, first-one-wins (RUNTIME.md § Session
|
|
9
9
|
* Termination Conditions):
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* TERMINATE if (motions >= max_motions) -> TRIGGER_TURNS
|
|
12
12
|
* OR (now >= deadline) -> TRIGGER_DEADLINE
|
|
13
13
|
* OR (total_cost >= max_cost_usd) -> TRIGGER_COST
|
|
14
|
-
* OR (AUTHORITY issues DISSOLVE) ->
|
|
14
|
+
* OR (AUTHORITY issues DISSOLVE) -> TRIGGER_OWNER
|
|
15
15
|
*
|
|
16
|
-
* The
|
|
16
|
+
* The SESSION_CLOSED record "always names which condition triggered and the
|
|
17
17
|
* state of all other conditions at that moment", so this module evaluates every
|
|
18
18
|
* condition even once one has fired.
|
|
19
19
|
*
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import type { Role } from './canon.ts';
|
|
24
|
-
import { appendEntry } from './
|
|
24
|
+
import { appendEntry } from './log.ts';
|
|
25
25
|
import type { FileWrite } from './scm.ts';
|
|
26
26
|
import { createState, type SessionStateFile } from './state.ts';
|
|
27
27
|
import { seats } from './actors.ts';
|
|
@@ -34,7 +34,7 @@ export const TRIGGERS = [
|
|
|
34
34
|
'TRIGGER_TURNS',
|
|
35
35
|
'TRIGGER_DEADLINE',
|
|
36
36
|
'TRIGGER_COST',
|
|
37
|
-
'
|
|
37
|
+
'TRIGGER_OWNER',
|
|
38
38
|
'TRIGGER_LAST_STANDING',
|
|
39
39
|
'TRIGGER_VERDICT',
|
|
40
40
|
] as const;
|
|
@@ -43,10 +43,10 @@ export type Trigger = (typeof TRIGGERS)[number];
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* When a session ends on its own — the third protocol override point (ADR-0007).
|
|
46
|
-
* `objective` (default) ends only on an explicit
|
|
46
|
+
* `objective` (default) ends only on an explicit closing or a configured
|
|
47
47
|
* ceiling. `last-standing` ends the moment one seated actor remains — the Battle
|
|
48
48
|
* Royale terminal, checked after an elimination cull. `verdict` ends the moment a
|
|
49
|
-
*
|
|
49
|
+
* vote carries — a decision has been reached, so the Jury rises. Composed
|
|
50
50
|
* with `resolution: unanimity` it is a jury that deliberates until unanimous.
|
|
51
51
|
*/
|
|
52
52
|
export type TerminationPolicy = 'objective' | 'last-standing' | 'verdict';
|
|
@@ -62,12 +62,12 @@ export const isTerminationPolicy = (v: unknown): v is TerminationPolicy =>
|
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* Is the field down to a single survivor? Reads the seat register — AUTHORITY
|
|
65
|
-
* holds no seat, so a lone
|
|
65
|
+
* holds no seat, so a lone Owner never counts as the winner. Caller should
|
|
66
66
|
* only consult this after an elimination actually occurred, so an as-yet-unseated
|
|
67
67
|
* fresh session is not mistaken for a finished one.
|
|
68
68
|
*/
|
|
69
|
-
export const lastStanding = (
|
|
70
|
-
const remaining = seats(
|
|
69
|
+
export const lastStanding = (log: string): { readonly terminate: boolean; readonly survivor: string | null } => {
|
|
70
|
+
const remaining = seats(log);
|
|
71
71
|
return remaining.length <= 1
|
|
72
72
|
? { terminate: true, survivor: remaining[0]?.actor ?? null }
|
|
73
73
|
: { terminate: false, survivor: null };
|
|
@@ -78,7 +78,7 @@ export interface Ceilings {
|
|
|
78
78
|
readonly max_motions: number | null;
|
|
79
79
|
readonly deadline: string | null;
|
|
80
80
|
readonly max_cost_usd: number | null;
|
|
81
|
-
/**
|
|
81
|
+
/** Owner is warned before the cost ceiling — the low-fuel light. */
|
|
82
82
|
readonly cost_warning_usd?: number | null;
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -94,7 +94,7 @@ export interface ConditionState {
|
|
|
94
94
|
/** False when the ceiling is not configured. */
|
|
95
95
|
readonly configured: boolean;
|
|
96
96
|
readonly fired: boolean;
|
|
97
|
-
/** Human-readable current-vs-ceiling, for the
|
|
97
|
+
/** Human-readable current-vs-ceiling, for the SESSION_CLOSED record. */
|
|
98
98
|
readonly detail: string;
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -167,7 +167,7 @@ export const checkTermination = (
|
|
|
167
167
|
});
|
|
168
168
|
|
|
169
169
|
conditions.push({
|
|
170
|
-
trigger: '
|
|
170
|
+
trigger: 'TRIGGER_OWNER',
|
|
171
171
|
configured: true,
|
|
172
172
|
fired: dissolve,
|
|
173
173
|
detail: dissolve ? 'DISSOLVE issued by AUTHORITY' : 'no DISSOLVE issued',
|
|
@@ -188,17 +188,17 @@ export const checkTermination = (
|
|
|
188
188
|
};
|
|
189
189
|
|
|
190
190
|
/* -------------------------------------------------------------------------- */
|
|
191
|
-
/*
|
|
191
|
+
/* Closing */
|
|
192
192
|
/* -------------------------------------------------------------------------- */
|
|
193
193
|
|
|
194
|
-
export class
|
|
194
|
+
export class CloseError extends Error {
|
|
195
195
|
constructor(message: string) {
|
|
196
196
|
super(message);
|
|
197
|
-
this.name = '
|
|
197
|
+
this.name = 'CloseError';
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
export interface
|
|
201
|
+
export interface CloseInput {
|
|
202
202
|
readonly at: string;
|
|
203
203
|
readonly actor: string;
|
|
204
204
|
readonly role: Role;
|
|
@@ -212,59 +212,59 @@ export interface ProrogationInput {
|
|
|
212
212
|
readonly milestone_id?: string | null;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
export interface
|
|
215
|
+
export interface CloseResult {
|
|
216
216
|
readonly state: SessionStateFile;
|
|
217
217
|
readonly files: readonly FileWrite[];
|
|
218
|
-
readonly
|
|
218
|
+
readonly log: string;
|
|
219
219
|
/** Milestone the caller must close via ScmProvider. Null if none. */
|
|
220
220
|
readonly milestone_to_close: string | null;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
|
-
*
|
|
224
|
+
* Close a proceeding.
|
|
225
225
|
*
|
|
226
226
|
* Constraints enforced:
|
|
227
|
-
* - A
|
|
227
|
+
* - A TRIGGER_OWNER closing requires AUTHORITY. DISSOLVE is an
|
|
228
228
|
* AUTHORITY verb; the automatic triggers are the engine's and need no actor
|
|
229
229
|
* authority.
|
|
230
|
-
* - An already-
|
|
230
|
+
* - An already-closed session cannot be closed twice — the record is
|
|
231
231
|
* sealed, and a second seal would be a post-seal write.
|
|
232
|
-
* - A session in
|
|
233
|
-
* explicit that a
|
|
232
|
+
* - A session in MISCONDUCT cannot be closed. RUNTIME.md is
|
|
233
|
+
* explicit that a misconduct suspends rather than closes, precisely so a
|
|
234
234
|
* captured AUTHORITY cannot dissolve the session before evidence
|
|
235
235
|
* accumulates. The substrate must survive a premature dissolution.
|
|
236
236
|
*/
|
|
237
|
-
export const
|
|
238
|
-
input:
|
|
239
|
-
|
|
240
|
-
):
|
|
241
|
-
if (input.state.state === '
|
|
242
|
-
throw new
|
|
237
|
+
export const closeSession = (
|
|
238
|
+
input: CloseInput,
|
|
239
|
+
log: string,
|
|
240
|
+
): CloseResult => {
|
|
241
|
+
if (input.state.state === 'CLOSED') {
|
|
242
|
+
throw new CloseError('session is already closed — the record is sealed');
|
|
243
243
|
}
|
|
244
|
-
if (input.trigger === '
|
|
245
|
-
throw new
|
|
244
|
+
if (input.trigger === 'TRIGGER_OWNER' && input.role !== 'AUTHORITY') {
|
|
245
|
+
throw new CloseError(
|
|
246
246
|
`DISSOLVE is an AUTHORITY verb — ${input.actor} is ${input.role}`,
|
|
247
247
|
);
|
|
248
248
|
}
|
|
249
|
-
if (input.state.suspension?.cause === '
|
|
250
|
-
throw new
|
|
251
|
-
'a session in
|
|
249
|
+
if (input.state.suspension?.cause === 'MISCONDUCT') {
|
|
250
|
+
throw new CloseError(
|
|
251
|
+
'a session in MISCONDUCT cannot be closed — it suspends pending external review',
|
|
252
252
|
);
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const state = createState({
|
|
256
256
|
session_guid: input.state.session_guid,
|
|
257
257
|
protocol: input.state.protocol,
|
|
258
|
-
state: '
|
|
258
|
+
state: 'CLOSED',
|
|
259
259
|
quorum: input.state.quorum,
|
|
260
|
-
|
|
260
|
+
log_head: input.state.log_head,
|
|
261
261
|
updated_at: input.at,
|
|
262
262
|
suspension: null,
|
|
263
263
|
});
|
|
264
264
|
|
|
265
265
|
const fields: Record<string, string> = {
|
|
266
266
|
Trigger: input.trigger,
|
|
267
|
-
'Session status': '
|
|
267
|
+
'Session status': 'CLOSED — record sealed',
|
|
268
268
|
};
|
|
269
269
|
|
|
270
270
|
// The record names every condition, not just the one that fired.
|
|
@@ -280,7 +280,7 @@ export const prorogue = (
|
|
|
280
280
|
'# SESSION SUMMARY',
|
|
281
281
|
'',
|
|
282
282
|
`**Session:** ${input.state.session_guid}`,
|
|
283
|
-
`**
|
|
283
|
+
`**Closed:** ${input.at}`,
|
|
284
284
|
`**Trigger:** ${input.trigger}`,
|
|
285
285
|
'',
|
|
286
286
|
'---',
|
|
@@ -294,8 +294,8 @@ export const prorogue = (
|
|
|
294
294
|
return {
|
|
295
295
|
state,
|
|
296
296
|
files,
|
|
297
|
-
|
|
298
|
-
type: '
|
|
297
|
+
log: appendEntry(log, {
|
|
298
|
+
type: 'SESSION_CLOSED',
|
|
299
299
|
at: input.at,
|
|
300
300
|
actor: input.actor,
|
|
301
301
|
role: input.role,
|
package/src/conflict.ts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* CONFLICT — mechanical, routine, resolved by any actor holding WRITE.
|
|
9
9
|
* **Not a governance failure.**
|
|
10
|
-
* DEADLOCK — no valid
|
|
10
|
+
* DEADLOCK — no valid vote outcome. A governance failure.
|
|
11
11
|
*
|
|
12
12
|
* A merge conflict is an ordinary event in concurrent work. Treating it as a
|
|
13
|
-
* fault would suspend sessions for something two
|
|
13
|
+
* fault would suspend sessions for something two operators can settle between
|
|
14
14
|
* themselves, train actors to escalate routine work, and bury the genuinely
|
|
15
15
|
* undecidable cases in noise. So nothing here suspends, nothing escalates, and
|
|
16
16
|
* nothing reaches for AUTHORITY.
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { VERBS, type Role, type Verb } from './canon.ts';
|
|
26
|
-
import { appendEntry, parseEntries, type
|
|
26
|
+
import { appendEntry, parseEntries, type RecordEntry } from './log.ts';
|
|
27
27
|
|
|
28
28
|
/* -------------------------------------------------------------------------- */
|
|
29
29
|
/* Detection */
|
|
@@ -78,9 +78,9 @@ export const detectConflicts = (motions: readonly MotionFiles[]): readonly Confl
|
|
|
78
78
|
* one unit, and the conflict between them, the very overlap this detects, was
|
|
79
79
|
* lost. This is governance logic, so it lives here rather than in the CLI.
|
|
80
80
|
*/
|
|
81
|
-
export const detectRecordConflicts = (
|
|
81
|
+
export const detectRecordConflicts = (log: string): readonly Conflict[] => {
|
|
82
82
|
const touched = new Map<string, string[]>();
|
|
83
|
-
for (const entry of parseEntries(
|
|
83
|
+
for (const entry of parseEntries(log)) {
|
|
84
84
|
const files = entry.fields['Files touched'];
|
|
85
85
|
if (files === undefined || files === 'none') continue;
|
|
86
86
|
const motion = entry.fields['Motion'] ?? `${entry.actor}@${entry.at}`;
|
|
@@ -105,7 +105,7 @@ export class ConflictError extends Error {
|
|
|
105
105
|
*
|
|
106
106
|
* Any actor holding WRITE — which is the substance of the CANON entry, and the
|
|
107
107
|
* reason a conflict is not a governance event. Requiring AUTHORITY would turn
|
|
108
|
-
* every merge conflict into
|
|
108
|
+
* every merge conflict into an owner interruption.
|
|
109
109
|
*/
|
|
110
110
|
export const mayResolve = (verbs: readonly Verb[]): boolean => verbs.includes('WRITE');
|
|
111
111
|
|
|
@@ -125,7 +125,7 @@ export const conflictEntry = (
|
|
|
125
125
|
at: string,
|
|
126
126
|
actor: string,
|
|
127
127
|
role: Role,
|
|
128
|
-
):
|
|
128
|
+
): RecordEntry => ({
|
|
129
129
|
type: 'CONFLICT',
|
|
130
130
|
at,
|
|
131
131
|
actor,
|
|
@@ -160,8 +160,8 @@ export interface ResolutionInput {
|
|
|
160
160
|
*/
|
|
161
161
|
export const resolveConflict = (
|
|
162
162
|
input: ResolutionInput,
|
|
163
|
-
|
|
164
|
-
): { readonly entry:
|
|
163
|
+
log: string,
|
|
164
|
+
): { readonly entry: RecordEntry; readonly log: string } => {
|
|
165
165
|
if (!mayResolve(input.verbs)) {
|
|
166
166
|
throw new ConflictError(
|
|
167
167
|
`resolving a conflict requires WRITE — ${input.actor} (${input.role}) holds ${
|
|
@@ -176,7 +176,7 @@ export const resolveConflict = (
|
|
|
176
176
|
throw new ConflictError('a resolution must state how the conflict was settled');
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
const entry:
|
|
179
|
+
const entry: RecordEntry = {
|
|
180
180
|
type: 'CONFLICT_RESOLVED',
|
|
181
181
|
at: input.at,
|
|
182
182
|
actor: input.actor,
|
|
@@ -184,18 +184,18 @@ export const resolveConflict = (
|
|
|
184
184
|
fields: {
|
|
185
185
|
Motions: input.motions.join(', '),
|
|
186
186
|
'Resolved by': `${input.actor} (${input.role}) — holding WRITE`,
|
|
187
|
-
'
|
|
187
|
+
'Owner intervention': 'none — a conflict is not a governance failure',
|
|
188
188
|
},
|
|
189
189
|
body: input.resolution.trim(),
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
-
return { entry,
|
|
192
|
+
return { entry, log: appendEntry(log, entry) };
|
|
193
193
|
};
|
|
194
194
|
|
|
195
195
|
/** Conflicts recorded and not yet resolved. */
|
|
196
|
-
export const openConflicts = (
|
|
196
|
+
export const openConflicts = (log: string): readonly string[] => {
|
|
197
197
|
const open = new Set<string>();
|
|
198
|
-
for (const entry of parseEntries(
|
|
198
|
+
for (const entry of parseEntries(log)) {
|
|
199
199
|
const motions = entry.fields['Motions'];
|
|
200
200
|
if (motions === undefined) continue;
|
|
201
201
|
if (entry.type === 'CONFLICT') open.add(motions);
|
package/src/containment.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* POLITIK-ARCHITECTURE.md § Hard Containment Rule:
|
|
5
5
|
*
|
|
6
6
|
* Agents MAY NEVER traverse above CWD.
|
|
7
|
-
* Reading ../anything =
|
|
8
|
-
* Logged to
|
|
9
|
-
* Escalated to
|
|
7
|
+
* Reading ../anything = Charter violation
|
|
8
|
+
* Logged to record immediately
|
|
9
|
+
* Escalated to Owner automatically
|
|
10
10
|
* Session paused pending ruling
|
|
11
11
|
*
|
|
12
12
|
* ## What this module is, and what it is not
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*
|
|
25
25
|
* What is detectable after the fact is still worth having: an agent that
|
|
26
26
|
* *wrote* outside the session, or that *reports* having read above it, leaves
|
|
27
|
-
* evidence. The
|
|
27
|
+
* evidence. The record shows what happened, which is the framework's answer
|
|
28
28
|
* to most things it cannot prevent.
|
|
29
29
|
*
|
|
30
30
|
* Attribution: Steve Krisjanovs, Cordfuse
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
import { isAbsolute, relative, resolve, sep } from 'node:path';
|
|
34
34
|
|
|
35
35
|
import type { Role } from './canon.ts';
|
|
36
|
-
import type {
|
|
36
|
+
import type { RecordEntry } from './log.ts';
|
|
37
37
|
|
|
38
38
|
/* -------------------------------------------------------------------------- */
|
|
39
39
|
/* Findings */
|
|
@@ -132,16 +132,16 @@ export const checkContainment = (
|
|
|
132
132
|
* Record a containment breach.
|
|
133
133
|
*
|
|
134
134
|
* The spec is unambiguous about the consequence: logged immediately, escalated
|
|
135
|
-
* to the
|
|
135
|
+
* to the owner, session paused pending a ruling. That is the escalation
|
|
136
136
|
* flow, so the breach reuses it rather than inventing a parallel path — the
|
|
137
|
-
*
|
|
137
|
+
* Owner rules, and `politik rule` resumes.
|
|
138
138
|
*/
|
|
139
139
|
export const breachEntry = (
|
|
140
140
|
check: ContainmentCheck,
|
|
141
141
|
at: string,
|
|
142
142
|
actor: string,
|
|
143
143
|
role: Role,
|
|
144
|
-
):
|
|
144
|
+
): RecordEntry => ({
|
|
145
145
|
type: 'CONTAINMENT_BREACH',
|
|
146
146
|
at,
|
|
147
147
|
actor,
|
|
@@ -149,10 +149,10 @@ export const breachEntry = (
|
|
|
149
149
|
fields: {
|
|
150
150
|
Breaches: String(check.breaches.length),
|
|
151
151
|
Evidence: check.breaches.map((b) => `${b.kind}: ${b.evidence}`).join('; '),
|
|
152
|
-
'Session status': 'SUSPENDED — escalated to the
|
|
152
|
+
'Session status': 'SUSPENDED — escalated to the owner pending a ruling',
|
|
153
153
|
Note: 'detection, not prevention — a spawned process runs with the operating system\'s permissions',
|
|
154
154
|
},
|
|
155
155
|
body:
|
|
156
|
-
'An actor reached above the session directory.
|
|
157
|
-
'The
|
|
156
|
+
'An actor reached above the session directory. Charter forbid it. ' +
|
|
157
|
+
'The session is suspended until the owner rules.',
|
|
158
158
|
});
|
package/src/doctor.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Reports whether this host can run a Politik session, and how. Exists because
|
|
5
5
|
* the platform matrix (EXECUTION.md § Phase 6) is otherwise a list of claims
|
|
6
|
-
* nobody can reproduce —
|
|
6
|
+
* nobody can reproduce — an owner on an unknown machine should be able to ask
|
|
7
7
|
* the tool rather than trust a table written on someone else's laptop.
|
|
8
8
|
*
|
|
9
9
|
* Probing only. Nothing here mutates anything, and a failed check is reported,
|
package/src/election.ts
CHANGED
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
* otherwise race to represent the same constituency. First to acquire the
|
|
15
15
|
* lock becomes the Constituency broadcaster; the rest defer.
|
|
16
16
|
*
|
|
17
|
-
* - **Global (not this module):** "Slot claimed atomically via
|
|
18
|
-
* commit." Across machines, the
|
|
17
|
+
* - **Global (not this module):** "Slot claimed atomically via record
|
|
18
|
+
* commit." Across machines, the record is the arbiter — a commit either
|
|
19
19
|
* lands or it does not.
|
|
20
20
|
*
|
|
21
21
|
* Winning the local lock therefore grants the right to *attempt* a claim. It is
|
|
22
|
-
* not the claim. A broadcaster that wins the mutex can still lose the
|
|
22
|
+
* not the claim. A broadcaster that wins the mutex can still lose the record
|
|
23
23
|
* commit to an agent on another machine, and that is correct.
|
|
24
24
|
*
|
|
25
25
|
* Attribution: Steve Krisjanovs, Cordfuse
|
|
@@ -76,7 +76,7 @@ export const lockPath = (dir: string, sessionGuid: string, role: Role): string =
|
|
|
76
76
|
/* -------------------------------------------------------------------------- */
|
|
77
77
|
|
|
78
78
|
export type ElectionOutcome =
|
|
79
|
-
/** This agent is the Constituency broadcaster. It may attempt the
|
|
79
|
+
/** This agent is the Constituency broadcaster. It may attempt the record claim. */
|
|
80
80
|
| { readonly elected: true; readonly holder: LockHolder }
|
|
81
81
|
/** Another agent on this machine holds the constituency. */
|
|
82
82
|
| { readonly elected: false; readonly reason: 'DEFERRED'; readonly holder: LockHolder | null }
|
package/src/envelope.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* # [SESSION-GUID]
|
|
8
8
|
* ## target-actor: OPERATOR
|
|
9
9
|
* ## slots-remaining: 3
|
|
10
|
-
* ## protocol:
|
|
10
|
+
* ## protocol: majority-vote
|
|
11
11
|
* ## prompt: |
|
|
12
12
|
* Review the authentication refactor in motion-003
|
|
13
13
|
* and file your assessment as a PR review.
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* block scalar. This module implements that shape and nothing more.
|
|
18
18
|
*
|
|
19
19
|
* The envelope is an *ephemeral nudge*. Transport may drop it with no loss:
|
|
20
|
-
* the
|
|
20
|
+
* the record in the session repo is the durable, ordered truth, and peers
|
|
21
21
|
* fall back to reading the repo. Nothing here is authoritative.
|
|
22
22
|
*
|
|
23
23
|
* Attribution: Steve Krisjanovs, Cordfuse
|
|
@@ -210,7 +210,7 @@ export const serializeEnvelope = (envelope: Envelope): string => {
|
|
|
210
210
|
* target constituency, and are slots available?
|
|
211
211
|
*
|
|
212
212
|
* A true result only makes the agent *eligible*. The slot is not held until it
|
|
213
|
-
* is claimed atomically via a
|
|
213
|
+
* is claimed atomically via a record commit (step 5) — this function performs
|
|
214
214
|
* no claim and grants no exclusivity.
|
|
215
215
|
*/
|
|
216
216
|
export const isEligible = (envelope: Envelope, actorRole: Role): boolean =>
|