instar 1.3.747 → 1.3.749

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 (85) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +136 -2
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/core/HttpLeaseTransport.d.ts +22 -0
  5. package/dist/core/HttpLeaseTransport.d.ts.map +1 -1
  6. package/dist/core/HttpLeaseTransport.js +37 -3
  7. package/dist/core/HttpLeaseTransport.js.map +1 -1
  8. package/dist/core/LeaseCoordinator.d.ts +22 -0
  9. package/dist/core/LeaseCoordinator.d.ts.map +1 -1
  10. package/dist/core/LeaseCoordinator.js +11 -0
  11. package/dist/core/LeaseCoordinator.js.map +1 -1
  12. package/dist/core/MachinePoolRegistry.d.ts +11 -0
  13. package/dist/core/MachinePoolRegistry.d.ts.map +1 -1
  14. package/dist/core/MachinePoolRegistry.js +29 -1
  15. package/dist/core/MachinePoolRegistry.js.map +1 -1
  16. package/dist/core/PeerPresencePuller.d.ts +26 -1
  17. package/dist/core/PeerPresencePuller.d.ts.map +1 -1
  18. package/dist/core/PeerPresencePuller.js +15 -1
  19. package/dist/core/PeerPresencePuller.js.map +1 -1
  20. package/dist/core/PostUpdateMigrator.d.ts +16 -0
  21. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  22. package/dist/core/PostUpdateMigrator.js +80 -5
  23. package/dist/core/PostUpdateMigrator.js.map +1 -1
  24. package/dist/core/SessionManager.d.ts.map +1 -1
  25. package/dist/core/SessionManager.js +16 -0
  26. package/dist/core/SessionManager.js.map +1 -1
  27. package/dist/core/conversationBindGate.d.ts +62 -0
  28. package/dist/core/conversationBindGate.d.ts.map +1 -0
  29. package/dist/core/conversationBindGate.js +83 -0
  30. package/dist/core/conversationBindGate.js.map +1 -0
  31. package/dist/core/devGatedFeatures.d.ts.map +1 -1
  32. package/dist/core/devGatedFeatures.js +12 -0
  33. package/dist/core/devGatedFeatures.js.map +1 -1
  34. package/dist/core/machineCoherenceAdvert.d.ts +108 -0
  35. package/dist/core/machineCoherenceAdvert.d.ts.map +1 -0
  36. package/dist/core/machineCoherenceAdvert.js +160 -0
  37. package/dist/core/machineCoherenceAdvert.js.map +1 -0
  38. package/dist/core/machineCoherenceManifest.d.ts +133 -0
  39. package/dist/core/machineCoherenceManifest.d.ts.map +1 -0
  40. package/dist/core/machineCoherenceManifest.js +293 -0
  41. package/dist/core/machineCoherenceManifest.js.map +1 -0
  42. package/dist/core/types.d.ts +21 -0
  43. package/dist/core/types.d.ts.map +1 -1
  44. package/dist/core/types.js.map +1 -1
  45. package/dist/monitoring/CommitmentTracker.d.ts.map +1 -1
  46. package/dist/monitoring/CommitmentTracker.js +4 -1
  47. package/dist/monitoring/CommitmentTracker.js.map +1 -1
  48. package/dist/monitoring/MachineCoherenceSentinel.d.ts +240 -0
  49. package/dist/monitoring/MachineCoherenceSentinel.d.ts.map +1 -0
  50. package/dist/monitoring/MachineCoherenceSentinel.js +336 -0
  51. package/dist/monitoring/MachineCoherenceSentinel.js.map +1 -0
  52. package/dist/monitoring/guardManifest.d.ts.map +1 -1
  53. package/dist/monitoring/guardManifest.js +25 -0
  54. package/dist/monitoring/guardManifest.js.map +1 -1
  55. package/dist/monitoring/machineCoherenceEpisode.d.ts +152 -0
  56. package/dist/monitoring/machineCoherenceEpisode.d.ts.map +1 -0
  57. package/dist/monitoring/machineCoherenceEpisode.js +92 -0
  58. package/dist/monitoring/machineCoherenceEpisode.js.map +1 -0
  59. package/dist/monitoring/machineCoherenceEpisodeManager.d.ts +210 -0
  60. package/dist/monitoring/machineCoherenceEpisodeManager.d.ts.map +1 -0
  61. package/dist/monitoring/machineCoherenceEpisodeManager.js +724 -0
  62. package/dist/monitoring/machineCoherenceEpisodeManager.js.map +1 -0
  63. package/dist/monitoring/machineCoherenceEvaluate.d.ts +129 -0
  64. package/dist/monitoring/machineCoherenceEvaluate.d.ts.map +1 -0
  65. package/dist/monitoring/machineCoherenceEvaluate.js +183 -0
  66. package/dist/monitoring/machineCoherenceEvaluate.js.map +1 -0
  67. package/dist/scaffold/templates.d.ts.map +1 -1
  68. package/dist/scaffold/templates.js +7 -1
  69. package/dist/scaffold/templates.js.map +1 -1
  70. package/dist/server/AgentServer.d.ts +1 -0
  71. package/dist/server/AgentServer.d.ts.map +1 -1
  72. package/dist/server/AgentServer.js +1 -0
  73. package/dist/server/AgentServer.js.map +1 -1
  74. package/dist/server/routes.d.ts +2 -1
  75. package/dist/server/routes.d.ts.map +1 -1
  76. package/dist/server/routes.js +141 -88
  77. package/dist/server/routes.js.map +1 -1
  78. package/package.json +1 -1
  79. package/src/data/builtin-manifest.json +65 -65
  80. package/src/scaffold/templates.ts +7 -1
  81. package/upgrades/{1.3.747.md → 1.3.748.md} +16 -0
  82. package/upgrades/1.3.749.md +35 -0
  83. package/upgrades/side-effects/action-claim-dryrun-audit-mkdir-fix.md +45 -0
  84. package/upgrades/side-effects/machine-coherence-guard.md +229 -0
  85. package/upgrades/side-effects/slack-followthrough-generalization.md +49 -0
