claude-code-session-manager 0.132.0 → 0.133.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/README.md +3 -3
- package/dist/assets/{AgentLibrary-C09MlPFx.js → AgentLibrary-BTIBmZkM.js} +2 -2
- package/dist/assets/{AppSettings-DvDKsCnD.js → AppSettings-DwnfV9-4.js} +2 -2
- package/dist/assets/{Button-BzG_KdBC.js → Button-CObXxw7b.js} +1 -1
- package/dist/assets/DocumentEditorPane-CgB5IuOY.js +1 -0
- package/dist/assets/{Extensions-DgxKT_OZ.js → Extensions-Fuhshcl6.js} +2 -2
- package/dist/assets/{History-Nd3bKjBq.js → History-DbUV4jxK.js} +2 -2
- package/dist/assets/{Library-R71t6VAB.js → Library-COr79GyT.js} +1 -1
- package/dist/assets/{ListDetail-CG50Ul7c.js → ListDetail-DY53nXya.js} +1 -1
- package/dist/assets/{Panel-C7EFG4eU.js → Panel-D7NX5iP8.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-J92iNEGC.js → ProjectClaudeConfig-DuWzM8qA.js} +1 -1
- package/dist/assets/{ProvenanceBadge-C3KB3ILO.js → ProvenanceBadge-AnwE1p5X.js} +1 -1
- package/dist/assets/{Scheduler-DeYBA7uc.js → Scheduler-BHfx0rXd.js} +9 -9
- package/dist/assets/Settings-tt0VZCyz.js +2 -0
- package/dist/assets/{SkillReferenceGraph-D7bt3fyB.js → SkillReferenceGraph-D_rxqWgq.js} +1 -1
- package/dist/assets/{Skills-GpxtUrFP.js → Skills-BVQPJZaF.js} +1 -1
- package/dist/assets/{SourceChip-uyVMCZc7.js → SourceChip-DC5XD8KC.js} +1 -1
- package/dist/assets/{SystemPrompt-Cv25uFSM.js → SystemPrompt-XnvP0_cS.js} +1 -1
- package/dist/assets/{TiptapBody-uP8fJkbM.js → TiptapBody-B_TNEADm.js} +1 -1
- package/dist/assets/{Toggle-DRs80cX-.js → Toggle-CxQO8pGN.js} +1 -1
- package/dist/assets/{ViewTabs-BDkvvzJ8.js → ViewTabs-CEjnWPD9.js} +1 -1
- package/dist/assets/{VoiceButton-Cmtz2sQt.js → VoiceButton-B-6gdmKe.js} +1 -1
- package/dist/assets/{historyTotals-DHwAXunq.js → historyTotals-dT8vcKzX.js} +1 -1
- package/dist/assets/{index-oXqzajWV.css → index-5QIl5Kcd.css} +1 -1
- package/dist/assets/index-BLORXCcT.js +3111 -0
- package/dist/index.html +2 -2
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +427 -413
- package/package.json +4 -2
- package/scripts/README.md +1 -0
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +77 -14
- package/src/main/index.cjs +13 -0
- package/src/main/ipcSchemas.cjs +54 -0
- package/src/main/lib/CLAUDE.md +2 -0
- package/src/main/lib/agent-cli/adapters/antigravity.cjs +147 -0
- package/src/main/lib/agent-cli/adapters/codex.cjs +170 -0
- package/src/main/lib/agent-cli/adapters/cursor.cjs +138 -0
- package/src/main/lib/agent-cli/adapters/gemini.cjs +119 -0
- package/src/main/lib/agent-cli/adapters/opencode.cjs +117 -0
- package/src/main/lib/agent-cli/agentCliEvents.cjs +94 -0
- package/src/main/lib/agent-cli/agentCliIpc.cjs +109 -0
- package/src/main/lib/agent-cli/agentCliRegistry.cjs +213 -0
- package/src/main/lib/agent-cli/agentCliSessionStore.cjs +152 -0
- package/src/main/lib/agent-cli/agentCliTurn.cjs +99 -0
- package/src/main/lib/app-preview/appPreviewIpc.cjs +125 -0
- package/src/main/lib/app-preview/appPreviewManager.cjs +317 -0
- package/src/main/lib/app-preview/appPreviewScripts.cjs +106 -0
- package/src/main/lib/app-preview/appPreviewSweep.cjs +92 -0
- package/src/main/lib/chatBootRecovery.cjs +41 -1
- package/src/main/lib/claude/agentEffortResolve.cjs +11 -3
- package/src/main/lib/epic/activeIndexMerge.cjs +25 -2
- package/src/main/lib/epic/archivedTranscript.cjs +39 -6
- package/src/main/lib/epic/epicChanges.cjs +466 -0
- package/src/main/lib/epic/epicMint.cjs +45 -1
- package/src/main/lib/epic/epicReopen.cjs +8 -2
- package/src/main/lib/epic/epicSpawnPlan.cjs +12 -0
- package/src/main/lib/epic/epicWorktreeMerge.cjs +39 -4
- package/src/main/lib/epic/promptSessionsCreateEpic.cjs +9 -4
- package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +2 -0
- package/src/main/lib/git/gitExec.cjs +9 -1
- package/src/main/lib/git/gitWorktree.cjs +94 -0
- package/src/main/lib/git/unifiedDiff.cjs +207 -0
- package/src/main/lib/mdDocCensus.cjs +364 -0
- package/src/main/lib/mdDocRefs.cjs +249 -0
- package/src/main/lib/mdNetworkScan.cjs +158 -15
- package/src/main/lib/persona-macro/macroJobDispatch.cjs +4 -1
- package/src/main/lib/persona-macro/macroJobIpc.cjs +1 -1
- package/src/main/lib/prd/prdCreate.cjs +7 -2
- package/src/main/lib/prd/prdFrontmatter.cjs +10 -3
- package/src/main/lib/promptSessionSchema.cjs +6 -0
- package/src/main/lib/remoteTranscriptTail.cjs +23 -4
- package/src/main/lib/scheduler/landedSinceRun.cjs +2 -1
- package/src/main/lib/scheduler/scheduleJobSchema.cjs +2 -0
- package/src/main/lib/scheduler/schedulerPaths.cjs +3 -0
- package/src/main/projectPages.cjs +14 -3
- package/src/main/scheduler/gitTreeGuard.cjs +2 -1
- package/src/main/scheduler/prdParser.cjs +2 -1
- package/src/main/scheduler.cjs +7 -2
- package/src/main/transcripts.cjs +18 -4
- package/src/main/webRemote.cjs +10 -5
- package/src/preload/api.d.ts +147 -2
- package/src/preload/apiSurface.json +56 -0
- package/src/preload/index.cjs +22 -0
- package/dist/assets/DocumentEditorPane-fm6zsnLM.js +0 -1
- package/dist/assets/Settings-B6r7N4v-.js +0 -2
- package/dist/assets/index-CBCdyHbZ.js +0 -3097
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-session-manager",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.133.1",
|
|
4
4
|
"description": "Local cockpit for the Claude Code CLI — multi-tab terminal, full config surface, scheduler, voice dictation, and live observability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main/index.cjs",
|
|
@@ -75,7 +75,9 @@
|
|
|
75
75
|
"lint:test-smells": "node scripts/test-quality/smells.cjs --check tests/quality/smell-allowlist.json",
|
|
76
76
|
"lint:page-stewards": "node scripts/check-page-stewards.cjs",
|
|
77
77
|
"lint:e2e-budget": "node scripts/check-e2e-budget.cjs",
|
|
78
|
-
"lint": "
|
|
78
|
+
"lint:scroll": "node scripts/check-scroll-into-view.cjs",
|
|
79
|
+
"check:frame": "node scripts/frame-integrity.mjs",
|
|
80
|
+
"lint": "npm run lint:selectors && npm run lint:hooks && npm run lint:docs && npm run lint:paths && npm run lint:any && npm run lint:main-ts-check && npm run lint:filenames && npm run lint:renderer-storage && npm run lint:test-smells && npm run lint:page-stewards && npm run lint:e2e-budget && npm run lint:scroll",
|
|
79
81
|
"sync:settings-schema": "node scripts/sync-settings-schema.cjs"
|
|
80
82
|
},
|
|
81
83
|
"keywords": [
|
package/scripts/README.md
CHANGED
|
@@ -20,6 +20,7 @@ scripts/lib was moved into src/main/lib (2026-09); nothing under src/ may requir
|
|
|
20
20
|
| check-explicit-any.cjs | `npm run lint:any` (in `lint`) — bans explicit `any`/`@ts-ignore` in renderer+preload; per-line `// lint-allow-any: <reason>` | no |
|
|
21
21
|
| check-main-ts-check.cjs | `npm run lint:main-ts-check` (in `lint`) — `tsconfig.main.json` `include` ⇔ `// @ts-check` first line, both directions; explicit list only, `checkJs` false | no |
|
|
22
22
|
| check-renderer-storage.cjs | `npm run lint:renderer-storage` (in `lint`) — ratchet-bans `localStorage.`/`sessionStorage.` in `src/renderer` outside an explicit ALLOWLIST (Epic stateless-ui-review) | no |
|
|
23
|
+
| check-scroll-into-view.cjs | `npm run lint:scroll` (in `lint`) — bans `scrollIntoView(` in non-test `src/renderer`; use `src/renderer/lib/scrollWithin.ts` (it drags overflow-hidden layout frames) | no |
|
|
23
24
|
| check-tracked-filenames.cjs | `npm run lint:filenames` (in `lint`) — fails on tracked paths with Windows-illegal chars, trailing dot/space, or reserved device names | no |
|
|
24
25
|
| check-unstable-selectors.cjs | `npm run lint:selectors` (in `lint`) | no |
|
|
25
26
|
| install-scheduler-mcp-user-scope.sh | manual (`seedSchedulerMcp.cjs` does the same on first boot, or on the next boot after its marker file is deleted) | no |
|
package/src/main/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"gitSha": "
|
|
4
|
-
"gitShortSha": "
|
|
2
|
+
"version": "0.133.1",
|
|
3
|
+
"gitSha": "4c74235ec6f1e9687e72c9de96deab9b6287f6d9",
|
|
4
|
+
"gitShortSha": "4c74235e",
|
|
5
5
|
"gitBranch": "HEAD",
|
|
6
|
-
"builtAt": "2026-11-
|
|
6
|
+
"builtAt": "2026-11-14T04:00:21.487Z",
|
|
7
7
|
"dirty": false
|
|
8
8
|
}
|
package/src/main/chatRunner.cjs
CHANGED
|
@@ -57,6 +57,9 @@ const chatInflight = require('./lib/chatInflight.cjs');
|
|
|
57
57
|
const { feedChildStdin } = require('./lib/process/childStdin.cjs');
|
|
58
58
|
const memoryScope = require('./lib/process/memoryScope.cjs');
|
|
59
59
|
const { createHeadTailBuffer } = require('./lib/util/headTailBuffer.cjs');
|
|
60
|
+
const { isNonClaudeAgentCli } = require('./lib/agent-cli/agentCliEvents.cjs');
|
|
61
|
+
const { planAgentCliTurn } = require('./lib/agent-cli/agentCliTurn.cjs');
|
|
62
|
+
const { writeNativeSession } = require('./lib/agent-cli/agentCliSessionStore.cjs');
|
|
60
63
|
|
|
61
64
|
// Caps on per-run stream buffers (a run can last hours).
|
|
62
65
|
const STDERR_TAIL_MAX = 64 * 1024;
|
|
@@ -598,7 +601,13 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
|
|
|
598
601
|
});
|
|
599
602
|
};
|
|
600
603
|
|
|
601
|
-
|
|
604
|
+
// Non-Claude agent-CLI Epic (codex, gemini, …): the turn spawns that CLI's adapter command
|
|
605
|
+
// instead of claude; every Claude-only resolution below is skipped for it.
|
|
606
|
+
let agentEpic = null;
|
|
607
|
+
try { agentEpic = agentModelResolve.findEpicByClaudeSessionId(cwd, sessionId); } catch { agentEpic = null; }
|
|
608
|
+
const isAgentCli = !!(agentEpic && isNonClaudeAgentCli(agentEpic.agentCli));
|
|
609
|
+
|
|
610
|
+
const claudeBin = isAgentCli ? null : resolveClaudeBin();
|
|
602
611
|
// Carried down to any MCP server this run spawns (e.g.
|
|
603
612
|
// scripts/scheduler-mcp-server.cjs, inherited via the claude CLI's own
|
|
604
613
|
// child env) so scheduler_create_prd can auto-resolve sourcePromptId
|
|
@@ -627,16 +636,18 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
|
|
|
627
636
|
// throws; falls back to the hardcoded 'sonnet' literal when there's no
|
|
628
637
|
// Epic, no agentType, or the persona has no model/'inherit' — --model
|
|
629
638
|
// must never be left unpinned (CLAUDE.md model-pinning rule).
|
|
630
|
-
const model = agentModelResolve.resolveEpicModel({ cwd, claudeSessionId: sessionId });
|
|
639
|
+
const model = isAgentCli ? null : agentModelResolve.resolveEpicModel({ cwd, claudeSessionId: sessionId });
|
|
631
640
|
// Persona `effort:` (same overlay-aware persona, agentEffortResolve.cjs);
|
|
632
641
|
// effortArgs() yields NO tokens for inherit/absent/dangling.
|
|
633
|
-
const effortFlags = effortArgs(resolveEpicEffort({ cwd, claudeSessionId: sessionId }).effort);
|
|
642
|
+
const effortFlags = isAgentCli ? [] : effortArgs(resolveEpicEffort({ cwd, claudeSessionId: sessionId }).effort);
|
|
634
643
|
|
|
635
644
|
// Develop-loop-off Epics launch with the dev plugin disabled for this session only.
|
|
636
645
|
let loopOffArgs = [];
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
646
|
+
if (!isAgentCli) {
|
|
647
|
+
try {
|
|
648
|
+
loopOffArgs = developLoopOffSettingsArgs(agentModelResolve.findEpicByClaudeSessionId(cwd, sessionId));
|
|
649
|
+
} catch { /* lookup failure = launch as today */ }
|
|
650
|
+
}
|
|
640
651
|
|
|
641
652
|
// Main is authoritative about --resume vs --session-id AND the spawn cwd, and it decides
|
|
642
653
|
// them TOGETHER (epicSpawnPlan.cjs): a transcript under an encoding the spawn cwd cannot see
|
|
@@ -652,8 +663,25 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
|
|
|
652
663
|
settle();
|
|
653
664
|
return;
|
|
654
665
|
}
|
|
666
|
+
// Agent-CLI turn plan (agentCliTurn.cjs): command, argv, stdin, auth env, parser, transcript.
|
|
667
|
+
let agentPlan = null;
|
|
668
|
+
if (isAgentCli) {
|
|
669
|
+
agentPlan = planAgentCliTurn({ epic: agentEpic, claudeSessionId: sessionId, cwd: plan.execCwd, prompt: fullPrompt });
|
|
670
|
+
if (!agentPlan.ok) {
|
|
671
|
+
emitTerminal('chat:run:error', { tabId, sessionId, code: agentPlan.code, message: agentPlan.message });
|
|
672
|
+
if (silent && typeof onSilentError === 'function') {
|
|
673
|
+
try { onSilentError(agentPlan.message, agentPlan.code); } catch { /* caller bug must not wedge the lane */ }
|
|
674
|
+
}
|
|
675
|
+
settle();
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
const agentEnv = agentPlan
|
|
680
|
+
? cleanChildEnv({ PATH: pathWithUserBins(), SM_CHAT_SESSION_ID: sessionId, SM_PROJECT_ROOT: cwd, ...agentPlan.envExtra })
|
|
681
|
+
: null;
|
|
682
|
+
|
|
655
683
|
const useResume = plan.useResume;
|
|
656
|
-
if (useResume !== !!resume) {
|
|
684
|
+
if (!agentPlan && useResume !== !!resume) {
|
|
657
685
|
try {
|
|
658
686
|
logs.writeLine({
|
|
659
687
|
scope: 'chatRunner',
|
|
@@ -764,8 +792,10 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
|
|
|
764
792
|
// A turn's background processes (dev server, local service) outlive it on
|
|
765
793
|
// purpose: the scope is never stopped; created --collect, systemd collects it once empty.
|
|
766
794
|
try {
|
|
767
|
-
const chatArgs = buildArgs(resumeFlag);
|
|
768
|
-
let target =
|
|
795
|
+
const chatArgs = agentPlan ? agentPlan.args : buildArgs(resumeFlag);
|
|
796
|
+
let target = agentPlan
|
|
797
|
+
? { command: agentPlan.command, args: chatArgs }
|
|
798
|
+
: claudeSpawnTarget('chat', sessionId, claudeBin, chatArgs);
|
|
769
799
|
// Limits first: with the cap off, never probe systemd.
|
|
770
800
|
const limits = memoryScope.memoryLimitsFor({ totalRamMb: Math.floor(require('node:os').totalmem() / 1048576) });
|
|
771
801
|
{
|
|
@@ -778,11 +808,12 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
|
|
|
778
808
|
target = { ...target, command: wrapped.command, args: wrapped.args, argv0: undefined };
|
|
779
809
|
}
|
|
780
810
|
}
|
|
811
|
+
if (agentPlan) agentPlan.transcript.userPrompt(fullPrompt);
|
|
781
812
|
thisChild = spawn(target.command, target.args || chatArgs, {
|
|
782
813
|
...(target.argv0 ? { argv0: target.argv0 } : {}),
|
|
783
814
|
...(target.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}),
|
|
784
815
|
cwd: execCwd,
|
|
785
|
-
env: childEnv,
|
|
816
|
+
env: agentPlan ? agentEnv : childEnv,
|
|
786
817
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
787
818
|
...detachedSpawnOpts(), // own process group so killTree can SIGTERM descendants
|
|
788
819
|
});
|
|
@@ -799,7 +830,7 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
|
|
|
799
830
|
}
|
|
800
831
|
child = thisChild;
|
|
801
832
|
chatInflight.begin(sessionId, { tabId, cwd, pid: thisChild.pid, startedAt, resume, silent, promptId, origin, worktreeDirHint }).catch(() => {});
|
|
802
|
-
feedChildStdin(thisChild, fullPrompt, {
|
|
833
|
+
feedChildStdin(thisChild, agentPlan ? agentPlan.stdin : fullPrompt, {
|
|
803
834
|
log: (m) => logs.writeLine({ scope: 'chatRunner', level: 'warn', message: m }),
|
|
804
835
|
});
|
|
805
836
|
|
|
@@ -907,11 +938,37 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
|
|
|
907
938
|
}
|
|
908
939
|
};
|
|
909
940
|
|
|
941
|
+
// Agent-CLI turns: the adapter's parser translates each native line into Claude
|
|
942
|
+
// stream-json events, which are recorded and then fed through processLine unchanged.
|
|
943
|
+
let nativeIdSaved = false;
|
|
944
|
+
const processAgentEvents = (events) => {
|
|
945
|
+
for (const ev of Array.isArray(events) ? events : []) {
|
|
946
|
+
try { agentPlan.transcript.event(ev); } catch { /* transcript never fails a turn */ }
|
|
947
|
+
if (ev && ev.type === 'system' && ev.subtype === 'init' && typeof ev.session_id === 'string'
|
|
948
|
+
&& ev.session_id && !nativeIdSaved) {
|
|
949
|
+
nativeIdSaved = true;
|
|
950
|
+
try {
|
|
951
|
+
writeNativeSession(sessionId, { cli: agentPlan.cli, nativeSessionId: ev.session_id });
|
|
952
|
+
} catch (err) {
|
|
953
|
+
logs.writeLine({ scope: 'chatRunner', level: 'warn', message: `agent-cli native session write failed: ${err?.message ?? err}` });
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
processLine(JSON.stringify(ev));
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
const handleLine = (line) => {
|
|
960
|
+
if (!agentPlan) { processLine(line); return; }
|
|
961
|
+
if (!line) return;
|
|
962
|
+
let events = [];
|
|
963
|
+
try { events = agentPlan.parser.push(line); } catch { events = []; }
|
|
964
|
+
processAgentEvents(events);
|
|
965
|
+
};
|
|
966
|
+
|
|
910
967
|
thisChild.stdout.on('data', (chunk) => {
|
|
911
968
|
lineBuffer += chunk.toString('utf8');
|
|
912
969
|
let nl;
|
|
913
970
|
while ((nl = lineBuffer.indexOf('\n')) !== -1) {
|
|
914
|
-
|
|
971
|
+
handleLine(lineBuffer.slice(0, nl).trim());
|
|
915
972
|
lineBuffer = lineBuffer.slice(nl + 1);
|
|
916
973
|
}
|
|
917
974
|
if (lineBuffer.length > LINE_BUFFER_MAX) {
|
|
@@ -955,12 +1012,18 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
|
|
|
955
1012
|
// terminalSent latch.
|
|
956
1013
|
thisChild.on('close', (code, signal) => {
|
|
957
1014
|
// Flush any partial line that didn't end with \n
|
|
958
|
-
if (lineBuffer.trim())
|
|
1015
|
+
if (lineBuffer.trim()) handleLine(lineBuffer.trim());
|
|
1016
|
+
if (agentPlan) {
|
|
1017
|
+
let endEvents = [];
|
|
1018
|
+
try { endEvents = agentPlan.parser.end({ exitCode: code }); } catch { endEvents = []; }
|
|
1019
|
+
processAgentEvents(endEvents);
|
|
1020
|
+
try { agentPlan.transcript.close(); } catch { /* never fails a turn */ }
|
|
1021
|
+
}
|
|
959
1022
|
|
|
960
1023
|
// Flag-swap retry: the CLI rejected the session flag before doing any
|
|
961
1024
|
// work. Retry exactly once with the other flag; the timers, lane and
|
|
962
1025
|
// terminal latch stay at executeRun level, so this is still one turn.
|
|
963
|
-
if (!terminalSent && !killed && code !== 0 && attemptNo === 1
|
|
1026
|
+
if (!agentPlan && !terminalSent && !killed && code !== 0 && attemptNo === 1
|
|
964
1027
|
&& finalAssistantText === '' && recentToolUses.length === 0
|
|
965
1028
|
&& !/rate.?limit/i.test(stderrText())) {
|
|
966
1029
|
const swapTo = resumeFlag
|
package/src/main/index.cjs
CHANGED
|
@@ -75,6 +75,7 @@ const promptSessionsCreateEpic = require('./lib/epic/promptSessionsCreateEpic.cj
|
|
|
75
75
|
const customerFeedbackIpc = require('./lib/feedback-remote/customerFeedbackIpc.cjs');
|
|
76
76
|
const epicWorktreeMint = require('./lib/epic/epicWorktreeMint.cjs');
|
|
77
77
|
const epicWorktreeMerge = require('./lib/epic/epicWorktreeMerge.cjs');
|
|
78
|
+
const { registerAppPreviewHandlers, getAppPreviewManager } = require('./lib/app-preview/appPreviewIpc.cjs');
|
|
78
79
|
const epicWorktreeProjectConfig = require('./lib/epic/epicWorktreeProjectConfig.cjs');
|
|
79
80
|
const macroLibrary = require('./lib/persona-macro/macroLibrary.cjs');
|
|
80
81
|
const { resolveModelCatalog } = require('./lib/claude/modelCatalog.cjs');
|
|
@@ -1086,6 +1087,8 @@ require('./lib/epic/archivedTranscript.cjs').registerIpc(ipcMain);
|
|
|
1086
1087
|
customerFeedbackIpc.registerCustomerFeedbackHandlers();
|
|
1087
1088
|
epicWorktreeMint.registerEpicWorktreeMintHandlers();
|
|
1088
1089
|
epicWorktreeMerge.registerEpicWorktreeMergeHandlers();
|
|
1090
|
+
require('./lib/epic/epicChanges.cjs').registerEpicChangesHandlers();
|
|
1091
|
+
registerAppPreviewHandlers(ipcMain, { getWindow: () => mainWindow });
|
|
1089
1092
|
require('./lib/epic/epicReopen.cjs').registerEpicReopenHandlers();
|
|
1090
1093
|
epicWorktreeProjectConfig.registerEpicWorktreeProjectConfigHandlers();
|
|
1091
1094
|
registerMemoryAggregateIpc();
|
|
@@ -1115,6 +1118,7 @@ filesIpc.registerFilesHandlers();
|
|
|
1115
1118
|
registerDocEditHandlers();
|
|
1116
1119
|
webRemote.registerRemoteHandlers();
|
|
1117
1120
|
registerAgentsHandlers({ ipcMain, getWindow: () => mainWindow });
|
|
1121
|
+
require('./lib/agent-cli/agentCliIpc.cjs').registerAgentCliHandlers({ ipcMain });
|
|
1118
1122
|
try {
|
|
1119
1123
|
registerUpdaterIpc({ ipcMain, getWindow: () => mainWindow, ptyManager });
|
|
1120
1124
|
} catch (e) {
|
|
@@ -1285,6 +1289,12 @@ app.on('web-contents-created', (_e, wc) => {
|
|
|
1285
1289
|
|
|
1286
1290
|
app.whenReady().then(async () => {
|
|
1287
1291
|
logs.pruneOld();
|
|
1292
|
+
// Kill "Run preview" dev servers orphaned by a crashed previous run
|
|
1293
|
+
// (they outlive us when a child setsid'd out of the process group).
|
|
1294
|
+
try {
|
|
1295
|
+
const count = require('./lib/app-preview/appPreviewSweep.cjs').sweepOrphanedPreviews();
|
|
1296
|
+
if (count > 0) logs.writeLine({ scope: 'app-preview', level: 'warn', message: 'killed orphaned previews', meta: { count } });
|
|
1297
|
+
} catch { /* best-effort */ }
|
|
1288
1298
|
logs.writeLine({ scope: 'main', level: 'info', message: 'app start', meta: { version: app.getVersion(), platform: process.platform } });
|
|
1289
1299
|
logs.writeLine({ scope: 'main', level: 'info', message: 'ozone platform', meta: { ozonePlatform: app.commandLine.getSwitchValue('ozone-platform') || 'default', override: process.env.SM_OZONE_PLATFORM || null } });
|
|
1290
1300
|
|
|
@@ -1693,6 +1703,8 @@ function runShutdownCleanup() {
|
|
|
1693
1703
|
// later before-quit/will-quit firing is a safe no-op.
|
|
1694
1704
|
releaseSchedulerOwnership();
|
|
1695
1705
|
try { scheduler.stop(); } catch { /* */ }
|
|
1706
|
+
// App preview dev servers die with the app (sync SIGKILL of each tree).
|
|
1707
|
+
try { getAppPreviewManager().stopAll(); } catch { /* */ }
|
|
1696
1708
|
// PRD F1 v2 §IPC plumbing: must unregisterAll on will-quit.
|
|
1697
1709
|
try { globalShortcut.unregisterAll(); } catch { /* */ }
|
|
1698
1710
|
voiceHotkey.disposeOnQuit();
|
|
@@ -1723,6 +1735,7 @@ app.on('activate', () => {
|
|
|
1723
1735
|
app.on('before-quit', () => {
|
|
1724
1736
|
releaseSchedulerOwnership();
|
|
1725
1737
|
supervisor.stopSupervisor();
|
|
1738
|
+
try { getAppPreviewManager().stopAll(); } catch { /* */ }
|
|
1726
1739
|
ptyManager.killAll();
|
|
1727
1740
|
configMgr.closeAllWatchers();
|
|
1728
1741
|
closeAllProjectPagesWatchers();
|
package/src/main/ipcSchemas.cjs
CHANGED
|
@@ -15,6 +15,7 @@ const { PERSONA_NAME_RE } = require('./agentLibrary.cjs');
|
|
|
15
15
|
const { AgentPersonaSaveSchema, PersonaNameSchema, ProjectCwdSchema } = require('./lib/persona-macro/agentPersonaSchema.cjs');
|
|
16
16
|
const { MacroSaveSchema, MacroDeleteSchema, MacroSetProjectSchema, MacroRemoveFromProjectSchema, MacroInputSchema } = require('./lib/persona-macro/macroLibrary.cjs');
|
|
17
17
|
const { MAX_SLOTS } = require('./lib/scheduler/sessionSlots.cjs');
|
|
18
|
+
const { PRD_EFFORT_LEVELS } = require('./lib/prd/prdFrontmatter.cjs');
|
|
18
19
|
// Aliased: this file already has a looser, exchanges-only SESSION_ID_RE (Exchanges section).
|
|
19
20
|
const { SESSION_ID_RE: RESTORABLE_SESSION_ID_RE } = require('./lib/epic/restorableSessions.cjs');
|
|
20
21
|
|
|
@@ -241,6 +242,11 @@ const promptSessionsCreateEpic = z.object({
|
|
|
241
242
|
// it becomes a transcript filename) instead of minting a fresh one. Absent =
|
|
242
243
|
// a normal mint; ensureEpic's restore gate decides whether the id may be adopted.
|
|
243
244
|
restoreSessionId: z.string().regex(RESTORABLE_SESSION_ID_RE).optional(),
|
|
245
|
+
// Which agent CLI drives this Epic; absent = Claude Code. ensureEpic enforces
|
|
246
|
+
// the Claude-only rules (non-Claude => develop loop off, no restore).
|
|
247
|
+
agentCli: z.enum(['claude', 'codex', 'gemini', 'antigravity', 'cursor', 'opencode']).optional(),
|
|
248
|
+
// Model passed to a non-Claude CLI; absent = that CLI's own default.
|
|
249
|
+
agentCliModel: z.string().min(1).max(128).optional(),
|
|
244
250
|
});
|
|
245
251
|
|
|
246
252
|
// Renderer entry point for the "Restore a session" picker: this project's CLI
|
|
@@ -284,6 +290,33 @@ const promptSessionsMergeToMain = z.object({
|
|
|
284
290
|
carriedPaths: z.array(z.string().min(1).max(4096)).max(100000).optional(),
|
|
285
291
|
});
|
|
286
292
|
|
|
293
|
+
// Epic Changes view read (lib/epic/epicChanges.cjs getEpicChanges). Strict so
|
|
294
|
+
// an unknown key is refused; getEpicChanges re-validates cwd (absolute +
|
|
295
|
+
// validatePath) and epicId (isSafeEpicId) itself.
|
|
296
|
+
const epicChangesGet = z.object({
|
|
297
|
+
cwd: z.string().min(1),
|
|
298
|
+
epicId: z.string().min(1).max(200),
|
|
299
|
+
}).strict();
|
|
300
|
+
|
|
301
|
+
// App preview (lib/app-preview/appPreviewIpc.cjs). Main resolves the dev
|
|
302
|
+
// server's dir from the active index — the renderer sends only cwd + epicId,
|
|
303
|
+
// never a path to run in. The script regex mirrors appPreviewScripts.cjs's
|
|
304
|
+
// SCRIPT_NAME_RE (kept literal here; a test asserts they match): no leading
|
|
305
|
+
// '-' (so '--inspect' can't become an npm flag) and no shell metacharacters.
|
|
306
|
+
const APP_PREVIEW_SCRIPT_RE = /^[A-Za-z0-9@_][A-Za-z0-9:_.@/-]{0,99}$/;
|
|
307
|
+
const appPreviewScripts = z.object({
|
|
308
|
+
cwd: z.string().min(1).max(4096),
|
|
309
|
+
epicId: z.string().regex(PROMPT_SESSION_ID_RE),
|
|
310
|
+
});
|
|
311
|
+
const appPreviewStart = z.object({
|
|
312
|
+
cwd: z.string().min(1).max(4096),
|
|
313
|
+
epicId: z.string().regex(PROMPT_SESSION_ID_RE),
|
|
314
|
+
script: z.string().regex(APP_PREVIEW_SCRIPT_RE),
|
|
315
|
+
});
|
|
316
|
+
const appPreviewStop = z.object({
|
|
317
|
+
epicId: z.string().regex(PROMPT_SESSION_ID_RE),
|
|
318
|
+
});
|
|
319
|
+
|
|
287
320
|
// Renderer entry points for the per-project "disable Epic worktree
|
|
288
321
|
// isolation" UI toggle (lib/epic/epicWorktreeProjectConfig.cjs) — PRD 1035.
|
|
289
322
|
const promptSessionsGetWorktreeDisabled = z.object({
|
|
@@ -717,6 +750,7 @@ const macrosDispatchJob = z.object({
|
|
|
717
750
|
macroId: z.string().min(1).max(128),
|
|
718
751
|
epicId: z.string().min(1).max(200),
|
|
719
752
|
extraInstructions: z.string().max(4000).optional(),
|
|
753
|
+
effort: z.enum(/** @type {[string, ...string[]]} */ ([...PRD_EFFORT_LEVELS])).optional(),
|
|
720
754
|
});
|
|
721
755
|
const macrosJobStatus = z.object({ cwd: z.string().min(1).max(4096) });
|
|
722
756
|
|
|
@@ -879,6 +913,20 @@ const projectPagesCwd = z.object({
|
|
|
879
913
|
cwd: z.string().min(1).max(4096),
|
|
880
914
|
}).strict();
|
|
881
915
|
|
|
916
|
+
// project-pages:md-network — cwd plus optional human folder overrides for the
|
|
917
|
+
// census. Folders are repo-relative path PREFIXES used only for classification
|
|
918
|
+
// (never joined onto the fs), so the shape check here is the whole contract.
|
|
919
|
+
const mdNetworkFolder = z.string().min(1).max(512).refine(
|
|
920
|
+
(f) => !f.startsWith('/') && !f.includes('\\') && !f.includes('\0') && !f.split('/').includes('..'),
|
|
921
|
+
{ message: "folder must be repo-relative (no leading '/', backslash, NUL or '..' segment)" },
|
|
922
|
+
);
|
|
923
|
+
const mdNetworkFolderList = z.array(mdNetworkFolder).max(50);
|
|
924
|
+
const projectPagesMdNetwork = z.object({
|
|
925
|
+
cwd: z.string().min(1).max(4096),
|
|
926
|
+
recordFolders: mdNetworkFolderList.optional(),
|
|
927
|
+
docFolders: mdNetworkFolderList.optional(),
|
|
928
|
+
}).strict();
|
|
929
|
+
|
|
882
930
|
// ──────────────────────────────────────────── Project Home admin route
|
|
883
931
|
// Real path validation is projectRootResolve.cjs + config.cjs's validatePath;
|
|
884
932
|
// html content limits live in projectHomeAdminRoutes.cjs's validateHomeHtml.
|
|
@@ -1432,7 +1480,11 @@ module.exports = {
|
|
|
1432
1480
|
SAS_GATED_READS,
|
|
1433
1481
|
MUTATE_COMMANDS,
|
|
1434
1482
|
ALLOWED_COMMANDS,
|
|
1483
|
+
APP_PREVIEW_SCRIPT_RE,
|
|
1435
1484
|
schemas: {
|
|
1485
|
+
appPreviewScripts,
|
|
1486
|
+
appPreviewStart,
|
|
1487
|
+
appPreviewStop,
|
|
1436
1488
|
webRemotePair,
|
|
1437
1489
|
webRemoteRevokeDevice,
|
|
1438
1490
|
webRemoteAuditTail,
|
|
@@ -1509,6 +1561,7 @@ module.exports = {
|
|
|
1509
1561
|
memoryProposeFix,
|
|
1510
1562
|
projectBriefCwd,
|
|
1511
1563
|
projectPagesCwd,
|
|
1564
|
+
projectPagesMdNetwork,
|
|
1512
1565
|
projectPagesRename,
|
|
1513
1566
|
projectPagesDelete,
|
|
1514
1567
|
projectHomeAdminWriteBody,
|
|
@@ -1532,6 +1585,7 @@ module.exports = {
|
|
|
1532
1585
|
promptSessionsReadArchived,
|
|
1533
1586
|
promptSessionsReadSessionTranscript,
|
|
1534
1587
|
promptSessionsMergeToMain,
|
|
1588
|
+
epicChangesGet,
|
|
1535
1589
|
promptSessionsGetWorktreeDisabled,
|
|
1536
1590
|
promptSessionsSetWorktreeDisabled,
|
|
1537
1591
|
auditLogAppend,
|
package/src/main/lib/CLAUDE.md
CHANGED
|
@@ -4,6 +4,8 @@ Shared main-process helpers (CommonJS `.cjs`). Layout source of truth: `scripts/
|
|
|
4
4
|
|
|
5
5
|
## What's here
|
|
6
6
|
|
|
7
|
+
- `agent-cli/` — other agent CLIs: registry, adapters, session store, turn planner, IPC.
|
|
8
|
+
- `app-preview/` — Epic dev-server preview processes (spawn, URL detect, stop, orphan sweep).
|
|
7
9
|
- `claude/` — claude CLI binary, caps, model/effort resolution.
|
|
8
10
|
- `epic/` — Epic mint, worktrees, active index, spawn plan/cwd, transcripts.
|
|
9
11
|
- `feedback-remote/` — cross-project and customer feedback conduits.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Google Antigravity CLI (`agy`) adapter: builds headless/interactive argv and
|
|
3
|
+
// translates agy's `--output-format stream-json` NDJSON (every line carries an
|
|
4
|
+
// `event` field: init / step_update / result) into the Claude stream-json
|
|
5
|
+
// events from ../agentCliEvents.cjs. The prompt is delivered over stdin as one
|
|
6
|
+
// `--input-format stream-json` user line, never in argv; agy exits after stdin
|
|
7
|
+
// closes. `--conversation <id>` resumes. Pure module.
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
initEvent, textEvent, toolUseEvent, toolResultEvent, resultEvent, safeJsonLine,
|
|
11
|
+
} = require('../agentCliEvents.cjs');
|
|
12
|
+
|
|
13
|
+
const SKIP_PERMS = '--dangerously-skip-permissions';
|
|
14
|
+
const HEADLESS_FLAGS = ['--input-format', 'stream-json', '--output-format', 'stream-json', SKIP_PERMS];
|
|
15
|
+
|
|
16
|
+
const str = (v) => (typeof v === 'string' ? v : undefined);
|
|
17
|
+
const hasId = (id) => typeof id === 'string' && id.length > 0;
|
|
18
|
+
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
19
|
+
const sessionArgs = (id) => (hasId(id) ? ['--conversation', id] : []);
|
|
20
|
+
const modelArgs = (model) => (typeof model === 'string' && model ? ['--model', model] : []);
|
|
21
|
+
|
|
22
|
+
function headlessSpawn({ prompt, nativeSessionId, model } = {}) {
|
|
23
|
+
return {
|
|
24
|
+
args: [...HEADLESS_FLAGS, ...sessionArgs(nativeSessionId), ...modelArgs(model)],
|
|
25
|
+
stdin: JSON.stringify({ event: 'user', message: { content: typeof prompt === 'string' ? prompt : '' } }) + '\n',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function interactiveArgs({ nativeSessionId, model } = {}) {
|
|
30
|
+
return [SKIP_PERMS, ...sessionArgs(nativeSessionId), ...modelArgs(model)];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function pickUsage(u) {
|
|
34
|
+
if (!isObj(u)) return undefined;
|
|
35
|
+
const out = {};
|
|
36
|
+
for (const k of ['input_tokens', 'output_tokens']) {
|
|
37
|
+
if (typeof u[k] === 'number' && Number.isFinite(u[k])) out[k] = u[k];
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function createParser() {
|
|
43
|
+
let sessionId = null;
|
|
44
|
+
let resultEmitted = false;
|
|
45
|
+
let initEmitted = false;
|
|
46
|
+
const texts = [];
|
|
47
|
+
const toolStarted = new Set();
|
|
48
|
+
const toolDone = new Set();
|
|
49
|
+
|
|
50
|
+
// conversation_id may sit at the top level or inside the event payload.
|
|
51
|
+
function convId(evt, payload) {
|
|
52
|
+
const id = str(evt.conversation_id) ?? (isObj(payload) ? str(payload.conversation_id) : undefined);
|
|
53
|
+
return hasId(id) ? id : undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function adopt(id) {
|
|
57
|
+
if (id && !sessionId) sessionId = id;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function handleStep(evt, out) {
|
|
61
|
+
const s = evt.step_update;
|
|
62
|
+
if (!isObj(s)) return;
|
|
63
|
+
adopt(convId(evt, s));
|
|
64
|
+
if (s.step_type === 'agent_response') {
|
|
65
|
+
const delta = str(s.text_delta);
|
|
66
|
+
if (delta) {
|
|
67
|
+
texts.push(delta);
|
|
68
|
+
out.push(textEvent(delta));
|
|
69
|
+
}
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (s.step_type !== 'tool') return; // user_input / checkpoint / unknown: ignored
|
|
73
|
+
const key = `${sessionId ?? convId(evt, s) ?? ''}:${s.step_index}`;
|
|
74
|
+
const startTool = () => {
|
|
75
|
+
if (toolStarted.has(key)) return;
|
|
76
|
+
toolStarted.add(key);
|
|
77
|
+
out.push(toolUseEvent({
|
|
78
|
+
id: key,
|
|
79
|
+
name: str(s.tool_name) ?? 'unknown',
|
|
80
|
+
input: isObj(s.tool_info) ? s.tool_info : {},
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
83
|
+
if (s.state === 'ACTIVE') {
|
|
84
|
+
startTool();
|
|
85
|
+
} else if (s.state === 'DONE') {
|
|
86
|
+
if (toolDone.has(key)) return;
|
|
87
|
+
startTool(); // keep tool_use/tool_result paired if ACTIVE was never seen
|
|
88
|
+
toolDone.add(key);
|
|
89
|
+
out.push(toolResultEvent({ toolUseId: key, content: '', isError: false }));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function handleResult(evt, out) {
|
|
94
|
+
const r = evt.result;
|
|
95
|
+
if (!isObj(r) || resultEmitted) return;
|
|
96
|
+
resultEmitted = true;
|
|
97
|
+
adopt(convId(evt, r));
|
|
98
|
+
const text = texts.join('') || str(r.response) || str(r.error) || '';
|
|
99
|
+
out.push(resultEvent({
|
|
100
|
+
ok: r.status === 'SUCCESS',
|
|
101
|
+
text,
|
|
102
|
+
usage: pickUsage(r.usage),
|
|
103
|
+
nativeSessionId: sessionId ?? undefined,
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function handle(evt, out) {
|
|
108
|
+
switch (evt.event) {
|
|
109
|
+
case 'init': {
|
|
110
|
+
adopt(convId(evt, evt.init));
|
|
111
|
+
if (sessionId && !initEmitted) {
|
|
112
|
+
initEmitted = true;
|
|
113
|
+
out.push(initEvent(sessionId, 'antigravity'));
|
|
114
|
+
}
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
case 'step_update':
|
|
118
|
+
handleStep(evt, out);
|
|
119
|
+
return;
|
|
120
|
+
case 'result':
|
|
121
|
+
handleResult(evt, out);
|
|
122
|
+
return;
|
|
123
|
+
default:
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
push(line) {
|
|
129
|
+
const out = [];
|
|
130
|
+
try {
|
|
131
|
+
const evt = safeJsonLine(line);
|
|
132
|
+
if (evt) handle(evt, out);
|
|
133
|
+
} catch {
|
|
134
|
+
return []; // never throw from push; drop the line
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
},
|
|
138
|
+
end() {
|
|
139
|
+
return [];
|
|
140
|
+
},
|
|
141
|
+
nativeSessionId() {
|
|
142
|
+
return sessionId;
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
module.exports = { id: 'antigravity', headlessSpawn, createParser, interactiveArgs };
|