instar 1.3.575 → 1.3.576

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.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkCH,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;AAkH7D,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;AAg4CD,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,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E,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,CAswctE;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"}
@@ -3546,6 +3546,32 @@ export async function startServer(options) {
3546
3546
  log: (event, detail) => console.log(pc.dim(` [ws2-send] ${event} ${JSON.stringify(detail)}`)),
3547
3547
  });
3548
3548
  }
3549
+ // WS2.6 SEND-SIDE: userRegistry (a PII kind). Unlike the seamed memory stores,
3550
+ // there is NO single canonical UserManager — telegram (send-only + normal mode)
3551
+ // and slack each construct their OWN long-lived instance against the same
3552
+ // users.json. This shared attacher wires the journal-backed emitter to each so a
3553
+ // user written on ANY in-process path replicates (upsertUser→persistUsers fires
3554
+ // emitPut for every survivor; removeUser fires the channel-keyed emitDelete
3555
+ // tombstone). Channel-keyed identity — the local userId NEVER crosses the wire.
3556
+ // Dark by default ⇒ no-op. SECONDARY paths NOT covered by this in-process emitter
3557
+ // (documented in the side-effects review): the Slack org-permission admin route
3558
+ // (per-request UserManager in routes.ts, would need RouteContext plumbing) and
3559
+ // the `instar user add` CLI (a separate process — the snapshot reads the journal,
3560
+ // not users.json). REQ-M14: a replicated user record is NEVER authoritative for
3561
+ // inbound-principal resolution — the local channel index always wins.
3562
+ const _userReplStores = replicatedRecordEmitter
3563
+ ? await import('../core/UserRegistryReplicatedStore.js')
3564
+ : null;
3565
+ const attachUserReplication = (um) => {
3566
+ if (!replicatedRecordEmitter || !_userReplStores)
3567
+ return;
3568
+ const emitter = replicatedRecordEmitter;
3569
+ const { USER_STORE_KEY, deriveUserRecordKey, buildUserRecordData, buildUserTombstoneData } = _userReplStores;
3570
+ um.setUserReplicationEmitter({
3571
+ emitPut: (rec) => emitter.emit(USER_STORE_KEY, deriveUserRecordKey(rec.channels), (hlc, origin, observed) => buildUserRecordData({ record: rec, hlc, origin, observed })),
3572
+ emitDelete: (channels, deletedAt) => emitter.emit(USER_STORE_KEY, deriveUserRecordKey(channels), (hlc, origin, observed) => buildUserTombstoneData({ channels, hlc, origin, deletedAt, observed })),
3573
+ });
3574
+ };
3549
3575
  const selfStateSyncReceive = () => {
3550
3576
  const out = {};
3551
3577
  const stores = _stateSyncStoresResolved;
@@ -4940,6 +4966,7 @@ export async function startServer(options) {
4940
4966
  // "--no-telegram (registry-only) injection" branch and slash-commands
4941
4967
  // reached the AI session as plain chat text.
4942
4968
  const userManagerSendOnly = new UserManager(config.stateDir, config.users);
4969
+ attachUserReplication(userManagerSendOnly); // WS2.6 send-side (dark by default)
4943
4970
  _fixDeps = { state, liveConfig, sessionManager, telegram, config };
4944
4971
  wireTelegramRouting(telegram, sessionManager, quotaTracker, topicMemory, userManagerSendOnly, (topicId, text) => handleFixCommand(topicId, text, _fixDeps), () => (collaborationSurfacer && conversationStore && telegram) ? { collaborationSurfacer, conversationStore, commitmentTracker, telegram, brief: briefDeps } : null, () => _agentServerRef?.getTopicOperatorStore() ?? null, () => state.get('agent-attention-topic'));
4945
4972
  wireTelegramCallbacks(telegram, sessionManager, state, quotaTracker, undefined, config.sessions.claudePath, topicMemory);
@@ -5057,6 +5084,7 @@ export async function startServer(options) {
5057
5084
  // "Account switcher + quota collector pipeline" section above.
5058
5085
  // Initialize persistent UserManager for user identity resolution (Gap 8)
5059
5086
  const userManager = new UserManager(config.stateDir, config.users);
5087
+ attachUserReplication(userManager); // WS2.6 send-side (dark by default)
5060
5088
  // Fix command dependencies — populated later when subsystems initialize.
5061
5089
  // Uses a mutable ref so wireTelegramRouting can capture it in a closure now.
5062
5090
  _fixDeps = {
@@ -5479,6 +5507,7 @@ export async function startServer(options) {
5479
5507
  // Own UserManager instance for verified-principal resolution (the
5480
5508
  // Telegram-block userManager is out of scope here). Reads users.json.
5481
5509
  const slackUserManager = new UserManager(config.stateDir, config.users);
5510
+ attachUserReplication(slackUserManager); // WS2.6 send-side (dark by default)
5482
5511
  // ── Floor-action grants are read from the SIGNED Coordination Mandate ──
5483
5512
  // A MandateStore reader over the SAME file + SAME HMAC sign/verify deps as
5484
5513
  // the coordination engine in AgentServer (which is constructed later, so we