@@ -0,0 +1,133 @@
1
+ /**
2
+ * machineCoherenceManifest.ts — the coherence-critical manifest (spec §3.1).
3
+ *
4
+ * A fleet-uniform, code-shipped catalog of the flags/versions whose skew across
5
+ * an agent's OWN machines silently halves a cross-machine guarantee (the F4
6
+ * incident class). The manifest ships ATOMIC with the code — every machine on
7
+ * version V evaluates the SAME set — so a key present on one side only is
8
+ * VERSION skew (already alarmed by the version dimension), never phantom flag
9
+ * skew. Spec: docs/specs/machine-coherence-guard.md §3.1/§3.3.
10
+ *
11
+ * Purity contract: this module is pure + deterministic (no I/O, no clock, no
12
+ * LLM). The evaluator (MachineCoherenceSentinel) and the advert builder both
13
+ * consume it; the manifest-size ratchet + membership-drift guard (§3.1 "N5")
14
+ * are unit tests over the exports here.
15
+ *
16
+ * Faithful elaborations of the spec's §3.1 interface sketch (documented, not
17
+ * silent — see the side-effects artifact):
18
+ * - `dryRunConfigPath?` — the spec's `resolution: 'dev-gate+dryRun'` (and the
19
+ * "(+ dryRun)" raw rows) inherently need to know WHERE the dry-run flag
20
+ * lives; the sketch omitted it. It is folded into the effective value.
21
+ * - The F4 pair (`ws13PinReplicate` + `ws13Reconcile`) is TWO independent
22
+ * entries sharing one guarantee line, so each key is compared on its own —
23
+ * strictly finer-grained than a compound row, never coarser.
24
+ */
25
+ /** How the effective value is computed. */
26
+ export type CoherenceResolution = 'raw' | 'dev-gate' | 'dev-gate+dryRun';
27
+ /** Where a manifest entry's REAL consumer reads its input from (spec §3.1 M8). */
28
+ export type CoherenceReadSource = 'boot' | 'live';
29
+ export interface CoherenceCriticalFlag {
30
+ /** Stable key, e.g. 'seamlessness.ws13PinReplicate'. */
31
+ key: string;
32
+ /** Dotted config path to the entry's input value. */
33
+ configPath: string;
34
+ /** How the effective value is computed. */
35
+ resolution: CoherenceResolution;
36
+ /**
37
+ * Dotted config path to the dry-run flag folded into the effective value.
38
+ * Present for every `dev-gate+dryRun` entry and for the "(+ dryRun)" raw
39
+ * rows. Absent → dry-run is not a dimension for this key.
40
+ */
41
+ dryRunConfigPath?: string;
42
+ /**
43
+ * Where the entry's REAL consumer reads it from (spec §3.1 M8): 'boot' = the
44
+ * boot-time config object (a change needs a restart to take effect) | 'live'
45
+ * = liveConfig (a PATCH /config changes behavior with NO restart, e.g.
46
+ * sessionPool.stage). The resolver MUST read each entry the way its real
47
+ * consumer does, or the advert lies about effective behavior.
48
+ */
49
+ readSource: CoherenceReadSource;
50
+ /** One line: the cross-machine guarantee a mixed pool halves (alarm body). */
51
+ guarantee: string;
52
+ }
53
+ /**
54
+ * The 7 WS2 replicated stores whose per-store `enabled` (+ dryRun) is
55
+ * coherence-critical (replicated-memory reach: a non-advertising peer silently
56
+ * drops the kind). Shipped as a CODE constant, NOT config-derived, so the
57
+ * manifest is fleet-uniform (a fleet config with no stateSync block still
58
+ * carries all 7 rows — same set on every machine at version V).
59
+ */
60
+ export declare const COHERENCE_STATE_SYNC_STORES: readonly ["preferences", "relationships", "learnings", "knowledge", "evolutionActions", "userRegistry", "topicOperator"];
61
+ /**
62
+ * COHERENCE_CRITICAL_FLAGS — the manifest (spec §3.1 table). Fleet-uniform,
63
+ * code-shipped. Order is stable (drives manifestHash determinism after sort).
64
+ */
65
+ export declare const COHERENCE_CRITICAL_FLAGS: CoherenceCriticalFlag[];
66
+ /**
67
+ * Explicit membership-exclusion list (spec §3.1 "N5" membership drift guard):
68
+ * every `multiMachine.*` DEV_GATED_FEATURES entry not in the manifest must be
69
+ * named here with a one-line reason. Adding a new coherence-relevant dev-gated
70
+ * flag without a manifest decision fails the drift-guard build test — the F4
71
+ * class cannot be silently re-created for future flags.
72
+ */
73
+ export interface CoherenceManifestExclusion {
74
+ configPath: string;
75
+ reason: string;
76
+ }
77
+ export declare const COHERENCE_MANIFEST_EXCLUSIONS: CoherenceManifestExclusion[];
78
+ export declare const MC_MAX_ENTRIES = 64;
79
+ export declare const MC_KEY_MAX = 64;
80
+ export declare const MC_VALUE_MAX = 32;
81
+ /** fixed-fields + flags portion of the advert, serialized. */
82
+ export declare const MC_FLAGS_BYTES_MAX = 2048;
83
+ /** the §3.2 alarm marker sub-budget. */
84
+ export declare const MC_MARKER_BYTES_MAX = 1536;
85
+ /** whole coherenceAdvert block. */
86
+ export declare const MC_BLOCK_BYTES_MAX = 3584;
87
+ /** alarm marker rowIdentityHashes clamp (>= any ratchet-passing manifest's row count). */
88
+ export declare const MC_MARKER_ROWS_MAX = 72;
89
+ /** per-row identity hash length (truncated, hex). */
90
+ export declare const MC_ROW_HASH_LEN = 16;
91
+ /** Effective-value alphabet for a clamped scalar (spec §3.1/M4/R5-N3). */
92
+ export declare const MC_VALUE_ALPHABET: RegExp;
93
+ /** instarVersion alphabet (spec §3.2 M4 receive clamp). */
94
+ export declare const MC_VERSION_ALPHABET: RegExp;
95
+ /** manifestHash: 64 lowercase hex. */
96
+ export declare const MC_MANIFEST_HASH_RE: RegExp;
97
+ /** episodeId format (spec §3.2 N4). */
98
+ export declare const MC_EPISODE_ID_RE: RegExp;
99
+ /** Read a dotted config path off a plain object (undefined on any miss). */
100
+ export declare function getByPath(obj: unknown, dotted: string): unknown;
101
+ /** The config view the resolver reads: a boot config object + optional live getter. */
102
+ export interface CoherenceConfigView {
103
+ /** The full boot-time agent config object. */
104
+ boot: Record<string, unknown>;
105
+ /**
106
+ * Optional live-config getter (liveConfig.get(path, fallback)). Used for
107
+ * `readSource: 'live'` entries so a PATCH /config change is reflected with no
108
+ * restart. Absent → live entries fall back to the boot value.
109
+ */
110
+ liveGet?: (path: string, fallback: unknown) => unknown;
111
+ }
112
+ /**
113
+ * Resolve one manifest entry's effective value against a config view.
114
+ * Deterministic; identical across two machines on the same manifest generation.
115
+ * Returns a clamped scalar string ('live' | 'dry-run' | 'off' | a stage class).
116
+ */
117
+ export declare function resolveFlagValue(entry: CoherenceCriticalFlag, view: CoherenceConfigView): string;
118
+ /**
119
+ * Build the manifest-resolved effective-value map (advert `flags`). Keys are the
120
+ * manifest keys, values clamped scalars. Deterministic + pure.
121
+ */
122
+ export declare function buildCoherenceFlags(view: CoherenceConfigView): Record<string, string>;
123
+ /**
124
+ * Compute the manifest hash — sha256 over the sorted ENTRIES (key + resolution
125
+ * + readSource), NOT just the key list (spec §3.1 M7: two builds can share keys
126
+ * but differ in resolution semantics). Lowercase hex, 64 chars.
127
+ */
128
+ export declare function computeManifestHash(flags?: CoherenceCriticalFlag[]): string;
129
+ /** The manifest hash for THIS build's shipped manifest (memoized-safe, pure). */
130
+ export declare function selfManifestHash(): string;
131
+ /** Protocol version this build advertises (mirrors the seamlessness layer). */
132
+ export declare function selfProtocolVersion(): number;
133
+ //# sourceMappingURL=machineCoherenceManifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machineCoherenceManifest.d.ts","sourceRoot":"","sources":["../../src/core/machineCoherenceManifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,2CAA2C;AAC3C,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AAC5D,sCAAsC;AACtC,eAAO,MAAM,mBAAmB,QAAmB,CAAC;AACpD,uCAAuC;AACvC,eAAO,MAAM,gBAAgB,QAAkB,CAAC;AAEhD,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAQ/D;AAED,uFAAuF;AACvF,MAAM,WAAW,mBAAmB;IAClC,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC;CACxD;AAOD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAuDhG;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMrF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,qBAAqB,EAA6B,GAAG,MAAM,CAMrG;AAED,iFAAiF;AACjF,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
@@ -0,0 +1,293 @@
1
+ /**
2
+ * machineCoherenceManifest.ts — the coherence-critical manifest (spec §3.1).
3
+ *
4
+ * A fleet-uniform, code-shipped catalog of the flags/versions whose skew across
5
+ * an agent's OWN machines silently halves a cross-machine guarantee (the F4
6
+ * incident class). The manifest ships ATOMIC with the code — every machine on
7
+ * version V evaluates the SAME set — so a key present on one side only is
8
+ * VERSION skew (already alarmed by the version dimension), never phantom flag
9
+ * skew. Spec: docs/specs/machine-coherence-guard.md §3.1/§3.3.
10
+ *
11
+ * Purity contract: this module is pure + deterministic (no I/O, no clock, no
12
+ * LLM). The evaluator (MachineCoherenceSentinel) and the advert builder both
13
+ * consume it; the manifest-size ratchet + membership-drift guard (§3.1 "N5")
14
+ * are unit tests over the exports here.
15
+ *
16
+ * Faithful elaborations of the spec's §3.1 interface sketch (documented, not
17
+ * silent — see the side-effects artifact):
18
+ * - `dryRunConfigPath?` — the spec's `resolution: 'dev-gate+dryRun'` (and the
19
+ * "(+ dryRun)" raw rows) inherently need to know WHERE the dry-run flag
20
+ * lives; the sketch omitted it. It is folded into the effective value.
21
+ * - The F4 pair (`ws13PinReplicate` + `ws13Reconcile`) is TWO independent
22
+ * entries sharing one guarantee line, so each key is compared on its own —
23
+ * strictly finer-grained than a compound row, never coarser.
24
+ */
25
+ import { resolveDevAgentGate } from './devAgentGate.js';
26
+ import { SEAMLESSNESS_PROTOCOL_VERSION } from './seamlessnessConfig.js';
27
+ import crypto from 'node:crypto';
28
+ /**
29
+ * The 7 WS2 replicated stores whose per-store `enabled` (+ dryRun) is
30
+ * coherence-critical (replicated-memory reach: a non-advertising peer silently
31
+ * drops the kind). Shipped as a CODE constant, NOT config-derived, so the
32
+ * manifest is fleet-uniform (a fleet config with no stateSync block still
33
+ * carries all 7 rows — same set on every machine at version V).
34
+ */
35
+ export const COHERENCE_STATE_SYNC_STORES = [
36
+ 'preferences',
37
+ 'relationships',
38
+ 'learnings',
39
+ 'knowledge',
40
+ 'evolutionActions',
41
+ 'userRegistry',
42
+ 'topicOperator',
43
+ ];
44
+ function stateSyncEntries() {
45
+ return COHERENCE_STATE_SYNC_STORES.map((store) => ({
46
+ key: `stateSync.${store}.enabled`,
47
+ configPath: `multiMachine.stateSync.${store}.enabled`,
48
+ resolution: 'dev-gate+dryRun',
49
+ dryRunConfigPath: `multiMachine.stateSync.${store}.dryRun`,
50
+ readSource: 'boot',
51
+ guarantee: `replicated ${store} reach — a non-advertising machine silently drops this store's replicated kind`,
52
+ }));
53
+ }
54
+ /**
55
+ * COHERENCE_CRITICAL_FLAGS — the manifest (spec §3.1 table). Fleet-uniform,
56
+ * code-shipped. Order is stable (drives manifestHash determinism after sort).
57
+ */
58
+ export const COHERENCE_CRITICAL_FLAGS = [
59
+ {
60
+ key: 'seamlessness.ws13PinReplicate',
61
+ configPath: 'multiMachine.seamlessness.ws13PinReplicate',
62
+ resolution: 'dev-gate+dryRun',
63
+ dryRunConfigPath: 'multiMachine.seamlessness.ws13DryRun',
64
+ readSource: 'boot',
65
+ guarantee: 'cross-machine conversation-move actuation (the F4 pair)',
66
+ },
67
+ {
68
+ key: 'seamlessness.ws13Reconcile',
69
+ configPath: 'multiMachine.seamlessness.ws13Reconcile',
70
+ resolution: 'dev-gate+dryRun',
71
+ dryRunConfigPath: 'multiMachine.seamlessness.ws13DryRun',
72
+ readSource: 'boot',
73
+ guarantee: 'cross-machine conversation-move actuation (the F4 pair)',
74
+ },
75
+ {
76
+ key: 'seamlessness.ws43JournalLease',
77
+ configPath: 'multiMachine.seamlessness.ws43JournalLease',
78
+ resolution: 'dev-gate+dryRun',
79
+ dryRunConfigPath: 'multiMachine.seamlessness.ws43JournalLeaseDryRun',
80
+ readSource: 'boot',
81
+ guarantee: 'job-claim single-ownership (a mixed pool keeps the whole pool on the legacy bus)',
82
+ },
83
+ {
84
+ key: 'seamlessness.ws44PoolLinks',
85
+ configPath: 'multiMachine.seamlessness.ws44PoolLinks',
86
+ resolution: 'dev-gate',
87
+ readSource: 'boot',
88
+ guarantee: 'cross-machine private-view link serving',
89
+ },
90
+ {
91
+ key: 'seamlessness.ws44PoolCache',
92
+ configPath: 'multiMachine.seamlessness.ws44PoolCache',
93
+ resolution: 'dev-gate',
94
+ readSource: 'boot',
95
+ guarantee: 'pool-cache fan-out honesty (a mixed pool re-fans per surface)',
96
+ },
97
+ ...stateSyncEntries(),
98
+ {
99
+ key: 'pollFollowsLease.enabled',
100
+ configPath: 'multiMachine.pollFollowsLease.enabled',
101
+ resolution: 'raw',
102
+ dryRunConfigPath: 'multiMachine.pollFollowsLease.dryRun',
103
+ readSource: 'boot',
104
+ guarantee: 'ingress-follows-lease (the July-1 silent-loss shape)',
105
+ },
106
+ {
107
+ key: 'sessionPool.stage',
108
+ configPath: 'multiMachine.sessionPool.stage',
109
+ resolution: 'raw',
110
+ readSource: 'live',
111
+ guarantee: 'whether the pool routes real traffic at all (+ the exactlyOnceIngress default it drives)',
112
+ },
113
+ {
114
+ key: 'exactlyOnceIngress',
115
+ configPath: 'multiMachine.exactlyOnceIngress',
116
+ resolution: 'raw',
117
+ readSource: 'live',
118
+ guarantee: 'per-message dedup ledger on every machine',
119
+ },
120
+ {
121
+ key: 'meshTransport.enabled',
122
+ configPath: 'multiMachine.meshTransport.enabled',
123
+ resolution: 'raw',
124
+ readSource: 'boot',
125
+ guarantee: 'multi-rope mesh reachability',
126
+ },
127
+ {
128
+ key: 'developmentAgent',
129
+ configPath: 'developmentAgent',
130
+ resolution: 'raw',
131
+ readSource: 'boot',
132
+ guarantee: 'the ROOT of the F4 class — every omitted-flag resolution flips with it',
133
+ },
134
+ {
135
+ key: 'monitoring.machineCoherence',
136
+ configPath: 'monitoring.machineCoherence.enabled',
137
+ resolution: 'dev-gate+dryRun',
138
+ dryRunConfigPath: 'monitoring.machineCoherence.dryRun',
139
+ readSource: 'boot',
140
+ guarantee: 'the machine-coherence guard itself (a half-dark pool has halved its own alarm redundancy)',
141
+ },
142
+ ];
143
+ export const COHERENCE_MANIFEST_EXCLUSIONS = [
144
+ { configPath: 'multiMachine.coherenceJournal.enabled', reason: 'content-free local lifecycle journal; a mixed pool degrades to no-journal on one side, not a data guarantee the guard owns' },
145
+ { configPath: 'multiMachine.meshTransport.recoveryProbeEnabled', reason: 'per-machine transport self-heal probe; its own U4.3 episode alarm owns its skew' },
146
+ { configPath: 'multiMachine.secretSync.enabled', reason: 'receive-only by default + per-machine sealed keys; a non-receiver simply re-enters a secret, no silent data-loss' },
147
+ { configPath: 'multiMachine.seamlessness.ws3OneVoice', reason: 'per-machine speaker-election posture; the single-negotiator lease is the coherence authority, not this flag' },
148
+ { configPath: 'multiMachine.writeAdmission.enabled', reason: 'per-machine write-admission gate (ships typed-refusal); a mixed pool degrades to the legacy standby-read-only boolean, not silent loss' },
149
+ { configPath: 'multiMachine.seamlessness.ws41DurableAck', reason: 'durable remote-ack: a non-participant degrades to today\'s in-memory ack, surfaced by its own route' },
150
+ { configPath: 'multiMachine.accountFollowMe.enabled', reason: 'account/quota metadata projection; operator-mandate-gated per machine, not a silent guarantee' },
151
+ { configPath: 'multiMachine.seamlessness.ws43RoleGuard', reason: 'spawn-boundary role re-check; a non-participant keeps today\'s behavior, raises its own deduped item' },
152
+ { configPath: 'multiMachine.durableOwnership.enabled', reason: 'per-machine durable-ownership record; ownership placement has its own coherence surface' },
153
+ { configPath: 'multiMachine.ownershipFollowsLiveWork', reason: 'placement heuristic; per-machine, no cross-machine data-loss guarantee' },
154
+ { configPath: 'multiMachine.sessionPool.staleOwnerRelease.enabled', reason: 'failover reconciler; its own /pool/stale-owner-release telemetry owns its state' },
155
+ { configPath: 'multiMachine.sessionPool.enabled', reason: 'legacy pool gate; sessionPool.stage (in manifest) is the coherence-relevant routing key' },
156
+ { configPath: 'multiMachine.sessionPool.inboundQueue.enabled', reason: 'per-machine durable inbound queue; its own /pool/queue loss-notices surface skew' },
157
+ { configPath: 'multiMachine.sessionPool.holdForStability.enabled', reason: 'per-machine hold policy; trails inboundQueue by one rung, no cross-machine data guarantee' },
158
+ { configPath: 'multiMachine.sessionPool.ownershipCheckedSpawn.enabled', reason: 'per-machine spawn ownership check; no silent cross-machine guarantee' },
159
+ { configPath: 'multiMachine.leaseSelfHeal.staleHolderTakeover.enabled', reason: 'lease self-heal reconciler; the lease/split-brain machinery owns its coherence' },
160
+ { configPath: 'multiMachine.leaseSelfHeal.silentStandbyRelinquish.enabled', reason: 'lease self-heal reconciler; lease-layer owned' },
161
+ { configPath: 'multiMachine.leaseSelfHeal.soloCaptainHold.enabled', reason: 'lease self-heal reconciler; lease-layer owned' },
162
+ { configPath: 'multiMachine.leaseSelfHeal.preferredCaptainHandback.enabled', reason: 'lease self-heal reconciler; lease-layer owned + operator latch' },
163
+ { configPath: 'multiMachine.stateSync.threadlinePairing.enabled', reason: 'verified-pairing store; a non-participant fails-closed on credential share (its own gate), not a silent memory-reach loss like the 7 WS2 stores' },
164
+ ];
165
+ // ─── Clamp + byte bounds (spec §3.1) ─────────────────────────────────────
166
+ export const MC_MAX_ENTRIES = 64;
167
+ export const MC_KEY_MAX = 64;
168
+ export const MC_VALUE_MAX = 32;
169
+ /** fixed-fields + flags portion of the advert, serialized. */
170
+ export const MC_FLAGS_BYTES_MAX = 2048;
171
+ /** the §3.2 alarm marker sub-budget. */
172
+ export const MC_MARKER_BYTES_MAX = 1536;
173
+ /** whole coherenceAdvert block. */
174
+ export const MC_BLOCK_BYTES_MAX = 3584;
175
+ /** alarm marker rowIdentityHashes clamp (>= any ratchet-passing manifest's row count). */
176
+ export const MC_MARKER_ROWS_MAX = 72;
177
+ /** per-row identity hash length (truncated, hex). */
178
+ export const MC_ROW_HASH_LEN = 16;
179
+ /** Effective-value alphabet for a clamped scalar (spec §3.1/M4/R5-N3). */
180
+ export const MC_VALUE_ALPHABET = /^[a-z0-9-]{1,32}$/;
181
+ /** instarVersion alphabet (spec §3.2 M4 receive clamp). */
182
+ export const MC_VERSION_ALPHABET = /^[0-9A-Za-z.+-]{1,32}$/;
183
+ /** manifestHash: 64 lowercase hex. */
184
+ export const MC_MANIFEST_HASH_RE = /^[0-9a-f]{64}$/;
185
+ /** episodeId format (spec §3.2 N4). */
186
+ export const MC_EPISODE_ID_RE = /^mc-\d{1,29}$/;
187
+ /** Read a dotted config path off a plain object (undefined on any miss). */
188
+ export function getByPath(obj, dotted) {
189
+ if (obj == null)
190
+ return undefined;
191
+ let cur = obj;
192
+ for (const seg of dotted.split('.')) {
193
+ if (cur == null || typeof cur !== 'object')
194
+ return undefined;
195
+ cur = cur[seg];
196
+ }
197
+ return cur;
198
+ }
199
+ function clampValue(v) {
200
+ const s = String(v).toLowerCase().replace(/[^a-z0-9-]/g, '-').slice(0, MC_VALUE_MAX);
201
+ return s.length ? s : 'unknown';
202
+ }
203
+ /**
204
+ * Resolve one manifest entry's effective value against a config view.
205
+ * Deterministic; identical across two machines on the same manifest generation.
206
+ * Returns a clamped scalar string ('live' | 'dry-run' | 'off' | a stage class).
207
+ */
208
+ export function resolveFlagValue(entry, view) {
209
+ const cfg = view.boot;
210
+ // Special-cased scalars (non-boolean effective values).
211
+ switch (entry.key) {
212
+ case 'developmentAgent':
213
+ return cfg?.developmentAgent === true ? 'true' : 'false';
214
+ case 'meshTransport.enabled': {
215
+ const raw = getByPath(cfg, 'multiMachine.meshTransport.enabled');
216
+ // meshTransport ships ENABLED by default (Layers 0-2 additive).
217
+ return raw === false ? 'off' : 'live';
218
+ }
219
+ case 'sessionPool.stage': {
220
+ const pool = view.liveGet
221
+ ? view.liveGet('multiMachine.sessionPool', getByPath(cfg, 'multiMachine.sessionPool'))
222
+ : getByPath(cfg, 'multiMachine.sessionPool');
223
+ const stage = pool && typeof pool.stage === 'string' ? pool.stage : 'dark';
224
+ return clampValue(stage);
225
+ }
226
+ case 'exactlyOnceIngress': {
227
+ const mm = getByPath(cfg, 'multiMachine');
228
+ const pool = view.liveGet
229
+ ? view.liveGet('multiMachine.sessionPool', getByPath(cfg, 'multiMachine.sessionPool'))
230
+ : getByPath(cfg, 'multiMachine.sessionPool');
231
+ const explicit = mm ? mm.exactlyOnceIngress : undefined;
232
+ const stage = pool && typeof pool.stage === 'string' ? pool.stage : undefined;
233
+ const resolved = typeof explicit === 'boolean'
234
+ ? explicit
235
+ : stage === 'live-transfer' || stage === 'rebalance';
236
+ return resolved ? 'live' : 'off';
237
+ }
238
+ default:
239
+ break;
240
+ }
241
+ // Boolean-fold path (raw / dev-gate / dev-gate+dryRun with an optional dryRun fold).
242
+ const rawEnabled = getByPath(cfg, entry.configPath);
243
+ let enabled;
244
+ if (entry.resolution === 'raw') {
245
+ enabled = rawEnabled === true;
246
+ }
247
+ else {
248
+ enabled = resolveDevAgentGate(typeof rawEnabled === 'boolean' ? rawEnabled : undefined, cfg);
249
+ }
250
+ if (!enabled)
251
+ return 'off';
252
+ if (entry.dryRunConfigPath) {
253
+ const dry = getByPath(cfg, entry.dryRunConfigPath);
254
+ // Convention: a dev-gated dry-run defaults TRUE (first rung); a raw dry-run
255
+ // (pollFollowsLease) defaults FALSE (live once enabled).
256
+ const dryDefault = entry.resolution !== 'raw';
257
+ const isDry = typeof dry === 'boolean' ? dry : dryDefault;
258
+ return isDry ? 'dry-run' : 'live';
259
+ }
260
+ return 'live';
261
+ }
262
+ /**
263
+ * Build the manifest-resolved effective-value map (advert `flags`). Keys are the
264
+ * manifest keys, values clamped scalars. Deterministic + pure.
265
+ */
266
+ export function buildCoherenceFlags(view) {
267
+ const out = {};
268
+ for (const entry of COHERENCE_CRITICAL_FLAGS) {
269
+ out[entry.key] = clampValue(resolveFlagValue(entry, view));
270
+ }
271
+ return out;
272
+ }
273
+ /**
274
+ * Compute the manifest hash — sha256 over the sorted ENTRIES (key + resolution
275
+ * + readSource), NOT just the key list (spec §3.1 M7: two builds can share keys
276
+ * but differ in resolution semantics). Lowercase hex, 64 chars.
277
+ */
278
+ export function computeManifestHash(flags = COHERENCE_CRITICAL_FLAGS) {
279
+ const canonical = flags
280
+ .map((f) => `${f.key}|${f.resolution}|${f.readSource}`)
281
+ .sort()
282
+ .join('\n');
283
+ return crypto.createHash('sha256').update(canonical).digest('hex');
284
+ }
285
+ /** The manifest hash for THIS build's shipped manifest (memoized-safe, pure). */
286
+ export function selfManifestHash() {
287
+ return computeManifestHash(COHERENCE_CRITICAL_FLAGS);
288
+ }
289
+ /** Protocol version this build advertises (mirrors the seamlessness layer). */
290
+ export function selfProtocolVersion() {
291
+ return SEAMLESSNESS_PROTOCOL_VERSION;
292
+ }
293
+ //# sourceMappingURL=machineCoherenceManifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machineCoherenceManifest.js","sourceRoot":"","sources":["../../src/core/mach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;AACrE,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,gBAAgB;IAC9B,OAAO,mBAAmB,CAAC,wBAAwB,CAAC,CAAC;AACvD,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,mBAAmB;IACjC,OAAO,6BAA6B,CAAC;AACvC,CAAC"}
@@ -1957,6 +1957,27 @@ export interface MachineCapacity {
1957
1957
  * restarts via the durable last-known store, so a dark peer renders with
1958
1958
  * its honest age. */
1959
1959
  guardPostureReceivedAt?: string;
1960
+ /** Machine-coherence advert (machine-coherence-guard §3.2): running version,
1961
+ * protocol version, manifest hash, the guard's own posture, and the
1962
+ * manifest-resolved effective flag values. Emission is UNCONDITIONAL (M3 —
1963
+ * ships live with the code; only the evaluator/alarm are dev-gated); absent
1964
+ * = the peer predates the guard (classified `unknown` → version-class after
1965
+ * grace). Receive side is CLAMPED (M4) — a rejected advert is replaced by
1966
+ * `coherenceAdvertRejected`, never carried forward as current posture. */
1967
+ coherenceAdvert?: import('./machineCoherenceAdvert.js').CoherenceAdvert;
1968
+ /** RECEIVER-side receipt time (ISO) of the LAST beat that actually CARRIED a
1969
+ * coherenceAdvert (M5): carry-forward must never impersonate freshness — the
1970
+ * evaluator degrades an advert older than `advertStaleMs` to `advert-stale`
1971
+ * even while liveness (`routerReceivedAt`) stays fresh via git beats. */
1972
+ coherenceAdvertReceivedAt?: string;
1973
+ /** Clamp-rejection marker (M4): set when the peer's LAST advert failed the
1974
+ * receive clamp. REPLACES the stored advert for evaluation purposes
1975
+ * (rejected ≠ absent — surfaced as `advert-rejected`, a LOUD named
1976
+ * condition, never silence); cleared by the next clean advert. */
1977
+ coherenceAdvertRejected?: {
1978
+ atMs: number;
1979
+ reason: string;
1980
+ };
1960
1981
  }
1961
1982
  /** The compact posture block that rides the capacity heartbeat
1962
1983
  * (GUARD-POSTURE-ENDPOINT-SPEC §2.3). Counts plus per-key detail for ONLY