instar 0.26.2 → 0.26.4
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.
- package/dashboard/index.html +55 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +65 -4
- package/dist/commands/server.js.map +1 -1
- package/dist/commands/slack-cli.d.ts.map +1 -1
- package/dist/commands/slack-cli.js +6 -0
- package/dist/commands/slack-cli.js.map +1 -1
- package/dist/core/CapabilityMapper.d.ts.map +1 -1
- package/dist/core/CapabilityMapper.js +2 -0
- package/dist/core/CapabilityMapper.js.map +1 -1
- package/dist/core/EvolutionManager.d.ts +17 -0
- package/dist/core/EvolutionManager.d.ts.map +1 -1
- package/dist/core/EvolutionManager.js +64 -0
- package/dist/core/EvolutionManager.js.map +1 -1
- package/dist/core/GitSync.d.ts.map +1 -1
- package/dist/core/GitSync.js +10 -2
- package/dist/core/GitSync.js.map +1 -1
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +37 -0
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/core/SessionManager.d.ts.map +1 -1
- package/dist/core/SessionManager.js +9 -0
- package/dist/core/SessionManager.js.map +1 -1
- package/dist/core/types.d.ts +4 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lifeline/ServerSupervisor.d.ts.map +1 -1
- package/dist/lifeline/ServerSupervisor.js +37 -1
- package/dist/lifeline/ServerSupervisor.js.map +1 -1
- package/dist/messaging/imessage/IMessageAdapter.d.ts +112 -0
- package/dist/messaging/imessage/IMessageAdapter.d.ts.map +1 -0
- package/dist/messaging/imessage/IMessageAdapter.js +483 -0
- package/dist/messaging/imessage/IMessageAdapter.js.map +1 -0
- package/dist/messaging/imessage/NativeBackend.d.ts +82 -0
- package/dist/messaging/imessage/NativeBackend.d.ts.map +1 -0
- package/dist/messaging/imessage/NativeBackend.js +353 -0
- package/dist/messaging/imessage/NativeBackend.js.map +1 -0
- package/dist/messaging/imessage/OutboundAuditLog.d.ts +49 -0
- package/dist/messaging/imessage/OutboundAuditLog.d.ts.map +1 -0
- package/dist/messaging/imessage/OutboundAuditLog.js +58 -0
- package/dist/messaging/imessage/OutboundAuditLog.js.map +1 -0
- package/dist/messaging/imessage/OutboundRateLimiter.d.ts +54 -0
- package/dist/messaging/imessage/OutboundRateLimiter.d.ts.map +1 -0
- package/dist/messaging/imessage/OutboundRateLimiter.js +111 -0
- package/dist/messaging/imessage/OutboundRateLimiter.js.map +1 -0
- package/dist/messaging/imessage/index.d.ts +10 -0
- package/dist/messaging/imessage/index.d.ts.map +1 -0
- package/dist/messaging/imessage/index.js +13 -0
- package/dist/messaging/imessage/index.js.map +1 -0
- package/dist/messaging/imessage/normalize-phone.d.ts +26 -0
- package/dist/messaging/imessage/normalize-phone.d.ts.map +1 -0
- package/dist/messaging/imessage/normalize-phone.js +55 -0
- package/dist/messaging/imessage/normalize-phone.js.map +1 -0
- package/dist/messaging/imessage/types.d.ts +84 -0
- package/dist/messaging/imessage/types.d.ts.map +1 -0
- package/dist/messaging/imessage/types.js +5 -0
- package/dist/messaging/imessage/types.js.map +1 -0
- package/dist/messaging/shared/MessagingEventBus.d.ts +5 -0
- package/dist/messaging/shared/MessagingEventBus.d.ts.map +1 -1
- package/dist/messaging/shared/MessagingEventBus.js.map +1 -1
- package/dist/messaging/slack/SlackAdapter.d.ts.map +1 -1
- package/dist/messaging/slack/SlackAdapter.js +31 -1
- package/dist/messaging/slack/SlackAdapter.js.map +1 -1
- package/dist/messaging/slack/SocketModeClient.d.ts.map +1 -1
- package/dist/messaging/slack/SocketModeClient.js +6 -0
- package/dist/messaging/slack/SocketModeClient.js.map +1 -1
- package/dist/monitoring/PresenceProxy.d.ts +10 -4
- package/dist/monitoring/PresenceProxy.d.ts.map +1 -1
- package/dist/monitoring/PresenceProxy.js +87 -15
- package/dist/monitoring/PresenceProxy.js.map +1 -1
- package/dist/monitoring/QuotaExhaustionDetector.d.ts +15 -0
- package/dist/monitoring/QuotaExhaustionDetector.d.ts.map +1 -1
- package/dist/monitoring/QuotaExhaustionDetector.js +26 -3
- package/dist/monitoring/QuotaExhaustionDetector.js.map +1 -1
- package/dist/monitoring/SessionMonitor.d.ts.map +1 -1
- package/dist/monitoring/SessionMonitor.js +5 -2
- package/dist/monitoring/SessionMonitor.js.map +1 -1
- package/dist/monitoring/SessionRecovery.d.ts +16 -1
- package/dist/monitoring/SessionRecovery.d.ts.map +1 -1
- package/dist/monitoring/SessionRecovery.js +71 -8
- package/dist/monitoring/SessionRecovery.js.map +1 -1
- package/dist/scheduler/JobScheduler.js +1 -1
- package/dist/scheduler/JobScheduler.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +14 -0
- package/dist/server/routes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +65 -65
- package/src/templates/hooks/settings-template.json +11 -0
- package/upgrades/0.26.3.md +26 -0
- package/upgrades/0.26.4.md +17 -0
package/dist/commands/server.js
CHANGED
|
@@ -865,8 +865,9 @@ function wireTelegramRouting(telegram, sessionManager, quotaTracker, topicMemory
|
|
|
865
865
|
telegram.trackMessageInjection(topicId, targetSession, text);
|
|
866
866
|
}
|
|
867
867
|
else {
|
|
868
|
-
// Session died —
|
|
868
|
+
// Session died — classify death cause before deciding how to respawn
|
|
869
869
|
let isQuotaDeath = false;
|
|
870
|
+
let isContextExhausted = false;
|
|
870
871
|
try {
|
|
871
872
|
const output = sessionManager.captureOutput(targetSession, 100);
|
|
872
873
|
if (output) {
|
|
@@ -877,10 +878,36 @@ function wireTelegramRouting(telegram, sessionManager, quotaTracker, topicMemory
|
|
|
877
878
|
telegram.sendToTopic(topicId, `🔴 Session died — quota limit reached.\n${classification.detail}\n\n` +
|
|
878
879
|
`Use /switch-account to switch, /login to add an account, or reply again to force restart.`).catch(() => { });
|
|
879
880
|
}
|
|
881
|
+
else if (classification.cause === 'context_exhausted') {
|
|
882
|
+
isContextExhausted = true;
|
|
883
|
+
telegram.sendToTopic(topicId, `🔄 Conversation got too long — starting a fresh session with your recent history.`).catch(() => { });
|
|
884
|
+
}
|
|
880
885
|
}
|
|
881
886
|
}
|
|
882
887
|
catch { /* classification failed — fall through to respawn */ }
|
|
883
|
-
if (
|
|
888
|
+
if (isContextExhausted) {
|
|
889
|
+
// Context exhaustion: respawn FRESH (no --resume) — the old conversation
|
|
890
|
+
// is too large to continue. The respawn path will load telegram thread
|
|
891
|
+
// history as context, giving the new session continuity.
|
|
892
|
+
if (spawningTopics.has(topicId)) {
|
|
893
|
+
console.log(`[telegram→session] Spawn already in progress for topic ${topicId} — skipping duplicate respawn`);
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
spawningTopics.add(topicId);
|
|
897
|
+
// Remove the resume UUID so respawnSessionForTopic doesn't try --resume
|
|
898
|
+
if (_topicResumeMap) {
|
|
899
|
+
_topicResumeMap.remove(topicId);
|
|
900
|
+
}
|
|
901
|
+
respawnSessionForTopic(sessionManager, telegram, targetSession, topicId, text, topicMemory, resolvedUser ?? undefined)
|
|
902
|
+
.catch(err => {
|
|
903
|
+
console.error(`[telegram→session] Context exhaustion respawn failed:`, err);
|
|
904
|
+
telegram.sendToTopic(topicId, `❌ Fresh session restart failed. Try sending your message again.`).catch(() => { });
|
|
905
|
+
})
|
|
906
|
+
.finally(() => {
|
|
907
|
+
spawningTopics.delete(topicId);
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
else if (!isQuotaDeath) {
|
|
884
911
|
// Guard: skip respawn if one is already in progress for this topic.
|
|
885
912
|
// Prevents the infinite respawn loop: dead session + rapid messages → each
|
|
886
913
|
// message triggers a new respawn → multiple concurrent spawns → chaos.
|
|
@@ -3122,6 +3149,22 @@ export async function startServer(options) {
|
|
|
3122
3149
|
if (telegram)
|
|
3123
3150
|
await telegram.sendToTopic(topicId, message);
|
|
3124
3151
|
},
|
|
3152
|
+
captureSessionOutput: (name, lines) => {
|
|
3153
|
+
return sessionManager.captureOutput(name, lines);
|
|
3154
|
+
},
|
|
3155
|
+
respawnSessionFresh: async (topicId, _sessionName, recoveryPrompt) => {
|
|
3156
|
+
// Fresh respawn for context exhaustion — explicitly clear resume UUID
|
|
3157
|
+
// so the new session starts clean with telegram history, not --resume.
|
|
3158
|
+
if (_topicResumeMap) {
|
|
3159
|
+
_topicResumeMap.remove(topicId);
|
|
3160
|
+
}
|
|
3161
|
+
if (telegram) {
|
|
3162
|
+
const targetSession = telegram.getSessionForTopic(topicId);
|
|
3163
|
+
if (!targetSession)
|
|
3164
|
+
return;
|
|
3165
|
+
await respawnSessionForTopic(sessionManager, telegram, targetSession, topicId, undefined, topicMemory, undefined, recoveryPrompt, { silent: true });
|
|
3166
|
+
}
|
|
3167
|
+
},
|
|
3125
3168
|
});
|
|
3126
3169
|
console.log(pc.green(' Session Recovery enabled (mechanical fast-path)'));
|
|
3127
3170
|
}
|
|
@@ -4341,11 +4384,29 @@ export async function startServer(options) {
|
|
|
4341
4384
|
const featureRegistry = new FeatureRegistry(config.stateDir, {
|
|
4342
4385
|
hmacKey: config.authToken || undefined,
|
|
4343
4386
|
});
|
|
4344
|
-
|
|
4387
|
+
let featureRegistryReady = false;
|
|
4388
|
+
try {
|
|
4389
|
+
await featureRegistry.open();
|
|
4390
|
+
featureRegistryReady = true;
|
|
4391
|
+
}
|
|
4392
|
+
catch (frErr) {
|
|
4393
|
+
const msg = frErr instanceof Error ? frErr.message : String(frErr);
|
|
4394
|
+
console.warn(pc.yellow(` FeatureRegistry: failed to open (${msg.slice(0, 120)})`));
|
|
4395
|
+
const { DegradationReporter } = await import('../monitoring/DegradationReporter.js');
|
|
4396
|
+
DegradationReporter.getInstance().report({
|
|
4397
|
+
feature: 'FeatureRegistry',
|
|
4398
|
+
primary: 'SQLite-backed feature registry with discovery state tracking',
|
|
4399
|
+
fallback: 'Feature definitions available in-memory only (no persistent state)',
|
|
4400
|
+
reason: `FeatureRegistry open failed: ${msg.slice(0, 200)}`,
|
|
4401
|
+
impact: 'Feature discovery state not persisted. Features default to definitions only.',
|
|
4402
|
+
});
|
|
4403
|
+
}
|
|
4345
4404
|
for (const def of BUILTIN_FEATURES) {
|
|
4346
4405
|
featureRegistry.register(def);
|
|
4347
4406
|
}
|
|
4348
|
-
|
|
4407
|
+
if (featureRegistryReady) {
|
|
4408
|
+
featureRegistry.bootstrap(config);
|
|
4409
|
+
}
|
|
4349
4410
|
{
|
|
4350
4411
|
const summaries = featureRegistry.getSummaries();
|
|
4351
4412
|
const enabledCount = summaries.filter((f) => f.enabled).length;
|