claude-code-session-manager 0.137.0 → 0.139.0
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/.claude-plugin/marketplace.json +1 -1
- package/README.md +339 -82
- package/dist/assets/{AppSettings-l7NTc0yu.js → AppSettings-CUfWY9vN.js} +2 -2
- package/dist/assets/History-DDnqaLyw.js +2 -0
- package/dist/assets/HomeClaudeConfig-CGD2Onjv.js +3 -0
- package/dist/assets/{Panel-BuInRmA0.js → Panel-Csyd9HbD.js} +1 -1
- package/dist/assets/ProjectClaudeConfig-C-jlYpC_.js +26 -0
- package/dist/assets/{Scheduler-B7sn2mUw.js → Scheduler-NLs08fx7.js} +9 -9
- package/dist/assets/{SkillReferenceGraph-DwV0Ueyc.js → SkillReferenceGraph-DcscPXAG.js} +1 -1
- package/dist/assets/Skills-BpGRKOcY.js +67 -0
- package/dist/assets/{TiptapBody-Bl8hDhhS.js → TiptapBody-DSU3769X.js} +60 -54
- package/dist/assets/ViewTabs-C0PRZx4_.js +1 -0
- package/dist/assets/{VoiceButton-DJx-jY4r.js → VoiceButton-D2rMurNg.js} +1 -1
- package/dist/assets/{historyTotals-Cgjm5q24.js → historyTotals-TcIQs2sh.js} +1 -1
- package/dist/assets/{index-62tyjEQB.css → index-BCySPdtU.css} +1 -1
- package/dist/assets/index-C-d0DCre.js +3124 -0
- package/dist/index.html +2 -2
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +471 -452
- package/package.json +13 -5
- package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
- package/plugins/session-manager-dev/skills/builder/SKILL.md +12 -4
- package/plugins/session-manager-dev/skills/builder/scripts/publish-preflight.cjs +255 -0
- package/plugins/session-manager-dev/skills/develop/SKILL.md +12 -5
- package/scripts/README.md +1 -0
- package/scripts/scheduler-mcp-server.cjs +161 -18
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +53 -2
- package/src/main/exchanges.cjs +70 -5
- package/src/main/historyAggregator.cjs +84 -58
- package/src/main/historyDashboard.cjs +18 -13
- package/src/main/index.cjs +35 -9
- package/src/main/ipcSchemas.cjs +133 -5
- package/src/main/lib/claude/effectiveModelInfo.cjs +2 -2
- package/src/main/lib/claude/modelPricing.cjs +148 -0
- package/src/main/lib/demo-video-kit/checks.cjs +16 -0
- package/src/main/lib/epic/epicAdminRoutes.cjs +101 -0
- package/src/main/lib/epic/epicAttachments.cjs +143 -0
- package/src/main/lib/epic/epicJobReceipt.cjs +87 -0
- package/src/main/lib/epic/epicMint.cjs +4 -0
- package/src/main/lib/epic/epicOutsideRead.cjs +306 -0
- package/src/main/lib/epic/epicOutsideState.cjs +233 -0
- package/src/main/lib/epic/epicSettle.cjs +1 -1
- package/src/main/lib/epic/epicStateWatcher.cjs +157 -0
- package/src/main/lib/epic/externalRef.cjs +37 -0
- package/src/main/lib/epic/externalRefIndex.cjs +136 -0
- package/src/main/lib/epic/restorableSessions.cjs +151 -17
- package/src/main/lib/epic/transcriptUsage.cjs +197 -0
- package/src/main/lib/externalContract.cjs +111 -0
- package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +121 -4
- package/src/main/lib/feedback-remote/crossProjectReply.cjs +83 -1
- package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +16 -6
- package/src/main/lib/feedback-remote/customerFeedbackClient.cjs +50 -8
- package/src/main/lib/feedback-remote/customerFeedbackInbox.cjs +218 -4
- package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +19 -3
- package/src/main/lib/feedback-remote/feedbackImages.cjs +171 -0
- package/src/main/lib/feedback-remote/localAdminHttp.cjs +11 -10
- package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +287 -1
- package/src/main/lib/feedback-remote/needsYouAdminRoutes.cjs +133 -0
- package/src/main/lib/feedback-remote/needsYouIpc.cjs +50 -0
- package/src/main/lib/feedback-remote/needsYouStore.cjs +281 -0
- package/src/main/lib/feedback-remote/remoteFrameAssembler.cjs +113 -0
- package/src/main/lib/historyRollup.cjs +32 -5
- package/src/main/lib/mcpToolCatalog.cjs +111 -14
- package/src/main/lib/persona-macro/agentAdminRoutes.cjs +121 -0
- package/src/main/lib/persona-macro/macroLibrary.cjs +7 -0
- package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
- package/src/main/lib/process/bootStdioGuard.cjs +32 -0
- package/src/main/lib/process/stdioGuard.cjs +115 -0
- package/src/main/lib/promptSessionSchema.cjs +4 -0
- package/src/main/lib/remoteTranscriptTail.cjs +32 -1
- package/src/main/lib/scheduler/schedulerPaths.cjs +9 -0
- package/src/main/lib/telemetry/auditEvents.cjs +176 -0
- package/src/main/lib/telemetry/eventsAdminRoutes.cjs +45 -0
- package/src/main/loopEfficiencyHandlers.cjs +1 -1
- package/src/main/scheduler.cjs +29 -0
- package/src/main/templates/PRD_AUTHORING.md +1 -0
- package/src/main/transcripts.cjs +62 -7
- package/src/main/webRemote.cjs +122 -18
- package/src/preload/api.d.ts +98 -9
- package/src/preload/apiSurface.cjs +7 -0
- package/src/preload/apiSurface.json +415 -83
- package/src/preload/index.cjs +17 -3
- package/src/seed/agents/demo-video-builder.md +10 -7
- package/dist/assets/AgentLibrary-DV0DTZDC.js +0 -2
- package/dist/assets/Button-Cmfkgjfa.js +0 -1
- package/dist/assets/DocumentEditorPane-MTljV-Uw.js +0 -1
- package/dist/assets/Extensions-Cc1Q_8id.js +0 -2
- package/dist/assets/History-CFo-1DHo.js +0 -2
- package/dist/assets/Library-C_ibFiOx.js +0 -32
- package/dist/assets/ListDetail-ByULG209.js +0 -1
- package/dist/assets/ProjectClaudeConfig-yqqVtHY7.js +0 -25
- package/dist/assets/ProvenanceBadge-CJvnQReI.js +0 -1
- package/dist/assets/Settings-DRRSJksU.js +0 -2
- package/dist/assets/Skills-DVYHA9gV.js +0 -29
- package/dist/assets/SourceChip-DfJ5_5rV.js +0 -1
- package/dist/assets/SystemPrompt-f11wGllK.js +0 -1
- package/dist/assets/Toggle-DaxeFDFp.js +0 -1
- package/dist/assets/ViewTabs-DRtgFKRw.js +0 -1
- package/dist/assets/claude-settings-schema-COigsajx.js +0 -3
- package/dist/assets/index-iQ6pdyuS.js +0 -3116
package/src/main/webRemote.cjs
CHANGED
|
@@ -84,6 +84,31 @@ let _configCache = null;
|
|
|
84
84
|
let _configCacheAt = 0;
|
|
85
85
|
let _repairNeeded = false; // relay rejected the device token (invalid_token / 401): terminal until re-pair
|
|
86
86
|
let _destroyed = false; // set at app shutdown to stop reconnect loops
|
|
87
|
+
let _frameAssembler = null; // inbound e2e:frame reassembly (lazy; reset with all clients)
|
|
88
|
+
let _frameSweepTimer = null;
|
|
89
|
+
const FRAME_SWEEP_MS = 30_000;
|
|
90
|
+
|
|
91
|
+
// Abilities this desktop advertises in event:remote:ready; web clients only send
|
|
92
|
+
// boxed e2e:frame sequences to desktops listing 'e2e-frames'.
|
|
93
|
+
const REMOTE_CAPABILITIES = Object.freeze(['e2e-frames', 'chat-images']);
|
|
94
|
+
|
|
95
|
+
function getFrameAssembler() {
|
|
96
|
+
if (!_frameAssembler) {
|
|
97
|
+
const { createFrameAssembler } = require('./lib/feedback-remote/remoteFrameAssembler.cjs');
|
|
98
|
+
_frameAssembler = createFrameAssembler();
|
|
99
|
+
}
|
|
100
|
+
return _frameAssembler;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function startFrameSweep() {
|
|
104
|
+
stopFrameSweep();
|
|
105
|
+
_frameSweepTimer = setInterval(() => { if (_frameAssembler) _frameAssembler.sweep(); }, FRAME_SWEEP_MS);
|
|
106
|
+
_frameSweepTimer.unref?.();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function stopFrameSweep() {
|
|
110
|
+
if (_frameSweepTimer) { clearInterval(_frameSweepTimer); _frameSweepTimer = null; }
|
|
111
|
+
}
|
|
87
112
|
|
|
88
113
|
// E2E session state — reset on each new WS connection.
|
|
89
114
|
// .state: 'idle' | 'pending_sas' | 'authenticated' | 'failed'
|
|
@@ -254,6 +279,7 @@ function resetE2e() {
|
|
|
254
279
|
|
|
255
280
|
// Mark one client's session failed without touching any other client.
|
|
256
281
|
function failClient(client) {
|
|
282
|
+
if (_frameAssembler) _frameAssembler.dropClient(client.key);
|
|
257
283
|
client.e2e = makeState('failed');
|
|
258
284
|
client.peerPubKey = null;
|
|
259
285
|
client.deviceId = null;
|
|
@@ -383,6 +409,7 @@ function scheduleReconnect() {
|
|
|
383
409
|
async function disconnect() {
|
|
384
410
|
cancelReconnect();
|
|
385
411
|
stopHeartbeat();
|
|
412
|
+
stopFrameSweep();
|
|
386
413
|
resetE2e();
|
|
387
414
|
if (_ws) {
|
|
388
415
|
const ws = _ws;
|
|
@@ -453,6 +480,7 @@ async function connect() {
|
|
|
453
480
|
_backoffMs = BACKOFF_INIT_MS;
|
|
454
481
|
_missedPongs = 0;
|
|
455
482
|
startHeartbeat();
|
|
483
|
+
startFrameSweep();
|
|
456
484
|
// Update lastConnectedAt without exposing token
|
|
457
485
|
invalidateConfigCache(); // a pin written since the last cached read must not be overwritten
|
|
458
486
|
loadConfig().then(async (c) => {
|
|
@@ -479,6 +507,7 @@ async function connect() {
|
|
|
479
507
|
|
|
480
508
|
ws.on('close', (code) => {
|
|
481
509
|
stopHeartbeat();
|
|
510
|
+
stopFrameSweep();
|
|
482
511
|
stopAllSessionWatches();
|
|
483
512
|
resetE2e();
|
|
484
513
|
if (_ws === ws) _ws = null;
|
|
@@ -561,6 +590,7 @@ function pruneSessionWatchers() {
|
|
|
561
590
|
/** Tear down one client (its PTY streams + subscriptions) without touching others. */
|
|
562
591
|
function teardownClient(key) {
|
|
563
592
|
_lastRekeyMs.delete(key);
|
|
593
|
+
if (_frameAssembler) _frameAssembler.dropClient(key);
|
|
564
594
|
const rec = _clients.teardown(key);
|
|
565
595
|
pruneSessionWatchers();
|
|
566
596
|
return rec;
|
|
@@ -568,6 +598,7 @@ function teardownClient(key) {
|
|
|
568
598
|
|
|
569
599
|
/** Tear down every client — no client keeps a PTY stream or subscription afterwards. */
|
|
570
600
|
function teardownAllClients() {
|
|
601
|
+
_frameAssembler = null; // drops every client's partial frames
|
|
571
602
|
const n = _clients.teardownAll();
|
|
572
603
|
pruneSessionWatchers();
|
|
573
604
|
return n;
|
|
@@ -717,7 +748,7 @@ function stopAllSessionWatches() {
|
|
|
717
748
|
function finalizeE2eAuthenticated(logMessage, client) {
|
|
718
749
|
logs.writeLine({ scope: 'webRemote', level: 'info', message: logMessage });
|
|
719
750
|
broadcastStatus();
|
|
720
|
-
if (client && loadConfigSync().remoteEnabled) pushEventTo(client, 'event:remote:ready', { ts: Date.now() });
|
|
751
|
+
if (client && loadConfigSync().remoteEnabled) pushEventTo(client, 'event:remote:ready', { ts: Date.now(), capabilities: [...REMOTE_CAPABILITIES] });
|
|
721
752
|
}
|
|
722
753
|
|
|
723
754
|
// ─── Message handling & command dispatch ─────────────────────────────────────
|
|
@@ -897,6 +928,10 @@ async function handleMessage(raw, device) {
|
|
|
897
928
|
} catch {
|
|
898
929
|
return;
|
|
899
930
|
}
|
|
931
|
+
if (inner && typeof inner === 'object' && inner.type === 'e2e:frame') {
|
|
932
|
+
await handleFrame(inner, device, client);
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
900
935
|
// Dispatch as if it arrived unencrypted
|
|
901
936
|
await dispatchEnvelope(inner, device, client);
|
|
902
937
|
return;
|
|
@@ -913,6 +948,31 @@ async function handleMessage(raw, device) {
|
|
|
913
948
|
await dispatchEnvelope(envelope, device, client);
|
|
914
949
|
}
|
|
915
950
|
|
|
951
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* One decrypted e2e:frame slice of a browser→desktop message too large for the relay's
|
|
955
|
+
* 256 KB cap. Only authenticated clients of an enabled remote are buffered; a completed
|
|
956
|
+
* message goes through the normal dispatchEnvelope gates.
|
|
957
|
+
*/
|
|
958
|
+
async function handleFrame(inner, device, client) {
|
|
959
|
+
if (client.e2e.state !== 'authenticated') return;
|
|
960
|
+
if (!(await loadConfig()).remoteEnabled) {
|
|
961
|
+
if (_frameAssembler) _frameAssembler.dropClient(client.key); // kill switch: free any partial
|
|
962
|
+
return;
|
|
963
|
+
}
|
|
964
|
+
const payload = inner.payload;
|
|
965
|
+
const result = getFrameAssembler().accept(client.key, payload);
|
|
966
|
+
if (result.status === 'complete') {
|
|
967
|
+
await dispatchEnvelope(result.envelope, device, client);
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
if (result.status !== 'refused') return;
|
|
971
|
+
const msgId = payload && typeof payload.msgId === 'string' && UUID_RE.test(payload.msgId) ? payload.msgId : undefined;
|
|
972
|
+
await auditLog(new Date().toISOString(), 'e2e:frame', device.deviceId, msgId, `refused:${result.reason}`, client);
|
|
973
|
+
if (msgId) respond(msgId, { error: 'rejected' }, undefined, client);
|
|
974
|
+
}
|
|
975
|
+
|
|
916
976
|
const IPC_INVOKE_MAX_CALLS = 50;
|
|
917
977
|
let _ipcDispatcher = null;
|
|
918
978
|
|
|
@@ -1269,33 +1329,75 @@ function getDispatchMap() {
|
|
|
1269
1329
|
// client — in-process call, no admin HTTP hop needed since webRemote
|
|
1270
1330
|
// already runs inside the Electron main process (PRD 753).
|
|
1271
1331
|
'cmd:chat:send': async (payload) => {
|
|
1272
|
-
const
|
|
1332
|
+
const result = schemas.remoteChatSend.safeParse(payload);
|
|
1333
|
+
if (!result.success) {
|
|
1334
|
+
const issues = result.error.issues;
|
|
1335
|
+
if (issues.length > 0 && issues.every((i) => i.path[0] === 'images')) {
|
|
1336
|
+
return { ok: false, disposition: 'refused', reason: 'attachment-invalid' };
|
|
1337
|
+
}
|
|
1338
|
+
throw result.error;
|
|
1339
|
+
}
|
|
1340
|
+
const parsed = result.data;
|
|
1273
1341
|
const { readActiveIndex } = require('./lib/epic/epicMint.cjs');
|
|
1274
1342
|
const data = await sessionsStore.load();
|
|
1275
1343
|
const tabs = data?.tabs ?? [];
|
|
1276
|
-
// Resolve the target in main: an open tab, or an ACTIVE Epic (by id or
|
|
1277
|
-
// claudeSessionId) of an open project. Anything else is a structured refusal.
|
|
1278
1344
|
const outcome = (r) => ({
|
|
1279
1345
|
ok: r.disposition !== 'refused',
|
|
1280
1346
|
disposition: r.disposition,
|
|
1281
1347
|
...(r.reason ? { reason: r.reason } : {}),
|
|
1282
1348
|
});
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1349
|
+
// 1. Resolve the target BEFORE writing anything: an open tab, or an ACTIVE
|
|
1350
|
+
// Epic (by id or claudeSessionId) of an open project. Anything else is a
|
|
1351
|
+
// structured refusal.
|
|
1352
|
+
let target = null;
|
|
1353
|
+
const openTab = tabs.find((t) => t && (t.sessionId === parsed.tabId || t.id === parsed.tabId));
|
|
1354
|
+
if (openTab) {
|
|
1355
|
+
target = { id: parsed.tabId, extra: undefined, projectCwd: openTab.cwd };
|
|
1356
|
+
} else {
|
|
1357
|
+
for (const tab of tabs) {
|
|
1358
|
+
const sessions = Object.values(readActiveIndex(tab.cwd)?.sessions ?? {});
|
|
1359
|
+
const epic = sessions.find((e) => e && (e.id === parsed.tabId || e.claudeSessionId === parsed.tabId));
|
|
1360
|
+
if (!epic) continue;
|
|
1361
|
+
if (epic.status !== 'active' || !epic.claudeSessionId) {
|
|
1362
|
+
return { ok: false, disposition: 'refused', reason: epic.status === 'proposed' ? 'proposed' : 'not-active' };
|
|
1363
|
+
}
|
|
1364
|
+
target = {
|
|
1365
|
+
id: epic.id,
|
|
1366
|
+
extra: { sessionId: epic.claudeSessionId, cwd: epic.cwd || tab.cwd },
|
|
1367
|
+
projectCwd: tab.cwd,
|
|
1368
|
+
};
|
|
1369
|
+
break;
|
|
1292
1370
|
}
|
|
1293
|
-
return outcome(await chatRunner.enqueueExternalPrompt(epic.id, parsed.prompt, {
|
|
1294
|
-
sessionId: epic.claudeSessionId,
|
|
1295
|
-
cwd: epic.cwd || tab.cwd,
|
|
1296
|
-
}));
|
|
1297
1371
|
}
|
|
1298
|
-
return { ok: false, disposition: 'refused', reason: 'unknown-target' };
|
|
1372
|
+
if (!target) return { ok: false, disposition: 'refused', reason: 'unknown-target' };
|
|
1373
|
+
|
|
1374
|
+
const enqueue = (prompt) => (target.extra
|
|
1375
|
+
? chatRunner.enqueueExternalPrompt(target.id, prompt, target.extra)
|
|
1376
|
+
: chatRunner.enqueueExternalPrompt(target.id, prompt));
|
|
1377
|
+
|
|
1378
|
+
const images = parsed.images ?? [];
|
|
1379
|
+
if (images.length === 0) return outcome(await enqueue(parsed.prompt));
|
|
1380
|
+
|
|
1381
|
+
// 2. Save images under the owning open tab's project (never logged: no
|
|
1382
|
+
// image data or names reach the audit trail).
|
|
1383
|
+
const { saveChatImages, composeAttachedPrompt, removeSavedAttachments } = require('./lib/epic/epicAttachments.cjs');
|
|
1384
|
+
// projectCwd is an open tab's cwd: register it with the write boundary
|
|
1385
|
+
// (as promptSessionsIpc does) so the save never depends on a pty having spawned.
|
|
1386
|
+
require('./config.cjs').addAllowedRoot(validatePath(target.projectCwd));
|
|
1387
|
+
const saved = await saveChatImages({ projectCwd: target.projectCwd, images });
|
|
1388
|
+
if (!saved.ok) return { ok: false, disposition: 'refused', reason: 'attachment-invalid' };
|
|
1389
|
+
|
|
1390
|
+
// 3. Enqueue; only a definite refusal removes the files ('unconfirmed' may
|
|
1391
|
+
// still land, so its files stay).
|
|
1392
|
+
let r;
|
|
1393
|
+
try {
|
|
1394
|
+
r = await enqueue(composeAttachedPrompt(parsed.prompt, saved.paths));
|
|
1395
|
+
} catch (err) {
|
|
1396
|
+
await removeSavedAttachments(target.projectCwd, saved.paths);
|
|
1397
|
+
throw err;
|
|
1398
|
+
}
|
|
1399
|
+
if (r.disposition === 'refused') await removeSavedAttachments(target.projectCwd, saved.paths);
|
|
1400
|
+
return { ...outcome(r), attachments: saved.names };
|
|
1299
1401
|
},
|
|
1300
1402
|
|
|
1301
1403
|
'cmd:session:options': async () => {
|
|
@@ -1600,9 +1702,11 @@ function destroy() {
|
|
|
1600
1702
|
_ws = null;
|
|
1601
1703
|
}
|
|
1602
1704
|
stopHeartbeat();
|
|
1705
|
+
stopFrameSweep();
|
|
1603
1706
|
}
|
|
1604
1707
|
|
|
1605
1708
|
module.exports = {
|
|
1709
|
+
REMOTE_CAPABILITIES,
|
|
1606
1710
|
loadConfig,
|
|
1607
1711
|
setIpcDispatcher,
|
|
1608
1712
|
attachWindow,
|
package/src/preload/api.d.ts
CHANGED
|
@@ -283,12 +283,16 @@ export type McpCheckResult =
|
|
|
283
283
|
* HomeAgentTools section. */
|
|
284
284
|
export interface McpToolCatalogEntry {
|
|
285
285
|
name: string;
|
|
286
|
-
group: 'scheduler' | 'chat' | 'feedback' | 'help';
|
|
286
|
+
group: 'scheduler' | 'chat' | 'feedback' | 'help' | 'project-home' | 'macros' | 'customer-feedback' | 'epics' | 'agents';
|
|
287
287
|
purpose: string;
|
|
288
|
+
/** Plain one-line summary (10-90 chars) — the Dashboard row text. */
|
|
289
|
+
summary: string;
|
|
288
290
|
whenToUse: string;
|
|
289
291
|
whenNotToUse: string;
|
|
290
292
|
exampleArgs: Record<string, unknown>;
|
|
291
293
|
notes: string | null;
|
|
294
|
+
/** Arg groups the handler refuses a call without ('exactly one of'). */
|
|
295
|
+
requiredOneOf?: string[][];
|
|
292
296
|
}
|
|
293
297
|
|
|
294
298
|
export interface McpRecipe {
|
|
@@ -382,6 +386,23 @@ export interface MacroJobStatus {
|
|
|
382
386
|
}
|
|
383
387
|
|
|
384
388
|
/** One user-defined sidebar HOT KEYS macro (macroLibrary.cjs). `projects` = absolute cwds or `'*'` (every project); a surface `'project-home'` macro is always `['*']` (only its generated artifacts are per project). */
|
|
389
|
+
/** One "Needs you" item an outside app posted (main/lib/feedback-remote/needsYouStore.cjs StoredItemSchema). */
|
|
390
|
+
export interface NeedsYouItem {
|
|
391
|
+
app: string;
|
|
392
|
+
id: string;
|
|
393
|
+
title: string;
|
|
394
|
+
why: string;
|
|
395
|
+
link: string | null;
|
|
396
|
+
/** 2-5 distinct choices; null = no answer buttons (informational only). */
|
|
397
|
+
options: string[] | null;
|
|
398
|
+
externalRef: string | null;
|
|
399
|
+
status: 'open' | 'answered' | 'withdrawn';
|
|
400
|
+
answer: string | null;
|
|
401
|
+
createdAt: string;
|
|
402
|
+
updatedAt: string;
|
|
403
|
+
answeredAt: string | null;
|
|
404
|
+
}
|
|
405
|
+
|
|
385
406
|
export interface Macro {
|
|
386
407
|
id: string;
|
|
387
408
|
label: string;
|
|
@@ -400,6 +421,8 @@ export interface Macro {
|
|
|
400
421
|
inputs?: MacroInput[];
|
|
401
422
|
/** Projects ('*' or absolute cwds) this macro's session may start work in without approval. */
|
|
402
423
|
autoStartTargets?: string[];
|
|
424
|
+
/** True lets a script start this macro via POST /admin/macros/run. */
|
|
425
|
+
scriptStart?: boolean;
|
|
403
426
|
/** Set only on built-ins whose press builds in the background. */
|
|
404
427
|
job?: MacroJob;
|
|
405
428
|
}
|
|
@@ -429,6 +452,8 @@ export interface MacroSaveInput {
|
|
|
429
452
|
inputs?: MacroInput[];
|
|
430
453
|
/** Same omit/clear semantics as `inputs`. */
|
|
431
454
|
autoStartTargets?: string[];
|
|
455
|
+
/** True lets a script start this macro via POST /admin/macros/run. */
|
|
456
|
+
scriptStart?: boolean;
|
|
432
457
|
}
|
|
433
458
|
|
|
434
459
|
/** One `agentCli.detect` row — a non-Claude agent CLI and whether it is installed. */
|
|
@@ -699,6 +724,8 @@ export interface CustomerFeedbackItem {
|
|
|
699
724
|
statusNote: string | null;
|
|
700
725
|
statusAt: number | string | null;
|
|
701
726
|
seenStatusAt: number | string | null;
|
|
727
|
+
/** Images the feedback host confirmed it stored (0 when none were sent). */
|
|
728
|
+
imageCount?: number;
|
|
702
729
|
}
|
|
703
730
|
|
|
704
731
|
export interface CustomerFeedbackInboxItem {
|
|
@@ -714,6 +741,8 @@ export interface CustomerFeedbackInboxItem {
|
|
|
714
741
|
statusNote: string | null;
|
|
715
742
|
statusAt: string | number | null;
|
|
716
743
|
epicId: string | null;
|
|
744
|
+
/** Screenshot metadata in submission order; `path` = local cache file, null until downloaded. */
|
|
745
|
+
images: { mime: string; bytes: number; path: string | null }[];
|
|
717
746
|
}
|
|
718
747
|
|
|
719
748
|
export interface CustomerFeedbackOwnerInfo {
|
|
@@ -1256,6 +1285,10 @@ export interface DayProjectRow {
|
|
|
1256
1285
|
outputTokens: number;
|
|
1257
1286
|
cacheReadTokens: number;
|
|
1258
1287
|
cacheCreationTokens: number;
|
|
1288
|
+
/** Recorded 1-hour part of cacheCreationTokens. */
|
|
1289
|
+
cacheCreation1hTokens?: number;
|
|
1290
|
+
/** Part of cacheCreationTokens with no recorded 5-minute / 1-hour split (rollup lines written before v4); priced at the 1-hour rate and marked estimated when above zero. */
|
|
1291
|
+
cacheCreationUnknownTokens?: number;
|
|
1259
1292
|
costUsd: number;
|
|
1260
1293
|
/** Set when the model id didn't match opus/sonnet/haiku and was priced at Sonnet rates as a fallback. */
|
|
1261
1294
|
estimated?: boolean;
|
|
@@ -1309,6 +1342,10 @@ export interface HistoryDashboardProjectRow extends HistoryDashboardTotals {
|
|
|
1309
1342
|
outputTokens: number;
|
|
1310
1343
|
cacheReadTokens: number;
|
|
1311
1344
|
cacheCreationTokens: number;
|
|
1345
|
+
/** Recorded 1-hour part of cacheCreationTokens. */
|
|
1346
|
+
cacheCreation1hTokens?: number;
|
|
1347
|
+
/** Part of cacheCreationTokens with no recorded 5-minute / 1-hour split (rollup lines written before v4); priced at the 1-hour rate and marked estimated when above zero. */
|
|
1348
|
+
cacheCreationUnknownTokens?: number;
|
|
1312
1349
|
costUsd: number;
|
|
1313
1350
|
estimated?: boolean;
|
|
1314
1351
|
}>;
|
|
@@ -1331,6 +1368,10 @@ export interface HistoryDashboardResult {
|
|
|
1331
1368
|
outputTokens: number;
|
|
1332
1369
|
cacheReadTokens: number;
|
|
1333
1370
|
cacheCreationTokens: number;
|
|
1371
|
+
/** Recorded 1-hour part of cacheCreationTokens. */
|
|
1372
|
+
cacheCreation1hTokens?: number;
|
|
1373
|
+
/** Part of cacheCreationTokens with no recorded 5-minute / 1-hour split (rollup lines written before v4); priced at the 1-hour rate and marked estimated when above zero. */
|
|
1374
|
+
cacheCreationUnknownTokens?: number;
|
|
1334
1375
|
costUsd: number;
|
|
1335
1376
|
estimated?: boolean;
|
|
1336
1377
|
}>;
|
|
@@ -1338,6 +1379,8 @@ export interface HistoryDashboardResult {
|
|
|
1338
1379
|
generatedAt: number;
|
|
1339
1380
|
/** Dates included in `days` that are NOT yet finalized (typically just today). */
|
|
1340
1381
|
provisionalDates: string[];
|
|
1382
|
+
/** Dates in range finalized under an older rollup version (counted before once-per-call counting; read high). */
|
|
1383
|
+
legacyDates: string[];
|
|
1341
1384
|
}
|
|
1342
1385
|
|
|
1343
1386
|
|
|
@@ -2168,6 +2211,15 @@ export interface ChatExternalSendResult {
|
|
|
2168
2211
|
reason?: ChatExternalSendRefusalReason;
|
|
2169
2212
|
}
|
|
2170
2213
|
|
|
2214
|
+
/** What the renderer did with a `chat:external-new-session` that carried a requestId (POST /admin/macros/run), reported back to main. */
|
|
2215
|
+
export interface ChatExternalNewSessionResult {
|
|
2216
|
+
requestId: string;
|
|
2217
|
+
ok: boolean;
|
|
2218
|
+
/** The minted Epic's id when `ok`. */
|
|
2219
|
+
epicId?: string;
|
|
2220
|
+
error?: string;
|
|
2221
|
+
}
|
|
2222
|
+
|
|
2171
2223
|
export type CreateProjectFolderResult =
|
|
2172
2224
|
| { ok: true; path: string }
|
|
2173
2225
|
| { ok: false; code: 'invalid-name' | 'invalid-parent' | 'exists' | 'io'; error: string; path?: string };
|
|
@@ -2296,8 +2348,10 @@ export interface SessionManagerAPI {
|
|
|
2296
2348
|
exists: (cwd: string, sessionUuid: string) => Promise<boolean>;
|
|
2297
2349
|
/** Batched token-usage totals, one map entry per requested sessionId. A
|
|
2298
2350
|
* session with no transcript file yet (or one over the main-process size
|
|
2299
|
-
* cap) maps to null.
|
|
2300
|
-
|
|
2351
|
+
* cap) maps to null. `lastContext` = input + cache-read + cache-creation
|
|
2352
|
+
* tokens of the newest model call (null when there is none); `calls` =
|
|
2353
|
+
* number of model calls, each message.id counted once. */
|
|
2354
|
+
usageFor: (cwd: string, sessionIds: string[]) => Promise<Record<string, { inputTokens: number; outputTokens: number; lastContext: number | null; calls: number } | null>>;
|
|
2301
2355
|
/** Fires once per main-process flush with the ORDERED batch of events that
|
|
2302
2356
|
* flush produced (never one call per event) — see transcripts.cjs's
|
|
2303
2357
|
* doFlush / MAX_EVENTS_PER_BATCH. */
|
|
@@ -2397,6 +2451,14 @@ export interface SessionManagerAPI {
|
|
|
2397
2451
|
/** Fires after any save/delete/setProject — re-fetch list(). */
|
|
2398
2452
|
onChanged: (handler: () => void) => () => void;
|
|
2399
2453
|
};
|
|
2454
|
+
needsYou: {
|
|
2455
|
+
/** Open items only, across every app. */
|
|
2456
|
+
list: () => Promise<{ ok: true; items: NeedsYouItem[] }>;
|
|
2457
|
+
/** Answer one open item with one of its options; `ok: false` + error in words when no such open item/option. */
|
|
2458
|
+
answer: (payload: { app: string; id: string; answer: string }) => Promise<{ ok: true; item: NeedsYouItem } | { ok: false; error: string }>;
|
|
2459
|
+
/** Fires after any post/withdraw/answer — re-fetch list(). */
|
|
2460
|
+
onChanged: (handler: () => void) => () => void;
|
|
2461
|
+
};
|
|
2400
2462
|
appPreview: {
|
|
2401
2463
|
/** The Epic's package.json scripts (dir = worktree when it has one) plus a suggested dev script. */
|
|
2402
2464
|
scripts: (payload: { cwd: string; epicId: string }) => Promise<AppPreviewScriptsResult>;
|
|
@@ -2498,8 +2560,14 @@ export interface SessionManagerAPI {
|
|
|
2498
2560
|
configPath: () => Promise<string>;
|
|
2499
2561
|
};
|
|
2500
2562
|
customerFeedback: {
|
|
2501
|
-
|
|
2502
|
-
|
|
2563
|
+
/** `images` are raw data URLs; main prepares (validates/downscales) them before sending. */
|
|
2564
|
+
submit: (p: {
|
|
2565
|
+
title: string;
|
|
2566
|
+
body: string;
|
|
2567
|
+
tag: CustomerFeedbackTag;
|
|
2568
|
+
images?: { dataUrl: string }[];
|
|
2569
|
+
}) => Promise<
|
|
2570
|
+
{ ok: true; item: CustomerFeedbackItem; warning?: string } | { ok: false; error: string }
|
|
2503
2571
|
>;
|
|
2504
2572
|
list: () => Promise<CustomerFeedbackItem[]>;
|
|
2505
2573
|
refreshStatus: () => Promise<
|
|
@@ -2520,6 +2588,10 @@ export interface SessionManagerAPI {
|
|
|
2520
2588
|
inboxLinkEpic: (p: { id: string; epicId: string }) => Promise<
|
|
2521
2589
|
{ ok: true } | { ok: false; error: string }
|
|
2522
2590
|
>;
|
|
2591
|
+
/** A cached inbox screenshot as a data URL; `index` is 0-based. */
|
|
2592
|
+
inboxImage(p: { id: string; index: number }): Promise<
|
|
2593
|
+
{ ok: true; dataUrl: string } | { ok: false; error: string }
|
|
2594
|
+
>;
|
|
2523
2595
|
};
|
|
2524
2596
|
telemetry: {
|
|
2525
2597
|
getConfig: () => Promise<TelemetryConfig>;
|
|
@@ -2770,8 +2842,8 @@ export interface SessionManagerAPI {
|
|
|
2770
2842
|
* Kind allowlist is enforced main-side (ipcSchemas.cjs) — this channel is
|
|
2771
2843
|
* append-only, no read/list IPC exists. */
|
|
2772
2844
|
append: (
|
|
2773
|
-
kind: 'epic_create' | 'epic_approve' | 'epic_complete' | 'epic_delete' | 'epic_resume' | 'epic_duplicate' | 'epic_draft_update',
|
|
2774
|
-
fields: { cwd: string; epicId: string; source: string },
|
|
2845
|
+
kind: 'epic_create' | 'epic_approve' | 'epic_complete' | 'epic_delete' | 'epic_resume' | 'epic_duplicate' | 'epic_draft_update' | 'epic_continue',
|
|
2846
|
+
fields: { cwd: string; epicId: string; source: string; fromEpicId?: string },
|
|
2775
2847
|
) => Promise<{ ok: boolean }>;
|
|
2776
2848
|
};
|
|
2777
2849
|
git: {
|
|
@@ -2838,9 +2910,24 @@ export interface SessionManagerAPI {
|
|
|
2838
2910
|
onExternalSend: (handler: (e: ChatExternalSendEvent) => void) => () => void;
|
|
2839
2911
|
/** Reports what the renderer did with an external send (echoing its requestId) back to main. */
|
|
2840
2912
|
reportExternalSendResult: (result: ChatExternalSendResult) => Promise<void>;
|
|
2913
|
+
/** Reports the minted epicId (or an error) for an external new-session that carried a requestId back to main. */
|
|
2914
|
+
reportExternalNewSessionResult: (result: ChatExternalNewSessionResult) => Promise<void>;
|
|
2841
2915
|
/** Fires when a paired phone asks main to start a new Session (payload pre-validated in main). */
|
|
2842
2916
|
onExternalNewSession: (
|
|
2843
|
-
handler: (e: {
|
|
2917
|
+
handler: (e: {
|
|
2918
|
+
cwd: string;
|
|
2919
|
+
agentName: string;
|
|
2920
|
+
tag: AgentPersonaTag;
|
|
2921
|
+
title: string;
|
|
2922
|
+
prompt: string;
|
|
2923
|
+
macroId?: string;
|
|
2924
|
+
/** An outside app's own id for the Epic to create. */
|
|
2925
|
+
externalRef?: string;
|
|
2926
|
+
/** Set when main awaits the result; echo it back via `reportExternalNewSessionResult`. */
|
|
2927
|
+
requestId?: string;
|
|
2928
|
+
via?: 'script';
|
|
2929
|
+
effort?: string;
|
|
2930
|
+
}) => void,
|
|
2844
2931
|
) => () => void;
|
|
2845
2932
|
/** Classify a queued PromptTicket's text as 'inline' (run through
|
|
2846
2933
|
* chatRunner) or 'develop' (dispatch to /develop for PRD decomposition).
|
|
@@ -2950,6 +3037,8 @@ export interface PromptSessionsCreateEpicPayload {
|
|
|
2950
3037
|
sourceTabId?: string;
|
|
2951
3038
|
/** The macro that launched this Epic. */
|
|
2952
3039
|
macroId?: string;
|
|
3040
|
+
/** An outside app's own id for this Epic. */
|
|
3041
|
+
externalRef?: string;
|
|
2953
3042
|
};
|
|
2954
3043
|
/** Full first-prompt body + its labeled sections (epicIntake.ts's
|
|
2955
3044
|
* composeEpicIntake) — carried alongside goalText so the Epic's first
|
|
@@ -2961,7 +3050,7 @@ export interface PromptSessionsCreateEpicPayload {
|
|
|
2961
3050
|
text: string;
|
|
2962
3051
|
source?: string;
|
|
2963
3052
|
/** Which part of its AIM slot this entry is; absent on Epics minted before AIM sections. */
|
|
2964
|
-
part?: 'persona' | 'grounding' | 'injection' | 'reference' | 'job-type' | 'goal';
|
|
3053
|
+
part?: 'persona' | 'grounding' | 'injection' | 'handoff' | 'reference' | 'job-type' | 'goal';
|
|
2965
3054
|
}>;
|
|
2966
3055
|
/** Adopt an existing CLI session of this project instead of minting one. */
|
|
2967
3056
|
restoreSessionId?: string;
|
|
@@ -7,6 +7,13 @@
|
|
|
7
7
|
* read — never writes state, spawns processes, or touches OS UI
|
|
8
8
|
* mutate — everything else that is allowed remotely
|
|
9
9
|
* deny — desktop-only (pty, clipboard, shell, updater, config fs access, …)
|
|
10
|
+
* pack: (invoke/send only, optional) preload packs the positional params into ONE
|
|
11
|
+
* object arg: `["path","base64"]` = `{ path, base64 }` in positional order. A
|
|
12
|
+
* `"...name"` entry spreads that (object) positional arg into the packed object
|
|
13
|
+
* instead of naming a key. Absent = args are forwarded positionally. Browser
|
|
14
|
+
* stand-in (renderer/web/remoteApi.ts) uses it to post the same shape preload would.
|
|
15
|
+
* Rows preload transforms in other ways (voice.setTtsEnabled `!!`, memory.ask /
|
|
16
|
+
* memory.proposeFix nested target) are pinned as KNOWN_UNDESCRIBED in the test.
|
|
10
17
|
* Classification is conservative: when unsure, mutate; screen/clipboard/fs/shell => deny.
|
|
11
18
|
*
|
|
12
19
|
* Drift is caught by __tests__/apiSurface.test.cjs, which replays the real preload.
|