claude-code-session-manager 0.139.0 → 0.140.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/README.md +20 -4
- package/dist/assets/AppSettings-CMFEM68R.js +2 -0
- package/dist/assets/History--JwsFnbn.js +2 -0
- package/dist/assets/{HomeClaudeConfig-CGD2Onjv.js → HomeClaudeConfig-ijEXs--3.js} +2 -2
- package/dist/assets/{Panel-Csyd9HbD.js → Panel-CALyU0pe.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-C-jlYpC_.js → ProjectClaudeConfig-sdlA-fUb.js} +1 -1
- package/dist/assets/Scheduler-YT3j8SUa.js +16 -0
- package/dist/assets/{SkillReferenceGraph-DcscPXAG.js → SkillReferenceGraph-CxAuwhNN.js} +1 -1
- package/dist/assets/{Skills-BpGRKOcY.js → Skills-DtRzghn5.js} +26 -26
- package/dist/assets/{TiptapBody-DSU3769X.js → TiptapBody-DApeu7x8.js} +1 -1
- package/dist/assets/{ViewTabs-C0PRZx4_.js → ViewTabs-B7qLXRAH.js} +1 -1
- package/dist/assets/{VoiceButton-D2rMurNg.js → VoiceButton-DtStfv1H.js} +1 -1
- package/dist/assets/{historyTotals-TcIQs2sh.js → historyTotals-ydfnwepc.js} +1 -1
- package/dist/assets/index-CtxruO1L.js +3121 -0
- package/dist/assets/{index-BCySPdtU.css → index-DKXdXfka.css} +1 -1
- package/dist/index.html +2 -2
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +423 -426
- package/package.json +5 -2
- package/plugins/AGENTS.md +60 -0
- package/plugins/CLAUDE.md +1 -60
- package/plugins/session-manager-dev/skills/develop/SKILL.md +26 -19
- package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +5 -4
- package/plugins/session-manager-dev/skills/maintaining-md-network/audit.md +4 -2
- package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +16 -12
- package/plugins/session-manager-dev/skills/maintaining-md-network/migrate-to-agents-md.md +15 -0
- package/plugins/session-manager-dev/skills/maintaining-md-network/placement.md +50 -2
- package/plugins/session-manager-dev/skills/maintaining-md-network/plan.md +10 -10
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +117 -112
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdDuplicates.cjs +182 -0
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdLinks.cjs +340 -0
- package/scripts/README.md +1 -0
- package/scripts/hooks/guard-tool-risk.cjs +91 -0
- package/scripts/hooks/lib/guard-tool-risk-policy.cjs +217 -0
- package/scripts/ops-sweep.cjs +53 -23
- package/scripts/scheduler-mcp-server.cjs +200 -18
- package/src/main/build-info.json +4 -4
- package/src/main/config.cjs +112 -8
- package/src/main/docEdit.cjs +6 -1
- package/src/main/files.cjs +7 -27
- package/src/main/health.cjs +48 -15
- package/src/main/historyAggregator.cjs +88 -5
- package/src/main/historyDashboard.cjs +69 -4
- package/src/main/index.cjs +56 -2
- package/src/main/ipcSchemas.cjs +112 -16
- package/src/main/lib/AGENTS.md +54 -0
- package/src/main/lib/CLAUDE.md +1 -54
- package/src/main/lib/agent-cli/adapters/codex.cjs +5 -2
- package/src/main/lib/agent-cli/agentCliIpc.cjs +18 -2
- package/src/main/lib/agent-cli/agentCliSessionStore.cjs +1 -0
- package/src/main/lib/agent-cli/agentCliTurn.cjs +20 -2
- package/src/main/lib/agent-cli/geminiContextDefaults.cjs +94 -0
- package/src/main/lib/claude/effectiveModelInfo.cjs +90 -20
- package/src/main/lib/claude/jobSandboxPolicy.cjs +202 -0
- package/src/main/lib/claude/personaToolScope.cjs +12 -6
- package/src/main/lib/claude/rateLimitDetect.cjs +13 -2
- package/src/main/lib/claude/runClaudeP.cjs +6 -1
- package/src/main/lib/claude/toolRiskIpc.cjs +177 -0
- package/src/main/lib/claude/toolRiskMarks.cjs +373 -0
- package/src/main/lib/demo-video-kit/seedKit.cjs +27 -6
- package/src/main/lib/ephemeralCwd.cjs +37 -2
- package/src/main/lib/epic/delegationReadiness.cjs +42 -9
- package/src/main/lib/epic/epicAdminRoutes.cjs +25 -5
- package/src/main/lib/epic/epicOutsideRead.cjs +118 -1
- package/src/main/lib/epic/epicOutsideState.cjs +2 -2
- package/src/main/lib/epic/epicSweepValidator.cjs +7 -2
- package/src/main/lib/epic/epicValidationHook.cjs +24 -4
- package/src/main/lib/epic/guardSpawnSettings.cjs +57 -1
- package/src/main/lib/externalContract.cjs +31 -5
- package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +55 -1
- package/src/main/lib/feedback-remote/crossProjectReply.cjs +106 -11
- package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +47 -19
- package/src/main/lib/feedback-remote/needsYouStore.cjs +6 -2
- package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +98 -1
- package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +5 -0
- package/src/main/lib/git/branchSweep.cjs +209 -4
- package/src/main/lib/git/gitWorktree.cjs +41 -5
- package/src/main/lib/guardShims.cjs +1 -1
- package/src/main/lib/historyRollup.cjs +26 -0
- package/src/main/lib/insideHome.cjs +27 -1
- package/src/main/lib/mcpToolCatalog.cjs +122 -12
- package/src/main/lib/mdDocCensus.cjs +59 -78
- package/src/main/lib/mdDocRefs.cjs +71 -93
- package/src/main/lib/mdNetworkScan.cjs +245 -250
- package/src/main/lib/mdReviewRecord.cjs +22 -9
- package/src/main/lib/memoryMdNetwork.cjs +5 -12
- package/src/main/lib/opsOwnership.cjs +18 -2
- package/src/main/lib/opsRetentionSettings.cjs +28 -4
- package/src/main/lib/persona-macro/macroJobDispatch.cjs +90 -20
- package/src/main/lib/persona-macro/macroJobIpc.cjs +144 -46
- package/src/main/lib/persona-macro/macroJobStatus.cjs +87 -9
- package/src/main/lib/persona-macro/macroLibrary.cjs +95 -5
- package/src/main/lib/persona-macro/personaImportHealth.cjs +78 -17
- package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +96 -0
- package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
- package/src/main/lib/prd/depSlugResolve.cjs +104 -4
- package/src/main/lib/prd/prdAdminRoutes.cjs +35 -2
- package/src/main/lib/prd/prdCreate.cjs +351 -23
- package/src/main/lib/prd/prdDisposition.cjs +11 -2
- package/src/main/lib/prd/prdFrontmatter.cjs +96 -3
- package/src/main/lib/process/loginItem.cjs +171 -0
- package/src/main/lib/process/loginItemPlan.cjs +193 -0
- package/src/main/lib/project-pages/playerBridge.cjs +4 -0
- package/src/main/lib/project-pages/videoReview.cjs +268 -0
- package/src/main/lib/project-pages/videoReviewIpc.cjs +229 -0
- package/src/main/lib/scheduler/cpuSample.cjs +131 -4
- package/src/main/lib/scheduler/fixPlanSlug.cjs +4 -3
- package/src/main/lib/scheduler/loadGate.cjs +24 -6
- package/src/main/lib/scheduler/planRecordHarvest.cjs +108 -0
- package/src/main/lib/scheduler/planRecordRetention.cjs +144 -0
- package/src/main/lib/scheduler/queueStore.cjs +7 -0
- package/src/main/lib/scheduler/rcaReport.cjs +21 -1
- package/src/main/lib/scheduler/reaperHelpers.cjs +35 -5
- package/src/main/lib/scheduler/runLogRetention.cjs +104 -3
- package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
- package/src/main/lib/scheduler/schedulerBatch.cjs +25 -48
- package/src/main/lib/scheduler/schedulerPaths.cjs +3 -0
- package/src/main/lib/scheduler/sessionSlots.cjs +176 -21
- package/src/main/lib/scheduler/validationQuality.cjs +282 -0
- package/src/main/lib/scheduler/validatorVerdictSchema.cjs +254 -0
- package/src/main/lib/tasks/taskAdminRoutes.cjs +641 -0
- package/src/main/lib/tasks/taskIpc.cjs +80 -0
- package/src/main/lib/tasks/taskLedger.cjs +502 -0
- package/src/main/lib/tasks/taskRun.cjs +313 -0
- package/src/main/lib/tasks/taskSwitch.cjs +120 -0
- package/src/main/loginItemIpc.cjs +35 -0
- package/src/main/loopEfficiencyHandlers.cjs +10 -1
- package/src/main/projectPages.cjs +6 -15
- package/src/main/promptSessionEvents.cjs +9 -1
- package/src/main/queueOps.cjs +260 -3
- package/src/main/runVerify.cjs +53 -25
- package/src/main/scheduler/AGENTS.md +26 -0
- package/src/main/scheduler/CLAUDE.md +1 -26
- package/src/main/scheduler/budget.cjs +239 -9
- package/src/main/scheduler/cancelDependents.cjs +154 -0
- package/src/main/scheduler/prdParser.cjs +4 -1
- package/src/main/scheduler/starvation.cjs +20 -18
- package/src/main/scheduler.cjs +745 -64
- package/src/main/supervisor.cjs +5 -1
- package/src/main/templates/PRD_AUTHORING.md +6 -1
- package/src/main/validationQualityHandlers.cjs +199 -0
- package/src/main/webRemote.cjs +10 -2
- package/src/preload/api.d.ts +364 -21
- package/src/preload/apiSurface.json +89 -10
- package/src/preload/index.cjs +23 -2
- package/src/seed/agents/validator.md +19 -8
- package/dist/assets/AppSettings-CUfWY9vN.js +0 -2
- package/dist/assets/History-DDnqaLyw.js +0 -2
- package/dist/assets/Scheduler-NLs08fx7.js +0 -16
- package/dist/assets/index-C-d0DCre.js +0 -3124
|
@@ -8,6 +8,16 @@
|
|
|
8
8
|
* re-exported from historyAggregator.cjs (date math) plus lib/claude/modelPricing.cjs (cost) — never
|
|
9
9
|
* fs/promises, never PROJECTS_DIR. See historyDashboard.test.cjs's zero-scan
|
|
10
10
|
* guarantee test.
|
|
11
|
+
*
|
|
12
|
+
* The one non-rollup input is the Task ledger (lib/tasks/taskLedger.cjs
|
|
13
|
+
* readTaskUsageDays, for every project in lib/tasks/taskSwitch.cjs
|
|
14
|
+
* listTaskProjects, switch on or off). It is still no transcript scan and no
|
|
15
|
+
* PROJECTS_DIR: each project's own session-manager-operations/tasks/ day files.
|
|
16
|
+
* Its spend lands as rows keyed 'sm-task:<absolute cwd>' so the renderer fold
|
|
17
|
+
* puts it on that project's row. Nothing counts twice: Tasks run with
|
|
18
|
+
* --no-session-persistence and write no transcript, and historyAggregator.cjs
|
|
19
|
+
* skips the transcript of any Task that did persist (sibling PRD
|
|
20
|
+
* task-history-skip-task-transcripts), so no rollup line carries Task usage.
|
|
11
21
|
*/
|
|
12
22
|
|
|
13
23
|
'use strict';
|
|
@@ -22,6 +32,58 @@ const { schemas } = require('./ipcSchemas.cjs');
|
|
|
22
32
|
// after this, so it's an effective "no lower bound".
|
|
23
33
|
const EARLIEST_DATE = '1970-01-01';
|
|
24
34
|
|
|
35
|
+
/** Prefix of a Task project's row key in days[].byProject: 'sm-task:' + absolute cwd. */
|
|
36
|
+
const TASK_PROJECT_PREFIX = 'sm-task:';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Default Task readers, required lazily so a dashboard that never reaches
|
|
40
|
+
* them (and the zero-scan test's module graph) stays as it was.
|
|
41
|
+
*/
|
|
42
|
+
function defaultTaskDeps() {
|
|
43
|
+
return {
|
|
44
|
+
listTaskProjects: () => require('./lib/tasks/taskSwitch.cjs').listTaskProjects(),
|
|
45
|
+
readTaskUsageDays: (cwd, range) => require('./lib/tasks/taskLedger.cjs').readTaskUsageDays(cwd, range),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Task ledger days → buckets shaped like rollup lines: per day, one totals
|
|
51
|
+
* bucket (promptCount = sessionCount = task count) and one bucket per model,
|
|
52
|
+
* so they go through the same fold + cost path as transcript rows.
|
|
53
|
+
*/
|
|
54
|
+
async function readTaskBuckets(from, to, deps) {
|
|
55
|
+
const listTaskProjects = deps.listTaskProjects ?? defaultTaskDeps().listTaskProjects;
|
|
56
|
+
const readTaskUsageDays = deps.readTaskUsageDays ?? defaultTaskDeps().readTaskUsageDays;
|
|
57
|
+
const buckets = [];
|
|
58
|
+
for (const { cwd } of listTaskProjects() || []) {
|
|
59
|
+
if (typeof cwd !== 'string' || !cwd) continue;
|
|
60
|
+
let days;
|
|
61
|
+
try {
|
|
62
|
+
days = await readTaskUsageDays(cwd, { sinceDate: from, untilDate: to });
|
|
63
|
+
} catch (err) {
|
|
64
|
+
console.warn(`[historyDashboard] Task ledger read failed for ${cwd}:`, err);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const projectDir = TASK_PROJECT_PREFIX + cwd;
|
|
68
|
+
for (const d of days || []) {
|
|
69
|
+
buckets.push({
|
|
70
|
+
date: d.date, projectDir, modelId: historyRollup.TOTALS_MODEL_ID,
|
|
71
|
+
promptCount: d.tasks || 0, sessionCount: d.tasks || 0,
|
|
72
|
+
});
|
|
73
|
+
for (const [modelId, m] of Object.entries(d.byModel || {})) {
|
|
74
|
+
buckets.push({
|
|
75
|
+
date: d.date, projectDir, modelId,
|
|
76
|
+
inputTokens: m.input_tokens || 0,
|
|
77
|
+
outputTokens: m.output_tokens || 0,
|
|
78
|
+
cacheReadTokens: m.cache_read_input_tokens || 0,
|
|
79
|
+
cacheCreationTokens: m.cache_creation_input_tokens || 0,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return buckets;
|
|
85
|
+
}
|
|
86
|
+
|
|
25
87
|
function emptyProjectRow(date, projectDir) {
|
|
26
88
|
return {
|
|
27
89
|
date,
|
|
@@ -117,10 +179,11 @@ function addRowToTotals(totals, row) {
|
|
|
117
179
|
}
|
|
118
180
|
|
|
119
181
|
/**
|
|
120
|
-
* Answer the History dashboard's full request
|
|
121
|
-
* O(rollup lines in range) — no transcript file is
|
|
182
|
+
* Answer the History dashboard's full request from rollup lines plus the Task
|
|
183
|
+
* ledger. O(rollup lines + Task ledger lines in range) — no transcript file is
|
|
184
|
+
* ever opened. `deps` ({ listTaskProjects, readTaskUsageDays }) is for tests.
|
|
122
185
|
*/
|
|
123
|
-
async function computeDashboard(req) {
|
|
186
|
+
async function computeDashboard(req, deps = {}) {
|
|
124
187
|
const rangeDays = req?.rangeDays ?? 30;
|
|
125
188
|
const isAll = rangeDays === 0;
|
|
126
189
|
const today = localDate(new Date());
|
|
@@ -131,12 +194,13 @@ async function computeDashboard(req) {
|
|
|
131
194
|
const readFrom = isAll ? EARLIEST_DATE : prevFrom;
|
|
132
195
|
|
|
133
196
|
const map = await historyRollup.readRollup(readFrom, to);
|
|
197
|
+
const taskBuckets = await readTaskBuckets(readFrom, to, deps);
|
|
134
198
|
|
|
135
199
|
const daysMap = new Map(); // date -> Map(projectDir -> row)
|
|
136
200
|
const prevRow = emptyProjectRow('', '');
|
|
137
201
|
const finalizedDates = new Set();
|
|
138
202
|
|
|
139
|
-
for (const bucket of map.values()) {
|
|
203
|
+
for (const bucket of [...map.values(), ...taskBuckets]) {
|
|
140
204
|
if (bucket.projectDir === historyRollup.FINALIZED_PROJECT_ID && bucket.modelId === historyRollup.FINALIZED_MODEL_ID) {
|
|
141
205
|
if (bucket.finalizedAt) finalizedDates.add(bucket.date);
|
|
142
206
|
continue;
|
|
@@ -228,4 +292,5 @@ function registerHistoryDashboardHandlers() {
|
|
|
228
292
|
module.exports = {
|
|
229
293
|
registerHistoryDashboardHandlers,
|
|
230
294
|
computeDashboard,
|
|
295
|
+
TASK_PROJECT_PREFIX,
|
|
231
296
|
};
|
package/src/main/index.cjs
CHANGED
|
@@ -126,8 +126,12 @@ require('./lib/epic/epicAdminRoutes.cjs').registerAdminRoute(adminHttp, {
|
|
|
126
126
|
isTabBusy: chatRunner.isTabBusy,
|
|
127
127
|
listJobs: () => scheduler.remote.listJobs(),
|
|
128
128
|
});
|
|
129
|
+
// Validator quality numbers per project for outside callers (read-only).
|
|
130
|
+
require('./validationQualityHandlers.cjs').registerAdminRoute(adminHttp);
|
|
129
131
|
// Persona roster + per-project effective model/effort for outside apps (read-only).
|
|
130
132
|
require('./lib/persona-macro/agentAdminRoutes.cjs').registerAdminRoute(adminHttp);
|
|
133
|
+
// Task primitive: one headless claude -p run for a project, under the slot cap (POST /admin/tasks).
|
|
134
|
+
require('./lib/tasks/taskAdminRoutes.cjs').registerAdminRoute(adminHttp);
|
|
131
135
|
// The scheduler tick turns Epic state changes into epic_state_changed audit rows.
|
|
132
136
|
require('./lib/epic/epicStateWatcher.cjs').configureEpicStateWatcher({ isTabBusy: chatRunner.isTabBusy });
|
|
133
137
|
const supervisor = require('./supervisor.cjs');
|
|
@@ -146,6 +150,7 @@ const { registerHistoryAggregatorHandlers, finalizeClosedDays, refreshIntradayTo
|
|
|
146
150
|
const runLogRetention = require('./lib/scheduler/runLogRetention.cjs');
|
|
147
151
|
const { registerHistoryDashboardHandlers } = require('./historyDashboard.cjs');
|
|
148
152
|
const { registerLoopEfficiencyHandlers } = require('./loopEfficiencyHandlers.cjs');
|
|
153
|
+
const { registerValidationQualityHandlers } = require('./validationQualityHandlers.cjs');
|
|
149
154
|
const { tryAcquireLock, releaseLock, DEFAULT_LOCK_PATH } = require('./lib/scheduler/watchdogHelpers.cjs');
|
|
150
155
|
const { createIntradayRefresh } = require('./lib/intradayRefresh.cjs');
|
|
151
156
|
const schedulerConfig = require('./lib/scheduler/schedulerConfig.cjs');
|
|
@@ -181,6 +186,7 @@ const webRemote = require('./webRemote.cjs');
|
|
|
181
186
|
const { registerAgentsHandlers } = require('./agentsIpc.cjs');
|
|
182
187
|
const { registerTelemetryHandlers } = require('./telemetryIpc.cjs');
|
|
183
188
|
const { registerUpdaterIpc } = require('./updaterIpc.cjs');
|
|
189
|
+
const { registerLoginItemIpc } = require('./loginItemIpc.cjs');
|
|
184
190
|
const { listExchanges } = require('./exchanges.cjs');
|
|
185
191
|
const { resolveClaudeBin } = require('./lib/claude/claudeBin.cjs');
|
|
186
192
|
const { checkInsideHome, assertInsideHome } = require('./lib/insideHome.cjs');
|
|
@@ -642,7 +648,7 @@ function broadcastMacrosChanged() {
|
|
|
642
648
|
ipcMain.handle('macros:list', () => macroLibrary.listMacros());
|
|
643
649
|
// Background macro jobs: dispatch a built-in macro as a scheduler PRD inside an existing Epic.
|
|
644
650
|
// createPrd is wired exactly as chat:create-prd (below) so its own reconcile request queues the row.
|
|
645
|
-
|
|
651
|
+
const macroJobIpcDeps = {
|
|
646
652
|
schemas,
|
|
647
653
|
validatePath: require('./config.cjs').validatePath,
|
|
648
654
|
readActiveIndex: require('./lib/epic/epicMint.cjs').readActiveIndex,
|
|
@@ -651,7 +657,11 @@ require('./lib/persona-macro/macroJobIpc.cjs').registerMacroJobIpc(ipcMain, {
|
|
|
651
657
|
archivePrd: (slug, cwd) => queueOps.archiveMany([slug], cwd),
|
|
652
658
|
// Durable 'job-not-queued' notice on the Epic when a dispatch fails (PRD 2950).
|
|
653
659
|
appendResponseEventWithReason: promptSessionEvents.appendResponseEventWithReason,
|
|
654
|
-
}
|
|
660
|
+
};
|
|
661
|
+
require('./lib/persona-macro/macroJobIpc.cjs').registerMacroJobIpc(ipcMain, macroJobIpcDeps);
|
|
662
|
+
// Project Video review step: list + human decide (approve / ask for changes). Same deps
|
|
663
|
+
// as macroJobIpc — a decision dispatches through runToolJob. Renderer IPC only.
|
|
664
|
+
require('./lib/project-pages/videoReviewIpc.cjs').registerVideoReviewIpc(ipcMain, macroJobIpcDeps);
|
|
655
665
|
// claudeConfig (lib/claudeConfig.cjs): key-scoped read/patch of Claude's JSON config files.
|
|
656
666
|
// A successful patch broadcasts `config:changed` so renderer state refreshes.
|
|
657
667
|
ipcMain.handle('claudeConfig:read', validated(schemas.claudeConfigRead, async (p) => {
|
|
@@ -666,7 +676,27 @@ ipcMain.handle('claudeConfig:patch', validated(schemas.claudeConfigPatch, async
|
|
|
666
676
|
sendIfAlive(mainWindow, 'config:changed', { path: result.path, mtimeMs, kind: 'change' });
|
|
667
677
|
return result;
|
|
668
678
|
}));
|
|
679
|
+
// toolRisk (lib/claude/toolRiskIpc.cjs): System/Project tool-risk marks + the Project
|
|
680
|
+
// interactive opt-in that installs/removes guard-tool-risk in <cwd>/.claude/settings.json.
|
|
681
|
+
require('./lib/claude/toolRiskIpc.cjs').registerToolRiskIpc(ipcMain, {
|
|
682
|
+
schemas,
|
|
683
|
+
validated,
|
|
684
|
+
validatePath: configMgr.validatePath,
|
|
685
|
+
onChanged: ({ path: changedPath }) => sendIfAlive(mainWindow, 'config:changed', { path: changedPath, mtimeMs: Date.now(), kind: 'change' }),
|
|
686
|
+
});
|
|
669
687
|
ipcMain.handle('macros:save', validated(schemas.macrosSave, async (payload) => {
|
|
688
|
+
// A Project Video tool with a job must be runnable by its persona (projectVideoToolCheck.cjs);
|
|
689
|
+
// a refusal throws so the editor shows the reason. Every other save is unchanged.
|
|
690
|
+
const existing = payload.id ? (await macroLibrary.listMacros()).find((m) => m.id === payload.id) : undefined;
|
|
691
|
+
const surface = payload.surface ?? existing?.surface;
|
|
692
|
+
const job = payload.job !== undefined ? payload.job : existing?.job;
|
|
693
|
+
const projects = payload.projects ?? existing?.projects;
|
|
694
|
+
if (surface === 'project-video' && job && typeof job === 'object'
|
|
695
|
+
&& Array.isArray(projects) && projects.length === 1 && projects[0] !== macroLibrary.ALL_PROJECTS) {
|
|
696
|
+
const { checkProjectVideoToolRunnable } = require('./lib/persona-macro/projectVideoToolCheck.cjs');
|
|
697
|
+
const verdict = await checkProjectVideoToolRunnable({ cwd: projects[0], agentName: payload.agentName, job });
|
|
698
|
+
if (!verdict.ok) throw new Error(verdict.error);
|
|
699
|
+
}
|
|
670
700
|
const macro = await macroLibrary.saveMacro(payload);
|
|
671
701
|
broadcastMacrosChanged();
|
|
672
702
|
return macro;
|
|
@@ -1103,6 +1133,7 @@ queueOps.registerQueueOpsHandlers({ retireCompletedSlugs: scheduler.retireComple
|
|
|
1103
1133
|
registerHistoryAggregatorHandlers();
|
|
1104
1134
|
registerHistoryDashboardHandlers();
|
|
1105
1135
|
registerLoopEfficiencyHandlers();
|
|
1136
|
+
registerValidationQualityHandlers();
|
|
1106
1137
|
pluginInstall.registerPluginInstallHandlers();
|
|
1107
1138
|
memoryTool.registerMemoryHandlers();
|
|
1108
1139
|
activeIndexMerge.registerActiveIndexMergeHandlers();
|
|
@@ -1119,6 +1150,7 @@ epicWorktreeProjectConfig.registerEpicWorktreeProjectConfigHandlers();
|
|
|
1119
1150
|
registerMemoryAggregateIpc();
|
|
1120
1151
|
registerProjectBriefIpc();
|
|
1121
1152
|
registerProjectPagesIpc();
|
|
1153
|
+
require('./lib/tasks/taskIpc.cjs').registerTaskIpc({ ipcMain });
|
|
1122
1154
|
ipcMain.handle('promptSessionTranscript:append', validated(schemas.promptSessionTranscriptAppend, async ({ cwd, epicId, role, text, at, eventId }) => {
|
|
1123
1155
|
const ok = await promptSessionTranscript.appendTurn(cwd, epicId, { role, text, at, eventId });
|
|
1124
1156
|
return { ok };
|
|
@@ -1150,6 +1182,25 @@ try {
|
|
|
1150
1182
|
} catch (e) {
|
|
1151
1183
|
logs.writeLine({ scope: 'main', level: 'error', message: 'updater IPC registration failed', meta: { error: e?.message } });
|
|
1152
1184
|
}
|
|
1185
|
+
try {
|
|
1186
|
+
const { createLoginItem } = require('./lib/process/loginItem.cjs');
|
|
1187
|
+
const loginItem = createLoginItem({
|
|
1188
|
+
app,
|
|
1189
|
+
platform: process.platform,
|
|
1190
|
+
packaged: isPackagedApp(),
|
|
1191
|
+
dev: process.env.SM_DEV === '1' || process.env.SM_E2E === '1',
|
|
1192
|
+
homeDir: os.homedir(),
|
|
1193
|
+
env: process.env,
|
|
1194
|
+
appId: 'run.bilko.session-manager',
|
|
1195
|
+
resolveNpx,
|
|
1196
|
+
warn: (message, meta) => logs.writeLine({ scope: 'main', level: 'warn', message, meta }),
|
|
1197
|
+
});
|
|
1198
|
+
registerLoginItemIpc({ ipcMain, loginItem });
|
|
1199
|
+
// Bring an enabled login item up to this build's script + entry; not awaited, never throws.
|
|
1200
|
+
void loginItem.refreshIfStale();
|
|
1201
|
+
} catch (e) {
|
|
1202
|
+
logs.writeLine({ scope: 'main', level: 'error', message: 'login item IPC registration failed', meta: { error: e?.message } });
|
|
1203
|
+
}
|
|
1153
1204
|
try {
|
|
1154
1205
|
require('./lib/opsRetentionSettings.cjs').registerIpc(ipcMain);
|
|
1155
1206
|
} catch (e) {
|
|
@@ -1279,6 +1330,9 @@ function runRunLogRetentionPass() {
|
|
|
1279
1330
|
removedFiles: (result.removedFiles || 0) + tmp.removedFiles + archive.removedFiles,
|
|
1280
1331
|
freedBytes: (result.freedBytes || 0) + tmp.freedBytes + archive.freedBytes,
|
|
1281
1332
|
errorCount: (result.errors ? result.errors.length : 0) + tmp.errors.length + archive.errors.length,
|
|
1333
|
+
// plan-records/<epic-id>/ of completed/orphan Epics, pruned inside runBootSweep
|
|
1334
|
+
// for the same project list readMergedSync swept (planRecordsDays knob).
|
|
1335
|
+
planRecords: result.planRecords || null,
|
|
1282
1336
|
},
|
|
1283
1337
|
});
|
|
1284
1338
|
} catch (e) {
|
package/src/main/ipcSchemas.cjs
CHANGED
|
@@ -16,6 +16,7 @@ const { AgentPersonaSaveSchema, PersonaNameSchema, ProjectCwdSchema } = require(
|
|
|
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
18
|
const { PRD_EFFORT_LEVELS } = require('./lib/prd/prdFrontmatter.cjs');
|
|
19
|
+
const { MISS_KINDS } = require('./lib/scheduler/validatorVerdictSchema.cjs');
|
|
19
20
|
// Aliased: this file already has a looser, exchanges-only SESSION_ID_RE (Exchanges section).
|
|
20
21
|
const { SESSION_ID_RE: RESTORABLE_SESSION_ID_RE } = require('./lib/epic/restorableSessions.cjs');
|
|
21
22
|
|
|
@@ -127,10 +128,19 @@ const configWriteJson = z.object({
|
|
|
127
128
|
writer: z.string().min(1).max(64).optional(),
|
|
128
129
|
});
|
|
129
130
|
|
|
131
|
+
// `importedBy`: a CLAUDE.md / CLAUDE.local.md whose @-import closure main
|
|
132
|
+
// checks to allow writing an imported instruction file (config.cjs
|
|
133
|
+
// checkInstructionWrite). Main proves the import; the renderer only names it.
|
|
130
134
|
const configWriteText = z.object({
|
|
131
135
|
path: z.string().min(1).max(4096),
|
|
132
136
|
text: z.string(),
|
|
133
137
|
writer: z.string().min(1).max(64).optional(),
|
|
138
|
+
importedBy: z.string().min(1).max(4096).optional(),
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
const configCanWrite = z.object({
|
|
142
|
+
path: z.string().min(1).max(4096),
|
|
143
|
+
importedBy: z.string().min(1).max(4096).optional(),
|
|
134
144
|
});
|
|
135
145
|
|
|
136
146
|
const configListDir = z.object({
|
|
@@ -425,6 +435,11 @@ const DepSlugSchema = z.string().min(1).max(160).regex(/^[A-Za-z0-9][\w.-]*$/);
|
|
|
425
435
|
// large /develop plan depends on every other slug in the plan, so this must
|
|
426
436
|
// stay well above the largest plan size the PRD authoring flow allows.
|
|
427
437
|
const MAX_DEPENDS_ON = 100;
|
|
438
|
+
// Tool-risk rule strings a PRD is cleared to call — shared by schedulerCreatePrd
|
|
439
|
+
// and adminPrdFrontmatterPatch so create and update accept the same shape.
|
|
440
|
+
// The rule grammar (toolRiskMarks.parseRule), de-dup and cap are re-checked by
|
|
441
|
+
// prdCreate.cjs's normalizeRiskTools on both paths.
|
|
442
|
+
const RiskToolsSchema = z.array(z.string().min(1).max(200)).max(20);
|
|
428
443
|
// Wave-authoring decision (scheduler wave-disposition PRD), shared between
|
|
429
444
|
// schedulerCreatePrd (authoring time) and adminPrdFrontmatterPatch (the
|
|
430
445
|
// after-the-fact change path) so both can never disagree on what a valid
|
|
@@ -450,6 +465,18 @@ const schedulerCreatePrd = z.object({
|
|
|
450
465
|
// Explicit ordering (PRD 832): slugs that must complete before this PRD
|
|
451
466
|
// becomes eligible. Written to frontmatter as `dependsOn: [a, b]`.
|
|
452
467
|
dependsOn: z.array(DepSlugSchema).max(MAX_DEPENDS_ON).optional(),
|
|
468
|
+
// Deliberate cross-Epic duplicate: exact NN slugs of other Epics' PRDs that
|
|
469
|
+
// share this PRD's bare slug. createPrd refuses such a duplicate (409) unless
|
|
470
|
+
// this lists every one of them (prdCreate.cjs findCrossEpicDuplicates).
|
|
471
|
+
allowDuplicateOf: z.array(z.string().min(1).max(160).regex(/^\d+-[A-Za-z0-9][\w.-]*$/, 'must be an exact NN-prefixed slug')).max(MAX_DEPENDS_ON).optional(),
|
|
472
|
+
// The earlier PRDs this PRD repairs (PRD prd-fixes-field). Bounds mirror
|
|
473
|
+
// prdCreate.cjs FIXES_MAX / FIX_REASON_MAX; createPrd resolves each prd to an
|
|
474
|
+
// existing NN slug and re-checks the shape (validateFixesShape).
|
|
475
|
+
fixes: z.array(z.object({
|
|
476
|
+
prd: z.string().min(1).max(160),
|
|
477
|
+
missKind: z.enum(/** @type {[string, ...string[]]} */ ([...MISS_KINDS])),
|
|
478
|
+
reason: z.string().min(1).max(200),
|
|
479
|
+
})).min(1).max(20).optional(),
|
|
453
480
|
// Explicit wave-authoring decision (scheduler wave-disposition PRD) — only
|
|
454
481
|
// meaningful (and only stamped) when this PRD joins an Epic that already
|
|
455
482
|
// has incomplete PRDs and lands as a wave root (no dependsOn of its own);
|
|
@@ -459,6 +486,9 @@ const schedulerCreatePrd = z.object({
|
|
|
459
486
|
// Artifact-only PRD declaration — cross-field rules enforced in prdCreate.cjs.
|
|
460
487
|
deliverable: z.literal('artifact').optional(),
|
|
461
488
|
artifactPaths: z.array(z.string().min(1).max(1024).regex(NO_NEWLINE_RE, 'must not contain newlines')).max(50).optional(),
|
|
489
|
+
// Tool-risk rule strings this PRD is cleared to call (toolRiskMarks.parseRule
|
|
490
|
+
// grammar, re-checked + de-duplicated in prdCreate.cjs; written as `riskTools`).
|
|
491
|
+
riskTools: RiskToolsSchema.optional(),
|
|
462
492
|
// An EXISTING Epic's promptSessionId (PRD 748) — NOT a PromptTicket.id.
|
|
463
493
|
// ensureEpic() (epicMint.cjs) joins the Epic whose active-index.json
|
|
464
494
|
// sessions key literally equals this value; the renderer only ever sends
|
|
@@ -622,8 +652,10 @@ const adminListAgentsQuery = z.object({
|
|
|
622
652
|
cwd: z.string().min(1).max(4096).optional(),
|
|
623
653
|
});
|
|
624
654
|
|
|
655
|
+
// cwd is optional only for a lookup by id: Session Manager then finds the
|
|
656
|
+
// Epic among its registered projects (epicOutsideRead.findEpicProject).
|
|
625
657
|
const adminGetEpicQuery = z.object({
|
|
626
|
-
cwd: z.string().min(1).max(4096),
|
|
658
|
+
cwd: z.string().min(1).max(4096).optional(),
|
|
627
659
|
id: z.string().min(1).max(200).optional(),
|
|
628
660
|
externalRef: z.string().max(1000).optional().transform((v, ctx) => {
|
|
629
661
|
if (v === undefined) return undefined;
|
|
@@ -638,6 +670,8 @@ const adminGetEpicQuery = z.object({
|
|
|
638
670
|
receipt: z.string().max(10).optional().transform((v) => v === '1' || v === 'true'),
|
|
639
671
|
}).refine((v) => (v.id === undefined) !== (v.externalRef === undefined), {
|
|
640
672
|
message: 'exactly one of id or externalRef is required',
|
|
673
|
+
}).refine((v) => v.externalRef === undefined || v.cwd !== undefined, {
|
|
674
|
+
message: 'externalRef requires cwd',
|
|
641
675
|
});
|
|
642
676
|
|
|
643
677
|
// Partial frontmatter patch for update-prd — same recognized-key set as
|
|
@@ -679,6 +713,10 @@ const adminPrdFrontmatterPatch = z.object({
|
|
|
679
713
|
// chain) rewrites this alongside dependsOn via the same
|
|
680
714
|
// schedule:set-prd-disposition path (see prdDisposition.cjs).
|
|
681
715
|
disposition: PrdDispositionSchema.optional(),
|
|
716
|
+
// Patchable after creation too, with the SAME shape as create. updatePrd
|
|
717
|
+
// re-checks a non-empty list with normalizeRiskTools; an explicit `[]`
|
|
718
|
+
// removes the key from the PRD file.
|
|
719
|
+
riskTools: RiskToolsSchema.optional(),
|
|
682
720
|
});
|
|
683
721
|
|
|
684
722
|
const adminUpdatePrd = z.object({
|
|
@@ -703,9 +741,15 @@ const adminUpdatePrd = z.object({
|
|
|
703
741
|
'body cannot be combined with gate, files or acceptanceCriteria',
|
|
704
742
|
);
|
|
705
743
|
|
|
744
|
+
// `dependents` (PRD 3499): what happens to pending PRDs that depend on the
|
|
745
|
+
// cancelled job — required by remote.cancelJob whenever any exist.
|
|
706
746
|
const adminCancelJob = z.object({
|
|
707
747
|
slug: z.string().regex(SCHEDULE_SLUG_RE),
|
|
708
748
|
cwd: z.string().min(1).max(4096).optional(),
|
|
749
|
+
dependents: z.object({
|
|
750
|
+
action: z.enum(['cascade', 'repoint', 'clear']),
|
|
751
|
+
to: z.string().min(1).max(200).optional(),
|
|
752
|
+
}).strict().refine((d) => d.action !== 'repoint' || d.to !== undefined, 'dependents.to is required for action "repoint"').optional(),
|
|
709
753
|
});
|
|
710
754
|
|
|
711
755
|
// ──────────────────────────────────────────── Projects
|
|
@@ -784,6 +828,19 @@ const claudeConfigPatch = z.object({
|
|
|
784
828
|
keyPath: z.array(z.string().min(1).max(256)).min(1).max(8),
|
|
785
829
|
value: z.unknown().optional(),
|
|
786
830
|
}).strict();
|
|
831
|
+
// toolRisk:read / toolRisk:write — mirrors ToolRiskReadInput / ToolRiskWriteInput
|
|
832
|
+
// (src/preload/api.d.ts). Rule/mark validity is toolRiskMarks.cjs's job (so its
|
|
833
|
+
// error text reaches the UI); here only the shape is pinned.
|
|
834
|
+
const toolRiskBase = {
|
|
835
|
+
scope: z.enum(['user', 'project']),
|
|
836
|
+
cwd: z.string().min(1).max(4096).nullish(),
|
|
837
|
+
};
|
|
838
|
+
const toolRiskRead = z.object(toolRiskBase).strict();
|
|
839
|
+
const toolRiskWrite = z.object({
|
|
840
|
+
...toolRiskBase,
|
|
841
|
+
marks: z.record(z.string().max(1024), z.unknown()),
|
|
842
|
+
interactive: z.boolean().optional(),
|
|
843
|
+
}).strict();
|
|
787
844
|
// mcp:check-server — names WHICH configured server to check, never its config:
|
|
788
845
|
// main reads that from disk (lib/mcpToolsProbe.cjs checkConfiguredMcpServer), so
|
|
789
846
|
// the renderer can't make main spawn a command of its choosing. A project server
|
|
@@ -802,12 +859,17 @@ const macrosSave = MacroSaveSchema;
|
|
|
802
859
|
const macrosDelete = MacroDeleteSchema;
|
|
803
860
|
const macrosSetProject = MacroSetProjectSchema;
|
|
804
861
|
const macrosRemoveFromProject = MacroRemoveFromProjectSchema;
|
|
805
|
-
// Background macro job (macroJobIpc.cjs): press a built-in macro as a scheduler PRD inside an existing Epic.
|
|
862
|
+
// Background macro job (macroJobIpc.cjs): press a built-in macro or project Video tool as a scheduler PRD inside an existing Epic.
|
|
806
863
|
const macrosDispatchJob = z.object({
|
|
807
864
|
cwd: z.string().min(1).max(4096),
|
|
808
865
|
macroId: z.string().min(1).max(128),
|
|
809
866
|
epicId: z.string().min(1).max(200),
|
|
810
867
|
extraInstructions: z.string().max(4000).optional(),
|
|
868
|
+
// A project Video tool's input values. No `review` key: an unknown key is
|
|
869
|
+
// stripped, so only the main-side review-decision IPC can pass a decision.
|
|
870
|
+
inputValues: z.record(z.string().max(128), z.string().max(4000))
|
|
871
|
+
.refine((o) => Object.keys(o).length <= 20, 'at most 20 input values')
|
|
872
|
+
.optional(),
|
|
811
873
|
effort: z.enum(/** @type {[string, ...string[]]} */ ([...PRD_EFFORT_LEVELS])).optional(),
|
|
812
874
|
});
|
|
813
875
|
const macrosJobStatus = z.object({ cwd: z.string().min(1).max(4096) });
|
|
@@ -1002,22 +1064,15 @@ const projectPagesCwd = z.object({
|
|
|
1002
1064
|
cwd: z.string().min(1).max(4096),
|
|
1003
1065
|
}).strict();
|
|
1004
1066
|
|
|
1005
|
-
// project-pages:md-network — cwd
|
|
1006
|
-
//
|
|
1007
|
-
//
|
|
1008
|
-
const mdNetworkFolder = z.string().min(1).max(512).refine(
|
|
1009
|
-
(f) => !f.startsWith('/') && !f.includes('\\') && !f.includes('\0') && !f.split('/').includes('..'),
|
|
1010
|
-
{ message: "folder must be repo-relative (no leading '/', backslash, NUL or '..' segment)" },
|
|
1011
|
-
);
|
|
1012
|
-
const mdNetworkFolderList = z.array(mdNetworkFolder).max(50);
|
|
1067
|
+
// project-pages:md-network — cwd only. History folders come from the tracked
|
|
1068
|
+
// .session-manager.json mdNetwork.history and the census heuristic; the IPC
|
|
1069
|
+
// carries no folder overrides (.strict() rejects recordFolders/docFolders).
|
|
1013
1070
|
const projectPagesMdNetwork = z.object({
|
|
1014
1071
|
cwd: z.string().min(1).max(4096),
|
|
1015
|
-
recordFolders: mdNetworkFolderList.optional(),
|
|
1016
|
-
docFolders: mdNetworkFolderList.optional(),
|
|
1017
1072
|
}).strict();
|
|
1018
1073
|
|
|
1019
|
-
// project-pages:md-review — cwd plus optional
|
|
1020
|
-
// reviews/validation/<id>/ folders to list. Ids are joined onto
|
|
1074
|
+
// project-pages:md-review — cwd plus optional Epic ids whose plan-records/<id>/
|
|
1075
|
+
// + legacy reviews/validation/<id>/ folders to list. Ids are joined onto fs; the
|
|
1021
1076
|
// slug regex (same as lib/mdReviewRecord.cjs EPIC_ID_RE) is load-bearing.
|
|
1022
1077
|
const projectPagesMdReview = z.object({
|
|
1023
1078
|
cwd: z.string().min(1).max(4096),
|
|
@@ -1044,6 +1099,15 @@ const projectDemoVideoAdminWriteBody = z.object({
|
|
|
1044
1099
|
// never match.
|
|
1045
1100
|
const ENTRY_ID_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
1046
1101
|
const entryId = z.string().regex(ENTRY_ID_RE);
|
|
1102
|
+
// Project Video review step (project-pages/videoReviewIpc.cjs): renderer IPC only.
|
|
1103
|
+
const projectVideosReviewList = z.object({ cwd: z.string().min(1).max(4096) }).strict();
|
|
1104
|
+
const projectVideosReviewDecide = z.object({
|
|
1105
|
+
cwd: z.string().min(1).max(4096),
|
|
1106
|
+
entryId,
|
|
1107
|
+
decision: z.enum(['approve', 'changes']),
|
|
1108
|
+
note: z.string().max(2000).optional(),
|
|
1109
|
+
}).strict();
|
|
1110
|
+
const projectVideosReviewRetry = z.object({ cwd: z.string().min(1).max(4096), entryId }).strict();
|
|
1047
1111
|
const projectVideoReportFields = {
|
|
1048
1112
|
lufs: z.number().nullable(),
|
|
1049
1113
|
truePeakDb: z.number().nullable(),
|
|
@@ -1058,8 +1122,10 @@ const projectVideoReportFields = {
|
|
|
1058
1122
|
const projectVideoMeta = z.object({
|
|
1059
1123
|
id: entryId,
|
|
1060
1124
|
title: z.string().min(1).max(120),
|
|
1061
|
-
kind: z.enum(['project-demo', 'blog-post', 'feature']),
|
|
1125
|
+
kind: z.enum(['project-demo', 'blog-post', 'feature', 'episode']),
|
|
1062
1126
|
target: z.string().max(300).optional(),
|
|
1127
|
+
// From the document's sm-demo-aspect tag; absent on older entries (treat as '16:9').
|
|
1128
|
+
aspect: z.enum(['16:9', '9:16']).optional(),
|
|
1063
1129
|
style: z.string().max(40),
|
|
1064
1130
|
lengthS: z.number().int().min(5).max(60),
|
|
1065
1131
|
createdAt: z.string().datetime(),
|
|
@@ -1106,7 +1172,7 @@ const projectVideoAdminWriteBody = z.object({
|
|
|
1106
1172
|
cwd: z.string().min(1).max(4096).optional(),
|
|
1107
1173
|
videoId: entryId,
|
|
1108
1174
|
title: z.string().min(1).max(120),
|
|
1109
|
-
kind: z.enum(['project-demo', 'blog-post', 'feature']),
|
|
1175
|
+
kind: z.enum(['project-demo', 'blog-post', 'feature', 'episode']),
|
|
1110
1176
|
lengthS: z.number().int().min(5).max(60),
|
|
1111
1177
|
html: z.string(),
|
|
1112
1178
|
meta: projectVideoMeta.omit({ id: true, createdAt: true }).extend({
|
|
@@ -1386,6 +1452,26 @@ const historyDashboard = z.object({
|
|
|
1386
1452
|
rangeDays: z.union([z.literal(30), z.literal(60), z.literal(90), z.literal(0)]),
|
|
1387
1453
|
}).strict();
|
|
1388
1454
|
|
|
1455
|
+
// ──────────────────────────────────────────── Tasks (lib/tasks/taskIpc.cjs)
|
|
1456
|
+
const TaskCwd = z.string().min(1).max(4096).refine((s) => path.isAbsolute(s), 'cwd must be absolute');
|
|
1457
|
+
const TaskFilter = z.string().min(1).max(512).optional();
|
|
1458
|
+
const TaskListQuery = z.object({
|
|
1459
|
+
cwd: TaskCwd,
|
|
1460
|
+
since: TaskFilter,
|
|
1461
|
+
until: TaskFilter,
|
|
1462
|
+
pipeline: TaskFilter,
|
|
1463
|
+
runId: TaskFilter,
|
|
1464
|
+
step: TaskFilter,
|
|
1465
|
+
agent: TaskFilter,
|
|
1466
|
+
status: TaskFilter,
|
|
1467
|
+
source: TaskFilter,
|
|
1468
|
+
limit: z.number().int().min(1).max(200).optional(),
|
|
1469
|
+
offset: z.number().int().min(0).optional(),
|
|
1470
|
+
}).strict();
|
|
1471
|
+
const TaskGetQuery = z.object({ cwd: TaskCwd, id: z.string().min(1).max(200) }).strict();
|
|
1472
|
+
const TaskSwitchQuery = z.object({ cwd: TaskCwd }).strict();
|
|
1473
|
+
const TaskSwitchSet = z.object({ cwd: TaskCwd, enabled: z.boolean() }).strict();
|
|
1474
|
+
|
|
1389
1475
|
// ──────────────────────────────────────────── Voice (F1/F5/F7/F8)
|
|
1390
1476
|
// Mirrors voiceSettings.cjs isValidConfig / isValidDevicePref / isValid…
|
|
1391
1477
|
// validators (ad-hoc on disk). Schemas here gate the IPC boundary so a
|
|
@@ -1642,6 +1728,7 @@ module.exports = {
|
|
|
1642
1728
|
configReadText,
|
|
1643
1729
|
configWriteJson,
|
|
1644
1730
|
configWriteText,
|
|
1731
|
+
configCanWrite,
|
|
1645
1732
|
configListDir,
|
|
1646
1733
|
configWatch,
|
|
1647
1734
|
configWatchOpts,
|
|
@@ -1671,6 +1758,10 @@ module.exports = {
|
|
|
1671
1758
|
archiveProject,
|
|
1672
1759
|
historyAggregate,
|
|
1673
1760
|
historyDashboard,
|
|
1761
|
+
TaskListQuery,
|
|
1762
|
+
TaskGetQuery,
|
|
1763
|
+
TaskSwitchQuery,
|
|
1764
|
+
TaskSwitchSet,
|
|
1674
1765
|
voiceSetHotkey,
|
|
1675
1766
|
voiceSetDevicePref,
|
|
1676
1767
|
voiceSetTurnDetector,
|
|
@@ -1756,6 +1847,8 @@ module.exports = {
|
|
|
1756
1847
|
agentsDeletePersona,
|
|
1757
1848
|
claudeConfigRead,
|
|
1758
1849
|
claudeConfigPatch,
|
|
1850
|
+
toolRiskRead,
|
|
1851
|
+
toolRiskWrite,
|
|
1759
1852
|
mcpCheckServer,
|
|
1760
1853
|
macrosSave,
|
|
1761
1854
|
macrosDelete,
|
|
@@ -1763,6 +1856,9 @@ module.exports = {
|
|
|
1763
1856
|
macrosRemoveFromProject,
|
|
1764
1857
|
macrosDispatchJob,
|
|
1765
1858
|
macrosJobStatus,
|
|
1859
|
+
projectVideosReviewList,
|
|
1860
|
+
projectVideosReviewDecide,
|
|
1861
|
+
projectVideosReviewRetry,
|
|
1766
1862
|
needsYouList,
|
|
1767
1863
|
needsYouAnswer,
|
|
1768
1864
|
agentsGetPersonaBody,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# src/main/lib/ — scoped context
|
|
2
|
+
|
|
3
|
+
Shared main-process helpers (CommonJS `.cjs`). Layout source of truth: `scripts/lib-layout.json`.
|
|
4
|
+
|
|
5
|
+
## What's here
|
|
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).
|
|
9
|
+
- `claude/` — claude CLI binary, caps, model/effort resolution.
|
|
10
|
+
- `demo-video-kit/` — demo-video build tools (capture, sound, frames, checks), seeded to `~/.claude/session-manager/demo-video-kit/`.
|
|
11
|
+
- `epic/` — Epic mint, worktrees, active index, spawn plan/cwd, transcripts.
|
|
12
|
+
- `feedback-remote/` — cross-project and customer feedback conduits.
|
|
13
|
+
- `git/` — git exec, worktrees, branch sweeps, job worktrees.
|
|
14
|
+
- `persona-macro/` — agent persona schema/merge, macro library, builtin macros.
|
|
15
|
+
- `prd/` — PRD parsing helpers, admin routes, dep-slug resolution, plan validation.
|
|
16
|
+
- `process/` — child processes, kill tree, env cleaning, pid liveness, instance lock.
|
|
17
|
+
- `project-pages/` — Project Home pages library, competitor matrix store/HTML, player bridge.
|
|
18
|
+
- `scheduler/` — dispatch loop, session slots, gates, supervisors, queue helpers.
|
|
19
|
+
- `tasks/` — Task ledger, switch, runner, admin routes and IPC (one headless claude -p run per project); store: [`tasks/README.md`](../../../session-manager-operations/tasks/README.md).
|
|
20
|
+
- `telemetry/` — audit/ops error logs, crash and OTLP telemetry.
|
|
21
|
+
- `util/` — generic pure helpers (atomic fs, kebab, home/cwd encoding, JSON extract, tail).
|
|
22
|
+
- top-level files — cross-cutting modules that fit no domain (`opsOwnership`, `activeSessions`, `projectRootResolve`, `cwdClassify`).
|
|
23
|
+
- `__tests__/` — tests for top-level modules; subfolders carry their own.
|
|
24
|
+
|
|
25
|
+
## Where a new module goes
|
|
26
|
+
|
|
27
|
+
Put it in the subfolder whose domain it serves; pure and domain-free goes in `util/`.
|
|
28
|
+
A new top-level `lib/` module needs a stated reason (no domain fits) in its header comment,
|
|
29
|
+
and a `scripts/lib-layout.json` entry. Never add a subfolder for one file.
|
|
30
|
+
|
|
31
|
+
## Reuse before writing
|
|
32
|
+
|
|
33
|
+
Each of these was found duplicated once. Grep first; extend the canonical one.
|
|
34
|
+
|
|
35
|
+
| Need | Canonical | Function |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| Atomic write (tmp+rename) | `util/atomicFs.cjs` | `writeTextAtomic[Sync]`, `writeJsonAtomic[Sync]` |
|
|
38
|
+
| JSON read with fallback | `util/atomicFs.cjs` | `readJsonOr`, `readJsonOrSync` |
|
|
39
|
+
| PID liveness | `process/pidAlive.cjs` | `pidAlive` |
|
|
40
|
+
| Kebab / slug | `util/kebabCase.cjs` | `kebabCase` |
|
|
41
|
+
| Project root, read-only/total (never throws) | `activeSessions.cjs` | `projectRootOf` |
|
|
42
|
+
| Project root, validated; `opsInternal:'refuse'` for writers | `opsOwnership.cjs` | `resolveProjectRoot` |
|
|
43
|
+
| Project root + Epic from session/epic hints | `projectRootResolve.cjs` | `resolveProjectContext` |
|
|
44
|
+
| Ops-root path (single-writer law) | `opsOwnership.cjs` | `opsPath` |
|
|
45
|
+
| Run git | `git/gitExec.cjs` | `execGit` |
|
|
46
|
+
| Spawn `claude -p` (only machine-wide cap) | `scheduler/sessionSlots.cjs` | `acquire`, `release` |
|
|
47
|
+
|
|
48
|
+
Pin `--model` on every `claude -p` spawn.
|
|
49
|
+
|
|
50
|
+
## What must NOT be assumed
|
|
51
|
+
|
|
52
|
+
- No private process caps, no hand-rolled tmp+rename, no new `JSON.parse(readFileSync)` fallbacks.
|
|
53
|
+
- Never call `activeSessions.cjs` `allProjectCwds`/`activeProjectCwds` on an IPC, boot or timer hot path: they scan `~/.claude/projects` synchronously (7k+ dirs, 0.3-4 s; the 2026-10-25 OOM crashes).
|
|
54
|
+
- `ipcSchemas.cjs` `validated()` passes the zod-parsed payload, which strips unknown keys: an IPC key rename the schema misses silently drops the key (2026-11-07 persona wipe). Rename keys and schema in one PRD; prefer `.strict()`.
|
package/src/main/lib/CLAUDE.md
CHANGED
|
@@ -1,54 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Shared main-process helpers (CommonJS `.cjs`). Layout source of truth: `scripts/lib-layout.json`.
|
|
4
|
-
|
|
5
|
-
## What's here
|
|
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).
|
|
9
|
-
- `claude/` — claude CLI binary, caps, model/effort resolution.
|
|
10
|
-
- `demo-video-kit/` — demo-video build tools (capture, sound, frames, checks), seeded to `~/.claude/session-manager/demo-video-kit/`.
|
|
11
|
-
- `epic/` — Epic mint, worktrees, active index, spawn plan/cwd, transcripts.
|
|
12
|
-
- `feedback-remote/` — cross-project and customer feedback conduits.
|
|
13
|
-
- `git/` — git exec, worktrees, branch sweeps, job worktrees.
|
|
14
|
-
- `persona-macro/` — agent persona schema/merge, macro library, builtin macros.
|
|
15
|
-
- `prd/` — PRD parsing helpers, admin routes, dep-slug resolution, plan validation.
|
|
16
|
-
- `process/` — child processes, kill tree, env cleaning, pid liveness, instance lock.
|
|
17
|
-
- `project-pages/` — Project Home pages library, competitor matrix store/HTML, player bridge.
|
|
18
|
-
- `scheduler/` — dispatch loop, session slots, gates, supervisors, queue helpers.
|
|
19
|
-
- `telemetry/` — audit/ops error logs, crash and OTLP telemetry.
|
|
20
|
-
- `util/` — generic pure helpers (atomic fs, kebab, home/cwd encoding, JSON extract, tail).
|
|
21
|
-
- top-level files — cross-cutting modules that fit no domain (`opsOwnership`, `activeSessions`, `projectRootResolve`, `cwdClassify`).
|
|
22
|
-
- `__tests__/` — tests for top-level modules; subfolders carry their own.
|
|
23
|
-
|
|
24
|
-
## Where a new module goes
|
|
25
|
-
|
|
26
|
-
Put it in the subfolder whose domain it serves; pure and domain-free goes in `util/`.
|
|
27
|
-
A new top-level `lib/` module needs a stated reason (no domain fits) in its header comment,
|
|
28
|
-
and a `scripts/lib-layout.json` entry. Never add a subfolder for one file.
|
|
29
|
-
|
|
30
|
-
## Reuse before writing
|
|
31
|
-
|
|
32
|
-
Each of these was found duplicated once. Grep first; extend the canonical one.
|
|
33
|
-
|
|
34
|
-
| Need | Canonical | Function |
|
|
35
|
-
| --- | --- | --- |
|
|
36
|
-
| Atomic write (tmp+rename) | `util/atomicFs.cjs` | `writeTextAtomic[Sync]`, `writeJsonAtomic[Sync]` |
|
|
37
|
-
| JSON read with fallback | `util/atomicFs.cjs` | `readJsonOr`, `readJsonOrSync` |
|
|
38
|
-
| PID liveness | `process/pidAlive.cjs` | `pidAlive` |
|
|
39
|
-
| Kebab / slug | `util/kebabCase.cjs` | `kebabCase` |
|
|
40
|
-
| Project root, read-only/total (never throws) | `activeSessions.cjs` | `projectRootOf` |
|
|
41
|
-
| Project root, validated; `opsInternal:'refuse'` for writers | `opsOwnership.cjs` | `resolveProjectRoot` |
|
|
42
|
-
| Project root + Epic from session/epic hints | `projectRootResolve.cjs` | `resolveProjectContext` |
|
|
43
|
-
| Ops-root path (single-writer law) | `opsOwnership.cjs` | `opsPath` |
|
|
44
|
-
| Run git | `git/gitExec.cjs` | `execGit` |
|
|
45
|
-
| Spawn `claude -p` (only machine-wide cap) | `scheduler/sessionSlots.cjs` | `acquire`, `release` |
|
|
46
|
-
|
|
47
|
-
Pin `--model` on every `claude -p` spawn.
|
|
48
|
-
|
|
49
|
-
## What must NOT be assumed
|
|
50
|
-
|
|
51
|
-
- Never `path.join` an agent cwd to build an ops path — use `opsPath`.
|
|
52
|
-
- No private process caps, no hand-rolled tmp+rename, no new `JSON.parse(readFileSync)` fallbacks.
|
|
53
|
-
- Never call `activeSessions.cjs` `allProjectCwds`/`activeProjectCwds` on an IPC, boot or timer hot path: they scan `~/.claude/projects` synchronously (7k+ dirs, 0.3-4 s; the 2026-10-25 OOM crashes).
|
|
54
|
-
- `ipcSchemas.cjs` `validated()` passes the zod-parsed payload, which strips unknown keys: an IPC key rename the schema misses silently drops the key (2026-11-07 persona wipe). Rename keys and schema in one PRD; prefer `.strict()`.
|
|
1
|
+
@AGENTS.md
|
|
@@ -8,6 +8,9 @@ const {
|
|
|
8
8
|
} = require('../agentCliEvents.cjs');
|
|
9
9
|
|
|
10
10
|
const BYPASS = '--dangerously-bypass-approvals-and-sandbox';
|
|
11
|
+
// Root-level config override: in a folder with no AGENTS.md, Codex reads CLAUDE.md instead.
|
|
12
|
+
// Must precede the subcommand head (spawn argv, no shell — the quotes are part of the TOML value).
|
|
13
|
+
const FALLBACK = ['-c', 'project_doc_fallback_filenames=["CLAUDE.md"]'];
|
|
11
14
|
|
|
12
15
|
function modelArgs(model) {
|
|
13
16
|
return typeof model === 'string' && model ? ['-m', model] : [];
|
|
@@ -20,14 +23,14 @@ function hasId(id) {
|
|
|
20
23
|
function headlessSpawn({ prompt, nativeSessionId, model } = {}) {
|
|
21
24
|
const head = hasId(nativeSessionId) ? ['exec', 'resume', nativeSessionId] : ['exec'];
|
|
22
25
|
return {
|
|
23
|
-
args: [...head, '--json', BYPASS, '--skip-git-repo-check', ...modelArgs(model), '-'],
|
|
26
|
+
args: [...FALLBACK, ...head, '--json', BYPASS, '--skip-git-repo-check', ...modelArgs(model), '-'],
|
|
24
27
|
stdin: prompt,
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
function interactiveArgs({ nativeSessionId, model } = {}) {
|
|
29
32
|
const head = hasId(nativeSessionId) ? ['resume', nativeSessionId] : [];
|
|
30
|
-
return [...head, BYPASS, ...modelArgs(model)];
|
|
33
|
+
return [...FALLBACK, ...head, BYPASS, ...modelArgs(model)];
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
const str = (v) => (typeof v === 'string' ? v : undefined);
|