instar 1.3.527 → 1.3.529

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 (42) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +141 -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 +28 -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 +25 -2
  10. package/dist/core/CoherenceJournal.js.map +1 -1
  11. package/dist/core/EvolutionManager.d.ts +35 -0
  12. package/dist/core/EvolutionManager.d.ts.map +1 -1
  13. package/dist/core/EvolutionManager.js +49 -0
  14. package/dist/core/EvolutionManager.js.map +1 -1
  15. package/dist/core/LearningsReplicatedStore.d.ts +298 -0
  16. package/dist/core/LearningsReplicatedStore.d.ts.map +1 -0
  17. package/dist/core/LearningsReplicatedStore.js +574 -0
  18. package/dist/core/LearningsReplicatedStore.js.map +1 -0
  19. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  20. package/dist/core/PostUpdateMigrator.js +46 -1
  21. package/dist/core/PostUpdateMigrator.js.map +1 -1
  22. package/dist/core/RelationshipManager.d.ts +61 -1
  23. package/dist/core/RelationshipManager.d.ts.map +1 -1
  24. package/dist/core/RelationshipManager.js +86 -2
  25. package/dist/core/RelationshipManager.js.map +1 -1
  26. package/dist/core/RelationshipsReplicatedStore.d.ts +298 -0
  27. package/dist/core/RelationshipsReplicatedStore.d.ts.map +1 -0
  28. package/dist/core/RelationshipsReplicatedStore.js +660 -0
  29. package/dist/core/RelationshipsReplicatedStore.js.map +1 -0
  30. package/dist/core/devGatedFeatures.d.ts.map +1 -1
  31. package/dist/core/devGatedFeatures.js +10 -0
  32. package/dist/core/devGatedFeatures.js.map +1 -1
  33. package/dist/scaffold/templates.d.ts.map +1 -1
  34. package/dist/scaffold/templates.js +3 -1
  35. package/dist/scaffold/templates.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/data/builtin-manifest.json +20 -20
  38. package/src/scaffold/templates.ts +3 -1
  39. package/upgrades/1.3.528.md +34 -0
  40. package/upgrades/1.3.529.md +33 -0
  41. package/upgrades/side-effects/ws22-learnings.md +74 -0
  42. package/upgrades/side-effects/ws23-relationships.md +150 -0
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgCH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAS3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAuBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAiH7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAsBtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAUT;AAyID,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAm1CD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,cAAc,EAAE,cAAc,EAC9B,YAAY,CAAC,EAAE,YAAY,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,O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EAAE,OAAO,CAAC;CACpB;AAm1CD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,cAAc,EAAE,cAAc,EAC9B,YAAY,CAAC,EAAE,YAAY,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,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,CAopatE;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,27 @@ 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);
3320
+ // WS2.2 (multi-machine-replicated-store-foundation) — register the THIRD concrete
3321
+ // replicated kind, `learning-record`, onto the registry: the SECOND memory-family
3322
+ // kind (after WS2.3 relationships). Dual-registry's dynamic half (the static half is
3323
+ // CoherenceJournal.JOURNAL_KINDS, which now lists 'learning-record'). Registration is
3324
+ // INERT — emission/serve/pull stay gated behind `multiMachine.stateSync.learnings.enabled`
3325
+ // (default false ⇒ strict no-op). With it registered, selfStateSyncReceive self-reports
3326
+ // `learnings:true` IFF the store is enabled, and the rollback-unmerge resolves its
3327
+ // contributing kind via getByStore. The local LRN-NNN id is NEVER replicated — the
3328
+ // recordKey is a content fingerprint (LearningsReplicatedStore.deriveLearningRecordKey).
3329
+ const { LEARNING_KIND_REGISTRATION } = await import('../core/LearningsReplicatedStore.js');
3330
+ replicatedKindRegistry.register(LEARNING_KIND_REGISTRATION);
3310
3331
  // Snapshot-then-tail engine (Component 4 / build-order step 3,
3311
3332
  // multi-machine-replicated-store-foundation §6). The cache (FIXED ceiling,
3312
3333
  // §8.2 — NOT pool-scaled), the per-peer rebuild breaker (§6.3), and the engine
@@ -3417,6 +3438,54 @@ export async function startServer(options) {
3417
3438
  });
3418
3439
  // preferencesUnionReader is passed into AgentServer below (consumed by
3419
3440
  // /preferences/session-context's foundation path).
