instar 0.28.1 → 0.28.2

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/README.md +1 -1
  2. package/dist/commands/server.d.ts.map +1 -1
  3. package/dist/commands/server.js +42 -3
  4. package/dist/commands/server.js.map +1 -1
  5. package/dist/lifeline/ServerSupervisor.d.ts.map +1 -1
  6. package/dist/lifeline/ServerSupervisor.js +31 -0
  7. package/dist/lifeline/ServerSupervisor.js.map +1 -1
  8. package/dist/lifeline/TelegramLifeline.d.ts +8 -0
  9. package/dist/lifeline/TelegramLifeline.d.ts.map +1 -1
  10. package/dist/lifeline/TelegramLifeline.js +115 -6
  11. package/dist/lifeline/TelegramLifeline.js.map +1 -1
  12. package/dist/messaging/SpawnRequestManager.d.ts +16 -0
  13. package/dist/messaging/SpawnRequestManager.d.ts.map +1 -1
  14. package/dist/messaging/SpawnRequestManager.js +63 -5
  15. package/dist/messaging/SpawnRequestManager.js.map +1 -1
  16. package/dist/server/AgentServer.d.ts +5 -0
  17. package/dist/server/AgentServer.d.ts.map +1 -1
  18. package/dist/server/AgentServer.js +1 -0
  19. package/dist/server/AgentServer.js.map +1 -1
  20. package/dist/server/routes.d.ts +7 -0
  21. package/dist/server/routes.d.ts.map +1 -1
  22. package/dist/server/routes.js +85 -15
  23. package/dist/server/routes.js.map +1 -1
  24. package/dist/threadline/AgentTrustManager.d.ts +2 -0
  25. package/dist/threadline/AgentTrustManager.d.ts.map +1 -1
  26. package/dist/threadline/AgentTrustManager.js +5 -3
  27. package/dist/threadline/AgentTrustManager.js.map +1 -1
  28. package/dist/threadline/mcp-stdio-entry.js +3 -2
  29. package/dist/threadline/mcp-stdio-entry.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/data/builtin-manifest.json +48 -48
  32. package/upgrades/0.28.2.md +29 -0
