@litfamily/litgravity 0.1.0 → 0.1.2
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 +32 -0
- package/README.md +72 -17
- package/README_ko-KR.md +72 -17
- package/package.json +1 -1
- package/plugin/hooks/lib/lanes.mjs +65 -0
- package/plugin/hooks/lib/motion.mjs +34 -5
- package/plugin/hooks/lib/reentry.mjs +7 -0
- package/plugin/hooks/lib/rewind/brief.mjs +332 -0
- package/plugin/hooks/lib/rewind/collect.mjs +328 -0
- package/plugin/hooks/lib/rewind/gauge.mjs +55 -0
- package/plugin/hooks/lib/rewind/next-step.mjs +77 -0
- package/plugin/hooks/lib/rewind/redact.mjs +60 -0
- package/plugin/hooks/lib/rewind/transcripts.mjs +211 -0
- package/plugin/hooks/lib/routes.mjs +79 -5
- package/plugin/hooks/lib/workflow-stack.mjs +213 -0
- package/plugin/hooks/post-tool-use.mjs +37 -1
- package/plugin/hooks/pre-invocation.mjs +91 -2
- package/plugin/hooks/session-start.mjs +26 -3
- package/plugin/hooks/stop.mjs +22 -2
- package/plugin/hud/looks.mjs +29 -0
- package/plugin/hud/render.mjs +234 -12
- package/plugin/plugin.json +1 -1
- package/plugin/skills/frontend-ui-ux/SKILL.md +12 -1
- package/plugin/skills/frontend-ui-ux/kit/components.css +417 -0
- package/plugin/skills/frontend-ui-ux/kit/fonts.json +22 -0
- package/plugin/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
- package/plugin/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
- package/plugin/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
- package/plugin/skills/frontend-ui-ux/kit/ui.js +226 -0
- package/plugin/skills/frontend-ui-ux/references/house-styles.md +234 -0
- package/plugin/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe-lock.mjs +196 -0
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe-page.mjs +30 -9
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe-rules.mjs +20 -8
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe.mjs +42 -9
- package/plugin/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
- package/plugin/skills/lit-adhd/SKILL.md +157 -0
- package/plugin/skills/lit-adhd/references/card-examples.md +101 -0
- package/plugin/skills/lit-adhd/references/status-taxonomy.md +32 -0
- package/plugin/skills/lit-adhd/scripts/rewind.mjs +5 -0
- package/plugin/skills/lit-diagram-drawer/SKILL.md +5 -3
- package/plugin/skills/lit-diagram-drawer/references/drawing-rules.md +1 -1
- package/plugin/skills/lit-diagram-drawer/references/style-guide.md +21 -12
- package/plugin/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
- package/plugin/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
- package/plugin/skills/lit-diagram-drawer/references/type-tree.md +3 -3
- package/plugin/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
- package/plugin/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +1 -2
- package/plugin/skills/lit-diagram-drawer/scripts/visual-quality.mjs +1 -2
- package/plugin/skills/lit-docx/SKILL.md +3 -3
- package/plugin/skills/lit-handoff/SKILL.md +1 -0
- package/plugin/skills/lit-hijack/SKILL.md +263 -0
- package/plugin/skills/lit-hijack/references/capture-and-provenance.md +100 -0
- package/plugin/skills/lit-hijack/references/clean-room-build.md +75 -0
- package/plugin/skills/lit-hijack/references/distil-and-licence.md +67 -0
- package/plugin/skills/lit-hijack/references/gap-and-port-design.md +100 -0
- package/plugin/skills/lit-hijack/references/parity-and-report.md +85 -0
- package/plugin/skills/lit-hijack/scripts/hijack.mjs +953 -0
- package/plugin/skills/lit-plan/SKILL.md +1 -1
- package/plugin/skills/lit-pptx/SKILL.md +8 -8
- package/plugin/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
- package/plugin/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
- package/plugin/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
- package/plugin/skills/lit-pptx/fonts/provenance.json +32 -1
- package/plugin/skills/lit-pptx/references/agents/analyst.md +34 -56
- package/plugin/skills/lit-pptx/references/agents/antithesis.md +49 -67
- package/plugin/skills/lit-pptx/references/agents/architect.md +38 -51
- package/plugin/skills/lit-pptx/references/agents/critic.md +25 -41
- package/plugin/skills/lit-pptx/references/agents/synthesizer.md +37 -46
- package/plugin/skills/lit-pptx/references/agents/thesis.md +29 -49
- package/plugin/skills/lit-pptx/references/anti-slop-checklist.md +119 -145
- package/plugin/skills/lit-pptx/references/authoring-guide.md +187 -278
- package/plugin/skills/lit-pptx/references/consensus-protocol.md +99 -97
- package/plugin/skills/lit-pptx/references/data-display-cookbook.md +36 -137
- package/plugin/skills/lit-pptx/references/density-and-fill.md +147 -216
- package/plugin/skills/lit-pptx/references/design-system-azure.md +56 -85
- package/plugin/skills/lit-pptx/references/direction-step.md +134 -176
- package/plugin/skills/lit-pptx/references/examples/01-pitch-signal-ko.md +114 -115
- package/plugin/skills/lit-pptx/references/examples/02-pitch-studio-ko.md +66 -66
- package/plugin/skills/lit-pptx/references/examples/03-business-review-ledger-ko.md +63 -63
- package/plugin/skills/lit-pptx/references/examples/04-business-review-night-en.md +96 -96
- package/plugin/skills/lit-pptx/references/examples/05-research-talk-paper-en.md +81 -81
- package/plugin/skills/lit-pptx/references/examples/06-lecture-chalk-ko.md +103 -103
- package/plugin/skills/lit-pptx/references/examples/07-data-review-night-en.md +100 -98
- package/plugin/skills/lit-pptx/references/examples/08-image-led-atlas-ko.md +76 -76
- package/plugin/skills/lit-pptx/references/examples/09-briefing-gazette-ko.md +96 -96
- package/plugin/skills/lit-pptx/references/examples/10-status-update-ledger-ko.md +80 -80
- package/plugin/skills/lit-pptx/references/examples/11-portfolio-studio-en.md +72 -72
- package/plugin/skills/lit-pptx/references/examples/12-research-tutorial-chalk-en.md +95 -95
- package/plugin/skills/lit-pptx/references/examples/13-engineering-review-computational-brutalism-ko.md +173 -0
- package/plugin/skills/lit-pptx/references/examples/14-launch-pitch-neo-brutalism-ko.md +154 -0
- package/plugin/skills/lit-pptx/references/examples/15-design-lecture-bauhaus-ko.md +139 -0
- package/plugin/skills/lit-pptx/references/examples/16-community-programme-riso-ko.md +158 -0
- package/plugin/skills/lit-pptx/references/examples/17-public-data-briefing-newsroom-ko.md +179 -0
- package/plugin/skills/lit-pptx/references/interview-protocol.md +83 -102
- package/plugin/skills/lit-pptx/references/layout-families.md +161 -265
- package/plugin/skills/lit-pptx/references/stages/autopilot.md +30 -70
- package/plugin/skills/lit-pptx/references/stages/interview.md +36 -68
- package/plugin/skills/lit-pptx/references/stages/plan.md +26 -67
- package/plugin/skills/lit-pptx/references/title-treatments.md +93 -145
- package/plugin/skills/lit-pptx/references/tonalities/atlas.md +95 -108
- package/plugin/skills/lit-pptx/references/tonalities/bauhaus.md +140 -0
- package/plugin/skills/lit-pptx/references/tonalities/chalk.md +107 -122
- package/plugin/skills/lit-pptx/references/tonalities/computational-brutalism.md +150 -0
- package/plugin/skills/lit-pptx/references/tonalities/gazette.md +87 -111
- package/plugin/skills/lit-pptx/references/tonalities/ledger.md +96 -125
- package/plugin/skills/lit-pptx/references/tonalities/neo-brutalism.md +161 -0
- package/plugin/skills/lit-pptx/references/tonalities/newsroom.md +144 -0
- package/plugin/skills/lit-pptx/references/tonalities/night.md +104 -131
- package/plugin/skills/lit-pptx/references/tonalities/paper.md +114 -130
- package/plugin/skills/lit-pptx/references/tonalities/riso.md +137 -0
- package/plugin/skills/lit-pptx/references/tonalities/signal.md +96 -103
- package/plugin/skills/lit-pptx/references/tonalities/studio.md +81 -112
- package/plugin/skills/lit-pptx/scripts/compile-deck.js +4 -6
- package/plugin/skills/lit-pptx/scripts/craft_extras.py +135 -91
- package/plugin/skills/lit-pptx/scripts/deck_craft.py +1 -1
- package/plugin/skills/lit-pptx/scripts/embed_fonts.py +13 -1
- package/plugin/skills/lit-pptx/scripts/layout_inventory.py +1 -1
- package/plugin/skills/lit-pptx/scripts/learn_template.py +1 -1
- package/plugin/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
- package/plugin/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
- package/plugin/skills/lit-pptx/scripts/lib/render-pack.js +370 -563
- package/plugin/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
- package/plugin/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
- package/plugin/skills/lit-pptx/scripts/qa_deck.py +6 -6
- package/plugin/skills/lit-pptx/scripts/render_pages.py +31 -0
- package/plugin/skills/lit-pptx/scripts/validate_pptx.py +1 -1
- package/plugin/skills/lit-pptx/specs/markdown-slide-spec-v1.md +167 -191
- package/plugin/skills/lit-pptx/specs/markdown-slide-spec-v2.md +117 -166
- package/plugin/skills/lit-pptx/specs/template-enrollment-contract.md +307 -330
- package/plugin/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
- package/plugin/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +99 -0
- package/plugin/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
- package/plugin/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
- package/plugin/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
- package/plugin/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
- package/plugin/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
- package/plugin/skills/lit-schematic/SKILL.md +114 -0
- package/plugin/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
- package/plugin/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
- package/plugin/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
- package/plugin/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
- package/plugin/skills/lit-schematic/references/cutaway-outputs.md +70 -0
- package/plugin/skills/lit-schematic/references/isometric-craft.md +101 -0
- package/plugin/skills/lit-schematic/references/journal-figures.md +72 -0
- package/plugin/skills/lit-schematic/references/kit-api.md +134 -0
- package/plugin/skills/lit-schematic/references/pfd-and-layout.md +53 -0
- package/plugin/skills/lit-schematic/references/pid-drafting.md +103 -0
- package/plugin/skills/lit-schematic/references/pid-symbols.md +163 -0
- package/plugin/skills/lit-schematic/references/verification.md +100 -0
- package/plugin/skills/lit-schematic/scripts/doctor.mjs +57 -0
- package/plugin/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
- package/plugin/skills/lit-schematic/scripts/lib/fonts.mjs +27 -0
- package/plugin/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
- package/plugin/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
- package/plugin/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
- package/plugin/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
- package/plugin/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
- package/plugin/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
- package/plugin/skills/lit-schematic/scripts/lib/png.mjs +132 -0
- package/plugin/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
- package/plugin/skills/lit-schematic/scripts/lib/route.mjs +218 -0
- package/plugin/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
- package/plugin/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
- package/plugin/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
- package/plugin/skills/lit-schematic/scripts/motion.mjs +129 -0
- package/plugin/skills/lit-schematic/scripts/qa.mjs +92 -0
- package/plugin/skills/lit-schematic/scripts/render.mjs +233 -0
- package/plugin/skills/lit-schematic/scripts/scaffold.mjs +60 -0
- package/plugin/skills/lit-scientific-visualization/SKILL.md +17 -6
- package/plugin/skills/lit-typographic-motion/SKILL.md +58 -48
- package/plugin/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +13 -2
- package/plugin/skills/lit-typographic-motion/engine/blender/runner.py +218 -0
- package/plugin/skills/lit-typographic-motion/engine/core/presets.mjs +1 -1
- package/plugin/skills/lit-typographic-motion/engine/node/analysis.mjs +65 -1
- package/plugin/skills/lit-typographic-motion/engine/node/assets.mjs +298 -0
- package/plugin/skills/lit-typographic-motion/engine/node/blender.mjs +143 -0
- package/plugin/skills/lit-typographic-motion/engine/node/board.mjs +136 -0
- package/plugin/skills/lit-typographic-motion/engine/node/brief.mjs +7 -1
- package/plugin/skills/lit-typographic-motion/engine/node/chrome.mjs +9 -12
- package/plugin/skills/lit-typographic-motion/engine/node/cover-assets.mjs +5 -3
- package/plugin/skills/lit-typographic-motion/engine/node/cover-capture.mjs +7 -6
- package/plugin/skills/lit-typographic-motion/engine/node/cover-treatment.mjs +37 -4
- package/plugin/skills/lit-typographic-motion/engine/node/cover.mjs +19 -8
- package/plugin/skills/lit-typographic-motion/engine/node/done.mjs +45 -6
- package/plugin/skills/lit-typographic-motion/engine/node/frame-worker.mjs +7 -5
- package/plugin/skills/lit-typographic-motion/engine/node/gallery.mjs +121 -0
- package/plugin/skills/lit-typographic-motion/engine/node/host.mjs +34 -0
- package/plugin/skills/lit-typographic-motion/engine/node/house.mjs +44 -0
- package/plugin/skills/lit-typographic-motion/engine/node/look.mjs +34 -20
- package/plugin/skills/lit-typographic-motion/engine/node/pipeline.mjs +19 -9
- package/plugin/skills/lit-typographic-motion/engine/node/scaffold.mjs +210 -0
- package/plugin/skills/lit-typographic-motion/engine/node/score.mjs +639 -0
- package/plugin/skills/lit-typographic-motion/engine/node/sound-cli.mjs +21 -4
- package/plugin/skills/lit-typographic-motion/engine/node/sound.mjs +127 -29
- package/plugin/skills/lit-typographic-motion/engine/node/stage-capture.mjs +7 -6
- package/plugin/skills/lit-typographic-motion/engine/node/stage-gate.mjs +59 -5
- package/plugin/skills/lit-typographic-motion/engine/node/stage-qa.mjs +141 -9
- package/plugin/skills/lit-typographic-motion/engine/node/stage-serve.mjs +28 -5
- package/plugin/skills/lit-typographic-motion/engine/node/stage.mjs +82 -14
- package/plugin/skills/lit-typographic-motion/engine/node/styles.mjs +213 -0
- package/plugin/skills/lit-typographic-motion/engine/node/treatment.mjs +311 -10
- package/plugin/skills/lit-typographic-motion/engine/stage/cover-init.js +14 -2
- package/plugin/skills/lit-typographic-motion/engine/stage/init.js +11 -1
- package/plugin/skills/lit-typographic-motion/engine/stage/qa.js +6 -1
- package/plugin/skills/lit-typographic-motion/engine/stage/stage-kit.js +83 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
- package/plugin/skills/lit-typographic-motion/recipes/hero-3d/expected.json +69 -0
- package/plugin/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
- package/plugin/skills/lit-typographic-motion/recipes/orbit-loop/expected.json +6 -4
- package/plugin/skills/lit-typographic-motion/recipes/painted-light/expected.json +4 -2
- package/plugin/skills/lit-typographic-motion/recipes/weight-tide/expected.json +7 -5
- package/plugin/skills/lit-typographic-motion/references/cover.md +394 -443
- package/plugin/skills/lit-typographic-motion/references/craft-loop.md +57 -87
- package/plugin/skills/lit-typographic-motion/references/depth.md +122 -0
- package/plugin/skills/lit-typographic-motion/references/look.md +94 -129
- package/plugin/skills/lit-typographic-motion/references/runtime.md +58 -91
- package/plugin/skills/lit-typographic-motion/references/sound.md +130 -99
- package/plugin/skills/lit-typographic-motion/references/stage.md +190 -215
- package/plugin/skills/lit-typographic-motion/references/studio.md +245 -0
- package/plugin/skills/lit-typographic-motion/references/style-bibles.md +108 -97
- package/plugin/skills/lit-typographic-motion/references/treatment.md +191 -143
- package/plugin/skills/lit-typographic-motion/scripts/motion-doctor.mjs +17 -5
- package/plugin/skills/lit-typographic-motion/scripts/motion.mjs +47 -7
- package/plugin/skills/lit-typographic-motion/styles/paper.json +41 -0
- package/plugin/skills/lit-typographic-motion/styles/swiss-signal.json +41 -0
- package/plugin/skills/lit-typographic-motion/styles/terminalcore.json +42 -0
- package/plugin/skills/lit-typographic-motion/styles/tidal.json +41 -0
- package/plugin/skills/litresearch/SKILL.md +1 -0
- package/plugin/skills/readme-studio/SKILL.md +2 -0
- package/plugin/skills/readme-studio/templates/hyperframes-cover/package-lock.json +3 -3
- package/plugin/skills/readme-studio/templates/remotion-cover/package-lock.json +3 -3
- package/plugin/skills/review-work/SKILL.md +1 -1
- package/plugin/skills/start-work/SKILL.md +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Progress gauges for the lit-adhd brief (D9). Code draws them so the model copies them verbatim:
|
|
2
|
+
// `[▉▉▉░░] 3/5`, one cell per item up to ten, scaled above that. Returns null when either number
|
|
3
|
+
// is unknown — a gauge appears only when both numbers are real.
|
|
4
|
+
|
|
5
|
+
const MAX_CELLS = 10;
|
|
6
|
+
const known = (value) => Number.isInteger(value) && value >= 0;
|
|
7
|
+
|
|
8
|
+
export const gauge = (done, total) => {
|
|
9
|
+
if (!known(total) || !known(done)) return null;
|
|
10
|
+
const k = Math.min(done, total);
|
|
11
|
+
const cells = Math.min(total, MAX_CELLS);
|
|
12
|
+
let filled = k;
|
|
13
|
+
if (total > MAX_CELLS) filled = k === total ? MAX_CELLS : k === 0 ? 0 : Math.min(MAX_CELLS - 1, Math.max(1, Math.floor((k * MAX_CELLS) / total)));
|
|
14
|
+
return `[${'▉'.repeat(filled)}${'░'.repeat(cells - filled)}] ${k}/${total}`;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const progressOf = (done, total, remaining) => ({
|
|
18
|
+
done: known(done) ? done : null,
|
|
19
|
+
total: known(total) ? total : null,
|
|
20
|
+
gauge: gauge(done, total),
|
|
21
|
+
remaining: Array.isArray(remaining) && remaining.length ? remaining : known(total) && known(done) && done >= total ? [] : null,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const aggregateProgress = (items) => {
|
|
25
|
+
const done = items.reduce((sum, item) => sum + (known(item.done) ? item.done : 0), 0);
|
|
26
|
+
const total = items.every((item) => known(item.total)) ? items.reduce((sum, item) => sum + item.total, 0) : null;
|
|
27
|
+
return { done, total, gauge: gauge(done, total) };
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const charWidth = (codePoint) => {
|
|
31
|
+
if (codePoint === 0 || codePoint < 32 || (codePoint >= 0x7f && codePoint < 0xa0)) return 0;
|
|
32
|
+
if (/\p{Mn}|\p{Me}|\p{Cf}/u.test(String.fromCodePoint(codePoint)) || (codePoint >= 0x1160 && codePoint <= 0x11ff)) return 0;
|
|
33
|
+
if ((codePoint >= 0x1100 && codePoint <= 0x115f) || (codePoint >= 0x2e80 && codePoint <= 0xa4cf)
|
|
34
|
+
|| (codePoint >= 0xac00 && codePoint <= 0xd7a3) || (codePoint >= 0xf900 && codePoint <= 0xfaff)
|
|
35
|
+
|| (codePoint >= 0xfe30 && codePoint <= 0xfe4f) || (codePoint >= 0xff00 && codePoint <= 0xff60)
|
|
36
|
+
|| (codePoint >= 0xffe0 && codePoint <= 0xffe6) || (codePoint >= 0x1f300 && codePoint <= 0x1faff)
|
|
37
|
+
|| (codePoint >= 0x20000 && codePoint <= 0x3fffd)) return 2;
|
|
38
|
+
return 1;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const displayWidth = (text) => [...String(text)].reduce((sum, ch) => sum + charWidth(ch.codePointAt(0)), 0);
|
|
42
|
+
|
|
43
|
+
export const clipToWidth = (text, width) => {
|
|
44
|
+
const value = String(text);
|
|
45
|
+
if (displayWidth(value) <= width) return value;
|
|
46
|
+
let out = '';
|
|
47
|
+
let used = 0;
|
|
48
|
+
for (const ch of value) {
|
|
49
|
+
const w = charWidth(ch.codePointAt(0));
|
|
50
|
+
if (used + w > width - 1) break;
|
|
51
|
+
out += ch;
|
|
52
|
+
used += w;
|
|
53
|
+
}
|
|
54
|
+
return `${out}…`;
|
|
55
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// The one next step a lit-adhd brief offers, chosen by fixed priority over the collected records,
|
|
2
|
+
// and the small record `go` later reads back within 30 minutes:
|
|
3
|
+
// 1. this session's paused spine frame -> resume-frame (`lit continue`)
|
|
4
|
+
// 2. this session's active start-work -> continue-work
|
|
5
|
+
// 3. a single open plan with no work -> start-plan (`lit start plans/<plan>.md`)
|
|
6
|
+
// 4. otherwise -> none
|
|
7
|
+
// A start-work approval is typed as `lit approve` when the run asks for it; agy keeps no record of a
|
|
8
|
+
// pending one for a brief to offer.
|
|
9
|
+
|
|
10
|
+
import { closeSync, constants, fstatSync, mkdirSync, openSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import { dirname, join } from 'node:path';
|
|
12
|
+
import { safeId } from '../common.mjs';
|
|
13
|
+
|
|
14
|
+
export const chooseNextStep = (data, sessionId) => {
|
|
15
|
+
const ownStack = data.workflows.find((f) => f.sessionId === sessionId && f.role === 'spine' && f.status === 'paused');
|
|
16
|
+
if (sessionId && ownStack) {
|
|
17
|
+
return { kind: 'resume-frame', target: { skill: ownStack.skill, stage: ownStack.stage, progress: ownStack.progress.gauge ?? `${ownStack.progress.done ?? 0} done` }, say: 'lit continue' };
|
|
18
|
+
}
|
|
19
|
+
const own = data.startWork.find((w) => w.status === 'active' && sessionId && w.sessionId === sessionId);
|
|
20
|
+
if (own) return { kind: 'continue-work', target: { plan: own.plan }, say: 'go' };
|
|
21
|
+
const running = data.startWork.some((w) => ['active', 'paused'].includes(w.status));
|
|
22
|
+
const open = data.roadmap.plans.filter((p) => p.local && p.progress.total !== null && p.progress.done < p.progress.total);
|
|
23
|
+
if (!running && open.length === 1) {
|
|
24
|
+
return { kind: 'start-plan', target: { plan: open[0].plan }, say: 'go', command: `lit start ${open[0].plan}` };
|
|
25
|
+
}
|
|
26
|
+
return { kind: 'none', target: null };
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const nextStepPath = (root, conversationId) => {
|
|
30
|
+
const id = safeId(conversationId);
|
|
31
|
+
if (!id) return null;
|
|
32
|
+
return join(root, 'adhd', `next-${id}.json`);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const writeNextStep = (root, conversationId, step, now = new Date()) => {
|
|
36
|
+
const path = nextStepPath(root, conversationId);
|
|
37
|
+
if (!path) return null;
|
|
38
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
39
|
+
const staging = `${path}.${process.pid}.tmp`;
|
|
40
|
+
writeFileSync(staging, `${JSON.stringify({ kind: step.kind, target: step.target, at: now.toISOString() })}\n`);
|
|
41
|
+
renameSync(staging, path);
|
|
42
|
+
return path;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const GO_PROMPT = /^\s*(?:(?:lit\s+)?go|ㄱㄱ|고|진행)[\s.!?]*$/iu;
|
|
46
|
+
export const isGoPrompt = (prompt) => typeof prompt === 'string' && prompt.length <= 64 && GO_PROMPT.test(prompt);
|
|
47
|
+
|
|
48
|
+
export const NEXT_STEP_MAX_AGE_MS = 30 * 60_000;
|
|
49
|
+
const KINDS = new Set(['resume-frame', 'continue-work', 'start-plan', 'none']);
|
|
50
|
+
|
|
51
|
+
export const takeNextStep = (root, conversationId, now = Date.now()) => {
|
|
52
|
+
const path = nextStepPath(root, conversationId);
|
|
53
|
+
if (!path) return null;
|
|
54
|
+
let text;
|
|
55
|
+
try {
|
|
56
|
+
const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
57
|
+
try {
|
|
58
|
+
const stat = fstatSync(fd);
|
|
59
|
+
if (!stat.isFile() || stat.size > 16_384) return null;
|
|
60
|
+
text = readFileSync(fd, 'utf8');
|
|
61
|
+
} finally {
|
|
62
|
+
closeSync(fd);
|
|
63
|
+
}
|
|
64
|
+
} catch {
|
|
65
|
+
return null;
|
|
66
|
+
} finally {
|
|
67
|
+
try { unlinkSync(path); } catch { /* nothing to consume */ }
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const record = JSON.parse(text);
|
|
71
|
+
const age = now - Date.parse(record.at);
|
|
72
|
+
if (!KINDS.has(record.kind) || !(age >= -60_000 && age <= NEXT_STEP_MAX_AGE_MS)) return null;
|
|
73
|
+
return { kind: record.kind, target: record.target && typeof record.target === 'object' ? record.target : null };
|
|
74
|
+
} catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Redaction for every string the lit-adhd collector emits. Credential shapes, URI userinfo,
|
|
2
|
+
// secret-named NAME=value pairs and quoted "name": value pairs, one-time codes beside an auth word,
|
|
3
|
+
// environment values of 8+ characters, and the home directory. Shorter environment values are left
|
|
4
|
+
// alone: masking every short value would erase ordinary words.
|
|
5
|
+
|
|
6
|
+
const MASK = '[redacted]';
|
|
7
|
+
const SECRET_NAME = /KEY|TOKEN|SECRET|PASS|AUTH|COOKIE/iu;
|
|
8
|
+
const ASSIGNMENT = /\b([A-Za-z_][A-Za-z0-9_]*)=("[^"]*"|'[^']*'|[^\s"'`]+)/gu;
|
|
9
|
+
// A quoted key (JSON, a dict literal) names a secret when it ends in one; `author` does not.
|
|
10
|
+
const QUOTED_PAIR = /(["'])([A-Za-z_][A-Za-z0-9_-]*)\1(\s*:\s*)("(?:[^"\\]|\\.)*"|'[^']*'|[^\s,}\]]+)/gu;
|
|
11
|
+
const SECRET_KEY = /(?:key|token|secret|passw(?:or)?d|passphrase|cookie|credentials?|authorization|auth)$/iu;
|
|
12
|
+
const ONE_TIME = [
|
|
13
|
+
/\b((?:otp|passcode|pin|2fa|mfa|one[- ]time (?:code|password)|verification code|auth(?:entication)? code)\b[\s:=#-]*)\d{4,8}\b/giu,
|
|
14
|
+
/(인증\s*(?:번호|코드)\s*[:=]?\s*)\d{4,8}(?!\d)/gu,
|
|
15
|
+
];
|
|
16
|
+
// Terminal control: ESC/CSI/OSC sequences, other C0/C1 controls and bidi overrides would act on the
|
|
17
|
+
// terminal that shows the brief, so they go before anything else. Tab and newline stay.
|
|
18
|
+
const OSC = /\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)?/gu;
|
|
19
|
+
const CSI = /(?:\u001b\[|\u009b)[0-?]*[ -/]*[@-~]/gu;
|
|
20
|
+
const CONTROL = /[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/gu;
|
|
21
|
+
const PLAIN_ENV_NAMES = /^(?:PATH|HOME|PWD|OLDPWD|SHELL|USER|LOGNAME|LANG|LANGUAGE|TERM|TERM_PROGRAM|TERM_PROGRAM_VERSION|COLORTERM|EDITOR|VISUAL|PAGER|TMPDIR|SHLVL|LC_[A-Z]+|XPC_[A-Z_]+|__CF[A-Z_]*|COMMAND_MODE|_)$/u;
|
|
22
|
+
|
|
23
|
+
const SHAPES = [
|
|
24
|
+
/(?<![A-Za-z0-9_])(?:ghp|gho|ghu|ghs|ghr|github_pat)_[A-Za-z0-9_]{20,}(?![A-Za-z0-9_])/gu,
|
|
25
|
+
/(?<![A-Za-z0-9_])(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}(?![A-Za-z0-9_])/gu,
|
|
26
|
+
/\bsk-[A-Za-z0-9_-]{20,}\b/gu,
|
|
27
|
+
/(?<![A-Za-z0-9_])npm_[A-Za-z0-9]{20,}(?![A-Za-z0-9_])/gu,
|
|
28
|
+
/(?<![A-Z0-9])(?:AKIA|ASIA)[A-Z0-9]{16}(?![A-Z0-9])/gu,
|
|
29
|
+
/(?<![A-Za-z0-9_])xox[baprs]-[A-Za-z0-9-]{10,}(?![A-Za-z0-9_-])/gu,
|
|
30
|
+
/(?<![A-Za-z0-9_])AIza[0-9A-Za-z_-]{20,}(?![A-Za-z0-9_])/gu,
|
|
31
|
+
/\bbearer\s+[A-Za-z0-9._~+/=-]{12,}(?=$|[^A-Za-z0-9._~+/=-])/giu,
|
|
32
|
+
/\b(?:password|passwd|secret|token|api[_-]?key|access[_-]?token)\s*[:=]\s*[^\s,;]+/giu,
|
|
33
|
+
];
|
|
34
|
+
const USERINFO = /(?<![A-Za-z0-9+.-])(?:[A-Za-z][A-Za-z0-9+.-]*:)?\/\/[^/?#\s]+@/gu;
|
|
35
|
+
|
|
36
|
+
const envSecrets = (env) => Object.entries(env ?? {})
|
|
37
|
+
.filter(([name, value]) => typeof value === 'string' && value.length >= 8 && !PLAIN_ENV_NAMES.test(name)
|
|
38
|
+
&& !/^[~/]/u.test(value) && !value.includes(':/') && !/^(?:true|false|\d+)$/iu.test(value))
|
|
39
|
+
.map(([, value]) => value)
|
|
40
|
+
.sort((a, b) => b.length - a.length);
|
|
41
|
+
|
|
42
|
+
export const makeRedactor = ({ env = process.env, home = env?.HOME } = {}) => {
|
|
43
|
+
const values = envSecrets(env);
|
|
44
|
+
return (input) => {
|
|
45
|
+
if (typeof input !== 'string' || input === '') return input;
|
|
46
|
+
let text = input.replace(OSC, '').replace(CSI, '').replace(CONTROL, '');
|
|
47
|
+
for (const value of values) if (text.includes(value)) text = text.split(value).join(MASK);
|
|
48
|
+
text = text.replace(USERINFO, (match) => match.replace(/\/\/[^/?#\s]+@/u, `//${MASK}@`));
|
|
49
|
+
text = text.replace(ASSIGNMENT, (match, name) => (SECRET_NAME.test(name) ? `${name}=${MASK}` : match));
|
|
50
|
+
text = text.replace(QUOTED_PAIR, (match, quote, name, sep, value) => {
|
|
51
|
+
if (!SECRET_KEY.test(name)) return match;
|
|
52
|
+
const q = /^["']/u.test(value) ? value[0] : '';
|
|
53
|
+
return `${quote}${name}${quote}${sep}${q}${MASK}${q}`;
|
|
54
|
+
});
|
|
55
|
+
for (const pattern of ONE_TIME) text = text.replace(pattern, (match, lead) => `${lead}${MASK}`);
|
|
56
|
+
for (const pattern of SHAPES) text = text.replace(pattern, MASK);
|
|
57
|
+
if (typeof home === 'string' && home.length > 1) text = text.split(home).join('~');
|
|
58
|
+
return text;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// agy conversation transcripts for the lit-adhd collector. agy stores one JSONL file per conversation
|
|
2
|
+
// under `~/.gemini/antigravity-cli/brain/<id>/`. Each step has `step_index`, `source`, `type`,
|
|
3
|
+
// `status`, `content` and `created_at`. Files are read as head + tail only, under a shared budget,
|
|
4
|
+
// through descriptors opened without following links.
|
|
5
|
+
|
|
6
|
+
import { closeSync, constants, fstatSync, lstatSync, openSync, readSync, readdirSync } from 'node:fs';
|
|
7
|
+
import { join, relative } from 'node:path';
|
|
8
|
+
|
|
9
|
+
export const HEAD_BYTES = 64 * 1024;
|
|
10
|
+
export const TAIL_BYTES = 256 * 1024;
|
|
11
|
+
export const TOTAL_BUDGET_BYTES = 8 * 1024 * 1024;
|
|
12
|
+
const ACTIVE_MS = 15 * 60 * 1000;
|
|
13
|
+
|
|
14
|
+
export const makeBudget = (limit = TOTAL_BUDGET_BYTES) => ({ limit, used: 0, exhausted: false });
|
|
15
|
+
|
|
16
|
+
const readSlice = (fd, position, length, budget) => {
|
|
17
|
+
const allowed = Math.min(length, budget.limit - budget.used);
|
|
18
|
+
if (allowed <= 0) { budget.exhausted = true; return ''; }
|
|
19
|
+
const buffer = Buffer.alloc(allowed);
|
|
20
|
+
const read = readSync(fd, buffer, 0, allowed, position);
|
|
21
|
+
budget.used += read;
|
|
22
|
+
if (allowed < length) budget.exhausted = true;
|
|
23
|
+
return buffer.subarray(0, read).toString('utf8');
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const readTranscriptLines = (path, budget, { head = HEAD_BYTES, tail = TAIL_BYTES } = {}) => {
|
|
27
|
+
let fd;
|
|
28
|
+
try {
|
|
29
|
+
if (!lstatSync(path).isFile()) return null;
|
|
30
|
+
fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
31
|
+
const { size } = fstatSync(fd);
|
|
32
|
+
const chunks = size <= head + tail
|
|
33
|
+
? [readSlice(fd, 0, size, budget)]
|
|
34
|
+
: [readSlice(fd, 0, head, budget), readSlice(fd, size - tail, tail, budget)];
|
|
35
|
+
const lines = [];
|
|
36
|
+
for (const chunk of chunks) {
|
|
37
|
+
for (const line of chunk.split('\n')) {
|
|
38
|
+
if (!line.trim()) continue;
|
|
39
|
+
try {
|
|
40
|
+
const parsed = JSON.parse(line);
|
|
41
|
+
if (parsed && typeof parsed === 'object') lines.push(parsed);
|
|
42
|
+
} catch {
|
|
43
|
+
// Partial or malformed line at a slice edge is skipped.
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return lines;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
} finally {
|
|
51
|
+
if (fd !== undefined) closeSync(fd);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// agy 1.4.4 writes each conversation's steps to
|
|
56
|
+
// `~/.gemini/antigravity-cli/brain/<conversationId>/.system_generated/logs/transcript.jsonl` (the file the hook
|
|
57
|
+
// payload names as `transcriptPath`); `conversations/<id>.db` holds the host's own database and is never read.
|
|
58
|
+
// The transcript carries no workspace, so the collector passes the conversation ids it knows belong to the
|
|
59
|
+
// workspace (the route-state files under `$XDG_STATE_HOME/litgravity/sessions/<workspace hash>/`) and only those
|
|
60
|
+
// transcripts are opened. Without ids every conversation folder is listed.
|
|
61
|
+
export const transcriptPathOf = (geminiDir, id) => join(geminiDir, 'brain', id, '.system_generated', 'logs', 'transcript.jsonl');
|
|
62
|
+
|
|
63
|
+
export const findTranscripts = (geminiDir, ids = null) => {
|
|
64
|
+
let names = ids;
|
|
65
|
+
if (!names) {
|
|
66
|
+
try {
|
|
67
|
+
names = readdirSync(join(geminiDir, 'brain'), { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
|
|
68
|
+
} catch {
|
|
69
|
+
return { status: 'unknown', files: [] };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const files = [];
|
|
73
|
+
for (const id of names) {
|
|
74
|
+
const path = transcriptPathOf(geminiDir, id);
|
|
75
|
+
try {
|
|
76
|
+
const st = lstatSync(path);
|
|
77
|
+
if (st.isFile()) files.push({ id, path, mtimeMs: st.mtimeMs });
|
|
78
|
+
} catch {
|
|
79
|
+
// This conversation has no transcript yet.
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
files.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
83
|
+
return { status: files.length ? 'ok' : 'unknown', files };
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Tool arguments in the transcript are JSON-encoded strings (`"Path":"\"/a/b\""`); decode them once.
|
|
87
|
+
const argValue = (value) => {
|
|
88
|
+
if (typeof value !== 'string') return value;
|
|
89
|
+
try {
|
|
90
|
+
const parsed = JSON.parse(value);
|
|
91
|
+
return typeof parsed === 'string' ? parsed : value;
|
|
92
|
+
} catch {
|
|
93
|
+
return value;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const clip = (text, max) => {
|
|
98
|
+
const flat = String(text).replace(/\s+/gu, ' ').trim();
|
|
99
|
+
return flat.length > max ? `${flat.slice(0, max - 1)}…` : flat;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
function extractRequest(content) {
|
|
103
|
+
if (typeof content !== 'string') return null;
|
|
104
|
+
const m = /<USER_REQUEST>\r?\n?([\s\S]*?)\r?\n?<\/USER_REQUEST>/.exec(content);
|
|
105
|
+
return (m ? m[1] : content).trim();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const WRITE_TOOLS = new Set(['write_file', 'write_to_file', 'replace_file_content', 'multi_replace_file_content']);
|
|
109
|
+
// What a tool call was about, in a few words: a file's base name or a subagent's type. Never a command
|
|
110
|
+
// line, a search query or file contents.
|
|
111
|
+
const actionTarget = (args) => {
|
|
112
|
+
const path = argValue(args?.Path ?? args?.TargetFile ?? args?.AbsolutePath);
|
|
113
|
+
if (typeof path === 'string' && path) return path.split(/[\\/]/u).at(-1);
|
|
114
|
+
const type = argValue(args?.TypeName);
|
|
115
|
+
return typeof type === 'string' && type ? type : null;
|
|
116
|
+
};
|
|
117
|
+
const WAITING_TEXT = /[??]\s*$|`?lit approve`?|`?lit deny`?|승인해\s*주|확인해\s*주|괜찮을까요|할까요/iu;
|
|
118
|
+
const APPROVAL_TEXT = /`?lit approve`?|`?lit deny`?|승인해\s*주/iu;
|
|
119
|
+
const BLOCKED_TEXT = /^\s*BLOCKED\b/mu;
|
|
120
|
+
|
|
121
|
+
// Why the newest turn ends waiting on the user, read from the steps after the last prompt: `question` when it called
|
|
122
|
+
// ask_question, `BLOCKED` for a blocked report, `approve` when it asks for a typed approval, `asked` for any other
|
|
123
|
+
// closing question, else null. The status line shows it; the brief marks the same turns waiting-on-user.
|
|
124
|
+
export const waitingReason = (lines) => {
|
|
125
|
+
if (!Array.isArray(lines)) return null;
|
|
126
|
+
const from = lines.findLastIndex((l) => l?.type === 'USER_INPUT');
|
|
127
|
+
let text = null;
|
|
128
|
+
let asked = false;
|
|
129
|
+
for (const line of lines.slice(from + 1)) {
|
|
130
|
+
if (line?.type !== 'PLANNER_RESPONSE') continue;
|
|
131
|
+
if (Array.isArray(line.tool_calls) && line.tool_calls.length) asked = line.tool_calls.some((c) => /ask_question/i.test(String(c?.name ?? '')));
|
|
132
|
+
if (typeof line.content === 'string' && line.content.trim()) text = line.content;
|
|
133
|
+
}
|
|
134
|
+
if (asked) return 'question';
|
|
135
|
+
if (!text) return null;
|
|
136
|
+
const tail = text.slice(-400);
|
|
137
|
+
if (BLOCKED_TEXT.test(text)) return 'BLOCKED';
|
|
138
|
+
if (APPROVAL_TEXT.test(tail)) return 'approve';
|
|
139
|
+
return WAITING_TEXT.test(tail) ? 'asked' : null;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// One session's record from its agy transcript lines.
|
|
143
|
+
export const sessionRecord = (lines, { redact = (t) => t, now = Date.now(), cwd: workspace = null } = {}) => {
|
|
144
|
+
if (!lines || !lines.length) return null;
|
|
145
|
+
let cwd = workspace;
|
|
146
|
+
let started = null;
|
|
147
|
+
let last = null;
|
|
148
|
+
let lastEntry = null;
|
|
149
|
+
const prompts = [];
|
|
150
|
+
const tools = {};
|
|
151
|
+
const files = [];
|
|
152
|
+
let result = null;
|
|
153
|
+
let lastAction = null;
|
|
154
|
+
for (const line of lines) {
|
|
155
|
+
if (typeof line.cwd === 'string') cwd ??= line.cwd;
|
|
156
|
+
const at = Date.parse(line.created_at);
|
|
157
|
+
if (Number.isFinite(at)) {
|
|
158
|
+
started = started === null ? at : Math.min(started, at);
|
|
159
|
+
last = last === null ? at : Math.max(last, at);
|
|
160
|
+
}
|
|
161
|
+
if (line.type === 'USER_INPUT' && typeof line.content === 'string') {
|
|
162
|
+
const text = extractRequest(line.content);
|
|
163
|
+
if (text) {
|
|
164
|
+
prompts.push(text);
|
|
165
|
+
lastEntry = { role: 'user', text };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (line.type === 'PLANNER_RESPONSE' && typeof line.content === 'string' && line.content.trim()) {
|
|
169
|
+
result = line.content;
|
|
170
|
+
lastEntry = { role: 'assistant', text: line.content };
|
|
171
|
+
}
|
|
172
|
+
if (line.type === 'PLANNER_RESPONSE' && Array.isArray(line.tool_calls)) {
|
|
173
|
+
for (const call of line.tool_calls) {
|
|
174
|
+
if (typeof call?.name !== 'string') continue;
|
|
175
|
+
tools[call.name] = (tools[call.name] ?? 0) + 1;
|
|
176
|
+
const path = argValue(call.args?.Path ?? call.args?.TargetFile);
|
|
177
|
+
if (WRITE_TOOLS.has(call.name) && typeof path === 'string') files.push(path);
|
|
178
|
+
const target = actionTarget(call.args);
|
|
179
|
+
lastAction = { tool: call.name, ...(target ? { target } : {}) };
|
|
180
|
+
lastEntry = { role: 'tool' };
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const relativeFile = (path) => {
|
|
185
|
+
if (!cwd) return path;
|
|
186
|
+
const inside = relative(cwd, path);
|
|
187
|
+
return inside && !inside.startsWith('..') ? inside : path;
|
|
188
|
+
};
|
|
189
|
+
const changed = [...new Set(files.reverse())].slice(0, 5).map((p) => redact(relativeFile(p)));
|
|
190
|
+
const asked = [...new Set([prompts[0], prompts.at(-1)].filter(Boolean))].slice(0, 2).map((t) => clip(redact(t), 160));
|
|
191
|
+
const waiting = lastEntry?.role === 'assistant' && WAITING_TEXT.test(lastEntry.text.slice(-400));
|
|
192
|
+
const status = last === null ? 'unknown' : waiting ? 'waiting-on-user' : now - last < ACTIVE_MS ? 'active' : 'ended';
|
|
193
|
+
// agy does not carry a sessionId in the transcript; use the conversation folder name if available.
|
|
194
|
+
const sessionId = lines.find((l) => typeof l.conversation_id === 'string')?.conversation_id ?? null;
|
|
195
|
+
return {
|
|
196
|
+
sessionId,
|
|
197
|
+
id8: sessionId ? sessionId.slice(0, 8) : 'unknown',
|
|
198
|
+
worktree: cwd ? redact(cwd) : 'unknown',
|
|
199
|
+
cwd,
|
|
200
|
+
started: started === null ? 'unknown' : new Date(started).toISOString(),
|
|
201
|
+
last: last === null ? 'unknown' : new Date(last).toISOString(),
|
|
202
|
+
lastMs: last,
|
|
203
|
+
title: clip(redact(prompts[0] ?? 'unknown'), 80),
|
|
204
|
+
asked: asked.length ? asked : ['unknown'],
|
|
205
|
+
done: { tools, files: changed, commits: [] },
|
|
206
|
+
lastAction: lastAction ? { tool: clip(redact(lastAction.tool), 40), ...(lastAction.target ? { target: clip(redact(lastAction.target), 60) } : {}) } : null,
|
|
207
|
+
result: result ? clip(redact(result), 240) : 'unknown',
|
|
208
|
+
status,
|
|
209
|
+
...(waiting ? { waitingReason: 'asked the user' } : {}),
|
|
210
|
+
};
|
|
211
|
+
};
|
|
@@ -5,6 +5,7 @@ export const SKILL_ROUTES = [
|
|
|
5
5
|
{ id: 'lit-loop', when: 'bare `lit`, or a multi-step task that needs criteria, tests and proof' },
|
|
6
6
|
{ id: 'litgoal', when: 'set, check or close a finish line that outlives this conversation' },
|
|
7
7
|
{ id: 'litwork', when: 'ship one contained change with proof: implement, fix, land' },
|
|
8
|
+
{ id: 'lit-hijack', when: 'port the know-how from someone else\'s published work into your own skill or system, clean-room' },
|
|
8
9
|
{ id: 'lit-plan', when: 'plan before code; the turn writes plans/<slug>.md and nothing else' },
|
|
9
10
|
{ id: 'lit-brainstorm', when: 'open ideation: spread out on options, score a shortlist, hand off' },
|
|
10
11
|
{ id: 'deep-interview', when: 'the request is vague or broad and needs questions first' },
|
|
@@ -30,12 +31,14 @@ export const SKILL_ROUTES = [
|
|
|
30
31
|
{ id: 'readme-studio', when: 'write or refresh a README from repository facts' },
|
|
31
32
|
{ id: 'lit-docx', when: 'a Word document, or DOCX/PDF converted to Markdown (needs Python)' },
|
|
32
33
|
{ id: 'lit-pptx', when: 'a slide deck (needs Python)' },
|
|
34
|
+
{ id: 'lit-schematic', when: 'a P&ID, PFD, equipment layout, journal apparatus figure or isometric cutaway of real hardware' },
|
|
33
35
|
{ id: 'lit-scientific-visualization', when: 'a publication-ready figure from data' },
|
|
34
36
|
{ id: 'lit-diagram-drawer', when: 'an architecture, workflow or timeline diagram' },
|
|
35
37
|
{ id: 'lit-typographic-motion', when: 'a short film, kinetic type, lyric video or a seamless README cover loop' },
|
|
36
38
|
{ id: 'autoresearch', when: 'a budgeted experiment loop against a metric' },
|
|
37
39
|
{ id: 'structural-search', when: 'find or rewrite code by syntax shape' },
|
|
38
40
|
{ id: 'browser-drive', when: 'the answer only exists inside a running web page' },
|
|
41
|
+
{ id: 'lit-adhd', when: 'cross-session brief: what each recent session was asked, did and waits on, with progress gauges' },
|
|
39
42
|
{ id: 'lit-team', when: 'two or more child agents behind one durable team packet' },
|
|
40
43
|
{ id: 'autoconference', when: 'a budgeted research conference: parallel researchers, review, synthesis' },
|
|
41
44
|
{ id: 'rules', when: 'which rules, AGENTS.md files and skills agy loads, and in what order' },
|
|
@@ -44,11 +47,18 @@ export const SKILL_ROUTES = [
|
|
|
44
47
|
];
|
|
45
48
|
|
|
46
49
|
export const SKILL_IDS = new Set(SKILL_ROUTES.map((r) => r.id));
|
|
50
|
+
// Skill ids that are another name for a skill: typed whole, slashed or after `lit`, they take its route.
|
|
51
|
+
export const SKILL_ALIASES = { 'lit-rewind': 'lit-adhd' };
|
|
52
|
+
const skillId = (word) => (SKILL_IDS.has(word) ? word : SKILL_ALIASES[word]);
|
|
47
53
|
|
|
48
54
|
// The word after a leading `lit` picks the route: a word below, or any skill id typed whole (`lit debugging …`,
|
|
49
55
|
// `lit comment-checker …`); anything else falls back to lit-loop.
|
|
50
56
|
export const KEYWORD_ROUTES = {
|
|
51
57
|
loop: 'lit-loop',
|
|
58
|
+
hijack: 'lit-hijack',
|
|
59
|
+
hijacking: 'lit-hijack',
|
|
60
|
+
'하이재킹': 'lit-hijack',
|
|
61
|
+
'하이잭': 'lit-hijack',
|
|
52
62
|
plan: 'lit-plan',
|
|
53
63
|
work: 'litwork',
|
|
54
64
|
goal: 'litgoal',
|
|
@@ -73,6 +83,8 @@ export const KEYWORD_ROUTES = {
|
|
|
73
83
|
ideate: 'lit-brainstorm',
|
|
74
84
|
idea: 'lit-brainstorm',
|
|
75
85
|
ideas: 'lit-brainstorm',
|
|
86
|
+
adhd: 'lit-adhd',
|
|
87
|
+
rewind: 'lit-adhd',
|
|
76
88
|
team: 'lit-team',
|
|
77
89
|
conference: 'autoconference',
|
|
78
90
|
rules: 'rules',
|
|
@@ -93,11 +105,21 @@ export const KEYWORD_ROUTES = {
|
|
|
93
105
|
pptx: 'lit-pptx',
|
|
94
106
|
ppt: 'lit-pptx',
|
|
95
107
|
docx: 'lit-docx',
|
|
108
|
+
schematic: 'lit-schematic',
|
|
109
|
+
pid: 'lit-schematic',
|
|
110
|
+
pfd: 'lit-schematic',
|
|
111
|
+
cutaway: 'lit-schematic',
|
|
112
|
+
'계통도': 'lit-schematic',
|
|
113
|
+
'공정도': 'lit-schematic',
|
|
114
|
+
'모식도': 'lit-schematic',
|
|
115
|
+
'장치도': 'lit-schematic',
|
|
96
116
|
diagram: 'lit-diagram-drawer',
|
|
97
117
|
'다이어그램': 'lit-diagram-drawer',
|
|
98
118
|
'도식': 'lit-diagram-drawer',
|
|
99
119
|
figure: 'lit-scientific-visualization',
|
|
100
120
|
plot: 'lit-scientific-visualization',
|
|
121
|
+
frontend: 'frontend-ui-ux',
|
|
122
|
+
ui: 'frontend-ui-ux',
|
|
101
123
|
code: 'lit-code',
|
|
102
124
|
tdd: 'lit-code',
|
|
103
125
|
structural: 'structural-search',
|
|
@@ -128,8 +150,54 @@ export function motionIntent(task) {
|
|
|
128
150
|
return FILM_COMPOUND.test(text) || (VIDEO_NOUN.test(text) && MAKE_VERB.test(text));
|
|
129
151
|
}
|
|
130
152
|
|
|
153
|
+
// Physical schematics: P&IDs, PFDs, apparatus figures, isometric cutaways. A strong noun names a drawing and routes
|
|
154
|
+
// alone; a weak noun needs a draw or make verb. Interface deliverables and chart nouns stay with their owners.
|
|
155
|
+
const SCHEMATIC_STRONG = /\bp\s?&\s?i\s?ds?\b|\bpfds?\b|\bbfds?\b|piping\s+(?:and|&)\s+instrumentation|process\s+flow\s+(?:diagram|sheet)s?|block\s+flow\s+diagrams?|\bplot\s+plans?\b|equipment\s+layouts?|experimental\s+(?:set\s?up|apparatus)|\bcut\s?aways?\b|컷어웨이|배관\s?계장도|계장도|공정\s?흐름도|공정도|모식도|장치도|실험\s?장치|피앤아이디|배치도|계통도|단면도/iu;
|
|
156
|
+
const SCHEMATIC_WEAK = /\bschematics?\b|\bisometric\b|\bapparatus\b|사시도|개략도|아이소메트릭|도면/iu;
|
|
157
|
+
const SCHEMATIC_CHART = /차트|그래프|\b(?:charts?|graphs?|plots?(?!\s+plans?\b))\b/iu;
|
|
158
|
+
const SCHEMATIC_DRAW_VERB = /\b(?:draw|drawing|drew|sketch|sketching|illustrate|illustrating|render|rendering|redraw)\b|그려|그리|그림|도식|작도/iu;
|
|
159
|
+
const SCHEMATIC_INTERFACE = /\b(?:dashboards?|landing\s?pages?|web\s?pages?|websites?|homepages?|web\s?apps?|apps?|screens?|admin\s?(?:panel|console)|user\s?interface|ui)\b|대시보드|웹사이트|랜딩|페이지|화면|앱/iu;
|
|
160
|
+
const SCHEMATIC_MAKE_VERB = /\b(?:make|making|create|creating|design|designing|build|lay\s?out)\b|만들|만드/iu;
|
|
161
|
+
const SCHEMATIC_OFFICE = /보고서|발표자료|슬라이드|문서|\b(?:reports?|slides?|presentations?|documents?)\b/iu;
|
|
162
|
+
export function schematicIntent(task) {
|
|
163
|
+
const text = String(task ?? '');
|
|
164
|
+
if (SCHEMATIC_CHART.test(text)) return false;
|
|
165
|
+
if (SCHEMATIC_INTERFACE.test(text) && !SCHEMATIC_DRAW_VERB.test(text)) return false;
|
|
166
|
+
if (SCHEMATIC_OFFICE.test(text) && !SCHEMATIC_DRAW_VERB.test(text)) return false;
|
|
167
|
+
if (SCHEMATIC_STRONG.test(text)) return true;
|
|
168
|
+
return SCHEMATIC_WEAK.test(text) && (SCHEMATIC_DRAW_VERB.test(text) || SCHEMATIC_MAKE_VERB.test(text));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// A slide count beside a slide noun ("덱 10장", "a 10-slide deck") asks for the deck without a making verb.
|
|
172
|
+
const SLIDE_COUNT = /\d+\s?장|\b\d+[\s-]?slides?\b/u;
|
|
173
|
+
const SLIDE_NOUN = /덱|슬라이드|발표자료|프레젠테이션|피티|\bdecks?\b|\bslides?\b|\bpresentations?\b/iu;
|
|
174
|
+
const OFFICE_VERB = /만들|작성|써|쓰|뽑아|정리|\b(?:make|create|write|draft|prepare|build)\b/iu;
|
|
175
|
+
const PHOTO_NOT_SLIDE = /사진|이미지|보정|편집|촬영|\bphotos?\b|\bimages?\b/iu;
|
|
176
|
+
export function deckIntent(task) {
|
|
177
|
+
const text = String(task ?? '');
|
|
178
|
+
if (PHOTO_NOT_SLIDE.test(text)) return false;
|
|
179
|
+
const counted = SLIDE_COUNT.test(text) && SLIDE_NOUN.test(text);
|
|
180
|
+
return counted || (SLIDE_NOUN.test(text) && OFFICE_VERB.test(text));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// An English build-intent task ("build a landing page", "create a dashboard") goes to frontend-ui-ux.
|
|
184
|
+
// The verb and noun halves are both required so "build an API" or "design the schema" stay inert.
|
|
185
|
+
// Korean verbs (만들, 디자인, 꾸미, etc.) with a surface noun (화면, 페이지, 대시보드, 인터페이스) also route.
|
|
186
|
+
const UI_BUILD_VERB = /\b(?:build|create|make(?!\s+sure\b)|implement|code|develop)\b/u;
|
|
187
|
+
const UI_PAGE_NOUN = /\b(?:landing\s?page|web\s?page|website|web\s?site|homepage|home\s?page|dashboard|admin\s?(?:panel|console|ui)|settings\s?(?:page|screen)|(?:sign\s?up|log\s?in|checkout|pricing|profile|onboarding)\s?(?:page|screen|form|flow)|user\s?interface|web\s?ui|front\s?end|ui)\b/u;
|
|
188
|
+
const UI_DESIGN_VERB = /\b(?:re)?(?:design(?:ing|ed)?|styl(?:e|ing|ed)|skin(?:ning)?|theme|theming)\b|\b(?:mock\s?-?up|lay\s?out|polish(?:ing)?|revamp)\b|디자인|만들|만드|개편|꾸미|꾸며|다듬|배치|구성/u;
|
|
189
|
+
const UI_SURFACE_NOUN = /\b(?:ui|ux|interface|screen|page|view|component|layout|dashboard|css|styling|stylesheet|typography|palette|dark\s?mode|responsive)\b|화면|페이지|인터페이스|레이아웃|대시보드|컴포넌트|스타일|테마|다크\s?모드|반응형|디자인\s?시스템|사이드바|푸터|툴바|위젯/u;
|
|
190
|
+
const NON_INTERFACE_BUILD = /\b(?:grafana|kibana|datadog|metabase|looker|tableau|power\s?bi|backend|back\s?end|api|endpoint|docker|image|cli|migration|schema)\b/iu;
|
|
191
|
+
export function frontendIntent(task) {
|
|
192
|
+
const text = String(task ?? '');
|
|
193
|
+
if (NON_INTERFACE_BUILD.test(text)) return false;
|
|
194
|
+
if (UI_BUILD_VERB.test(text) && UI_PAGE_NOUN.test(text)) return true;
|
|
195
|
+
return UI_DESIGN_VERB.test(text) && UI_SURFACE_NOUN.test(text);
|
|
196
|
+
}
|
|
197
|
+
|
|
131
198
|
const RESTART_WORDS = new Set(['new', 'restart']);
|
|
132
199
|
const CONTINUE_WORDS = new Set(['continue', 'resume']);
|
|
200
|
+
const APPROVE_WORDS = new Set(['approve', 'deny']);
|
|
133
201
|
const SEPARATORS = /^[\s:,.!?]+/;
|
|
134
202
|
const firstWord = (s) => (/^([^\s:,.!?]+)/.exec(s)?.[1] ?? '').toLowerCase();
|
|
135
203
|
|
|
@@ -157,17 +225,23 @@ export function detectRoute(prompt) {
|
|
|
157
225
|
word = firstWord(rest);
|
|
158
226
|
}
|
|
159
227
|
const resume = !restart && CONTINUE_WORDS.has(word);
|
|
228
|
+
const approve = !restart && !resume && APPROVE_WORDS.has(word);
|
|
160
229
|
const bare = !restart && (word === '' || (resume && rest.slice(word.length).trim() === ''));
|
|
161
|
-
const route = KEYWORD_ROUTES[word] ?? (
|
|
162
|
-
const base = { keyword: route ? word : null, bare, resume, restart, direct: false, empty: word === '' || (resume && rest.slice(word.length).trim() === '') };
|
|
163
|
-
if (!route && !bare && !resume
|
|
230
|
+
const route = KEYWORD_ROUTES[word] ?? skillId(word);
|
|
231
|
+
const base = { keyword: route ? word : null, bare, resume, restart, approve: approve ? word : null, direct: false, empty: word === '' || (resume && rest.slice(word.length).trim() === '') };
|
|
232
|
+
if (!route && !bare && !resume) {
|
|
233
|
+
if (schematicIntent(rest)) return { route: 'lit-schematic', ...base, keyword: null };
|
|
234
|
+
if (motionIntent(rest)) return { route: 'lit-typographic-motion', ...base, keyword: null };
|
|
235
|
+
if (deckIntent(rest)) return { route: 'lit-pptx', ...base, keyword: null };
|
|
236
|
+
if (frontendIntent(rest)) return { route: 'frontend-ui-ux', ...base, keyword: null };
|
|
237
|
+
}
|
|
164
238
|
const hit = { route: route ?? 'lit-loop', ...base };
|
|
165
239
|
if (hit.route === 'review-work') {
|
|
166
240
|
hit.reviewMode = REVIEW_MODES[firstWord(rest.slice(word.length).replace(SEPARATORS, ''))] ?? null;
|
|
167
241
|
}
|
|
168
242
|
return hit;
|
|
169
243
|
}
|
|
170
|
-
|
|
171
|
-
if (
|
|
244
|
+
const id = skillId(lower);
|
|
245
|
+
if (id && (lower.startsWith('lit') || slash)) return { route: id, keyword: null, bare: false, resume: false, restart: false, direct: true, empty: false };
|
|
172
246
|
return null;
|
|
173
247
|
}
|