3441
+ // WS2.3 — the relationships manager handle is declared here (assigned later, at
3442
+ // its construction site) so the union-reader closures below can reference it. The
3443
+ // closures only deref it at request time (well after assignment), so the forward
3444
+ // reference is safe.
3445
+ let relationships;
3446
+ // WS2.3 — the bypass-proof union reader for the `relationships` store (REQ-M7).
3447
+ // The single funnel every replicated relationship read routes through, so no
3448
+ // caller reads a raw replica around the no-clobber rule. `loadOriginRecords`
3449
+ // materializes the OWN relationship store as the single origin today (via
3450
+ // relationshipToOriginRecord, keyed on the channel-set identity surface — the
3451
+ // local UUID is NEVER replicated); when the journal apply path lands peer
3452
+ // `relationship-record` replicas (a later rollout stage), the seam extends to read
3453
+ // those peer namespaces too. With only the own origin the union is a strict no-op
3454
+ // (= that one local record). tierOf returns HIGH (append-both-and-flag never
3455
+ // silently clobbers two divergent people). Consulted by the relationships peer-read
3456
+ // surface ONLY when stateSync.relationships.enabled is true.
3457
+ const { relationshipTierOf, relationshipToOriginRecord, deriveRelationshipRecordKey, mergeUnionToRelationships, renderForeignRelationshipContext, RELATIONSHIP_STORE_KEY } = await import('../core/RelationshipsReplicatedStore.js');
3458
+ const relationshipsUnionReader = new ReplicatedStoreReader({
3459
+ registry: replicatedKindRegistry,
3460
+ stores: config.multiMachine?.stateSync,
3461
+ tierOf: relationshipTierOf,
3462
+ loadOriginRecords: (store, recordKey) => {
3463
+ if (store !== RELATIONSHIP_STORE_KEY || _meshSelfId === null || !relationships)
3464
+ return [];
3465
+ // Own-origin materialization: find the local record whose channel-set identity
3466
+ // surface matches this recordKey (mirrors the manager's channel-collision logic).
3467
+ for (const r of relationships.getAll()) {
3468
+ if (deriveRelationshipRecordKey(r.channels) === recordKey) {
3469
+ const o = relationshipToOriginRecord(r, _meshSelfId);
3470
+ return o ? [o] : [];
3471
+ }
3472
+ }
3473
+ return [];
3474
+ },
3475
+ listRecordKeys: (store) => {
3476
+ if (store !== RELATIONSHIP_STORE_KEY || !relationships)
3477
+ return [];
3478
+ const keys = [];
3479
+ for (const r of relationships.getAll()) {
3480
+ const k = deriveRelationshipRecordKey(r.channels);
3481
+ if (k !== null)
3482
+ keys.push(k);
3483
+ }
3484
+ return keys;
3485
+ },
3486
+ droppedOrigins: droppedOriginRegistry,
3487
+ conflictStore,
3488
+ });
3420
3489
  // Read local signing key for machine route authentication
3421
3490
  let localSigningKeyPem = '';
