instar 0.28.33 → 0.28.35

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 (48) hide show
  1. package/dashboard/index.html +30 -40
  2. package/dist/commands/server.d.ts.map +1 -1
  3. package/dist/commands/server.js +14 -1
  4. package/dist/commands/server.js.map +1 -1
  5. package/dist/core/MessagingToneGate.d.ts +42 -0
  6. package/dist/core/MessagingToneGate.d.ts.map +1 -0
  7. package/dist/core/MessagingToneGate.js +109 -0
  8. package/dist/core/MessagingToneGate.js.map +1 -0
  9. package/dist/core/PostUpdateMigrator.d.ts +14 -0
  10. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  11. package/dist/core/PostUpdateMigrator.js +123 -2
  12. package/dist/core/PostUpdateMigrator.js.map +1 -1
  13. package/dist/messaging/TelegramAdapter.d.ts +8 -0
  14. package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
  15. package/dist/messaging/TelegramAdapter.js +42 -3
  16. package/dist/messaging/TelegramAdapter.js.map +1 -1
  17. package/dist/monitoring/PresenceProxy.d.ts +40 -0
  18. package/dist/monitoring/PresenceProxy.d.ts.map +1 -1
  19. package/dist/monitoring/PresenceProxy.js +156 -4
  20. package/dist/monitoring/PresenceProxy.js.map +1 -1
  21. package/dist/monitoring/PromptGate.d.ts.map +1 -1
  22. package/dist/monitoring/PromptGate.js +75 -0
  23. package/dist/monitoring/PromptGate.js.map +1 -1
  24. package/dist/monitoring/SessionWatchdog.d.ts +26 -0
  25. package/dist/monitoring/SessionWatchdog.d.ts.map +1 -1
  26. package/dist/monitoring/SessionWatchdog.js +204 -26
  27. package/dist/monitoring/SessionWatchdog.js.map +1 -1
  28. package/dist/monitoring/probes/MessagingProbe.d.ts +4 -0
  29. package/dist/monitoring/probes/MessagingProbe.d.ts.map +1 -1
  30. package/dist/monitoring/probes/MessagingProbe.js +24 -8
  31. package/dist/monitoring/probes/MessagingProbe.js.map +1 -1
  32. package/dist/server/AgentServer.d.ts +1 -0
  33. package/dist/server/AgentServer.d.ts.map +1 -1
  34. package/dist/server/AgentServer.js +1 -0
  35. package/dist/server/AgentServer.js.map +1 -1
  36. package/dist/server/routes.d.ts +5 -0
  37. package/dist/server/routes.d.ts.map +1 -1
  38. package/dist/server/routes.js +92 -2
  39. package/dist/server/routes.js.map +1 -1
  40. package/package.json +1 -1
  41. package/scripts/collect-metrics.py +120 -25
  42. package/src/data/builtin-manifest.json +66 -66
  43. package/src/templates/scripts/imessage-reply.sh +16 -3
  44. package/src/templates/scripts/slack-reply.sh +10 -0
  45. package/src/templates/scripts/telegram-reply.sh +11 -0
  46. package/src/templates/scripts/whatsapp-reply.sh +10 -0
  47. package/upgrades/0.28.34.md +17 -0
  48. package/upgrades/0.28.35.md +37 -0
@@ -3161,19 +3161,13 @@
3161
3161
  // back near the bottom, resume following.
3162
3162
  // Also trigger history loading when user scrolls near the top.
3163
3163
  term.onScroll(() => {
3164
+ if (suppressScrollHandler) return;
3164
3165
  const buf = term.buffer.active;
3165
3166
  const atBottom = buf.baseY === 0 || (buf.baseY - buf.viewportY) <= 3;
3166
3167
 
3167
3168
  if (atBottom && !userIsFollowing) {
3168
3169
  // User scrolled back to bottom — resume following and apply pending output
3169
- userIsFollowing = true;
3170
- if (pendingOutputData) {
3171
- const data = pendingOutputData;
3172
- pendingOutputData = null;
3173
- term.clear();
3174
- term.write(data);
3175
- term.scrollToBottom();
3176
- }
3170
+ resumeLiveOutput();
3177
3171
  } else if (!atBottom) {
3178
3172
  userIsFollowing = false;
3179
3173
  }
@@ -3201,16 +3195,7 @@
3201
3195
  if (e.deltaY > 0 && !userIsFollowing) {
3202
3196
  const buf = term.buffer.active;
3203
3197
  const atBottom = buf.baseY === 0 || (buf.baseY - buf.viewportY) <= 5;
3204
- if (atBottom) {
3205
- userIsFollowing = true;
3206
- if (pendingOutputData) {
3207
- const data = pendingOutputData;
3208
- pendingOutputData = null;
3209
- term.clear();
3210
- term.write(data);
3211
- term.scrollToBottom();
3212
- }
3213
- }
3198
+ if (atBottom) resumeLiveOutput();
3214
3199
  }
3215
3200
  }, { passive: true });
3216
3201
  }
@@ -3252,6 +3237,32 @@
3252
3237
  let userIsFollowing = true;
3253
3238
  /** Pending output data received while user is scrolled up — applied when they return to bottom */
