instar 1.3.0 → 1.3.1
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/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +41 -3
- package/dist/commands/server.js.map +1 -1
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +11 -9
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/scaffold/templates.d.ts.map +1 -1
- package/dist/scaffold/templates.js +1 -8
- package/dist/scaffold/templates.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +18 -65
- package/dist/server/routes.js.map +1 -1
- package/dist/threadline/CollaborationSurfacer.d.ts.map +1 -1
- package/dist/threadline/CollaborationSurfacer.js +7 -3
- package/dist/threadline/CollaborationSurfacer.js.map +1 -1
- package/dist/threadline/hubCommands.d.ts +67 -0
- package/dist/threadline/hubCommands.d.ts.map +1 -0
- package/dist/threadline/hubCommands.js +126 -0
- package/dist/threadline/hubCommands.js.map +1 -0
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +62 -62
- package/src/scaffold/templates.ts +1 -8
- package/upgrades/1.3.1.md +27 -0
- package/upgrades/side-effects/threadline-open-this-deterministic.md +45 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA0QH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA0QH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAksDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA0sMtE;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"}
|
package/dist/commands/server.js
CHANGED
|
@@ -1004,7 +1004,10 @@ function messageToPipeline(msg, topicName) {
|
|
|
1004
1004
|
timestamp: msg.receivedAt,
|
|
1005
1005
|
};
|
|
1006
1006
|
}
|
|
1007
|
-
function wireTelegramRouting(telegram, sessionManager, quotaTracker, topicMemory, userManager, fixCommandHandler
|
|
1007
|
+
function wireTelegramRouting(telegram, sessionManager, quotaTracker, topicMemory, userManager, fixCommandHandler,
|
|
1008
|
+
// Late-bound: the threadline hub deps are constructed AFTER this is wired, so
|
|
1009
|
+
// resolve them at message-time (CMT-529 deterministic "open this" intercept).
|
|
1010
|
+
getHubDeps) {
|
|
1008
1011
|
// Guard: tracks which topic IDs have a spawn in progress.
|
|
1009
1012
|
// Prevents duplicate concurrent spawns for the same topic when messages
|
|
1010
1013
|
// arrive faster than the async spawn completes.
|
|
@@ -1056,6 +1059,41 @@ function wireTelegramRouting(telegram, sessionManager, quotaTracker, topicMemory
|
|
|
1056
1059
|
})();
|
|
1057
1060
|
return;
|
|
1058
1061
|
}
|
|
1062
|
+
// ── Threadline hub commands: "open this" / "tie this to <topic>" (CMT-529) ──
|
|
1063
|
+
// When a message in the Threadline HUB topic is a deterministic hub command,
|
|
1064
|
+
// bind the conversation to a topic STRUCTURALLY — before any agent interprets
|
|
1065
|
+
// it. This onTopicMessage seam is the convergence both inbound paths reach
|
|
1066
|
+
// (lifeline-forward AND server-polling), so one intercept covers both modes.
|
|
1067
|
+
// FAIL-OPEN: any error falls through to normal routing.
|
|
1068
|
+
const hubDeps = getHubDeps?.() ?? null;
|
|
1069
|
+
if (hubDeps) {
|
|
1070
|
+
try {
|
|
1071
|
+
let hubTopicId;
|
|
1072
|
+
try {
|
|
1073
|
+
hubTopicId = hubDeps.collaborationSurfacer.getHubTopicId();
|
|
1074
|
+
}
|
|
1075
|
+
catch {
|
|
1076
|
+
hubTopicId = undefined;
|
|
1077
|
+
}
|
|
1078
|
+
if (hubTopicId !== undefined && Number(topicId) === Number(hubTopicId)) {
|
|
1079
|
+
const { parseHubCommand, bindHubConversation } = await import('../threadline/hubCommands.js');
|
|
1080
|
+
const cmd = parseHubCommand(text);
|
|
1081
|
+
if (cmd) {
|
|
1082
|
+
const result = await bindHubConversation(hubDeps, { ...cmd, autoPick: true }); // human "open this" → auto-pick most-recent, never 409
|
|
1083
|
+
if (!result.ok) {
|
|
1084
|
+
await telegram.sendToTopic(topicId, result.status === 404
|
|
1085
|
+
? 'Nothing waiting in the hub to open right now.'
|
|
1086
|
+
: `Couldn't open that — ${result.error}`).catch(() => { });
|
|
1087
|
+
}
|
|
1088
|
+
// On success bindHubConversation already posted the hub confirmation.
|
|
1089
|
+
return; // structural: never inject the command into a session
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
catch (err) {
|
|
1094
|
+
console.warn(`[telegram] hub-command intercept error (fail-open): ${err instanceof Error ? err.message : err}`);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1059
1097
|
// ── Fix commands from notification messages ──────────────────────
|
|
1060
1098
|
// Handle "fix auth", "clean processes", "restart", etc. directly
|
|
1061
1099
|
// in the server process — no need to spawn a Claude session for these.
|
|
@@ -2684,7 +2722,7 @@ export async function startServer(options) {
|
|
|
2684
2722
|
// reached the AI session as plain chat text.
|
|
2685
2723
|
const userManagerSendOnly = new UserManager(config.stateDir, config.users);
|
|
2686
2724
|
_fixDeps = { state, liveConfig, sessionManager, telegram, config };
|
|
2687
|
-
wireTelegramRouting(telegram, sessionManager, quotaTracker, topicMemory, userManagerSendOnly, (topicId, text) => handleFixCommand(topicId, text, _fixDeps));
|
|
2725
|
+
wireTelegramRouting(telegram, sessionManager, quotaTracker, topicMemory, userManagerSendOnly, (topicId, text) => handleFixCommand(topicId, text, _fixDeps), () => (collaborationSurfacer && conversationStore && telegram) ? { collaborationSurfacer, conversationStore, commitmentTracker, telegram } : null);
|
|
2688
2726
|
wireTelegramCallbacks(telegram, sessionManager, state, quotaTracker, undefined, config.sessions.claudePath, topicMemory);
|
|
2689
2727
|
console.log(pc.green(' Telegram routing + command callbacks wired (send-only)'));
|
|
2690
2728
|
}
|
|
@@ -2848,7 +2886,7 @@ export async function startServer(options) {
|
|
|
2848
2886
|
config,
|
|
2849
2887
|
};
|
|
2850
2888
|
// Wire up topic → session routing and session management callbacks
|
|
2851
|
-
wireTelegramRouting(telegram, sessionManager, quotaTracker, topicMemory, userManager, (topicId, text) => handleFixCommand(topicId, text, _fixDeps));
|
|
2889
|
+
wireTelegramRouting(telegram, sessionManager, quotaTracker, topicMemory, userManager, (topicId, text) => handleFixCommand(topicId, text, _fixDeps), () => (collaborationSurfacer && conversationStore && telegram) ? { collaborationSurfacer, conversationStore, commitmentTracker, telegram } : null);
|
|
2852
2890
|
wireTelegramCallbacks(telegram, sessionManager, state, quotaTracker, accountSwitcher, config.sessions.claudePath, topicMemory);
|
|
2853
2891
|
// Wire up unknown-user handling (Multi-User Setup Wizard Phase 4.5)
|
|
2854
2892
|
telegram.onGetRegistrationPolicy = () => ({
|