claude-code-session-manager 0.126.0 → 0.128.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/bin/cli.cjs +71 -9
- package/bin/supervise.cjs +84 -0
- package/dist/assets/{AgentLibrary-bzeuZN4F.js → AgentLibrary-cNQU5YWy.js} +1 -1
- package/dist/assets/{Button-8dWfDDuQ.js → Button-9dIPAOBg.js} +1 -1
- package/dist/assets/{DataModel-D4ybBPZN.js → DataModel-DrDJ6ysw.js} +1 -1
- package/dist/assets/{History-hsztE6yh.js → History-4rrDdWNP.js} +1 -1
- package/dist/assets/{Hooks-CRmZMQaW.js → Hooks-Bj_jF5Pa.js} +1 -1
- package/dist/assets/{Library-Czt3Bojd.js → Library-D-Wsxrh7.js} +1 -1
- package/dist/assets/{ListDetail-Cr6Ct_WX.js → ListDetail-D7Om0H8j.js} +1 -1
- package/dist/assets/{McpServers-CeXJ2bng.js → McpServers-CbIbSd5o.js} +1 -1
- package/dist/assets/{Memory-caujO8O3.js → Memory-DgQlvQrO.js} +1 -1
- package/dist/assets/{Panel-D64i9tGz.js → Panel-DZHiD8Ar.js} +1 -1
- package/dist/assets/{Permissions-DpWOIrvr.js → Permissions-CfzduF4B.js} +1 -1
- package/dist/assets/{Plugins-Bd1ekP5P.js → Plugins-D-AG5nAo.js} +2 -2
- package/dist/assets/{ProvenanceBadge-B96A_uZf.js → ProvenanceBadge-B9JSEjll.js} +1 -1
- package/dist/assets/{SaveBar-D0Y2t-Ao.js → SaveBar-mVKig6hL.js} +1 -1
- package/dist/assets/{Scheduler-Y5_YbNrC.js → Scheduler-DFTCnh60.js} +1 -1
- package/dist/assets/{ScopeSwitcher-BmWA_dP9.js → ScopeSwitcher-s8J-yr7Z.js} +1 -1
- package/dist/assets/{Settings-Bcf65bpL.js → Settings-BTmxRMaP.js} +1 -1
- package/dist/assets/{SkillReferenceGraph-BeSNXloA.js → SkillReferenceGraph-C5lKqf5y.js} +1 -1
- package/dist/assets/{Skills-DwnQKJVc.js → Skills-CxOacq0k.js} +1 -1
- package/dist/assets/{SystemPrompt-Dih6SCmL.js → SystemPrompt-BCWg5FAz.js} +1 -1
- package/dist/assets/{TagLibrary-BZ-Kp10P.js → TagLibrary-BnF0_PkG.js} +1 -1
- package/dist/assets/{TiptapBody-C2nEUmF7.js → TiptapBody-C2Iu6rZd.js} +1 -1
- package/dist/assets/{Toggle-Dw8-zNQo.js → Toggle-C-oD66BG.js} +1 -1
- package/dist/assets/{ViewTabs-CoYPKGN-.js → ViewTabs-Cs4v7vLY.js} +1 -1
- package/dist/assets/{historyTotals-BbKcNpV7.js → historyTotals-CbRSLD8f.js} +1 -1
- package/dist/assets/{index-BnKaYERU.css → index-DtdWBGrI.css} +1 -1
- package/dist/assets/index-DzY_GXYY.js +3081 -0
- package/dist/assets/{settingsSchema-6doG_61l.js → settingsSchema-bSBfHuan.js} +1 -1
- package/dist/assets/{skillFrontmatter-BYMYWDfb.js → skillFrontmatter-BEseWm8r.js} +1 -1
- package/dist/assets/{useAgentsDirWatch-Cqabjieh.js → useAgentsDirWatch-CdyHxKCI.js} +1 -1
- package/dist/index.html +2 -2
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +343 -341
- package/package.json +1 -1
- package/plugins/session-manager-dev/skills/develop/SKILL.md +3 -2
- package/scripts/scheduler-mcp-server.cjs +209 -7
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +37 -4
- package/src/main/crashDiagnostics.cjs +83 -8
- package/src/main/health.cjs +16 -5
- package/src/main/index.cjs +46 -0
- package/src/main/ipcSchemas.cjs +107 -0
- package/src/main/lib/chatBootRecovery.cjs +136 -0
- package/src/main/lib/chatInflight.cjs +88 -0
- package/src/main/lib/claude/agentModelResolve.cjs +26 -7
- package/src/main/lib/claude/personaToolScope.cjs +40 -2
- package/src/main/lib/demo-video-kit/capture.cjs +113 -0
- package/src/main/lib/demo-video-kit/character.cjs +97 -0
- package/src/main/lib/demo-video-kit/checks.cjs +150 -0
- package/src/main/lib/demo-video-kit/frames.cjs +200 -0
- package/src/main/lib/demo-video-kit/seedKit.cjs +52 -0
- package/src/main/lib/demo-video-kit/sound.cjs +312 -0
- package/src/main/lib/epic/epicDelegationStats.cjs +1 -0
- package/src/main/lib/epic/epicSweepValidator.cjs +60 -6
- package/src/main/lib/epic/epicValidationHook.cjs +31 -3
- package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +71 -15
- package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +185 -34
- package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +15 -0
- package/src/main/lib/mcpToolCatalog.cjs +93 -14
- package/src/main/lib/opsOwnership.cjs +9 -5
- package/src/main/lib/persona-macro/builtinMacros.cjs +30 -5
- package/src/main/lib/persona-macro/macroJobDispatch.cjs +116 -0
- package/src/main/lib/persona-macro/macroJobIpc.cjs +50 -0
- package/src/main/lib/persona-macro/macroJobStatus.cjs +112 -0
- package/src/main/lib/persona-macro/macroLibrary.cjs +73 -3
- package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +100 -0
- package/src/main/lib/prd/prdCreate.cjs +17 -2
- package/src/main/lib/prd/prdFrontmatter.cjs +7 -2
- package/src/main/lib/process/childWithLog.cjs +38 -95
- package/src/main/lib/process/memoryScope.cjs +140 -0
- package/src/main/lib/process/ozonePlatform.cjs +15 -0
- package/src/main/lib/process/procIdentity.cjs +10 -3
- package/src/main/lib/process/scopeOomPolicy.cjs +69 -0
- package/src/main/lib/project-pages/pagesLibrary.cjs +171 -0
- package/src/main/lib/project-pages/playerBridge.cjs +129 -0
- package/src/main/lib/scheduler/cpuSample.cjs +147 -0
- package/src/main/lib/scheduler/definitionOfDone.cjs +40 -0
- package/src/main/lib/scheduler/jobLeftovers.cjs +204 -0
- package/src/main/lib/scheduler/jobSupervisorRecord.cjs +2 -1
- package/src/main/lib/scheduler/loadGate.cjs +116 -45
- package/src/main/lib/scheduler/queueStore.cjs +5 -2
- package/src/main/lib/scheduler/scheduleJobSchema.cjs +2 -0
- package/src/main/lib/scheduler/schedulerBatch.cjs +10 -3
- package/src/main/lib/scheduler/schedulerConfig.cjs +7 -2
- package/src/main/lib/smfileHeaders.cjs +11 -3
- package/src/main/lib/telemetry/crashTelemetry.cjs +8 -4
- package/src/main/projectPages.cjs +107 -30
- package/src/main/promptSessionsIpc.cjs +131 -0
- package/src/main/scheduler/budget.cjs +31 -0
- package/src/main/scheduler/prdParser.cjs +2 -0
- package/src/main/scheduler/prdPaths.cjs +54 -0
- package/src/main/scheduler/reviewLadder.cjs +17 -0
- package/src/main/scheduler/starvation.cjs +22 -0
- package/src/main/scheduler.cjs +548 -77
- package/src/main/seedSchedulerMcp.cjs +10 -1
- package/src/main/templates/PRD_AUTHORING.md +5 -2
- package/src/main/transcripts.cjs +8 -0
- package/src/main/usage.cjs +4 -2
- package/src/main/webRemote.cjs +3 -1
- package/src/preload/api.d.ts +113 -7
- package/src/preload/apiSurface.json +70 -0
- package/src/preload/index.cjs +13 -0
- package/src/seed/agents/demo-video-builder.md +141 -43
- package/src/seed/agents/project-home-builder.md +26 -13
- package/dist/assets/index-DgPUERhe.js +0 -3079
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* macroJobDispatch.cjs — turn a built-in macro press into ONE artifact-only
|
|
5
|
+
* scheduler PRD inside an existing Epic, so the build runs headless as the
|
|
6
|
+
* macro's persona under the scheduler's budget instead of a chat turn.
|
|
7
|
+
* Never mints an Epic (single-creator law): the caller supplies epicId.
|
|
8
|
+
*
|
|
9
|
+
* Plain Node, no Electron imports; all I/O is injected.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const path = require('node:path');
|
|
13
|
+
const { BUILTIN_MACROS } = require('./builtinMacros.cjs');
|
|
14
|
+
const { kebabCase } = require('../util/kebabCase.cjs');
|
|
15
|
+
|
|
16
|
+
const ACTIVE = new Set(['pending', 'held', 'running']);
|
|
17
|
+
const RETRYABLE = new Set(['needs_review', 'failed']);
|
|
18
|
+
|
|
19
|
+
function buildGate(absPath, nowMs) {
|
|
20
|
+
// No shell: everything with shell characters sits inside single quotes, so
|
|
21
|
+
// the script itself uses double quotes only (JSON.stringify).
|
|
22
|
+
const script = `const s=require("fs").statSync(${JSON.stringify(absPath)});process.exit(s.size>0&&s.mtimeMs>${nowMs}?0:1)`;
|
|
23
|
+
return `timeout 60 node -e '${script}'`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const PAGE_IDS = { 'how it works': 'how-it-works', faq: 'faq', overview: 'overview' };
|
|
27
|
+
|
|
28
|
+
// Entry id: videos get a fresh one per press; knowledge pages are named by a
|
|
29
|
+
// 'Page: <name>' line in the extra instructions (default 'overview').
|
|
30
|
+
function entryIdFor(kind, extra, t) {
|
|
31
|
+
if (kind === 'video') return `vid-${t.toString(36)}${Math.random().toString(36).slice(2, 5).padEnd(3, '0')}`;
|
|
32
|
+
const m = /^\s*Page:\s*(.+?)\s*$/im.exec(extra || '');
|
|
33
|
+
if (!m) return 'overview';
|
|
34
|
+
const name = m[1];
|
|
35
|
+
const known = PAGE_IDS[name.toLowerCase()];
|
|
36
|
+
if (known) return known;
|
|
37
|
+
const custom = /^custom topic:\s*(.+)$/i.exec(name);
|
|
38
|
+
return kebabCase(custom ? custom[1] : name, { maxLen: 40, fallback: 'overview' });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function dispatchMacroJob(
|
|
42
|
+
{ cwd, macroId, epicId, extraInstructions } = {},
|
|
43
|
+
{ createPrd, listRows, archivePrd, builtins = BUILTIN_MACROS, now = Date.now } = {},
|
|
44
|
+
) {
|
|
45
|
+
const macro = (builtins || []).find((m) => m && m.id === macroId);
|
|
46
|
+
if (!macro || !macro.job) return { ok: false, error: `macro ${macroId} has no background job declaration` };
|
|
47
|
+
if (typeof epicId !== 'string' || !epicId.trim()) return { ok: false, error: 'epicId is required — a background build joins an existing Epic' };
|
|
48
|
+
if (typeof cwd !== 'string' || !cwd) return { ok: false, error: 'cwd is required' };
|
|
49
|
+
if (typeof createPrd !== 'function') return { ok: false, error: 'createPrd is not available' };
|
|
50
|
+
|
|
51
|
+
const t = now();
|
|
52
|
+
const extra = typeof extraInstructions === 'string' ? extraInstructions.trim() : '';
|
|
53
|
+
const entryKind = macro.job.entryKind;
|
|
54
|
+
const entryId = entryKind ? entryIdFor(entryKind, extra, t) : null;
|
|
55
|
+
const artifactPaths = macro.job.artifactPaths.map((p) => (entryId ? p.split('{id}').join(entryId) : p));
|
|
56
|
+
const absPaths = artifactPaths.map((p) => path.join(cwd, p));
|
|
57
|
+
for (const s of [cwd, ...absPaths]) {
|
|
58
|
+
if (s.includes("'") || /[\r\n]/.test(s)) return { ok: false, error: "cwd or artifact path contains a character the gate cannot quote (single quote or newline)" };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let rows = [];
|
|
62
|
+
try {
|
|
63
|
+
rows = (typeof listRows === 'function' ? await listRows({ cwd }) : []) || [];
|
|
64
|
+
} catch (e) {
|
|
65
|
+
return { ok: false, error: `could not read queue: ${e?.message ?? e}` };
|
|
66
|
+
}
|
|
67
|
+
const mine = rows.filter((r) => r && r.macroId === macroId && (!r.cwd || r.cwd === cwd));
|
|
68
|
+
const active = mine.find((r) => ACTIVE.has(r.status));
|
|
69
|
+
if (active) return { ok: false, error: `${macro.label} is already building`, activeSlug: active.slug };
|
|
70
|
+
|
|
71
|
+
// Newest row decides: a stale needs_review/failed attempt is archived so the
|
|
72
|
+
// retry is not blocked by (or confused with) it.
|
|
73
|
+
const newest = mine.reduce((a, r) => (!a || (Number(r.lastRunAt ?? r.finishedAt ?? 0) >= Number(a.lastRunAt ?? a.finishedAt ?? 0)) ? r : a), null);
|
|
74
|
+
if (newest && RETRYABLE.has(newest.status) && typeof archivePrd === 'function') {
|
|
75
|
+
try { await archivePrd(newest.slug, cwd); } catch { /* best effort */ }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const slug = `${kebabCase(macro.label, { maxLen: 30, fallback: 'macro' })}-build-${t.toString(36)}${Math.random().toString(36).slice(2, 5)}`;
|
|
79
|
+
let goal = extra ? `${macro.prompt}\n\nAdditional instructions: ${extra}` : macro.prompt;
|
|
80
|
+
if (entryId) goal += `\n\nEntry id: ${entryId}. Save with ${entryKind === 'video' ? 'videoId' : 'pageId'} = ${entryId}.`;
|
|
81
|
+
|
|
82
|
+
const input = {
|
|
83
|
+
title: `${macro.label}: background build`,
|
|
84
|
+
slug,
|
|
85
|
+
cwd,
|
|
86
|
+
agentType: macro.agentName,
|
|
87
|
+
tag: macro.tag,
|
|
88
|
+
deliverable: 'artifact',
|
|
89
|
+
artifactPaths,
|
|
90
|
+
files: artifactPaths,
|
|
91
|
+
estimateMinutes: macro.job.estimateMinutes,
|
|
92
|
+
macroId,
|
|
93
|
+
sourcePromptId: epicId,
|
|
94
|
+
disposition: 'new-head',
|
|
95
|
+
goal,
|
|
96
|
+
acceptanceCriteria: [
|
|
97
|
+
`${artifactPaths[0]} is written during this run by the save tool your persona names, never by hand.`,
|
|
98
|
+
'Nothing in the repository is committed.',
|
|
99
|
+
],
|
|
100
|
+
implementationNotes:
|
|
101
|
+
`Work as the ${macro.agentName} persona (your system prompt) end to end. This build was started from Project Home and no one is watching: never stop to ask. `
|
|
102
|
+
+ 'Build outside the repository (mktemp -d under ~/.cache). SM_PROJECT_ROOT is the project main checkout; the save tool writes there, so omit its cwd.',
|
|
103
|
+
gate: absPaths.map((p) => buildGate(p, t)),
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
let res;
|
|
107
|
+
try {
|
|
108
|
+
res = await createPrd(input);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
return { ok: false, error: `createPrd failed: ${e?.message ?? e}` };
|
|
111
|
+
}
|
|
112
|
+
if (!res || res.ok === false) return { ok: false, error: res?.error || 'createPrd failed' };
|
|
113
|
+
return { ok: true, slug, epicId };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
module.exports = { dispatchMacroJob };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* macroJobIpc.cjs — IPC handlers `macros:dispatch-job` and `macros:job-status`.
|
|
5
|
+
* Thin wiring over dispatchMacroJob / macroJobStatuses; every dependency is
|
|
6
|
+
* injected (index.cjs passes the real scheduler, createPrd and archive).
|
|
7
|
+
*
|
|
8
|
+
* deps: { schemas, validatePath, readActiveIndex, createPrd, loadJobs,
|
|
9
|
+
* archivePrd, dispatchMacroJob?, macroJobStatuses?, readHistoryTail? }
|
|
10
|
+
* `createPrd` is called as `chat:create-prd` calls it, so its own
|
|
11
|
+
* remote.requestReconcile() queues the row at once — no second rescan here.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const { dispatchMacroJob: realDispatch } = require('./macroJobDispatch.cjs');
|
|
15
|
+
const { macroJobStatuses: realStatuses } = require('./macroJobStatus.cjs');
|
|
16
|
+
|
|
17
|
+
function registerMacroJobIpc(ipcMain, deps = {}) {
|
|
18
|
+
const dispatch = deps.dispatchMacroJob || realDispatch;
|
|
19
|
+
const statuses = deps.macroJobStatuses || realStatuses;
|
|
20
|
+
|
|
21
|
+
ipcMain.handle('macros:dispatch-job', async (_event, rawPayload) => {
|
|
22
|
+
const payload = deps.schemas.macrosDispatchJob.parse(rawPayload);
|
|
23
|
+
const cwd = deps.validatePath(payload.cwd);
|
|
24
|
+
const index = deps.readActiveIndex(cwd);
|
|
25
|
+
const sessions = index && index.sessions ? index.sessions : {};
|
|
26
|
+
const entry = Object.prototype.hasOwnProperty.call(sessions, payload.epicId) ? sessions[payload.epicId] : null;
|
|
27
|
+
if (!entry || entry.status !== 'active') {
|
|
28
|
+
return { ok: false, error: `epic ${payload.epicId} is not an active session in this project` };
|
|
29
|
+
}
|
|
30
|
+
return dispatch(
|
|
31
|
+
{ cwd, macroId: payload.macroId, epicId: payload.epicId, extraInstructions: payload.extraInstructions },
|
|
32
|
+
{
|
|
33
|
+
createPrd: deps.createPrd,
|
|
34
|
+
listRows: async () => deps.loadJobs(),
|
|
35
|
+
archivePrd: (slug, rowCwd) => deps.archivePrd(slug, rowCwd),
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
ipcMain.handle('macros:job-status', async (_event, rawPayload) => {
|
|
41
|
+
const payload = deps.schemas.macrosJobStatus.parse(rawPayload);
|
|
42
|
+
const cwd = deps.validatePath(payload.cwd);
|
|
43
|
+
return statuses({ cwd }, {
|
|
44
|
+
loadJobs: deps.loadJobs,
|
|
45
|
+
...(deps.readHistoryTail ? { readHistoryTail: deps.readHistoryTail } : {}),
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = { registerMacroJobIpc };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* macroJobStatus.cjs — per built-in macro with a `job` declaration, the state of
|
|
5
|
+
* its newest background job for one project: newest live queue row, else newest
|
|
6
|
+
* entry in a bounded tail of the project's scheduler history. Read-only.
|
|
7
|
+
*
|
|
8
|
+
* Plain Node, no Electron imports; all I/O is injected.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const { BUILTIN_MACROS } = require('./builtinMacros.cjs');
|
|
12
|
+
const { readTail } = require('../util/fileTail.cjs');
|
|
13
|
+
|
|
14
|
+
const HISTORY_TAIL_BYTES = 524288;
|
|
15
|
+
const RUNNING = new Set(['running', 'investigating']);
|
|
16
|
+
const FAILED = new Set(['failed', 'needs_review', 'skipped', 'cancelled']);
|
|
17
|
+
|
|
18
|
+
function stateOf(status) {
|
|
19
|
+
if (RUNNING.has(status)) return 'running';
|
|
20
|
+
if (status === 'completed') return 'done';
|
|
21
|
+
if (FAILED.has(status)) return 'failed';
|
|
22
|
+
return 'queued'; // pending/held/blocked/deferred/null/unknown
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function reasonOf(row, status) {
|
|
26
|
+
if (row.verifierVerdict === 'budget_exceeded') {
|
|
27
|
+
const n = row.budgetMinutes;
|
|
28
|
+
return Number.isFinite(n) && n > 0 ? `Timed out at the ${n}-minute job budget` : 'Timed out at the job budget';
|
|
29
|
+
}
|
|
30
|
+
for (const v of [row.error, row.finalizeReason, row.terminalReason]) {
|
|
31
|
+
if (typeof v === 'string' && v.trim()) return v;
|
|
32
|
+
}
|
|
33
|
+
return `Ended as ${status}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function toStatus(macroId, row) {
|
|
37
|
+
const status = row.status == null ? null : row.status;
|
|
38
|
+
const state = stateOf(status);
|
|
39
|
+
return {
|
|
40
|
+
macroId,
|
|
41
|
+
epicId: row.epicId ?? row.sourcePromptId ?? null,
|
|
42
|
+
slug: row.slug ?? null,
|
|
43
|
+
state,
|
|
44
|
+
status,
|
|
45
|
+
reason: state === 'failed' ? reasonOf(row, status) : null,
|
|
46
|
+
startedAt: row.startedAt ?? null,
|
|
47
|
+
finishedAt: row.finishedAt ?? null,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function stamp(row) {
|
|
52
|
+
const t = Date.parse(row.finishedAt || row.startedAt || row.createdAt || row.queuedAt || '');
|
|
53
|
+
return Number.isFinite(t) ? t : 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Newest row of `rows` (ties: later in the list wins). */
|
|
57
|
+
function newest(rows) {
|
|
58
|
+
let best = null;
|
|
59
|
+
let bestT = -Infinity;
|
|
60
|
+
for (const r of rows) {
|
|
61
|
+
const t = stamp(r);
|
|
62
|
+
if (t >= bestT) { best = r; bestT = t; }
|
|
63
|
+
}
|
|
64
|
+
return best;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function parseHistory(text) {
|
|
68
|
+
const out = [];
|
|
69
|
+
if (typeof text !== 'string' || !text) return out;
|
|
70
|
+
for (const line of text.split('\n')) {
|
|
71
|
+
if (!line.trim()) continue;
|
|
72
|
+
try {
|
|
73
|
+
const o = JSON.parse(line);
|
|
74
|
+
if (o && typeof o === 'object' && !o.kind) out.push(o);
|
|
75
|
+
} catch { /* torn line (tail cut mid-line, partial write) */ }
|
|
76
|
+
}
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function defaultReadHistoryTail(cwd) {
|
|
81
|
+
const { projectHistoryPath } = require('../scheduler/queueStore.cjs');
|
|
82
|
+
return readTail(projectHistoryPath(cwd), HISTORY_TAIL_BYTES);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function macroJobStatuses({ cwd } = {}, { loadJobs, readHistoryTail = defaultReadHistoryTail, builtins = BUILTIN_MACROS } = {}) {
|
|
86
|
+
const macros = (builtins || []).filter((m) => m && m.job && m.id);
|
|
87
|
+
if (!macros.length) return [];
|
|
88
|
+
let live = [];
|
|
89
|
+
try {
|
|
90
|
+
const rows = typeof loadJobs === 'function' ? await loadJobs() : [];
|
|
91
|
+
live = Array.isArray(rows) ? rows.filter((r) => r && r.cwd === cwd && r.macroId) : [];
|
|
92
|
+
} catch { live = []; }
|
|
93
|
+
|
|
94
|
+
let history = null; // lazily read once, only if some macro has no live row
|
|
95
|
+
const loadHistory = async () => {
|
|
96
|
+
if (history) return history;
|
|
97
|
+
try {
|
|
98
|
+
history = parseHistory(await readHistoryTail(cwd)).filter((r) => r.macroId && (!r.cwd || r.cwd === cwd));
|
|
99
|
+
} catch { history = []; }
|
|
100
|
+
return history;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const out = [];
|
|
104
|
+
for (const m of macros) {
|
|
105
|
+
let row = newest(live.filter((r) => r.macroId === m.id));
|
|
106
|
+
if (!row) row = newest((await loadHistory()).filter((r) => r.macroId === m.id));
|
|
107
|
+
if (row) out.push(toStatus(m.id, row));
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
module.exports = { macroJobStatuses, HISTORY_TAIL_BYTES };
|
|
@@ -190,6 +190,8 @@ const MacroSetProjectSchema = z.object({
|
|
|
190
190
|
enabled: z.boolean(),
|
|
191
191
|
});
|
|
192
192
|
|
|
193
|
+
const MacroRemoveFromProjectSchema = z.object({ id: MacroIdSchema, cwd: AbsolutePathSchema });
|
|
194
|
+
|
|
193
195
|
function defaultFilePath() {
|
|
194
196
|
return path.join(schedulerHome(), 'macros.json');
|
|
195
197
|
}
|
|
@@ -308,9 +310,26 @@ function resolveBuiltins(opts) {
|
|
|
308
310
|
/**
|
|
309
311
|
* Pure. Seeds any `builtins` entry missing from `macros` (as `builtin: true`),
|
|
310
312
|
* and upgrades a stored built-in that is behind the shipped `builtinVersion`
|
|
311
|
-
* AND
|
|
312
|
-
*
|
|
313
|
+
* AND unedited: `updatedAt === createdAt`, OR `isShippedCopy` (label/agent/tag
|
|
314
|
+
* match and the prompt is one of the built-in's `priorPrompts`). A really
|
|
315
|
+
* edited built-in is left untouched. Changing a built-in prompt means moving
|
|
316
|
+
* the old prompt into `priorPrompts` in builtinMacros.cjs. Returns
|
|
317
|
+
* `{ macros, changed }`.
|
|
318
|
+
*/
|
|
319
|
+
/**
|
|
320
|
+
* True when `stored` matches an earlier shipped version of `builtin`. The
|
|
321
|
+
* editor stamps `updatedAt` on every Save (even an unchanged one), so
|
|
322
|
+
* timestamps alone cannot prove a real edit.
|
|
313
323
|
*/
|
|
324
|
+
function isShippedCopy(stored, builtin) {
|
|
325
|
+
return (
|
|
326
|
+
stored.label === builtin.label &&
|
|
327
|
+
stored.agentName === builtin.agentName &&
|
|
328
|
+
stored.tag === builtin.tag &&
|
|
329
|
+
(builtin.priorPrompts || []).includes(stored.prompt)
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
|
|
314
333
|
function ensureBuiltins(macros, builtins) {
|
|
315
334
|
if (!builtins || builtins.length === 0) return { macros, changed: false };
|
|
316
335
|
let changed = false;
|
|
@@ -337,7 +356,7 @@ function ensureBuiltins(macros, builtins) {
|
|
|
337
356
|
}
|
|
338
357
|
const stored = next[idx];
|
|
339
358
|
const storedVersion = stored.builtinVersion || 0;
|
|
340
|
-
const neverEdited = stored.updatedAt === stored.createdAt;
|
|
359
|
+
const neverEdited = stored.updatedAt === stored.createdAt || isShippedCopy(stored, b);
|
|
341
360
|
if (storedVersion < b.builtinVersion && neverEdited) {
|
|
342
361
|
next[idx] = {
|
|
343
362
|
...stored,
|
|
@@ -462,8 +481,24 @@ async function loadStore(filePath, opts) {
|
|
|
462
481
|
|
|
463
482
|
// --- public API -------------------------------------------------------------
|
|
464
483
|
|
|
484
|
+
/**
|
|
485
|
+
* Decorate built-in entries with their live `job` declaration from BUILTIN_MACROS.
|
|
486
|
+
* Never persisted: `job` is read at list time so a stored copy cannot freeze it.
|
|
487
|
+
*/
|
|
488
|
+
function withBuiltinJobs(macros) {
|
|
489
|
+
return macros.map((m) => {
|
|
490
|
+
const { job: _stale, ...rest } = m;
|
|
491
|
+
const b = BUILTIN_MACROS.find((x) => x.id === m.id);
|
|
492
|
+
return b && b.job ? { ...rest, job: b.job } : rest;
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
|
|
465
496
|
/** @returns {Promise<Macro[]>} */
|
|
466
497
|
async function listMacros(opts = {}) {
|
|
498
|
+
return withBuiltinJobs(await listMacrosRaw(opts));
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
async function listMacrosRaw(opts) {
|
|
467
502
|
const filePath = resolvePath(opts);
|
|
468
503
|
const first = await readStore(filePath);
|
|
469
504
|
if (first.state === 'ok') {
|
|
@@ -600,6 +635,39 @@ async function setMacroProject(input, opts = {}) {
|
|
|
600
635
|
});
|
|
601
636
|
}
|
|
602
637
|
|
|
638
|
+
/**
|
|
639
|
+
* One project gives up a macro. The macro is deleted when `cwd` was its last
|
|
640
|
+
* project; otherwise only `cwd` is dropped, so one project can never take a
|
|
641
|
+
* button from another. Refuses a built-in, a '*' macro, and a macro not listed
|
|
642
|
+
* for `cwd`. Returns `{ ok: true, deleted, macro }` or `{ ok: false, error }`;
|
|
643
|
+
* when `deleted`, `macro` is the removed copy.
|
|
644
|
+
*/
|
|
645
|
+
async function removeMacroFromProject(input, opts = {}) {
|
|
646
|
+
const { id, cwd } = MacroRemoveFromProjectSchema.parse(input);
|
|
647
|
+
const filePath = resolvePath(opts);
|
|
648
|
+
const target = normalizeCwd(cwd);
|
|
649
|
+
return serialize(async () => {
|
|
650
|
+
const macros = await loadForWrite(filePath, opts);
|
|
651
|
+
const idx = macros.findIndex((m) => m.id === id);
|
|
652
|
+
if (idx === -1) return { ok: false, error: `macro not found: ${id}` };
|
|
653
|
+
const macro = macros[idx];
|
|
654
|
+
if (macro.builtin) return { ok: false, error: 'built-in macros cannot be deleted' };
|
|
655
|
+
if (macro.projects.includes(ALL_PROJECTS)) {
|
|
656
|
+
return { ok: false, error: `macro ${id} is shown in every project; only the human can remove it, from the HOT KEYS panel` };
|
|
657
|
+
}
|
|
658
|
+
if (!macro.projects.includes(target)) return { ok: false, error: `macro ${id} is not visible to ${target}` };
|
|
659
|
+
const projects = macro.projects.filter((p) => p !== target);
|
|
660
|
+
if (projects.length === 0) {
|
|
661
|
+
await writeStore(filePath, macros.filter((m) => m.id !== id));
|
|
662
|
+
return { ok: true, deleted: true, macro };
|
|
663
|
+
}
|
|
664
|
+
const updated = { ...macro, projects, updatedAt: new Date().toISOString() };
|
|
665
|
+
macros[idx] = updated;
|
|
666
|
+
await writeStore(filePath, macros);
|
|
667
|
+
return { ok: true, deleted: false, macro: updated };
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
|
|
603
671
|
module.exports = {
|
|
604
672
|
ALL_PROJECTS,
|
|
605
673
|
MACRO_INPUT_MAX_LEN,
|
|
@@ -609,6 +677,7 @@ module.exports = {
|
|
|
609
677
|
MacroSaveSchema,
|
|
610
678
|
MacroDeleteSchema,
|
|
611
679
|
MacroSetProjectSchema,
|
|
680
|
+
MacroRemoveFromProjectSchema,
|
|
612
681
|
macroPlaceholders,
|
|
613
682
|
defaultMacroValues,
|
|
614
683
|
renderMacroPrompt,
|
|
@@ -618,6 +687,7 @@ module.exports = {
|
|
|
618
687
|
saveMacro,
|
|
619
688
|
deleteMacro,
|
|
620
689
|
setMacroProject,
|
|
690
|
+
removeMacroFromProject,
|
|
621
691
|
defaultFilePath,
|
|
622
692
|
ensureBuiltins,
|
|
623
693
|
};
|
|
@@ -161,6 +161,18 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
|
|
|
161
161
|
},
|
|
162
162
|
],
|
|
163
163
|
"project-home-builder": [
|
|
164
|
+
// Not from src/seed git history: this body was written to ~/.claude/agents by this repo's own
|
|
165
|
+
// agent on 2026-08-02, before the seed file existed, so no seed commit ever contained it.
|
|
166
|
+
{
|
|
167
|
+
commit: "pre-seed-2026-08-02",
|
|
168
|
+
bodySha256: "ad9f77d1279b7e8b0856285c361f45d8b339369a63675307817d781e82588662",
|
|
169
|
+
fm: {
|
|
170
|
+
description: "Generates a project's static Project Home/Project Pages from that project's own saved component library and a computed project summary, if that pipeline exists there.",
|
|
171
|
+
tools: "Read, Grep, Glob, Bash, Write, Edit",
|
|
172
|
+
tags: "project-home-builder",
|
|
173
|
+
title: "Platform — Docs Engineer",
|
|
174
|
+
},
|
|
175
|
+
},
|
|
164
176
|
{
|
|
165
177
|
commit: "e9f2f540",
|
|
166
178
|
bodySha256: "e1c80f465179f814f1e9ea95529434309e5238facdc8c6664cb8f44f8302e148",
|
|
@@ -190,6 +202,39 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
|
|
|
190
202
|
effort: "medium",
|
|
191
203
|
},
|
|
192
204
|
},
|
|
205
|
+
{
|
|
206
|
+
commit: "seed-v3",
|
|
207
|
+
bodySha256: "8cef2256f31d1d166a305923388d1d0d2f4f099275df24d869decc35a6cb11bb",
|
|
208
|
+
fm: {
|
|
209
|
+
description: "Reads a project and writes ONE self-contained overview page (home.html) for its Project Home tab, then saves it with a single project_home_write call.",
|
|
210
|
+
tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_home_write",
|
|
211
|
+
title: "Project Home — Builder",
|
|
212
|
+
model: "sonnet",
|
|
213
|
+
effort: "medium",
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
commit: "seed-v4",
|
|
218
|
+
bodySha256: "525ba0b41d540bea5804b9c34765e05566555fb8447659a3b3c6579814c4a563",
|
|
219
|
+
fm: {
|
|
220
|
+
description: "Reads a project and writes ONE Knowledge Page (Overview by default, or How it works, FAQ, or a custom topic) for its Project Home tab, then saves it with a single project_page_write call.",
|
|
221
|
+
tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_home_write, mcp__session-manager-scheduler__project_page_write",
|
|
222
|
+
title: "Project Home — Builder",
|
|
223
|
+
model: "sonnet",
|
|
224
|
+
effort: "medium",
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
commit: "persona-no-reach-around",
|
|
229
|
+
bodySha256: "3453b38989b713e6671efdb1417a003dc6fc40fa82e506faf24239c598947c26",
|
|
230
|
+
fm: {
|
|
231
|
+
description: "Reads a project and writes ONE Knowledge Page (Overview by default, or How it works, FAQ, or a custom topic) for its Project Home tab, then saves it with a single project_page_write call.",
|
|
232
|
+
tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_home_write, mcp__session-manager-scheduler__project_page_write",
|
|
233
|
+
title: "Project Home — Builder",
|
|
234
|
+
model: "sonnet",
|
|
235
|
+
effort: "medium",
|
|
236
|
+
},
|
|
237
|
+
},
|
|
193
238
|
],
|
|
194
239
|
"validator": [
|
|
195
240
|
{
|
|
@@ -342,6 +387,61 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
|
|
|
342
387
|
effort: "max",
|
|
343
388
|
},
|
|
344
389
|
},
|
|
390
|
+
{
|
|
391
|
+
commit: "seed-v5",
|
|
392
|
+
bodySha256: "503ab8eed370d546f0435ac56a1470a1af31c6c665a2660af8c94b4d9ed6361a",
|
|
393
|
+
fm: {
|
|
394
|
+
description: "30-second self-contained HTML/JS demo video for Project Home, saved via project_demo_video_write.",
|
|
395
|
+
tools: "Read, Grep, Glob, Bash, Write, Edit",
|
|
396
|
+
title: "Project Home — Demo Video",
|
|
397
|
+
model: "opus",
|
|
398
|
+
effort: "max",
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
commit: "seed-v6",
|
|
403
|
+
bodySha256: "503ab8eed370d546f0435ac56a1470a1af31c6c665a2660af8c94b4d9ed6361a",
|
|
404
|
+
fm: {
|
|
405
|
+
description: "30-second self-contained HTML/JS demo video for Project Home, saved via project_demo_video_write.",
|
|
406
|
+
tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_demo_video_write",
|
|
407
|
+
title: "Project Home — Demo Video",
|
|
408
|
+
model: "opus",
|
|
409
|
+
effort: "max",
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
commit: "seed-v7",
|
|
414
|
+
bodySha256: "7d2040de1734c23148c3870b6ce3a3e5ce2aa319637dc7fc0cc2af63ec1b3036",
|
|
415
|
+
fm: {
|
|
416
|
+
description: "30-second or 1-minute self-contained HTML/JS demo video for Project Home, saved via project_demo_video_write.",
|
|
417
|
+
tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_demo_video_write",
|
|
418
|
+
title: "Project Home — Demo Video",
|
|
419
|
+
model: "opus",
|
|
420
|
+
effort: "max",
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
commit: "seed-v8",
|
|
425
|
+
bodySha256: "cf1bff8a70042f93fa18d2102ca71b969825377b9460834f3d2ae15f915d206b",
|
|
426
|
+
fm: {
|
|
427
|
+
description: "30-second or 1-minute self-contained HTML/JS demo video for Project Home, saved via project_video_write.",
|
|
428
|
+
tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_demo_video_write, mcp__session-manager-scheduler__project_video_write, mcp__session-manager-scheduler__project_character_write",
|
|
429
|
+
title: "Project Home — Demo Video",
|
|
430
|
+
model: "opus",
|
|
431
|
+
effort: "max",
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
commit: "persona-no-reach-around",
|
|
436
|
+
bodySha256: "259ae44d41f10990d55d1444d3bbf97012a9330d5bfb2ac5a7229113bb125e36",
|
|
437
|
+
fm: {
|
|
438
|
+
description: "30-second or 1-minute self-contained HTML/JS demo video for Project Home, saved via project_video_write.",
|
|
439
|
+
tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_demo_video_write, mcp__session-manager-scheduler__project_video_write, mcp__session-manager-scheduler__project_character_write",
|
|
440
|
+
title: "Project Home — Demo Video",
|
|
441
|
+
model: "opus",
|
|
442
|
+
effort: "max",
|
|
443
|
+
},
|
|
444
|
+
},
|
|
345
445
|
],
|
|
346
446
|
"blender-artist": [
|
|
347
447
|
{
|
|
@@ -37,6 +37,7 @@ const { sizingWarnings } = require('./prdSizing.cjs');
|
|
|
37
37
|
const telemetryCounters = require('../telemetry/telemetryCounters.cjs');
|
|
38
38
|
const { execGit } = require('../git/gitExec.cjs');
|
|
39
39
|
const { extractRepoPathCandidates, worktreeReachWarnings } = require('./prdWorktreeReach.cjs');
|
|
40
|
+
const { isSweepValidatorSlug } = require('../epic/epicSweepValidator.cjs');
|
|
40
41
|
const { validateGate, validateFiles, renderFilesSection, renderGateSection } = require('./prdGateFiles.cjs');
|
|
41
42
|
const { resolveGate, parseChain, isNoneGate } = require('../scheduler/definitionOfDone.cjs');
|
|
42
43
|
|
|
@@ -80,11 +81,16 @@ function deriveSlugFromTitle(title) {
|
|
|
80
81
|
* criteria / Files / Implementation notes / Out of scope / Gate /
|
|
81
82
|
* Engineering standards, in order.
|
|
82
83
|
*/
|
|
84
|
+
const MACRO_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
85
|
+
function isValidMacroId(id) {
|
|
86
|
+
return typeof id === 'string' && MACRO_ID_RE.test(id);
|
|
87
|
+
}
|
|
88
|
+
|
|
83
89
|
function buildPrdBody(input) {
|
|
84
90
|
const {
|
|
85
91
|
title, cwd, estimateMinutes, goal, acceptanceCriteria,
|
|
86
|
-
implementationNotes, outOfScope, sourcePromptId, sourceTabId, tag, agentType, dependsOn, quietMachine, disposition, deliverable, artifactPaths, planId,
|
|
87
|
-
gate, files,
|
|
92
|
+
implementationNotes, outOfScope, sourcePromptId, sourceTabId, tag, agentType, dependsOn, quietMachine, disposition, deliverable, artifactPaths, planId, macroId,
|
|
93
|
+
gate, files, budgetExempt,
|
|
88
94
|
} = input;
|
|
89
95
|
|
|
90
96
|
// No `parallelGroup` frontmatter key (PRD_AUTHORING.md §5) — the NN-
|
|
@@ -136,7 +142,11 @@ function buildPrdBody(input) {
|
|
|
136
142
|
// criteria are wall-clock/timing measurements that CPU contention from
|
|
137
143
|
// sibling jobs would otherwise invalidate. Only emitted when true — see
|
|
138
144
|
// prdFrontmatter.cjs's applyKey for the matching "only true opts in" parse.
|
|
145
|
+
if (isValidMacroId(macroId)) fmLines.push(`macroId: ${macroId}`);
|
|
139
146
|
if (quietMachine === true) fmLines.push('quietMachine: true');
|
|
147
|
+
// Budget exemption is for a sweep validator that cannot be split further;
|
|
148
|
+
// every other caller's budgetExempt is ignored.
|
|
149
|
+
if (budgetExempt === true && agentType === 'validator' && isSweepValidatorSlug(input.slug)) fmLines.push('budgetExempt: true');
|
|
140
150
|
fmLines.push('---', '');
|
|
141
151
|
|
|
142
152
|
const acLines = acceptanceCriteria.map((line) => `- [ ] ${line}`).join('\n');
|
|
@@ -400,6 +410,11 @@ async function createPrdInner(input, remote, ctl, opts = {}) {
|
|
|
400
410
|
}
|
|
401
411
|
}
|
|
402
412
|
|
|
413
|
+
// macroId (in-process callers only): refused before NN allocation.
|
|
414
|
+
if (input.macroId != null && !isValidMacroId(input.macroId)) {
|
|
415
|
+
return { ok: false, applied: false, status: 400, error: 'macroId must match /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/ when given' };
|
|
416
|
+
}
|
|
417
|
+
|
|
403
418
|
// Fake-heading guard (gate-and-files-in-PRD-body unit): a caller-supplied
|
|
404
419
|
// free-text field that itself contains a "# Gate" or "# Files" heading line
|
|
405
420
|
// would, after buildPrdBody splices in the real section below, read as TWO
|
|
@@ -77,8 +77,9 @@ function splitFrontmatter(raw) {
|
|
|
77
77
|
* never emitted, which is how `scheduler_update_prd` clears a dependency.
|
|
78
78
|
*/
|
|
79
79
|
|
|
80
|
-
const RECOGNIZED_KEYS = new Set(['title', 'cwd', 'estimateMinutes', 'parallelGroup', 'sourcePromptId', 'sourceTabId', 'tag', 'agentType', 'createdVia', 'issuedAt', 'dependsOn', 'quietMachine', 'disposition', 'planId', 'deliverable', 'artifactPaths']);
|
|
81
|
-
const EMIT_ORDER = ['title', 'cwd', 'estimateMinutes', 'parallelGroup', 'sourcePromptId', 'sourceTabId', 'tag', 'agentType', 'createdVia', 'issuedAt', 'dependsOn', 'quietMachine', 'disposition', 'planId', 'deliverable', 'artifactPaths'];
|
|
80
|
+
const RECOGNIZED_KEYS = new Set(['title', 'cwd', 'estimateMinutes', 'parallelGroup', 'sourcePromptId', 'sourceTabId', 'tag', 'agentType', 'createdVia', 'issuedAt', 'dependsOn', 'quietMachine', 'disposition', 'planId', 'deliverable', 'artifactPaths', 'macroId']);
|
|
81
|
+
const EMIT_ORDER = ['title', 'cwd', 'estimateMinutes', 'parallelGroup', 'sourcePromptId', 'sourceTabId', 'tag', 'agentType', 'createdVia', 'issuedAt', 'dependsOn', 'quietMachine', 'disposition', 'planId', 'deliverable', 'artifactPaths', 'macroId'];
|
|
82
|
+
const MACRO_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
82
83
|
const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
|
|
83
84
|
|
|
84
85
|
function indentOf(line) {
|
|
@@ -194,6 +195,10 @@ function applyKey(fm, key, after) {
|
|
|
194
195
|
// recognized; anything else is dropped so a typo can never opt in.
|
|
195
196
|
if (v === 'artifact') fm.deliverable = v;
|
|
196
197
|
return;
|
|
198
|
+
case 'macroId':
|
|
199
|
+
// Id of the macro whose press dispatched this PRD; anything off-pattern is dropped.
|
|
200
|
+
if (typeof v === 'string' && MACRO_ID_RE.test(v.trim())) fm.macroId = v.trim();
|
|
201
|
+
return;
|
|
197
202
|
case 'artifactPaths': {
|
|
198
203
|
// Inline `[a, b]` list, same shape as dependsOn.
|
|
199
204
|
const list = parseInlineList(after);
|