@litfamily/litcodex 1.0.23 → 1.0.25
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 +13 -13
- package/dist/install/generated-skill-payload-hashes.js +13 -13
- 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/dist/deliverable-hedge-guard.js +23 -2
- 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 +55 -1
- package/marketplace/plugins/litcodex/skills/lit-humanizer/scripts/core.mjs +13 -2
- 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 +55 -1
- package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/scripts/core.mjs +13 -2
- package/package.json +2 -2
- package/readme-assets/badge-version.svg +1 -1
|
@@ -29,7 +29,7 @@ Inputs are the user's requested document, supplied facts or source files, output
|
|
|
29
29
|
| Create | A report, proposal, or Word deliverable is requested | Write the direction card, preserve Markdown, produce DOCX in the chosen tonality, run the gate with page checks, and inspect pages. |
|
|
30
30
|
| Convert | A DOCX or PDF source is supplied for Markdown extraction | Use the supported converter and compare source and output. |
|
|
31
31
|
| Edit | A DOCX is supplied for an authorized modification | Work on a copy, check match count, and reopen the result. |
|
|
32
|
-
| Blocked | A required converter is unavailable | Keep valid source and name the exact
|
|
32
|
+
| Blocked | A required converter is unavailable | Keep valid source and name the exact missing capability in the reply. |
|
|
33
33
|
|
|
34
34
|
## #contract.procedure
|
|
35
35
|
|
|
@@ -88,7 +88,7 @@ Set `OFFICE` to the installed `plugins/litcodex/skills/lit-pptx/scripts/office-r
|
|
|
88
88
|
4. Convert: `node "$OFFICE" docx convert doc.md doc.docx` (the frontmatter tonality applies; `--tonality <Name>` and `--density <n>` override it). For a publisher submission use `--publisher <profile>` with no tonality (the profile's rules stand; the converter only keeps text 8 pt clear of a table, a table caption and a figure caption); profile templates live under `templates/docx/` and `templates/registry.yaml`, and the six packs under `templates/tonalities/`.
|
|
89
89
|
5. Gate: `node "$OFFICE" docx qa doc.docx --source doc.md --layout`. It reports the office floor (OF-301 measure advisory, OF-302 numeric alignment HIGH), a content check (every source heading reached the page, no blank, no printed frontmatter), noun-phrase headings and heading order, a notice written with a colon rather than a spaced dash (`notice.dash`, failing on a tonality document), the restraint checks on a tonality document (accent kinds, ink headings, heading ratio, table fills, component budget, header chips; ISO dates on every path) and, with `--layout`, the rendered pages (fill, stranded headings, splits, component variety, cover block, `memo.fit`: a memo never spills onto a second page it fills under a quarter of the frame, `page.spill`: no second page filled under 0.4 and no last page holding a paragraph or two, `list.split`: a list of up to six items stays on one page and in one column (a five- or six-item list may break once in a column, two items each side), `heading.column`: no heading at the foot of a column while its text opens the next, `columns.balance`: no column a quarter short beside a full one and a last page with even columns, and `heading.apart`: a heading and its lead sentence stand on the page where their table starts). Fix the source from each finding and convert again; never weaken the gate. When the user compares two tonalities, add `--compare other.docx`: the two must differ in at least three structural features. Without `soffice` the page checks do not run; say so.
|
|
90
90
|
6. Render with `node "$OFFICE" docx audit doc.docx --out-dir <preview-dir>` when `soffice` is available and inspect every page at reading size. If `soffice` aborts (including exit 134) or sandbox policy blocks it, reopen the DOCX structurally and state "visual thumbnails skipped". A structure-only check is not visual proof. LibreOffice previews may break Hangul inside a word; Word breaks between 어절.
|
|
91
|
-
7. For PDF output, run `node "$OFFICE" docx pdf doc.md doc.pdf --publisher <profile>` when the required XeLaTeX path is available, or convert the gated DOCX with `soffice`. If the tool is missing,
|
|
91
|
+
7. For PDF output, run `node "$OFFICE" docx pdf doc.md doc.pdf --publisher <profile>` when the required XeLaTeX path is available, or convert the gated DOCX with `soffice`. If the tool is missing, say so in the reply and keep the valid Markdown/DOCX outputs. Verify that the PDF opens and inspect pages.
|
|
92
92
|
|
|
93
93
|
## Convert or edit an existing file
|
|
94
94
|
|
|
@@ -22,7 +22,7 @@ tonality: Report
|
|
|
22
22
|
- 정원 2,880명 중 2,045명 참석
|
|
23
23
|
:::
|
|
24
24
|
|
|
25
|
-
이 보고는 대출, 좌석, 프로그램 세 영역을 차례로 보고, 4분기에 바로 할 수 있는 조정 세 가지를 제안한다.
|
|
25
|
+
이 보고는 대출, 좌석, 프로그램 세 영역을 차례로 보고, 4분기에 바로 할 수 있는 조정 세 가지를 제안한다. 증축이나 인력 증원은 비용이 커서 다음 예산 협의에서 따로 다룬다.
|
|
26
26
|
|
|
27
27
|
# 대출 현황
|
|
28
28
|
|
|
@@ -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 or a 비교하려는/위한 것이 아님 form, a comparison or ranking noun with a negated use or reading verb, a purpose-용 data noun with 아님, numbers said to be incomparable or a ranking refused for this data, or a table whose row order is said not to be a ranking; ko-negative-pledge-repeat fires when two such disclaimer sentences share a document; en-negative-pledge needs a comparison, benchmark or ranking noun. The three rules also read a quote line that opens with a bold label (`> **주의:** …`), because that is the author's own callout; a plain `>` quote stays unread. 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,60 @@
|
|
|
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*주(?:세요|십시오))|(?:으)?면\\s*(?:[*_]{1,2}\\s*)?안\\s*(?:됨|된다|됩니다)(?![가-힣]))|(?:(?:비교|결론|벤치마크|순위|대표값|일반화)(?:이|가)|목적이|(?:위한|려는)\\s*것이)\\s*(?:[*_]{1,2}\\s*)?(?:아님|아니다|아닙니다)(?![가-힣])|순위표(?:이|가)\\s*(?:[*_]{1,2}\\s*)?(?:아님|아니다|아닙니다|아니고)(?![가-힣]))|(?:비교|결론|벤치마크|순위|대표값|일반화)(?:처럼|으로|로)\\s*(?:[*_]{1,2}\\s*)?(?:쓰|사용하|해석하|읽|간주하|인용하)(?:지\\s*(?:[*_]{1,2}\\s*)?(?:않(?:음|는다|습니다)|말\\s*것|마세요|마십시오|말아\\s*주(?:세요|십시오))|(?:으)?면\\s*(?:[*_]{1,2}\\s*)?안\\s*(?:됨|된다|됩니다)(?![가-힣]))|(?:공개|배포|대외|외부|홍보|발표|보고|비교|인용|공식)용\\s*(?:자료|문서|수치|표|그래프)(?:이|가)\\s*(?:[*_]{1,2}\\s*)?(?:아님|아니다|아닙니다)(?![가-힣])|(?<![가-힣])(?:숫자|수치)(?:들)?(?:은|는|이|가|을|를|끼리|도)(?![가-힣])(?:(?!면\\s)[^.!?\\n]){0,40}?(?<![와과]\\s)(?<![와과])비교할\\s*수\\s*(?:는\\s*)?없(?:다|습니다|음|나)(?![가-힣])|(?<![가-힣])(?:숫자|수치)(?:들)?끼리\\s*(?:서로\\s*|직접\\s*)?비교(?:해서|하여|해)\\s[^.!?\\n]{0,30}?[\"”’']\\s*(?:는|라는)\\s*결론[^.!?\\n]{0,8}?(?:수\\s*없(?:다|습니다)(?![가-힣])|(?:으)?면\\s*(?:[*_]{1,2}\\s*)?안\\s*(?:됨|된다|됩니다)(?![가-힣]))|(?:(?<![가-힣])(?:숫자|수치)(?:들)?|(?<![가-힣])(?:이|위|아래|본)\\s+(?:표|값|자료|그래프|차트))[^.!?\\n]{0,40}?(?:빠르|느리)다고\\s*판단하(?:지\\s*(?:[*_]{1,2}\\s*)?(?:말\\s*것|마세요|마십시오|말아\\s*주(?:세요|십시오))|(?:으)?면\\s*(?:[*_]{1,2}\\s*)?안\\s*(?:됨|된다|됩니다)(?![가-힣]))|(?:빠르|느리)다[\"”’']?\\s*(?:는|라는)\\s*식으로\\s*읽(?:지\\s*(?:[*_]{1,2}\\s*)?(?:말\\s*것|마세요|마십시오|말아\\s*주(?:세요|십시오))|(?:으)?면\\s*(?:[*_]{1,2}\\s*)?안\\s*(?:됨|된다|됩니다)(?![가-힣]))|만으로\\s[^.!?\\n]{0,40}?(?<![가-힣])순위를\\s*정하[^.!?\\n]{0,25}?(?:수\\s*없(?:다|습니다|음)(?![가-힣])|(?:해|하)서는\\s*안\\s*(?:됨|된다|됩니다)(?![가-힣]))|(?<![가-힣])순위[^.!?\\n]{0,20}?근거로\\s*(?:[*_]{1,2}\\s*)?사용할\\s*수\\s*(?:는\\s*)?없(?:다|습니다|음)(?![가-힣])|할\\s*수\\s*없는\\s*것\\s{0,3}:\\s{0,3}(?:[*_]{1,2}\\s{0,3})?[^.!?\\n]{0,30}?(?<![가-힣])순위를?\\s*매기거나|(?<![가-힣])표의\\s+(?:나열\\s+)?순서(?:는|가)\\s[^.!?\\n]{0,20}?(?<![가-힣])순위(?:(?:를|을)\\s*뜻하지\\s*(?:[*_]{1,2}\\s*)?않(?:음|는다|습니다)|(?:가|이)\\s*(?:[*_]{1,2}\\s*)?(?:아님|아니다|아닙니다)(?![가-힣]))",
|
|
888
|
+
"flags": "m",
|
|
889
|
+
"scope": "line",
|
|
890
|
+
"context": [
|
|
891
|
+
"fenced_code",
|
|
892
|
+
"quoted_user_text",
|
|
893
|
+
"blockquote_callout"
|
|
894
|
+
],
|
|
895
|
+
"rationale": "A line that tells the reader what the document, table or number is not for belongs in the chat reply, or it becomes a fact about the data. Refused shapes: a self-reference topic (이/본/해당/위/아래 plus a document noun plus 은/는) followed on the same line by a negated claim verb, a claim noun plus 아님, or 위한/려는 것이 아님; a comparison or ranking noun plus (으)로/처럼 and a negated use or reading verb, including the polite 말아 주세요 form; a purpose-용 data noun such as 공개용 수치 plus 아님; 숫자/수치 said to be incomparable, or compared among themselves toward a quoted verdict; a speed judgment forbidden for these numbers; a ranking refused for this data (…만으로 순위를 정할 수 없다, 할 수 없는 것: 순위를 매기거나); and a table whose row order is said not to be a ranking. Kept outside the pattern because operating rules, method lines, manuals and standard notices are written with them: use verbs after a self-reference, 근거/평가/증거/추천, inference limits, conditional method facts, type-system rules, reported speech and explainers, order notices with no table anchor, and the legal or financial notice verbs (대체하, 보장하, 권유). A bold-label callout line (> **주의:** …) is read as well; a plain quote is not.",
|
|
896
|
+
"fixture_ids": [
|
|
897
|
+
"ko-negative-pledge:positive",
|
|
898
|
+
"ko-negative-pledge:negative"
|
|
899
|
+
]
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
"id": "ko-negative-pledge-repeat",
|
|
903
|
+
"lang": "ko",
|
|
904
|
+
"severity": "block",
|
|
905
|
+
"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*(?:[.!?。]|$))",
|
|
906
|
+
"flags": "m",
|
|
907
|
+
"scope": "document",
|
|
908
|
+
"context": [
|
|
909
|
+
"fenced_code",
|
|
910
|
+
"quoted_user_text",
|
|
911
|
+
"blockquote_callout"
|
|
912
|
+
],
|
|
913
|
+
"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.",
|
|
914
|
+
"fixture_ids": [
|
|
915
|
+
"ko-negative-pledge-repeat:positive",
|
|
916
|
+
"ko-negative-pledge-repeat:negative"
|
|
917
|
+
]
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
"id": "en-negative-pledge",
|
|
921
|
+
"lang": "en",
|
|
922
|
+
"severity": "block",
|
|
923
|
+
"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)|\\bthey\\s+are\\s+not\\s+(?:an?\\s+)?(?:comparison|benchmark|ranking)s?\\b(?!-)(?!\\s+(?:arm|arms|group|groups|standard|standards|class|baseline)\\b)(?=\\s*(?:[.!?*_]|$))|\\b(?:do\\s+not|don[’']t)\\s+compare\\s+(?:these|those)\\s+(?:numbers|figures|results|values|scores|latencies)(?:\\s+(?:with|to)\\s+(?:each\\s+other|one\\s+another)\\b|(?=\\s*(?:[.!?*_]|$)))|\\b(?:these|those|the)\\s+(?:numbers|figures)\\s+are\\s+not\\s+comparable(?:\\s+(?:with|to)\\s+(?:each\\s+other|one\\s+another)\\b|(?=\\s*(?:[.!?*_]|$)))|\\b(?:this|the|these|our)\\s+(?:table|chart|figure|graph|list|report|document|deck|slide|page|summary|overview|analysis)s?\\s+(?:is|are)\\s+not\\s+(?:(?:meant|intended)\\s+)?(?:(?:to\\s+be\\s+)?(?:an?\\s+)?(?:ranking|benchmark|comparison|leaderboard|endorsement)s?\\b(?!-)(?!\\s+(?:arm|arms|group|groups|standard|standards|class|baseline)\\b)(?=\\s*(?:[.!?*_]|$))|to\\s+(?:rank|compare|benchmark)\\b)|\\b(?:do\\s+not|don[’']t)\\s+read\\s+(?:this|the|these|our)\\s+(?:table|chart|figure|graph|list|report|document|deck|slide|page|summary|overview|analysis)s?\\s+as\\s+(?:an?\\s+)?(?:comparison|benchmark|ranking)s?\\b(?!-)(?!\\s+(?:arm|arms|group|groups|standard|standards|class|baseline)\\b)",
|
|
924
|
+
"flags": "i",
|
|
925
|
+
"scope": "sentence",
|
|
926
|
+
"context": [
|
|
927
|
+
"fenced_code",
|
|
928
|
+
"quoted_user_text",
|
|
929
|
+
"blockquote_callout"
|
|
930
|
+
],
|
|
931
|
+
"rationale": "A sentence saying the deck, report or numbers are not intended, meant or to be read as a comparison, benchmark or ranking, or that the document makes no claim about something, belongs in the chat reply. The same refusal covers a table, chart or set of figures that does not constitute one, a closing \"they are not a ranking.\", \"do not compare these numbers (with each other).\" or \"the numbers are not comparable.\", and a deliverable subject (this table, the report, our deck) that is not a ranking, benchmark, comparison, leaderboard or endorsement or is not meant to rank or compare. The comparison, benchmark or ranking noun is required so safety labels and advice, offer or diagnosis notices stay clean; a refusal that goes on to describe or instruct (a ranking of schools, comparable with the previous release, compare these values directly; convert to SI first, this is not a benchmark, it is …) stays clean, and a bare \"this\" is not a subject. A bold-label callout line (> **Note:** …) is read as well; a plain quote is not.",
|
|
932
|
+
"fixture_ids": [
|
|
933
|
+
"en-negative-pledge:positive",
|
|
934
|
+
"en-negative-pledge:negative"
|
|
935
|
+
]
|
|
882
936
|
}
|
|
883
937
|
]
|
|
884
938
|
}
|
|
@@ -82,7 +82,12 @@ function sourceRows(text) {
|
|
|
82
82
|
if (/^\s{0,3}>\s?/.test(line)) {
|
|
83
83
|
captionPending = 0;
|
|
84
84
|
figureActive = false;
|
|
85
|
-
|
|
85
|
+
// A quote that opens with a bold label (> **주의:** ...) is the author's own callout, not quoted
|
|
86
|
+
// user text. Rules with the blockquote_callout context still read it, with the marker blanked.
|
|
87
|
+
const callout = /^\s{0,3}>\s?(?:\*\*|__)[^*_\n]{1,24}(?:\*\*|__)/.test(line)
|
|
88
|
+
? inlineCodeAsSpaces(line.replace(/^\s{0,3}>\s?/, (prefix) => ' '.repeat(prefix.length)))
|
|
89
|
+
: '';
|
|
90
|
+
return { line, number: index + 1, candidate: '', callout, skipped: true, caption: false, captionAttribution: false };
|
|
86
91
|
}
|
|
87
92
|
const candidate = inlineCodeAsSpaces(line);
|
|
88
93
|
const caption = isCaption(line);
|
|
@@ -149,7 +154,8 @@ function splitSentences(span) {
|
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
function ruleSegments(rows, rule, cache) {
|
|
152
|
-
const
|
|
157
|
+
const readCallouts = rule.context.includes('blockquote_callout');
|
|
158
|
+
const cacheKey = `${rule.scope}/${rule.context.includes('table_figure_caption')}/${readCallouts}`;
|
|
153
159
|
if (cache.has(cacheKey)) return cache.get(cacheKey);
|
|
154
160
|
const skipCaptions = rule.context.includes('table_figure_caption');
|
|
155
161
|
const segments = [];
|
|
@@ -162,6 +168,11 @@ function ruleSegments(rows, rule, cache) {
|
|
|
162
168
|
};
|
|
163
169
|
|
|
164
170
|
for (const row of rows) {
|
|
171
|
+
if (readCallouts && row.callout) {
|
|
172
|
+
flush();
|
|
173
|
+
segments.push({ text: row.callout, line: row.number });
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
165
176
|
const captionExempt = skipCaptions && (row.caption || row.captionAttribution);
|
|
166
177
|
if (row.skipped || captionExempt || (rule.scope === 'sentence' && !row.candidate.trim())) {
|
|
167
178
|
flush();
|
|
@@ -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";
|