claude-code-session-manager 0.141.0 → 0.143.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/README.md +76 -153
- package/bin/cli.cjs +11 -0
- package/dist/assets/AppSettings-BO4jDVGO.js +2 -0
- package/dist/assets/{History-DJMiuXyK.js → History-DTttbvPb.js} +1 -1
- package/dist/assets/HomeClaudeConfig-DADP5bfn.js +3 -0
- package/dist/assets/{Panel-Bf1Cf8UL.js → Panel-B_D4Bg7L.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-BWPpypf9.js → ProjectClaudeConfig-DPnDJKcr.js} +7 -7
- package/dist/assets/Scheduler-CNLjn90m.js +16 -0
- package/dist/assets/{SkillReferenceGraph-Ba4TkX2C.js → SkillReferenceGraph-D1b2aiol.js} +1 -1
- package/dist/assets/{Skills-C1v91GEO.js → Skills-cfV7sgk6.js} +5 -5
- package/dist/assets/{TiptapBody-BrcWVpiW.js → TiptapBody-DVXtEIVy.js} +1 -1
- package/dist/assets/Toggle-CYajnSdx.js +1 -0
- package/dist/assets/{VoiceButton-qivnDV6K.js → VoiceButton-DJ4gGRuE.js} +1 -1
- package/dist/assets/{historyTotals-CMCPTKqC.js → historyTotals-D3MoHY2U.js} +1 -1
- package/dist/assets/index-CdTppjKR.js +3133 -0
- package/dist/assets/{index-DKXdXfka.css → index-DVHIHoJf.css} +1 -1
- package/dist/index.html +2 -2
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +496 -484
- package/package.json +6 -4
- package/plugins/AGENTS.md +4 -3
- package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
- package/plugins/session-manager-dev/hooks/hooks.json +15 -0
- package/plugins/session-manager-dev/hooks/residue-check.cjs +241 -0
- package/plugins/session-manager-dev/skills/builder/SKILL.md +5 -0
- package/plugins/session-manager-dev/skills/develop/SKILL.md +58 -18
- package/plugins/session-manager-dev/skills/develop/standards.md +3 -2
- package/scripts/README.md +2 -0
- package/scripts/hooks/guard-tool-risk.cjs +5 -1
- package/scripts/hooks/lib/guard-tool-risk-policy.cjs +158 -1
- package/scripts/scheduler-mcp-server.cjs +1032 -112
- package/src/main/adminRouteRegistry.cjs +69 -0
- package/src/main/agentLibrary.cjs +72 -4
- package/src/main/agentsIpc.cjs +3 -2
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +336 -23
- package/src/main/config.cjs +35 -1
- package/src/main/docEdit.cjs +4 -2
- package/src/main/health.cjs +129 -2
- package/src/main/index.cjs +110 -52
- package/src/main/ipcSchemas.cjs +172 -8
- package/src/main/lib/AGENTS.md +1 -1
- package/src/main/lib/chatBootRecovery.cjs +2 -0
- package/src/main/lib/claude/agentModelResolve.cjs +51 -25
- package/src/main/lib/claude/agentSnapshot.cjs +186 -0
- package/src/main/lib/claude/environmentProfiles.cjs +242 -0
- package/src/main/lib/claude/jobSandboxPolicy.cjs +241 -33
- package/src/main/lib/claude/personaToolScope.cjs +82 -31
- package/src/main/lib/claude/runClaudeP.cjs +4 -2
- package/src/main/lib/claude/toolRiskMarks.cjs +41 -1
- package/src/main/lib/claude/usageCircuit.cjs +49 -21
- package/src/main/lib/claude/vaultRefs.cjs +277 -0
- package/src/main/lib/demo-video-kit/capture.cjs +282 -12
- package/src/main/lib/demo-video-kit/cast.md +52 -0
- package/src/main/lib/demo-video-kit/character.cjs +778 -30
- package/src/main/lib/demo-video-kit/checks.cjs +120 -1
- package/src/main/lib/demo-video-kit/export.cjs +218 -0
- package/src/main/lib/demo-video-kit/frames.cjs +104 -9
- package/src/main/lib/demo-video-kit/kind-marketing.md +121 -0
- package/src/main/lib/demo-video-kit/kind-tiktok.md +103 -0
- package/src/main/lib/demo-video-kit/kokoroSay.cjs +205 -0
- package/src/main/lib/demo-video-kit/project-home-html.md +43 -0
- package/src/main/lib/demo-video-kit/projectSounds.cjs +191 -0
- package/src/main/lib/demo-video-kit/resumableRun.cjs +298 -0
- package/src/main/lib/demo-video-kit/seedKit.cjs +3 -3
- package/src/main/lib/demo-video-kit/sound.cjs +166 -9
- package/src/main/lib/demo-video-kit/standalone.cjs +231 -0
- package/src/main/lib/demo-video-kit/voiceLane.cjs +233 -0
- package/src/main/lib/demo-video-kit/voiceLibrary.cjs +312 -0
- package/src/main/lib/epic/activeIndexMerge.cjs +5 -0
- package/src/main/lib/epic/artifactAdminRoutes.cjs +211 -0
- package/src/main/lib/epic/artifactIpc.cjs +153 -0
- package/src/main/lib/epic/artifactNotice.cjs +72 -0
- package/src/main/lib/epic/artifactRetention.cjs +356 -0
- package/src/main/lib/epic/artifactStore.cjs +435 -0
- package/src/main/lib/epic/delegationReadiness.cjs +83 -2
- package/src/main/lib/epic/epicAgentRefresh.cjs +97 -0
- package/src/main/lib/epic/epicEventLog.cjs +258 -0
- package/src/main/lib/epic/epicMint.cjs +43 -1
- package/src/main/lib/epic/epicOutsideRead.cjs +1 -0
- package/src/main/lib/epic/epicOutsideState.cjs +18 -4
- package/src/main/lib/epic/epicPurge.cjs +347 -0
- package/src/main/lib/epic/epicReopen.cjs +5 -2
- package/src/main/lib/epic/epicSettle.cjs +4 -13
- package/src/main/lib/epic/epicSpawnPlan.cjs +57 -4
- package/src/main/lib/epic/epicStateEmitter.cjs +248 -0
- package/src/main/lib/epic/epicStatusMirror.cjs +34 -1
- package/src/main/lib/epic/epicTransitions.cjs +139 -0
- package/src/main/lib/epic/epicValidationHook.cjs +94 -4
- package/src/main/lib/epic/guardSpawnSettings.cjs +3 -2
- package/src/main/lib/externalContract.cjs +48 -4
- package/src/main/lib/feedback-remote/autoStartedSession.cjs +1 -1
- package/src/main/lib/feedback-remote/crossProjectReply.cjs +478 -127
- package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +16 -3
- package/src/main/lib/feedback-remote/customerFeedbackClient.cjs +11 -6
- package/src/main/lib/feedback-remote/customerFeedbackInbox.cjs +26 -1
- package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +5 -2
- package/src/main/lib/feedback-remote/feedbackBoxDrain.cjs +409 -0
- package/src/main/lib/feedback-remote/feedbackBoxKeys.cjs +218 -0
- package/src/main/lib/feedback-remote/feedbackEnvelope.cjs +163 -0
- package/src/main/lib/feedback-remote/feedbackRelayClient.cjs +164 -0
- package/src/main/lib/feedback-remote/feedbackReport.cjs +234 -0
- package/src/main/lib/feedback-remote/feedbackSeal.cjs +217 -0
- package/src/main/lib/feedback-remote/localAdminHttp.cjs +108 -2
- package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +32 -1
- package/src/main/lib/feedback-remote/needsYouIpc.cjs +17 -0
- package/src/main/lib/feedback-remote/needsYouStore.cjs +177 -6
- package/src/main/lib/feedback-remote/pendingReplies.cjs +207 -0
- package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +282 -14
- package/src/main/lib/feedback-remote/replyClaims.cjs +159 -0
- package/src/main/lib/feedback-remote/serviceClient.cjs +429 -0
- package/src/main/lib/feedback-remote/serviceMcpSession.cjs +252 -0
- package/src/main/lib/feedback-remote/serviceMcpTools.cjs +284 -0
- package/src/main/lib/feedback-remote/servicePairings.cjs +313 -0
- package/src/main/lib/feedback-remote/serviceStdioBridge.cjs +290 -0
- package/src/main/lib/feedback-remote/siteFeedbackAdminRoutes.cjs +295 -0
- package/src/main/lib/feedback-remote/siteFeedbackInbox.cjs +598 -0
- package/src/main/lib/feedback-remote/siteFeedbackIpc.cjs +86 -0
- package/src/main/lib/feedback-remote/siteFeedbackService.cjs +477 -0
- package/src/main/lib/git/gitWorktree.cjs +8 -0
- package/src/main/lib/git/runtimeStateUntrack.cjs +15 -1
- package/src/main/lib/git/worktreeDeps.cjs +182 -4
- package/src/main/lib/mcpToolCatalog.cjs +399 -29
- package/src/main/lib/opsOwnership.cjs +141 -28
- package/src/main/lib/opsRetentionSettings.cjs +27 -5
- package/src/main/lib/persona-macro/builtinMacros.cjs +7 -2
- package/src/main/lib/persona-macro/macroJobDispatch.cjs +52 -8
- package/src/main/lib/persona-macro/macroJobIpc.cjs +16 -6
- package/src/main/lib/persona-macro/macroLibrary.cjs +49 -7
- package/src/main/lib/persona-macro/personaFrontmatterSchema.cjs +83 -0
- package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +3 -0
- package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +309 -0
- package/src/main/lib/phaseProjection.cjs +103 -0
- package/src/main/lib/prd/depSlugResolve.cjs +4 -13
- package/src/main/lib/prd/prdBodyPatch.cjs +12 -17
- package/src/main/lib/prd/prdCreate.cjs +387 -228
- package/src/main/lib/prd/prdCriteria.cjs +228 -0
- package/src/main/lib/prd/prdFrontmatter.cjs +43 -3
- package/src/main/lib/prd/prdGateFiles.cjs +125 -49
- package/src/main/lib/prd/prdSizing.cjs +3 -1
- package/src/main/lib/process/cleanEnv.cjs +52 -1
- package/src/main/lib/process/leftoverRenice.cjs +178 -0
- package/src/main/lib/process/memoryScope.cjs +31 -3
- package/src/main/lib/project-pages/pagesLibrary.cjs +72 -6
- package/src/main/lib/project-pages/videoPressLines.cjs +145 -0
- package/src/main/lib/project-pages/videoReviewIpc.cjs +3 -2
- package/src/main/lib/project-pages/videoScriptPress.cjs +260 -0
- package/src/main/lib/project-pages/videoScriptRunRoute.cjs +351 -0
- package/src/main/lib/project-pages/videoScriptSwitchIpc.cjs +49 -0
- package/src/main/lib/project-pages/videoScriptSwitchRoute.cjs +173 -0
- package/src/main/lib/project-pages/voiceAdminRoutes.cjs +175 -0
- package/src/main/lib/project-pages/voicePreview.cjs +196 -0
- package/src/main/lib/project-pages/voicesIpc.cjs +186 -0
- package/src/main/lib/promptSessionSchema.cjs +6 -0
- package/src/main/lib/scheduler/cancelledRow.cjs +57 -0
- package/src/main/lib/scheduler/cpuSample.cjs +133 -42
- package/src/main/lib/scheduler/criteriaChecks.cjs +313 -0
- package/src/main/lib/scheduler/definitionOfDone.cjs +44 -5
- package/src/main/lib/scheduler/heldSchedulerTurns.cjs +238 -0
- package/src/main/lib/scheduler/jobMemoryStats.cjs +324 -0
- package/src/main/lib/scheduler/loadGate.cjs +82 -4
- package/src/main/lib/scheduler/planRecordHarvest.cjs +152 -54
- package/src/main/lib/scheduler/prdOutcomeRecord.cjs +191 -0
- package/src/main/lib/scheduler/queueStore.cjs +16 -0
- package/src/main/lib/scheduler/rcaReport.cjs +79 -15
- package/src/main/lib/scheduler/runLogRetention.cjs +42 -1
- package/src/main/lib/scheduler/scheduleJobSchema.cjs +18 -0
- package/src/main/lib/scheduler/scheduleJobTransitions.cjs +47 -0
- package/src/main/lib/scheduler/schedulerConfig.cjs +47 -0
- package/src/main/lib/scheduler/schedulerPaths.cjs +9 -3
- package/src/main/lib/scheduler/schedulerRuntimeState.cjs +50 -1
- package/src/main/lib/scheduler/sessionSlots.cjs +5 -1
- package/src/main/lib/scheduler/slotsRoute.cjs +251 -0
- package/src/main/lib/scheduler/toolClearance.cjs +258 -0
- package/src/main/lib/scheduler/usageHoldRoute.cjs +97 -0
- package/src/main/lib/scheduler/validatorVerdictSchema.cjs +152 -11
- package/src/main/lib/tasks/memoryConsolidation.cjs +312 -0
- package/src/main/lib/tasks/mitigationReview.cjs +314 -0
- package/src/main/lib/tasks/taskAdminRoutes.cjs +390 -25
- package/src/main/lib/tasks/taskIpc.cjs +22 -18
- package/src/main/lib/tasks/taskLedger.cjs +147 -25
- package/src/main/lib/tasks/taskRun.cjs +186 -17
- package/src/main/lib/tasks/taskSwitch.cjs +85 -12
- package/src/main/lib/tasks/taskSwitchRoute.cjs +172 -0
- package/src/main/lib/telemetry/auditEvents.cjs +204 -6
- package/src/main/lib/telemetry/auditLog.cjs +6 -2
- package/src/main/lib/telemetry/eventsAdminRoutes.cjs +198 -6
- package/src/main/lib/telemetry/webhookDelivery.cjs +205 -0
- package/src/main/lib/telemetry/webhookRegistry.cjs +281 -0
- package/src/main/lib/toolUseClassify.cjs +181 -0
- package/src/main/lib/util/atomicFs.cjs +2 -2
- package/src/main/lib/util/smfileRange.cjs +77 -0
- package/src/main/projectPages.cjs +3 -1
- package/src/main/promptSessionEvents.cjs +21 -1
- package/src/main/pty.cjs +77 -0
- package/src/main/queueOps.cjs +33 -14
- package/src/main/runVerify.cjs +74 -9
- package/src/main/scheduler/AGENTS.md +1 -0
- package/src/main/scheduler/budget.cjs +6 -5
- package/src/main/scheduler/prdParser.cjs +46 -13
- package/src/main/scheduler/reviewLadder.cjs +9 -25
- package/src/main/scheduler/utilizationHold.cjs +191 -0
- package/src/main/scheduler.cjs +1932 -213
- package/src/main/templates/PRD_AUTHORING.md +11 -3
- package/src/main/webRemote.cjs +463 -6
- package/src/preload/api.d.ts +576 -39
- package/src/preload/apiSurface.json +223 -7
- package/src/preload/index.cjs +48 -1
- package/src/seed/agents/architect.md +6 -1
- package/src/seed/agents/blender-artist.md +2 -1
- package/src/seed/agents/competitive-analyst.md +3 -1
- package/src/seed/agents/competitive-researcher.md +2 -1
- package/src/seed/agents/demo-video-builder.md +98 -87
- package/src/seed/agents/dev-lead.md +3 -3
- package/src/seed/agents/project-home-builder.md +9 -31
- package/src/seed/agents/validator.md +23 -23
- package/dist/assets/AppSettings-DExeJhqQ.js +0 -2
- package/dist/assets/HomeClaudeConfig-CTp2tkZ4.js +0 -3
- package/dist/assets/Scheduler-cyr61UAC.js +0 -16
- package/dist/assets/ViewTabs-DXhOWFG0.js +0 -1
- package/dist/assets/index-B2TQz3nd.js +0 -3121
- package/src/main/lib/epic/epicStateWatcher.cjs +0 -157
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
* - lib/scheduler/queueStore.cjs (raw fs tmp+rename)
|
|
29
29
|
* - lib/telemetry/opsErrorLog.cjs (raw fs append, JSONL error log)
|
|
30
30
|
* - lib/tasks/taskLedger.cjs (raw fs append + atomicFs bodies)
|
|
31
|
+
* - lib/claude/agentSnapshot.cjs (atomicFs, write-once snapshots)
|
|
32
|
+
* - lib/telemetry/webhookRegistry.cjs (atomicFs, 0600 subscriptions file)
|
|
33
|
+
* - lib/epic/epicPurge.cjs (human-only Epic purge: deletes each
|
|
34
|
+
* namespace's files AS that namespace's owner — the one exception to
|
|
35
|
+
* keep-forever retention; it never borrows another owner's id)
|
|
31
36
|
* Renderer callers declare their writer id through the IPC payload.
|
|
32
37
|
*/
|
|
33
38
|
|
|
@@ -81,19 +86,75 @@ const OWNERS = Object.freeze({
|
|
|
81
86
|
// scheduler copies them out of job worktrees and prunes them after the Epic
|
|
82
87
|
// completes. See plan-records/README.md.
|
|
83
88
|
'plan-records': 'scheduler',
|
|
89
|
+
// The per-Epic durable event log: events/<epicId>/events.jsonl, closed
|
|
90
|
+
// {domain}.{action} kinds, summaries only. lib/epic/epicEventLog.cjs is the
|
|
91
|
+
// ONLY writer. Keep forever. See session-manager-operations/AGENTS.md.
|
|
92
|
+
'events': 'event-log',
|
|
93
|
+
// Immutable, content-addressed AgentSnapshots: agents/snapshots/<sha256>.json,
|
|
94
|
+
// written once each. lib/claude/agentSnapshot.cjs is the ONLY writer. Keep
|
|
95
|
+
// forever. See session-manager-operations/AGENTS.md.
|
|
96
|
+
'agents': 'agents',
|
|
97
|
+
// Local webhook subscriptions (loopback URL, kinds filter, HMAC secret):
|
|
98
|
+
// webhooks/subscriptions.json, mode 0600. lib/telemetry/webhookRegistry.cjs
|
|
99
|
+
// is the ONLY writer. Runtime (holds secrets — never committed).
|
|
100
|
+
'webhooks': 'webhooks',
|
|
101
|
+
// Per-project website feedback inbox: reports from the embedded feedback
|
|
102
|
+
// widget, which carry screenshots and reporter emails. Written only as the
|
|
103
|
+
// 'feedback-inbox' writer. Runtime (personal data — never committed);
|
|
104
|
+
// resolved/wontfix items pruned after feedbackInboxDays (opsRetentionSettings).
|
|
105
|
+
'feedback-inbox': 'feedback-inbox',
|
|
106
|
+
// Per-project Artifacts store: files agents made for human review, copied
|
|
107
|
+
// out of job/Epic worktrees as artifacts/<epic-id>/<name> (or
|
|
108
|
+
// artifacts/_tasks/<task-id>/<name>) plus each owner's index.json ledger.
|
|
109
|
+
// lib/epic/artifactStore.cjs is the ONLY writer. Runtime (self-ignored);
|
|
110
|
+
// pruned artifactsDays after the Epic completes.
|
|
111
|
+
'artifacts': 'artifacts',
|
|
84
112
|
});
|
|
85
113
|
|
|
86
114
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
115
|
+
* namespace -> its git class, one entry per namespace Session Manager defines.
|
|
116
|
+
* - 'runtime': machine-local state, never committed. Each dir self-ignores
|
|
117
|
+
* with its own `*` .gitignore (ensureRuntimeIgnores).
|
|
118
|
+
* - 'tracked': the project's own authored output (Project Home pages and
|
|
119
|
+
* videos, the Brief, docs), committed like docs. Session Manager never
|
|
120
|
+
* writes an ignore file there; a project that wants it out of git adds its
|
|
121
|
+
* own rule.
|
|
122
|
+
* A folder not listed here (feedback/, retired 2026-08-02, or any folder a
|
|
123
|
+
* project made itself) belongs to the project: a project's feedback/ is its
|
|
124
|
+
* own folder, and Session Manager never writes, ignores, bans from commits or
|
|
125
|
+
* untracks it.
|
|
92
126
|
*/
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
'
|
|
96
|
-
|
|
127
|
+
const GIT_CLASS = Object.freeze({
|
|
128
|
+
scheduler: 'runtime',
|
|
129
|
+
'prompt-sessions': 'runtime',
|
|
130
|
+
logs: 'runtime',
|
|
131
|
+
'ui-prefs': 'runtime',
|
|
132
|
+
'memory-clusters': 'runtime',
|
|
133
|
+
tasks: 'runtime',
|
|
134
|
+
'plan-records': 'runtime',
|
|
135
|
+
events: 'runtime',
|
|
136
|
+
agents: 'runtime',
|
|
137
|
+
webhooks: 'runtime',
|
|
138
|
+
'feedback-inbox': 'runtime',
|
|
139
|
+
artifacts: 'runtime',
|
|
140
|
+
'project-brief': 'tracked',
|
|
141
|
+
'project-pages': 'tracked',
|
|
142
|
+
architecture: 'tracked',
|
|
143
|
+
'design-mocks': 'tracked',
|
|
144
|
+
HUMAN_LEARN: 'tracked',
|
|
145
|
+
manual: 'tracked',
|
|
146
|
+
reviews: 'tracked',
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Machine-local RUNTIME namespaces, derived from GIT_CLASS. Every consumer
|
|
151
|
+
* (self-ignore sweep, worktree carry, finish-protocol commit ban, health,
|
|
152
|
+
* runtime-state untrack) reads this list. This repo's root .gitignore lists
|
|
153
|
+
* each one too (plus its own retired feedback/ folder, which is not runtime).
|
|
154
|
+
*/
|
|
155
|
+
const RUNTIME_NAMESPACES = Object.freeze(
|
|
156
|
+
Object.keys(GIT_CLASS).filter((ns) => GIT_CLASS[ns] === 'runtime'),
|
|
157
|
+
);
|
|
97
158
|
|
|
98
159
|
/** Writer id for the per-namespace self-ignore file. */
|
|
99
160
|
const RUNTIME_IGNORE_WRITER = 'runtime-ignore';
|
|
@@ -105,9 +166,10 @@ const RUNTIME_IGNORE_WRITER = 'runtime-ignore';
|
|
|
105
166
|
* code review, not discovered later in a race.
|
|
106
167
|
*/
|
|
107
168
|
const DELEGATIONS_BASE = {
|
|
108
|
-
// Each runtime namespace
|
|
109
|
-
// project's root .gitignore needs no edit.
|
|
110
|
-
// ensureRuntimeIgnores writes it.
|
|
169
|
+
// Each runtime namespace (GIT_CLASS 'runtime', all owned) carries its own
|
|
170
|
+
// `.gitignore` (content `*`) so the project's root .gitignore needs no edit.
|
|
171
|
+
// Only that one file, only ensureRuntimeIgnores writes it. Tracked and
|
|
172
|
+
// project-owned folders get no delegation.
|
|
111
173
|
...Object.fromEntries(RUNTIME_NAMESPACES.map((ns) => [ns, []])),
|
|
112
174
|
'prompt-sessions': Object.freeze([
|
|
113
175
|
Object.freeze({
|
|
@@ -183,6 +245,8 @@ function checkOpsWrite(absPath, writer) {
|
|
|
183
245
|
|
|
184
246
|
const owner = OWNERS[namespace];
|
|
185
247
|
if (!owner) {
|
|
248
|
+
// Fail closed: an owner-less folder (a project's own feedback/, say) is
|
|
249
|
+
// the project's, never Session Manager's — no writer, no delegation.
|
|
186
250
|
return {
|
|
187
251
|
ok: false,
|
|
188
252
|
error:
|
|
@@ -343,34 +407,83 @@ function opsPath(cwd, ...segments) {
|
|
|
343
407
|
}
|
|
344
408
|
|
|
345
409
|
/**
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
410
|
+
* ensureRuntimeIgnore(projectRoot, ns) → the `.gitignore` path written, or null.
|
|
411
|
+
* When `<projectRoot>/session-manager-operations/<ns>/` is a directory with no
|
|
412
|
+
* `.gitignore` file, write one containing `*` (which also ignores itself).
|
|
413
|
+
* Null when the file already exists or the namespace dir is absent. Throws on
|
|
414
|
+
* a non-runtime `ns`, an ownership refusal, or an IO error (including a
|
|
415
|
+
* non-file sitting at the `.gitignore` path). Never creates the namespace dir.
|
|
350
416
|
* `projectRoot` must already be resolved (resolveProjectRoot/projectRootOf).
|
|
351
417
|
*/
|
|
352
|
-
function
|
|
418
|
+
function ensureRuntimeIgnore(projectRoot, ns) {
|
|
419
|
+
if (!RUNTIME_NAMESPACES.includes(ns)) {
|
|
420
|
+
throw new Error(`'${ns}' is not a runtime namespace (RUNTIME_NAMESPACES in lib/opsOwnership.cjs)`);
|
|
421
|
+
}
|
|
422
|
+
const dir = path.join(projectRoot, OPS_ROOT_DIR, ns);
|
|
423
|
+
let isDir = false;
|
|
424
|
+
try { isDir = fs.statSync(dir).isDirectory(); } catch { /* absent */ }
|
|
425
|
+
if (!isDir) return null;
|
|
426
|
+
const file = path.join(dir, '.gitignore');
|
|
427
|
+
let st = null;
|
|
428
|
+
try { st = fs.statSync(file); } catch { /* absent */ }
|
|
429
|
+
if (st && st.isFile()) return null;
|
|
430
|
+
const verdict = checkOpsWrite(file, RUNTIME_IGNORE_WRITER);
|
|
431
|
+
if (!verdict.ok) throw new Error(verdict.error);
|
|
353
432
|
const { writeTextAtomicSync } = require('./util/atomicFs.cjs');
|
|
354
|
-
|
|
433
|
+
writeTextAtomicSync(file, '*\n');
|
|
434
|
+
return file;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* ensureRuntimeIgnoreForPath(absPath) → the `.gitignore` path written, or null.
|
|
439
|
+
* For a path inside a RUNTIME namespace of an ops root (innermost
|
|
440
|
+
* session-manager-operations segment, same rule as parseOpsPath), create the
|
|
441
|
+
* namespace dir if missing and self-ignore it. Null for a path outside any ops
|
|
442
|
+
* root, in an authored namespace, or that IS the namespace `.gitignore`.
|
|
443
|
+
* Throws on refusal or IO error.
|
|
444
|
+
*/
|
|
445
|
+
function ensureRuntimeIgnoreForPath(absPath) {
|
|
446
|
+
if (!absPath || typeof absPath !== 'string') return null;
|
|
447
|
+
const resolved = path.resolve(absPath);
|
|
448
|
+
const segs = resolved.split(path.sep);
|
|
449
|
+
const idx = segs.lastIndexOf(OPS_ROOT_DIR);
|
|
450
|
+
if (idx === -1) return null;
|
|
451
|
+
const ns = segs[idx + 1];
|
|
452
|
+
if (!ns || !RUNTIME_NAMESPACES.includes(ns)) return null;
|
|
453
|
+
const rest = segs.slice(idx + 2).filter(Boolean);
|
|
454
|
+
if (rest.length === 1 && rest[0] === '.gitignore') return null;
|
|
455
|
+
const projectRoot = segs.slice(0, idx).join(path.sep) || path.sep;
|
|
456
|
+
fs.mkdirSync(path.join(projectRoot, OPS_ROOT_DIR, ns), { recursive: true });
|
|
457
|
+
return ensureRuntimeIgnore(projectRoot, ns);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* ensureRuntimeIgnores(projectRoot) → string[] of `.gitignore` paths written.
|
|
462
|
+
* ensureRuntimeIgnore for every runtime namespace, each isolated: one
|
|
463
|
+
* namespace's failure never stops the others. After the loop, throws one
|
|
464
|
+
* Error naming every failed namespace and its reason. Idempotent.
|
|
465
|
+
*/
|
|
466
|
+
function ensureRuntimeIgnores(projectRoot) {
|
|
355
467
|
const written = [];
|
|
468
|
+
const failures = [];
|
|
356
469
|
for (const ns of RUNTIME_NAMESPACES) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
const verdict = checkOpsWrite(file, RUNTIME_IGNORE_WRITER);
|
|
364
|
-
if (!verdict.ok) throw new Error(verdict.error);
|
|
365
|
-
writeTextAtomicSync(file, '*\n');
|
|
366
|
-
written.push(file);
|
|
470
|
+
try {
|
|
471
|
+
const file = ensureRuntimeIgnore(projectRoot, ns);
|
|
472
|
+
if (file) written.push(file);
|
|
473
|
+
} catch (e) {
|
|
474
|
+
failures.push(`${ns}: ${(e && e.message) || String(e)}`);
|
|
475
|
+
}
|
|
367
476
|
}
|
|
477
|
+
if (failures.length) throw new Error(`runtime self-ignore failed: ${failures.join('; ')}`);
|
|
368
478
|
return written;
|
|
369
479
|
}
|
|
370
480
|
|
|
371
481
|
module.exports = {
|
|
482
|
+
GIT_CLASS,
|
|
372
483
|
RUNTIME_NAMESPACES,
|
|
373
484
|
RUNTIME_IGNORE_WRITER,
|
|
485
|
+
ensureRuntimeIgnore,
|
|
486
|
+
ensureRuntimeIgnoreForPath,
|
|
374
487
|
ensureRuntimeIgnores,
|
|
375
488
|
OPS_ROOT_DIR,
|
|
376
489
|
OWNERS,
|
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Storage: ~/.claude/session-manager/ops-retention.json
|
|
5
5
|
* Shape (DEFAULTS): { runLogs:{maxAgeDays,keepPerSlug}, runsArchiveDays, auditLogMonths,
|
|
6
|
-
* reservedMarkersKeep, tasksDays, planRecordsDays }
|
|
6
|
+
* reservedMarkersKeep, tasksDays, planRecordsDays, artifactsDays, feedbackInboxDays }
|
|
7
7
|
* tasksDays: Task ledger day files + bodies (lib/tasks/taskLedger.cjs pruneOld).
|
|
8
8
|
* planRecordsDays: plan-records/<epic-id>/ folders of completed/orphan Epics
|
|
9
9
|
* (lib/scheduler/planRecordRetention.cjs prunePlanRecords).
|
|
10
|
+
* artifactsDays: artifacts/<epic-id>/ folders of completed/archived/orphan Epics, pinned
|
|
11
|
+
* ledger entries kept; artifacts/_tasks/ follows tasksDays
|
|
12
|
+
* (lib/epic/artifactRetention.cjs pruneArtifacts).
|
|
13
|
+
* feedbackInboxDays: delete resolved or wontfix feedback-inbox/ items older than this.
|
|
10
14
|
* Archived transcripts are kept forever (fixed policy, not a setting).
|
|
11
15
|
*
|
|
12
16
|
* Top-level in lib/ (no domain fits: read by scheduler, telemetry and epic sweeps alike).
|
|
@@ -27,6 +31,8 @@ const DEFAULTS = Object.freeze({
|
|
|
27
31
|
reservedMarkersKeep: 100,
|
|
28
32
|
tasksDays: 30,
|
|
29
33
|
planRecordsDays: 14,
|
|
34
|
+
artifactsDays: 30,
|
|
35
|
+
feedbackInboxDays: 90,
|
|
30
36
|
});
|
|
31
37
|
|
|
32
38
|
// [min, max] per integer field; out-of-range values clamp, non-integers round.
|
|
@@ -38,6 +44,8 @@ const BOUNDS = Object.freeze({
|
|
|
38
44
|
reservedMarkersKeep: [1, 100000],
|
|
39
45
|
tasksDays: [1, 3650],
|
|
40
46
|
planRecordsDays: [1, 3650],
|
|
47
|
+
artifactsDays: [1, 3650],
|
|
48
|
+
feedbackInboxDays: [1, 3650],
|
|
41
49
|
});
|
|
42
50
|
|
|
43
51
|
function storePath() {
|
|
@@ -71,7 +79,7 @@ function validatePatch(patch) {
|
|
|
71
79
|
if (rk !== 'maxAgeDays' && rk !== 'keepPerSlug') throw new Error(`Invalid ops retention config: runLogs.${rk}`);
|
|
72
80
|
out.runLogs[rk] = num(`runLogs.${rk}`, rv);
|
|
73
81
|
}
|
|
74
|
-
} else if (k === 'runsArchiveDays' || k === 'auditLogMonths' || k === 'reservedMarkersKeep' || k === 'tasksDays' || k === 'planRecordsDays') {
|
|
82
|
+
} else if (k === 'runsArchiveDays' || k === 'auditLogMonths' || k === 'reservedMarkersKeep' || k === 'tasksDays' || k === 'planRecordsDays' || k === 'artifactsDays' || k === 'feedbackInboxDays') {
|
|
75
83
|
out[k] = num(k, v);
|
|
76
84
|
} else {
|
|
77
85
|
throw new Error(`Invalid ops retention config: unknown key ${k}`);
|
|
@@ -95,7 +103,7 @@ function sanitizeStored(data) {
|
|
|
95
103
|
};
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
|
-
for (const key of ['runsArchiveDays', 'auditLogMonths', 'reservedMarkersKeep', 'tasksDays', 'planRecordsDays']) {
|
|
106
|
+
for (const key of ['runsArchiveDays', 'auditLogMonths', 'reservedMarkersKeep', 'tasksDays', 'planRecordsDays', 'artifactsDays', 'feedbackInboxDays']) {
|
|
99
107
|
const v = int(key, data[key]);
|
|
100
108
|
if (v !== undefined) out[key] = v;
|
|
101
109
|
}
|
|
@@ -122,6 +130,8 @@ function withDefaults(stored) {
|
|
|
122
130
|
reservedMarkersKeep: s.reservedMarkersKeep ?? DEFAULTS.reservedMarkersKeep,
|
|
123
131
|
tasksDays: s.tasksDays ?? DEFAULTS.tasksDays,
|
|
124
132
|
planRecordsDays: s.planRecordsDays ?? DEFAULTS.planRecordsDays,
|
|
133
|
+
artifactsDays: s.artifactsDays ?? DEFAULTS.artifactsDays,
|
|
134
|
+
feedbackInboxDays: s.feedbackInboxDays ?? DEFAULTS.feedbackInboxDays,
|
|
125
135
|
};
|
|
126
136
|
}
|
|
127
137
|
|
|
@@ -146,7 +156,7 @@ function write(patch) {
|
|
|
146
156
|
/**
|
|
147
157
|
* Dry-run report of what each policy would free, via the sweeps' own
|
|
148
158
|
* eligibility code. Read-only. opts: { now, runsDir, plansRoot, jobs, liveKeys,
|
|
149
|
-
* projectRoot, epicStatus }. planRecords
|
|
159
|
+
* projectRoot, epicStatus }. planRecords + artifacts are reported only when projectRoot is given;
|
|
150
160
|
* epicStatus defaults to reading that project's prompt-sessions/<id>.json.
|
|
151
161
|
*/
|
|
152
162
|
function preview(opts) {
|
|
@@ -179,22 +189,34 @@ function preview(opts) {
|
|
|
179
189
|
});
|
|
180
190
|
const tmp = staleTmpSweep.sweepStaleTmp(plansRoot, { now, dryRun: true });
|
|
181
191
|
let planRecords = null;
|
|
192
|
+
let artifacts = null;
|
|
182
193
|
if (o.projectRoot) {
|
|
183
194
|
const planRecordRetention = require('./scheduler/planRecordRetention.cjs');
|
|
195
|
+
const epicStatus = typeof o.epicStatus === 'function' ? o.epicStatus : planRecordRetention.defaultEpicStatus(o.projectRoot);
|
|
184
196
|
const pr = planRecordRetention.prunePlanRecords({
|
|
185
197
|
projectRoot: o.projectRoot,
|
|
186
|
-
epicStatus
|
|
198
|
+
epicStatus,
|
|
187
199
|
now,
|
|
188
200
|
days: s.planRecordsDays,
|
|
189
201
|
dryRun: true,
|
|
190
202
|
});
|
|
191
203
|
planRecords = { folders: pr.removed.length };
|
|
204
|
+
const ar = require('./epic/artifactRetention.cjs').pruneArtifacts({
|
|
205
|
+
projectRoot: o.projectRoot,
|
|
206
|
+
epicStatus,
|
|
207
|
+
now,
|
|
208
|
+
days: s.artifactsDays,
|
|
209
|
+
tasksDays: s.tasksDays,
|
|
210
|
+
dryRun: true,
|
|
211
|
+
});
|
|
212
|
+
artifacts = { folders: ar.removed.length, files: ar.removedFiles };
|
|
192
213
|
}
|
|
193
214
|
return {
|
|
194
215
|
runLogs: { files: report.eligible.reduce((n, e) => n + e.removeFiles.length, 0) + report.dodFiles.length, bytes: report.eligibleSummary.bytes },
|
|
195
216
|
runsArchive: { entries: archive.removedFiles, bytes: archive.freedBytes },
|
|
196
217
|
tmp: { files: tmp.removedFiles, bytes: tmp.freedBytes },
|
|
197
218
|
...(planRecords ? { planRecords } : {}),
|
|
219
|
+
...(artifacts ? { artifacts } : {}),
|
|
198
220
|
};
|
|
199
221
|
}
|
|
200
222
|
|
|
@@ -51,11 +51,13 @@ const BUILTIN_MACROS = Object.freeze([
|
|
|
51
51
|
tag: 'project-home-builder',
|
|
52
52
|
surface: 'project-home',
|
|
53
53
|
projects: ['*'],
|
|
54
|
-
builtinVersion:
|
|
54
|
+
builtinVersion: 12,
|
|
55
55
|
job: Object.freeze({
|
|
56
56
|
estimateMinutes: 60,
|
|
57
57
|
entryKind: 'video',
|
|
58
58
|
artifactPaths: Object.freeze(['session-manager-operations/project-pages/videos/{id}/index.html']),
|
|
59
|
+
// A press may opt into the review stage (reviewStage: true); see macroJobDispatch.cjs.
|
|
60
|
+
reviewable: true,
|
|
59
61
|
}),
|
|
60
62
|
priorPrompts: Object.freeze([
|
|
61
63
|
'Generate a 30-second demo video for this project as one self-contained HTML/JavaScript animation that presents its main goals and key features, grounded only in what you read in the repository. Save it with a single project_demo_video_write call.',
|
|
@@ -66,9 +68,12 @@ const BUILTIN_MACROS = Object.freeze([
|
|
|
66
68
|
"Generate a character and cute animated JavaScript video as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise. The video kind is named on a 'Video kind: <name>' line in the additional instructions: Blog post (a video that presents the blog post named on the 'Video target:' line — a post path in this repository or a URL; read it and tell its real content) or Feature (a video about the feature named on the 'Video target:' line, found in the repository); with no Video kind line, make a Project demo of the whole project's main goals and key features. Ground everything in what you read in the repository (and the target) — invent an original mascot character whose look, name and personality match the subject's theme and purpose, and tell its real story through it. Write the narration script first (hook, problem, solution, key points, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits. Narrate with Kokoro (kokoro-onnx) using a natural female (af_heart) or male (am_michael) voice per the audio policy in the persona. Save it with a single project_video_write call passing the htmlPath and the id on the 'Entry id' line.",
|
|
67
69
|
"Generate a character and cute animated JavaScript video as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise; a 'Video length: 30' line means 30 seconds. The video kind is named on a 'Video kind: <name>' line in the additional instructions: Blog post (a video that presents the blog post named on the 'Video target:' line — a post path in this repository or a URL; read it and tell its real content) or Feature (a video about the feature named on the 'Video target:' line, found in the repository); with no Video kind line, make a Project demo of the whole project's main goals and key features. A 'Video kind: Project demo' line means that same whole-project demo. Ground everything in what you read in the repository (and the target) — invent an original mascot character whose look, name and personality match the subject's theme and purpose, and tell its real story through it. A 'Character: off' line means no mascot: make a type-led animation in the chosen style that tells the same real story through moving type and shapes, skip the character wherever the persona uses one (design, _character, project_character_write, lip-sync, the character self-check) and save meta.character as null; a 'Character: on' line or no Character line keeps the mascot. Write the narration script first (hook, problem, solution, key points, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits. A 'Video style: Auto' line means the same: pick the style that best fits. Narrate with Kokoro (kokoro-onnx) using a natural female (af_heart) or male (am_michael) voice per the audio policy in the persona. Save it with a single project_video_write call passing the htmlPath and the id on the 'Entry id' line.",
|
|
68
70
|
"Generate a cute animated JavaScript video with an original mascot character unless a Character: off line says otherwise, as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise; a 'Video length: 30' line means 30 seconds. The video kind is named on a 'Video kind: <name>' line in the additional instructions: Blog post (a video that presents the blog post named on the 'Video target:' line — a post path in this repository or a URL; read it and tell its real content) or Feature (a video about the feature named on the 'Video target:' line, found in the repository); with no Video kind line, make a Project demo of the whole project's main goals and key features. A 'Video kind: Project demo' line means that same whole-project demo. Ground everything in what you read in the repository (and the target) — invent an original mascot character whose look, name and personality match the subject's theme and purpose, and tell its real story through it. A 'Character: off' line means no mascot: make a type-led animation in the chosen style that tells the same real story through moving type and shapes, skip the character wherever the persona uses one (design, _character, project_character_write, lip-sync, the character self-check) and save meta.character as null; a 'Character: on' line or no Character line keeps the mascot. Write the narration script first (hook, problem, solution, key points, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits. A 'Video style: Auto' line means the same: pick the style that best fits. Narrate with Kokoro (kokoro-onnx) using a natural female (af_heart) or male (am_michael) voice per the audio policy in the persona. Save it with a single project_video_write call passing the htmlPath and the id on the 'Entry id' line.",
|
|
71
|
+
"Generate a cute animated JavaScript video with an original mascot character unless a Character: off line says otherwise, as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise; a 'Video length: 30' line means 30 seconds. The video kind is named on a 'Video kind: <name>' line in the additional instructions: Blog post (a video that presents the blog post named on the 'Video target:' line — a post path in this repository or a URL; read it and tell its real content) or Feature (a video about the feature named on the 'Video target:' line, found in the repository); with no Video kind line, make a Project demo of the whole project's main goals and key features. A 'Video kind: Project demo' line means that same whole-project demo. A Blog post or Feature kind with no 'Video target:' line, or with a target you cannot find in the repository or read at its URL, also means that same whole-project demo: never pick a post or feature yourself, say so in your report, and save the kind as project-demo. When the target makes claims about how this project works, check each one against the code: drop a claim the code contradicts or attribute it to the post, and never narrate it as fact about the project. Ground everything in what you read in the repository (and the target) — invent an original mascot character whose look, name and personality match the subject's theme and purpose, and tell its real story through it. A 'Character: off' line means no mascot: make a type-led animation in the chosen style that tells the same real story through moving type and shapes, skip the character wherever the persona uses one (design, _character, project_character_write, lip-sync, the character self-check) and save meta.character as null; a 'Character: on' line or no Character line keeps the mascot. Write the narration script first (hook, problem, solution, key points, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits. A 'Video style: Auto' line means the same: pick the style that best fits. Narrate with Kokoro (kokoro-onnx) using a natural female (af_heart) or male (am_michael) voice per the audio policy in the persona. Save it with a single project_video_write call passing the htmlPath and the id on the 'Entry id' line.",
|
|
72
|
+
"Generate a cute animated JavaScript video with an original mascot character unless a Character: off line says otherwise, as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise; a 'Video length: 30' line means 30 seconds. The video kind is named on a 'Video kind: <name>' line in the additional instructions: Blog post (a video that presents the blog post named on the 'Video target:' line — a post path in this repository or a URL; read it and tell its real content) or Feature (a video about the feature named on the 'Video target:' line, found in the repository); with no Video kind line, make a Project demo of the whole project's main goals and key features; a 'Video kind: TikTok' line means a vertical 9:16 short for this project's own audience, made by following the kit's kind-tiktok.md playbook and saved as kind tiktok with its MP4, poster and post caption, and a 'Video kind: Marketing' line means a 16:9 landing-page video made by following the kit's kind-marketing.md playbook and saved as kind marketing with its MP4 and poster; a TikTok or Marketing video with no target is about the whole project and never falls back to a Project demo. A 'Video kind: Project demo' line means that same whole-project demo. A Blog post or Feature kind with no 'Video target:' line, or with a target you cannot find in the repository or read at its URL, also means that same whole-project demo: never pick a post or feature yourself, say so in your report, and save the kind as project-demo. When the target makes claims about how this project works, check each one against the code: drop a claim the code contradicts or attribute it to the post, and never narrate it as fact about the project. Ground everything in what you read in the repository (and the target) — invent an original mascot character whose look, name and personality match the subject's theme and purpose, and tell its real story through it. A 'Character: off' line means no mascot: make a type-led animation in the chosen style that tells the same real story through moving type and shapes, skip the character wherever the persona uses one (design, _character, project_character_write, lip-sync, the character self-check) and save meta.character as null; a 'Character: on' line or no Character line keeps the mascot. Write the narration script first (hook, problem, solution, key points, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits. A 'Video style: Auto' line means the same: pick the style that best fits. When the project has a saved persona in videos/_character, it hosts the video and narration uses the saved project persona's voice: a command voice speaks every line with no fallback, and a failure fails the run, and a Kokoro persona voice uses its own voice id. Narrate with Kokoro (kokoro-onnx) using a natural female (af_heart) or male (am_michael) voice per the audio policy in the persona only when there is no saved persona. Save it with a single project_video_write call passing the htmlPath and the id on the 'Entry id' line.",
|
|
73
|
+
"Generate a cute animated JavaScript video with an original mascot character unless a Character: off line says otherwise, as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise; a 'Video length: 30' line means 30 seconds. The video kind is named on a 'Video kind: <name>' line in the additional instructions: Blog post (a video that presents the blog post named on the 'Video target:' line — a post path in this repository or a URL; read it and tell its real content) or Feature (a video about the feature named on the 'Video target:' line, found in the repository); with no Video kind line, make a Project demo of the whole project's main goals and key features; a 'Video kind: TikTok' line means a vertical 9:16 short for this project's own audience, made by following the kit's kind-tiktok.md playbook and saved as kind tiktok with its MP4, poster and post caption, and a 'Video kind: Marketing' line means a 16:9 landing-page video made by following the kit's kind-marketing.md playbook and saved as kind marketing with its MP4 and poster; a TikTok or Marketing video with no target is about the whole project and never falls back to a Project demo. A 'Video kind: Project demo' line means that same whole-project demo. A Blog post or Feature kind with no 'Video target:' line, or with a target you cannot find in the repository or read at its URL, also means that same whole-project demo: never pick a post or feature yourself, say so in your report, and save the kind as project-demo. When the target makes claims about how this project works, check each one against the code: drop a claim the code contradicts or attribute it to the post, and never narrate it as fact about the project. Ground everything in what you read in the repository (and the target) — invent an original mascot character whose look, name and personality match the subject's theme and purpose, and tell its real story through it. A 'Character: off' line means no mascot: make a type-led animation in the chosen style that tells the same real story through moving type and shapes, skip the character wherever the persona uses one (design, _character, project_character_write, lip-sync, the character self-check) and save meta.character as null; a 'Character: on' line or no Character line keeps the mascot. Write the narration script first (hook, problem, solution, key points, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits. A 'Video style: Auto' line means the same: pick the style that best fits. When the project has a saved persona in videos/_character, it hosts the video and narration uses the saved project persona's voice: a command voice speaks every line with no fallback, and a failure fails the run, and a Kokoro persona voice uses its own voice id. When the saved persona has a cast, every line is spoken in its own speaker's voice, the host's or that cast member's, with the same no-fallback rule, and a cast member with no voice never speaks. Narrate with Kokoro (kokoro-onnx) using a natural female (af_heart) or male (am_michael) voice per the audio policy in the persona only when there is no saved persona. Save it with a single project_video_write call passing the htmlPath and the id on the 'Entry id' line.",
|
|
69
74
|
]),
|
|
70
75
|
prompt:
|
|
71
|
-
"Generate a cute animated JavaScript video with an original mascot character unless a Character: off line says otherwise, as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise; a 'Video length: 30' line means 30 seconds. The video kind is named on a 'Video kind: <name>' line in the additional instructions: Blog post (a video that presents the blog post named on the 'Video target:' line — a post path in this repository or a URL; read it and tell its real content) or Feature (a video about the feature named on the 'Video target:' line, found in the repository); with no Video kind line, make a Project demo of the whole project's main goals and key features. A 'Video kind: Project demo' line means that same whole-project demo. A Blog post or Feature kind with no 'Video target:' line, or with a target you cannot find in the repository or read at its URL, also means that same whole-project demo: never pick a post or feature yourself, say so in your report, and save the kind as project-demo. When the target makes claims about how this project works, check each one against the code: drop a claim the code contradicts or attribute it to the post, and never narrate it as fact about the project. Ground everything in what you read in the repository (and the target) — invent an original mascot character whose look, name and personality match the subject's theme and purpose, and tell its real story through it. A 'Character: off' line means no mascot: make a type-led animation in the chosen style that tells the same real story through moving type and shapes, skip the character wherever the persona uses one (design, _character, project_character_write, lip-sync, the character self-check) and save meta.character as null; a 'Character: on' line or no Character line keeps the mascot. Write the narration script first (hook, problem, solution, key points, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits. A 'Video style: Auto' line means the same: pick the style that best fits.
|
|
76
|
+
"Generate a cute animated JavaScript video with an original mascot character unless a Character: off line says otherwise, as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise; a 'Video length: 30' line means 30 seconds. The video kind is named on a 'Video kind: <name>' line in the additional instructions: Blog post (a video that presents the blog post named on the 'Video target:' line — a post path in this repository or a URL; read it and tell its real content) or Feature (a video about the feature named on the 'Video target:' line, found in the repository); with no Video kind line, make a Project demo of the whole project's main goals and key features; a 'Video kind: TikTok' line means a vertical 9:16 short for this project's own audience, made by following the kit's kind-tiktok.md playbook and saved as kind tiktok with its MP4, poster and post caption, and a 'Video kind: Marketing' line means a 16:9 landing-page video made by following the kit's kind-marketing.md playbook and saved as kind marketing with its MP4 and poster; a TikTok or Marketing video with no target is about the whole project and never falls back to a Project demo. A 'Video kind: Project demo' line means that same whole-project demo. A Blog post or Feature kind with no 'Video target:' line, or with a target you cannot find in the repository or read at its URL, also means that same whole-project demo: never pick a post or feature yourself, say so in your report, and save the kind as project-demo. When the target makes claims about how this project works, check each one against the code: drop a claim the code contradicts or attribute it to the post, and never narrate it as fact about the project. Ground everything in what you read in the repository (and the target) — invent an original mascot character whose look, name and personality match the subject's theme and purpose, and tell its real story through it. A 'Character: off' line means no mascot: make a type-led animation in the chosen style that tells the same real story through moving type and shapes, skip the character wherever the persona uses one (design, _character, project_character_write, lip-sync, the character self-check) and save meta.character as null; a 'Character: on' line or no Character line keeps the mascot. Write the narration script first (hook, problem, solution, key points, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits. A 'Video style: Auto' line means the same: pick the style that best fits. When the project has a saved persona in videos/_character, it hosts the video and narration uses the saved project persona's voice: a command voice speaks every line with no fallback, and a failure fails the run, and a Kokoro persona voice uses its own voice id. When the saved persona has a cast, every line is spoken in its own speaker's voice, the host's or that cast member's, with the same no-fallback rule, and a cast member with no voice never speaks. Speak every narration line through the kit with node <kit>/character.cjs speak spec.json, never a hand-written TTS script: a 'Voice: <id>' line in the additional instructions picks the voice first (as spec.voice), then the saved persona's voice, then, only when there is no saved persona, the kit default natural female (af_heart) or male (am_michael) voice per the audio policy in the persona. Save it with a single project_video_write call passing the htmlPath and the id on the 'Entry id' line.",
|
|
72
77
|
}),
|
|
73
78
|
Object.freeze({
|
|
74
79
|
id: 'builtin-review-md-network',
|
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
* A project's own Video tool (library macro, surface 'project-video', projects
|
|
10
10
|
* [cwd], with a job) dispatches the same way: artifact-only, or a committing PRD
|
|
11
11
|
* when job.repoPaths is set, with an optional review stage when job.review is set.
|
|
12
|
+
* A built-in whose job.reviewable is true (Demo Video) runs that same review
|
|
13
|
+
* stage when the press passes reviewStage: true or a review decision.
|
|
14
|
+
* A project Video tool's job gets voiceId = the press's voiceId, else the tool's
|
|
15
|
+
* default voiceId, else nothing; handed to createPrd as `voiceId` (PRD
|
|
16
|
+
* frontmatter, which the scheduler exports as SM_VOICE_ID) and named in the
|
|
17
|
+
* job's implementation notes as a 'Voice: <id>' line.
|
|
12
18
|
*
|
|
13
19
|
* Plain Node, no Electron imports; all I/O is injected.
|
|
14
20
|
*/
|
|
@@ -18,14 +24,22 @@ const { BUILTIN_MACROS } = require('./builtinMacros.cjs');
|
|
|
18
24
|
const { kebabCase } = require('../util/kebabCase.cjs');
|
|
19
25
|
const { PRD_EFFORT_LEVELS } = require('../prd/prdFrontmatter.cjs');
|
|
20
26
|
const { renderMacroPrompt } = require('./macroLibrary.cjs');
|
|
27
|
+
const { VOICE_ID_RE } = require('../demo-video-kit/voiceLibrary.cjs');
|
|
21
28
|
|
|
22
29
|
const ACTIVE = new Set(['pending', 'held', 'running']);
|
|
23
30
|
const RETRYABLE = new Set(['needs_review', 'failed']);
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
// One path keeps the original single-stat script. Alternatives (Demo Video:
|
|
33
|
+
// the stage artifact OR outcome.json) pass when ANY is fresh (size > 0,
|
|
34
|
+
// mtime after dispatch); a missing alternative counts as not fresh.
|
|
35
|
+
function buildGate(absPaths, nowMs) {
|
|
36
|
+
const list = Array.isArray(absPaths) ? absPaths : [absPaths];
|
|
26
37
|
// No shell: everything with shell characters sits inside single quotes, so
|
|
27
|
-
// the script itself uses double quotes only (JSON.stringify)
|
|
28
|
-
|
|
38
|
+
// the script itself uses double quotes only (JSON.stringify) and never a
|
|
39
|
+
// single quote.
|
|
40
|
+
const script = list.length === 1
|
|
41
|
+
? `const s=require("fs").statSync(${JSON.stringify(list[0])});process.exit(s.size>0&&s.mtimeMs>${nowMs}?0:1)`
|
|
42
|
+
: `const f=require("fs");process.exit(${JSON.stringify(list)}.some((p)=>{try{const s=f.statSync(p);return s.size>0&&s.mtimeMs>${nowMs}}catch{return false}})?0:1)`;
|
|
29
43
|
return `timeout 60 node -e '${script}'`;
|
|
30
44
|
}
|
|
31
45
|
|
|
@@ -62,6 +76,10 @@ function rawEntryIdFor(kind, extra, t) {
|
|
|
62
76
|
const VIDEO_INDEX_REL = 'session-manager-operations/project-pages/videos/{id}/index.html';
|
|
63
77
|
// Same string as video-review-store's REVIEW_MATERIAL_REL (asserted by the IPC wiring test).
|
|
64
78
|
const REVIEW_MATERIAL_REL = 'session-manager-operations/project-pages/videos/{id}/review/material.json';
|
|
79
|
+
// Written by project_video_outcome_write (projectHomeAdminRoutes.cjs): a run that
|
|
80
|
+
// ends with a saved outcome (season-complete) and no video on purpose.
|
|
81
|
+
const OUTCOME_REL = 'session-manager-operations/project-pages/videos/{id}/outcome.json';
|
|
82
|
+
const OUTCOME_MACRO_ID = 'builtin-demo-video';
|
|
65
83
|
|
|
66
84
|
const oneLine = (v) => String(v).replace(/[\r\n]+/g, ' ').trim();
|
|
67
85
|
|
|
@@ -91,8 +109,19 @@ function resolveProjectTool(macros, macroId, cwd) {
|
|
|
91
109
|
return m;
|
|
92
110
|
}
|
|
93
111
|
|
|
112
|
+
// Review stage: a project tool with job.review always reviews first; a built-in
|
|
113
|
+
// with job.reviewable reviews only when the press opts in (reviewStage === true)
|
|
114
|
+
// or a 'changes' decision sends it back. An approved review is the final build.
|
|
115
|
+
function stageFor(tool, builtin, review, reviewStage) {
|
|
116
|
+
const decision = review && typeof review === 'object' ? review.decision : undefined;
|
|
117
|
+
if (tool) return tool.job.review ? (decision === 'approved' ? 'final' : 'review') : null;
|
|
118
|
+
if (!builtin || builtin.job.reviewable !== true) return null;
|
|
119
|
+
if (decision === 'approved') return 'final';
|
|
120
|
+
return reviewStage === true || decision === 'changes' ? 'review' : null;
|
|
121
|
+
}
|
|
122
|
+
|
|
94
123
|
async function dispatchMacroJob(
|
|
95
|
-
{ cwd, macroId, epicId, extraInstructions, effort, inputValues, review } = {},
|
|
124
|
+
{ cwd, macroId, epicId, extraInstructions, effort, inputValues, review, reviewStage, voiceId } = {},
|
|
96
125
|
{ createPrd, listRows, archivePrd, builtins = BUILTIN_MACROS, macros = [], now = Date.now } = {},
|
|
97
126
|
) {
|
|
98
127
|
const builtin = (builtins || []).find((m) => m && m.id === macroId);
|
|
@@ -101,6 +130,9 @@ async function dispatchMacroJob(
|
|
|
101
130
|
if (!macro || !macro.job) return { ok: false, error: `macro ${macroId} has no background job declaration` };
|
|
102
131
|
if (typeof epicId !== 'string' || !epicId.trim()) return { ok: false, error: 'epicId is required — a background build joins an existing Epic' };
|
|
103
132
|
if (typeof cwd !== 'string' || !cwd) return { ok: false, error: 'cwd is required' };
|
|
133
|
+
if (voiceId != null && (typeof voiceId !== 'string' || !VOICE_ID_RE.test(voiceId))) {
|
|
134
|
+
return { ok: false, error: `voiceId must match /${VOICE_ID_RE.source}/ when given` };
|
|
135
|
+
}
|
|
104
136
|
if (typeof createPrd !== 'function') return { ok: false, error: 'createPrd is not available' };
|
|
105
137
|
|
|
106
138
|
let prompt = macro.prompt;
|
|
@@ -115,13 +147,16 @@ async function dispatchMacroJob(
|
|
|
115
147
|
const extra = [stripReviewLines(typeof extraInstructions === 'string' ? extraInstructions : ''), rLine].filter(Boolean).join('\n');
|
|
116
148
|
const entryKind = tool ? 'video' : macro.job.entryKind;
|
|
117
149
|
const entryId = entryKind ? entryIdFor(entryKind, extra, t) : null;
|
|
118
|
-
const stage = tool
|
|
150
|
+
const stage = stageFor(tool, builtin, review, reviewStage);
|
|
119
151
|
const repoPaths = tool && Array.isArray(tool.job.repoPaths) && tool.job.repoPaths.length ? tool.job.repoPaths.slice() : null;
|
|
120
|
-
const artifactPaths = tool
|
|
152
|
+
const artifactPaths = tool || stage === 'review'
|
|
121
153
|
? [(stage === 'review' ? REVIEW_MATERIAL_REL : VIDEO_INDEX_REL).split('{id}').join(entryId)]
|
|
122
154
|
: macro.job.artifactPaths.map((p) => (entryId ? p.split('{id}').join(entryId) : p));
|
|
123
155
|
const absPaths = artifactPaths.map((p) => path.join(cwd, p));
|
|
124
|
-
|
|
156
|
+
// Built-in Demo Video only: a saved outcome is an alternative pass for every gate.
|
|
157
|
+
const outcomeRel = builtin && macroId === OUTCOME_MACRO_ID && entryId ? OUTCOME_REL.split('{id}').join(entryId) : null;
|
|
158
|
+
const outcomeAbs = outcomeRel ? path.join(cwd, outcomeRel) : null;
|
|
159
|
+
for (const s of [cwd, ...absPaths, ...(outcomeAbs ? [outcomeAbs] : [])]) {
|
|
125
160
|
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)" };
|
|
126
161
|
}
|
|
127
162
|
|
|
@@ -161,7 +196,7 @@ async function dispatchMacroJob(
|
|
|
161
196
|
sourcePromptId: epicId,
|
|
162
197
|
disposition: 'new-head',
|
|
163
198
|
goal,
|
|
164
|
-
gate: absPaths.map((p) => buildGate(p, t)),
|
|
199
|
+
gate: absPaths.map((p) => buildGate(outcomeAbs ? [p, outcomeAbs] : [p], t)),
|
|
165
200
|
};
|
|
166
201
|
if (repoPaths) {
|
|
167
202
|
Object.assign(input, {
|
|
@@ -183,6 +218,7 @@ async function dispatchMacroJob(
|
|
|
183
218
|
acceptanceCriteria: [
|
|
184
219
|
`${artifactPaths[0]} is written during this run by ${saveTool}, never by hand.`,
|
|
185
220
|
'Nothing in the repository is committed. No commit is the expected result: once the gate is green, end with SCHEDULER_VERDICT: PASS, never FAIL for the missing commit.',
|
|
221
|
+
...(outcomeRel ? [`A saved outcome is a passing result with no video: when a kind playbook says to stop with an outcome, ${outcomeRel} written during this run by project_video_outcome_write passes the gate in place of ${artifactPaths[0]}; save no video or review material and end with SCHEDULER_VERDICT: PASS.`] : []),
|
|
186
222
|
],
|
|
187
223
|
implementationNotes:
|
|
188
224
|
`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. `
|
|
@@ -191,6 +227,14 @@ async function dispatchMacroJob(
|
|
|
191
227
|
});
|
|
192
228
|
}
|
|
193
229
|
if (typeof effort === 'string' && PRD_EFFORT_LEVELS.includes(effort)) input.effort = effort;
|
|
230
|
+
// Press pick beats the tool default; only a project Video tool's job carries a voice.
|
|
231
|
+
const jobVoiceId = tool
|
|
232
|
+
? (voiceId || (typeof tool.voiceId === 'string' && VOICE_ID_RE.test(tool.voiceId) ? tool.voiceId : null))
|
|
233
|
+
: null;
|
|
234
|
+
if (jobVoiceId) {
|
|
235
|
+
input.voiceId = jobVoiceId;
|
|
236
|
+
input.implementationNotes += ` Voice: ${jobVoiceId} (also in SM_VOICE_ID): speak every narration line with this library voice.`;
|
|
237
|
+
}
|
|
194
238
|
|
|
195
239
|
let res;
|
|
196
240
|
try {
|
|
@@ -13,9 +13,12 @@
|
|
|
13
13
|
* checkProjectVideoToolRunnable? (default projectVideoToolCheck.cjs) }
|
|
14
14
|
*
|
|
15
15
|
* runToolJob is the one dispatch path: macros:dispatch-job calls it without a
|
|
16
|
-
* review decision
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* review decision (but with the press's reviewStage opt-in); the
|
|
17
|
+
* review-decision IPC calls it with one. After an ok dispatch of a project
|
|
18
|
+
* Video tool — or of builtin-demo-video when the result has a stage ('review'
|
|
19
|
+
* or 'final') — it records the entry's review dispatch (dispatch.json), so the
|
|
20
|
+
* review card, Approve, Ask for changes and Retry can re-dispatch it. A plain
|
|
21
|
+
* Demo Video press (stage null) records nothing.
|
|
19
22
|
* Before dispatching a library 'project-video' tool with a job it runs
|
|
20
23
|
* checkProjectVideoToolRunnable; a refusal returns { ok: false, error } with
|
|
21
24
|
* no PRD written and the job-not-queued notice. Built-ins are never checked.
|
|
@@ -36,6 +39,8 @@ const { BUILTIN_MACROS } = require('./builtinMacros.cjs');
|
|
|
36
39
|
const macroLibrary = require('./macroLibrary.cjs');
|
|
37
40
|
|
|
38
41
|
const JOB_NOT_QUEUED_NOTICE = 'job-not-queued';
|
|
42
|
+
/** The one built-in whose review-stage runs are recorded for the review card. */
|
|
43
|
+
const DEMO_VIDEO_ID = 'builtin-demo-video';
|
|
39
44
|
|
|
40
45
|
function noticeText(label, error) {
|
|
41
46
|
return `${label} background build was not queued: ${error} — press it again in Project Home ▸ Tools to retry.`;
|
|
@@ -74,10 +79,10 @@ async function listLibraryMacros(deps) {
|
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
/**
|
|
77
|
-
* runToolJob(deps, { cwd, macroId, epicId, extraInstructions, inputValues, effort, review })
|
|
82
|
+
* runToolJob(deps, { cwd, macroId, epicId, extraInstructions, inputValues, effort, review, reviewStage, voiceId })
|
|
78
83
|
* `cwd` must already be validated. Returns dispatchMacroJob's result.
|
|
79
84
|
*/
|
|
80
|
-
async function runToolJob(deps = {}, { cwd, macroId, epicId, extraInstructions, inputValues, effort, review } = {}) {
|
|
85
|
+
async function runToolJob(deps = {}, { cwd, macroId, epicId, extraInstructions, inputValues, effort, review, reviewStage, voiceId } = {}) {
|
|
81
86
|
const dispatch = deps.dispatchMacroJob || realDispatch;
|
|
82
87
|
const index = deps.readActiveIndex(cwd);
|
|
83
88
|
const sessions = index && index.sessions ? index.sessions : {};
|
|
@@ -101,6 +106,8 @@ async function runToolJob(deps = {}, { cwd, macroId, epicId, extraInstructions,
|
|
|
101
106
|
const args = { cwd, macroId, epicId, extraInstructions, effort };
|
|
102
107
|
if (inputValues !== undefined) args.inputValues = inputValues;
|
|
103
108
|
if (review !== undefined) args.review = review;
|
|
109
|
+
if (reviewStage !== undefined) args.reviewStage = reviewStage;
|
|
110
|
+
if (voiceId !== undefined) args.voiceId = voiceId;
|
|
104
111
|
const dispatchDeps = {
|
|
105
112
|
createPrd: deps.createPrd,
|
|
106
113
|
listRows: async () => deps.loadJobs(),
|
|
@@ -119,7 +126,8 @@ async function runToolJob(deps = {}, { cwd, macroId, epicId, extraInstructions,
|
|
|
119
126
|
if (result && result.ok === true && result.entryId) {
|
|
120
127
|
const isBuiltin = !!findById(deps.builtins || BUILTIN_MACROS, macroId);
|
|
121
128
|
const tool = isBuiltin ? null : findById(macros, macroId);
|
|
122
|
-
|
|
129
|
+
const reviewedBuiltin = isBuiltin && macroId === DEMO_VIDEO_ID && (result.stage === 'review' || result.stage === 'final');
|
|
130
|
+
if (reviewedBuiltin || (tool && !tool.builtin && macroLibrary.isProjectVideoTool(tool, cwd))) {
|
|
123
131
|
await recordToolDispatch(deps, cwd, result, { macroId, epicId, inputValues, extraInstructions });
|
|
124
132
|
}
|
|
125
133
|
}
|
|
@@ -170,6 +178,8 @@ function registerMacroJobIpc(ipcMain, deps = {}) {
|
|
|
170
178
|
extraInstructions: payload.extraInstructions,
|
|
171
179
|
inputValues: payload.inputValues,
|
|
172
180
|
effort: payload.effort,
|
|
181
|
+
reviewStage: payload.reviewStage,
|
|
182
|
+
voiceId: payload.voiceId,
|
|
173
183
|
});
|
|
174
184
|
});
|
|
175
185
|
|