@oh-story/dsh 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +38 -0
- package/cordis.patch.yml +3 -0
- package/lib/client.js +1201 -0
- package/lib/client.js.map +7 -0
- package/lib/drama/LICENSE.upstream +21 -0
- package/lib/drama/manifest.json +1012 -0
- package/lib/drama/skills/short-drama/SKILL.md +153 -0
- package/lib/drama/skills/short-drama/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama/assets/creator-decision.example.jsonl +4 -0
- package/lib/drama/skills/short-drama/assets/production-observation.example.jsonl +2 -0
- package/lib/drama/skills/short-drama/assets/project-template/short-drama.json +36 -0
- package/lib/drama/skills/short-drama/assets/reference-observation.example.jsonl +2 -0
- package/lib/drama/skills/short-drama/references/audience-reveal.md +74 -0
- package/lib/drama/skills/short-drama/references/contract-and-ownership.md +94 -0
- package/lib/drama/skills/short-drama/references/creator-workflow.md +82 -0
- package/lib/drama/skills/short-drama/references/form-cards/Q/347/211/210/350/241/250/350/276/276.md +73 -0
- package/lib/drama/skills/short-drama/references/form-cards//344/272/214/347/273/264/345/212/250/346/200/201/346/274/253.md +74 -0
- package/lib/drama/skills/short-drama/references/form-cards//345/233/275/346/274/253/344/272/214/346/254/241/345/205/203.md +79 -0
- package/lib/drama/skills/short-drama/references/form-cards//345/256/236/346/213/215.md +75 -0
- package/lib/drama/skills/short-drama/references/form-cards//346/260/264/345/242/250/347/254/224/350/247/246.md +85 -0
- package/lib/drama/skills/short-drama/references/form-cards//351/243/216/346/240/274/345/214/226/344/270/211/347/273/264.md +72 -0
- package/lib/drama/skills/short-drama/references/knowhow-index.md +80 -0
- package/lib/drama/skills/short-drama/references/lifecycle-commands.md +130 -0
- package/lib/drama/skills/short-drama/references/look-development.md +52 -0
- package/lib/drama/skills/short-drama/references/pickup-and-alternate.md +58 -0
- package/lib/drama/skills/short-drama/references/production-form-profiles.md +126 -0
- package/lib/drama/skills/short-drama/references/reference-roles.md +142 -0
- package/lib/drama/skills/short-drama/references/runtime-preflight.md +27 -0
- package/lib/drama/skills/short-drama/scripts/project_tool.py +1963 -0
- package/lib/drama/skills/short-drama/scripts/selftest.py +287 -0
- package/lib/drama/skills/short-drama-assets/SKILL.md +187 -0
- package/lib/drama/skills/short-drama-assets/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-assets/assets/character-look.example.jsonl +3 -0
- package/lib/drama/skills/short-drama-assets/assets/continuity.example.jsonl +4 -0
- package/lib/drama/skills/short-drama-assets/assets/decisions.example.jsonl +5 -0
- package/lib/drama/skills/short-drama-assets/assets/location-view.example.jsonl +3 -0
- package/lib/drama/skills/short-drama-assets/assets/occurrences.example.jsonl +5 -0
- package/lib/drama/skills/short-drama-assets/assets/prop-state.example.jsonl +3 -0
- package/lib/drama/skills/short-drama-assets/examples/minimal/characters.jsonl +2 -0
- package/lib/drama/skills/short-drama-assets/examples/minimal/looks.jsonl +2 -0
- package/lib/drama/skills/short-drama-assets/references/asset-review-checklist.md +89 -0
- package/lib/drama/skills/short-drama-assets/references/character-and-look.md +164 -0
- package/lib/drama/skills/short-drama-assets/references/continuity-delta.md +123 -0
- package/lib/drama/skills/short-drama-assets/references/identity-vs-variant.md +146 -0
- package/lib/drama/skills/short-drama-assets/references/location-and-view.md +84 -0
- package/lib/drama/skills/short-drama-assets/references/occurrence-extraction.md +111 -0
- package/lib/drama/skills/short-drama-assets/references/prop-and-state.md +107 -0
- package/lib/drama/skills/short-drama-assets/references/stage-contract.md +136 -0
- package/lib/drama/skills/short-drama-assets/references/voice-direction.md +171 -0
- package/lib/drama/skills/short-drama-assets/scripts/asset_check.py +267 -0
- package/lib/drama/skills/short-drama-assets/scripts/selftest.py +89 -0
- package/lib/drama/skills/short-drama-develop/SKILL.md +157 -0
- package/lib/drama/skills/short-drama-develop/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-develop/assets/adaptation-map.example.jsonl +1 -0
- package/lib/drama/skills/short-drama-develop/assets/creative-brief.md +120 -0
- package/lib/drama/skills/short-drama-develop/assets/episode-map.jsonl +1 -0
- package/lib/drama/skills/short-drama-develop/assets/story-engine.md +181 -0
- package/lib/drama/skills/short-drama-develop/references/adaptation-craft.md +219 -0
- package/lib/drama/skills/short-drama-develop/references/creative-reference-intake.md +57 -0
- package/lib/drama/skills/short-drama-develop/references/director-brief-craft.md +113 -0
- package/lib/drama/skills/short-drama-develop/references/episode-design.md +509 -0
- package/lib/drama/skills/short-drama-develop/references/genre-and-hook-playbook.md +240 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//344/272/262/345/255/220/351/232/220/347/247/230.md +112 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//344/273/231/344/276/240/344/277/256/347/234/237.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//345/212/250/344/275/234/344/273/273/345/212/241.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//345/217/244/350/243/205/346/235/203/350/260/213.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//345/244/215/344/273/207/346/211/223/350/204/270.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//345/256/266/345/272/255/345/205/263/347/263/273.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//346/202/254/347/226/221/350/247/204/345/210/231.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//347/224/237/346/264/273/346/265/201.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//347/240/264/351/225/234/351/207/215/345/234/206.md +109 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//350/201/214/345/234/272/345/226/234/345/211/247.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//350/261/252/351/227/250/345/251/232/346/201/213.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//350/272/253/344/273/275/351/224/231/344/275/215.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards.md +92 -0
- package/lib/drama/skills/short-drama-develop/references/mechanism-loop.md +282 -0
- package/lib/drama/skills/short-drama-develop/references/multi-episode-intake.md +128 -0
- package/lib/drama/skills/short-drama-develop/references/premise-devices.md +211 -0
- package/lib/drama/skills/short-drama-develop/references/reveal-reversal-payoff.md +99 -0
- package/lib/drama/skills/short-drama-develop/references/serial-character-and-memory.md +293 -0
- package/lib/drama/skills/short-drama-develop/references/stage-contract.md +88 -0
- package/lib/drama/skills/short-drama-develop/references/story-craft.md +359 -0
- package/lib/drama/skills/short-drama-develop/scripts/episode_intake.py +699 -0
- package/lib/drama/skills/short-drama-develop/scripts/selftest.py +47 -0
- package/lib/drama/skills/short-drama-image-prompts/SKILL.md +181 -0
- package/lib/drama/skills/short-drama-image-prompts/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-image-prompts/assets/image-prompt-spec.jsonl.md +187 -0
- package/lib/drama/skills/short-drama-image-prompts/assets/image-prompts.md +37 -0
- package/lib/drama/skills/short-drama-image-prompts/assets/lookdev-frame-spec.jsonl.md +128 -0
- package/lib/drama/skills/short-drama-image-prompts/assets/lookdev-prompts.md +31 -0
- package/lib/drama/skills/short-drama-image-prompts/examples/minimal-image-prompt-specs.jsonl +2 -0
- package/lib/drama/skills/short-drama-image-prompts/references/character-and-look.md +154 -0
- package/lib/drama/skills/short-drama-image-prompts/references/common-recipe.md +231 -0
- package/lib/drama/skills/short-drama-image-prompts/references/edit-and-revision.md +122 -0
- package/lib/drama/skills/short-drama-image-prompts/references/location-plate.md +152 -0
- package/lib/drama/skills/short-drama-image-prompts/references/look-and-state-variant.md +96 -0
- package/lib/drama/skills/short-drama-image-prompts/references/lookdev-frame.md +38 -0
- package/lib/drama/skills/short-drama-image-prompts/references/production-sheet-recipes.md +177 -0
- package/lib/drama/skills/short-drama-image-prompts/references/prop-plate.md +140 -0
- package/lib/drama/skills/short-drama-image-prompts/references/review-and-fixtures.md +92 -0
- package/lib/drama/skills/short-drama-image-prompts/references/stage-contract.md +89 -0
- package/lib/drama/skills/short-drama-image-prompts/scripts/image_prompt_check.py +443 -0
- package/lib/drama/skills/short-drama-image-prompts/scripts/selftest.py +93 -0
- package/lib/drama/skills/short-drama-novel-analyze/SKILL.md +245 -0
- package/lib/drama/skills/short-drama-novel-analyze/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-novel-analyze/assets/episode-candidate.example.jsonl +3 -0
- package/lib/drama/skills/short-drama-novel-analyze/references/adaptation-triage.md +116 -0
- package/lib/drama/skills/short-drama-novel-analyze/references/adaptation-value.md +124 -0
- package/lib/drama/skills/short-drama-novel-analyze/references/aggregation-and-entities.md +155 -0
- package/lib/drama/skills/short-drama-novel-analyze/references/chapter-extraction.md +141 -0
- package/lib/drama/skills/short-drama-novel-analyze/references/stage-contract.md +67 -0
- package/lib/drama/skills/short-drama-novel-analyze/scripts/novel_index.py +651 -0
- package/lib/drama/skills/short-drama-novel-analyze/scripts/selftest.py +51 -0
- package/lib/drama/skills/short-drama-produce/SKILL.md +103 -0
- package/lib/drama/skills/short-drama-produce/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-produce/references/adapter-contract.md +140 -0
- package/lib/drama/skills/short-drama-produce/references/providers/gpt-image-2.md +24 -0
- package/lib/drama/skills/short-drama-produce/references/providers/minimax-music.md +25 -0
- package/lib/drama/skills/short-drama-produce/references/providers/seedance.md +40 -0
- package/lib/drama/skills/short-drama-produce/scripts/fixture_adapter.py +60 -0
- package/lib/drama/skills/short-drama-produce/scripts/production_tool.py +1635 -0
- package/lib/drama/skills/short-drama-produce/scripts/provider_adapters.py +964 -0
- package/lib/drama/skills/short-drama-produce/scripts/selftest.py +134 -0
- package/lib/drama/skills/short-drama-review/SKILL.md +178 -0
- package/lib/drama/skills/short-drama-review/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-review/assets/finding-template.jsonl +2 -0
- package/lib/drama/skills/short-drama-review/assets/supersession-decision.example.json +42 -0
- package/lib/drama/skills/short-drama-review/assets/verdict-template.json +32 -0
- package/lib/drama/skills/short-drama-review/examples/minimal-findings.jsonl +2 -0
- package/lib/drama/skills/short-drama-review/examples/minimal-verdict.json +34 -0
- package/lib/drama/skills/short-drama-review/references/anti-template-repair.md +114 -0
- package/lib/drama/skills/short-drama-review/references/production-quality-gates.md +270 -0
- package/lib/drama/skills/short-drama-review/references/project-calibration.md +85 -0
- package/lib/drama/skills/short-drama-review/references/review-method.md +82 -0
- package/lib/drama/skills/short-drama-review/references/rubric-assets-prompts.md +115 -0
- package/lib/drama/skills/short-drama-review/references/rubric-source-analysis.md +108 -0
- package/lib/drama/skills/short-drama-review/references/rubric-story-script.md +164 -0
- package/lib/drama/skills/short-drama-review/references/rubric-visual-motion.md +166 -0
- package/lib/drama/skills/short-drama-review/references/stage-contract.md +87 -0
- package/lib/drama/skills/short-drama-review/scripts/review_check.py +325 -0
- package/lib/drama/skills/short-drama-review/scripts/selftest.py +87 -0
- package/lib/drama/skills/short-drama-storyboard/SKILL.md +264 -0
- package/lib/drama/skills/short-drama-storyboard/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-storyboard/assets/coverage-audition.example.jsonl +2 -0
- package/lib/drama/skills/short-drama-storyboard/assets/coverage-template.json +49 -0
- package/lib/drama/skills/short-drama-storyboard/assets/keyframe-prompts.md +32 -0
- package/lib/drama/skills/short-drama-storyboard/assets/keyframe-template.jsonl +2 -0
- package/lib/drama/skills/short-drama-storyboard/assets/revision-lineage.fragment.json +12 -0
- package/lib/drama/skills/short-drama-storyboard/assets/scene-visual-plan.example.jsonl +2 -0
- package/lib/drama/skills/short-drama-storyboard/assets/shot-template.jsonl +2 -0
- package/lib/drama/skills/short-drama-storyboard/references/blocking-playbooks.md +241 -0
- package/lib/drama/skills/short-drama-storyboard/references/coverage-audition.md +39 -0
- package/lib/drama/skills/short-drama-storyboard/references/keyframe-craft.md +169 -0
- package/lib/drama/skills/short-drama-storyboard/references/production-shot-grammar.md +264 -0
- package/lib/drama/skills/short-drama-storyboard/references/review-and-fixtures.md +70 -0
- package/lib/drama/skills/short-drama-storyboard/references/scene-visual-plan.md +39 -0
- package/lib/drama/skills/short-drama-storyboard/references/screenplay-to-keyframe-example.md +157 -0
- package/lib/drama/skills/short-drama-storyboard/references/shot-craft.md +192 -0
- package/lib/drama/skills/short-drama-storyboard/references/shot-revision-identity.md +29 -0
- package/lib/drama/skills/short-drama-storyboard/references/stage-contract.md +110 -0
- package/lib/drama/skills/short-drama-storyboard/scripts/selftest.py +191 -0
- package/lib/drama/skills/short-drama-storyboard/scripts/storyboard_check.py +824 -0
- package/lib/drama/skills/short-drama-video-prompts/SKILL.md +245 -0
- package/lib/drama/skills/short-drama-video-prompts/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/coverage-scope.fragment.json +21 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/delivery-container.jsonl.md +101 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/motion-spec.jsonl.md +212 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/motion-terminal.example.jsonl +2 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/music-spec.jsonl.md +31 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/performance.fragment.json +38 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/video-prompts.md +46 -0
- package/lib/drama/skills/short-drama-video-prompts/examples/minimal-music-specs.jsonl +2 -0
- package/lib/drama/skills/short-drama-video-prompts/references/camera-audio-continuity.md +240 -0
- package/lib/drama/skills/short-drama-video-prompts/references/delivery-profile.md +255 -0
- package/lib/drama/skills/short-drama-video-prompts/references/generability.md +93 -0
- package/lib/drama/skills/short-drama-video-prompts/references/motion-recipe.md +304 -0
- package/lib/drama/skills/short-drama-video-prompts/references/performance-action-timing.md +191 -0
- package/lib/drama/skills/short-drama-video-prompts/references/production-prompt-grammar.md +312 -0
- package/lib/drama/skills/short-drama-video-prompts/references/review-and-fixtures.md +168 -0
- package/lib/drama/skills/short-drama-video-prompts/references/stage-contract.md +110 -0
- package/lib/drama/skills/short-drama-video-prompts/scripts/container_check.py +329 -0
- package/lib/drama/skills/short-drama-video-prompts/scripts/motion_timing_check.py +450 -0
- package/lib/drama/skills/short-drama-video-prompts/scripts/music_spec_check.py +327 -0
- package/lib/drama/skills/short-drama-video-prompts/scripts/selftest.py +82 -0
- package/lib/drama/skills/short-drama-write/SKILL.md +284 -0
- package/lib/drama/skills/short-drama-write/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-write/assets/beats.jsonl +2 -0
- package/lib/drama/skills/short-drama-write/assets/episode-card-standalone.json +120 -0
- package/lib/drama/skills/short-drama-write/assets/episode-card.json +55 -0
- package/lib/drama/skills/short-drama-write/assets/screenplay.md +36 -0
- package/lib/drama/skills/short-drama-write/assets/voice-record-sheet.jsonl.md +89 -0
- package/lib/drama/skills/short-drama-write/references/dialogue-craft.md +519 -0
- package/lib/drama/skills/short-drama-write/references/production-format-dialect.md +273 -0
- package/lib/drama/skills/short-drama-write/references/scene-handoff-capsule.md +51 -0
- package/lib/drama/skills/short-drama-write/references/scene-sound-dramaturgy.md +43 -0
- package/lib/drama/skills/short-drama-write/references/screenplay-format.md +260 -0
- package/lib/drama/skills/short-drama-write/references/script-craft.md +558 -0
- package/lib/drama/skills/short-drama-write/references/stage-contract.md +94 -0
- package/lib/drama/skills/short-drama-write/references/substitutable-realization.md +107 -0
- package/lib/drama/skills/short-drama-write/scripts/duration_estimate.py +309 -0
- package/lib/drama/skills/short-drama-write/scripts/screenplay_index.py +1091 -0
- package/lib/drama/skills/short-drama-write/scripts/selftest.py +229 -0
- package/lib/drama/skills/short-drama-write/scripts/voice_sheet_check.py +416 -0
- package/lib/index.js +756 -0
- package/lib/index.js.map +7 -0
- package/lib/oh-story/LICENSE.upstream +21 -0
- package/lib/oh-story/manifest.json +1351 -0
- package/lib/oh-story/roles/chapter-extractor.md +314 -0
- package/lib/oh-story/roles/character-designer.md +169 -0
- package/lib/oh-story/roles/consistency-checker.md +190 -0
- package/lib/oh-story/roles/narrative-writer.md +294 -0
- package/lib/oh-story/roles/story-architect.md +195 -0
- package/lib/oh-story/roles/story-explorer.md +364 -0
- package/lib/oh-story/roles/story-researcher.md +304 -0
- package/lib/oh-story/skills/browser-cdp/SKILL.md +175 -0
- package/lib/oh-story/skills/story/SKILL.md +116 -0
- package/lib/oh-story/skills/story/VERSION +1 -0
- package/lib/oh-story/skills/story-cover/SKILL.md +327 -0
- package/lib/oh-story/skills/story-cover/references/cover-styles.md +210 -0
- package/lib/oh-story/skills/story-deslop/SKILL.md +445 -0
- package/lib/oh-story/skills/story-deslop/references/anti-ai-writing.md +582 -0
- package/lib/oh-story/skills/story-deslop/references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-deslop/scripts/check-ai-patterns.js +1371 -0
- package/lib/oh-story/skills/story-deslop/scripts/check-degeneration.js +330 -0
- package/lib/oh-story/skills/story-deslop/scripts/check-outline-copy.js +241 -0
- package/lib/oh-story/skills/story-deslop/scripts/normalize-punctuation.js +410 -0
- package/lib/oh-story/skills/story-import/SKILL.md +634 -0
- package/lib/oh-story/skills/story-import/references/character-state-reverse.md +82 -0
- package/lib/oh-story/skills/story-import/references/format-and-structure.md +169 -0
- package/lib/oh-story/skills/story-import/references/length-routing.md +134 -0
- package/lib/oh-story/skills/story-import/references/state-tracking.md +108 -0
- package/lib/oh-story/skills/story-import/references/structure-mapping-long.md +442 -0
- package/lib/oh-story/skills/story-import/references/structure-mapping-short.md +175 -0
- package/lib/oh-story/skills/story-import/references/tracking-transaction.md +161 -0
- package/lib/oh-story/skills/story-import/scripts/tracking_commit.py +1139 -0
- package/lib/oh-story/skills/story-long-analyze/SKILL.md +329 -0
- package/lib/oh-story/skills/story-long-analyze/references/deconstruction-notes.md +270 -0
- package/lib/oh-story/skills/story-long-analyze/references/material-decomposition.md +530 -0
- package/lib/oh-story/skills/story-long-analyze/references/output-templates.md +559 -0
- package/lib/oh-story/skills/story-long-analyze/references/pipeline-ops.md +80 -0
- package/lib/oh-story/skills/story-long-analyze/references/style-profile-generator.md +149 -0
- package/lib/oh-story/skills/story-long-analyze/references/style-profile-protocol.md +133 -0
- package/lib/oh-story/skills/story-long-scan/SKILL.md +342 -0
- package/lib/oh-story/skills/story-long-scan/references/genre-trends.md +197 -0
- package/lib/oh-story/skills/story-long-scan/references/publishing-guide.md +114 -0
- package/lib/oh-story/skills/story-long-scan/references/reader-profiling.md +105 -0
- package/lib/oh-story/skills/story-long-scan/references/scan-output-format.md +207 -0
- package/lib/oh-story/skills/story-long-scan/references/topic-decision.md +78 -0
- package/lib/oh-story/skills/story-long-write/SKILL.md +327 -0
- package/lib/oh-story/skills/story-long-write/references/anti-ai-writing.md +582 -0
- package/lib/oh-story/skills/story-long-write/references/artifact-protocols.md +302 -0
- package/lib/oh-story/skills/story-long-write/references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-long-write/references/character-basics.md +445 -0
- package/lib/oh-story/skills/story-long-write/references/character-design-methods.md +428 -0
- package/lib/oh-story/skills/story-long-write/references/character-relations.md +385 -0
- package/lib/oh-story/skills/story-long-write/references/commercial-core-methods.md +502 -0
- package/lib/oh-story/skills/story-long-write/references/cross-book-recall.md +62 -0
- package/lib/oh-story/skills/story-long-write/references/dialogue-mastery.md +282 -0
- package/lib/oh-story/skills/story-long-write/references/emotional-arc-design.md +426 -0
- package/lib/oh-story/skills/story-long-write/references/emotional-methods.md +209 -0
- package/lib/oh-story/skills/story-long-write/references/female-audience-writing.md +188 -0
- package/lib/oh-story/skills/story-long-write/references/format-and-structure.md +169 -0
- package/lib/oh-story/skills/story-long-write/references/genre-catalog.md +480 -0
- package/lib/oh-story/skills/story-long-write/references/genre-core-mechanics.md +415 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//344/270/234/346/226/271/344/273/231/344/276/240.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//344/274/240/347/273/237/347/216/204/345/271/273.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/216/206/345/217/262/345/217/244/344/273/243.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/216/206/345/217/262/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/217/214/347/224/267/344/270/273.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/217/244/350/250/200/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/217/244/351/243/216/344/270/226/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/245/263/351/242/221/346/202/254/347/226/221.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/245/263/351/242/221/347/247/215/347/224/260.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/256/253/346/226/227/345/256/205/346/226/227.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/271/264/344/273/243.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/277/253/347/251/277.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/202/254/347/226/221/347/201/265/345/274/202.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/202/254/347/226/221/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/210/230/347/245/236/350/265/230/345/251/277.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/212/227/346/210/230/350/260/215/346/210/230.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/230/237/345/205/211/347/222/200/347/222/250.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/260/221/345/233/275/350/250/200/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/270/270/346/210/217/344/275/223/350/202/262.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//347/216/204/345/271/273/350/204/221/346/264/236.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//347/216/204/345/271/273/350/250/200/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//347/216/260/350/250/200/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//347/247/221/345/271/273/346/234/253/344/270/226.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//350/201/214/345/234/272/345/251/232/346/201/213.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//350/245/277/346/226/271/345/245/207/345/271/273.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//350/261/252/351/227/250/346/200/273/350/243/201.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/203/275/345/270/202/344/277/256/347/234/237.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/203/275/345/270/202/346/227/245/345/270/270.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/203/275/345/270/202/347/247/215/347/224/260.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/203/275/345/270/202/350/204/221/346/264/236.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/203/275/345/270/202/351/253/230/346/255/246.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/235/222/346/230/245/347/224/234/345/256/240.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards.md +91 -0
- package/lib/oh-story/skills/story-long-write/references/genre-readers.md +235 -0
- package/lib/oh-story/skills/story-long-write/references/genre-writing-formulas.md +444 -0
- package/lib/oh-story/skills/story-long-write/references/hooks-chapter.md +225 -0
- package/lib/oh-story/skills/story-long-write/references/hooks-paragraph.md +146 -0
- package/lib/oh-story/skills/story-long-write/references/hooks-suspense.md +352 -0
- package/lib/oh-story/skills/story-long-write/references/opening-design.md +349 -0
- package/lib/oh-story/skills/story-long-write/references/outline-conflict.md +457 -0
- package/lib/oh-story/skills/story-long-write/references/outline-methods.md +287 -0
- package/lib/oh-story/skills/story-long-write/references/outline-rhythm.md +389 -0
- package/lib/oh-story/skills/story-long-write/references/outline-structure-theory.md +326 -0
- package/lib/oh-story/skills/story-long-write/references/plot-core-methods.md +522 -0
- package/lib/oh-story/skills/story-long-write/references/plot-emotion-system.md +354 -0
- package/lib/oh-story/skills/story-long-write/references/plot-frameworks.md +711 -0
- package/lib/oh-story/skills/story-long-write/references/plot-special-topics.md +622 -0
- package/lib/oh-story/skills/story-long-write/references/quality-checklist.md +184 -0
- package/lib/oh-story/skills/story-long-write/references/reader-contract-and-progression.md +109 -0
- package/lib/oh-story/skills/story-long-write/references/reversal-toolkit.md +349 -0
- package/lib/oh-story/skills/story-long-write/references/state-tracking.md +108 -0
- package/lib/oh-story/skills/story-long-write/references/style-combat-face.md +409 -0
- package/lib/oh-story/skills/story-long-write/references/style-craft.md +347 -0
- package/lib/oh-story/skills/story-long-write/references/style-genre-modules.md +510 -0
- package/lib/oh-story/skills/story-long-write/references/tracking-transaction.md +161 -0
- package/lib/oh-story/skills/story-long-write/references/workflow-chapter.md +140 -0
- package/lib/oh-story/skills/story-long-write/references/workflow-daily.md +171 -0
- package/lib/oh-story/skills/story-long-write/references/workflow-revision.md +99 -0
- package/lib/oh-story/skills/story-long-write/references/workflow-setup.md +284 -0
- package/lib/oh-story/skills/story-long-write/references/writing-craft.md +421 -0
- package/lib/oh-story/skills/story-long-write/scripts/check-ai-patterns.js +1371 -0
- package/lib/oh-story/skills/story-long-write/scripts/check-degeneration.js +330 -0
- package/lib/oh-story/skills/story-long-write/scripts/check-outline-copy.js +241 -0
- package/lib/oh-story/skills/story-long-write/scripts/normalize-punctuation.js +410 -0
- package/lib/oh-story/skills/story-long-write/scripts/tracking_commit.py +1139 -0
- package/lib/oh-story/skills/story-review/SKILL.md +483 -0
- package/lib/oh-story/skills/story-review/references/anti-ai-writing.md +582 -0
- package/lib/oh-story/skills/story-review/references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-review/references/character-relations.md +385 -0
- package/lib/oh-story/skills/story-review/references/dialogue-mastery.md +282 -0
- package/lib/oh-story/skills/story-review/references/plot-core-methods.md +522 -0
- package/lib/oh-story/skills/story-review/references/quality-checklist.md +250 -0
- package/lib/oh-story/skills/story-review/references/quality-rubric.md +55 -0
- package/lib/oh-story/skills/story-review/references/rubrics/fanqie.md +18 -0
- package/lib/oh-story/skills/story-review/references/rubrics/qidian.md +19 -0
- package/lib/oh-story/skills/story-review/references/rubrics/zhihu.md +20 -0
- package/lib/oh-story/skills/story-review/references/tracking-transaction.md +161 -0
- package/lib/oh-story/skills/story-review/scripts/check-ai-patterns.js +1371 -0
- package/lib/oh-story/skills/story-review/scripts/check-degeneration.js +330 -0
- package/lib/oh-story/skills/story-review/scripts/normalize-punctuation.js +410 -0
- package/lib/oh-story/skills/story-review/scripts/tracking_commit.py +1139 -0
- package/lib/oh-story/skills/story-setup/SKILL.md +495 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/anti-ai-writing.md +582 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/character-basics.md +445 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/character-design-methods.md +428 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/character-relations.md +385 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/dialogue-mastery.md +282 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/emotional-arc-design.md +426 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/emotional-methods.md +179 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/format-and-structure.md +169 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-catalog.md +480 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-core-mechanics.md +415 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//344/270/234/346/226/271/344/273/231/344/276/240.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//344/274/240/347/273/237/347/216/204/345/271/273.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/216/206/345/217/262/345/217/244/344/273/243.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/216/206/345/217/262/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/217/214/347/224/267/344/270/273.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/217/244/350/250/200/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/217/244/351/243/216/344/270/226/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/245/263/351/242/221/346/202/254/347/226/221.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/245/263/351/242/221/347/247/215/347/224/260.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/256/253/346/226/227/345/256/205/346/226/227.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/271/264/344/273/243.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/277/253/347/251/277.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/202/254/347/226/221/347/201/265/345/274/202.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/202/254/347/226/221/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/210/230/347/245/236/350/265/230/345/251/277.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/212/227/346/210/230/350/260/215/346/210/230.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/230/237/345/205/211/347/222/200/347/222/250.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/260/221/345/233/275/350/250/200/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/270/270/346/210/217/344/275/223/350/202/262.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//347/216/204/345/271/273/350/204/221/346/264/236.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//347/216/204/345/271/273/350/250/200/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//347/216/260/350/250/200/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//347/247/221/345/271/273/346/234/253/344/270/226.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//350/201/214/345/234/272/345/251/232/346/201/213.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//350/245/277/346/226/271/345/245/207/345/271/273.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//350/261/252/351/227/250/346/200/273/350/243/201.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/203/275/345/270/202/344/277/256/347/234/237.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/203/275/345/270/202/346/227/245/345/270/270.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/203/275/345/270/202/347/247/215/347/224/260.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/203/275/345/270/202/350/204/221/346/264/236.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/203/275/345/270/202/351/253/230/346/255/246.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/235/222/346/230/245/347/224/234/345/256/240.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards.md +91 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-readers.md +235 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-writing-formulas.md +444 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/hooks-chapter.md +225 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/hooks-suspense.md +352 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/opening-design.md +349 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/outline-conflict.md +457 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/outline-methods.md +287 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/outline-rhythm.md +389 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/plot-core-methods.md +522 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/quality-checklist.md +247 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/reversal-toolkit.md +349 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/style-combat-face.md +409 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/style-genre-modules.md +510 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/writing-craft.md +421 -0
- package/lib/oh-story/skills/story-short-analyze/SKILL.md +278 -0
- package/lib/oh-story/skills/story-short-analyze/references/anti-ai-writing.md +582 -0
- package/lib/oh-story/skills/story-short-analyze/references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-short-analyze/references/character-basics.md +453 -0
- package/lib/oh-story/skills/story-short-analyze/references/character-design-methods.md +438 -0
- package/lib/oh-story/skills/story-short-analyze/references/character-relations.md +395 -0
- package/lib/oh-story/skills/story-short-analyze/references/deconstruction-examples.md +79 -0
- package/lib/oh-story/skills/story-short-analyze/references/genre-catalog.md +490 -0
- package/lib/oh-story/skills/story-short-analyze/references/genre-core-mechanics.md +425 -0
- package/lib/oh-story/skills/story-short-analyze/references/genre-readers.md +245 -0
- package/lib/oh-story/skills/story-short-analyze/references/genre-writing-formulas.md +453 -0
- package/lib/oh-story/skills/story-short-analyze/references/genre-writing-techniques.md +475 -0
- package/lib/oh-story/skills/story-short-analyze/references/hooks-chapter.md +225 -0
- package/lib/oh-story/skills/story-short-analyze/references/hooks-paragraph.md +146 -0
- package/lib/oh-story/skills/story-short-analyze/references/hooks-suspense.md +352 -0
- package/lib/oh-story/skills/story-short-analyze/references/material-decomposition.md +685 -0
- package/lib/oh-story/skills/story-short-analyze/references/output-contract.md +165 -0
- package/lib/oh-story/skills/story-short-analyze/references/output-templates.md +561 -0
- package/lib/oh-story/skills/story-short-analyze/references/quality-checklist.md +242 -0
- package/lib/oh-story/skills/story-short-analyze/references/real-market-data.md +90 -0
- package/lib/oh-story/skills/story-short-analyze/references/zhihu-style.md +54 -0
- package/lib/oh-story/skills/story-short-scan/SKILL.md +212 -0
- package/lib/oh-story/skills/story-short-scan/references/real-market-data.md +90 -0
- package/lib/oh-story/skills/story-short-write/SKILL.md +433 -0
- package/lib/oh-story/skills/story-short-write/references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-short-write/references/cross-book-recall.md +62 -0
- package/lib/oh-story/skills/story-short-write/references/dialogue-mastery.md +282 -0
- package/lib/oh-story/skills/story-short-write/references/emotional-methods.md +179 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//344/270/226/346/203/205/346/211/223/350/204/270.md +159 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//345/217/214/347/224/267/344/270/273.md +156 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//345/244/215/344/273/207/346/211/223/350/204/270.md +163 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//345/256/205/346/226/227/345/256/253/346/226/227.md +167 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/200/273/350/243/201/350/261/252/351/227/250.md +178 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/202/254/347/226/221.md +166 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/260/221/344/277/227/346/200/252/350/260/210.md +159 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/262/231/351/233/225/350/204/221/346/264/236.md +151 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//347/224/234/345/256/240.md +153 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//350/277/275/345/246/273/347/201/253/350/221/254/345/234/272.md +210 -0
- package/lib/oh-story/skills/story-short-write/references/genre-writing-formulas.md +444 -0
- package/lib/oh-story/skills/story-short-write/references/genre-writing-techniques.md +488 -0
- package/lib/oh-story/skills/story-short-write/references/hooks-chapter.md +225 -0
- package/lib/oh-story/skills/story-short-write/references/hooks-paragraph.md +146 -0
- package/lib/oh-story/skills/story-short-write/references/hooks-suspense.md +352 -0
- package/lib/oh-story/skills/story-short-write/references/output-contract.md +165 -0
- package/lib/oh-story/skills/story-short-write/references/quality-checklist.md +222 -0
- package/lib/oh-story/skills/story-short-write/references/reversal-toolkit.md +349 -0
- package/lib/oh-story/skills/story-short-write/references/short-craft.md +185 -0
- package/lib/oh-story/skills/story-short-write/references/short-deslop.md +133 -0
- package/lib/oh-story/skills/story-short-write/references/short-format.md +167 -0
- package/lib/oh-story/skills/story-short-write/references/submission-craft.md +35 -0
- package/lib/oh-story/skills/story-short-write/references/villain-and-reveal.md +158 -0
- package/lib/oh-story/skills/story-short-write/references/writing-workflow.md +153 -0
- package/lib/oh-story/skills/story-short-write/scripts/check-ai-patterns.js +1371 -0
- package/lib/oh-story/skills/story-short-write/scripts/check-degeneration.js +330 -0
- package/lib/oh-story/skills/story-short-write/scripts/check-outline-copy.js +241 -0
- package/lib/oh-story/skills/story-short-write/scripts/normalize-punctuation.js +410 -0
- package/lib/types/client/file-activity.d.ts +30 -0
- package/lib/types/client/file-activity.d.ts.map +1 -0
- package/lib/types/client/file-tree.d.ts +20 -0
- package/lib/types/client/file-tree.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +12 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/jsonl-preview.d.ts +15 -0
- package/lib/types/client/jsonl-preview.d.ts.map +1 -0
- package/lib/types/client/markdown-preview.d.ts +38 -0
- package/lib/types/client/markdown-preview.d.ts.map +1 -0
- package/lib/types/index.d.ts +25 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/native-hooks.d.ts +16 -0
- package/lib/types/native-hooks.d.ts.map +1 -0
- package/lib/types/role-provider.d.ts +6 -0
- package/lib/types/role-provider.d.ts.map +1 -0
- package/lib/types/role-tool.d.ts +10 -0
- package/lib/types/role-tool.d.ts.map +1 -0
- package/lib/types/skill-provider.d.ts +15 -0
- package/lib/types/skill-provider.d.ts.map +1 -0
- package/lib/types/workspace-request-trust.d.ts +13 -0
- package/lib/types/workspace-request-trust.d.ts.map +1 -0
- package/lib/types/workspace-route.d.ts +10 -0
- package/lib/types/workspace-route.d.ts.map +1 -0
- package/lib/types/workspace-security.d.ts +9 -0
- package/lib/types/workspace-security.d.ts.map +1 -0
- package/package.json +107 -0
package/lib/client.js
ADDED
|
@@ -0,0 +1,1201 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({id:"@oh-story/dsh",factory:(require)=>{var module={exports:{}};var exports=module.exports;
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name2 in all)
|
|
9
|
+
__defProp(target, name2, { get: all[name2], enumerable: !0 });
|
|
10
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
17
|
+
|
|
18
|
+
// src/client/index.tsx
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
__export(index_exports, {
|
|
21
|
+
apply: () => apply,
|
|
22
|
+
default: () => index_default,
|
|
23
|
+
inject: () => inject,
|
|
24
|
+
name: () => name
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
var import_react = require("react"), import_react_dom = require("react-dom");
|
|
28
|
+
|
|
29
|
+
// src/client/file-activity.ts
|
|
30
|
+
var STORY_DIRECTORIES = /* @__PURE__ */ new Set(["\u6B63\u6587", "\u5927\u7EB2", "\u8BBE\u5B9A", "\u8FFD\u8E2A", "\u5BF9\u6807", "\u53C2\u8003\u8D44\u6599"]), DRAMA_DIRECTORIES = /* @__PURE__ */ new Set(["\u8F93\u5165", "\u9879\u76EE\u5F00\u53D1", "\u8BBE\u5B9A\u96C6", "\u5267\u96C6", "\u4EA4\u4ED8", "\u521B\u4F5C\u8005\u51B3\u7B56", "\u5BA1\u67E5"]), EDITABLE_EXTENSION = /\.(?:md|txt|json|jsonl)$/iu;
|
|
31
|
+
function decodeEscape(character) {
|
|
32
|
+
switch (character) {
|
|
33
|
+
case '"':
|
|
34
|
+
return '"';
|
|
35
|
+
case "\\":
|
|
36
|
+
return "\\";
|
|
37
|
+
case "/":
|
|
38
|
+
return "/";
|
|
39
|
+
case "b":
|
|
40
|
+
return "\b";
|
|
41
|
+
case "f":
|
|
42
|
+
return "\f";
|
|
43
|
+
case "n":
|
|
44
|
+
return `
|
|
45
|
+
`;
|
|
46
|
+
case "r":
|
|
47
|
+
return "\r";
|
|
48
|
+
case "t":
|
|
49
|
+
return " ";
|
|
50
|
+
default:
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function jsonStringPrefix(raw, key) {
|
|
55
|
+
let match = new RegExp(`"${key.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}"\\s*:\\s*"`, "u").exec(raw);
|
|
56
|
+
if (match === null) return;
|
|
57
|
+
let value = "";
|
|
58
|
+
for (let index = match.index + match[0].length; index < raw.length; index += 1) {
|
|
59
|
+
let character = raw[index] ?? "";
|
|
60
|
+
if (character === '"') return { value, complete: !0 };
|
|
61
|
+
if (character !== "\\") {
|
|
62
|
+
value += character;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
let escape = raw[index + 1];
|
|
66
|
+
if (escape === void 0) return { value, complete: !1 };
|
|
67
|
+
if (escape === "u") {
|
|
68
|
+
let hex = raw.slice(index + 2, index + 6);
|
|
69
|
+
if (!/^[\da-f]{4}$/iu.test(hex)) return { value, complete: !1 };
|
|
70
|
+
value += String.fromCharCode(Number.parseInt(hex, 16)), index += 5;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
let decoded = decodeEscape(escape);
|
|
74
|
+
if (decoded === void 0) return { value, complete: !1 };
|
|
75
|
+
value += decoded, index += 1;
|
|
76
|
+
}
|
|
77
|
+
return { value, complete: !1 };
|
|
78
|
+
}
|
|
79
|
+
function completedString(raw, key) {
|
|
80
|
+
let value = jsonStringPrefix(raw, key);
|
|
81
|
+
return value?.complete === !0 ? value.value : void 0;
|
|
82
|
+
}
|
|
83
|
+
function mutation(name2, callId, argsRaw, stage) {
|
|
84
|
+
if (name2 === "write")
|
|
85
|
+
return {
|
|
86
|
+
callId,
|
|
87
|
+
name: name2,
|
|
88
|
+
argsRaw,
|
|
89
|
+
stage,
|
|
90
|
+
path: jsonStringPrefix(argsRaw, "file_path")?.value,
|
|
91
|
+
operation: "replace-file",
|
|
92
|
+
oldText: void 0,
|
|
93
|
+
newText: jsonStringPrefix(argsRaw, "content")?.value
|
|
94
|
+
};
|
|
95
|
+
if (name2 === "edit")
|
|
96
|
+
return {
|
|
97
|
+
callId,
|
|
98
|
+
name: name2,
|
|
99
|
+
argsRaw,
|
|
100
|
+
stage,
|
|
101
|
+
path: jsonStringPrefix(argsRaw, "file_path")?.value,
|
|
102
|
+
operation: "replace-text",
|
|
103
|
+
oldText: completedString(argsRaw, "old_string"),
|
|
104
|
+
newText: jsonStringPrefix(argsRaw, "new_string")?.value
|
|
105
|
+
};
|
|
106
|
+
if (name2 !== "str_replace_editor") return;
|
|
107
|
+
let command = completedString(argsRaw, "command");
|
|
108
|
+
if (command === "view") return;
|
|
109
|
+
let path = jsonStringPrefix(argsRaw, "path")?.value;
|
|
110
|
+
return command === "create" ? {
|
|
111
|
+
callId,
|
|
112
|
+
name: name2,
|
|
113
|
+
argsRaw,
|
|
114
|
+
stage,
|
|
115
|
+
path,
|
|
116
|
+
operation: "replace-file",
|
|
117
|
+
oldText: void 0,
|
|
118
|
+
newText: jsonStringPrefix(argsRaw, "file_text")?.value
|
|
119
|
+
} : command === "str_replace" ? {
|
|
120
|
+
callId,
|
|
121
|
+
name: name2,
|
|
122
|
+
argsRaw,
|
|
123
|
+
stage,
|
|
124
|
+
path,
|
|
125
|
+
operation: "replace-text",
|
|
126
|
+
oldText: completedString(argsRaw, "old_str"),
|
|
127
|
+
newText: jsonStringPrefix(argsRaw, "new_str")?.value
|
|
128
|
+
} : command === "insert" ? {
|
|
129
|
+
callId,
|
|
130
|
+
name: name2,
|
|
131
|
+
argsRaw,
|
|
132
|
+
stage,
|
|
133
|
+
path,
|
|
134
|
+
operation: "insert-text",
|
|
135
|
+
oldText: void 0,
|
|
136
|
+
newText: jsonStringPrefix(argsRaw, "new_str")?.value
|
|
137
|
+
} : { callId, name: name2, argsRaw, stage, path, operation: void 0, oldText: void 0, newText: void 0 };
|
|
138
|
+
}
|
|
139
|
+
function activeFileMutation(partialBlocks, runningCalls) {
|
|
140
|
+
for (let index = runningCalls.length - 1; index >= 0; index -= 1) {
|
|
141
|
+
let call = runningCalls[index];
|
|
142
|
+
if (call === void 0) continue;
|
|
143
|
+
let value = mutation(call.name, call.callId, call.argsRaw, "running");
|
|
144
|
+
if (value !== void 0) return value;
|
|
145
|
+
}
|
|
146
|
+
for (let index = partialBlocks.length - 1; index >= 0; index -= 1) {
|
|
147
|
+
let block = partialBlocks[index];
|
|
148
|
+
if (block?.kind !== "tool-call") continue;
|
|
149
|
+
let value = mutation(block.name, block.callId, block.argsRaw, "streaming");
|
|
150
|
+
if (value !== void 0) return value;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function creativeRelativePath(path, cwd) {
|
|
154
|
+
if (path === void 0 || path === "") return;
|
|
155
|
+
let normalized = path.replaceAll("\\", "/"), root = cwd?.replaceAll("\\", "/").replace(/\/$/u, ""), relative = root !== void 0 && normalized.startsWith(`${root}/`) ? normalized.slice(root.length + 1) : normalized.replace(/^\.\//u, "").replace(/^\//u, ""), [directory2] = relative.split("/", 1);
|
|
156
|
+
if (!(!(directory2 !== void 0 && (STORY_DIRECTORIES.has(directory2) || DRAMA_DIRECTORIES.has(directory2))) && relative !== "short-drama.json" || !EDITABLE_EXTENSION.test(relative)) && !relative.split("/").some((part) => part === ".." || part === ""))
|
|
157
|
+
return relative;
|
|
158
|
+
}
|
|
159
|
+
function workbenchModeForPath(path) {
|
|
160
|
+
if (path === "short-drama.json") return "drama";
|
|
161
|
+
let directory2 = path?.split("/", 1)[0];
|
|
162
|
+
if (directory2 !== void 0 && STORY_DIRECTORIES.has(directory2)) return "story";
|
|
163
|
+
if (directory2 !== void 0 && DRAMA_DIRECTORIES.has(directory2)) return "drama";
|
|
164
|
+
}
|
|
165
|
+
function previewMutation(activity, base) {
|
|
166
|
+
if (activity.operation === "replace-file") return activity.newText;
|
|
167
|
+
if (activity.operation === "replace-text") {
|
|
168
|
+
if (activity.oldText === void 0 || activity.newText === void 0) return;
|
|
169
|
+
let at = base.indexOf(activity.oldText);
|
|
170
|
+
return at < 0 ? void 0 : `${base.slice(0, at)}${activity.newText}${base.slice(at + activity.oldText.length)}`;
|
|
171
|
+
}
|
|
172
|
+
if (activity.operation === "insert-text") {
|
|
173
|
+
if (activity.newText === void 0) return;
|
|
174
|
+
let rawLine = /"insert_line"\s*:\s*(\d+)/u.exec(activity.argsRaw)?.[1];
|
|
175
|
+
if (rawLine === void 0) return;
|
|
176
|
+
let line = Number.parseInt(rawLine, 10), parts = base.split(`
|
|
177
|
+
`), at = Math.max(0, Math.min(parts.length, line));
|
|
178
|
+
return parts.splice(at, 0, activity.newText), parts.join(`
|
|
179
|
+
`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// src/client/file-tree.ts
|
|
184
|
+
function directory(name2, path) {
|
|
185
|
+
return { name: name2, path, directories: /* @__PURE__ */ new Map(), files: [] };
|
|
186
|
+
}
|
|
187
|
+
function compareNames(left, right) {
|
|
188
|
+
return left.name.localeCompare(right.name, "zh-Hans-CN", { numeric: !0 });
|
|
189
|
+
}
|
|
190
|
+
function freezeDirectory(value) {
|
|
191
|
+
let directories = [...value.directories.values()].map(freezeDirectory).sort(compareNames), files = [...value.files].sort(compareNames);
|
|
192
|
+
return {
|
|
193
|
+
kind: "directory",
|
|
194
|
+
name: value.name,
|
|
195
|
+
path: value.path,
|
|
196
|
+
fileCount: files.length + directories.reduce((sum, child) => sum + child.fileCount, 0),
|
|
197
|
+
children: [...directories, ...files]
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function buildFileTree(files, group) {
|
|
201
|
+
let root = directory(group, group);
|
|
202
|
+
for (let file of files) {
|
|
203
|
+
let segments = (file.path.startsWith(`${group}/`) ? file.path.slice(group.length + 1) : file.path).split("/").filter((segment) => segment !== ""), name2 = segments.pop();
|
|
204
|
+
if (name2 === void 0) continue;
|
|
205
|
+
let parent = root;
|
|
206
|
+
for (let segment of segments) {
|
|
207
|
+
let path = `${parent.path}/${segment}`, child = parent.directories.get(segment) ?? directory(segment, path);
|
|
208
|
+
parent.directories.set(segment, child), parent = child;
|
|
209
|
+
}
|
|
210
|
+
parent.files.push({ kind: "file", name: name2, path: file.path, bytes: file.bytes });
|
|
211
|
+
}
|
|
212
|
+
return freezeDirectory(root).children;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// src/client/jsonl-preview.tsx
|
|
216
|
+
var import_jsx_runtime = require("react/jsx-runtime"), TITLE_KEYS = [
|
|
217
|
+
"display_name",
|
|
218
|
+
"title",
|
|
219
|
+
"name",
|
|
220
|
+
"shot_id",
|
|
221
|
+
"scene_id",
|
|
222
|
+
"episode_id",
|
|
223
|
+
"character_id",
|
|
224
|
+
"location_id",
|
|
225
|
+
"view_id",
|
|
226
|
+
"prop_id",
|
|
227
|
+
"state_id",
|
|
228
|
+
"decision_id",
|
|
229
|
+
"occurrence_id",
|
|
230
|
+
"record_id",
|
|
231
|
+
"id"
|
|
232
|
+
];
|
|
233
|
+
function objectRecord(value) {
|
|
234
|
+
return typeof value == "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
235
|
+
}
|
|
236
|
+
function stringField(record, keys) {
|
|
237
|
+
for (let key of keys) {
|
|
238
|
+
let value = record[key];
|
|
239
|
+
if (typeof value == "string" && value.trim() !== "") return value;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function metadata(value, line) {
|
|
243
|
+
let record = objectRecord(value);
|
|
244
|
+
if (record === void 0) return { title: typeof value == "string" ? value : JSON.stringify(value) ?? `\u7B2C ${String(line)} \u884C` };
|
|
245
|
+
let type = stringField(record, ["record_type", "type", "kind"]), acceptance = objectRecord(record.creator_acceptance), status = stringField(record, ["status"]) ?? (acceptance === void 0 ? void 0 : stringField(acceptance, ["status"]));
|
|
246
|
+
return {
|
|
247
|
+
title: stringField(record, TITLE_KEYS) ?? `\u8BB0\u5F55 ${String(line)}`,
|
|
248
|
+
...type === void 0 ? {} : { type },
|
|
249
|
+
...status === void 0 ? {} : { status }
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function parseJsonl(content) {
|
|
253
|
+
let records = [], lines = content.replaceAll(`\r
|
|
254
|
+
`, `
|
|
255
|
+
`).split(`
|
|
256
|
+
`);
|
|
257
|
+
for (let [index, raw] of lines.entries())
|
|
258
|
+
if (raw.trim() !== "")
|
|
259
|
+
try {
|
|
260
|
+
let value = JSON.parse(raw);
|
|
261
|
+
records.push({ line: index + 1, raw, value, ...metadata(value, index + 1) });
|
|
262
|
+
} catch (error) {
|
|
263
|
+
records.push({
|
|
264
|
+
line: index + 1,
|
|
265
|
+
raw,
|
|
266
|
+
title: `\u7B2C ${String(index + 1)} \u884C\u683C\u5F0F\u9519\u8BEF`,
|
|
267
|
+
error: error instanceof Error ? error.message : String(error)
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
return records;
|
|
271
|
+
}
|
|
272
|
+
var PREVIEW_LIMIT = 200;
|
|
273
|
+
function JsonlPreview({ content, label }) {
|
|
274
|
+
let records = parseJsonl(content);
|
|
275
|
+
if (records.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "oh-story-markdown-empty", children: "\u8FD9\u4E2A JSONL \u6587\u4EF6\u8FD8\u662F\u7A7A\u7684\u3002" });
|
|
276
|
+
let valid = records.filter((record) => record.error === void 0).length, errors = records.length - valid, visible = records.slice(0, PREVIEW_LIMIT);
|
|
277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "oh-story-jsonl", "aria-label": `${label} \u7ED3\u6784\u5316\u9884\u89C8`, children: [
|
|
278
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "oh-story-jsonl-summary", children: [
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: errors === 0 ? `${String(valid)} \u6761\u8BB0\u5F55` : `${String(valid)} \u6761\u6709\u6548\u8BB0\u5F55` }),
|
|
280
|
+
errors > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
281
|
+
String(errors),
|
|
282
|
+
" \u6761\u683C\u5F0F\u9519\u8BEF"
|
|
283
|
+
] }),
|
|
284
|
+
records.length > PREVIEW_LIMIT && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
285
|
+
"\u4EC5\u663E\u793A\u524D ",
|
|
286
|
+
String(PREVIEW_LIMIT),
|
|
287
|
+
" \u6761"
|
|
288
|
+
] })
|
|
289
|
+
] }),
|
|
290
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "oh-story-jsonl-records", children: visible.map((record) => record.error === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { open: records.length <= 2, children: [
|
|
291
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
293
|
+
"\u7B2C ",
|
|
294
|
+
String(record.line),
|
|
295
|
+
" \u884C"
|
|
296
|
+
] }),
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: record.title }),
|
|
298
|
+
record.type !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: record.type }),
|
|
299
|
+
record.status !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("em", { children: record.status })
|
|
300
|
+
] }),
|
|
301
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: JSON.stringify(record.value, null, 2) }) })
|
|
302
|
+
] }, record.line) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "oh-story-jsonl-error", role: "alert", children: [
|
|
303
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: record.title }),
|
|
304
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: record.error }),
|
|
305
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: record.raw })
|
|
306
|
+
] }, record.line)) })
|
|
307
|
+
] });
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/client/markdown-preview.tsx
|
|
311
|
+
var import_jsx_runtime2 = require("react/jsx-runtime"), INLINE = /(`[^`\n]+`|\*\*[^*\n]+\*\*|~~[^~\n]+~~|\[[^\]\n]+\]\(https?:\/\/[^)\s]+\)|\*[^*\n]+\*)/gu;
|
|
312
|
+
function inline(source, key) {
|
|
313
|
+
let nodes = [], cursor = 0;
|
|
314
|
+
for (let match of source.matchAll(INLINE)) {
|
|
315
|
+
let token = match[0], index = match.index;
|
|
316
|
+
if (index > cursor && nodes.push(source.slice(cursor, index)), token.startsWith("`")) nodes.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { children: token.slice(1, -1) }, `${key}-${String(index)}`));
|
|
317
|
+
else if (token.startsWith("**")) nodes.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: token.slice(2, -2) }, `${key}-${String(index)}`));
|
|
318
|
+
else if (token.startsWith("~~")) nodes.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("del", { children: token.slice(2, -2) }, `${key}-${String(index)}`));
|
|
319
|
+
else if (token.startsWith("*")) nodes.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("em", { children: token.slice(1, -1) }, `${key}-${String(index)}`));
|
|
320
|
+
else {
|
|
321
|
+
let link = /^\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)$/u.exec(token);
|
|
322
|
+
nodes.push(link === null ? token : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: link[2], target: "_blank", rel: "noreferrer", children: link[1] }, `${key}-${String(index)}`));
|
|
323
|
+
}
|
|
324
|
+
cursor = index + token.length;
|
|
325
|
+
}
|
|
326
|
+
return cursor < source.length && nodes.push(source.slice(cursor)), nodes;
|
|
327
|
+
}
|
|
328
|
+
function splitTableRow(line) {
|
|
329
|
+
let source = line.trim();
|
|
330
|
+
source.startsWith("|") && (source = source.slice(1)), source.endsWith("|") && (source = source.slice(0, -1));
|
|
331
|
+
let cells = [], cell = "";
|
|
332
|
+
for (let index = 0; index < source.length; index += 1) {
|
|
333
|
+
let character = source[index] ?? "";
|
|
334
|
+
character === "\\" && source[index + 1] === "|" ? (cell += "|", index += 1) : character === "|" ? (cells.push(cell.trim()), cell = "") : cell += character;
|
|
335
|
+
}
|
|
336
|
+
return cells.push(cell.trim()), cells;
|
|
337
|
+
}
|
|
338
|
+
function tableAlignments(line) {
|
|
339
|
+
let cells = splitTableRow(line);
|
|
340
|
+
if (!(cells.length === 0 || !cells.every((cell) => /^:?-{3,}:?$/u.test(cell))))
|
|
341
|
+
return cells.map((cell) => {
|
|
342
|
+
if (cell.startsWith(":") && cell.endsWith(":")) return "center";
|
|
343
|
+
if (cell.endsWith(":")) return "right";
|
|
344
|
+
if (cell.startsWith(":")) return "left";
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
function beginsBlock(lines, index) {
|
|
348
|
+
let line = lines[index] ?? "";
|
|
349
|
+
return /^(`{3,}|~{3,})\s*[\w-]*\s*$/u.test(line) || /^#{1,6}\s+/u.test(line) || /^(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(line) || /^>\s?/u.test(line) || /^[-*+]\s+/u.test(line) || /^\d+[.)]\s+/u.test(line) || line.includes("|") && tableAlignments(lines[index + 1] ?? "") !== void 0;
|
|
350
|
+
}
|
|
351
|
+
function parseMarkdownBlocks(markdown) {
|
|
352
|
+
let lines = markdown.replaceAll(`\r
|
|
353
|
+
`, `
|
|
354
|
+
`).split(`
|
|
355
|
+
`), result = [];
|
|
356
|
+
for (let index = 0; index < lines.length; ) {
|
|
357
|
+
let line = lines[index] ?? "";
|
|
358
|
+
if (line.trim() === "") {
|
|
359
|
+
index += 1;
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
let fence = /^(`{3,}|~{3,})\s*([\w-]*)\s*$/u.exec(line);
|
|
363
|
+
if (fence !== null) {
|
|
364
|
+
let marker = fence[1] ?? "```", markerCharacter = marker[0] ?? "`", closing = new RegExp(`^${markerCharacter}{${String(marker.length)},}\\s*$`, "u"), code = [];
|
|
365
|
+
for (index += 1; index < lines.length && !closing.test(lines[index] ?? ""); )
|
|
366
|
+
code.push(lines[index] ?? ""), index += 1;
|
|
367
|
+
index < lines.length && (index += 1), result.push({ kind: "code", lines: code, ...fence[2] === void 0 || fence[2] === "" ? {} : { language: fence[2] } });
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
let heading = /^(#{1,6})\s+(.+)$/u.exec(line);
|
|
371
|
+
if (heading !== null) {
|
|
372
|
+
result.push({ kind: "heading", text: heading[2] ?? "", level: heading[1]?.length ?? 1 }), index += 1;
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
if (/^(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(line)) {
|
|
376
|
+
result.push({ kind: "rule" }), index += 1;
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
let alignments = line.includes("|") ? tableAlignments(lines[index + 1] ?? "") : void 0;
|
|
380
|
+
if (alignments !== void 0) {
|
|
381
|
+
let headers = splitTableRow(line), rows = [];
|
|
382
|
+
for (index += 2; index < lines.length && (lines[index] ?? "").includes("|") && (lines[index] ?? "").trim() !== ""; )
|
|
383
|
+
rows.push(splitTableRow(lines[index] ?? "")), index += 1;
|
|
384
|
+
result.push({ kind: "table", headers, rows, alignments });
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
if (/^>\s?/u.test(line)) {
|
|
388
|
+
let quote = [];
|
|
389
|
+
for (; index < lines.length && /^>\s?/u.test(lines[index] ?? ""); )
|
|
390
|
+
quote.push((lines[index] ?? "").replace(/^>\s?/u, "")), index += 1;
|
|
391
|
+
result.push({ kind: "quote", lines: quote });
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
let unordered = /^[-*+]\s+(.+)$/u.exec(line), ordered = /^(\d+)[.)]\s+(.+)$/u.exec(line);
|
|
395
|
+
if (unordered !== null || ordered !== null) {
|
|
396
|
+
let kind = unordered !== null ? "ul" : "ol", items = [], pattern = kind === "ul" ? /^[-*+]\s+(.+)$/u : /^\d+[.)]\s+(.+)$/u, start = ordered === null ? void 0 : Number(ordered[1]);
|
|
397
|
+
for (; index < lines.length; ) {
|
|
398
|
+
let item = pattern.exec(lines[index] ?? "");
|
|
399
|
+
if (item === null) break;
|
|
400
|
+
let source = item[1] ?? "", task = /^\[([ xX])\]\s+(.+)$/u.exec(source);
|
|
401
|
+
items.push(task === null ? { text: source } : { text: task[2] ?? "", checked: task[1]?.toLocaleLowerCase() === "x" }), index += 1;
|
|
402
|
+
}
|
|
403
|
+
result.push({ kind, items, ...start === void 0 ? {} : { start } });
|
|
404
|
+
continue;
|
|
405
|
+
}
|
|
406
|
+
let paragraph = [line];
|
|
407
|
+
for (index += 1; index < lines.length; ) {
|
|
408
|
+
let next = lines[index] ?? "";
|
|
409
|
+
if (next.trim() === "" || beginsBlock(lines, index)) break;
|
|
410
|
+
paragraph.push(next), index += 1;
|
|
411
|
+
}
|
|
412
|
+
result.push({ kind: "paragraph", lines: paragraph });
|
|
413
|
+
}
|
|
414
|
+
return result;
|
|
415
|
+
}
|
|
416
|
+
function Heading({ block, blockKey }) {
|
|
417
|
+
let children = inline(block.text, blockKey);
|
|
418
|
+
switch (block.level) {
|
|
419
|
+
case 1:
|
|
420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h1", { children });
|
|
421
|
+
case 2:
|
|
422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children });
|
|
423
|
+
case 3:
|
|
424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children });
|
|
425
|
+
case 4:
|
|
426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h4", { children });
|
|
427
|
+
case 5:
|
|
428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h5", { children });
|
|
429
|
+
default:
|
|
430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h6", { children });
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
function MarkdownPreview({ content, label }) {
|
|
434
|
+
let parsed = parseMarkdownBlocks(content);
|
|
435
|
+
return parsed.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "oh-story-markdown-empty", children: "\u8FD9\u4E2A Markdown \u6587\u4EF6\u8FD8\u662F\u7A7A\u7684\u3002" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("article", { className: "oh-story-markdown", "aria-label": `${label} \u6E32\u67D3\u9884\u89C8`, children: parsed.map((block, index) => {
|
|
436
|
+
let key = `block-${String(index)}`;
|
|
437
|
+
if (block.kind === "code") return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { "data-language": block.language, children: block.lines.join(`
|
|
438
|
+
`) }) }, key);
|
|
439
|
+
if (block.kind === "rule") return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("hr", {}, key);
|
|
440
|
+
if (block.kind === "quote") return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("blockquote", { children: block.lines.map((line, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: inline(line, `${key}-${String(lineIndex)}`) }, `${key}-${String(lineIndex)}`)) }, key);
|
|
441
|
+
if (block.kind === "ul" || block.kind === "ol") {
|
|
442
|
+
let items = block.items.map((item, itemIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { className: item.checked === void 0 ? void 0 : "oh-story-task-item", children: [
|
|
443
|
+
item.checked === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { type: "checkbox", checked: item.checked, readOnly: !0, disabled: !0, "aria-label": item.checked ? "\u5DF2\u5B8C\u6210" : "\u672A\u5B8C\u6210" }),
|
|
444
|
+
inline(item.text, `${key}-${String(itemIndex)}`)
|
|
445
|
+
] }, `${key}-${String(itemIndex)}`));
|
|
446
|
+
return block.kind === "ul" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { children: items }, key) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ol", { start: block.start, children: items }, key);
|
|
447
|
+
}
|
|
448
|
+
return block.kind === "table" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "oh-story-markdown-table", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { children: [
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: block.headers.map((cell, cellIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { style: { textAlign: block.alignments[cellIndex] }, children: inline(cell, `${key}-h-${String(cellIndex)}`) }, `${key}-h-${String(cellIndex)}`)) }) }),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tbody", { children: block.rows.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: block.headers.map((_, cellIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { textAlign: block.alignments[cellIndex] }, children: inline(row[cellIndex] ?? "", `${key}-r-${String(rowIndex)}-${String(cellIndex)}`) }, `${key}-r-${String(rowIndex)}-${String(cellIndex)}`)) }, `${key}-r-${String(rowIndex)}`)) })
|
|
451
|
+
] }) }, key) : block.kind === "heading" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading, { block, blockKey: key }, key) : block.kind === "paragraph" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: block.lines.map((line, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
452
|
+
lineIndex === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("br", {}),
|
|
453
|
+
inline(line, `${key}-${String(lineIndex)}`)
|
|
454
|
+
] }, `${key}-${String(lineIndex)}`)) }, key) : null;
|
|
455
|
+
}) });
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// inline-css:/home/runner/work/oh-story-dsh/oh-story-dsh/packages/dsh-plugin/src/client/plugin.css
|
|
459
|
+
var plugin_default = `.oh-story-bridge-marker { display: none; }
|
|
460
|
+
.oh-story-split-surface { display: contents; }
|
|
461
|
+
|
|
462
|
+
/* DSH documents every [data-slot] wrapper as a stable addressable styling
|
|
463
|
+
seam. The official Session body and composer stay mounted; this only turns
|
|
464
|
+
their scroll host into a three-column writing surface. */
|
|
465
|
+
[data-conversation-scroll]:has(> [data-slot="conversation.session"] > .oh-story-split-surface) {
|
|
466
|
+
--os-border: var(--dsw-alias-border-l2);
|
|
467
|
+
--os-muted: var(--dsw-alias-label-tertiary);
|
|
468
|
+
display: grid;
|
|
469
|
+
grid-template-columns: clamp(108px, 16%, 190px) minmax(220px, 1fr) minmax(260px, 38%);
|
|
470
|
+
grid-template-rows: minmax(0, 1fr);
|
|
471
|
+
min-height: 0;
|
|
472
|
+
overflow-x: hidden;
|
|
473
|
+
overflow-y: auto;
|
|
474
|
+
position: relative;
|
|
475
|
+
scrollbar-gutter: stable;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
[data-conversation-scroll]:has(> [data-slot="conversation.session"] > .oh-story-split-surface)
|
|
479
|
+
> [data-slot="conversation.session"] > :not(.oh-story-split-surface) {
|
|
480
|
+
grid-column: 3;
|
|
481
|
+
grid-row: 1;
|
|
482
|
+
min-width: 0;
|
|
483
|
+
min-height: 100%;
|
|
484
|
+
border-left: 1px solid var(--os-border);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
[data-conversation-scroll]:has(> [data-slot="conversation.session"] > .oh-story-split-surface)
|
|
488
|
+
> [data-composer-seat] {
|
|
489
|
+
grid-column: 3;
|
|
490
|
+
grid-row: 1;
|
|
491
|
+
align-self: start;
|
|
492
|
+
min-width: 0;
|
|
493
|
+
width: 100%;
|
|
494
|
+
position: sticky;
|
|
495
|
+
top: calc(var(--oh-story-scroll-height, 720px) - var(--dsh-composer-height, 152px));
|
|
496
|
+
bottom: auto;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.oh-story-tree,
|
|
500
|
+
.oh-story-editor {
|
|
501
|
+
box-sizing: border-box;
|
|
502
|
+
grid-row: 1;
|
|
503
|
+
position: sticky;
|
|
504
|
+
top: 0;
|
|
505
|
+
align-self: start;
|
|
506
|
+
min-width: 0;
|
|
507
|
+
min-height: 0;
|
|
508
|
+
height: 100%;
|
|
509
|
+
color: inherit;
|
|
510
|
+
background: var(--dsw-alias-bg-base);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.oh-story-tree {
|
|
514
|
+
grid-column: 1;
|
|
515
|
+
overflow: auto;
|
|
516
|
+
padding: 14px 10px 24px;
|
|
517
|
+
border-right: 1px solid var(--os-border);
|
|
518
|
+
background: var(--dsw-specific-sidebar-fill);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.oh-story-editor {
|
|
522
|
+
display: flex;
|
|
523
|
+
grid-column: 2;
|
|
524
|
+
overflow: hidden;
|
|
525
|
+
flex-direction: column;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.oh-story-brand,
|
|
529
|
+
.oh-story-editor header,
|
|
530
|
+
.oh-story-role summary {
|
|
531
|
+
display: flex;
|
|
532
|
+
align-items: center;
|
|
533
|
+
justify-content: space-between;
|
|
534
|
+
gap: 12px;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.oh-story-brand { min-height: 28px; padding: 0 5px 10px 7px; font-size: 14px; font-weight: 500; }
|
|
538
|
+
|
|
539
|
+
.oh-story-brand button,
|
|
540
|
+
.oh-story-save,
|
|
541
|
+
.oh-story-role button {
|
|
542
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
543
|
+
border-radius: 999px;
|
|
544
|
+
color: var(--dsw-alias-label-secondary);
|
|
545
|
+
background: var(--dsw-alias-bg-base);
|
|
546
|
+
padding: 3px 9px;
|
|
547
|
+
cursor: pointer;
|
|
548
|
+
font: inherit;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.oh-story-brand button { display: grid; width: 28px; height: 28px; place-items: center; border: 0; padding: 0; background: transparent; font-size: 16px; }
|
|
552
|
+
.oh-story-brand button:hover,
|
|
553
|
+
.oh-story-save:hover:not(:disabled),
|
|
554
|
+
.oh-story-role button:hover { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-interactive-bg-hover); }
|
|
555
|
+
.oh-story-brand button:focus-visible,
|
|
556
|
+
.oh-story-save:focus-visible,
|
|
557
|
+
.oh-story-mode-tabs button:focus-visible,
|
|
558
|
+
.oh-story-editor-tabs button:focus-visible,
|
|
559
|
+
.oh-story-tree nav button:focus-visible,
|
|
560
|
+
.oh-story-role button:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary); outline-offset: -2px; }
|
|
561
|
+
.oh-story-save:disabled { opacity: .48; cursor: default; }
|
|
562
|
+
|
|
563
|
+
.oh-story-mode-tabs {
|
|
564
|
+
display: grid;
|
|
565
|
+
grid-template-columns: 1fr 1fr;
|
|
566
|
+
margin: 0 4px 10px;
|
|
567
|
+
border-bottom: 1px solid var(--os-border);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.oh-story-mode-tabs button,
|
|
571
|
+
.oh-story-editor-tabs button {
|
|
572
|
+
position: relative;
|
|
573
|
+
min-height: 30px;
|
|
574
|
+
border: 0;
|
|
575
|
+
color: var(--os-muted);
|
|
576
|
+
background: transparent;
|
|
577
|
+
cursor: pointer;
|
|
578
|
+
font: inherit;
|
|
579
|
+
font-size: 12px;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.oh-story-mode-tabs button:hover,
|
|
583
|
+
.oh-story-editor-tabs button:hover { color: var(--dsw-alias-label-primary); }
|
|
584
|
+
.oh-story-mode-tabs button[aria-selected="true"],
|
|
585
|
+
.oh-story-editor-tabs button[aria-selected="true"] { color: var(--dsw-alias-label-primary); font-weight: 500; }
|
|
586
|
+
.oh-story-mode-tabs button[aria-selected="true"]::after {
|
|
587
|
+
position: absolute;
|
|
588
|
+
right: 14px;
|
|
589
|
+
bottom: -1px;
|
|
590
|
+
left: 14px;
|
|
591
|
+
height: 2px;
|
|
592
|
+
border-radius: 2px 2px 0 0;
|
|
593
|
+
background: var(--dsw-alias-state-business-primary);
|
|
594
|
+
content: "";
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
.oh-story-file-group,
|
|
598
|
+
.oh-story-file-folder { margin: 0; }
|
|
599
|
+
.oh-story-file-group > summary,
|
|
600
|
+
.oh-story-file-folder > summary {
|
|
601
|
+
display: flex;
|
|
602
|
+
align-items: center;
|
|
603
|
+
gap: 5px;
|
|
604
|
+
min-height: 26px;
|
|
605
|
+
padding: 0 7px;
|
|
606
|
+
border-radius: 6px;
|
|
607
|
+
color: var(--os-muted);
|
|
608
|
+
cursor: pointer;
|
|
609
|
+
list-style: none;
|
|
610
|
+
font-size: 11px;
|
|
611
|
+
font-weight: 600;
|
|
612
|
+
}
|
|
613
|
+
.oh-story-file-group > summary { margin-top: 3px; }
|
|
614
|
+
.oh-story-file-group > summary::-webkit-details-marker,
|
|
615
|
+
.oh-story-file-folder > summary::-webkit-details-marker { display: none; }
|
|
616
|
+
.oh-story-file-group > summary::before,
|
|
617
|
+
.oh-story-file-folder > summary::before { width: 8px; content: "\u203A"; transform: rotate(0); transition: transform .12s ease; }
|
|
618
|
+
.oh-story-file-group[open] > summary::before,
|
|
619
|
+
.oh-story-file-folder[open] > summary::before { transform: rotate(90deg); }
|
|
620
|
+
.oh-story-file-group > summary:hover,
|
|
621
|
+
.oh-story-file-folder > summary:hover { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-interactive-bg-hover); }
|
|
622
|
+
.oh-story-file-group > summary span,
|
|
623
|
+
.oh-story-file-folder > summary span { margin-left: auto; color: var(--dsw-alias-label-caption); font-weight: 400; }
|
|
624
|
+
|
|
625
|
+
.oh-story-tree nav button {
|
|
626
|
+
display: block;
|
|
627
|
+
width: 100%;
|
|
628
|
+
overflow: hidden;
|
|
629
|
+
padding: 6px 8px;
|
|
630
|
+
border: 0;
|
|
631
|
+
border-radius: 6px;
|
|
632
|
+
color: inherit;
|
|
633
|
+
background: transparent;
|
|
634
|
+
text-align: left;
|
|
635
|
+
text-overflow: ellipsis;
|
|
636
|
+
white-space: nowrap;
|
|
637
|
+
cursor: pointer;
|
|
638
|
+
font: inherit;
|
|
639
|
+
font-size: 12px;
|
|
640
|
+
}
|
|
641
|
+
.oh-story-tree nav button:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
642
|
+
.oh-story-tree nav button[aria-current="page"] { background: var(--dsw-alias-button-ghost-active-fill); color: var(--dsw-alias-label-primary); }
|
|
643
|
+
.oh-story-tree nav button[data-agent-target] { box-shadow: inset 2px 0 var(--dsw-alias-state-business-primary); }
|
|
644
|
+
|
|
645
|
+
.oh-story-editor header {
|
|
646
|
+
min-height: 44px;
|
|
647
|
+
flex: none;
|
|
648
|
+
padding: 0 14px;
|
|
649
|
+
border-bottom: 1px solid var(--os-border);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
.oh-story-editor header span {
|
|
653
|
+
overflow: hidden;
|
|
654
|
+
text-overflow: ellipsis;
|
|
655
|
+
white-space: nowrap;
|
|
656
|
+
font-size: 12px;
|
|
657
|
+
color: var(--os-muted);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
.oh-story-editor-actions { display: flex; flex: none; align-items: center; gap: 8px; }
|
|
661
|
+
.oh-story-editor-tabs {
|
|
662
|
+
display: flex;
|
|
663
|
+
padding: 2px;
|
|
664
|
+
border: 1px solid var(--os-border);
|
|
665
|
+
border-radius: 7px;
|
|
666
|
+
background: var(--dsw-alias-bg-layer-1);
|
|
667
|
+
}
|
|
668
|
+
.oh-story-editor-tabs button { min-height: 24px; padding: 0 9px; border-radius: 5px; font-size: 11px; }
|
|
669
|
+
.oh-story-editor-tabs button[aria-selected="true"] { background: var(--dsw-alias-bg-base); box-shadow: 0 1px 2px rgb(0 0 0 / 8%); }
|
|
670
|
+
.oh-story-save { min-height: 28px; }
|
|
671
|
+
|
|
672
|
+
.oh-story-editor textarea {
|
|
673
|
+
box-sizing: border-box;
|
|
674
|
+
width: 100%;
|
|
675
|
+
min-height: 0;
|
|
676
|
+
flex: 1;
|
|
677
|
+
resize: none;
|
|
678
|
+
border: 0;
|
|
679
|
+
outline: 0;
|
|
680
|
+
padding: clamp(20px, 4vw, 48px) clamp(22px, 6vw, 84px) 48px;
|
|
681
|
+
color: var(--dsw-alias-label-primary);
|
|
682
|
+
background: transparent;
|
|
683
|
+
font: 16px/1.9 ui-serif, "Songti SC", "STSong", Georgia, serif;
|
|
684
|
+
}
|
|
685
|
+
.oh-story-editor textarea[data-format="structured"] {
|
|
686
|
+
tab-size: 2;
|
|
687
|
+
font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
.oh-story-markdown {
|
|
691
|
+
box-sizing: border-box;
|
|
692
|
+
width: 100%;
|
|
693
|
+
min-height: 0;
|
|
694
|
+
flex: 1;
|
|
695
|
+
overflow: auto;
|
|
696
|
+
padding: clamp(24px, 5vw, 56px) clamp(24px, 7vw, 92px) 64px;
|
|
697
|
+
color: var(--dsw-alias-label-primary);
|
|
698
|
+
font: 16px/1.85 ui-serif, "Songti SC", "STSong", Georgia, serif;
|
|
699
|
+
overflow-wrap: anywhere;
|
|
700
|
+
}
|
|
701
|
+
.oh-story-markdown > :first-child { margin-top: 0; }
|
|
702
|
+
.oh-story-markdown > :last-child { margin-bottom: 0; }
|
|
703
|
+
.oh-story-markdown h1,
|
|
704
|
+
.oh-story-markdown h2,
|
|
705
|
+
.oh-story-markdown h3,
|
|
706
|
+
.oh-story-markdown h4,
|
|
707
|
+
.oh-story-markdown h5,
|
|
708
|
+
.oh-story-markdown h6 { margin: 1.45em 0 .6em; font-family: ui-sans-serif, system-ui, "PingFang SC", sans-serif; line-height: 1.35; letter-spacing: -.01em; }
|
|
709
|
+
.oh-story-markdown h1 { font-size: 1.75em; }
|
|
710
|
+
.oh-story-markdown h2 { padding-bottom: .35em; border-bottom: 1px solid var(--os-border); font-size: 1.35em; }
|
|
711
|
+
.oh-story-markdown h3 { font-size: 1.15em; }
|
|
712
|
+
.oh-story-markdown p { margin: .75em 0; }
|
|
713
|
+
.oh-story-markdown ul,
|
|
714
|
+
.oh-story-markdown ol { margin: .75em 0; padding-left: 1.6em; }
|
|
715
|
+
.oh-story-markdown li { margin: .28em 0; }
|
|
716
|
+
.oh-story-markdown .oh-story-task-item { list-style: none; margin-left: -1.35em; }
|
|
717
|
+
.oh-story-task-item input { margin: 0 .55em 0 0; accent-color: var(--dsw-alias-state-business-primary); }
|
|
718
|
+
.oh-story-markdown blockquote { margin: 1em 0; padding: .1em 1em; border-left: 3px solid var(--dsw-alias-state-business-primary); color: var(--dsw-alias-label-secondary); }
|
|
719
|
+
/* DSH gives inline code its own alias; the block fill is a different surface. */
|
|
720
|
+
.oh-story-markdown code { padding: .15em .4em; border-radius: 4px; background: var(--dsw-alias-markdown-inline-code); font: .86em/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
|
|
721
|
+
.oh-story-markdown pre { overflow: auto; margin: 1em 0; padding: 14px 16px; border: 1px solid var(--dsw-alias-border-l1); border-radius: 10px; background: var(--dsw-alias-markdown-code-block); }
|
|
722
|
+
.oh-story-markdown pre code { padding: 0; background: transparent; }
|
|
723
|
+
.oh-story-markdown a { color: var(--dsw-alias-state-business-primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
|
|
724
|
+
.oh-story-markdown del { color: var(--os-muted); }
|
|
725
|
+
.oh-story-markdown-table { overflow-x: auto; margin: 1em 0; border: 1px solid var(--os-border); border-radius: 10px; }
|
|
726
|
+
.oh-story-markdown table { width: 100%; border-collapse: collapse; font-family: ui-sans-serif, system-ui, "PingFang SC", sans-serif; font-size: 13px; line-height: 1.55; }
|
|
727
|
+
.oh-story-markdown th,
|
|
728
|
+
.oh-story-markdown td { min-width: 96px; padding: 9px 12px; border-right: 1px solid var(--os-border); border-bottom: 1px solid var(--os-border); vertical-align: top; }
|
|
729
|
+
.oh-story-markdown th:last-child,
|
|
730
|
+
.oh-story-markdown td:last-child { border-right: 0; }
|
|
731
|
+
.oh-story-markdown tbody tr:last-child td { border-bottom: 0; }
|
|
732
|
+
.oh-story-markdown th { background: var(--dsw-alias-bg-layer-1); font-weight: 600; }
|
|
733
|
+
.oh-story-markdown hr { margin: 2em 0; border: 0; border-top: 1px solid var(--os-border); }
|
|
734
|
+
.oh-story-markdown-empty { margin: auto; color: var(--os-muted); font-size: 13px; }
|
|
735
|
+
|
|
736
|
+
.oh-story-jsonl {
|
|
737
|
+
box-sizing: border-box;
|
|
738
|
+
display: flex;
|
|
739
|
+
width: 100%;
|
|
740
|
+
min-height: 0;
|
|
741
|
+
flex: 1;
|
|
742
|
+
overflow: hidden;
|
|
743
|
+
flex-direction: column;
|
|
744
|
+
color: var(--dsw-alias-label-primary);
|
|
745
|
+
background: var(--dsw-alias-bg-base);
|
|
746
|
+
}
|
|
747
|
+
.oh-story-jsonl-summary { display: flex; min-height: 42px; flex: none; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--os-border); font-size: 12px; }
|
|
748
|
+
.oh-story-jsonl-summary strong { font-weight: 600; }
|
|
749
|
+
.oh-story-jsonl-summary span { color: var(--os-muted); }
|
|
750
|
+
.oh-story-jsonl-records { overflow: auto; padding: 14px 18px 36px; }
|
|
751
|
+
.oh-story-jsonl details,
|
|
752
|
+
.oh-story-jsonl-error { overflow: hidden; margin-bottom: 10px; border: 1px solid var(--os-border); border-radius: 10px; background: var(--dsw-alias-bg-layer-1); }
|
|
753
|
+
.oh-story-jsonl summary { display: flex; min-height: 42px; align-items: center; gap: 9px; padding: 0 12px; cursor: pointer; list-style: none; font: 12px/1.4 ui-sans-serif, system-ui, "PingFang SC", sans-serif; }
|
|
754
|
+
.oh-story-jsonl summary::-webkit-details-marker { display: none; }
|
|
755
|
+
.oh-story-jsonl summary::before { content: "\u203A"; color: var(--os-muted); font-size: 16px; transition: transform .12s ease; }
|
|
756
|
+
.oh-story-jsonl details[open] summary::before { transform: rotate(90deg); }
|
|
757
|
+
.oh-story-jsonl summary > span { flex: none; color: var(--os-muted); font-variant-numeric: tabular-nums; }
|
|
758
|
+
.oh-story-jsonl summary > strong { overflow: hidden; min-width: 80px; flex: 1; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
|
|
759
|
+
.oh-story-jsonl summary > code,
|
|
760
|
+
.oh-story-jsonl summary > em { flex: none; padding: 2px 6px; border-radius: 5px; background: var(--dsw-alias-button-ghost-active-fill); color: var(--dsw-alias-label-secondary); font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; font-style: normal; }
|
|
761
|
+
.oh-story-jsonl pre { overflow: auto; max-height: 520px; margin: 0; padding: 14px 16px; border-top: 1px solid var(--os-border); background: var(--dsw-alias-markdown-code-block); color: var(--dsw-alias-label-secondary); white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
|
|
762
|
+
.oh-story-jsonl-error { display: grid; gap: 5px; padding: 12px; border-color: var(--dsw-alias-state-error-primary); font-size: 12px; }
|
|
763
|
+
.oh-story-jsonl-error > strong { color: var(--dsw-alias-state-error-primary); }
|
|
764
|
+
.oh-story-jsonl-error > span { color: var(--os-muted); }
|
|
765
|
+
.oh-story-jsonl-error pre { margin: 3px -12px -12px; }
|
|
766
|
+
|
|
767
|
+
.oh-story-stream,
|
|
768
|
+
.oh-story-conflict {
|
|
769
|
+
flex: none;
|
|
770
|
+
padding: 7px 12px;
|
|
771
|
+
border-bottom: 1px solid var(--os-border);
|
|
772
|
+
font-size: 11px;
|
|
773
|
+
line-height: 1.4;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
.oh-story-stream { color: var(--dsw-alias-state-business-primary); background: var(--dsw-alias-button-ghost-active-fill); }
|
|
777
|
+
.oh-story-stream[data-stage="streaming"] { animation: oh-story-pulse 1.2s ease-in-out infinite alternate; }
|
|
778
|
+
.oh-story-conflict { color: var(--dsw-alias-state-warn-label); background: var(--dsw-specific-tip); }
|
|
779
|
+
|
|
780
|
+
@keyframes oh-story-pulse { to { opacity: .62; } }
|
|
781
|
+
@media (prefers-reduced-motion: reduce) { .oh-story-stream[data-stage="streaming"] { animation: none; } }
|
|
782
|
+
|
|
783
|
+
.oh-story-empty { margin: auto; max-width: 480px; padding: 30px; color: var(--os-muted); line-height: 1.7; text-align: center; }
|
|
784
|
+
.oh-story-error { margin: 8px; padding: 8px 10px; border-radius: 8px; color: var(--dsw-alias-state-error-primary); background: var(--dsw-specific-tip); font-size: 12px; }
|
|
785
|
+
|
|
786
|
+
.oh-story-role { display: flex; flex-direction: column; margin: 0; overflow: hidden; }
|
|
787
|
+
.oh-story-role summary { min-height: 24px; padding: 0; cursor: pointer; list-style: none; font-size: 14px; line-height: 24px; }
|
|
788
|
+
.oh-story-role summary::-webkit-details-marker { display: none; }
|
|
789
|
+
.oh-story-role summary span { color: var(--dsw-alias-state-business-primary); }
|
|
790
|
+
.oh-story-role summary strong { margin-right: auto; color: var(--dsw-alias-label-secondary); font-weight: 500; }
|
|
791
|
+
.oh-story-role summary em { color: var(--dsw-alias-label-caption); font-style: normal; font-size: 12px; }
|
|
792
|
+
.oh-story-role[data-state="error"] summary em { color: var(--dsw-alias-state-error-primary); }
|
|
793
|
+
.oh-story-role pre { max-height: 260px; overflow: auto; margin: 4px 0 4px 4px; padding: 12px 16px; border: 1px solid var(--dsw-alias-border-l1); border-radius: 12px; color: var(--dsw-alias-label-secondary); background: var(--dsw-alias-markdown-code-block); white-space: pre-wrap; font: var(--dsw-font-markdown-code-block-small); }
|
|
794
|
+
.oh-story-role > button { align-self: flex-start; margin: 4px 0 2px 4px; font-size: 11px; }
|
|
795
|
+
|
|
796
|
+
@media (max-width: 980px) {
|
|
797
|
+
[data-conversation-scroll]:has(> [data-slot="conversation.session"] > .oh-story-split-surface) {
|
|
798
|
+
grid-template-columns: 104px minmax(210px, 1fr) minmax(252px, 40%);
|
|
799
|
+
}
|
|
800
|
+
.oh-story-editor textarea { padding-right: 28px; padding-left: 28px; }
|
|
801
|
+
}
|
|
802
|
+
`;
|
|
803
|
+
|
|
804
|
+
// src/client/index.tsx
|
|
805
|
+
var import_jsx_runtime3 = require("react/jsx-runtime"), name = "oh-story", inject = ["slots"], GROUP_ORDER = {
|
|
806
|
+
story: ["\u6B63\u6587", "\u5927\u7EB2", "\u8BBE\u5B9A", "\u8FFD\u8E2A", "\u5BF9\u6807", "\u53C2\u8003\u8D44\u6599"],
|
|
807
|
+
drama: ["\u9879\u76EE", "\u8F93\u5165", "\u9879\u76EE\u5F00\u53D1", "\u8BBE\u5B9A\u96C6", "\u5267\u96C6", "\u5BA1\u67E5", "\u521B\u4F5C\u8005\u51B3\u7B56", "\u4EA4\u4ED8"]
|
|
808
|
+
};
|
|
809
|
+
function groupForPath(path) {
|
|
810
|
+
return path === "short-drama.json" ? "\u9879\u76EE" : path.split("/", 1)[0] ?? "\u5176\u4ED6";
|
|
811
|
+
}
|
|
812
|
+
function preferredFile(files, mode) {
|
|
813
|
+
let matching = files.filter((file) => workbenchModeForPath(file.path) === mode), preferences = mode === "story" ? [/^正文\/.*\.md$/u, /^大纲\/.*\.md$/u, /\.md$/u] : [/^剧集\/EP0*1\/screenplay\.md$/iu, /^剧集\/.*\/screenplay\.md$/iu, /^项目开发\/creative-brief\.md$/u, /^输入\/.*\.md$/u, /\.md$/u, /^short-drama\.json$/u];
|
|
814
|
+
for (let pattern of preferences) {
|
|
815
|
+
let match = matching.find((file) => pattern.test(file.path));
|
|
816
|
+
if (match !== void 0) return match.path;
|
|
817
|
+
}
|
|
818
|
+
return matching[0]?.path;
|
|
819
|
+
}
|
|
820
|
+
var EMPTY_BLOCKS = [], EMPTY_CALLS = [];
|
|
821
|
+
function endpoint(path, sessionId, file) {
|
|
822
|
+
let url = new URL(`/oh-story/${path}`, globalThis.location.origin);
|
|
823
|
+
return url.searchParams.set("sessionId", sessionId), file !== void 0 && url.searchParams.set("path", file), url.toString();
|
|
824
|
+
}
|
|
825
|
+
async function json(response) {
|
|
826
|
+
let value = await response.json();
|
|
827
|
+
if (!response.ok) throw new Error(value.error ?? `HTTP ${String(response.status)}`);
|
|
828
|
+
return value;
|
|
829
|
+
}
|
|
830
|
+
function FileTreeNodes({
|
|
831
|
+
nodes,
|
|
832
|
+
depth,
|
|
833
|
+
expanded,
|
|
834
|
+
selected,
|
|
835
|
+
activityPath,
|
|
836
|
+
onToggle,
|
|
837
|
+
onSelect
|
|
838
|
+
}) {
|
|
839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: nodes.map((node) => {
|
|
840
|
+
if (node.kind === "file") return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
841
|
+
"button",
|
|
842
|
+
{
|
|
843
|
+
type: "button",
|
|
844
|
+
style: { paddingLeft: `${String(14 + depth * 14)}px` },
|
|
845
|
+
"data-file-path": node.path,
|
|
846
|
+
"data-agent-target": node.path === activityPath || void 0,
|
|
847
|
+
"aria-current": node.path === selected ? "page" : void 0,
|
|
848
|
+
onClick: () => {
|
|
849
|
+
onSelect(node.path);
|
|
850
|
+
},
|
|
851
|
+
children: node.name
|
|
852
|
+
},
|
|
853
|
+
node.path
|
|
854
|
+
);
|
|
855
|
+
let open = expanded[node.path] ?? selected?.startsWith(`${node.path}/`) === !0;
|
|
856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("details", { className: "oh-story-file-folder", open, onToggle: (event) => {
|
|
857
|
+
onToggle(node.path, event.currentTarget.open);
|
|
858
|
+
}, children: [
|
|
859
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("summary", { style: { paddingLeft: `${String(7 + depth * 14)}px` }, children: [
|
|
860
|
+
node.name,
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: node.fileCount })
|
|
862
|
+
] }),
|
|
863
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
864
|
+
FileTreeNodes,
|
|
865
|
+
{
|
|
866
|
+
nodes: node.children,
|
|
867
|
+
depth: depth + 1,
|
|
868
|
+
expanded,
|
|
869
|
+
selected,
|
|
870
|
+
activityPath,
|
|
871
|
+
onToggle,
|
|
872
|
+
onSelect
|
|
873
|
+
}
|
|
874
|
+
)
|
|
875
|
+
] }, node.path);
|
|
876
|
+
}) });
|
|
877
|
+
}
|
|
878
|
+
function useWorkspace(sessionId) {
|
|
879
|
+
let [version, setVersion] = (0, import_react.useState)(0), [workspace, setWorkspace] = (0, import_react.useState)(), [error, setError] = (0, import_react.useState)(), reload = (0, import_react.useCallback)(() => {
|
|
880
|
+
setVersion((value) => value + 1);
|
|
881
|
+
}, []);
|
|
882
|
+
return (0, import_react.useEffect)(() => {
|
|
883
|
+
let controller = new AbortController();
|
|
884
|
+
return setError(void 0), fetch(endpoint("workspace", sessionId), { signal: controller.signal }).then((response) => json(response)).then(setWorkspace).catch((reason) => {
|
|
885
|
+
controller.signal.aborted || setError(reason instanceof Error ? reason.message : String(reason));
|
|
886
|
+
}), () => {
|
|
887
|
+
controller.abort();
|
|
888
|
+
};
|
|
889
|
+
}, [sessionId, version]), { workspace, error, reload };
|
|
890
|
+
}
|
|
891
|
+
function CreativeWorkbench({ sessionId, useSession }) {
|
|
892
|
+
let { workspace, error, reload } = useWorkspace(sessionId), partialBlocks = useSession((value) => value.partial?.blocks ?? EMPTY_BLOCKS), runningCalls = useSession((value) => value.runningCalls ?? EMPTY_CALLS), activity = (0, import_react.useMemo)(() => activeFileMutation(partialBlocks, runningCalls), [partialBlocks, runningCalls]), activityPath = creativeRelativePath(activity?.path, workspace?.cwd), activityMode = workbenchModeForPath(activityPath), [workbench, setWorkbench] = (0, import_react.useState)("story"), initializedWorkbench = (0, import_react.useRef)(!1), [selected, setSelected] = (0, import_react.useState)(), [buffers, setBuffers] = (0, import_react.useState)({}), buffersRef = (0, import_react.useRef)({}), [refreshVersion, setRefreshVersion] = (0, import_react.useState)(0), [fileError, setFileError] = (0, import_react.useState)(), [conflict, setConflict] = (0, import_react.useState)(), [saving, setSaving] = (0, import_react.useState)(!1), [expanded, setExpanded] = (0, import_react.useState)({}), surfaceRef = (0, import_react.useRef)(null), navRef = (0, import_react.useRef)(null), lastActivity = (0, import_react.useRef)(), settleTimer = (0, import_react.useRef)(void 0), buffer = selected === void 0 ? void 0 : buffers[selected], dirty = buffer?.source === "human" && buffer.content !== buffer.saved, selectedLower = selected?.toLocaleLowerCase(), markdown = selectedLower?.endsWith(".md") === !0, jsonl = selectedLower?.endsWith(".jsonl") === !0, structured = jsonl || selectedLower?.endsWith(".json") === !0, previewable = markdown || jsonl, [editorMode, setEditorMode] = (0, import_react.useState)("preview");
|
|
893
|
+
(0, import_react.useEffect)(() => {
|
|
894
|
+
buffersRef.current = buffers;
|
|
895
|
+
}, [buffers]), (0, import_react.useEffect)(() => {
|
|
896
|
+
if (workspace === void 0 || initializedWorkbench.current) return;
|
|
897
|
+
let hasStory = workspace.files.some((file) => workbenchModeForPath(file.path) === "story");
|
|
898
|
+
workspace.shortDrama !== null && !hasStory && setWorkbench("drama"), initializedWorkbench.current = !0;
|
|
899
|
+
}, [workspace]), (0, import_react.useEffect)(() => {
|
|
900
|
+
activityMode !== void 0 && setWorkbench(activityMode);
|
|
901
|
+
}, [activityMode]), (0, import_react.useEffect)(() => {
|
|
902
|
+
setEditorMode(previewable ? "preview" : "source");
|
|
903
|
+
}, [previewable, selected]), (0, import_react.useEffect)(() => {
|
|
904
|
+
if (activityPath !== void 0) {
|
|
905
|
+
setSelected(activityPath);
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
selected !== void 0 && ((workspace?.files.some((file) => file.path === selected) ?? !1) || buffers[selected] !== void 0) && workbenchModeForPath(selected) === workbench || setSelected(workspace === void 0 ? void 0 : preferredFile(workspace.files, workbench));
|
|
909
|
+
}, [activityPath, buffers, selected, workbench, workspace]), (0, import_react.useEffect)(() => {
|
|
910
|
+
if (selected === void 0) return;
|
|
911
|
+
let exists = workspace?.files.some((file) => file.path === selected) ?? !1;
|
|
912
|
+
if (activityPath === selected && !exists) return;
|
|
913
|
+
let controller = new AbortController();
|
|
914
|
+
return setFileError(void 0), fetch(endpoint("file", sessionId, selected), { signal: controller.signal }).then((response) => json(response)).then((file) => {
|
|
915
|
+
let existing = buffersRef.current[file.path];
|
|
916
|
+
if (existing?.source === "human" && existing.content !== existing.saved) {
|
|
917
|
+
setConflict(`${file.path} \u5DF2\u88AB Agent \u66F4\u65B0\uFF1B\u4F60\u7684\u672A\u4FDD\u5B58\u7248\u672C\u4ECD\u4FDD\u7559\u3002`);
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
setBuffers((current) => ({
|
|
921
|
+
...current,
|
|
922
|
+
[file.path]: { content: file.content, saved: file.content, source: "disk", version: file.version }
|
|
923
|
+
}));
|
|
924
|
+
}).catch((reason) => {
|
|
925
|
+
controller.signal.aborted || setFileError(reason instanceof Error ? reason.message : String(reason));
|
|
926
|
+
}), () => {
|
|
927
|
+
controller.abort();
|
|
928
|
+
};
|
|
929
|
+
}, [activityPath, refreshVersion, selected, sessionId, workspace?.files]), (0, import_react.useEffect)(() => {
|
|
930
|
+
if (activity === void 0 || activityPath === void 0) return;
|
|
931
|
+
setSelected(activityPath);
|
|
932
|
+
let existing = buffers[activityPath];
|
|
933
|
+
if (existing?.source === "human" && existing.content !== existing.saved) {
|
|
934
|
+
setConflict(`${activityPath} \u6B63\u7531 Agent \u4FEE\u6539\uFF1B\u4F60\u7684\u672A\u4FDD\u5B58\u7248\u672C\u5DF2\u9501\u5B9A\uFF0C\u4E0D\u4F1A\u88AB\u8986\u76D6\u3002`);
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
let next = previewMutation(activity, existing?.saved ?? "");
|
|
938
|
+
next !== void 0 && (setConflict(void 0), setBuffers((current) => {
|
|
939
|
+
let currentBuffer = current[activityPath];
|
|
940
|
+
return currentBuffer?.source === "agent" && currentBuffer.content === next ? current : {
|
|
941
|
+
...current,
|
|
942
|
+
[activityPath]: {
|
|
943
|
+
content: next,
|
|
944
|
+
saved: currentBuffer?.saved ?? "",
|
|
945
|
+
source: "agent",
|
|
946
|
+
version: currentBuffer?.version ?? ""
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
}));
|
|
950
|
+
}, [activity, activityPath, buffers]), (0, import_react.useEffect)(() => {
|
|
951
|
+
if (activity !== void 0) {
|
|
952
|
+
settleTimer.current !== void 0 && clearTimeout(settleTimer.current), lastActivity.current = activity;
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
if (lastActivity.current !== void 0)
|
|
956
|
+
return settleTimer.current = setTimeout(() => {
|
|
957
|
+
lastActivity.current = void 0, reload(), setRefreshVersion((value) => value + 1);
|
|
958
|
+
}, 180), () => {
|
|
959
|
+
settleTimer.current !== void 0 && clearTimeout(settleTimer.current);
|
|
960
|
+
};
|
|
961
|
+
}, [activity, reload]), (0, import_react.useEffect)(() => {
|
|
962
|
+
if (selected !== void 0) {
|
|
963
|
+
for (let button of navRef.current?.querySelectorAll("button[data-file-path]") ?? [])
|
|
964
|
+
if (button.dataset.filePath === selected) {
|
|
965
|
+
button.scrollIntoView({ block: "nearest" });
|
|
966
|
+
break;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}, [selected]), (0, import_react.useEffect)(() => {
|
|
970
|
+
if (activity !== void 0 || workspace === void 0) return;
|
|
971
|
+
let sessionSurface = surfaceRef.current?.parentElement;
|
|
972
|
+
if (sessionSurface == null) return;
|
|
973
|
+
let knownPaths = new Set(workspace.files.map((file) => file.path)), followOfficialFileLink = (event) => {
|
|
974
|
+
let origin = event.target;
|
|
975
|
+
if (!(origin instanceof Element)) return;
|
|
976
|
+
let control = origin.closest("button, a");
|
|
977
|
+
if (control === null || control.closest(".oh-story-split-surface") !== null) return;
|
|
978
|
+
let candidates = [control.title, control.getAttribute("aria-label"), control.textContent];
|
|
979
|
+
for (let candidate of candidates) {
|
|
980
|
+
let path = creativeRelativePath(candidate?.trim().replace(/^Open\s+/u, ""), workspace.cwd);
|
|
981
|
+
if (!(path === void 0 || !knownPaths.has(path))) {
|
|
982
|
+
event.preventDefault(), event.stopPropagation(), setConflict(void 0), setWorkbench(workbenchModeForPath(path) ?? "story"), setSelected(path);
|
|
983
|
+
break;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
return sessionSurface.addEventListener("click", followOfficialFileLink, !0), () => {
|
|
988
|
+
sessionSurface.removeEventListener("click", followOfficialFileLink, !0);
|
|
989
|
+
};
|
|
990
|
+
}, [activity, workspace]);
|
|
991
|
+
let save = (0, import_react.useCallback)(async () => {
|
|
992
|
+
if (selected === void 0 || buffer === void 0) return;
|
|
993
|
+
let submitted = buffer;
|
|
994
|
+
setSaving(!0), setFileError(void 0);
|
|
995
|
+
try {
|
|
996
|
+
let file = await json(await fetch(endpoint("file", sessionId, selected), {
|
|
997
|
+
method: "PUT",
|
|
998
|
+
headers: { "content-type": "application/json" },
|
|
999
|
+
body: JSON.stringify({ content: submitted.content, baseVersion: submitted.version })
|
|
1000
|
+
}));
|
|
1001
|
+
setBuffers((current) => {
|
|
1002
|
+
let latest = current[selected];
|
|
1003
|
+
if (latest === void 0) return current;
|
|
1004
|
+
let unchanged = latest.content === submitted.content;
|
|
1005
|
+
return {
|
|
1006
|
+
...current,
|
|
1007
|
+
[selected]: {
|
|
1008
|
+
content: unchanged ? file.content : latest.content,
|
|
1009
|
+
saved: file.content,
|
|
1010
|
+
source: unchanged ? "disk" : "human",
|
|
1011
|
+
version: file.version
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
}), setConflict(void 0), reload();
|
|
1015
|
+
} catch (reason) {
|
|
1016
|
+
setFileError(reason instanceof Error ? reason.message : String(reason));
|
|
1017
|
+
} finally {
|
|
1018
|
+
setSaving(!1);
|
|
1019
|
+
}
|
|
1020
|
+
}, [buffer, reload, selected, sessionId]), groups = (0, import_react.useMemo)(() => {
|
|
1021
|
+
let value = /* @__PURE__ */ new Map(), all = [...workspace?.files ?? []].filter((file) => workbenchModeForPath(file.path) === workbench);
|
|
1022
|
+
activityPath !== void 0 && !all.some((file) => file.path === activityPath) && all.push({ path: activityPath, bytes: 0 }), all.sort((left, right) => left.path.localeCompare(right.path, "zh-Hans-CN"));
|
|
1023
|
+
for (let file of all) {
|
|
1024
|
+
let directory2 = groupForPath(file.path), files = value.get(directory2) ?? [];
|
|
1025
|
+
files.push(file), value.set(directory2, files);
|
|
1026
|
+
}
|
|
1027
|
+
let order = GROUP_ORDER[workbench];
|
|
1028
|
+
return [...value.entries()].sort(([left], [right]) => {
|
|
1029
|
+
let leftIndex = order.indexOf(left), rightIndex = order.indexOf(right);
|
|
1030
|
+
return (leftIndex < 0 ? order.length : leftIndex) - (rightIndex < 0 ? order.length : rightIndex) || left.localeCompare(right, "zh-Hans-CN");
|
|
1031
|
+
});
|
|
1032
|
+
}, [activityPath, workbench, workspace]), selectWorkbench = (next) => {
|
|
1033
|
+
setWorkbench(next), setConflict(void 0);
|
|
1034
|
+
let target = workspace === void 0 ? void 0 : preferredFile(workspace.files, next);
|
|
1035
|
+
setSelected(target);
|
|
1036
|
+
}, selectedGroup = selected === void 0 ? void 0 : groupForPath(selected), toggleGroup = (key, open) => {
|
|
1037
|
+
setExpanded((current) => ({ ...current, [key]: open }));
|
|
1038
|
+
};
|
|
1039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: surfaceRef, className: "oh-story-split-surface", children: [
|
|
1040
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: plugin_default }),
|
|
1041
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("aside", { className: "oh-story-tree", children: [
|
|
1042
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "oh-story-brand", children: [
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u2726 Oh Story" }),
|
|
1044
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: reload, title: "\u5237\u65B0", children: "\u21BB" })
|
|
1045
|
+
] }),
|
|
1046
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "oh-story-mode-tabs", role: "tablist", "aria-label": "\u521B\u4F5C\u5DE5\u4F5C\u53F0", children: [
|
|
1047
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", role: "tab", "aria-selected": workbench === "story", onClick: () => {
|
|
1048
|
+
selectWorkbench("story");
|
|
1049
|
+
}, children: "\u5C0F\u8BF4" }),
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", role: "tab", "aria-selected": workbench === "drama", onClick: () => {
|
|
1051
|
+
selectWorkbench("drama");
|
|
1052
|
+
}, children: "\u77ED\u5267" })
|
|
1053
|
+
] }),
|
|
1054
|
+
error !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "oh-story-error", children: error }),
|
|
1055
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("nav", { ref: navRef, "aria-label": workbench === "story" ? "\u5C0F\u8BF4\u9879\u76EE\u6587\u4EF6" : "\u77ED\u5267\u9879\u76EE\u6587\u4EF6", children: groups.map(([directory2, files]) => {
|
|
1056
|
+
let groupOpen = expanded[directory2] ?? selectedGroup === directory2;
|
|
1057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("details", { className: "oh-story-file-group", open: groupOpen, onToggle: (event) => {
|
|
1058
|
+
toggleGroup(directory2, event.currentTarget.open);
|
|
1059
|
+
}, children: [
|
|
1060
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("summary", { children: [
|
|
1061
|
+
directory2,
|
|
1062
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: files.length })
|
|
1063
|
+
] }),
|
|
1064
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1065
|
+
FileTreeNodes,
|
|
1066
|
+
{
|
|
1067
|
+
nodes: buildFileTree(files, directory2),
|
|
1068
|
+
depth: 1,
|
|
1069
|
+
expanded,
|
|
1070
|
+
selected,
|
|
1071
|
+
activityPath,
|
|
1072
|
+
onToggle: toggleGroup,
|
|
1073
|
+
onSelect: setSelected
|
|
1074
|
+
}
|
|
1075
|
+
)
|
|
1076
|
+
] }, directory2);
|
|
1077
|
+
}) })
|
|
1078
|
+
] }),
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("main", { className: "oh-story-editor", children: [
|
|
1080
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("header", { children: [
|
|
1081
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { title: selected, children: selected ?? `\u5728\u5F53\u524D DSH workspace \u4E2D\u9009\u62E9${workbench === "story" ? "\u5C0F\u8BF4" : "\u77ED\u5267"}\u6587\u4EF6` }),
|
|
1082
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "oh-story-editor-actions", children: [
|
|
1083
|
+
previewable && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "oh-story-editor-tabs", role: "tablist", "aria-label": markdown ? "Markdown \u67E5\u770B\u65B9\u5F0F" : "JSONL \u67E5\u770B\u65B9\u5F0F", children: [
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", role: "tab", "aria-selected": editorMode === "preview", onClick: () => {
|
|
1085
|
+
setEditorMode("preview");
|
|
1086
|
+
}, children: "\u9884\u89C8" }),
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", role: "tab", "aria-selected": editorMode === "source", onClick: () => {
|
|
1088
|
+
setEditorMode("source");
|
|
1089
|
+
}, children: "\u6E90\u7801" })
|
|
1090
|
+
] }),
|
|
1091
|
+
(dirty || saving) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "oh-story-save", type: "button", disabled: saving, onClick: () => {
|
|
1092
|
+
save();
|
|
1093
|
+
}, children: saving ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58" })
|
|
1094
|
+
] })
|
|
1095
|
+
] }),
|
|
1096
|
+
activityPath === selected && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "oh-story-stream", "data-stage": activity?.stage, children: [
|
|
1097
|
+
"\u25CF ",
|
|
1098
|
+
activity?.stage === "running" ? "Agent \u6B63\u5728\u5E94\u7528\u4FEE\u6539" : "Agent \u6B63\u5728\u751F\u6210\u6587\u4EF6\u5185\u5BB9"
|
|
1099
|
+
] }),
|
|
1100
|
+
conflict !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "oh-story-conflict", children: conflict }),
|
|
1101
|
+
fileError !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "oh-story-error", children: fileError }),
|
|
1102
|
+
selected === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "oh-story-empty", children: workbench === "story" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
1103
|
+
"\u5F53\u524D workspace \u8FD8\u6CA1\u6709\u5C0F\u8BF4\u6587\u4EF6\u3002\u53EF\u5728\u53F3\u4FA7 Chat \u4E2D\u8FD0\u884C ",
|
|
1104
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { children: "/story-setup" }),
|
|
1105
|
+
"\u3002"
|
|
1106
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
1107
|
+
"\u5F53\u524D workspace \u8FD8\u6CA1\u6709\u77ED\u5267\u9879\u76EE\u3002\u53EF\u5728\u53F3\u4FA7 Chat \u4E2D\u8FD0\u884C ",
|
|
1108
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { children: "/short-drama" }),
|
|
1109
|
+
"\u3002"
|
|
1110
|
+
] }) }) : buffer === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "oh-story-empty", children: [
|
|
1111
|
+
"\u6B63\u5728\u52A0\u8F7D ",
|
|
1112
|
+
selected,
|
|
1113
|
+
"\u2026"
|
|
1114
|
+
] }) : previewable && editorMode === "preview" ? markdown ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MarkdownPreview, { content: buffer.content, label: selected }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(JsonlPreview, { content: buffer.content, label: selected }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1115
|
+
"textarea",
|
|
1116
|
+
{
|
|
1117
|
+
value: buffer.content,
|
|
1118
|
+
"data-format": structured ? "structured" : "prose",
|
|
1119
|
+
onChange: (event) => {
|
|
1120
|
+
let content = event.target.value;
|
|
1121
|
+
setBuffers((current) => ({
|
|
1122
|
+
...current,
|
|
1123
|
+
[selected]: {
|
|
1124
|
+
content,
|
|
1125
|
+
saved: current[selected]?.saved ?? "",
|
|
1126
|
+
source: "human",
|
|
1127
|
+
version: current[selected]?.version ?? ""
|
|
1128
|
+
}
|
|
1129
|
+
}));
|
|
1130
|
+
},
|
|
1131
|
+
onKeyDown: (event) => {
|
|
1132
|
+
(event.metaKey || event.ctrlKey) && event.key.toLocaleLowerCase() === "s" && (event.preventDefault(), save());
|
|
1133
|
+
},
|
|
1134
|
+
spellCheck: !structured,
|
|
1135
|
+
"aria-label": selected
|
|
1136
|
+
}
|
|
1137
|
+
)
|
|
1138
|
+
] })
|
|
1139
|
+
] });
|
|
1140
|
+
}
|
|
1141
|
+
function CreativeSplitBridge(props) {
|
|
1142
|
+
let marker = (0, import_react.useRef)(null), [target, setTarget] = (0, import_react.useState)();
|
|
1143
|
+
return (0, import_react.useLayoutEffect)(() => {
|
|
1144
|
+
let anchor = marker.current?.closest("[data-phase]")?.querySelector("[data-conversation-scroll] > [data-slot='conversation.session']");
|
|
1145
|
+
setTarget(anchor ?? void 0);
|
|
1146
|
+
}, [props.sessionId]), (0, import_react.useLayoutEffect)(() => {
|
|
1147
|
+
let scroller = target?.parentElement;
|
|
1148
|
+
if (scroller == null) return;
|
|
1149
|
+
let publishHeight = () => {
|
|
1150
|
+
scroller.style.setProperty("--oh-story-scroll-height", `${String(scroller.clientHeight)}px`);
|
|
1151
|
+
};
|
|
1152
|
+
publishHeight();
|
|
1153
|
+
let observer = new ResizeObserver(publishHeight);
|
|
1154
|
+
return observer.observe(scroller), () => {
|
|
1155
|
+
observer.disconnect(), scroller.style.removeProperty("--oh-story-scroll-height");
|
|
1156
|
+
};
|
|
1157
|
+
}, [target]), /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
1158
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { ref: marker, className: "oh-story-bridge-marker", "aria-hidden": !0 }),
|
|
1159
|
+
target === void 0 ? null : (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CreativeWorkbench, { ...props }, props.sessionId), target)
|
|
1160
|
+
] });
|
|
1161
|
+
}
|
|
1162
|
+
function argsOf(block) {
|
|
1163
|
+
let raw = ("kind" in block ? block.call?.argsRaw : block.argsRaw) ?? "{}";
|
|
1164
|
+
try {
|
|
1165
|
+
let value = JSON.parse(raw);
|
|
1166
|
+
return typeof value == "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
1167
|
+
} catch {
|
|
1168
|
+
return {};
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
function resultOf(block) {
|
|
1172
|
+
if ("kind" in block)
|
|
1173
|
+
return block.content.map((item) => item.type === "text" ? item.text : JSON.stringify(item, null, 2)).join(`
|
|
1174
|
+
`);
|
|
1175
|
+
}
|
|
1176
|
+
function RoleToolView({ block, inspect }) {
|
|
1177
|
+
let args = argsOf(block), role = typeof args.role == "string" ? args.role : "story-role", output = resultOf(block), state = "kind" in block ? block.isError ? "error" : "done" : "running";
|
|
1178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("details", { className: "oh-story-role", "data-state": state, children: [
|
|
1179
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: plugin_default }),
|
|
1180
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("summary", { children: [
|
|
1181
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u2726 Role" }),
|
|
1182
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: role }),
|
|
1183
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("em", { children: state === "running" ? "\u8FD0\u884C\u4E2D" : state === "error" ? "\u5931\u8D25" : "\u5B8C\u6210" })
|
|
1184
|
+
] }),
|
|
1185
|
+
output !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("pre", { children: output }),
|
|
1186
|
+
inspect !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: inspect, children: "\u5728\u8F68\u8FF9\u4E2D\u68C0\u67E5" })
|
|
1187
|
+
] });
|
|
1188
|
+
}
|
|
1189
|
+
function apply(context) {
|
|
1190
|
+
context.slots.inject("conversation.session.header.actions", () => context.slots.register({
|
|
1191
|
+
name: "conversation.session.header.actions",
|
|
1192
|
+
id: "oh-story-workspace",
|
|
1193
|
+
order: -100
|
|
1194
|
+
}, CreativeSplitBridge)), context.slots.inject("tool.call.toolview", () => context.slots.register({
|
|
1195
|
+
name: "tool.call.toolview",
|
|
1196
|
+
key: "oh_story_role"
|
|
1197
|
+
}, RoleToolView));
|
|
1198
|
+
}
|
|
1199
|
+
var index_default = { name, inject, apply };
|
|
1200
|
+
;return module.exports;}});
|
|
1201
|
+
//# sourceMappingURL=client.js.map
|