package/README.md CHANGED
@@ -113,7 +113,7 @@ Instar solves the six dimensions of agent coherence:
113
113
  | **Intent Alignment** | Decision journaling, drift detection, organizational constraints | [→](https://instar.sh/features/intent/) |
114
114
  | **Multi-Machine** | Ed25519/X25519 crypto identity, encrypted sync, automatic failover | [→](https://instar.sh/features/multi-machine/) |
115
115
  | **Serendipity Protocol** | Sub-agents capture out-of-scope discoveries without breaking focus. HMAC-signed, secret-scanned | [→](https://instar.sh/features/serendipity/) |
116
- | **Threadline Protocol** | Agent-to-agent conversations with canonical identity, three-layer trust model, authorization policy, Ed25519 invitations, Sybil protection, MoltBridge network discovery, rich agent profiles (auto-compiled from agent data with human review gate), discovery waterfall, message security, tamper-proof audit logging, and framework-agnostic interop. 2,324 tests across 99 test files | [→](https://instar.sh/features/threadline/) |
116
+ | **Threadline Protocol** | Agent-to-agent conversations with canonical identity, three-layer trust model, authorization policy, Ed25519 invitations, Sybil protection, MoltBridge network discovery, rich agent profiles (auto-compiled from agent data with human review gate), discovery waterfall, message security, tamper-proof audit logging, framework-agnostic interop, and persistent listener daemon (always-on relay connection, pipe-mode sessions, sub-30s cross-machine failover). 2,324 tests across 104 test files | [→](https://instar.sh/features/threadline/) |
117
117
  | **Self-Healing** | LLM-powered stall detection, session recovery, promise tracking | [→](https://instar.sh/features/self-healing/) |
118
118
  | **AutoUpdater** | Built-in update engine. Checks npm, auto-applies, self-restarts | [→](https://instar.sh/features/autoupdater/) |
119
119
  | **Build Pipeline** | `/build` skill with worktree isolation, 6-phase pipeline, quality gates, stop-hook enforcement | |
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA2PH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAizCD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA+9HtE;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"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA2PH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAizCD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA8/HtE;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"}
@@ -4631,6 +4631,8 @@ export async function startServer(options) {
4631
4631
  let threadlineShutdown;
4632
4632
  let threadlineRelayClient;
4633
4633
  let unifiedTrust;
4634
+ /** Shared reply waiters for threadline waitForReply support */
4635
+ const threadlineReplyWaiters = new Map();
4634
4636
  try {
4635
4637
  const threadline = await bootstrapThreadline({
4636
4638
  agentName: config.projectName,
@@ -4711,6 +4713,37 @@ export async function startServer(options) {
4711
4713
  else {
4712
4714
  textContent = JSON.stringify(msg.content);
4713
4715
  }
4716
+ // Check if this message resolves a pending waitForReply request.
4717
+ // Skip auto-ack messages (they're from us, not a real reply).
4718
+ // Try both fingerprint and agent name as keys — the waiter is keyed by
4719
+ // agent name (from relay-send), but gate-passed provides the fingerprint.
4720
+ const isAutoAck = textContent.startsWith('Message received.') || textContent.startsWith('Message received,');
4721
+ let waiter = threadlineReplyWaiters.get(senderFingerprint);
4722
+ if (!waiter) {
4723
+ // Resolve fingerprint → agent name via known-agents cache
4724
+ const resolvedName = (() => {
4725
+ try {
4726
+ const kaPath = path.join(config.stateDir, 'threadline', 'known-agents.json');
4727
+ const kaData = JSON.parse(fs.readFileSync(kaPath, 'utf-8'));
4728
+ const agents = kaData.agents ?? kaData;
4729
+ if (Array.isArray(agents)) {
4730
+ // Check publicKey field for fingerprint match
4731
+ const match = agents.find((a) => a.publicKey === senderFingerprint || a.publicKey?.startsWith(senderFingerprint));
4732
+ return match?.name ?? null;
4733
+ }
4734
+ return null;
4735
+ }
4736
+ catch {
4737
+ return null;
4738
+ }
4739
+ })();
4740
+ if (resolvedName)
4741
+ waiter = threadlineReplyWaiters.get(resolvedName);
4742
+ }
4743
+ if (waiter && !isAutoAck) {
4744
+ waiter.resolve(textContent);
4745
+ // Don't return — still process the message normally for routing
4746
+ }
4714
4747
  // Auto-ack (post-trust-verification, never ack status messages)
4715
4748
  const msgType = typeof msg.content === 'object' && msg.content !== null ? msg.content.type : undefined;
4716
4749
  if (trustLevel !== 'untrusted' && msgType !== 'status' && config.threadline?.autoAck !== false && !isAckRateLimited(senderFingerprint)) {
@@ -4881,7 +4914,7 @@ export async function startServer(options) {
4881
4914
  return { content: lines.join('\n'), truncated: false, elapsedMs: Date.now() - start };
4882
4915
  }, { description: 'Feature discovery state and behavioral contract summary' });
4883
4916
  }
4884
- const server = new AgentServer({ config, sessionManager, state, scheduler, telegram, relationships, feedback, feedbackAnomalyDetector, dispatches, updateChecker, autoUpdater, autoDispatcher, quotaTracker, quotaManager, publisher, viewer, tunnel, evolution, watchdog, topicMemory, triageNurse, projectMapper, coherenceGate: scopeVerifier, contextHierarchy, canonicalState, operationGate, sentinel, adaptiveTrust, memoryMonitor, orphanReaper, coherenceMonitor, commitmentTracker, semanticMemory, activitySentinel, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, localSigningKeyPem, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, threadlineRelayClient, listenerManager: listenerManager ?? undefined, responseReviewGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, unifiedTrust, liveConfig });
4917
+ const server = new AgentServer({ config, sessionManager, state, scheduler, telegram, relationships, feedback, feedbackAnomalyDetector, dispatches, updateChecker, autoUpdater, autoDispatcher, quotaTracker, quotaManager, publisher, viewer, tunnel, evolution, watchdog, topicMemory, triageNurse, projectMapper, coherenceGate: scopeVerifier, contextHierarchy, canonicalState, operationGate, sentinel, adaptiveTrust, memoryMonitor, orphanReaper, coherenceMonitor, commitmentTracker, semanticMemory, activitySentinel, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, localSigningKeyPem, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, threadlineRelayClient, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, responseReviewGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, unifiedTrust, liveConfig });
4885
4918
  await server.start();
4886
4919
  // Connect DegradationReporter downstream systems now that everything is initialized.
4887
4920
  // Any degradation events queued during startup will drain to feedback + telegram.
@@ -5169,8 +5202,14 @@ export async function startServer(options) {
5169
5202
  await threadlineShutdown();
5170
5203
  wakeSocketServer?.stop();
5171
5204
  pipeSpawner?.killAll();
5172
- stopHeartbeat?.();
5173
- unregisterAgent(config.projectDir);
5205
+ try {
5206
+ stopHeartbeat?.();
5207
+ }
5208
+ catch { /* non-critical during shutdown */ }
5209
+ try {
5210
+ unregisterAgent(config.projectDir);
5211
+ }
5212
+ catch { /* ELOCKED is non-critical during shutdown */ }
5174
5213
  scheduler?.stop();
5175
5214
  if (telegram)
5176
5215
  await telegram.stop();