@litfamily/litcodex 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-Ko-KR.md +9 -9
- package/README.md +9 -9
- package/dist/install/generated-skill-payload-hashes.d.ts +12 -12
- package/dist/install/generated-skill-payload-hashes.js +12 -12
- package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
- package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
- package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
- package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.js +65 -26
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-mcp.js +26 -5
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.js +9 -5
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.d.ts +5 -2
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +10 -11
- package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.d.ts +9 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.js +23 -5
- package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
- package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
- package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
- package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
- package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
- package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
- package/marketplace/plugins/litcodex/skills/lit-docx/SKILL.md +2 -2
- package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/01-report-ko.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-humanizer/references/taxonomy.md +2 -0
- package/marketplace/plugins/litcodex/skills/lit-humanizer/rules.json +52 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/SKILL.md +2 -2
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/authoring-guide.md +3 -4
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/data-display-cookbook.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/density-and-fill.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/04-research-talk-paper-en.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/layout-families.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/paper.md +2 -2
- package/marketplace/plugins/litcodex/skills/lit-pptx/specs/markdown-slide-spec-v1.md +1 -1
- package/node_modules/@litcodex/lit-loop/dist/card-html.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/card-html.js +65 -26
- package/node_modules/@litcodex/lit-loop/dist/card-mcp.js +26 -5
- package/node_modules/@litcodex/lit-loop/dist/card-status.d.ts +2 -0
- package/node_modules/@litcodex/lit-loop/dist/card-status.js +9 -5
- package/node_modules/@litcodex/lit-loop/dist/hook-cli.d.ts +5 -2
- package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +10 -11
- package/node_modules/@litcodex/lit-loop/dist/live-step.d.ts +9 -1
- package/node_modules/@litcodex/lit-loop/dist/live-step.js +23 -5
- package/node_modules/@litcodex/lit-loop/package.json +1 -1
- package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/taxonomy.md +2 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/rules.json +52 -1
- package/package.json +2 -2
- package/readme-assets/badge-version.svg +1 -1
|
@@ -17,6 +17,8 @@ This original category comes from the 26 real lines in fixtures/pos-real.txt and
|
|
|
17
17
|
- ko-bracket-status-tag and en-bracket-status-tag — ko/en, block. Replace bracket keys with a sentence describing the status.
|
|
18
18
|
- ko-standalone-scope-disclaimer and en-standalone-scope-disclaimer — ko/en, block for stock disclaimers. Preserve a user-requested legal, medical or safety notice and place it once where it applies.
|
|
19
19
|
- ko-status-negation, ko-mi-status, en-epistemic-negation and en-not-performed — warnings. A negative result or unperformed action may be the finding. Write the actor, scope and verb plainly; never turn unknown into false or an estimate into a fact.
|
|
20
|
+
- ko-negative-pledge, ko-negative-pledge-repeat and en-negative-pledge — ko/en, block. A sentence that says what the document, table or number is not for (not a comparison, not a ranking, not to be read as a conclusion, not a public-use figure, the deck makes no claim) is a pledge about the artifact, not a finding. In a Codex edit it is refused before the write lands, so rewrite it: put the purpose boundary in the chat reply, or turn it into the fact it protects, written once beside the number it affects ("샘플은 한 공정 조건만 포함한다"). ko-negative-pledge is line-scoped and matches a self-reference subject with a negated claim verb, a comparison or ranking noun with a negated use verb, or a purpose-용 data noun with 아님; ko-negative-pledge-repeat fires when two such disclaimer sentences share a document; en-negative-pledge needs a comparison, benchmark or ranking noun. Operating rules (방폭 구역에서 사용하지 않습니다), method facts, negative findings and standard legal or financial notices stay outside these rules.
|
|
21
|
+
- ko-status-negation also covers the 쓰지 form, the ~지 않습니다 and ~지 않았습니다 endings, and bold-wrapped endings. It stays a warning: a method fact such as 실제 운영 데이터로 검증하지 않았습니다 may be exactly what the reader needs, and a lone 아님 or 쓰지 않음 sentence is judged by that warning rather than by the block rules above.
|
|
20
22
|
- ko-plain-meta-label-warn and en-plain-caveat-label — warnings for boundary headings. They may be useful in internal or technical packets.
|
|
21
23
|
- en-knowledge-cutoff, en-ai-self-disclaimer, en-hope-helps and ko-chatbot-signoff — block. Remove the model wrapper or generic sign-off, then retain the answer.
|
|
22
24
|
- ko-chatbot-opener and en-chatbot-opener — block stock greetings and praise at the start of a deliverable.
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"id": "ko-status-negation",
|
|
186
186
|
"lang": "ko",
|
|
187
187
|
"severity": "warn",
|
|
188
|
-
"pattern": "(?:검증|실측|측정|실행|실시|시작|확인|보장|평가|판단|조언|의미|증명|재현|사용|제공|적용|쓰)(?:[된한]
|
|
188
|
+
"pattern": "(?:검증|실측|측정|실행|실시|시작|확인|보장|평가|판단|조언|의미|증명|재현|사용|제공|적용|쓰)(?:[된한](?:\\s*(?:적이|값이))?|하지(?:\\s*않(?:음|는다|았다))?|되지\\s*않(?:음|는다|았다)|(?<=쓰)지|이|은|는)?\\s*(?:(?:\\*\\*|__)\\s*)?(?:아님|않음|않는다|않았다|않습니다|않았습니다|없음)|보류",
|
|
189
189
|
"flags": "im",
|
|
190
190
|
"scope": "line",
|
|
191
191
|
"context": [
|
|
@@ -879,6 +879,57 @@
|
|
|
879
879
|
"en-chatbot-closer:positive",
|
|
880
880
|
"en-chatbot-closer:negative"
|
|
881
881
|
]
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
"id": "ko-negative-pledge",
|
|
885
|
+
"lang": "ko",
|
|
886
|
+
"severity": "block",
|
|
887
|
+
"pattern": "(?<![가-힣])(?:이|본|해당|위|아래)\\s+(?:자료|문서|보고서|슬라이드|덱|표|그림|그래프|차트|수치|결과|비교|분석|내용|예시)(?:은|는)\\s[^.!?\\n]{0,40}?(?:(?:해석하|의미하|주장하|대표하)(?:지\\s*(?:[*_]{1,2}\\s*)?(?:않(?:음|는다|습니다)|말\\s*것|마세요|마십시오)|(?:으)?면\\s*(?:[*_]{1,2}\\s*)?안\\s*(?:됨|된다|됩니다))|(?:(?:비교|결론|벤치마크|순위|대표값|일반화)(?:이|가)|목적이|위한\\s*것이)\\s*(?:[*_]{1,2}\\s*)?(?:아님|아니다|아닙니다)(?![가-힣]))|(?:비교|결론|벤치마크|순위|대표값|일반화)(?:으로|로)\\s*(?:[*_]{1,2}\\s*)?(?:쓰|사용하|해석하|읽|간주하|인용하)(?:지\\s*(?:[*_]{1,2}\\s*)?(?:않(?:음|는다|습니다)|말\\s*것|마세요|마십시오)|(?:으)?면\\s*(?:[*_]{1,2}\\s*)?안\\s*(?:됨|된다|됩니다))|(?:공개|배포|대외|외부|홍보|발표|보고|비교|인용|공식)용\\s*(?:자료|문서|수치|표|그래프)(?:이|가)\\s*(?:[*_]{1,2}\\s*)?(?:아님|아니다|아닙니다)(?![가-힣])",
|
|
888
|
+
"flags": "m",
|
|
889
|
+
"scope": "line",
|
|
890
|
+
"context": [
|
|
891
|
+
"fenced_code",
|
|
892
|
+
"quoted_user_text"
|
|
893
|
+
],
|
|
894
|
+
"rationale": "A line that tells the reader what the document, table or number is not for does not belong in the deliverable; it goes in the chat reply, or it is rewritten as a fact about the data. Three shapes are refused: a self-reference topic (이/본/해당/위/아래 plus a document noun) followed by a negated claim verb or a claim noun plus 아님 on the same line; a comparison, conclusion or ranking noun plus (으)로 and a negated use verb; and a purpose-용 data noun such as 공개용 수치 plus 아님. Use verbs after a self-reference, 근거/평가/증거/추천, and the legal or financial notice verbs (대체하, 보장하, 권유) stay outside the pattern, because operating rules, method lines and standard notices are written with them.",
|
|
895
|
+
"fixture_ids": [
|
|
896
|
+
"ko-negative-pledge:positive",
|
|
897
|
+
"ko-negative-pledge:negative"
|
|
898
|
+
]
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
"id": "ko-negative-pledge-repeat",
|
|
902
|
+
"lang": "ko",
|
|
903
|
+
"severity": "block",
|
|
904
|
+
"pattern": "(?:(?:해석하|주장하|대표하)지\\s*(?:[*_]{1,2}\\s*)?않(?:음|습니다)|(?:비교|결론|벤치마크|순위|대표값|일반화)(?:이|가)\\s*(?:[*_]{1,2}\\s*)?(?:아님|아닙니다)(?![가-힣]))(?:[*_]{1,2})?(?=\\s*(?:[.!?。]|$))[\\s\\S]*?(?:(?:해석하|주장하|대표하)지\\s*(?:[*_]{1,2}\\s*)?않(?:음|습니다)|(?:비교|결론|벤치마크|순위|대표값|일반화)(?:이|가)\\s*(?:[*_]{1,2}\\s*)?(?:아님|아닙니다)(?![가-힣]))(?:[*_]{1,2})?(?=\\s*(?:[.!?。]|$))",
|
|
905
|
+
"flags": "m",
|
|
906
|
+
"scope": "document",
|
|
907
|
+
"context": [
|
|
908
|
+
"fenced_code",
|
|
909
|
+
"quoted_user_text"
|
|
910
|
+
],
|
|
911
|
+
"rationale": "Two or more sentences that end in 해석하지/주장하지/대표하지 않음, or in a claim noun plus 이/가 plus 아님, turn a document into a list of disclaimers. 의미하, 간주하, 인용하 and the use verbs are left out because repeated definitions, data-handling rules and operating rules end the same way. A single such sentence is left to the advisory ko-status-negation rule.",
|
|
912
|
+
"fixture_ids": [
|
|
913
|
+
"ko-negative-pledge-repeat:positive",
|
|
914
|
+
"ko-negative-pledge-repeat:negative"
|
|
915
|
+
]
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
"id": "en-negative-pledge",
|
|
919
|
+
"lang": "en",
|
|
920
|
+
"severity": "block",
|
|
921
|
+
"pattern": "\\b(?:this|these)\\s+(?:deck|report|document|analysis|table|chart|figure|figures|numbers|results|slide|comparison)\\s+(?:(?:is|are)\\s+not\\s+(?:intended|meant|to\\s+be\\s+(?:read|used|taken|interpreted))(?:\\s+to\\s+be\\s+(?:read|used|taken|interpreted))?\\s+as\\b(?!\\s*(?:a\\s+substitute|a\\s+replacement|(?:legal|investment|medical|professional)\\s+advice))\\s+(?:an?\\s+|the\\s+)?(?:[A-Za-z0-9-]+\\s+){0,4}?(?:comparison|benchmark|ranking)s?\\b(?!-)(?!\\s+(?:arm|arms|group|groups|standard|standards|class|baseline)\\b)|(?:should|must)\\s+not\\s+be\\s+(?:read|used|taken|interpreted)\\s+as\\s+(?:an?\\s+|the\\s+)?(?:[A-Za-z0-9-]+\\s+){0,4}?(?:comparison|benchmark|ranking)s?\\b(?!-)(?!\\s+(?:arm|arms|group|groups|standard|standards|class|baseline)\\b)|makes?\\s+no\\s+claims?\\s+(?:about|that|regarding|as\\s+to)\\b)|\\b(?:this|these)\\s+(?:is|are)\\s+not\\s+(?:intended|meant)\\s+as\\b(?!\\s*(?:a\\s+substitute|a\\s+replacement|(?:legal|investment|medical|professional)\\s+advice))\\s+(?:an?\\s+|the\\s+)?(?:[A-Za-z0-9-]+\\s+){0,4}?(?:comparison|benchmark|ranking)s?\\b(?!-)(?!\\s+(?:arm|arms|group|groups|standard|standards|class|baseline)\\b)|\\bthe\\s+(?:deck|report|document|analysis)\\s+makes?\\s+no\\s+claims?\\s+(?:about|that|regarding|as\\s+to)\\b|(?:^|\\s[-*]\\s)\\s*(?:[-*]\\s+|\\d+\\.\\s+)?(?:[*_]{1,2})?not\\s+(?:intended|meant|to\\s+be\\s+read|to\\s+be\\s+used)\\s+as\\b(?!\\s*(?:a\\s+substitute|a\\s+replacement|(?:legal|investment|medical|professional)\\s+advice))\\s+(?:an?\\s+|the\\s+)?(?:[A-Za-z0-9-]+\\s+){0,4}?(?:comparison|benchmark|ranking)s?\\b(?!-)(?!\\s+(?:arm|arms|group|groups|standard|standards|class|baseline)\\b)|\\b(?:this|these)\\s+(?:table|chart|figure|figures|numbers|results|comparison|analysis)\\s+(?:does|do)\\s+not\\s+constitute\\s+(?:an?\\s+)?[^.!?]{0,60}?\\b(?:comparison|benchmark|ranking)s?\\b(?!-)(?!\\s+(?:arm|arms|group|groups|standard|standards|class|baseline)\\b)",
|
|
922
|
+
"flags": "i",
|
|
923
|
+
"scope": "sentence",
|
|
924
|
+
"context": [
|
|
925
|
+
"fenced_code",
|
|
926
|
+
"quoted_user_text"
|
|
927
|
+
],
|
|
928
|
+
"rationale": "A sentence saying the deck, report or numbers are not intended, meant or to be read as a comparison, benchmark or ranking, that a table or set of figures does not constitute one, or that a document makes no claim about something, belongs in the chat reply. The comparison, benchmark or ranking noun is required so safety labels and advice, offer or diagnosis notices stay clean; \"does not constitute\" is limited to table-like subjects, and \"the\" opens a refusable sentence only with \"makes no claim\".",
|
|
929
|
+
"fixture_ids": [
|
|
930
|
+
"en-negative-pledge:positive",
|
|
931
|
+
"en-negative-pledge:negative"
|
|
932
|
+
]
|
|
882
933
|
}
|
|
883
934
|
]
|
|
884
935
|
}
|
|
@@ -29,7 +29,7 @@ Inputs are the user's actual slide request, supplied source material, requested
|
|
|
29
29
|
| Create | A deck or presentation deliverable is requested | Write the direction card, draft Markdown, compile PPTX under the chosen tonality, run QA, and inspect render. |
|
|
30
30
|
| Revise | An existing deck is supplied for editing | Preserve the source, produce a new version, and compare slides. |
|
|
31
31
|
| Learn | A supplied template is to be enrolled | Inspect the generated contract before rendering with it. |
|
|
32
|
-
| Blocked | A required runtime dependency is unavailable | Keep valid source and name the exact
|
|
32
|
+
| Blocked | A required runtime dependency is unavailable | Keep valid source and name the exact missing capability in the reply. |
|
|
33
33
|
|
|
34
34
|
## #contract.procedure
|
|
35
35
|
|
|
@@ -86,7 +86,7 @@ Set `OFFICE` to the installed `plugins/litcodex/skills/lit-pptx/scripts/office-r
|
|
|
86
86
|
5. Run `node "$OFFICE" pptx qa slides.pptx`. Correct every reported overflow, off-slide shape, empty outlined box, underfilled content area, table-only deck, picture occlusion, semantic overlap, anti-slop finding, and contrast failure. The `office_craft` result applies OF-101–OF-109 per slide (accent families, body measure, numeric alignment, nested-frame radius, grouping, gradient text, glow, emoji bullets, empty bands) and, on a tonality deck, OF-110–OF-114 over the whole deck: at least three title treatments and no more than the variance allows, composition variety (no layout on more than 40 % of content slides), bodies used to the floor, one frame per treatment, and titles and the cover subtitle as labels rather than sentences; OF-115 then fails a region left empty beside a full one (a bottom title above the floor, an empty side rail, a text or picture column whose largest empty band beside a longer column passes 40 % of the body even when a source strip closes it, a title panel taller than its text, a plate under an empty page), OF-117 a mostly-white figure picture on a dark ground (supply `name.dark.png` beside it or a `::: chart`), OF-118 a bold run-in label that runs into its sentence without a separator (the engine sets the colon), and OF-119 a count numeral beside an agenda title. When two tonalities of one source are offered, run `node "$OFFICE" pptx qa a.pptx --sibling b.pptx`: OF-116 fails two decks that differ in skeleton on fewer than two content slides (one, for a deck of under four). HIGH findings fail QA; MEDIUM findings are advisories (a legacy template gets MEDIUM on the variety checks because it has no fill policies). The report gives a fix hint per finding; fix the source, never the gate. `scripts/inventory.py` checks shape bounds and text fit; it is not a substitute for looking at rendered slides.
|
|
87
87
|
6. If font portability matters, run `node "$OFFICE" pptx embed slides.pptx`. The post-embed `scripts/check_ooxml.py` verifies ZIP entries, XML/content types, and that python-pptx can reopen the file. Preserve the pre-embed output until the post-check succeeds.
|
|
88
88
|
7. If LibreOffice exists, render the PPTX to PDF in a disposable output directory and rasterize every slide to PNG. Open each slide at reading size, then correct Korean glyphs, line breaks, charts, clipping, legibility, and hierarchy. If `soffice` aborts (including exit 134) or sandbox policy blocks it, keep the PPTX, run the structural QA and reopen checks, and explicitly state "visual thumbnails skipped". A passing structural QA gate establishes defect absence only.
|
|
89
|
-
8. Run 정→반→합 on the draft: state the slide's claim, challenge its weakest evidence or visual choice, then revise. Re-render and re-run QA until QA passes. Deliver source, PPTX, and requested previews
|
|
89
|
+
8. Run 정→반→합 on the draft: state the slide's claim, challenge its weakest evidence or visual choice, then revise. Re-render and re-run QA until QA passes. Deliver source, PPTX, and requested previews. Anything that affects how the deck can be used goes in the reply, not on a slide.
|
|
90
90
|
|
|
91
91
|
## Revision and template learning
|
|
92
92
|
|
|
@@ -69,13 +69,12 @@ These are semantic compositions of existing v1 blocks, so they remain renderer c
|
|
|
69
69
|
```markdown
|
|
70
70
|

