instar 1.3.673 → 1.3.674

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;AA2CH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAU3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAwBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAwH7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AA+EtD;;;;;;;;;;;;;;;;;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;AAy4CD,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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AE,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,CAsmhBtE;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"}
@@ -20,6 +20,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
20
20
  const execFileAsync = promisify(execFile);
21
21
  import { loadConfig, ensureStateDir, detectTmuxPath, detectGeminiPath } from '../core/Config.js';
22
22
  import { handleProcessLevelError } from '../core/uncaughtExceptionPolicy.js';
23
+ import { planInboundLossNotices } from '../core/inboundLossRouting.js';
23
24
  import { configureHostSpawnSemaphore } from '../core/hostSpawnSemaphore.js';
24
25
  import { SingleInstanceLock, installReleaseHandlers } from '../core/SingleInstanceLock.js';
25
26
  import { resolveDevAgentGate, resolveStateSyncStores } from '../core/devAgentGate.js';
@@ -2815,6 +2816,37 @@ export async function startServer(options) {
2815
2816
  }
2816
2817
  }
2817
2818
  }
2819
+ /**
2820
+ * F3 (Inbound Delivery Is Sacred): route an inbound-queue loss notice to each
2821
+ * ORIGINATING topic on the proven Telegram path (each loss item's sessionKey
2822
+ * IS the topic id the user messaged from), instead of the single attention
2823
+ * topic that `notify()` SILENTLY DROPS when unset. Items with no resolvable
2824
+ * numeric topic fall back to the attention topic; if THAT is also unset, the
2825
+ * loss is surfaced LOUDLY (console.error) — a lost inbound user message is
2826
+ * NEVER silently expired (the Inbound-Delivery-Is-Sacred corollary). Spec:
2827
+ * docs/specs/inbound-delivery-sacred.md.
2828
+ */
2829
+ function notifyInboundLoss(items, tier, buildMessage) {
2830
+ if (items.length === 0)
2831
+ return;
2832
+ const plan = planInboundLossNotices(items);
2833
+ // Each affected topic gets its OWN notice, in that topic (proven path).
2834
+ for (const { topicId, count } of plan.perTopic) {
2835
+ notify(tier, 'inbound-loss', buildMessage(count), topicId);
2836
+ }
2837
+ if (plan.unresolved > 0) {
2838
+ const attn = _notifyState?.get('agent-attention-topic') ?? 0;
2839
+ if (attn) {
2840
+ notify(tier, 'inbound-loss', buildMessage(plan.unresolved), attn);
2841
+ }
2842
+ else {
2843
+ // No resolvable topic AND no attention topic configured → the one place a
2844
+ // loss could go silent. Surface it LOUDLY instead (never a silent expiry).
2845
+ console.error(`[inbound-loss] ${plan.unresolved} lost inbound message(s) had no resolvable topic and no attention topic is ` +
2846
+ `configured — surfaced loudly per Inbound-Delivery-Is-Sacred (configure an attention topic so these reach you).`);
2847
+ }
2848
+ }
2849
+ }
2818
2850
  /**
2819
2851
  * Translate coherence check failures into human-readable, actionable messages.
2820
2852
  */
@@ -7810,12 +7842,10 @@ export async function startServer(options) {
7810
7842
  clearPisRecord: (sk) => { for (const r of pisRecordsForTopic(sk))
7811
7843
  sweepPis.clear(r.tmuxSession); },
7812
7844
  reportLoss: (items, reason) => {
7813
- const topics = [...new Set(items.map((i) => i.sessionKey))].join(', ');
7814
- notify('SUMMARY', 'inbound-queue', `I didn't get to ${items.length} queued message(s) (${reason}; topics: ${topics}) — resend anything still needed.`);
7845
+ notifyInboundLoss(items, 'SUMMARY', (count) => `I didn't get to ${count} of your message(s) (${reason}) — resend anything still needed.`);
7815
7846
  },
7816
7847
  reportPossiblyNotInjected: (items) => {
7817
- const topics = [...new Set(items.map((i) => i.sessionKey))].join(', ');
7818
- notify('SUMMARY', 'inbound-queue', `${items.length} message(s) may not have been injected before a crash (topics: ${topics}) — if a message went unanswered, resend it.`);
7848
+ notifyInboundLoss(items, 'SUMMARY', (count) => `${count} of your message(s) may not have been injected before a crash — if a message went unanswered, resend it.`);
7819
7849
  },
7820
7850
  raiseAttention: (title, body) => notify('IMMEDIATE', 'inbound-queue', `${title}: ${body}`),
7821
7851
  log: (line) => console.log(pc.dim(` ${line}`)),
@@ -7848,7 +7878,7 @@ export async function startServer(options) {
7848
7878
  }
7849
7879
  }
7850
7880
  if (dropped.length > 0) {
7851
- notify('SUMMARY', 'inbound-queue', `I didn't get to ${dropped.length} queued message(s) (the queue is enabled but this machine has no mesh identity, so the drain never started; topics: ${[...new Set(dropped)].join(', ')}) — resend anything still needed.`);
7881
+ notifyInboundLoss(dropped.map((sk) => ({ sessionKey: sk })), 'SUMMARY', (count) => `I didn't get to ${count} of your message(s) (the queue is enabled but this machine has no mesh identity, so the drain never started) — resend anything still needed.`);
7852
7882
  }
7853
7883
  store.close();
7854
7884
  _sweptInboundStore = null;
@@ -17593,12 +17623,10 @@ export async function startServer(options) {
17593
17623
  }
17594
17624
  },
17595
17625
  reportLoss: (items, reason) => {
17596
- const topics = [...new Set(items.map((i) => i.sessionKey))].join(', ');
17597
- notify('SUMMARY', 'inbound-queue', `I didn't get to ${items.length} queued message(s) (${reason}; topics: ${topics}) — resend anything still needed.`);
17626
+ notifyInboundLoss(items, 'SUMMARY', (count) => `I didn't get to ${count} of your message(s) (${reason}) — resend anything still needed.`);
17598
17627
  },
17599
17628
  reportPossiblyNotInjected: (items) => {
17600
- const topics = [...new Set(items.map((i) => i.sessionKey))].join(', ');
17601
- notify('SUMMARY', 'inbound-queue', `${items.length} message(s) may not have been injected (topics: ${topics}) — if a message went unanswered, resend it.`);
17629
+ notifyInboundLoss(items, 'SUMMARY', (count) => `${count} of your message(s) may not have been injected — if a message went unanswered, resend it.`);
17602
17630
  },
17603
17631
  log: (line) => console.log(pc.dim(` ${line}`)),
17604
17632
  reportDegradation: (reason) => {