3254
3239
  let pendingOutputData = null;
3240
+ /** Suppress the scroll handler while we programmatically rewrite + scroll the terminal,
3241
+ * so transient mid-write viewportY values don't flip userIsFollowing back to false. */
3242
+ let suppressScrollHandler = false;
3243
+
3244
+ /** Re-apply pending output and snap to the very bottom. Safe to call from the resume button
3245
+ * or the scroll handler. Uses term.write's callback so scrolling happens AFTER xterm has
3246
+ * finished parsing the data — rAF alone is not enough (write is async/batched). */
3247
+ function resumeLiveOutput() {
3248
+ userIsFollowing = true;
3249
+ hideResumeButton();
3250
+ suppressScrollHandler = true;
3251
+ const finish = () => {
3252
+ try { term.scrollToBottom(); } catch {}
3253
+ // Release suppression on the next frame so any onScroll fired by scrollToBottom
3254
+ // is ignored — the very next user scroll will then be honored normally.
3255
+ requestAnimationFrame(() => { suppressScrollHandler = false; });
3256
+ };
3257
+ if (pendingOutputData) {
3258
+ const data = pendingOutputData;
3259
+ pendingOutputData = null;
3260
+ term.clear();
3261
+ term.write(data, finish);
3262
+ } else {
3263
+ finish();
3264
+ }
3265
+ }
3255
3266
 
3256
3267
  function renderTerminalOutput(data) {
3257
3268
  if (!term) return;
@@ -3280,28 +3291,7 @@
3280
3291
  btn.id = 'resumeBtn';
3281
3292
  btn.textContent = '▼ Resume live output';
3282
3293
  btn.style.cssText = 'position:absolute;bottom:12px;left:50%;transform:translateX(-50%);z-index:10;background:var(--accent);color:#000;border:none;padding:6px 16px;border-radius:4px;font-size:12px;cursor:pointer;font-weight:600;opacity:0.95;box-shadow:0 2px 8px rgba(0,0,0,0.3);';
3283
- btn.onclick = () => {
3284
- userIsFollowing = true;
3285
- if (pendingOutputData) {
3286
- const data = pendingOutputData;
3287
- pendingOutputData = null;
3288
- term.clear();
3289
- term.write(data);
3290
- // Delay scrollToBottom until after xterm renders the written data
3291
- requestAnimationFrame(() => {
3292
- term.scrollToBottom();
3293
- // Also scroll the browser viewport to show the terminal bottom
3294
- const container = document.getElementById('terminalContainer');
3295
- if (container) container.scrollIntoView({ block: 'end', behavior: 'instant' });
3296
- });
3297
- } else {
3298
- // No pending data — just snap to bottom of existing content
3299
- term.scrollToBottom();
3300
- const container = document.getElementById('terminalContainer');
3301
- if (container) container.scrollIntoView({ block: 'end', behavior: 'instant' });
3302
- }
3303
- hideResumeButton();
3304
- };
3294
+ btn.onclick = () => resumeLiveOutput();
3305
3295
  const container = document.getElementById('terminalContainer');
3306
3296
  if (container) container.style.position = 'relative';
3307
3297
  container?.appendChild(btn);
@@ -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;AA81CD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAupItE;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;AA81CD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAoqItE;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"}
@@ -5022,6 +5022,19 @@ export async function startServer(options) {
5022
5022
  // Non-fatal — agent works without Threadline
5023
5023
  console.warn(pc.yellow(` Threadline: failed to bootstrap — ${err instanceof Error ? err.message : String(err)}`));
5024
5024
  }
5025
+ // Messaging Tone Gate — always-on tone check on outbound messaging routes.
5026
+ // Uses the shared IntelligenceProvider (Claude CLI subscription by default,
5027
+ // Anthropic API if key is set). No opt-in. Catches CLI commands, file paths,
5028
+ // config syntax, and other technical leakage in agent-to-user messages.
5029
+ let messagingToneGate;
5030
+ if (sharedIntelligence) {
5031
+ const { MessagingToneGate } = await import('../core/MessagingToneGate.js');
5032
+ messagingToneGate = new MessagingToneGate(sharedIntelligence);
5033
+ console.log(pc.green(' Messaging tone gate: active (Haiku via shared IntelligenceProvider)'));
5034
+ }
5035
+ else {
5036
+ console.log(pc.yellow(' Messaging tone gate: inactive (no IntelligenceProvider available)'));
5037
+ }
5025
5038
  // Response Review Pipeline (Coherence Gate) — evaluates agent responses before delivery
5026
5039
  let responseReviewGate;
5027
5040
  if (config.responseReview?.enabled) {
@@ -5114,7 +5127,7 @@ export async function startServer(options) {
5114
5127
  return { content: lines.join('\n'), truncated: false, elapsedMs: Date.now() - start };
5115
5128
  }, { description: 'Feature discovery state and behavioral contract summary' });
5116
5129
  }
5117
- 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 });
5130
+ 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, messagingToneGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, unifiedTrust, liveConfig });
5118
5131
  await server.start();
5119
5132
  // Connect DegradationReporter downstream systems now that everything is initialized.
5120
5133
  // Any degradation events queued during startup will drain to feedback + telegram.