3422
3491
  if (coordinator.enabled && coordinator.identity) {
@@ -4197,7 +4266,6 @@ export async function startServer(options) {
4197
4266
  : 'provenance + patterns only (no LLM review)';
4198
4267
  console.log(pc.green(` Input Guard: enabled (action: ${guardConfig.action ?? 'warn'}, ${reviewBackend})`));
4199
4268
  }
4200
- let relationships;
4201
4269
  if (config.relationships) {
4202
4270
  // Wire LLM intelligence for identity resolution. Subscription path only —
4203
4271
  // direct Anthropic API is forbidden per Rule 2 of the path constraints.
@@ -4232,6 +4300,36 @@ export async function startServer(options) {
4232
4300
  relationships = new RelationshipManager(config.relationships);
4233
4301
  const count = relationships.getAll().length;
4234
4302
  console.log(pc.green(` Relationships loaded: ${count} tracked (${intelligenceMode})`));
4303
+ // WS2.3 — inject the union-read seam (REQ-M7/M14). The peer-read surface (what
4304
+ // my OTHER machines know about this person) resolves THROUGH the bypass-proof
4305
+ // union reader and returns FOREIGN, READ-ONLY, neutralized context blocks
4306
+ // (each wrapped in `<replicated-untrusted-data>`). It is DISTINCT from the
4307
+ // local-authoritative resolveByChannel/getContextForPerson — identity
4308
+ // RESOLUTION of an inbound principal stays local-only. The seam is a strict
4309
+ // no-op while `multiMachine.stateSync.relationships.enabled` is false (the reader
4310
+ // returns nothing for a disabled store), so a single-machine / dark agent sees
4311
+ // an empty peer view. The emit seam (the `put`/tombstone funnel) is wired in a
4312
+ // later rollout stage on the same machinery — registered + dark here.
4313
+ relationships.setPeerReadSeam({
4314
+ peerContextForChannels: (channels) => {
4315
+ const recordKey = deriveRelationshipRecordKey(channels);
4316
+ if (recordKey === null)
4317
+ return [];
4318
+ const result = relationshipsUnionReader.read(RELATIONSHIP_STORE_KEY, recordKey);
4319
+ const views = mergeUnionToRelationships(new Map([[recordKey, result]]));
4320
+ // Only FOREIGN origins are surfaced (the local record is already the
4321
+ // authoritative getContextForPerson answer); render each as untrusted data.
4322
+ const out = [];
4323
+ for (const v of views) {
4324
+ if (v.origin === _meshSelfId)
4325
+ continue;
4326
+ const block = renderForeignRelationshipContext(v);
4327
+ if (block)
4328
+ out.push(block);
4329
+ }
4330
+ return out;
4331
+ },
4332
+ });
4235
4333
  }
4236
4334
  // Set up quota tracking if enabled
4237
4335
  let quotaTracker;
@@ -7451,6 +7549,48 @@ export async function startServer(options) {
7451
7549
  ...(config.evolution || {}),
7452
7550
  });
7453
7551
  console.log(pc.green(' Evolution system enabled'));
7552
+ // WS2.2 — the bypass-proof union reader for the `learnings` store. The single funnel
7553
+ // every replicated learning read routes through, so no caller reads a raw replica
7554
+ // around the no-clobber rule. `loadOriginRecords` materializes the OWN learning store
7555
+ // as the single origin today (via learningToOriginRecord, keyed on the content-
7556
+ // fingerprint identity surface — the local LRN-NNN id is NEVER replicated); when the
7557
+ // journal apply path lands peer `learning-record` replicas (a later rollout stage),
7558
+ // the seam extends to read those peer namespaces too. With only the own origin the
7559
+ // union is a strict no-op (= that one local record). tierOf returns HIGH (append-both-
7560
+ // and-flag never silently clobbers two divergent lessons; the READ layer is advisory,
7561
+ // injecting both variants as hints rather than blocking — fork #2). Consulted by a
7562
+ // learnings peer-read surface ONLY when stateSync.learnings.enabled is true.
7563
+ const { learningTierOf, learningToOriginRecord, deriveLearningRecordKey, LEARNING_STORE_KEY } = await import('../core/LearningsReplicatedStore.js');
7564
+ const learningsUnionReader = new ReplicatedStoreReader({
7565
+ registry: replicatedKindRegistry,
7566
+ stores: config.multiMachine?.stateSync,
7567
+ tierOf: learningTierOf,
7568
+ loadOriginRecords: (store, recordKey) => {
7569
+ if (store !== LEARNING_STORE_KEY || _meshSelfId === null)
7570
+ return [];
7571
+ for (const l of evolution.listLearnings()) {
7572
+ if (deriveLearningRecordKey(l.title, l.category, l.source) === recordKey) {
7573
+ const o = learningToOriginRecord(l, _meshSelfId);
7574
+ return o ? [o] : [];
7575
+ }
7576
+ }
7577
+ return [];
7578
+ },
7579
+ listRecordKeys: (store) => {
7580
+ if (store !== LEARNING_STORE_KEY)
7581
+ return [];
7582
+ const keys = [];
7583
+ for (const l of evolution.listLearnings()) {
7584
+ const k = deriveLearningRecordKey(l.title, l.category, l.source);
7585
+ if (k !== null)
7586
+ keys.push(k);
7587
+ }
7588
+ return keys;
7589
+ },
7590
+ droppedOrigins: droppedOriginRegistry,
7591
+ conflictStore,
7592
+ });
7593
+ void learningsUnionReader; // consumed by the learnings peer-read surface + the journal-apply rollout stage (WS2.2+)
7454
7594
  // Start MemoryPressureMonitor (platform-aware memory tracking)
7455
7595
  const { MemoryPressureMonitor } = await import('../monitoring/MemoryPressureMonitor.js');
7456
7596
  const memoryMonitor = new MemoryPressureMonitor({ stateDir: config.stateDir });