|
|
71
71
|
|
|
72
|
-
- **Observation** Pressure
|
|
73
|
-
|
|
74
|
-
(2) Implication: repeat the test before scale-up.
|
|
72
|
+
- **Observation** Pressure stayed inside the validated band at the one operating condition sampled.
|
|
73
|
+
- **Implication** Repeat the test at a second condition before scale-up.
|
|
75
74
|
```
|
|
76
75
|
|
|
77
76
|
2. **table plus decision takeaway** — keep units in headers, quantitative cells compact, ≤6 columns, and add a blockquote caption/source immediately after the table.
|
|
78
|
-
3. **source capture** — use a legible screenshot with locator/date in the alt text and state its
|
|
77
|
+
3. **source capture** — use a legible screenshot with locator/date in the alt text and state its relevance in the body. If the capture covers only part of the evidence, name that part once, beside the point it supports.
|
|
79
78
|
4. **two-record appendix evidence** — show at most two records per slide; include a one-line summary, source locator, and clickable DOI/canonical link when available. In a table cell, write `[원문](https://example.org/record)`; the PPTX renderer emits an external OOXML hyperlink relationship.
|
|
80
79
|
|
|
81
80
|
Do not write authoring trace or unresolved placeholders. Treat overclaim, jargon, imperative tone, unsupported schedules, hierarchy, and visual density as review-only items to resolve during thumbnail review.
|
|
@@ -39,7 +39,7 @@ Place source text under the table/chart, smaller than body text:
|
|
|
39
39
|
|
|
40
40
|
## Evidence display patterns
|
|
41
41
|
|
|
42
|
-
- **figure plus interpretation:** one figure, numbered caption, source locator,
|
|
42
|
+
- **figure plus interpretation:** one figure, numbered caption, source locator, and a concise interpretation placed as one visual group. When the data cover only part of the situation, say which part once, in the interpretation beside the number it qualifies.
|
|
43
43
|
- **table plus decision takeaway:** one bounded table, caption/source, and one decision sentence. Do not duplicate the table in prose.
|
|
44
44
|
- **source capture:** crop to the relevant region while retaining enough interface/document context to verify the locator.
|
|
45
45
|
- **two-record appendix evidence:** at most two records per slide. Each record includes summary, source/locator, and DOI/canonical link when available.
|
|
@@ -122,7 +122,7 @@ Every rule below hands the compiler something real to place lower on the page.
|
|
|
122
122
|
checks: the basis of each figure, a comparison (prior period, plan, peer), the period, the source,
|
|
123
123
|
and the implication or next action.
|
|
124
124
|
- **End data slides with a strip.** A line `출처: …` / `Source: …` naming origin and date; optionally
|
|
125
|
-
`주: …` / `Note: …` with a definition or
|
|
125
|
+
`주: …` / `Note: …` with a definition or a data fact (what a figure counts, its period, what it leaves out). A `주:` line never says what the slide is not for. These cost the takeaways no room, and the compiler
|
|
126
126
|
moves them to the foot wherever they stand in the slide text. The examples keep a Korean `출처:`
|
|
127
127
|
line directly under the table or picture it describes, so the attribution sits next to its
|
|
128
128
|
evidence in the source file. On slides without a table or picture, and on the first slides after
|
|
@@ -46,7 +46,7 @@ layout: figure-academic
|
|
|
46
46
|
- **Observation** Raw readings follow the reference but read 6-9 points high in wet soil
|
|
47
47
|
- **Observation** After a two-point calibration per soil batch, RMSE falls from 7.8 to 2.1 VWC points
|
|
48
48
|
- **Basis** 498,000 paired readings from 60 pits over 14 weeks (example data)
|
|
49
|
-
- **
|
|
49
|
+
- **Sample** One soil mix and one depth; clay-rich pits were not in the sample
|
|
50
50
|
- **Implication** A per-batch calibration is enough; per-probe calibration adds 0.3 points of accuracy
|
|
51
51
|
- Source: Example Urban Forestry Lab field data, June-September 2026 (example data)
|
|
52
52
|
---
|
|
@@ -69,7 +69,7 @@ Columns: what the family does, the source shape it reads, and the packs that car
|
|
|
69
69
|
| `image-split` | a picture beside its explanation | an image, then bullets | atlas, chalk, signal, studio |
|
|
70
70
|
| `photo-grid` | two or three pictures compared | two or three image lines, then one line of text | atlas, studio |
|
|
71
71
|
| `figure-pair` | before and after, or two conditions | two images, then one line of text | atlas, paper |
|
|
72
|
-
| `figure-academic` | a numbered figure and how to read it | an image with numbered caption and source; observation,
|
|
72
|
+
| `figure-academic` | a numbered figure and how to read it | an image with numbered caption and source; observation, basis, sample, implication bullets | paper |
|
|
73
73
|
| `asymmetric-feature` | one large element and a narrow text column | an image or a one-cell figure, then bullets | atlas, signal, studio |
|
|
74
74
|
|
|
75
75
|
Older layout names still resolve under a tonality: `content` and `main` become `text-column`,
|
|
@@ -56,7 +56,7 @@ under a `top-rule` title, kept even when the deck already leans on that title.
|
|
|
56
56
|
|
|
57
57
|
## Families and variants
|
|
58
58
|
|
|
59
|
-
- `figure-academic`: a numbered figure with observation, basis,
|
|
59
|
+
- `figure-academic`: a numbered figure with observation, basis, sample and implication lines.
|
|
60
60
|
- `figure-pair`: two conditions or before and after, one line of reading.
|
|
61
61
|
- `method`: the model with its symbols defined, figure or formula first.
|
|
62
62
|
- `chart-insight`, `full-chart`: results; the proposed method takes the crimson.
|
|
@@ -98,7 +98,7 @@ layout: figure-academic
|
|
|
98
98
|
- **Observation** Raw readings follow the reference but read 6-9 points high in wet soil
|
|
99
99
|
- **Observation** After a two-point calibration per soil batch, RMSE falls from 7.8 to 2.1 VWC points
|
|
100
100
|
- **Basis** 498,000 paired readings from 60 pits over 14 weeks (example data)
|
|
101
|
-
- **
|
|
101
|
+
- **Sample** One soil mix and one depth; clay-rich pits were not in the sample
|
|
102
102
|
- **Implication** A per-batch calibration is enough; per-probe calibration adds 0.3 points of accuracy
|
|
103
103
|
- Source: Example Urban Forestry Lab field data, June-September 2026 (example data)
|
|
104
104
|
---
|
|
@@ -236,7 +236,7 @@ Enrolled templates may advertise these semantic compositions of existing blocks:
|
|
|
236
236
|
|
|
237
237
|
- **figure plus interpretation:** `image` + `figure-caption` + body interpretation;
|
|
238
238
|
- **table plus decision takeaway:** table/`kpi-table` + `table-caption` + body takeaway;
|
|
239
|
-
- **source capture:** `image` + `figure-caption` containing locator/source + body
|
|
239
|
+
- **source capture:** `image` + `figure-caption` containing locator/source + body relevance (and which part of the evidence the capture covers, when it covers only part);
|
|
240
240
|
- **two-record appendix evidence:** title/body or `summary-group`, with no more than two records and DOI/canonical links when available.
|
|
241
241
|
|
|
242
242
|
For a Markdown image used as evidence, alt text is the visible figure caption and should contain a figure number plus `Source:`/`출처:`. A blockquote immediately after a table is its visible table caption/source. Appendix DOI/canonical/raw URL fields use `[label](https://...)` in table cells so the PPTX contains an external hyperlink relationship. These requirements reuse existing parser and renderer behavior.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CARD_HTML = "<!doctype html>\n<html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n<title>LIT</title>\n<style>\n:root{color-scheme:dark;--bg:#10141c;--bg2:#0d1118;--ink:#e6edf3;--dim:#7d8590;--faint:#30363d;--rail:#3a434e;--flame:#ff6337;--pink:#ff2d95;--acc:#5fd7ff;--accfill:#5fd7ff;--green:#6bdb8f;--amber:#ffaf3c;--red:#ff5f5f;--pillink:#0b0f14;\n--mono:\"SF Mono\",SFMono-Regular,ui-monospace,Menlo,Monaco,Consolas,\"Liberation Mono\",monospace}\n:root.light{color-scheme:light;--bg:#ffffff;--bg2:#fafbfd;--ink:#1b1f27;--dim:#69717e;--faint:#dde2e8;--rail:#cfd6de;--flame:#e2521f;--pink:#d81b78;--acc:#0a87b8;--green:#1f9d55;--amber:#b86e00;--red:#d93a3a}\n*{box-sizing:border-box}\nhtml,body{margin:0;background:transparent}\nbody{color:var(--ink);font-size:12.5px;line-height:1.55;font-weight:500;-webkit-font-smoothing:antialiased}\n.lc,.lc *{font-family:var(--mono)!important}\n.lc{position:relative;border-radius:14px;padding:11px 14px 10px;margin:1px;\nbackground:radial-gradient(110% 120% at 0% 0%,color-mix(in srgb,var(--pink) 8%,transparent),transparent 55%),radial-gradient(80% 110% at 100% 0%,color-mix(in srgb,var(--acc) 6%,transparent),transparent 60%),linear-gradient(180deg,var(--bg),var(--bg2));\nborder:1px solid color-mix(in srgb,var(--acc) 55%,transparent);box-shadow:0 0 0 1px color-mix(in srgb,var(--acc) 8%,transparent),0 10px 30px -18px color-mix(in srgb,var(--acc) 50%,transparent);animation:breathe 4.8s ease-in-out infinite}\n.lc.is-done{border-color:color-mix(in srgb,var(--green) 55%,transparent);box-shadow:0 0 0 1px color-mix(in srgb,var(--green) 8%,transparent);animation:none}\n.lc.is-idle{border-color:color-mix(in srgb,var(--dim) 40%,transparent);box-shadow:none;animation:none}\n@keyframes breathe{0%,100%{border-color:color-mix(in srgb,var(--acc) 38%,transparent)}50%{border-color:color-mix(in srgb,var(--acc) 80%,transparent)}}\n.head{display:flex;align-items:center;gap:7px;white-space:nowrap;min-height:22px}\n.brand{position:relative;overflow:hidden;display:inline-flex;align-items:center;gap:3px;padding:1px 9px 1px 7px;border-radius:999px;background:linear-gradient(90deg,#ff2d95,#ff6337);color:#0b0f14;font-weight:800;letter-spacing:.03em;box-shadow:0 0 16px -6px rgba(255,45,149,.6)}\n.j{color:var(--faint)}\n.name{font-weight:700;overflow:hidden;text-overflow:ellipsis}.acc{color:var(--acc)}.dim{color:var(--dim)}.ok{color:var(--green)}\n.right{margin-left:auto;font-weight:700;letter-spacing:.04em;display:inline-flex;align-items:center;gap:6px}\n.dot{width:6px;height:6px;border-radius:50%;background:var(--acc);box-shadow:0 0 7px var(--acc);animation:pulse 1.6s ease-in-out infinite}\n@keyframes pulse{50%{opacity:.35}}\n.map{display:flex;align-items:center;gap:7px;margin:9px 0 6px;white-space:nowrap;overflow:hidden}\n.st em{font-style:normal;margin-left:3px}.st.todo{color:var(--dim)}.st.done{font-weight:600}\n.rail{position:relative;display:inline-block;height:2px;border-radius:2px;flex:1 1 12px;max-width:56px;min-width:10px;background:var(--rail)}\n.rail.lead{overflow:hidden}.headfill{position:absolute;inset:0;width:40%;background:linear-gradient(90deg,var(--acc),transparent)}\n.comet{position:absolute;top:50%;width:5px;height:5px;margin-top:-2.5px;border-radius:50%;background:#fff;box-shadow:0 0 7px 2px var(--acc);animation:comet 2.4s linear infinite}\n:root.light .comet{background:var(--accfill);box-shadow:0 0 5px 1px var(--accfill)}\n@keyframes comet{0%{left:-8%;opacity:0}15%,85%{opacity:1}100%{left:100%;opacity:0}}\n.nowpill{position:relative;overflow:hidden;display:inline-flex;gap:6px;align-items:center;padding:0 9px;border-radius:999px;background:var(--accfill);color:var(--pillink);font-weight:800;box-shadow:0 0 14px -4px color-mix(in srgb,var(--accfill) 80%,transparent)}\n.sweep{position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,rgba(255,255,255,.7) 50%,transparent 70%);transform:translateX(-120%);animation:sweep 3.2s ease-in-out infinite;pointer-events:none}\n@keyframes sweep{0%,55%{transform:translateX(-120%)}85%,100%{transform:translateX(120%)}}\n.is-done .sweep,.is-idle .sweep{display:none}\n.row{display:flex;align-items:center;gap:8px;white-space:nowrap;min-height:20px}\n.tl{display:inline-flex;align-items:center;gap:6px;overflow:hidden;min-width:0}\n.nx{overflow:hidden;text-overflow:ellipsis}\n.bar{display:inline-flex;gap:2px;vertical-align:middle}.seg{display:inline-block;width:6px;height:10px;border-radius:1.5px}.seg.off{background:var(--faint)}\n.live{display:inline-flex;align-items:center;gap:6px;flex:0 0 auto}.row .tl+.live{margin-left:auto}\n.live .tool{font-weight:700}.live .last{font-weight:600;overflow:hidden;text-overflow:ellipsis}.live.done{color:var(--green);font-weight:700}\n.spin{color:var(--acc);animation:spin 1s linear infinite;flex:0 0 auto}@keyframes spin{to{transform:rotate(360deg)}}\n.spin.soft{color:var(--dim)}\nkbd{font-size:12px;color:var(--acc);background:color-mix(in srgb,var(--acc) 12%,transparent);border:1px solid color-mix(in srgb,var(--acc) 32%,transparent);border-radius:6px;padding:0 6px}\n.foot{display:flex;align-items:center;gap:12px;margin-top:7px;padding-top:7px;border-top:1px solid color-mix(in srgb,var(--faint) 75%,transparent);font-size:11.5px;color:var(--dim);white-space:nowrap;overflow:hidden}\n.use{display:inline-flex;align-items:center;gap:5px}.use b{font-weight:600;color:var(--ink)}\n.mini{display:inline-flex;gap:1.5px}.mini i{display:inline-block;width:4px;height:8px;border-radius:1px;background:var(--faint)}\n.ws{margin-left:auto;overflow:hidden;text-overflow:ellipsis}\n/* the side pane (the host's fullscreen mode): a vertical timeline, the use bars at the bottom */\n:root.pane .lc{min-height:calc(100vh - 2px);display:flex;flex-direction:column;padding:18px 20px 16px;font-size:13px}\n:root.pane .brand{font-size:13.5px;padding:2px 11px 2px 9px}:root.pane .name{font-size:13.5px}\n.tline{margin:18px 0 6px}\n.stg{position:relative;padding:0 0 12px 24px}\n.stg::before{content:\"\";position:absolute;left:4px;top:0;bottom:0;width:2px;background:var(--line,var(--rail))}\n.stg:first-child::before{top:9px}.stg:last-child::before{bottom:auto;height:9px}.stg:last-child{padding-bottom:0}\n.stg .pt{position:absolute;left:0;top:4px;width:10px;height:10px;border-radius:50%;border:2px solid var(--rail);background:var(--bg)}\n.stg.done .pt{border-color:var(--c);background:var(--c)}\n.stg.cur .pt{border-color:var(--acc);background:var(--bg);box-shadow:0 0 0 3px color-mix(in srgb,var(--acc) 25%,transparent),0 0 10px var(--acc)}\n.stg .line1{display:flex;align-items:center;gap:8px;min-height:18px}\n.stg .w{font-weight:600}.stg.todo .w{color:var(--dim);font-weight:500}\n.stg .meta{margin-left:auto;color:var(--dim);font-size:12px}\n.detail{margin-top:8px;padding:8px 11px;border-radius:10px;border:1px solid color-mix(in srgb,var(--faint) 85%,transparent);background:color-mix(in srgb,var(--bg2) 60%,transparent);display:flex;flex-direction:column;gap:3px}\n.banner{display:flex;align-items:center;gap:8px;margin:14px 0 0;padding:7px 11px;border-radius:10px;color:var(--green);font-weight:700;background:color-mix(in srgb,var(--green) 11%,transparent);border:1px solid color-mix(in srgb,var(--green) 32%,transparent)}\n.banner .dim{font-weight:500}\n.usage{margin-top:auto;padding-top:14px;border-top:1px solid color-mix(in srgb,var(--faint) 75%,transparent);display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--dim)}\n.ub{display:grid;grid-template-columns:3.2em 1fr 3.4em;align-items:center;gap:10px}.ub .pct{text-align:right;color:var(--ink);font-weight:600}\n.track{height:5px;border-radius:3px;background:var(--faint);overflow:hidden}.track i{display:block;height:100%;border-radius:3px}\n.hero{text-align:center;padding:36px 0 10px}.flame{font-size:40px;filter:drop-shadow(0 0 16px rgba(255,99,55,.45))}\n.herot{font-weight:700;font-size:15px;margin-top:8px}.heros{color:var(--dim);margin:6px 0 14px}\n.examples{display:flex;flex-direction:column;align-items:center;gap:6px}\n@media (prefers-reduced-motion:reduce){.lc,.lc *{animation:none!important}.sweep,.comet{display:none}}\n</style></head>\n<body><div id=\"card\" class=\"lc is-idle\" role=\"status\" aria-live=\"polite\"><div class=\"head\"><span class=\"brand\">\uD83D\uDD25 LIT</span><span class=\"j\">\u00B7</span><span class=\"name dim\">starting\u2026</span></div></div>\n<script>\n(function(){\nvar STATUS_TOOL=\"lit_card_status\";\nvar FAST=1500,SLOW=5000,IDLE=15000,MAX_BACKOFF=30000;\nvar root=document.documentElement,card=document.getElementById(\"card\");\nvar status=null,thread=null,timer=null,ticker=null,failures=0,idleSince=Date.now(),bridge=null,hostMode=null;\nvar nextId=1,pending={};\n\nfunction el(tag,cls,text){var n=document.createElement(tag);if(cls)n.className=cls;if(text!=null)n.textContent=String(text);return n;}\nfunction add(parent){for(var i=1;i<arguments.length;i++){var c=arguments[i];if(c!=null)parent.appendChild(typeof c===\"string\"?document.createTextNode(c):c);}return parent;}\nfunction joiner(){return el(\"span\",\"j\",\"\u00B7\");}\n\n/* linear-RGB mixing, so the flame \u2192 pink \u2192 accent ramp keeps its brightness */\nfunction hex(c){c=c.trim().replace(\"#\",\"\");return[0,2,4].map(function(i){return parseInt(c.substr(i,2),16)/255;});}\nfunction lin(v){return v<=0.04045?v/12.92:Math.pow((v+0.055)/1.055,2.4);}\nfunction gam(v){return v<=0.0031308?v*12.92:1.055*Math.pow(v,1/2.4)-0.055;}\nfunction mix(a,b,t){var x=hex(a),y=hex(b);return\"#\"+x.map(function(v,i){var m=gam(lin(v)+(lin(y[i])-lin(v))*t);return(\"0\"+Math.round(Math.max(0,Math.min(1,m))*255).toString(16)).slice(-2);}).join(\"\");}\nfunction token(name){return getComputedStyle(root).getPropertyValue(name)||\"#ffffff\";}\nfunction ramp(t){var f=token(\"--flame\"),p=token(\"--pink\"),a=token(\"--acc\");return t<=0.5?mix(f,p,t*2):mix(p,a,(t-0.5)*2);}\n\nfunction clock(ms){var s=Math.max(0,Math.floor(ms/1000));return Math.floor(s/60)+\":\"+(\"0\"+(s%60)).slice(-2);}\nfunction span(ms){var s=Math.max(1,Math.round(ms/1000));if(s<60)return s+\"s\";var m=Math.floor(s/60);if(m<60)return s%60?m+\"m \"+(s%60)+\"s\":m+\"m\";return Math.floor(m/60)+\"h \"+(m%60)+\"m\";}\nfunction since(t){var n=el(\"span\",\"dim el\",\"\u00B7 \"+clock(Date.now()-t));n.setAttribute(\"data-since\",String(t));return n;}\nfunction pane(){var m=(window.openai&&window.openai.displayMode)||hostMode;return m===\"fullscreen\"||m===\"pip\";}\n\nfunction bar(done,total){\n var cells=Math.min(total,10),filled=total===0?0:Math.round(done/total*cells);\n if(done>0&&filled===0)filled=1;if(done<total&&filled===cells)filled=cells-1;\n var b=el(\"span\",\"bar\");\n for(var i=0;i<cells;i++){var s=el(\"i\",\"seg\"+(i<filled?\"\":\" off\"));if(i<filled)s.style.background=mix(token(\"--pink\"),token(\"--acc\"),cells<=1?0:i/(cells-1));b.appendChild(s);}\n return b;\n}\nfunction useColor(p){return p>=90?token(\"--red\"):p>=70?token(\"--amber\"):null;}\nfunction mini(p){var b=el(\"span\",\"mini\"),on=Math.round(p/10),warn=useColor(p);for(var i=0;i<10;i++){var c=el(\"i\");if(i<on)c.style.background=warn||mix(token(\"--pink\"),token(\"--acc\"),i/9);b.appendChild(c);}return b;}\nfunction spinner(soft){\n var ns=\"http://www.w3.org/2000/svg\",svg=document.createElementNS(ns,\"svg\");\n svg.setAttribute(\"class\",\"spin\"+(soft?\" soft\":\"\"));svg.setAttribute(\"viewBox\",\"0 0 16 16\");svg.setAttribute(\"width\",\"12\");svg.setAttribute(\"height\",\"12\");svg.setAttribute(\"aria-hidden\",\"true\");\n var c=document.createElementNS(ns,\"circle\");\n [[\"cx\",\"8\"],[\"cy\",\"8\"],[\"r\",\"5.6\"],[\"fill\",\"none\"],[\"stroke\",\"currentColor\"],[\"stroke-width\",\"2.2\"],[\"stroke-dasharray\",\"24 11.2\"],[\"stroke-linecap\",\"round\"]].forEach(function(a){c.setAttribute(a[0],a[1]);});\n svg.appendChild(c);return svg;\n}\nfunction currentCell(map){if(!map)return null;for(var i=0;i<map.cells.length;i++)if(map.cells[i].state===\"current\")return map.cells[i];return null;}\nfunction progressOf(map){if(!map)return null;for(var i=0;i<map.cells.length;i++)if(map.cells[i].progress)return map.cells[i].progress;return null;}\nfunction doneWord(s){return progressOf(s.map)?\"COMPLETE\":\"DONE\";}\nfunction took(s){if(s.turnEndedAt)return s.turnEndedAt-(s.turnStartedAt||s.ignitedAt||s.turnEndedAt);return (s.lastStepAt||s.now)-s.ignitedAt;}\n\n/* what LIT is doing now: the running tool, the turn's own time, or that it waits */\nfunction liveNode(s){\n var n=el(\"span\",\"live\");\n if(s.step){add(n,spinner(false),el(\"span\",\"tool\",s.step.tool),since(s.step.startedAt));return n;}\n if(s.state===\"complete\"){n.className=\"live done\";add(n,\"\u2713 \",el(\"span\",null,doneWord(s)===\"DONE\"?\"turn done\":\"all done\"));if(s.ignitedAt)add(n,el(\"span\",\"dim\",\"in \"+span(took(s))));return n;}\n if(s.state===\"ignited\"&&s.working){add(n,spinner(true),el(\"span\",\"dim\",\"thinking\"));if(s.turnStartedAt)n.appendChild(since(s.turnStartedAt));if(s.lastTool)add(n,el(\"span\",\"dim\",\"\u00B7 last\"),el(\"span\",\"acc\",\"\u25B8\"),el(\"span\",\"last\",s.lastTool));return n;}\n if(s.state===\"ignited\"){add(n,el(\"span\",\"dim\",\"\u25E6 waiting for you\"));return n;}\n return null;\n}\nfunction head(s){\n var h=el(\"div\",\"head\"),b=el(\"span\",\"brand\");add(b,el(\"span\",\"sweep\"),\"\uD83D\uDD25 LIT\");add(h,b,joiner());\n if(s.state===\"ready\"){add(h,el(\"span\",\"name dim\",\"ready\"),el(\"span\",\"right dim\",\"idle\"));return h;}\n add(h,el(\"span\",\"name acc\",s.mode||\"lit\"));\n if(s.state===\"complete\"){add(h,el(\"span\",\"right ok\",doneWord(s)+\" \u2713\"));return h;}\n var cur=currentCell(s.map),r=el(\"span\",\"right acc\",cur?(cur.label||cur.word.toUpperCase()):\"IGNITED\");if(s.working)r.appendChild(el(\"i\",\"dot\"));add(h,r);return h;\n}\nfunction pillExtra(c){var l=(c.label||\"\").toLowerCase(),w=c.word.toLowerCase();if(!l||l===w)return\"\";return l.indexOf(w+\" \")===0?l.slice(w.length+1):l;}\nfunction stageWord(c){var w=c.word;if(c.state===\"done\"&&c.label)w+=\" \"+c.label;else if(c.progress&&c.state!==\"current\")w+=\" \"+c.progress.done+\"/\"+c.progress.total;return w;}\nfunction mapRow(s){\n var m=el(\"div\",\"map\"),cells=s.map.cells,n=cells.length,lastColor=null;\n cells.forEach(function(c,i){\n var color=ramp(n<=1?0:i/(n-1)),cur=c.state===\"current\"&&s.state!==\"complete\";\n if(i>0){\n var r=el(\"span\",\"rail\");\n if((c.state===\"done\"||c.state===\"partial\")&&cells[i-1].state!==\"pending\")r.style.background=\"linear-gradient(90deg,\"+(lastColor||color)+\",\"+color+\")\";\n else if(cur){r.style.background=\"linear-gradient(90deg,\"+(lastColor||token(\"--acc\"))+\",\"+token(\"--acc\")+\")\";r.appendChild(el(\"i\",\"comet\"));}\n else if(cells[i-1].state===\"current\"&&s.state!==\"complete\"){r.className=\"rail lead\";r.appendChild(el(\"i\",\"headfill\"));}\n m.appendChild(r);\n }\n if(cur){\n var p=el(\"span\",\"st nowpill\");add(p,el(\"span\",\"sweep\"),c.word);var extra=pillExtra(c);if(extra)add(p,el(\"b\",null,extra));if(c.progress)add(p,el(\"b\",null,c.progress.done+\"/\"+c.progress.total));m.appendChild(p);lastColor=token(\"--acc\");\n }else if(c.state===\"pending\"){var t=el(\"span\",\"st todo\",c.word);t.appendChild(el(\"em\",null,\"\u00B7\"));m.appendChild(t);}\n else{var d=el(\"span\",\"st done\",stageWord(c));d.style.color=color;d.appendChild(el(\"em\",null,c.state===\"partial\"?\"\u2026\":\"\u2713\"));m.appendChild(d);lastColor=color;}\n });\n return m;\n}\n/* the task line: progress and next on the left, the live step on the right; just the live step otherwise */\nfunction taskRow(s){\n var row=el(\"div\",\"row\"),prog=progressOf(s.map),next=s.map&&s.map.next;\n if(prog||next){\n var left=el(\"span\",\"tl\");add(left,el(\"span\",\"dim\",\"\u2514\"));\n if(prog)add(left,el(\"span\",\"dim\",\"task\"),el(\"b\",null,prog.done+\"/\"+prog.total),bar(prog.done,prog.total));\n if(next){if(prog)left.appendChild(joiner());add(left,el(\"span\",\"dim\",\"next\"),el(\"span\",\"acc\",\"\u25B8\"),el(\"span\",\"nx\",next));}\n add(row,left,liveNode(s));return row;\n }\n add(row,el(\"span\",\"dim\",\"\u2514\"),liveNode(s));return row;\n}\nfunction useItems(s){\n var u=s.usage||{},items=[];\n [[\"ctx\",u.ctx],[\"5h\",u.fiveHour],[\"1w\",u.week]].forEach(function(x){if(typeof x[1]===\"number\")items.push(x);});\n return items;\n}\nfunction foot(s){\n var f=el(\"div\",\"foot\");\n useItems(s).forEach(function(x){var u=el(\"span\",\"use\");add(u,x[0],mini(x[1]),el(\"b\",null,x[1]+\"%\"));var w=useColor(x[1]);if(w)u.lastChild.style.color=w;f.appendChild(u);});\n if(s.branch){var g=el(\"span\",\"use\");add(g,\"git\",el(\"b\",null,s.branch));f.appendChild(g);}\n if(s.workspace)f.appendChild(el(\"span\",\"ws\",s.workspace));\n return f.childNodes.length?f:null;\n}\nfunction timeline(s){\n var t=el(\"div\",\"tline\"),cells=s.map.cells,n=cells.length;\n cells.forEach(function(c,i){\n var color=ramp(n<=1?0:i/(n-1)),cur=c.state===\"current\"&&s.state!==\"complete\",todo=c.state===\"pending\";\n var g=el(\"div\",\"stg \"+(cur?\"cur\":todo?\"todo\":\"done\"));g.style.setProperty(\"--c\",color);\n var nextCell=cells[i+1];if(!todo&&!cur&&nextCell&&nextCell.state!==\"pending\")g.style.setProperty(\"--line\",color);\n var l1=el(\"div\",\"line1\"),w;\n if(cur){w=el(\"span\",\"st nowpill\");add(w,el(\"span\",\"sweep\"),c.label||c.word.toUpperCase());}\n else{w=el(\"span\",\"w\",c.word);if(!todo)w.style.color=color;}\n var meta=el(\"span\",\"meta\");if(c.progress)meta.textContent=c.progress.done+\"/\"+c.progress.total;else if(!todo&&!cur)meta.textContent=c.label?c.label+\" \u2713\":\"\u2713\";\n add(l1,w,meta);add(g,el(\"span\",\"pt\"),l1);\n if(cur){\n var d=el(\"div\",\"detail\"),prog=c.progress;\n if(prog){var r1=el(\"div\",\"row\");add(r1,el(\"span\",\"dim\",\"tasks\"),el(\"b\",null,prog.done+\"/\"+prog.total),bar(prog.done,prog.total));d.appendChild(r1);}\n if(s.map.next){var r2=el(\"div\",\"row\");add(r2,el(\"span\",\"dim\",\"next\"),el(\"span\",\"acc\",\"\u25B8\"),el(\"span\",\"nx\",s.map.next));d.appendChild(r2);}\n var r3=el(\"div\",\"row\"),live=liveNode(s);if(live){r3.appendChild(live);d.appendChild(r3);}\n g.appendChild(d);\n }\n t.appendChild(g);\n });\n return t;\n}\nfunction usageBlock(s){\n var items=useItems(s);if(!items.length&&!s.branch&&!s.workspace)return null;\n var u=el(\"div\",\"usage\");\n items.forEach(function(x){var r=el(\"div\",\"ub\"),tr=el(\"span\",\"track\"),fill=el(\"i\"),w=useColor(x[1]);fill.style.width=x[1]+\"%\";fill.style.background=w||\"linear-gradient(90deg,\"+token(\"--pink\")+\",\"+token(\"--acc\")+\")\";tr.appendChild(fill);var pct=el(\"span\",\"pct\",x[1]+\"%\");if(w)pct.style.color=w;add(r,el(\"span\",null,x[0]),tr,pct);u.appendChild(r);});\n var g=el(\"div\",\"row\");if(s.branch)add(g,\"git\",el(\"b\",null,s.branch));if(s.workspace){if(s.branch)g.appendChild(joiner());g.appendChild(el(\"span\",null,s.workspace));}\n if(g.childNodes.length)u.appendChild(g);\n return u;\n}\nfunction renderInline(s){\n card.appendChild(head(s));\n if(s.state===\"ready\"){var hint=el(\"div\",\"row\");add(hint,el(\"span\",\"dim\",\"no LIT skill yet\"),joiner(),el(\"span\",\"dim\",\"type\"),el(\"kbd\",null,\"lit <task>\"),el(\"span\",\"dim\",\"to start one\"));hint.style.marginTop=\"6px\";card.appendChild(hint);return;}\n if(s.map)card.appendChild(mapRow(s));else card.appendChild(el(\"div\",\"map\"));\n card.appendChild(taskRow(s));\n var f=foot(s);if(f){card.appendChild(f);var ws=f.querySelector(\".ws\");if(ws&&ws.scrollWidth>ws.clientWidth+1)f.removeChild(ws);}\n}\nfunction renderPane(s){\n card.appendChild(head(s));\n if(s.state===\"ready\"){\n var hero=el(\"div\",\"hero\"),hs=el(\"div\",\"heros\");add(hs,\"type \",el(\"kbd\",null,\"lit <task>\"),\" in this thread to start one\");\n var ex=el(\"div\",\"examples\");[\"lit add a --shout flag\",\"lit plan the release note\",\"lit-loop fix the parser\"].forEach(function(t){ex.appendChild(el(\"kbd\",null,t));});\n add(hero,el(\"div\",\"flame\",\"\uD83D\uDD25\"),el(\"div\",\"herot\",\"no LIT skill yet\"),hs,ex);card.appendChild(hero);\n }else{\n if(s.state===\"complete\"){var prog=progressOf(s.map),bn=el(\"div\",\"banner\",doneWord(s)+\" \u2713\");if(prog)add(bn,el(\"span\",\"dim\",prog.done+\"/\"+prog.total+\" tasks\"));if(s.ignitedAt)add(bn,el(\"span\",\"dim\",\"\u00B7 \"+span(took(s))));card.appendChild(bn);}\n if(s.map)card.appendChild(timeline(s));else{var r=el(\"div\",\"row\");r.style.marginTop=\"14px\";add(r,liveNode(s));card.appendChild(r);}\n }\n var u=usageBlock(s);if(u)card.appendChild(u);\n}\nfunction render(){\n var s=status;if(!s)return;\n var p=pane();root.classList.toggle(\"pane\",p);\n card.className=\"lc\"+(s.state===\"complete\"?\" is-done\":s.state===\"ready\"?\" is-idle\":\"\");\n card.textContent=\"\";\n if(p)renderPane(s);else renderInline(s);\n reportSize();\n}\nfunction tick(){\n if(ticker){clearInterval(ticker);ticker=null;}\n if(document.hidden||!card.querySelector(\"[data-since]\"))return;\n ticker=setInterval(function(){var n=card.querySelectorAll(\"[data-since]\");for(var i=0;i<n.length;i++)n[i].textContent=\"\u00B7 \"+clock(Date.now()-Number(n[i].getAttribute(\"data-since\")));},1000);\n}\nfunction accept(s){\n if(!s||s.version!==1)return;\n status=s;if(s.thread)thread=s.thread;\n if(s.working)idleSince=Date.now();\n render();tick();\n}\n\n/* host bridge: window.openai when present, else MCP Apps JSON-RPC over postMessage */\nfunction rpc(method,params){return new Promise(function(resolve,reject){var id=nextId++;pending[id]={resolve:resolve,reject:reject};window.parent.postMessage({jsonrpc:\"2.0\",id:id,method:method,params:params},\"*\");setTimeout(function(){if(pending[id]){delete pending[id];reject(new Error(method+\" timed out\"));}},5000);});}\nwindow.addEventListener(\"message\",function(ev){\n var m=ev.data;if(ev.source!==window.parent||!m||m.jsonrpc!==\"2.0\")return;\n if(m.id!=null&&pending[m.id]){var p=pending[m.id];delete pending[m.id];if(m.error)p.reject(m.error);else p.resolve(m.result);return;}\n if(m.method===\"ui/notifications/tool-result\"&&m.params)accept(m.params.structuredContent);\n if(m.method===\"ui/notifications/host-context-changed\"&&m.params){if(m.params.displayMode)hostMode=m.params.displayMode;applyTheme(m.params.theme||null);}\n});\nwindow.addEventListener(\"openai:set_globals\",function(){if(window.openai){applyTheme(window.openai.theme);if(window.openai.toolOutput&&!status)accept(window.openai.toolOutput);else render();}});\nfunction callStatus(){\n var args=thread?{thread_id:thread}:{};\n if(bridge===\"openai\")return window.openai.callTool(STATUS_TOOL,args).then(function(r){return r&&(r.structuredContent||r.result&&r.result.structuredContent);});\n return rpc(\"tools/call\",{name:STATUS_TOOL,arguments:args}).then(function(r){return r&&r.structuredContent;});\n}\nvar lastHeight=0;\nfunction reportSize(){\n if(pane())return;\n var h=Math.ceil(card.getBoundingClientRect().height)+2;if(h===lastHeight)return;lastHeight=h;\n if(bridge===\"openai\"&&typeof window.openai.notifyIntrinsicHeight===\"function\"){try{window.openai.notifyIntrinsicHeight(h);}catch(e){}}\n else if(bridge===\"mcp\")window.parent.postMessage({jsonrpc:\"2.0\",method:\"ui/notifications/size-changed\",params:{height:h}},\"*\");\n}\nfunction applyTheme(theme){\n var dark=theme?theme===\"dark\":!(window.matchMedia&&window.matchMedia(\"(prefers-color-scheme: light)\").matches);\n root.classList.toggle(\"light\",!dark);if(status)render();\n}\n\nfunction delay(){\n if(failures>0)return Math.min(MAX_BACKOFF,FAST*Math.pow(2,failures));\n if(status&&status.working)return FAST;\n return Date.now()-idleSince>120000?IDLE:SLOW;\n}\nfunction schedule(){if(timer)clearTimeout(timer);timer=null;if(!document.hidden)timer=setTimeout(poll,delay());}\nfunction poll(){\n callStatus().then(function(s){failures=0;accept(s);},function(){failures=Math.min(failures+1,5);}).then(schedule);\n}\ndocument.addEventListener(\"visibilitychange\",function(){if(document.hidden){if(timer)clearTimeout(timer);timer=null;tick();}else{idleSince=Date.now();tick();poll();}});\nwindow.addEventListener(\"resize\",function(){if(status)render();});\n\nfunction start(){\n if(window.openai&&typeof window.openai.callTool===\"function\"){\n bridge=\"openai\";applyTheme(window.openai.theme);if(window.openai.toolOutput)accept(window.openai.toolOutput);poll();return;\n }\n bridge=\"mcp\";applyTheme(null);\n rpc(\"ui/initialize\",{protocolVersion:\"2026-01-26\",appInfo:{name:\"lit-card\",version:\"1\"},appCapabilities:{availableDisplayModes:[\"inline\",\"fullscreen\"]}}).then(function(r){\n window.parent.postMessage({jsonrpc:\"2.0\",method:\"ui/notifications/initialized\",params:{}},\"*\");\n var ctx=r&&r.hostContext;if(ctx&&ctx.displayMode)hostMode=ctx.displayMode;applyTheme(ctx&&ctx.theme||null);poll();\n },function(){poll();});\n}\nif(window.matchMedia)window.matchMedia(\"(prefers-color-scheme: light)\").addEventListener(\"change\",function(){if(!(window.openai&&window.openai.theme))applyTheme(null);});\nstart();\n})();\n</script></body></html>\n";
|
|
1
|
+
export declare const CARD_HTML = "<!doctype html>\n<html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n<title>LIT</title>\n<style>\n:root{color-scheme:dark;--bg:#10141c;--bg2:#0d1118;--ink:#e6edf3;--dim:#7d8590;--faint:#30363d;--rail:#3a434e;--flame:#ff6337;--pink:#ff2d95;--acc:#5fd7ff;--accfill:#5fd7ff;--green:#6bdb8f;--amber:#ffaf3c;--red:#ff5f5f;--pillink:#0b0f14;\n--mono:\"SF Mono\",SFMono-Regular,ui-monospace,Menlo,Monaco,Consolas,\"Liberation Mono\",monospace}\n:root.light{color-scheme:light;--bg:#ffffff;--bg2:#fafbfd;--ink:#1b1f27;--dim:#5f6672;--faint:#dde2e8;--rail:#cfd6de;--flame:#bd3f0b;--pink:#c0186b;--acc:#006f99;--green:#17783f;--amber:#9a5b00;--red:#c42f2f}\n*{box-sizing:border-box}\nhtml,body{margin:0;background:transparent}\nbody{color:var(--ink);font-size:12.5px;line-height:1.55;font-weight:500;-webkit-font-smoothing:antialiased}\n.lc,.lc *{font-family:var(--mono)!important}\n.lc{position:relative;border-radius:14px;padding:11px 14px 10px;margin:1px;\nbackground:radial-gradient(110% 120% at 0% 0%,color-mix(in srgb,var(--pink) 8%,var(--bg)),var(--bg) 55%,var(--bg2));\nborder:1px solid color-mix(in srgb,var(--acc) 55%,transparent);box-shadow:0 0 0 1px color-mix(in srgb,var(--acc) 8%,transparent),0 10px 30px -18px color-mix(in srgb,var(--acc) 50%,transparent);animation:breathe 4.8s ease-in-out infinite}\n.lc.is-done{border-color:color-mix(in srgb,var(--green) 55%,transparent);box-shadow:0 0 0 1px color-mix(in srgb,var(--green) 8%,transparent);animation:none}\n.lc.is-idle{border-color:color-mix(in srgb,var(--dim) 40%,transparent);box-shadow:none;animation:none}\n@keyframes breathe{0%,100%{border-color:color-mix(in srgb,var(--acc) 38%,transparent)}50%{border-color:color-mix(in srgb,var(--acc) 80%,transparent)}}\n.head{display:flex;align-items:center;gap:7px;white-space:nowrap;min-height:22px}\n.brand{position:relative;overflow:hidden;display:inline-flex;align-items:center;gap:3px;padding:1px 9px 1px 7px;border-radius:999px;background:linear-gradient(90deg,#ff2d95,#ff6337);color:#0b0f14;font-weight:800;letter-spacing:.03em;box-shadow:0 0 16px -6px rgba(255,45,149,.6)}\n.j{display:inline-block;flex:0 0 auto;width:3px;height:3px;border-radius:50%;background:var(--rail)}\n.name{font-weight:700;overflow:hidden;text-overflow:ellipsis}.acc{color:var(--acc)}.dim{color:var(--dim)}.ok{color:var(--green)}\n.right{margin-left:auto;font-weight:700;letter-spacing:.04em;display:inline-flex;align-items:center;gap:6px}\n.dot{width:6px;height:6px;border-radius:50%;background:var(--acc);box-shadow:0 0 7px var(--acc);animation:pulse 1.6s ease-in-out infinite}\n@keyframes pulse{50%{opacity:.35}}\n.map{display:flex;align-items:center;gap:7px;margin:9px 0 6px;white-space:nowrap;overflow:hidden}\n.st em{font-style:normal;margin-left:3px}.st.todo{color:var(--dim)}.st.done{font-weight:600}\n.rail{position:relative;display:inline-block;height:2px;border-radius:2px;flex:1 1 12px;max-width:56px;min-width:10px;background:var(--rail)}\n.rail.lead{overflow:hidden}.headfill{position:absolute;inset:0;width:40%;background:linear-gradient(90deg,var(--acc),transparent)}\n.comet{position:absolute;top:50%;width:5px;height:5px;margin-top:-2.5px;border-radius:50%;background:#fff;box-shadow:0 0 7px 2px var(--acc);animation:comet 2.4s linear infinite}\n:root.light .comet{background:var(--accfill);box-shadow:0 0 5px 1px var(--accfill)}\n@keyframes comet{0%{left:-8%;opacity:0}15%,85%{opacity:1}100%{left:100%;opacity:0}}\n.nowpill{position:relative;overflow:hidden;display:inline-flex;gap:6px;align-items:center;padding:0 9px;border-radius:999px;background:var(--accfill);color:var(--pillink);font-weight:800;box-shadow:0 0 14px -4px color-mix(in srgb,var(--accfill) 80%,transparent)}\n.brand::after,.nowpill::after{content:\"\";position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,rgba(255,255,255,.7) 50%,transparent 70%);transform:translateX(-120%);animation:sweep 3.2s ease-in-out infinite;pointer-events:none}\n@keyframes sweep{0%,55%{transform:translateX(-120%)}85%,100%{transform:translateX(120%)}}\n.is-done .brand::after,.is-idle .brand::after,.folded .brand::after{display:none}\n.row{display:flex;align-items:center;gap:8px;white-space:nowrap;min-height:20px}\n.tl{display:inline-flex;align-items:center;gap:6px;overflow:hidden;min-width:0}\n.nx{overflow:hidden;text-overflow:ellipsis}\n.bar{display:inline-flex;gap:2px;vertical-align:middle}.seg{display:inline-block;width:6px;height:10px;border-radius:1.5px}.seg.off{background:var(--faint)}\n.live{display:inline-flex;align-items:center;gap:6px;flex:0 0 auto}.row .tl+.live{margin-left:auto}\n.live .tool{font-weight:700}.live .last{font-weight:600;overflow:hidden;text-overflow:ellipsis}.live.done{color:var(--green);font-weight:700}\n.spin{color:var(--acc);animation:spin 1s linear infinite;flex:0 0 auto}@keyframes spin{to{transform:rotate(360deg)}}\n.spin.soft{color:var(--dim)}\nkbd{font-size:12px;color:var(--acc);background:color-mix(in srgb,var(--acc) 12%,transparent);border:1px solid color-mix(in srgb,var(--acc) 32%,transparent);border-radius:6px;padding:0 6px}\n.foot{display:flex;align-items:center;gap:12px;margin-top:7px;padding-top:7px;border-top:1px solid color-mix(in srgb,var(--faint) 75%,transparent);font-size:11.5px;color:var(--dim);white-space:nowrap;overflow:hidden}\n.use{display:inline-flex;align-items:center;gap:5px}.use b{font-weight:600;color:var(--ink)}\n.mini{display:inline-flex;gap:1.5px}.mini i{display:inline-block;width:4px;height:8px;border-radius:1px;background:var(--faint)}\n.ws{margin-left:auto;overflow:hidden;text-overflow:ellipsis}\n/* the side pane (the host's fullscreen mode): a vertical timeline, the use bars at the bottom */\n:root.pane .lc{min-height:calc(100vh - 2px);display:flex;flex-direction:column;padding:18px 20px 16px;font-size:13px}\n:root.pane .brand{font-size:13.5px;padding:2px 11px 2px 9px}:root.pane .name{font-size:13.5px}\n.tline{margin:18px 0 6px}\n.stg{position:relative;padding:0 0 12px 24px}\n.stg::before{content:\"\";position:absolute;left:4px;top:0;bottom:0;width:2px;background:var(--line,var(--rail))}\n.stg:first-child::before{top:9px}.stg:last-child::before{bottom:auto;height:9px}.stg:last-child{padding-bottom:0}\n.stg .pt{position:absolute;left:0;top:4px;width:10px;height:10px;border-radius:50%;border:2px solid var(--rail);background:var(--bg)}\n.stg.done .pt{border-color:var(--c);background:var(--c)}\n.stg.cur .pt{border-color:var(--acc);background:var(--bg);box-shadow:0 0 0 3px color-mix(in srgb,var(--acc) 25%,transparent),0 0 10px var(--acc)}\n.stg .line1{display:flex;align-items:center;gap:8px;min-height:18px}\n.stg .w{font-weight:600}.stg.todo .w{color:var(--dim);font-weight:500}\n.stg .meta{margin-left:auto;color:var(--dim);font-size:12px}\n.detail{margin-top:8px;padding:8px 11px;border-radius:10px;border:1px solid color-mix(in srgb,var(--faint) 85%,transparent);background:color-mix(in srgb,var(--bg2) 60%,transparent);display:flex;flex-direction:column;gap:3px}\n.banner{display:flex;align-items:center;gap:8px;margin:14px 0 0;padding:7px 11px;border-radius:10px;color:var(--green);font-weight:700;background:color-mix(in srgb,var(--green) 11%,transparent);border:1px solid color-mix(in srgb,var(--green) 32%,transparent)}\n.banner .dim{font-weight:500}\n.usage{margin-top:auto;padding-top:14px;border-top:1px solid color-mix(in srgb,var(--faint) 75%,transparent);display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--dim)}\n.ub{display:grid;grid-template-columns:3.2em 1fr 3.4em;align-items:center;gap:10px}.ub .pct{text-align:right;color:var(--ink);font-weight:600}\n.track{height:5px;border-radius:3px;background:var(--faint);overflow:hidden}.track i{display:block;height:100%;border-radius:3px}\n.hero{text-align:center;padding:36px 0 10px}.flame{font-size:40px;filter:drop-shadow(0 0 16px rgba(255,99,55,.45))}\n.herot{font-weight:700;font-size:15px;margin-top:8px}.heros{color:var(--dim);margin:6px 0 14px}\n.examples{display:flex;flex-direction:column;align-items:center;gap:6px}\n/* an earlier turn's card, once a newer one opened below: one quiet line, no glow, no motion */\n.lc.folded{padding:3px 10px;border-radius:10px;background:var(--bg);border:1px solid color-mix(in srgb,var(--dim) 30%,transparent);box-shadow:none;animation:none;font-size:12px}\n.lc.folded .head{min-height:20px;gap:6px}\n.lc.folded .brand{padding:0 7px 0 6px;font-size:11px;background:color-mix(in srgb,var(--dim) 24%,var(--bg));color:var(--ink);box-shadow:none;filter:grayscale(1)}\n.lc.folded .name{color:var(--dim);font-weight:600}\n.lc.folded .right{font-weight:600;letter-spacing:0;flex:0 0 auto}\n@media (prefers-reduced-motion:reduce){.lc,.lc *{animation:none!important}.brand::after,.nowpill::after,.comet{display:none}}\n</style></head>\n<body><div id=\"card\" class=\"lc is-idle\" role=\"status\" aria-live=\"polite\"><div class=\"head\"><span class=\"brand\">\uD83D\uDD25 LIT</span><span class=\"j\">\u00B7</span><span class=\"name dim\">starting\u2026</span></div></div>\n<script>\n(function(){\nvar STATUS_TOOL=\"lit_card_status\";\nvar FAST=1500,SLOW=5000,IDLE=15000,MAX_BACKOFF=30000;\nvar root=document.documentElement,card=document.getElementById(\"card\");\nvar status=null,thread=null,timer=null,ticker=null,failures=0,idleSince=Date.now(),bridge=null,hostMode=null;\nvar opened=null,folded=false;\nvar nextId=1,pending={};\n\nfunction el(tag,cls,text){var n=document.createElement(tag);if(cls)n.className=cls;if(text!=null)n.textContent=String(text);return n;}\nfunction add(parent){for(var i=1;i<arguments.length;i++){var c=arguments[i];if(c!=null)parent.appendChild(typeof c===\"string\"?document.createTextNode(c):c);}return parent;}\nfunction joiner(){var n=el(\"span\",\"j\");n.setAttribute(\"aria-hidden\",\"true\");return n;}\n\n/* linear-RGB mixing, so the flame \u2192 pink \u2192 accent ramp keeps its brightness */\nfunction hex(c){c=c.trim().replace(\"#\",\"\");return[0,2,4].map(function(i){return parseInt(c.substr(i,2),16)/255;});}\nfunction lin(v){return v<=0.04045?v/12.92:Math.pow((v+0.055)/1.055,2.4);}\nfunction gam(v){return v<=0.0031308?v*12.92:1.055*Math.pow(v,1/2.4)-0.055;}\nfunction mix(a,b,t){var x=hex(a),y=hex(b);return\"#\"+x.map(function(v,i){var m=gam(lin(v)+(lin(y[i])-lin(v))*t);return(\"0\"+Math.round(Math.max(0,Math.min(1,m))*255).toString(16)).slice(-2);}).join(\"\");}\nfunction token(name){return getComputedStyle(root).getPropertyValue(name)||\"#ffffff\";}\nfunction ramp(t){var f=token(\"--flame\"),p=token(\"--pink\"),a=token(\"--acc\");return t<=0.5?mix(f,p,t*2):mix(p,a,(t-0.5)*2);}\n\nfunction clock(ms){var s=Math.max(0,Math.floor(ms/1000));return Math.floor(s/60)+\":\"+(\"0\"+(s%60)).slice(-2);}\nfunction span(ms){var s=Math.max(1,Math.round(ms/1000));if(s<60)return s+\"s\";var m=Math.floor(s/60);if(m<60)return s%60?m+\"m \"+(s%60)+\"s\":m+\"m\";return Math.floor(m/60)+\"h \"+(m%60)+\"m\";}\nfunction since(t){var n=el(\"span\",\"dim el\",\"\u00B7 \"+clock(Date.now()-t));n.setAttribute(\"data-since\",String(t));return n;}\nfunction turnClock(t){var n=el(\"span\",\"el\",clock(Date.now()-t));n.setAttribute(\"data-since\",String(t));n.setAttribute(\"data-bare\",\"1\");return n;}\nfunction pane(){var m=(window.openai&&window.openai.displayMode)||hostMode;return m===\"fullscreen\"||m===\"pip\";}\n\nfunction bar(done,total){\n var cells=Math.min(total,10),filled=total===0?0:Math.round(done/total*cells);\n if(done>0&&filled===0)filled=1;if(done<total&&filled===cells)filled=cells-1;\n var b=el(\"span\",\"bar\");\n for(var i=0;i<cells;i++){var s=el(\"i\",\"seg\"+(i<filled?\"\":\" off\"));if(i<filled)s.style.background=mix(token(\"--pink\"),token(\"--acc\"),cells<=1?0:i/(cells-1));b.appendChild(s);}\n return b;\n}\nfunction useColor(p){return p>=90?token(\"--red\"):p>=70?token(\"--amber\"):null;}\nfunction mini(p){var b=el(\"span\",\"mini\"),on=Math.round(p/10),fill=useColor(p)||token(\"--acc\");for(var i=0;i<10;i++){var c=el(\"i\");if(i<on)c.style.background=fill;b.appendChild(c);}return b;}\nfunction spinner(soft){\n var ns=\"http://www.w3.org/2000/svg\",svg=document.createElementNS(ns,\"svg\");\n svg.setAttribute(\"class\",\"spin\"+(soft?\" soft\":\"\"));svg.setAttribute(\"viewBox\",\"0 0 16 16\");svg.setAttribute(\"width\",\"12\");svg.setAttribute(\"height\",\"12\");svg.setAttribute(\"aria-hidden\",\"true\");\n var c=document.createElementNS(ns,\"circle\");\n [[\"cx\",\"8\"],[\"cy\",\"8\"],[\"r\",\"5.6\"],[\"fill\",\"none\"],[\"stroke\",\"currentColor\"],[\"stroke-width\",\"2.2\"],[\"stroke-dasharray\",\"24 11.2\"],[\"stroke-linecap\",\"round\"]].forEach(function(a){c.setAttribute(a[0],a[1]);});\n svg.appendChild(c);return svg;\n}\nfunction progressOf(map){if(!map)return null;for(var i=0;i<map.cells.length;i++)if(map.cells[i].progress)return map.cells[i].progress;return null;}\nfunction doneWord(s){return progressOf(s.map)?\"COMPLETE\":\"DONE\";}\nfunction took(s){if(s.turnEndedAt)return s.turnEndedAt-(s.turnStartedAt||s.ignitedAt||s.turnEndedAt);return (s.lastStepAt||s.now)-s.ignitedAt;}\n\n/* what LIT is doing now: the running tool, the turn's own time, or that it waits */\nfunction liveNode(s){\n var n=el(\"span\",\"live\");\n if(s.step){add(n,spinner(false),el(\"span\",\"tool\",s.step.tool),since(s.step.startedAt));return n;}\n if(s.state===\"complete\"){n.className=\"live done\";add(n,\"\u2713 \",el(\"span\",null,doneWord(s)===\"DONE\"?\"turn done\":\"all done\"));if(s.ignitedAt)add(n,el(\"span\",\"dim\",\"in \"+span(took(s))));return n;}\n if(s.state===\"ignited\"&&s.working){add(n,spinner(true),el(\"span\",\"dim\",\"thinking\"));if(s.lastTool)add(n,el(\"span\",\"dim\",\"\u00B7 last\"),el(\"span\",\"acc\",\"\u25B8\"),el(\"span\",\"last\",s.lastTool));return n;}\n if(s.state===\"ignited\"){add(n,el(\"span\",\"dim\",\"\u25E6 waiting for you\"));return n;}\n return null;\n}\n/* the header's right side: the turn clock while working (the map already names the stage), the result once done */\nfunction head(s){\n var h=el(\"div\",\"head\");add(h,el(\"span\",\"brand\",\"\uD83D\uDD25 LIT\"),joiner());\n if(s.state===\"ready\"){add(h,el(\"span\",\"name dim\",\"ready\"),el(\"span\",\"right dim\",\"idle\"));return h;}\n add(h,el(\"span\",\"name acc\",s.mode||\"lit\"));\n if(s.state===\"complete\"){add(h,el(\"span\",\"right ok\",doneWord(s)+\" \u2713\"));return h;}\n var r=el(\"span\",\"right acc\");if(!s.map)r.appendChild(el(\"span\",null,\"IGNITED\"));\n if(s.working){if(s.turnStartedAt)r.appendChild(turnClock(s.turnStartedAt));r.appendChild(el(\"i\",\"dot\"));}\n if(r.childNodes.length)h.appendChild(r);return h;\n}\n/* an earlier turn's card: the LIT mark, its mode and how it ended, on one line */\nfunction renderFolded(s){\n var h=el(\"div\",\"head\");add(h,el(\"span\",\"brand\",\"\uD83D\uDD25 LIT\"),joiner(),el(\"span\",\"name\",s&&s.mode||\"lit\"));\n if(s&&s.state===\"complete\"){var r=el(\"span\",\"right ok\",doneWord(s).toLowerCase()+\" \u2713\");if(s.ignitedAt)add(r,\" \",el(\"span\",\"dim\",span(took(s))));h.appendChild(r);}\n else h.appendChild(el(\"span\",\"right dim\",\"continued below \u2193\"));\n card.appendChild(h);\n}\nfunction pillExtra(c){var l=(c.label||\"\").toLowerCase(),w=c.word.toLowerCase();if(!l||l===w)return\"\";return l.indexOf(w+\" \")===0?l.slice(w.length+1):l;}\nfunction stageWord(c){var w=c.word;if(c.state===\"done\"&&c.label)w+=\" \"+c.label;else if(c.progress&&c.state!==\"current\")w+=\" \"+c.progress.done+\"/\"+c.progress.total;return w;}\nfunction mapRow(s){\n var m=el(\"div\",\"map\"),cells=s.map.cells,n=cells.length,lastColor=null;\n cells.forEach(function(c,i){\n var color=ramp(n<=1?0:i/(n-1)),cur=c.state===\"current\"&&s.state!==\"complete\";\n if(i>0){\n var r=el(\"span\",\"rail\");\n if((c.state===\"done\"||c.state===\"partial\")&&cells[i-1].state!==\"pending\")r.style.background=\"linear-gradient(90deg,\"+(lastColor||color)+\",\"+color+\")\";\n else if(cur){r.style.background=\"linear-gradient(90deg,\"+(lastColor||token(\"--acc\"))+\",\"+token(\"--acc\")+\")\";r.appendChild(el(\"i\",\"comet\"));}\n else if(cells[i-1].state===\"current\"&&s.state!==\"complete\"){r.className=\"rail lead\";r.appendChild(el(\"i\",\"headfill\"));}\n m.appendChild(r);\n }\n if(cur){\n var p=el(\"span\",\"st nowpill\",c.word);var extra=pillExtra(c);if(extra)add(p,el(\"b\",null,extra));if(c.progress)add(p,el(\"b\",null,c.progress.done+\"/\"+c.progress.total));m.appendChild(p);lastColor=token(\"--acc\");\n }else if(c.state===\"pending\"){var t=el(\"span\",\"st todo\",c.word);t.appendChild(el(\"em\",null,\"\u00B7\"));m.appendChild(t);}\n else{var d=el(\"span\",\"st done\",stageWord(c));d.style.color=color;d.appendChild(el(\"em\",null,c.state===\"partial\"?\"\u2026\":\"\u2713\"));m.appendChild(d);lastColor=color;}\n });\n return m;\n}\n/* the task line: progress and next on the left, the live step on the right; just the live step otherwise */\nfunction taskRow(s){\n var row=el(\"div\",\"row\"),prog=progressOf(s.map),next=s.map&&s.map.next;\n if(prog||next){\n var left=el(\"span\",\"tl\");add(left,el(\"span\",\"dim\",\"\u2514\"));\n if(prog)add(left,el(\"span\",\"dim\",\"task\"),el(\"b\",null,prog.done+\"/\"+prog.total),bar(prog.done,prog.total));\n if(next){if(prog)left.appendChild(joiner());add(left,el(\"span\",\"dim\",\"next\"),el(\"span\",\"acc\",\"\u25B8\"),el(\"span\",\"nx\",next));}\n add(row,left,liveNode(s));return row;\n }\n add(row,el(\"span\",\"dim\",\"\u2514\"),liveNode(s));return row;\n}\nfunction useItems(s){\n var u=s.usage||{},items=[];\n [[\"ctx\",u.ctx],[\"5h\",u.fiveHour],[\"1w\",u.week]].forEach(function(x){if(typeof x[1]===\"number\")items.push(x);});\n return items;\n}\nfunction foot(s){\n var f=el(\"div\",\"foot\");\n useItems(s).forEach(function(x){var u=el(\"span\",\"use\");add(u,x[0],mini(x[1]),el(\"b\",null,x[1]+\"%\"));var w=useColor(x[1]);if(w)u.lastChild.style.color=w;f.appendChild(u);});\n if(s.branch){var g=el(\"span\",\"use\");add(g,\"git\",el(\"b\",null,s.branch));f.appendChild(g);}\n if(s.workspace)f.appendChild(el(\"span\",\"ws\",s.workspace));\n return f.childNodes.length?f:null;\n}\nfunction timeline(s){\n var t=el(\"div\",\"tline\"),cells=s.map.cells,n=cells.length;\n cells.forEach(function(c,i){\n var color=ramp(n<=1?0:i/(n-1)),cur=c.state===\"current\"&&s.state!==\"complete\",todo=c.state===\"pending\";\n var g=el(\"div\",\"stg \"+(cur?\"cur\":todo?\"todo\":\"done\"));g.style.setProperty(\"--c\",color);\n var nextCell=cells[i+1];if(!todo&&!cur&&nextCell&&nextCell.state!==\"pending\")g.style.setProperty(\"--line\",color);\n var l1=el(\"div\",\"line1\"),w;\n if(cur)w=el(\"span\",\"st nowpill\",c.label||c.word.toUpperCase());\n else{w=el(\"span\",\"w\",c.word);if(!todo)w.style.color=color;}\n var meta=el(\"span\",\"meta\");if(c.progress)meta.textContent=c.progress.done+\"/\"+c.progress.total;else if(!todo&&!cur)meta.textContent=c.label?c.label+\" \u2713\":\"\u2713\";\n add(l1,w,meta);add(g,el(\"span\",\"pt\"),l1);\n if(cur){\n var d=el(\"div\",\"detail\"),prog=c.progress;\n if(prog){var r1=el(\"div\",\"row\");add(r1,el(\"span\",\"dim\",\"tasks\"),el(\"b\",null,prog.done+\"/\"+prog.total),bar(prog.done,prog.total));d.appendChild(r1);}\n if(s.map.next){var r2=el(\"div\",\"row\");add(r2,el(\"span\",\"dim\",\"next\"),el(\"span\",\"acc\",\"\u25B8\"),el(\"span\",\"nx\",s.map.next));d.appendChild(r2);}\n var r3=el(\"div\",\"row\"),live=liveNode(s);if(live){r3.appendChild(live);d.appendChild(r3);}\n g.appendChild(d);\n }\n t.appendChild(g);\n });\n return t;\n}\nfunction usageBlock(s){\n var items=useItems(s);if(!items.length&&!s.branch&&!s.workspace)return null;\n var u=el(\"div\",\"usage\");\n items.forEach(function(x){var r=el(\"div\",\"ub\"),tr=el(\"span\",\"track\"),fill=el(\"i\"),w=useColor(x[1]);fill.style.width=x[1]+\"%\";fill.style.background=w||token(\"--acc\");tr.appendChild(fill);var pct=el(\"span\",\"pct\",x[1]+\"%\");if(w)pct.style.color=w;add(r,el(\"span\",null,x[0]),tr,pct);u.appendChild(r);});\n var g=el(\"div\",\"row\");if(s.branch)add(g,\"git\",el(\"b\",null,s.branch));if(s.workspace){if(s.branch)g.appendChild(joiner());g.appendChild(el(\"span\",null,s.workspace));}\n if(g.childNodes.length)u.appendChild(g);\n return u;\n}\nfunction renderInline(s){\n card.appendChild(head(s));\n if(s.state===\"ready\"){var hint=el(\"div\",\"row\");add(hint,el(\"span\",\"dim\",\"no LIT skill yet\"),joiner(),el(\"span\",\"dim\",\"type\"),el(\"kbd\",null,\"lit <task>\"),el(\"span\",\"dim\",\"to start one\"));hint.style.marginTop=\"6px\";card.appendChild(hint);return;}\n if(s.map)card.appendChild(mapRow(s));else card.appendChild(el(\"div\",\"map\"));\n card.appendChild(taskRow(s));\n var f=foot(s);if(!f)return;card.appendChild(f);\n /* a narrow card drops the workspace, then the branch, then the last use items, rather than cut a number */\n var ws=f.querySelector(\".ws\");if(ws&&ws.scrollWidth>ws.clientWidth+1)f.removeChild(ws);\n while(f.lastChild&&f.scrollWidth>f.clientWidth+1)f.removeChild(f.lastChild);\n if(!f.childNodes.length)card.removeChild(f);\n}\nfunction renderPane(s){\n card.appendChild(head(s));\n if(s.state===\"ready\"){\n var hero=el(\"div\",\"hero\"),hs=el(\"div\",\"heros\");add(hs,\"type \",el(\"kbd\",null,\"lit <task>\"),\" in this thread to start one\");\n var ex=el(\"div\",\"examples\");[\"lit add a --shout flag\",\"lit plan the release note\",\"lit-loop fix the parser\"].forEach(function(t){ex.appendChild(el(\"kbd\",null,t));});\n add(hero,el(\"div\",\"flame\",\"\uD83D\uDD25\"),el(\"div\",\"herot\",\"no LIT skill yet\"),hs,ex);card.appendChild(hero);\n }else{\n if(s.state===\"complete\"){var prog=progressOf(s.map),bn=el(\"div\",\"banner\",doneWord(s)+\" \u2713\");if(prog)add(bn,el(\"span\",\"dim\",prog.done+\"/\"+prog.total+\" tasks\"));if(s.ignitedAt)add(bn,el(\"span\",\"dim\",\"\u00B7 \"+span(took(s))));card.appendChild(bn);}\n if(s.map)card.appendChild(timeline(s));else{var r=el(\"div\",\"row\");r.style.marginTop=\"14px\";add(r,liveNode(s));card.appendChild(r);}\n }\n var u=usageBlock(s);if(u)card.appendChild(u);\n}\nfunction render(){\n var s=status;\n if(folded){root.classList.toggle(\"pane\",false);card.className=\"lc folded\";card.textContent=\"\";renderFolded(s);reportSize();return;}\n if(!s)return;\n var p=pane();root.classList.toggle(\"pane\",p);\n card.className=\"lc\"+(s.state===\"complete\"?\" is-done\":s.state===\"ready\"?\" is-idle\":\"\");\n card.textContent=\"\";\n if(p)renderPane(s);else renderInline(s);\n reportSize();\n}\nfunction tick(){\n if(ticker){clearInterval(ticker);ticker=null;}\n if(document.hidden||!card.querySelector(\"[data-since]\"))return;\n ticker=setInterval(function(){var n=card.querySelectorAll(\"[data-since]\");for(var i=0;i<n.length;i++)n[i].textContent=(n[i].getAttribute(\"data-bare\")?\"\":\"\u00B7 \")+clock(Date.now()-Number(n[i].getAttribute(\"data-since\")));},1000);\n}\n/* the card's own opening time comes only from the tool result that created it, never from a poll */\nfunction own(s){if(opened===null&&s&&s.card&&typeof s.card.openedAt===\"number\")opened=s.card.openedAt;}\nfunction fold(){\n folded=true;\n if(timer){clearTimeout(timer);timer=null;}\n if(ticker){clearInterval(ticker);ticker=null;}\n render();\n}\nfunction accept(s,fromTool){\n if(folded||!s||s.version!==1)return;\n if(fromTool)own(s);\n if(opened!==null&&typeof s.cardOpenedAt===\"number\"&&s.cardOpenedAt>opened){fold();return;}\n status=s;if(s.thread)thread=s.thread;\n if(s.working)idleSince=Date.now();\n render();tick();\n}\n\n/* host bridge: window.openai when present, else MCP Apps JSON-RPC over postMessage */\nfunction rpc(method,params){return new Promise(function(resolve,reject){var id=nextId++;pending[id]={resolve:resolve,reject:reject};window.parent.postMessage({jsonrpc:\"2.0\",id:id,method:method,params:params},\"*\");setTimeout(function(){if(pending[id]){delete pending[id];reject(new Error(method+\" timed out\"));}},5000);});}\nwindow.addEventListener(\"message\",function(ev){\n var m=ev.data;if(ev.source!==window.parent||!m||m.jsonrpc!==\"2.0\")return;\n if(m.id!=null&&pending[m.id]){var p=pending[m.id];delete pending[m.id];if(m.error)p.reject(m.error);else p.resolve(m.result);return;}\n if(m.method===\"ui/notifications/tool-result\"&&m.params)accept(m.params.structuredContent,true);\n if(m.method===\"ui/notifications/host-context-changed\"&&m.params){if(m.params.displayMode)hostMode=m.params.displayMode;applyTheme(m.params.theme||null);}\n});\nwindow.addEventListener(\"openai:set_globals\",function(){if(window.openai){var o=window.openai.toolOutput;own(o);applyTheme(window.openai.theme);if(o&&!status)accept(o,true);else render();}});\nfunction callStatus(){\n var args=thread?{thread_id:thread}:{};\n if(bridge===\"openai\")return window.openai.callTool(STATUS_TOOL,args).then(function(r){return r&&(r.structuredContent||r.result&&r.result.structuredContent);});\n return rpc(\"tools/call\",{name:STATUS_TOOL,arguments:args}).then(function(r){return r&&r.structuredContent;});\n}\nvar lastHeight=0;\nfunction reportSize(){\n if(pane())return;\n var h=Math.ceil(card.getBoundingClientRect().height)+2;if(h===lastHeight)return;lastHeight=h;\n if(bridge===\"openai\"&&typeof window.openai.notifyIntrinsicHeight===\"function\"){try{window.openai.notifyIntrinsicHeight(h);}catch(e){}}\n else if(bridge===\"mcp\")window.parent.postMessage({jsonrpc:\"2.0\",method:\"ui/notifications/size-changed\",params:{height:h}},\"*\");\n}\nfunction applyTheme(theme){\n var dark=theme?theme===\"dark\":!(window.matchMedia&&window.matchMedia(\"(prefers-color-scheme: light)\").matches);\n root.classList.toggle(\"light\",!dark);if(status)render();\n}\n\nfunction delay(){\n if(failures>0)return Math.min(MAX_BACKOFF,FAST*Math.pow(2,failures));\n if(status&&status.working)return FAST;\n return Date.now()-idleSince>120000?IDLE:SLOW;\n}\nfunction schedule(){if(timer)clearTimeout(timer);timer=null;if(!document.hidden&&!folded)timer=setTimeout(poll,delay());}\nfunction poll(){\n if(folded)return;\n callStatus().then(function(s){failures=0;accept(s);},function(){failures=Math.min(failures+1,5);}).then(schedule);\n}\ndocument.addEventListener(\"visibilitychange\",function(){if(folded)return;if(document.hidden){if(timer)clearTimeout(timer);timer=null;tick();}else{idleSince=Date.now();tick();poll();}});\nwindow.addEventListener(\"resize\",function(){if(status||folded)render();});\n\nfunction start(){\n if(window.openai&&typeof window.openai.callTool===\"function\"){\n bridge=\"openai\";applyTheme(window.openai.theme);if(window.openai.toolOutput)accept(window.openai.toolOutput,true);poll();return;\n }\n bridge=\"mcp\";applyTheme(null);\n rpc(\"ui/initialize\",{protocolVersion:\"2026-01-26\",appInfo:{name:\"lit-card\",version:\"1\"},appCapabilities:{availableDisplayModes:[\"inline\",\"fullscreen\"]}}).then(function(r){\n window.parent.postMessage({jsonrpc:\"2.0\",method:\"ui/notifications/initialized\",params:{}},\"*\");\n var ctx=r&&r.hostContext;if(ctx&&ctx.displayMode)hostMode=ctx.displayMode;applyTheme(ctx&&ctx.theme||null);poll();\n },function(){poll();});\n}\nif(window.matchMedia)window.matchMedia(\"(prefers-color-scheme: light)\").addEventListener(\"change\",function(){if(!(window.openai&&window.openai.theme))applyTheme(null);});\nstart();\n})();\n</script></body></html>\n";
|
|
@@ -11,26 +11,31 @@
|
|
|
11
11
|
// card drew in a proportional face inside the app, so it pins its monospace face. Light and dark follow the
|
|
12
12
|
// host theme. It polls every 1.5 s while visible and working, slows down when idle and stops while
|
|
13
13
|
// hidden. It talks to the host through `window.openai` when present, else MCP Apps postMessage JSON-RPC.
|
|
14
|
+
//
|
|
15
|
+
// Every LIT turn opens a fresh card next to the newest turn. A card learns its own opening time once, from
|
|
16
|
+
// the tool result that created it; each poll names the thread's newest card. When that is a later card,
|
|
17
|
+
// this one folds into a single quiet line with its final state, stops every timer and never polls again.
|
|
18
|
+
// Usage bars stay in the calm accent until 70 % (amber) and 90 % (red); pink and flame are for LIT marks.
|
|
14
19
|
export const CARD_HTML = `<!doctype html>
|
|
15
20
|
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
16
21
|
<title>LIT</title>
|
|
17
22
|
<style>
|
|
18
23
|
:root{color-scheme:dark;--bg:#10141c;--bg2:#0d1118;--ink:#e6edf3;--dim:#7d8590;--faint:#30363d;--rail:#3a434e;--flame:#ff6337;--pink:#ff2d95;--acc:#5fd7ff;--accfill:#5fd7ff;--green:#6bdb8f;--amber:#ffaf3c;--red:#ff5f5f;--pillink:#0b0f14;
|
|
19
24
|
--mono:"SF Mono",SFMono-Regular,ui-monospace,Menlo,Monaco,Consolas,"Liberation Mono",monospace}
|
|
20
|
-
:root.light{color-scheme:light;--bg:#ffffff;--bg2:#fafbfd;--ink:#1b1f27;--dim:#
|
|
25
|
+
:root.light{color-scheme:light;--bg:#ffffff;--bg2:#fafbfd;--ink:#1b1f27;--dim:#5f6672;--faint:#dde2e8;--rail:#cfd6de;--flame:#bd3f0b;--pink:#c0186b;--acc:#006f99;--green:#17783f;--amber:#9a5b00;--red:#c42f2f}
|
|
21
26
|
*{box-sizing:border-box}
|
|
22
27
|
html,body{margin:0;background:transparent}
|
|
23
28
|
body{color:var(--ink);font-size:12.5px;line-height:1.55;font-weight:500;-webkit-font-smoothing:antialiased}
|
|
24
29
|
.lc,.lc *{font-family:var(--mono)!important}
|
|
25
30
|
.lc{position:relative;border-radius:14px;padding:11px 14px 10px;margin:1px;
|
|
26
|
-
background:radial-gradient(110% 120% at 0% 0%,color-mix(in srgb,var(--pink) 8%,
|
|
31
|
+
background:radial-gradient(110% 120% at 0% 0%,color-mix(in srgb,var(--pink) 8%,var(--bg)),var(--bg) 55%,var(--bg2));
|
|
27
32
|
border:1px solid color-mix(in srgb,var(--acc) 55%,transparent);box-shadow:0 0 0 1px color-mix(in srgb,var(--acc) 8%,transparent),0 10px 30px -18px color-mix(in srgb,var(--acc) 50%,transparent);animation:breathe 4.8s ease-in-out infinite}
|
|
28
33
|
.lc.is-done{border-color:color-mix(in srgb,var(--green) 55%,transparent);box-shadow:0 0 0 1px color-mix(in srgb,var(--green) 8%,transparent);animation:none}
|
|
29
34
|
.lc.is-idle{border-color:color-mix(in srgb,var(--dim) 40%,transparent);box-shadow:none;animation:none}
|
|
30
35
|
@keyframes breathe{0%,100%{border-color:color-mix(in srgb,var(--acc) 38%,transparent)}50%{border-color:color-mix(in srgb,var(--acc) 80%,transparent)}}
|
|
31
36
|
.head{display:flex;align-items:center;gap:7px;white-space:nowrap;min-height:22px}
|
|
32
37
|
.brand{position:relative;overflow:hidden;display:inline-flex;align-items:center;gap:3px;padding:1px 9px 1px 7px;border-radius:999px;background:linear-gradient(90deg,#ff2d95,#ff6337);color:#0b0f14;font-weight:800;letter-spacing:.03em;box-shadow:0 0 16px -6px rgba(255,45,149,.6)}
|
|
33
|
-
.j{
|
|
38
|
+
.j{display:inline-block;flex:0 0 auto;width:3px;height:3px;border-radius:50%;background:var(--rail)}
|
|
34
39
|
.name{font-weight:700;overflow:hidden;text-overflow:ellipsis}.acc{color:var(--acc)}.dim{color:var(--dim)}.ok{color:var(--green)}
|
|
35
40
|
.right{margin-left:auto;font-weight:700;letter-spacing:.04em;display:inline-flex;align-items:center;gap:6px}
|
|
36
41
|
.dot{width:6px;height:6px;border-radius:50%;background:var(--acc);box-shadow:0 0 7px var(--acc);animation:pulse 1.6s ease-in-out infinite}
|
|
@@ -43,9 +48,9 @@ border:1px solid color-mix(in srgb,var(--acc) 55%,transparent);box-shadow:0 0 0
|
|
|
43
48
|
:root.light .comet{background:var(--accfill);box-shadow:0 0 5px 1px var(--accfill)}
|
|
44
49
|
@keyframes comet{0%{left:-8%;opacity:0}15%,85%{opacity:1}100%{left:100%;opacity:0}}
|
|
45
50
|
.nowpill{position:relative;overflow:hidden;display:inline-flex;gap:6px;align-items:center;padding:0 9px;border-radius:999px;background:var(--accfill);color:var(--pillink);font-weight:800;box-shadow:0 0 14px -4px color-mix(in srgb,var(--accfill) 80%,transparent)}
|
|
46
|
-
.
|
|
51
|
+
.brand::after,.nowpill::after{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,rgba(255,255,255,.7) 50%,transparent 70%);transform:translateX(-120%);animation:sweep 3.2s ease-in-out infinite;pointer-events:none}
|
|
47
52
|
@keyframes sweep{0%,55%{transform:translateX(-120%)}85%,100%{transform:translateX(120%)}}
|
|
48
|
-
.is-done .
|
|
53
|
+
.is-done .brand::after,.is-idle .brand::after,.folded .brand::after{display:none}
|
|
49
54
|
.row{display:flex;align-items:center;gap:8px;white-space:nowrap;min-height:20px}
|
|
50
55
|
.tl{display:inline-flex;align-items:center;gap:6px;overflow:hidden;min-width:0}
|
|
51
56
|
.nx{overflow:hidden;text-overflow:ellipsis}
|
|
@@ -81,7 +86,13 @@ kbd{font-size:12px;color:var(--acc);background:color-mix(in srgb,var(--acc) 12%,
|
|
|
81
86
|
.hero{text-align:center;padding:36px 0 10px}.flame{font-size:40px;filter:drop-shadow(0 0 16px rgba(255,99,55,.45))}
|
|
82
87
|
.herot{font-weight:700;font-size:15px;margin-top:8px}.heros{color:var(--dim);margin:6px 0 14px}
|
|
83
88
|
.examples{display:flex;flex-direction:column;align-items:center;gap:6px}
|
|
84
|
-
|
|
89
|
+
/* an earlier turn's card, once a newer one opened below: one quiet line, no glow, no motion */
|
|
90
|
+
.lc.folded{padding:3px 10px;border-radius:10px;background:var(--bg);border:1px solid color-mix(in srgb,var(--dim) 30%,transparent);box-shadow:none;animation:none;font-size:12px}
|
|
91
|
+
.lc.folded .head{min-height:20px;gap:6px}
|
|
92
|
+
.lc.folded .brand{padding:0 7px 0 6px;font-size:11px;background:color-mix(in srgb,var(--dim) 24%,var(--bg));color:var(--ink);box-shadow:none;filter:grayscale(1)}
|
|
93
|
+
.lc.folded .name{color:var(--dim);font-weight:600}
|
|
94
|
+
.lc.folded .right{font-weight:600;letter-spacing:0;flex:0 0 auto}
|
|
95
|
+
@media (prefers-reduced-motion:reduce){.lc,.lc *{animation:none!important}.brand::after,.nowpill::after,.comet{display:none}}
|
|
85
96
|
</style></head>
|
|
86
97
|
<body><div id="card" class="lc is-idle" role="status" aria-live="polite"><div class="head"><span class="brand">🔥 LIT</span><span class="j">·</span><span class="name dim">starting…</span></div></div>
|
|
87
98
|
<script>
|
|
@@ -90,11 +101,12 @@ var STATUS_TOOL="lit_card_status";
|
|
|
90
101
|
var FAST=1500,SLOW=5000,IDLE=15000,MAX_BACKOFF=30000;
|
|
91
102
|
var root=document.documentElement,card=document.getElementById("card");
|
|
92
103
|
var status=null,thread=null,timer=null,ticker=null,failures=0,idleSince=Date.now(),bridge=null,hostMode=null;
|
|
104
|
+
var opened=null,folded=false;
|
|
93
105
|
var nextId=1,pending={};
|
|
94
106
|
|
|
95
107
|
function el(tag,cls,text){var n=document.createElement(tag);if(cls)n.className=cls;if(text!=null)n.textContent=String(text);return n;}
|
|
96
108
|
function add(parent){for(var i=1;i<arguments.length;i++){var c=arguments[i];if(c!=null)parent.appendChild(typeof c==="string"?document.createTextNode(c):c);}return parent;}
|
|
97
|
-
function joiner(){
|
|
109
|
+
function joiner(){var n=el("span","j");n.setAttribute("aria-hidden","true");return n;}
|
|
98
110
|
|
|
99
111
|
/* linear-RGB mixing, so the flame → pink → accent ramp keeps its brightness */
|
|
100
112
|
function hex(c){c=c.trim().replace("#","");return[0,2,4].map(function(i){return parseInt(c.substr(i,2),16)/255;});}
|
|
@@ -107,6 +119,7 @@ function ramp(t){var f=token("--flame"),p=token("--pink"),a=token("--acc");retur
|
|
|
107
119
|
function clock(ms){var s=Math.max(0,Math.floor(ms/1000));return Math.floor(s/60)+":"+("0"+(s%60)).slice(-2);}
|
|
108
120
|
function span(ms){var s=Math.max(1,Math.round(ms/1000));if(s<60)return s+"s";var m=Math.floor(s/60);if(m<60)return s%60?m+"m "+(s%60)+"s":m+"m";return Math.floor(m/60)+"h "+(m%60)+"m";}
|
|
109
121
|
function since(t){var n=el("span","dim el","· "+clock(Date.now()-t));n.setAttribute("data-since",String(t));return n;}
|
|
122
|
+
function turnClock(t){var n=el("span","el",clock(Date.now()-t));n.setAttribute("data-since",String(t));n.setAttribute("data-bare","1");return n;}
|
|
110
123
|
function pane(){var m=(window.openai&&window.openai.displayMode)||hostMode;return m==="fullscreen"||m==="pip";}
|
|
111
124
|
|
|
112
125
|
function bar(done,total){
|
|
@@ -117,7 +130,7 @@ function bar(done,total){
|
|
|
117
130
|
return b;
|
|
118
131
|
}
|
|
119
132
|
function useColor(p){return p>=90?token("--red"):p>=70?token("--amber"):null;}
|
|
120
|
-
function mini(p){var b=el("span","mini"),on=Math.round(p/10),
|
|
133
|
+
function mini(p){var b=el("span","mini"),on=Math.round(p/10),fill=useColor(p)||token("--acc");for(var i=0;i<10;i++){var c=el("i");if(i<on)c.style.background=fill;b.appendChild(c);}return b;}
|
|
121
134
|
function spinner(soft){
|
|
122
135
|
var ns="http://www.w3.org/2000/svg",svg=document.createElementNS(ns,"svg");
|
|
123
136
|
svg.setAttribute("class","spin"+(soft?" soft":""));svg.setAttribute("viewBox","0 0 16 16");svg.setAttribute("width","12");svg.setAttribute("height","12");svg.setAttribute("aria-hidden","true");
|
|
@@ -125,7 +138,6 @@ function spinner(soft){
|
|
|
125
138
|
[["cx","8"],["cy","8"],["r","5.6"],["fill","none"],["stroke","currentColor"],["stroke-width","2.2"],["stroke-dasharray","24 11.2"],["stroke-linecap","round"]].forEach(function(a){c.setAttribute(a[0],a[1]);});
|
|
126
139
|
svg.appendChild(c);return svg;
|
|
127
140
|
}
|
|
128
|
-
function currentCell(map){if(!map)return null;for(var i=0;i<map.cells.length;i++)if(map.cells[i].state==="current")return map.cells[i];return null;}
|
|
129
141
|
function progressOf(map){if(!map)return null;for(var i=0;i<map.cells.length;i++)if(map.cells[i].progress)return map.cells[i].progress;return null;}
|
|
130
142
|
function doneWord(s){return progressOf(s.map)?"COMPLETE":"DONE";}
|
|
131
143
|
function took(s){if(s.turnEndedAt)return s.turnEndedAt-(s.turnStartedAt||s.ignitedAt||s.turnEndedAt);return (s.lastStepAt||s.now)-s.ignitedAt;}
|
|
@@ -135,16 +147,26 @@ function liveNode(s){
|
|
|
135
147
|
var n=el("span","live");
|
|
136
148
|
if(s.step){add(n,spinner(false),el("span","tool",s.step.tool),since(s.step.startedAt));return n;}
|
|
137
149
|
if(s.state==="complete"){n.className="live done";add(n,"✓ ",el("span",null,doneWord(s)==="DONE"?"turn done":"all done"));if(s.ignitedAt)add(n,el("span","dim","in "+span(took(s))));return n;}
|
|
138
|
-
if(s.state==="ignited"&&s.working){add(n,spinner(true),el("span","dim","thinking"));if(s.
|
|
150
|
+
if(s.state==="ignited"&&s.working){add(n,spinner(true),el("span","dim","thinking"));if(s.lastTool)add(n,el("span","dim","· last"),el("span","acc","▸"),el("span","last",s.lastTool));return n;}
|
|
139
151
|
if(s.state==="ignited"){add(n,el("span","dim","◦ waiting for you"));return n;}
|
|
140
152
|
return null;
|
|
141
153
|
}
|
|
154
|
+
/* the header's right side: the turn clock while working (the map already names the stage), the result once done */
|
|
142
155
|
function head(s){
|
|
143
|
-
var h=el("div","head")
|
|
156
|
+
var h=el("div","head");add(h,el("span","brand","🔥 LIT"),joiner());
|
|
144
157
|
if(s.state==="ready"){add(h,el("span","name dim","ready"),el("span","right dim","idle"));return h;}
|
|
145
158
|
add(h,el("span","name acc",s.mode||"lit"));
|
|
146
159
|
if(s.state==="complete"){add(h,el("span","right ok",doneWord(s)+" ✓"));return h;}
|
|
147
|
-
var
|
|
160
|
+
var r=el("span","right acc");if(!s.map)r.appendChild(el("span",null,"IGNITED"));
|
|
161
|
+
if(s.working){if(s.turnStartedAt)r.appendChild(turnClock(s.turnStartedAt));r.appendChild(el("i","dot"));}
|
|
162
|
+
if(r.childNodes.length)h.appendChild(r);return h;
|
|
163
|
+
}
|
|
164
|
+
/* an earlier turn's card: the LIT mark, its mode and how it ended, on one line */
|
|
165
|
+
function renderFolded(s){
|
|
166
|
+
var h=el("div","head");add(h,el("span","brand","🔥 LIT"),joiner(),el("span","name",s&&s.mode||"lit"));
|
|
167
|
+
if(s&&s.state==="complete"){var r=el("span","right ok",doneWord(s).toLowerCase()+" ✓");if(s.ignitedAt)add(r," ",el("span","dim",span(took(s))));h.appendChild(r);}
|
|
168
|
+
else h.appendChild(el("span","right dim","continued below ↓"));
|
|
169
|
+
card.appendChild(h);
|
|
148
170
|
}
|
|
149
171
|
function pillExtra(c){var l=(c.label||"").toLowerCase(),w=c.word.toLowerCase();if(!l||l===w)return"";return l.indexOf(w+" ")===0?l.slice(w.length+1):l;}
|
|
150
172
|
function stageWord(c){var w=c.word;if(c.state==="done"&&c.label)w+=" "+c.label;else if(c.progress&&c.state!=="current")w+=" "+c.progress.done+"/"+c.progress.total;return w;}
|
|
@@ -160,7 +182,7 @@ function mapRow(s){
|
|
|
160
182
|
m.appendChild(r);
|
|
161
183
|
}
|
|
162
184
|
if(cur){
|
|
163
|
-
var p=el("span","st nowpill"
|
|
185
|
+
var p=el("span","st nowpill",c.word);var extra=pillExtra(c);if(extra)add(p,el("b",null,extra));if(c.progress)add(p,el("b",null,c.progress.done+"/"+c.progress.total));m.appendChild(p);lastColor=token("--acc");
|
|
164
186
|
}else if(c.state==="pending"){var t=el("span","st todo",c.word);t.appendChild(el("em",null,"·"));m.appendChild(t);}
|
|
165
187
|
else{var d=el("span","st done",stageWord(c));d.style.color=color;d.appendChild(el("em",null,c.state==="partial"?"…":"✓"));m.appendChild(d);lastColor=color;}
|
|
166
188
|
});
|
|
@@ -196,7 +218,7 @@ function timeline(s){
|
|
|
196
218
|
var g=el("div","stg "+(cur?"cur":todo?"todo":"done"));g.style.setProperty("--c",color);
|
|
197
219
|
var nextCell=cells[i+1];if(!todo&&!cur&&nextCell&&nextCell.state!=="pending")g.style.setProperty("--line",color);
|
|
198
220
|
var l1=el("div","line1"),w;
|
|
199
|
-
if(cur)
|
|
221
|
+
if(cur)w=el("span","st nowpill",c.label||c.word.toUpperCase());
|
|
200
222
|
else{w=el("span","w",c.word);if(!todo)w.style.color=color;}
|
|
201
223
|
var meta=el("span","meta");if(c.progress)meta.textContent=c.progress.done+"/"+c.progress.total;else if(!todo&&!cur)meta.textContent=c.label?c.label+" ✓":"✓";
|
|
202
224
|
add(l1,w,meta);add(g,el("span","pt"),l1);
|
|
@@ -214,7 +236,7 @@ function timeline(s){
|
|
|
214
236
|
function usageBlock(s){
|
|
215
237
|
var items=useItems(s);if(!items.length&&!s.branch&&!s.workspace)return null;
|
|
216
238
|
var u=el("div","usage");
|
|
217
|
-
items.forEach(function(x){var r=el("div","ub"),tr=el("span","track"),fill=el("i"),w=useColor(x[1]);fill.style.width=x[1]+"%";fill.style.background=w||
|
|
239
|
+
items.forEach(function(x){var r=el("div","ub"),tr=el("span","track"),fill=el("i"),w=useColor(x[1]);fill.style.width=x[1]+"%";fill.style.background=w||token("--acc");tr.appendChild(fill);var pct=el("span","pct",x[1]+"%");if(w)pct.style.color=w;add(r,el("span",null,x[0]),tr,pct);u.appendChild(r);});
|
|
218
240
|
var g=el("div","row");if(s.branch)add(g,"git",el("b",null,s.branch));if(s.workspace){if(s.branch)g.appendChild(joiner());g.appendChild(el("span",null,s.workspace));}
|
|
219
241
|
if(g.childNodes.length)u.appendChild(g);
|
|
220
242
|
return u;
|
|
@@ -224,7 +246,11 @@ function renderInline(s){
|
|
|
224
246
|
if(s.state==="ready"){var hint=el("div","row");add(hint,el("span","dim","no LIT skill yet"),joiner(),el("span","dim","type"),el("kbd",null,"lit <task>"),el("span","dim","to start one"));hint.style.marginTop="6px";card.appendChild(hint);return;}
|
|
225
247
|
if(s.map)card.appendChild(mapRow(s));else card.appendChild(el("div","map"));
|
|
226
248
|
card.appendChild(taskRow(s));
|
|
227
|
-
var f=foot(s);if(f)
|
|
249
|
+
var f=foot(s);if(!f)return;card.appendChild(f);
|
|
250
|
+
/* a narrow card drops the workspace, then the branch, then the last use items, rather than cut a number */
|
|
251
|
+
var ws=f.querySelector(".ws");if(ws&&ws.scrollWidth>ws.clientWidth+1)f.removeChild(ws);
|
|
252
|
+
while(f.lastChild&&f.scrollWidth>f.clientWidth+1)f.removeChild(f.lastChild);
|
|
253
|
+
if(!f.childNodes.length)card.removeChild(f);
|
|
228
254
|
}
|
|
229
255
|
function renderPane(s){
|
|
230
256
|
card.appendChild(head(s));
|
|
@@ -239,7 +265,9 @@ function renderPane(s){
|
|
|
239
265
|
var u=usageBlock(s);if(u)card.appendChild(u);
|
|
240
266
|
}
|
|
241
267
|
function render(){
|
|
242
|
-
var s=status;
|
|
268
|
+
var s=status;
|
|
269
|
+
if(folded){root.classList.toggle("pane",false);card.className="lc folded";card.textContent="";renderFolded(s);reportSize();return;}
|
|
270
|
+
if(!s)return;
|
|
243
271
|
var p=pane();root.classList.toggle("pane",p);
|
|
244
272
|
card.className="lc"+(s.state==="complete"?" is-done":s.state==="ready"?" is-idle":"");
|
|
245
273
|
card.textContent="";
|
|
@@ -249,10 +277,20 @@ function render(){
|
|
|
249
277
|
function tick(){
|
|
250
278
|
if(ticker){clearInterval(ticker);ticker=null;}
|
|
251
279
|
if(document.hidden||!card.querySelector("[data-since]"))return;
|
|
252
|
-
ticker=setInterval(function(){var n=card.querySelectorAll("[data-since]");for(var i=0;i<n.length;i++)n[i].textContent="· "+clock(Date.now()-Number(n[i].getAttribute("data-since")));},1000);
|
|
280
|
+
ticker=setInterval(function(){var n=card.querySelectorAll("[data-since]");for(var i=0;i<n.length;i++)n[i].textContent=(n[i].getAttribute("data-bare")?"":"· ")+clock(Date.now()-Number(n[i].getAttribute("data-since")));},1000);
|
|
281
|
+
}
|
|
282
|
+
/* the card's own opening time comes only from the tool result that created it, never from a poll */
|
|
283
|
+
function own(s){if(opened===null&&s&&s.card&&typeof s.card.openedAt==="number")opened=s.card.openedAt;}
|
|
284
|
+
function fold(){
|
|
285
|
+
folded=true;
|
|
286
|
+
if(timer){clearTimeout(timer);timer=null;}
|
|
287
|
+
if(ticker){clearInterval(ticker);ticker=null;}
|
|
288
|
+
render();
|
|
253
289
|
}
|
|
254
|
-
function accept(s){
|
|
255
|
-
if(
|
|
290
|
+
function accept(s,fromTool){
|
|
291
|
+
if(folded||!s||s.version!==1)return;
|
|
292
|
+
if(fromTool)own(s);
|
|
293
|
+
if(opened!==null&&typeof s.cardOpenedAt==="number"&&s.cardOpenedAt>opened){fold();return;}
|
|
256
294
|
status=s;if(s.thread)thread=s.thread;
|
|
257
295
|
if(s.working)idleSince=Date.now();
|
|
258
296
|
render();tick();
|
|
@@ -263,10 +301,10 @@ function rpc(method,params){return new Promise(function(resolve,reject){var id=n
|
|
|
263
301
|
window.addEventListener("message",function(ev){
|
|
264
302
|
var m=ev.data;if(ev.source!==window.parent||!m||m.jsonrpc!=="2.0")return;
|
|
265
303
|
if(m.id!=null&&pending[m.id]){var p=pending[m.id];delete pending[m.id];if(m.error)p.reject(m.error);else p.resolve(m.result);return;}
|
|
266
|
-
if(m.method==="ui/notifications/tool-result"&&m.params)accept(m.params.structuredContent);
|
|
304
|
+
if(m.method==="ui/notifications/tool-result"&&m.params)accept(m.params.structuredContent,true);
|
|
267
305
|
if(m.method==="ui/notifications/host-context-changed"&&m.params){if(m.params.displayMode)hostMode=m.params.displayMode;applyTheme(m.params.theme||null);}
|
|
268
306
|
});
|
|
269
|
-
window.addEventListener("openai:set_globals",function(){if(window.openai){applyTheme(window.openai.theme);if(
|
|
307
|
+
window.addEventListener("openai:set_globals",function(){if(window.openai){var o=window.openai.toolOutput;own(o);applyTheme(window.openai.theme);if(o&&!status)accept(o,true);else render();}});
|
|
270
308
|
function callStatus(){
|
|
271
309
|
var args=thread?{thread_id:thread}:{};
|
|
272
310
|
if(bridge==="openai")return window.openai.callTool(STATUS_TOOL,args).then(function(r){return r&&(r.structuredContent||r.result&&r.result.structuredContent);});
|
|
@@ -289,16 +327,17 @@ function delay(){
|
|
|
289
327
|
if(status&&status.working)return FAST;
|
|
290
328
|
return Date.now()-idleSince>120000?IDLE:SLOW;
|
|
291
329
|
}
|
|
292
|
-
function schedule(){if(timer)clearTimeout(timer);timer=null;if(!document.hidden)timer=setTimeout(poll,delay());}
|
|
330
|
+
function schedule(){if(timer)clearTimeout(timer);timer=null;if(!document.hidden&&!folded)timer=setTimeout(poll,delay());}
|
|
293
331
|
function poll(){
|
|
332
|
+
if(folded)return;
|
|
294
333
|
callStatus().then(function(s){failures=0;accept(s);},function(){failures=Math.min(failures+1,5);}).then(schedule);
|
|
295
334
|
}
|
|
296
|
-
document.addEventListener("visibilitychange",function(){if(document.hidden){if(timer)clearTimeout(timer);timer=null;tick();}else{idleSince=Date.now();tick();poll();}});
|
|
297
|
-
window.addEventListener("resize",function(){if(status)render();});
|
|
335
|
+
document.addEventListener("visibilitychange",function(){if(folded)return;if(document.hidden){if(timer)clearTimeout(timer);timer=null;tick();}else{idleSince=Date.now();tick();poll();}});
|
|
336
|
+
window.addEventListener("resize",function(){if(status||folded)render();});
|
|
298
337
|
|
|
299
338
|
function start(){
|
|
300
339
|
if(window.openai&&typeof window.openai.callTool==="function"){
|
|
301
|
-
bridge="openai";applyTheme(window.openai.theme);if(window.openai.toolOutput)accept(window.openai.toolOutput);poll();return;
|
|
340
|
+
bridge="openai";applyTheme(window.openai.theme);if(window.openai.toolOutput)accept(window.openai.toolOutput,true);poll();return;
|
|
302
341
|
}
|
|
303
342
|
bridge="mcp";applyTheme(null);
|
|
304
343
|
rpc("ui/initialize",{protocolVersion:"2026-01-26",appInfo:{name:"lit-card",version:"1"},appCapabilities:{availableDisplayModes:["inline","fullscreen"]}}).then(function(r){
|