@litfamily/litclaude 1.0.37 → 1.0.38
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/CHANGELOG.md +45 -0
- package/README.md +11 -8
- package/README_ko-KR.md +11 -8
- package/bin/litclaude-ai.js +3 -3
- package/docs/assets/readme/badge-version.svg +1 -1
- package/docs/assets/skills/lit-adhd.webp +0 -0
- package/docs/assets/skills/lit-hijack.webp +0 -0
- package/docs/assets/skills/lit-schematic.webp +0 -0
- package/docs/hooks.md +112 -26
- package/docs/workflow-compatibility-audit.md +1 -1
- package/package.json +1 -1
- package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
- package/plugins/litclaude/agents/lit-executor.md +4 -2
- package/plugins/litclaude/bin/litclaude-ai +1 -0
- package/plugins/litclaude/bin/litclaude-hook.js +349 -47
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/commands/lit-adhd.md +103 -0
- package/plugins/litclaude/commands/lit-hijack.md +102 -0
- package/plugins/litclaude/commands/lit-loop.md +4 -2
- package/plugins/litclaude/commands/lit-plan.md +5 -4
- package/plugins/litclaude/commands/lit-rewind.md +103 -0
- package/plugins/litclaude/commands/litgoal.md +5 -4
- package/plugins/litclaude/commands/start-work.md +25 -10
- package/plugins/litclaude/hooks/lit-mod.mjs +51 -5
- package/plugins/litclaude/lib/canonical-skill-catalog.mjs +3 -0
- package/plugins/litclaude/lib/canonical-skill-resources.mjs +199 -96
- package/plugins/litclaude/lib/lit-activation.mjs +24 -10
- package/plugins/litclaude/lib/mod/frame.mjs +158 -39
- package/plugins/litclaude/lib/mod/motion.mjs +21 -0
- package/plugins/litclaude/lib/mod/settings.mjs +4 -0
- package/plugins/litclaude/lib/mod/skills.mjs +3 -0
- package/plugins/litclaude/lib/mod/state.mjs +100 -7
- package/plugins/litclaude/lib/mod/svg-card.mjs +115 -15
- package/plugins/litclaude/lib/mod/timeline.mjs +24 -2
- package/plugins/litclaude/lib/mod/toasts.mjs +5 -2
- package/plugins/litclaude/lib/mod/view.mjs +199 -5
- package/plugins/litclaude/lib/mod/workflow.mjs +36 -7
- package/plugins/litclaude/lib/motion-render-gate.mjs +25 -7
- package/plugins/litclaude/lib/render_pages.py +29 -1
- package/plugins/litclaude/lib/rewind/collect.mjs +387 -0
- package/plugins/litclaude/lib/rewind/gauge.mjs +67 -0
- package/plugins/litclaude/lib/rewind/next-step.mjs +89 -0
- package/plugins/litclaude/lib/rewind/redact.mjs +36 -0
- package/plugins/litclaude/lib/rewind/transcripts.mjs +244 -0
- package/plugins/litclaude/lib/start-work-lifecycle.mjs +403 -18
- package/plugins/litclaude/lib/workflow-stack.mjs +243 -0
- package/plugins/litclaude/lib/workflow-stage.mjs +127 -103
- package/plugins/litclaude/scripts/scaffold-plan.mjs +1 -1
- package/plugins/litclaude/skills/frontend-ui-ux/SKILL.md +11 -3
- package/plugins/litclaude/skills/frontend-ui-ux/kit/components.css +414 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/fonts.json +22 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/ui.js +226 -0
- package/plugins/litclaude/skills/frontend-ui-ux/references/brand-and-imagery.md +1 -1
- package/plugins/litclaude/skills/frontend-ui-ux/references/complete-contract.md +1 -0
- package/plugins/litclaude/skills/frontend-ui-ux/references/craft-floor.md +9 -4
- package/plugins/litclaude/skills/frontend-ui-ux/references/default-editorial-pixel.json +6 -5
- package/plugins/litclaude/skills/frontend-ui-ux/references/house-styles.md +234 -0
- package/plugins/litclaude/skills/frontend-ui-ux/references/motion-guide.md +3 -3
- package/plugins/litclaude/skills/frontend-ui-ux/references/slop-register.md +7 -7
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-lock.mjs +196 -0
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-page.mjs +30 -9
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-rules.mjs +19 -7
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-static.mjs +12 -2
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe.mjs +53 -6
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
- package/plugins/litclaude/skills/lit-adhd/SKILL.md +151 -0
- package/plugins/litclaude/skills/lit-adhd/references/card-examples.md +69 -0
- package/plugins/litclaude/skills/lit-adhd/references/status-taxonomy.md +43 -0
- package/plugins/litclaude/skills/lit-adhd/scripts/rewind.mjs +11 -0
- package/plugins/litclaude/skills/lit-diagram-drawer/SKILL.md +5 -4
- package/plugins/litclaude/skills/lit-diagram-drawer/references/style-guide.md +20 -11
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-tree.md +3 -3
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
- package/plugins/litclaude/skills/lit-diagram-drawer/references/verifier-guide.md +1 -1
- package/plugins/litclaude/skills/lit-diagram-drawer/scripts/visual-quality.mjs +3 -3
- package/plugins/litclaude/skills/lit-handoff/SKILL.md +1 -1
- package/plugins/litclaude/skills/lit-hijack/SKILL.md +551 -0
- package/plugins/litclaude/skills/lit-hijack/references/capture-and-provenance.md +124 -0
- package/plugins/litclaude/skills/lit-hijack/references/clean-room-build.md +133 -0
- package/plugins/litclaude/skills/lit-hijack/references/distil-and-licence.md +128 -0
- package/plugins/litclaude/skills/lit-hijack/references/gap-and-port-design.md +152 -0
- package/plugins/litclaude/skills/lit-hijack/references/parity-and-report.md +131 -0
- package/plugins/litclaude/skills/lit-hijack/scripts/hijack.mjs +854 -0
- package/plugins/litclaude/skills/lit-loop/SKILL.md +4 -3
- package/plugins/litclaude/skills/lit-plan/SKILL.md +16 -10
- package/plugins/litclaude/skills/lit-pptx/SKILL.md +29 -14
- package/plugins/litclaude/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
- package/plugins/litclaude/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
- package/plugins/litclaude/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
- package/plugins/litclaude/skills/lit-pptx/fonts/provenance.json +32 -1
- package/plugins/litclaude/skills/lit-pptx/references/agents/architect.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/anti-slop-checklist.md +32 -11
- package/plugins/litclaude/skills/lit-pptx/references/authoring-guide.md +2 -2
- package/plugins/litclaude/skills/lit-pptx/references/data-display-cookbook.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/density-and-fill.md +3 -4
- package/plugins/litclaude/skills/lit-pptx/references/direction-step.md +19 -2
- package/plugins/litclaude/skills/lit-pptx/references/examples/13-engineering-review-computational-brutalism-ko.md +173 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/14-launch-pitch-neo-brutalism-ko.md +154 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/15-design-lecture-bauhaus-ko.md +139 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/16-community-programme-riso-ko.md +158 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/17-public-data-briefing-newsroom-ko.md +179 -0
- package/plugins/litclaude/skills/lit-pptx/references/layout-families.md +22 -26
- package/plugins/litclaude/skills/lit-pptx/references/title-treatments.md +30 -26
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/atlas.md +4 -4
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/bauhaus.md +140 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/chalk.md +3 -3
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/computational-brutalism.md +150 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/gazette.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/ledger.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/neo-brutalism.md +161 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/newsroom.md +144 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/night.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/paper.md +3 -3
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/riso.md +137 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/signal.md +2 -2
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/studio.md +6 -7
- package/plugins/litclaude/skills/lit-pptx/scripts/compile-deck.js +1 -1
- package/plugins/litclaude/skills/lit-pptx/scripts/craft_extras.py +135 -91
- package/plugins/litclaude/skills/lit-pptx/scripts/embed_fonts.py +13 -1
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/render-pack.js +370 -563
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
- package/plugins/litclaude/skills/lit-pptx/scripts/qa_deck.py +5 -5
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +99 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-recap/SKILL.md +3 -0
- package/plugins/litclaude/skills/lit-schematic/SKILL.md +112 -0
- package/plugins/litclaude/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
- package/plugins/litclaude/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
- package/plugins/litclaude/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
- package/plugins/litclaude/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
- package/plugins/litclaude/skills/lit-schematic/references/cutaway-outputs.md +70 -0
- package/plugins/litclaude/skills/lit-schematic/references/isometric-craft.md +101 -0
- package/plugins/litclaude/skills/lit-schematic/references/journal-figures.md +72 -0
- package/plugins/litclaude/skills/lit-schematic/references/kit-api.md +134 -0
- package/plugins/litclaude/skills/lit-schematic/references/pfd-and-layout.md +53 -0
- package/plugins/litclaude/skills/lit-schematic/references/pid-drafting.md +103 -0
- package/plugins/litclaude/skills/lit-schematic/references/pid-symbols.md +163 -0
- package/plugins/litclaude/skills/lit-schematic/references/verification.md +100 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/doctor.mjs +57 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/fonts.mjs +27 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/png.mjs +132 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/route.mjs +218 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/motion.mjs +129 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/qa.mjs +92 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/render.mjs +233 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/scaffold.mjs +60 -0
- package/plugins/litclaude/skills/lit-scientific-visualization/SKILL.md +14 -4
- package/plugins/litclaude/skills/lit-typographic-motion/SKILL.md +50 -45
- package/plugins/litclaude/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +11 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/blender/runner.py +218 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/core/presets.mjs +1 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/analysis.mjs +65 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/assets.mjs +208 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/blender.mjs +143 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/board.mjs +136 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/brief.mjs +7 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/chrome.mjs +6 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover-assets.mjs +5 -3
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover-capture.mjs +4 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover-treatment.mjs +37 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover.mjs +17 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/done.mjs +42 -3
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/frame-worker.mjs +7 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/gallery.mjs +121 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/house.mjs +44 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/look.mjs +33 -19
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/pipeline.mjs +18 -7
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/scaffold.mjs +210 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/score.mjs +639 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/sound-cli.mjs +21 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/sound.mjs +126 -27
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-capture.mjs +7 -6
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-gate.mjs +59 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-qa.mjs +141 -9
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-serve.mjs +28 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage.mjs +82 -14
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/styles.mjs +213 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/treatment.mjs +311 -10
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/cover-init.js +14 -2
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/init.js +11 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/qa.js +6 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/stage-kit.js +83 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/hero-3d/expected.json +69 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/orbit-loop/expected.json +2 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/painted-light/expected.json +2 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/weight-tide/expected.json +2 -0
- package/plugins/litclaude/skills/lit-typographic-motion/references/cover.md +67 -15
- package/plugins/litclaude/skills/lit-typographic-motion/references/craft-loop.md +3 -2
- package/plugins/litclaude/skills/lit-typographic-motion/references/depth.md +122 -0
- package/plugins/litclaude/skills/lit-typographic-motion/references/look.md +28 -13
- package/plugins/litclaude/skills/lit-typographic-motion/references/runtime.md +4 -3
- package/plugins/litclaude/skills/lit-typographic-motion/references/sound.md +92 -23
- package/plugins/litclaude/skills/lit-typographic-motion/references/stage.md +43 -22
- package/plugins/litclaude/skills/lit-typographic-motion/references/studio.md +245 -0
- package/plugins/litclaude/skills/lit-typographic-motion/references/style-bibles.md +30 -6
- package/plugins/litclaude/skills/lit-typographic-motion/references/treatment.md +108 -14
- package/plugins/litclaude/skills/lit-typographic-motion/scripts/motion-doctor.mjs +16 -3
- package/plugins/litclaude/skills/lit-typographic-motion/scripts/motion.mjs +47 -7
- package/plugins/litclaude/skills/lit-typographic-motion/styles/paper.json +41 -0
- package/plugins/litclaude/skills/lit-typographic-motion/styles/swiss-signal.json +41 -0
- package/plugins/litclaude/skills/lit-typographic-motion/styles/terminalcore.json +42 -0
- package/plugins/litclaude/skills/lit-typographic-motion/styles/tidal.json +41 -0
- package/plugins/litclaude/skills/litgoal/SKILL.md +3 -2
- package/plugins/litclaude/skills/litresearch/SKILL.md +5 -0
- package/plugins/litclaude/skills/readme-studio/templates/hyperframes-cover/package-lock.json +3 -3
- package/plugins/litclaude/skills/readme-studio/templates/remotion-cover/package-lock.json +3 -3
- package/plugins/litclaude/skills/start-work/SKILL.md +24 -11
- package/scripts/qa-cover-recipes.mjs +3 -3
|
@@ -86,6 +86,187 @@ export const stalledLanes = (agents, activity, now, thresholdMs = STALL_MS) =>
|
|
|
86
86
|
|
|
87
87
|
export const laneName = (agent) => String(agent.name || agent.description || agent.type || "agent").slice(0, 40);
|
|
88
88
|
|
|
89
|
+
// The card shows at most this many threads; the rest are counted as `+N more`. A deep chain still
|
|
90
|
+
// leaves PARALLEL_ROWS for the lanes and tasks under it.
|
|
91
|
+
export const THREAD_ROWS = 4;
|
|
92
|
+
const PARALLEL_ROWS = 3;
|
|
93
|
+
// Another session of this project counts as live while its stack was written this recently.
|
|
94
|
+
export const OTHER_SESSION_MS = 15 * 60 * 1000;
|
|
95
|
+
|
|
96
|
+
const countOrNull = (value) => (Number.isInteger(value) && value >= 0 ? value : null);
|
|
97
|
+
|
|
98
|
+
// `lists` maps a loop (`main`, or a subagent's id) to what its tool calls say of its progress:
|
|
99
|
+
// `steps`, the tool calls it finished; `todos`, the counts of its last TodoWrite; `tasks`, the
|
|
100
|
+
// status of each task it created with TaskCreate (TaskUpdate moves them); `latest`, which of the two
|
|
101
|
+
// lists it touched last. Only statuses are kept, never a todo's or a task's text.
|
|
102
|
+
export const EMPTY_LISTS = Object.freeze({});
|
|
103
|
+
const LIST_CAP = 200;
|
|
104
|
+
const LOOP_CAP = 40;
|
|
105
|
+
const TASK_STATUS = new Set(["pending", "in_progress", "completed"]);
|
|
106
|
+
|
|
107
|
+
const loopEntry = (lists, loop) => lists[loop] ?? { steps: 0, todos: null, tasks: {}, latest: null };
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Folds one finished tool call of `loop` into `lists`: every call counts a step, a TodoWrite
|
|
111
|
+
* replaces the loop's todo counts, a TaskCreate adds its task and a TaskUpdate moves the task in
|
|
112
|
+
* whichever loop created it (or in this loop, marked unseen, when its creation was not seen).
|
|
113
|
+
*/
|
|
114
|
+
export const noteLoopCall = (lists, loop, call, result) => {
|
|
115
|
+
if (typeof loop !== "string" || !loop) return lists;
|
|
116
|
+
const next = { ...lists };
|
|
117
|
+
const entry = { ...loopEntry(lists, loop) };
|
|
118
|
+
entry.steps += 1;
|
|
119
|
+
if (call?.tool === "TodoWrite" && Array.isArray(call.todos)) {
|
|
120
|
+
const todos = call.todos.slice(0, LIST_CAP);
|
|
121
|
+
entry.todos = { done: todos.filter((todo) => todo?.status === "completed").length, total: todos.length };
|
|
122
|
+
entry.latest = "todos";
|
|
123
|
+
} else if (call?.tool === "TaskCreate" && typeof result?.task?.id === "string") {
|
|
124
|
+
entry.tasks = { ...entry.tasks, [result.task.id.slice(0, 64)]: { status: "pending", seen: true } };
|
|
125
|
+
entry.latest = "tasks";
|
|
126
|
+
} else if (call?.tool === "TaskUpdate" && typeof call.taskId === "string" && (TASK_STATUS.has(call.status) || call.status === "deleted")) {
|
|
127
|
+
const id = call.taskId.slice(0, 64);
|
|
128
|
+
const owner = Object.keys(next).find((key) => key !== loop && next[key].tasks?.[id]);
|
|
129
|
+
const target = owner ? { ...next[owner] } : entry;
|
|
130
|
+
const tasks = { ...target.tasks };
|
|
131
|
+
if (call.status === "deleted") delete tasks[id];
|
|
132
|
+
else tasks[id] = { status: call.status, seen: tasks[id]?.seen ?? false };
|
|
133
|
+
target.tasks = Object.fromEntries(Object.entries(tasks).slice(-LIST_CAP));
|
|
134
|
+
target.latest = "tasks";
|
|
135
|
+
if (owner) next[owner] = target;
|
|
136
|
+
}
|
|
137
|
+
next[loop] = entry;
|
|
138
|
+
const loops = Object.keys(next);
|
|
139
|
+
return loops.length > LOOP_CAP ? Object.fromEntries(loops.slice(-LOOP_CAP).map((key) => [key, next[key]])) : next;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* A loop's `{ done, total }` from its list, or null when it keeps none. A task list whose
|
|
144
|
+
* creation was not all seen knows its done count but not its total.
|
|
145
|
+
*/
|
|
146
|
+
export const listProgress = (entry) => {
|
|
147
|
+
if (!entry) return null;
|
|
148
|
+
const tasks = Object.values(entry.tasks ?? {});
|
|
149
|
+
const fromTasks = tasks.length ? { done: tasks.filter(({ status }) => status === "completed").length, total: tasks.every(({ seen }) => seen) ? tasks.length : null } : null;
|
|
150
|
+
if (entry.latest === "tasks" && fromTasks) return fromTasks;
|
|
151
|
+
return entry.todos ?? fromTasks;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// `tasks` maps a background task's id to `{ id, kind, name, at, until }`: a shell a Bash call left
|
|
155
|
+
// running (its own `backgroundTaskId`) or a monitor, named by the call's description, never its
|
|
156
|
+
// command. `until` is a monitor's deadline. A task ends with its notification, a TaskStop, its
|
|
157
|
+
// deadline, or after TASK_STALE_MS when no ending was ever seen.
|
|
158
|
+
export const EMPTY_TASKS = Object.freeze({});
|
|
159
|
+
export const TASK_STALE_MS = 12 * 60 * 60 * 1000;
|
|
160
|
+
const TASK_CAP = 12;
|
|
161
|
+
const TASK_ID = /^[A-Za-z0-9_-]{1,64}$/u;
|
|
162
|
+
|
|
163
|
+
export const noteBackgroundTask = (tasks, { id, kind, name, at, until = null }) => {
|
|
164
|
+
if (typeof id !== "string" || !TASK_ID.test(id)) return tasks;
|
|
165
|
+
const label = String(name || kind).replace(/[\u0000-\u001f\u007f]/gu, " ").trim().slice(0, 40) || kind;
|
|
166
|
+
const next = { ...tasks, [id]: { id, kind, name: label, at, until: Number.isFinite(until) ? until : null } };
|
|
167
|
+
const ids = Object.keys(next);
|
|
168
|
+
return ids.length > TASK_CAP ? Object.fromEntries(ids.slice(-TASK_CAP).map((key) => [key, next[key]])) : next;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export const endBackgroundTask = (tasks, id) => (typeof id === "string" && tasks[id] ? Object.fromEntries(Object.entries(tasks).filter(([key]) => key !== id)) : tasks);
|
|
172
|
+
|
|
173
|
+
// The ids a task notification names as ended. Its text is read for `<task-id>` and `<status>`
|
|
174
|
+
// alone and kept nowhere; a notification that still reports a running task ends nothing.
|
|
175
|
+
export const endedTaskIds = (text) => {
|
|
176
|
+
const body = String(text ?? "").slice(0, 65_536);
|
|
177
|
+
const ids = [];
|
|
178
|
+
for (const block of body.split(/<\/task-notification>/u)) {
|
|
179
|
+
const id = /<task-id>\s*([A-Za-z0-9_-]{1,64})\s*<\/task-id>/u.exec(block)?.[1];
|
|
180
|
+
const status = /<status>\s*([a-z_]{1,24})\s*<\/status>/u.exec(block)?.[1] ?? "completed";
|
|
181
|
+
if (id && !["running", "pending", "in_progress"].includes(status)) ids.push(id);
|
|
182
|
+
}
|
|
183
|
+
return ids;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export const pruneBackgroundTasks = (tasks, now) => {
|
|
187
|
+
const kept = Object.entries(tasks).filter(([, task]) => !(task.until !== null && now > task.until) && !(now - task.at > TASK_STALE_MS));
|
|
188
|
+
return kept.length === Object.keys(tasks).length ? tasks : Object.fromEntries(kept);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const goalCount = (goal) => (goalIsOpen(goal) && goal.criteria.length > 0 ? { done: goal.criteria.filter(({ status }) => status === "pass").length, total: goal.criteria.length } : null);
|
|
192
|
+
const LOOP_SKILLS = new Set(["lit-loop", "litgoal", "litwork"]);
|
|
193
|
+
|
|
194
|
+
// A frame's k/n, the first source that knows it: the count the frame recorded, the start-work run
|
|
195
|
+
// it drives, the checkboxes of the plan it works from, the open goal's criteria (a loop), and for
|
|
196
|
+
// the frame on top the main loop's own todo or task list.
|
|
197
|
+
const frameCount = (frame, snapshot, mainList) => {
|
|
198
|
+
const record = frame.record;
|
|
199
|
+
if (countOrNull(record?.total) !== null) return { done: countOrNull(record.n) ?? 0, total: record.total };
|
|
200
|
+
const work = snapshot.work;
|
|
201
|
+
if (work?.total > 0 && (frame.skill === "start-work" || (record?.family === "main" && record.stage === "work"))) return { done: work.checked, total: work.total };
|
|
202
|
+
if (frame.plan?.total > 0) return frame.plan;
|
|
203
|
+
if (LOOP_SKILLS.has(frame.skill) || record?.family === "loop") {
|
|
204
|
+
const goal = goalCount(snapshot.goal);
|
|
205
|
+
if (goal) return goal;
|
|
206
|
+
}
|
|
207
|
+
return mainList ?? { done: countOrNull(record?.n), total: null };
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const frameThread = (frame, index, snapshot, active, mainList = null) => {
|
|
211
|
+
const { done, total } = frameCount(frame, snapshot, active ? mainList : null);
|
|
212
|
+
return {
|
|
213
|
+
key: `frame-${index}`,
|
|
214
|
+
name: frame.skill ?? frame.record?.family ?? "work",
|
|
215
|
+
stage: frame.record?.step ?? frame.record?.stage ?? null,
|
|
216
|
+
done,
|
|
217
|
+
total,
|
|
218
|
+
state: frame.record?.done ? "done" : frame.status === "paused" ? "paused" : frame.skill === "start-work" && snapshot.work?.status === "paused" ? "blocked" : "running",
|
|
219
|
+
active,
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// A lane's k/n: its own todo or task list, else the steps it has finished over an unknown total.
|
|
224
|
+
const laneCount = (entry) => listProgress(entry) ?? { done: entry?.steps ?? 0, total: null, steps: true };
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The live threads, or null while there is at most one: `{ chain, lanes, others, laneCount,
|
|
228
|
+
* taskCount, more, reserve }`. `chain` is this session's stack, parent first; `lanes` the subagents
|
|
229
|
+
* or work lanes running under its top frame, then its background tasks (`task` names the kind);
|
|
230
|
+
* `others` the top frame of each other session of this project whose stack moved within
|
|
231
|
+
* OTHER_SESSION_MS. At most THREAD_ROWS are kept (more under a deep chain, see PARALLEL_ROWS): the
|
|
232
|
+
* active frame and its parents first, then lanes and tasks, then other sessions. `reserve` is the card's thread-row count, never below the
|
|
233
|
+
* `threadReserve` the caller carried over, so the card does not shrink while threads are live.
|
|
234
|
+
*/
|
|
235
|
+
const threadsOf = ({ snapshot, lanes, tasks, lists, now, threadReserve }) => {
|
|
236
|
+
const frames = snapshot.workflow?.stack?.frames ?? [];
|
|
237
|
+
const mainList = listProgress(lists.main);
|
|
238
|
+
const chain = frames.map((frame, index) => frameThread(frame, index, snapshot, index === frames.length - 1, mainList));
|
|
239
|
+
const laneThreads = lanes.map((lane, index) => ({
|
|
240
|
+
key: `lane-${lane.id ?? index}`,
|
|
241
|
+
name: lane.name,
|
|
242
|
+
stage: null,
|
|
243
|
+
...laneCount(lane.id ? lists[lane.id] : null),
|
|
244
|
+
state: lane.status === "stalled" ? "blocked" : lane.status === "idle" ? "idle" : "running",
|
|
245
|
+
active: false,
|
|
246
|
+
}));
|
|
247
|
+
const taskThreads = tasks.map((task) => ({ key: `task-${task.id}`, name: task.name, stage: task.kind, done: null, total: null, state: "running", active: false, task: task.kind }));
|
|
248
|
+
const parallel = [...laneThreads, ...taskThreads];
|
|
249
|
+
const others = (snapshot.workflow?.others ?? [])
|
|
250
|
+
.filter((other) => Number.isFinite(other.at) && now - other.at <= OTHER_SESSION_MS && other.frames?.length)
|
|
251
|
+
.map((other) => ({ ...frameThread(other.frames.at(-1), 0, {}, false), key: `session-${other.id8}`, session: other.id8 }));
|
|
252
|
+
const total = chain.length + parallel.length + others.length;
|
|
253
|
+
if (total < 2) return null;
|
|
254
|
+
const room = Math.max(PARALLEL_ROWS, THREAD_ROWS - chain.length);
|
|
255
|
+
const keptLanes = parallel.slice(0, room);
|
|
256
|
+
const keptOthers = others.slice(0, Math.max(0, room - keptLanes.length));
|
|
257
|
+
const fork = parallel.length >= 2 ? 1 : 0;
|
|
258
|
+
const needed = chain.length + keptLanes.length + keptOthers.length + fork;
|
|
259
|
+
return {
|
|
260
|
+
chain,
|
|
261
|
+
lanes: keptLanes,
|
|
262
|
+
others: keptOthers,
|
|
263
|
+
laneCount: laneThreads.length,
|
|
264
|
+
taskCount: taskThreads.length,
|
|
265
|
+
more: total - chain.length - keptLanes.length - keptOthers.length,
|
|
266
|
+
reserve: Math.max(needed, Number.isInteger(threadReserve) ? threadReserve : 0),
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
|
|
89
270
|
const goalIsOpen = (goal) => Boolean(goal && NONTERMINAL_GOAL.has(goal.status));
|
|
90
271
|
|
|
91
272
|
const progressOf = (snapshot) => {
|
|
@@ -168,9 +349,11 @@ export const stepName = (tool) => {
|
|
|
168
349
|
* `$.session.usage()`, `notice` and `completion` whatever the mod is currently playing, `skills`
|
|
169
350
|
* the chips (skills.mjs chipStates), `lastDiscipline` the discipline or skill the session last
|
|
170
351
|
* lit (the idle title), `git` the branch and `step` the live step (`{ name, at }`, the tool the
|
|
171
|
-
* main loop runs and since when).
|
|
352
|
+
* main loop runs and since when). `threadReserve` is the previous model's `threads.reserve`,
|
|
353
|
+
* `lists` the loops' todo and task counts (noteLoopCall) and `tasks` the background tasks
|
|
354
|
+
* (noteBackgroundTask).
|
|
172
355
|
*/
|
|
173
|
-
export const buildBandModel = ({ snapshot, agents = [], activity = EMPTY_ACTIVITY, usage = null, now, band = "always", isWorking = false, notice = null, completion = null, skills = [], lastDiscipline = null, git = null, step = null }) => {
|
|
356
|
+
export const buildBandModel = ({ snapshot, agents = [], activity = EMPTY_ACTIVITY, usage = null, now, band = "always", isWorking = false, notice = null, completion = null, skills = [], lastDiscipline = null, git = null, step = null, threadReserve = 0, lists = EMPTY_LISTS, tasks = EMPTY_TASKS }) => {
|
|
174
357
|
const discipline = snapshot.ignition?.discipline ?? null;
|
|
175
358
|
const progress = progressOf(snapshot);
|
|
176
359
|
const completing = completion !== null;
|
|
@@ -197,16 +380,19 @@ export const buildBandModel = ({ snapshot, agents = [], activity = EMPTY_ACTIVIT
|
|
|
197
380
|
if (probe?.issue && probe.issueAt >= (probe.editAt ?? 0)) warnings.push({ tone: "red", subject: "ui probe", text: probe.issue, hint: "interface check failed" });
|
|
198
381
|
const active = Boolean(snapshot.work) || goalIsOpen(goal) || (discipline !== null && isWorking) || liveAgents.length > 0;
|
|
199
382
|
const lit = skills.some(({ state }) => state === "current");
|
|
383
|
+
const workflow = buildWorkflow({ snapshot, skills, completion, now });
|
|
384
|
+
const title = discipline ?? skills.find(({ state }) => state === "current")?.id ?? lastDiscipline;
|
|
200
385
|
const visible = band === "off" ? false : band === "always" || active || lit || notice !== null || completion !== null || warnings.length > 0;
|
|
201
386
|
return {
|
|
202
387
|
visible,
|
|
203
388
|
idle: !active && !lit,
|
|
204
389
|
discipline,
|
|
205
|
-
title:
|
|
390
|
+
title: workflow?.paused ? crumbOf(workflow.paused) : title,
|
|
206
391
|
phases,
|
|
207
392
|
progress,
|
|
208
393
|
next: snapshot.work?.nextTask ?? (goalIsOpen(goal) ? goal.criteria.find(({ status }) => status !== "pass")?.description || goal.objective || null : null),
|
|
209
394
|
lanes: { count: lanes.length, list: lanes },
|
|
395
|
+
threads: threadsOf({ snapshot, lanes, tasks: Object.values(pruneBackgroundTasks(tasks, now)), lists, now, threadReserve }),
|
|
210
396
|
autoloop,
|
|
211
397
|
ctxWarning,
|
|
212
398
|
warnings,
|
|
@@ -214,16 +400,24 @@ export const buildBandModel = ({ snapshot, agents = [], activity = EMPTY_ACTIVIT
|
|
|
214
400
|
goal: goalSummaryOf(goal),
|
|
215
401
|
skills: skills.map(({ id, at, state }) => ({ id, at, state })),
|
|
216
402
|
figures: figuresOf(usage, git),
|
|
217
|
-
workflow
|
|
403
|
+
workflow,
|
|
218
404
|
step: step && isWorking && stepName(step.name) ? { name: stepName(step.name), elapsedMs: Math.max(0, now - step.at) } : null,
|
|
219
405
|
notice,
|
|
220
406
|
completion,
|
|
221
407
|
};
|
|
222
408
|
};
|
|
223
409
|
|
|
224
|
-
|
|
410
|
+
// `lit-loop || > lit-brainstorm`, or `lit-loop || > … > lit-brainstorm` with a side between them.
|
|
411
|
+
const crumbOf = ({ parent, child, chain }) => `${parent} || > ${chain.length > 1 ? "… > " : ""}${child}`;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* The spinner's suffix: the ellipsis Claude Code drew, then the discipline and the progress count,
|
|
415
|
+
* or the paused parent and its count while a side runs over it.
|
|
416
|
+
*/
|
|
225
417
|
export const spinnerSuffix = (model, base = "…") => {
|
|
226
418
|
if (!model?.visible || !model.discipline) return null;
|
|
419
|
+
const paused = model.workflow?.paused;
|
|
420
|
+
if (paused) return `${base} · ${paused.child} (|| ${paused.parent}${paused.count ? ` ${paused.count.done}/${paused.count.total}` : ""})`;
|
|
227
421
|
const count = model.progress ? ` · ${model.progress.done}/${model.progress.total}` : "";
|
|
228
422
|
return `${base} · ${model.discipline}${count}`;
|
|
229
423
|
};
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
//
|
|
5
5
|
// Three families. The main chain runs a request from the interview to review (litgoal and
|
|
6
6
|
// autoresearch ride its work stage with criteria or iterations); litresearch has its own waves; a
|
|
7
|
-
// lit-loop criterion cycles through its test-first steps. The stage comes from the
|
|
8
|
-
//
|
|
9
|
-
// workflow-stage
|
|
10
|
-
// any of those, from the durable state that says work is under way. The durable state also fills
|
|
7
|
+
// lit-loop criterion cycles through its test-first steps. The stage comes from the session's workflow
|
|
8
|
+
// stack (`.litclaude/workflow-stack/<session>.json`, kept by the hooks and `litclaude-ai
|
|
9
|
+
// workflow-stage`) when it is fresh, else from the newer of the ignited discipline and a skill this
|
|
10
|
+
// request fired; without any of those, from the durable state that says work is under way. The durable state also fills
|
|
11
11
|
// in the detail: interview rounds, the plan draft's status, the work's tasks, research waves.
|
|
12
12
|
|
|
13
13
|
export const WORKFLOW_FAMILIES = Object.freeze({
|
|
@@ -107,6 +107,8 @@ const entryOf = ({ snapshot, skills, now }) => {
|
|
|
107
107
|
const chip = skills.find(({ id, state }) => state === "current" && DISCIPLINE_ENTRY[id]);
|
|
108
108
|
if (chip) candidates.push({ ...DISCIPLINE_ENTRY[chip.id], at: chip.at ?? 0, from: "skill" });
|
|
109
109
|
const record = snapshot.workflow?.record;
|
|
110
|
+
// The session's stack already follows every discipline the session started, paused or not.
|
|
111
|
+
if (record?.stacked && fresh(record, now)) return { family: record.family, stage: record.stage, at: record.at, from: "record", record };
|
|
110
112
|
if (fresh(record, now)) candidates.push({ family: record.family, stage: record.stage, at: record.at, from: "record", record });
|
|
111
113
|
// The record is written a moment after the ignition it answers, so a tie goes to the record.
|
|
112
114
|
return candidates.sort((a, b) => b.at - a.at || (a.from === "record" ? -1 : 1))[0] ?? null;
|
|
@@ -153,11 +155,13 @@ const plainText = (text) => (typeof text === "string" ? text.replace(/\*\*|__|`/
|
|
|
153
155
|
const percent = (value) => (Number.isFinite(value) ? Math.round(value <= 1 ? value * 100 : value) : null);
|
|
154
156
|
|
|
155
157
|
/**
|
|
156
|
-
* The map: `{ family, stages: [{ id, label, state }], current, count, items, verdicts, next }`,
|
|
158
|
+
* The map: `{ family, stages: [{ id, label, state }], current, count, items, verdicts, next, paused }`,
|
|
157
159
|
* or null when nothing places the session on a family's map (the card then keeps its PLAN / WORK /
|
|
158
160
|
* REVIEW track). `state` is done, now or todo; `current` is the index of the stage that is now,
|
|
159
161
|
* or -1 once the family is done. `count` is the current stage's n/m, `items` short facts about
|
|
160
|
-
* it, `verdicts` the review lanes or a crucible verdict, `next` the next task or criterion.
|
|
162
|
+
* it, `verdicts` the review lanes or a crucible verdict, `next` the next task or criterion. Under
|
|
163
|
+
* a side frame the map is the paused spine's: its stage marked `||` with its count, `paused` names
|
|
164
|
+
* the parent and the child, and the items give the child and the way back.
|
|
161
165
|
*/
|
|
162
166
|
export const buildWorkflow = ({ snapshot, skills = [], completion = null, now }) => {
|
|
163
167
|
const entry = entryOf({ snapshot, skills, now }) ?? inferredEntry(snapshot, now);
|
|
@@ -201,6 +205,9 @@ export const buildWorkflow = ({ snapshot, skills = [], completion = null, now })
|
|
|
201
205
|
next = plainText(goal.criteria.find(({ status }) => status !== "pass")?.description);
|
|
202
206
|
} else if (record?.stage === "work" && record.total) {
|
|
203
207
|
countOf = { done: Math.min(record.n ?? 0, record.total), total: record.total, unit: record.unit ?? "iteration" };
|
|
208
|
+
} else if (record?.plan?.total) {
|
|
209
|
+
// A work stage with nothing else to count counts the plan it took over from lit-plan.
|
|
210
|
+
countOf = { done: record.plan.done, total: record.plan.total, unit: "task" };
|
|
204
211
|
}
|
|
205
212
|
}
|
|
206
213
|
if (stage === "review") {
|
|
@@ -225,6 +232,8 @@ export const buildWorkflow = ({ snapshot, skills = [], completion = null, now })
|
|
|
225
232
|
} else if (goalIsOpen(goal) && goal.criteria.length > 0) {
|
|
226
233
|
countOf = { done: goal.criteria.filter(({ status }) => status === "pass").length, total: goal.criteria.length, unit: "criterion" };
|
|
227
234
|
next = goal.criteria.find(({ status }) => status !== "pass")?.description || null;
|
|
235
|
+
} else if (record?.plan?.total) {
|
|
236
|
+
countOf = { done: record.plan.done, total: record.plan.total, unit: "task" };
|
|
228
237
|
}
|
|
229
238
|
if (record && record.step.toUpperCase() !== record.stage) items.push(record.step.toLowerCase());
|
|
230
239
|
if (completion) stage = "RECORD";
|
|
@@ -237,8 +246,28 @@ export const buildWorkflow = ({ snapshot, skills = [], completion = null, now })
|
|
|
237
246
|
const stages = order.map((id, index) => {
|
|
238
247
|
let label = id;
|
|
239
248
|
if (index === current && countOf && family === "main") label = `${id} ${countOf.done}/${countOf.total}`;
|
|
249
|
+
// An open work ahead of the current stage keeps its task count in view.
|
|
250
|
+
else if (family === "main" && id === "work" && index > current && current >= 0 && snapshot.work?.total > 0) label = `work ${snapshot.work.checked}/${snapshot.work.total}`;
|
|
240
251
|
if (family === "research" && id === "wave" && wave > 0) label = `wave ${wave}`;
|
|
241
252
|
return { id, label, state: finished || index < current ? "done" : index === current ? "now" : "todo" };
|
|
242
253
|
});
|
|
243
|
-
|
|
254
|
+
const paused = pausedUnder(sources.stack, entry, finished);
|
|
255
|
+
if (paused) {
|
|
256
|
+
// The parent's map stays where it stopped; the row under it says what runs and the way back.
|
|
257
|
+
const at = stages[current];
|
|
258
|
+
const count = family !== "main" && countOf ? ` ${countOf.done}/${countOf.total}` : "";
|
|
259
|
+
at.label = `|| ${at.label}${count}`;
|
|
260
|
+
paused.count = countOf;
|
|
261
|
+
if (!next && goalIsOpen(snapshot.goal)) next = plainText(snapshot.goal.criteria.find(({ status }) => status !== "pass")?.description);
|
|
262
|
+
return { family, stages, current, count: null, items: [`↳ ${paused.child}`, "back: lit continue"], verdicts: null, next, paused };
|
|
263
|
+
}
|
|
264
|
+
return { family, stages, current, count: countOf, items, verdicts, next, paused: null };
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
// The stack's spine below a side frame: `{ parent, child, chain }` names the paused work, the
|
|
268
|
+
// discipline on top and the sides between them; null while the spine itself runs.
|
|
269
|
+
const pausedUnder = (stack, entry, finished) => {
|
|
270
|
+
if (finished || !entry.record?.stacked || !stack || stack.owner >= stack.frames.length - 1) return null;
|
|
271
|
+
const sides = stack.frames.slice(stack.owner + 1).map(({ skill }) => skill ?? "work");
|
|
272
|
+
return { parent: stack.frames[stack.owner].skill ?? entry.family, child: sides.at(-1), chain: sides };
|
|
244
273
|
};
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// environment (exit 10-12, 14, 15, 21, 22) goes straight to that notice. A done film with a downgrade, open
|
|
12
12
|
// look items or no image tool blocks once so the reply says so.
|
|
13
13
|
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
14
|
-
import { isAbsolute, join, resolve } from "node:path";
|
|
14
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
15
15
|
|
|
16
16
|
import { ensureStateDirIgnored, resolveProjectStateRoot } from "./project-state-root.mjs";
|
|
17
17
|
|
|
@@ -23,6 +23,16 @@ const DONE_MODULE = new URL("../skills/lit-typographic-motion/engine/node/done.m
|
|
|
23
23
|
|
|
24
24
|
export const motionTurnPath = (cwd = resolveProjectStateRoot()) => join(resolveProjectStateRoot(cwd), ".litclaude", "motion", "turn.json");
|
|
25
25
|
|
|
26
|
+
// The model often works inside the film folder (`cd motion-x && motion.mjs stage --out .`). Outside a Git
|
|
27
|
+
// repository that folder resolves to its own state root, so the tool and Stop hooks look for the turn the
|
|
28
|
+
// prompt armed in the nearest folder up the tree that holds one.
|
|
29
|
+
const turnRoot = (cwd) => {
|
|
30
|
+
for (let dir = resolve(cwd); ; dir = dirname(dir)) {
|
|
31
|
+
if (existsSync(motionTurnPath(dir))) return dir;
|
|
32
|
+
if (dirname(dir) === dir) return cwd;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
26
36
|
const readTurn = (cwd) => {
|
|
27
37
|
const path = motionTurnPath(cwd);
|
|
28
38
|
if (!existsSync(path)) return null;
|
|
@@ -51,11 +61,17 @@ export const recordMotionTurn = (cwd, { sessionId, discipline, now = Date.now()
|
|
|
51
61
|
|
|
52
62
|
const unquote = (value) => value?.replace(/^["']|["']$/gu, "");
|
|
53
63
|
|
|
64
|
+
// `$NAME` / `${NAME}` from `NAME=value` assignments earlier in the same command line. A variable the
|
|
65
|
+
// command never sets stays unexpanded, and the caller treats that path as unknown.
|
|
66
|
+
const expandVars = (value, vars) => value?.replace(/\$\{?([A-Za-z_][A-Za-z0-9_]*)\}?/gu, (whole, name) => vars.get(name) ?? whole);
|
|
67
|
+
|
|
54
68
|
/** Parse one `motion.mjs <subcommand> ...` command line into { mode, out, brief, round, stillsOnly }. */
|
|
55
69
|
export function parseMotionCommand(command, workdir) {
|
|
56
70
|
const match = COMMAND.exec(command);
|
|
57
71
|
if (!match) return null;
|
|
58
|
-
const
|
|
72
|
+
const vars = new Map();
|
|
73
|
+
for (const m of command.slice(0, match.index).matchAll(/(?:^|[\s;&|(])([A-Za-z_][A-Za-z0-9_]*)=("[^"]*"|'[^']*'|[^\s;&|]*)/gu)) vars.set(m[1], expandVars(unquote(m[2]), vars));
|
|
74
|
+
const tokens = [...match[2].matchAll(/"[^"]*"|'[^']*'|[^\s]+/gu)].map((m) => expandVars(unquote(m[0]), vars));
|
|
59
75
|
const values = {};
|
|
60
76
|
const positional = [];
|
|
61
77
|
let stillsOnly = false;
|
|
@@ -69,7 +85,7 @@ export function parseMotionCommand(command, workdir) {
|
|
|
69
85
|
}
|
|
70
86
|
} else if (!t.startsWith(">") && !t.startsWith("2>")) positional.push(t);
|
|
71
87
|
}
|
|
72
|
-
const abs = (p) => (p ? (isAbsolute(p) ? p : join(workdir, p)) : null);
|
|
88
|
+
const abs = (p) => (p && !p.includes("$") ? (isAbsolute(p) ? p : join(workdir, p)) : null);
|
|
73
89
|
const mode = match[1];
|
|
74
90
|
if (mode === "gate") return { mode, out: abs(positional[0]), brief: null, round: null, stillsOnly: false };
|
|
75
91
|
// cover-gate checks a file; it is not a render, so it never becomes the output the Stop hook judges.
|
|
@@ -90,7 +106,8 @@ const toolOutput = (input) => {
|
|
|
90
106
|
return [response.stdout, response.stderr, response.output].filter((part) => typeof part === "string").join("\n");
|
|
91
107
|
};
|
|
92
108
|
|
|
93
|
-
export const observeMotionTool = (
|
|
109
|
+
export const observeMotionTool = (start, { input, now = Date.now() }) => {
|
|
110
|
+
const cwd = turnRoot(start);
|
|
94
111
|
let turn;
|
|
95
112
|
try {
|
|
96
113
|
turn = readTurn(cwd);
|
|
@@ -98,7 +115,7 @@ export const observeMotionTool = (cwd, { input, now = Date.now() }) => {
|
|
|
98
115
|
return null;
|
|
99
116
|
}
|
|
100
117
|
if (!turn || turn.sessionId !== input.session_id) return null;
|
|
101
|
-
const workdir = typeof input.cwd === "string" ? input.cwd :
|
|
118
|
+
const workdir = typeof input.cwd === "string" ? input.cwd : start;
|
|
102
119
|
const command = input.tool_name === "Bash" && typeof input.tool_input?.command === "string" ? input.tool_input.command : "";
|
|
103
120
|
const parsed = parseMotionCommand(command, workdir);
|
|
104
121
|
if (!parsed) return null;
|
|
@@ -126,7 +143,8 @@ export function readsFromTranscript(transcriptPath) {
|
|
|
126
143
|
|
|
127
144
|
const notDoneNotice = (reasons) => `lit-typographic-motion: the film is not done (${reasons.join("; ")}). Stop rendering now and say in the reply, in plain words, that the film is not done and why, and what the user can run to finish it.`;
|
|
128
145
|
|
|
129
|
-
export const evaluateMotionStop = async ({ cwd, sessionId, transcriptPath = null, now = Date.now() }) => {
|
|
146
|
+
export const evaluateMotionStop = async ({ cwd: start, sessionId, transcriptPath = null, now = Date.now() }) => {
|
|
147
|
+
const cwd = turnRoot(start);
|
|
130
148
|
let turn;
|
|
131
149
|
try {
|
|
132
150
|
turn = readTurn(cwd);
|
|
@@ -153,7 +171,7 @@ export const evaluateMotionStop = async ({ cwd, sessionId, transcriptPath = null
|
|
|
153
171
|
];
|
|
154
172
|
if (!say.length) return { action: "allow", why: "done" };
|
|
155
173
|
writeTurn(cwd, { ...turn, notified: true });
|
|
156
|
-
return { action: "block", why: verdict.status, reason: `lit-typographic-motion: the film is finished. The reply must say plainly: ${say.join("; ")}.` };
|
|
174
|
+
return { action: "block", why: verdict.status, reason: `lit-typographic-motion: ${verdict.preview ? "the storyboard preview is finished" : "the film is finished"}. The reply must say plainly: ${say.join("; ")}.` };
|
|
157
175
|
}
|
|
158
176
|
if (verdict.status === "BLOCKED" || turn.blockCount >= MOTION_MAX_BLOCKS) {
|
|
159
177
|
writeTurn(cwd, { ...turn, notified: true, warned: true });
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
"""Render a .pptx, .docx or .pdf to PNG pages so a person (or the model) can look at it.
|
|
3
3
|
|
|
4
4
|
LibreOffice (soffice) converts Office files to PDF in a private profile directory,
|
|
5
|
-
so parallel runs never share a lock; PyMuPDF rasterises the PDF pages.
|
|
5
|
+
so parallel runs never share a lock; PyMuPDF rasterises the PDF pages. Fonts a .pptx
|
|
6
|
+
embeds as plain font files are placed in that profile's font folder first, so the pages
|
|
7
|
+
show the faces PowerPoint shows even where the font is not installed. A PDF input
|
|
6
8
|
skips the conversion. Without soffice an Office file cannot be rendered: the script
|
|
7
9
|
prints SKIP with the reason and exits 0, and the caller must say that the visual
|
|
8
10
|
pass did not happen.
|
|
@@ -21,9 +23,34 @@ import shutil
|
|
|
21
23
|
import subprocess
|
|
22
24
|
import sys
|
|
23
25
|
import tempfile
|
|
26
|
+
import zipfile
|
|
24
27
|
from pathlib import Path
|
|
25
28
|
|
|
26
29
|
|
|
30
|
+
def profile_fonts(source: Path, profile: Path) -> list[Path]:
|
|
31
|
+
"""Copy the plain font files a .pptx embeds (ppt/fonts/*.fntdata) into the profile's font folder."""
|
|
32
|
+
if source.suffix.lower() != ".pptx":
|
|
33
|
+
return []
|
|
34
|
+
placed = []
|
|
35
|
+
try:
|
|
36
|
+
with zipfile.ZipFile(source) as z:
|
|
37
|
+
for name in z.namelist():
|
|
38
|
+
if not (name.startswith("ppt/fonts/") and name.endswith(".fntdata")):
|
|
39
|
+
continue
|
|
40
|
+
data = z.read(name)
|
|
41
|
+
# Only a TrueType or OpenType file; an obfuscated or EOT part is left to the renderer.
|
|
42
|
+
kind = ".otf" if data[:4] == b"OTTO" else ".ttf" if data[:4] in (b"\x00\x01\x00\x00", b"true") else None
|
|
43
|
+
if not kind:
|
|
44
|
+
continue
|
|
45
|
+
target = profile / "user" / "fonts" / (Path(name).stem + kind)
|
|
46
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
47
|
+
target.write_bytes(data)
|
|
48
|
+
placed.append(target)
|
|
49
|
+
except zipfile.BadZipFile:
|
|
50
|
+
return []
|
|
51
|
+
return placed
|
|
52
|
+
|
|
53
|
+
|
|
27
54
|
def to_pdf(source: Path, out_dir: Path) -> tuple[Path | None, str]:
|
|
28
55
|
if source.suffix.lower() == ".pdf":
|
|
29
56
|
return source, "input is already PDF"
|
|
@@ -31,6 +58,7 @@ def to_pdf(source: Path, out_dir: Path) -> tuple[Path | None, str]:
|
|
|
31
58
|
if not soffice:
|
|
32
59
|
return None, "LibreOffice (soffice) is not on PATH"
|
|
33
60
|
with tempfile.TemporaryDirectory(prefix="litclaude-soffice-") as profile:
|
|
61
|
+
profile_fonts(source, Path(profile))
|
|
34
62
|
result = subprocess.run(
|
|
35
63
|
[
|
|
36
64
|
soffice,
|