instar 1.3.1082 → 1.3.1083

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;AA8EH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAU3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AA0BjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AA8H7D,OAAO,KAAK,EAAW,oBAAoB,EAAe,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAgFtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAUT;AAuID,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA+rDD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,oBAAoB,GAAG,IAAI,GACxC;IACD,YAAY,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAC3C,Q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,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,EAQrD,oBAAoB,CAAC,EAAE,MAAM;IAC3B,YAAY,EAAE,OAAO,kBAAkB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACrE,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,GACP,IAAI,CAwtBN;AAgmBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAwtqBtE;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"}
@@ -15052,14 +15052,58 @@ export async function startServer(options) {
15052
15052
  impact: 'Peer\'s queue depth is capped; older messages are dropped. No blame attribution.',
15053
15053
  });
15054
15054
  }
15055
+ else if (event.kind === 'spawn-drain-attention-failed') {
15056
+ reporter.report({
15057
+ feature: 'Threadline.SpawnDrainAttention',
15058
+ primary: `Create Attention marker "${event.attentionId}" for peer "${event.agent}"`,
15059
+ fallback: `Keep the drain target latched and retry the Attention write (attempt ${event.attempt})`,
15060
+ reason: `Attention write failed: ${event.error}`,
15061
+ impact: 'Queued work remains held and visible in spawn-manager status; the operator-facing marker is delayed.',
15062
+ });
15063
+ }
15055
15064
  }
15056
15065
  catch (err) {
15057
15066
  console.warn(`[spawn-manager] degradation reporter failed: ${err instanceof Error ? err.message : String(err)}`);
15058
15067
  }
15059
15068
  },
15069
+ onDrainGiveUp: async (event) => {
15070
+ if (!telegram) {
15071
+ throw new Error('Telegram Attention adapter is unavailable');
15072
+ }
15073
+ await telegram.createOrReopenAgentHealthAttentionItem({
15074
+ id: event.attentionId,
15075
+ title: `Spawn drain gave up for ${event.agent}`,
15076
+ summary: `${event.refusalCount} consecutive drain re-attempts were refused; ${event.queuedMessagesHeld} queued message(s) are held.`,
15077
+ description: `The Threadline spawn drain latched queued messages from "${event.agent}" after repeated refusals. ` +
15078
+ `Target: ${event.targetKey}. Refusal signature: ${event.refusalSignature}. ` +
15079
+ `Last refusal: ${event.reason}. Refusal window: ${new Date(event.firstRefusedAt).toISOString()} to ${new Date(event.lastRefusedAt).toISOString()}. ` +
15080
+ `The queued work is held until the refusal condition clears and the re-arm cooldown passes; the spawn guard threshold is unchanged.`,
15081
+ category: 'agent-health',
15082
+ priority: 'HIGH',
15083
+ lane: 'agent-health',
15084
+ healthKey: `spawn-drain-refusal:${event.targetKey}`,
15085
+ sourceContext: `spawn-drain-refusal:${event.targetKey}`,
15086
+ });
15087
+ },
15088
+ isDrainRefusalCleared: (marker) => {
15089
+ // Only memory pressure has an authoritative live clear signal here.
15090
+ // Other refusal classes still receive time hysteresis, then retry
15091
+ // through the unchanged admission gate rather than remaining latched
15092
+ // forever on a condition this layer cannot inspect.
15093
+ if (!/memory pressure/i.test(marker.refusalSignature))
15094
+ return true;
15095
+ const state = memoryMonitor?.getState();
15096
+ return !state || state.state === 'normal';
15097
+ },
15098
+ onDrainRearm: (event) => {
15099
+ console.log(`[spawn-manager] drain give-up latch re-armed for ${event.agent} ` +
15100
+ `(target=${event.targetKey}, signature="${event.refusalSignature}", quiet=${event.rearmCooldownMs}ms)`);
15101
+ },
15060
15102
  // §4.4: optional knobs from config.
15061
15103
  cooldownMs: spawnConfig?.cooldownMs,
15062
15104
  maxDrainsPerTick: spawnConfig?.maxDrainsPerTick,
15105
+ drainRefusalGiveUpThreshold: spawnConfig?.drainRefusalGiveUpThreshold,
15106
+ drainGiveUpRearmCooldownMs: spawnConfig?.drainGiveUpRearmCooldownMs,
15063
15107
  maxEnvelopeBytes: spawnConfig?.maxEnvelopeBytes,
15064
15108
  maxGlobalQueued: spawnConfig?.maxGlobalQueued,
15065
15109
  degradedMaxQueuedPerAgent: spawnConfig?.degradedMaxQueuedPerAgent,
@@ -15083,9 +15127,12 @@ export async function startServer(options) {
15083
15127
  if (!result.approved) {
15084
15128
  console.log(`[spawn-manager] drain re-attempt for ${agent} not approved: ${result.reason}`);
15085
15129
  }
15130
+ return result;
15086
15131
  }
15087
15132
  catch (err) {
15088
- console.warn(`[spawn-manager] drain re-attempt for ${agent} threw: ${err instanceof Error ? err.message : String(err)}`);
15133
+ const reason = err instanceof Error ? err.message : String(err);
15134
+ console.warn(`[spawn-manager] drain re-attempt for ${agent} threw: ${reason}`);
15135
+ return { approved: false, reason: `Drain callback threw: ${reason}`, retryAfterMs: 30_000 };
15089
15136
  }
15090
15137
  },
15091
15138
  });