instar 1.3.527 → 1.3.528

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 (32) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +88 -1
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  5. package/dist/config/ConfigDefaults.js +14 -0
  6. package/dist/config/ConfigDefaults.js.map +1 -1
  7. package/dist/core/CoherenceJournal.d.ts +1 -1
  8. package/dist/core/CoherenceJournal.d.ts.map +1 -1
  9. package/dist/core/CoherenceJournal.js +13 -2
  10. package/dist/core/CoherenceJournal.js.map +1 -1
  11. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  12. package/dist/core/PostUpdateMigrator.js +22 -1
  13. package/dist/core/PostUpdateMigrator.js.map +1 -1
  14. package/dist/core/RelationshipManager.d.ts +61 -1
  15. package/dist/core/RelationshipManager.d.ts.map +1 -1
  16. package/dist/core/RelationshipManager.js +86 -2
  17. package/dist/core/RelationshipManager.js.map +1 -1
  18. package/dist/core/RelationshipsReplicatedStore.d.ts +298 -0
  19. package/dist/core/RelationshipsReplicatedStore.d.ts.map +1 -0
  20. package/dist/core/RelationshipsReplicatedStore.js +660 -0
  21. package/dist/core/RelationshipsReplicatedStore.js.map +1 -0
  22. package/dist/core/devGatedFeatures.d.ts.map +1 -1
  23. package/dist/core/devGatedFeatures.js +5 -0
  24. package/dist/core/devGatedFeatures.js.map +1 -1
  25. package/dist/scaffold/templates.d.ts.map +1 -1
  26. package/dist/scaffold/templates.js +2 -1
  27. package/dist/scaffold/templates.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/data/builtin-manifest.json +19 -19
  30. package/src/scaffold/templates.ts +2 -1
  31. package/upgrades/1.3.528.md +34 -0
  32. package/upgrades/side-effects/ws23-relationships.md +150 -0
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands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WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,EAKhG,mBAAmB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,GACpD,IAAI,CA8eN;AA2lBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgmatE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
@@ -3307,6 +3307,16 @@ export async function startServer(options) {
3307
3307
  // `multiMachine.stateSync.preferences.enabled` (default false ⇒ strict no-op).
3308
3308
  const { PREF_KIND_REGISTRATION } = await import('../core/PreferencesReplicatedStore.js');
3309
3309
  replicatedKindRegistry.register(PREF_KIND_REGISTRATION);
3310
+ // WS2.3 (ws23-relationships-userregistry-security) — register the SECOND concrete
3311
+ // replicated kind, `relationship-record`, onto the registry: the FIRST PII kind.
3312
+ // Dual-registry's dynamic half (the static half is CoherenceJournal.JOURNAL_KINDS,
3313
+ // which now lists 'relationship-record'). Registration is INERT — emission/serve/
3314
+ // pull stay gated behind `multiMachine.stateSync.relationships.enabled` (default
3315
+ // false ⇒ strict no-op, NO PII ever crosses a machine boundary). With it registered,
3316
+ // selfStateSyncReceive self-reports `relationships:true` IFF the store is enabled,
3317
+ // and the rollback-unmerge resolves its contributing kind via getByStore.
3318
+ const { RELATIONSHIP_KIND_REGISTRATION } = await import('../core/RelationshipsReplicatedStore.js');
3319
+ replicatedKindRegistry.register(RELATIONSHIP_KIND_REGISTRATION);
3310
3320
  // Snapshot-then-tail engine (Component 4 / build-order step 3,
3311
3321
  // multi-machine-replicated-store-foundation §6). The cache (FIXED ceiling,
3312
3322
  // §8.2 — NOT pool-scaled), the per-peer rebuild breaker (§6.3), and the engine
@@ -3417,6 +3427,54 @@ export async function startServer(options) {
3417
3427
  });
3418
3428
  // preferencesUnionReader is passed into AgentServer below (consumed by
3419
3429
  // /preferences/session-context's foundation path).
3430
+ // WS2.3 — the relationships manager handle is declared here (assigned later, at
3431
+ // its construction site) so the union-reader closures below can reference it. The
3432
+ // closures only deref it at request time (well after assignment), so the forward
3433
+ // reference is safe.
3434
+ let relationships;
3435
+ // WS2.3 — the bypass-proof union reader for the `relationships` store (REQ-M7).
3436
+ // The single funnel every replicated relationship read routes through, so no
3437
+ // caller reads a raw replica around the no-clobber rule. `loadOriginRecords`
3438
+ // materializes the OWN relationship store as the single origin today (via
3439
+ // relationshipToOriginRecord, keyed on the channel-set identity surface — the
3440
+ // local UUID is NEVER replicated); when the journal apply path lands peer
3441
+ // `relationship-record` replicas (a later rollout stage), the seam extends to read
3442
+ // those peer namespaces too. With only the own origin the union is a strict no-op
3443
+ // (= that one local record). tierOf returns HIGH (append-both-and-flag never
3444
+ // silently clobbers two divergent people). Consulted by the relationships peer-read
3445
+ // surface ONLY when stateSync.relationships.enabled is true.
3446
+ const { relationshipTierOf, relationshipToOriginRecord, deriveRelationshipRecordKey, mergeUnionToRelationships, renderForeignRelationshipContext, RELATIONSHIP_STORE_KEY } = await import('../core/RelationshipsReplicatedStore.js');
3447
+ const relationshipsUnionReader = new ReplicatedStoreReader({
3448
+ registry: replicatedKindRegistry,
3449
+ stores: config.multiMachine?.stateSync,
3450
+ tierOf: relationshipTierOf,
3451
+ loadOriginRecords: (store, recordKey) => {
3452
+ if (store !== RELATIONSHIP_STORE_KEY || _meshSelfId === null || !relationships)
3453
+ return [];
3454
+ // Own-origin materialization: find the local record whose channel-set identity
3455
+ // surface matches this recordKey (mirrors the manager's channel-collision logic).
3456
+ for (const r of relationships.getAll()) {
3457
+ if (deriveRelationshipRecordKey(r.channels) === recordKey) {
3458
+ const o = relationshipToOriginRecord(r, _meshSelfId);
3459
+ return o ? [o] : [];
3460
+ }
3461
+ }
3462
+ return [];
3463
+ },
3464
+ listRecordKeys: (store) => {
3465
+ if (store !== RELATIONSHIP_STORE_KEY || !relationships)
3466
+ return [];
3467
+ const keys = [];
3468
+ for (const r of relationships.getAll()) {
3469
+ const k = deriveRelationshipRecordKey(r.channels);
3470
+ if (k !== null)
3471
+ keys.push(k);
3472
+ }
3473
+ return keys;
3474
+ },
3475
+ droppedOrigins: droppedOriginRegistry,
3476
+ conflictStore,
3477
+ });
3420
3478
  // Read local signing key for machine route authentication
3421
3479
  let localSigningKeyPem = '';
3422
3480
  if (coordinator.enabled && coordinator.identity) {
@@ -4197,7 +4255,6 @@ export async function startServer(options) {
4197
4255
  : 'provenance + patterns only (no LLM review)';
4198
4256
  console.log(pc.green(` Input Guard: enabled (action: ${guardConfig.action ?? 'warn'}, ${reviewBackend})`));
4199
4257
  }
4200
- let relationships;
4201
4258
  if (config.relationships) {
4202
4259
  // Wire LLM intelligence for identity resolution. Subscription path only —
4203
4260
  // direct Anthropic API is forbidden per Rule 2 of the path constraints.
@@ -4232,6 +4289,36 @@ export async function startServer(options) {
4232
4289
  relationships = new RelationshipManager(config.relationships);
4233
4290
  const count = relationships.getAll().length;
4234
4291
  console.log(pc.green(` Relationships loaded: ${count} tracked (${intelligenceMode})`));
4292
+ // WS2.3 — inject the union-read seam (REQ-M7/M14). The peer-read surface (what
4293
+ // my OTHER machines know about this person) resolves THROUGH the bypass-proof
4294
+ // union reader and returns FOREIGN, READ-ONLY, neutralized context blocks
4295
+ // (each wrapped in `<replicated-untrusted-data>`). It is DISTINCT from the
4296
+ // local-authoritative resolveByChannel/getContextForPerson — identity
4297
+ // RESOLUTION of an inbound principal stays local-only. The seam is a strict
4298
+ // no-op while `multiMachine.stateSync.relationships.enabled` is false (the reader
4299
+ // returns nothing for a disabled store), so a single-machine / dark agent sees
4300
+ // an empty peer view. The emit seam (the `put`/tombstone funnel) is wired in a
4301
+ // later rollout stage on the same machinery — registered + dark here.
4302
+ relationships.setPeerReadSeam({
4303
+ peerContextForChannels: (channels) => {
4304
+ const recordKey = deriveRelationshipRecordKey(channels);
4305
+ if (recordKey === null)
4306
+ return [];
4307
+ const result = relationshipsUnionReader.read(RELATIONSHIP_STORE_KEY, recordKey);
4308
+ const views = mergeUnionToRelationships(new Map([[recordKey, result]]));
4309
+ // Only FOREIGN origins are surfaced (the local record is already the
4310
+ // authoritative getContextForPerson answer); render each as untrusted data.
4311
+ const out = [];
4312
+ for (const v of views) {
4313
+ if (v.origin === _meshSelfId)
4314
+ continue;
4315
+ const block = renderForeignRelationshipContext(v);
4316
+ if (block)
4317
+ out.push(block);
4318
+ }
4319
+ return out;
4320
+ },
4321
+ });
4235
4322
  }
4236
4323
  // Set up quota tracking if enabled
4237
4324
  let quotaTracker;