@runweave/server-linux-x64 0.1.8 → 0.1.10
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/manifest.json +1494 -161
- package/native.tar.gz +0 -0
- package/package.json +1 -1
- package/payload/.agents/plugins/marketplace.json +20 -0
- package/payload/app-server/build-info.json +4 -4
- package/payload/app-server/index.cjs +6 -2
- package/payload/app-server/index.cjs.map +1 -1
- package/payload/backend/activity-sqlite-worker.cjs +2 -0
- package/payload/backend/build-info.json +4 -4
- package/payload/backend/dev-resources/control.cjs +5 -1
- package/payload/backend/index.cjs +466 -295
- package/payload/backend/ios-simulators/pool.py +3 -3
- package/payload/backend/scheduled-tasks-sqlite-worker.cjs +2 -0
- package/payload/frontend/dist/assets/{_baseUniq-vo4uuhMd.js → _baseUniq--CWv8e7O.js} +1 -1
- package/payload/frontend/dist/assets/{access-_jCu7Rgu.js → access-BCF23Qto.js} +1 -1
- package/payload/frontend/dist/assets/{advanced-CqOhObYj.js → advanced-D8viCLue.js} +1 -1
- package/payload/frontend/dist/assets/{appearance-CrrD5gzC.js → appearance-wPVMx-tB.js} +1 -1
- package/payload/frontend/dist/assets/{arc-dbfyHSF0.js → arc-BXffHD7A.js} +1 -1
- package/payload/frontend/dist/assets/{architectureDiagram-Q4EWVU46-CntSCAsO.js → architectureDiagram-Q4EWVU46-BXHN9QCj.js} +1 -1
- package/payload/frontend/dist/assets/{blockDiagram-DXYQGD6D-Chp0D4qy.js → blockDiagram-DXYQGD6D-DoZjab_0.js} +1 -1
- package/payload/frontend/dist/assets/{c4Diagram-AHTNJAMY-CF91pOuW.js → c4Diagram-AHTNJAMY-Ds2E62Z8.js} +1 -1
- package/payload/frontend/dist/assets/channel-83CTXkVl.js +1 -0
- package/payload/frontend/dist/assets/{chunk-4BX2VUAB-B1gxlVu2.js → chunk-4BX2VUAB-Dk1H2-5_.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-4TB4RGXK-Cxt3mj9b.js → chunk-4TB4RGXK-Sg0gzSvg.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-55IACEB6-BJT6qNik.js → chunk-55IACEB6-Du_EJG4S.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-EDXVE4YY-yI59bCa0.js → chunk-EDXVE4YY-BM1Cs5dU.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-FMBD7UC4-CDvncKKJ.js → chunk-FMBD7UC4-BM9thfyY.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-OYMX7WX6-BblOIU57.js → chunk-OYMX7WX6-C9Bvn4fo.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-QZHKN3VN-rODzNdO0.js → chunk-QZHKN3VN-CaakbFhJ.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-YZCP3GAM-B6D4wQwk.js → chunk-YZCP3GAM-DkVNrd40.js} +1 -1
- package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-oR8IYJwC.js +1 -0
- package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-oR8IYJwC.js +1 -0
- package/payload/frontend/dist/assets/clone-BIDF-bd9.js +1 -0
- package/payload/frontend/dist/assets/connection-DIdF_3aa.js +12 -0
- package/payload/frontend/dist/assets/{connections-DqDmxS-O.js → connections-DBYC8SFl.js} +1 -1
- package/payload/frontend/dist/assets/{cose-bilkent-S5V4N54A-BvwVWp29.js → cose-bilkent-S5V4N54A-B4-fwllY.js} +1 -1
- package/payload/frontend/dist/assets/{dagre-KV5264BT-h_K1TH11.js → dagre-KV5264BT-Byu4wqLk.js} +1 -1
- package/payload/frontend/dist/assets/{desktop-BQ3kGtKG.js → desktop-aESkh0HL.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-5BDNPKRD-B8g2SV6L.js → diagram-5BDNPKRD-DJW8DuCX.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-G4DWMVQ6-BOEnrqYm.js → diagram-G4DWMVQ6-DTBvds5J.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-MMDJMWI5-DlaN_z71.js → diagram-MMDJMWI5-D42e4xzm.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-TYMM5635-C_pSKftn.js → diagram-TYMM5635-BjV43-C_.js} +1 -1
- package/payload/frontend/dist/assets/{erDiagram-SMLLAGMA-C2dL-h3I.js → erDiagram-SMLLAGMA-DE47Ibp_.js} +1 -1
- package/payload/frontend/dist/assets/{flowDiagram-DWJPFMVM-BmXhKWFj.js → flowDiagram-DWJPFMVM-CjGBlzS4.js} +1 -1
- package/payload/frontend/dist/assets/{ganttDiagram-T4ZO3ILL-D_Odnssf.js → ganttDiagram-T4ZO3ILL-vfj40KZi.js} +1 -1
- package/payload/frontend/dist/assets/{gitGraphDiagram-UUTBAWPF-DcQdcwKZ.js → gitGraphDiagram-UUTBAWPF-DT5xfRNb.js} +1 -1
- package/payload/frontend/dist/assets/{graph-C_XsxefA.js → graph-D-AF6yQT.js} +1 -1
- package/payload/frontend/dist/assets/{image-D3hgVr8O.js → image-D9gtSsD9.js} +1 -1
- package/payload/frontend/dist/assets/{index-CEUsFFQq.js → index-BPVP2P-2.js} +95 -105
- package/payload/frontend/dist/assets/{infoDiagram-42DDH7IO-C6TnRyMi.js → infoDiagram-42DDH7IO-C7ew_uLJ.js} +1 -1
- package/payload/frontend/dist/assets/{ishikawaDiagram-UXIWVN3A-BL7rfALJ.js → ishikawaDiagram-UXIWVN3A-B6-YebU9.js} +1 -1
- package/payload/frontend/dist/assets/{journeyDiagram-VCZTEJTY-C_6407GW.js → journeyDiagram-VCZTEJTY-BOFgJDA5.js} +1 -1
- package/payload/frontend/dist/assets/{kanban-definition-6JOO6SKY-CK61Fd0p.js → kanban-definition-6JOO6SKY-jh06wZYz.js} +1 -1
- package/payload/frontend/dist/assets/{layout-DVn6JKbl.js → layout-B4p7V5fB.js} +1 -1
- package/payload/frontend/dist/assets/{linear-DyWskq8H.js → linear-D2JWfvdc.js} +1 -1
- package/payload/frontend/dist/assets/main-CuRgiPQf.js +706 -0
- package/payload/frontend/dist/assets/main-D4_uoZQa.css +33 -0
- package/payload/frontend/dist/assets/{min-apbLpSJ3.js → min--jD4Arnm.js} +1 -1
- package/payload/frontend/dist/assets/{mindmap-definition-QFDTVHPH-MVHZZbma.js → mindmap-definition-QFDTVHPH-DmzjmSuf.js} +1 -1
- package/payload/frontend/dist/assets/{monitoring-BApsVez_.js → monitoring-Tvvk6TfB.js} +1 -1
- package/payload/frontend/dist/assets/{notifications-CjxSNLU1.js → notifications-CqP2AQrW.js} +1 -1
- package/payload/frontend/dist/assets/{pieDiagram-DEJITSTG-Dhbb0AYU.js → pieDiagram-DEJITSTG-B79qIVe5.js} +1 -1
- package/payload/frontend/dist/assets/{quadrantDiagram-34T5L4WZ-Yk6LOF0S.js → quadrantDiagram-34T5L4WZ-DIOj1DhE.js} +1 -1
- package/payload/frontend/dist/assets/{record-content-BCJ80KS5.js → record-content-CzGGCbNs.js} +1 -1
- package/payload/frontend/dist/assets/{requirementDiagram-MS252O5E-BUhS0PEq.js → requirementDiagram-MS252O5E-C-n1j3tN.js} +1 -1
- package/payload/frontend/dist/assets/{sankeyDiagram-XADWPNL6-D2sdxz14.js → sankeyDiagram-XADWPNL6-BVKqWE6C.js} +1 -1
- package/payload/frontend/dist/assets/{sequenceDiagram-FGHM5R23-CRere4Fy.js → sequenceDiagram-FGHM5R23-B980Icqs.js} +1 -1
- package/payload/frontend/dist/assets/{stateDiagram-FHFEXIEX-_pk-OMlm.js → stateDiagram-FHFEXIEX-C-mJHzhL.js} +1 -1
- package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-B4L4fK9G.js +1 -0
- package/payload/frontend/dist/assets/{status-Dk5rRVQF.js → status-Bv4Czr9-.js} +1 -1
- package/payload/frontend/dist/assets/suiji-DyzQqRTE.js +1 -0
- package/payload/frontend/dist/assets/{svg-X7YkMMvx.js → svg-C6Aj62ig.js} +1 -1
- package/payload/frontend/dist/assets/{tabs-BmKbcPVh.js → tabs-BTUOhdAF.js} +1 -1
- package/payload/frontend/dist/assets/{timeline-definition-GMOUNBTQ-BPsI2pMC.js → timeline-definition-GMOUNBTQ-Dr9yRuVq.js} +1 -1
- package/payload/frontend/dist/assets/{vennDiagram-DHZGUBPP-BNJkZ1Az.js → vennDiagram-DHZGUBPP-B0Xsg1-Z.js} +1 -1
- package/payload/frontend/dist/assets/{wardley-RL74JXVD-CVcYeATS.js → wardley-RL74JXVD-BjIKKaA_.js} +1 -1
- package/payload/frontend/dist/assets/{wardleyDiagram-NUSXRM2D-BpLJ0alk.js → wardleyDiagram-NUSXRM2D-DMJ7MEA9.js} +1 -1
- package/payload/frontend/dist/assets/{xychartDiagram-5P7HB3ND-BdsYYk4M.js → xychartDiagram-5P7HB3ND-2tvgfdab.js} +1 -1
- package/payload/frontend/dist/build-info.json +4 -4
- package/payload/frontend/dist/companion.html +1 -1
- package/payload/frontend/dist/index.html +3 -3
- package/payload/packages/agent-bridge/src/install-pi.mjs +81 -0
- package/payload/plugins/pi/dist/SKILL.md +22 -0
- package/payload/plugins/pi/dist/bridge/app-server-client.cjs +82 -0
- package/payload/plugins/pi/dist/bridge/feishu_stop_notify.sh +169 -0
- package/payload/plugins/pi/dist/bridge/runweave-hook-bridge.cjs +583 -0
- package/payload/plugins/pi/dist/bridge/runweave-hook-completion.cjs +42 -0
- package/payload/plugins/pi/dist/bridge/runweave-hook-payload.cjs +578 -0
- package/payload/plugins/pi/dist/bridge/runweave-task-supervision.cjs +167 -0
- package/payload/plugins/pi/dist/runweave.js +316 -0
- package/payload/plugins/toolkit/.codex-plugin/plugin.json +31 -0
- package/payload/plugins/toolkit/README.md +185 -0
- package/payload/plugins/toolkit/hooks/AGENTS.md +6 -0
- package/payload/plugins/toolkit/hooks/app-server-client.cjs +82 -0
- package/payload/plugins/toolkit/hooks/feishu_stop_notify.sh +169 -0
- package/payload/plugins/toolkit/hooks/runweave-hook-bridge.cjs +583 -0
- package/payload/plugins/toolkit/hooks/runweave-hook-completion.cjs +42 -0
- package/payload/plugins/toolkit/hooks/runweave-hook-dispatch.cjs +123 -0
- package/payload/plugins/toolkit/hooks/runweave-hook-payload.cjs +578 -0
- package/payload/plugins/toolkit/hooks/runweave-task-supervision.cjs +167 -0
- package/payload/plugins/toolkit/hooks.json +108 -0
- package/payload/plugins/toolkit/skills/acceptance/SKILL.md +70 -0
- package/payload/plugins/toolkit/skills/acceptance/agents/openai.yaml +4 -0
- package/payload/plugins/toolkit/skills/acceptance/references/capture.md +38 -0
- package/payload/plugins/toolkit/skills/acceptance/references/delivery.md +54 -0
- package/payload/plugins/toolkit/skills/acceptance/references/gallery-contract.md +84 -0
- package/payload/plugins/toolkit/skills/acceptance/references/gallery-copy.md +34 -0
- package/payload/plugins/toolkit/skills/acceptance/references/video.md +52 -0
- package/payload/plugins/toolkit/skills/acceptance/scripts/capture.py +137 -0
- package/payload/plugins/toolkit/skills/acceptance/scripts/common.py +63 -0
- package/payload/plugins/toolkit/skills/acceptance/scripts/gallery.py +353 -0
- package/payload/plugins/toolkit/skills/acceptance/scripts/preview.py +109 -0
- package/payload/plugins/toolkit/skills/acceptance/scripts/video.py +283 -0
- package/payload/plugins/toolkit/skills/acceptance/templates/reader.css +576 -0
- package/payload/plugins/toolkit/skills/acceptance/templates/reader.html +63 -0
- package/payload/plugins/toolkit/skills/acceptance/templates/reader.js +326 -0
- package/payload/plugins/toolkit/skills/acceptance/templates/viewer.css +55 -0
- package/payload/plugins/toolkit/skills/acceptance-gallery/SKILL.md +8 -0
- package/payload/plugins/toolkit/skills/acceptance-gallery/agents/openai.yaml +6 -0
- package/payload/plugins/toolkit/skills/acceptance-gallery/references/capture-and-copy.md +3 -0
- package/payload/plugins/toolkit/skills/acceptance-gallery/references/content-contract.md +3 -0
- package/payload/plugins/toolkit/skills/acceptance-gallery/scripts/gallery.py +9 -0
- package/payload/plugins/toolkit/skills/acceptance-video/SKILL.md +8 -0
- package/payload/plugins/toolkit/skills/acceptance-video/agents/openai.yaml +6 -0
- package/payload/plugins/toolkit/skills/acceptance-video/references/input-and-capture.md +3 -0
- package/payload/plugins/toolkit/skills/acceptance-video/references/mobile-review.md +3 -0
- package/payload/plugins/toolkit/skills/acceptance-video/scripts/capture.py +9 -0
- package/payload/plugins/toolkit/skills/acceptance-video/scripts/video.py +9 -0
- package/payload/plugins/toolkit/skills/agent-device/SKILL.md +86 -0
- package/payload/plugins/toolkit/skills/agent-device/agents/openai.yaml +4 -0
- package/payload/plugins/toolkit/skills/agent-device/references/ios-setup.md +36 -0
- package/payload/plugins/toolkit/skills/agent-device/scripts/device.py +398 -0
- package/payload/plugins/toolkit/skills/agent-device/scripts/resources.py +248 -0
- package/payload/plugins/toolkit/skills/architecture-flow-prototyping/SKILL.md +128 -0
- package/payload/plugins/toolkit/skills/architecture-flow-prototyping/agents/openai.yaml +4 -0
- package/payload/plugins/toolkit/skills/architecture-flow-prototyping/references/architecture-flow-checklist.md +59 -0
- package/payload/plugins/toolkit/skills/architecture-flow-prototyping/references/architecture-flow-guide.md +135 -0
- package/payload/plugins/toolkit/skills/architecture-flow-prototyping/references/architecture-flow-handoff-template.md +57 -0
- package/payload/plugins/toolkit/skills/ask-first/SKILL.md +81 -0
- package/payload/plugins/toolkit/skills/brainstorming/SKILL.md +41 -0
- package/payload/plugins/toolkit/skills/browse-record/SKILL.md +35 -0
- package/payload/plugins/toolkit/skills/browse-record/references/app-usage.md +19 -0
- package/payload/plugins/toolkit/skills/browse-record/references/daily-reporting.md +115 -0
- package/payload/plugins/toolkit/skills/browse-record/references/zhihu.md +33 -0
- package/payload/plugins/toolkit/skills/browse-record/scripts/app_usage.py +110 -0
- package/payload/plugins/toolkit/skills/browse-record/scripts/browse_job.py +385 -0
- package/payload/plugins/toolkit/skills/browse-record/scripts/zhihu-read.js +126 -0
- package/payload/plugins/toolkit/skills/browse-record/scripts/zhihu_http.py +273 -0
- package/payload/plugins/toolkit/skills/clear-technical-explanations/LICENSE +21 -0
- package/payload/plugins/toolkit/skills/clear-technical-explanations/SKILL.md +103 -0
- package/payload/plugins/toolkit/skills/code-grounded-requirements/SKILL.md +54 -0
- package/payload/plugins/toolkit/skills/daily-doc-maintenance/SKILL.md +151 -0
- package/payload/plugins/toolkit/skills/daily-record/SKILL.md +63 -0
- package/payload/plugins/toolkit/skills/daily-record/agents/openai.yaml +4 -0
- package/payload/plugins/toolkit/skills/daily-record/references/browser-history.md +6 -0
- package/payload/plugins/toolkit/skills/daily-record/references/feishu.md +90 -0
- package/payload/plugins/toolkit/skills/daily-record/references/scheduled-reporting.md +144 -0
- package/payload/plugins/toolkit/skills/daily-record/references/scheduled-task.template.json +15 -0
- package/payload/plugins/toolkit/skills/daily-record/references/suiji-work-records.md +57 -0
- package/payload/plugins/toolkit/skills/daily-record/scripts/feishu.py +280 -0
- package/payload/plugins/toolkit/skills/daily-record/scripts/job.py +416 -0
- package/payload/plugins/toolkit/skills/daily-record/scripts/job_browser.py +77 -0
- package/payload/plugins/toolkit/skills/daily-record/scripts/job_facts.py +132 -0
- package/payload/plugins/toolkit/skills/daily-record/scripts/job_isolation.py +69 -0
- package/payload/plugins/toolkit/skills/daily-record/scripts/job_materials.py +154 -0
- package/payload/plugins/toolkit/skills/daily-record/scripts/job_screen.py +77 -0
- package/payload/plugins/toolkit/skills/daily-record/scripts/job_state.py +309 -0
- package/payload/plugins/toolkit/skills/daily-refactor/SKILL.md +101 -0
- package/payload/plugins/toolkit/skills/daily-refactor/scripts/compare-architecture-reports.mjs +168 -0
- package/payload/plugins/toolkit/skills/debugging-strategies/SKILL.md +38 -0
- package/payload/plugins/toolkit/skills/debugging-strategies/resources/implementation-playbook.md +520 -0
- package/payload/plugins/toolkit/skills/diagnostic-log-debugging/SKILL.md +79 -0
- package/payload/plugins/toolkit/skills/doc-coauthoring/SKILL.md +64 -0
- package/payload/plugins/toolkit/skills/eli5/LICENSE +21 -0
- package/payload/plugins/toolkit/skills/eli5/SKILL.md +18 -0
- package/payload/plugins/toolkit/skills/experience/SKILL.md +71 -0
- package/payload/plugins/toolkit/skills/experience/package.json +13 -0
- package/payload/plugins/toolkit/skills/git-advanced-workflows/SKILL.md +457 -0
- package/payload/plugins/toolkit/skills/github-pr/SKILL.md +109 -0
- package/payload/plugins/toolkit/skills/github-pr/scripts/github-access.mjs +292 -0
- package/payload/plugins/toolkit/skills/github-pr/scripts/preflight.mjs +191 -0
- package/payload/plugins/toolkit/skills/github-pr/scripts/source-worktree.mjs +354 -0
- package/payload/plugins/toolkit/skills/grill-with-docs/SKILL.md +66 -0
- package/payload/plugins/toolkit/skills/grill-with-docs/agents/openai.yaml +6 -0
- package/payload/plugins/toolkit/skills/grilling/SKILL.md +14 -0
- package/payload/plugins/toolkit/skills/handoff/SKILL.md +98 -0
- package/payload/plugins/toolkit/skills/karpathy-guidelines/SKILL.md +73 -0
- package/payload/plugins/toolkit/skills/playwright-cli/SKILL.md +562 -0
- package/payload/plugins/toolkit/skills/playwright-cli/references/element-attributes.md +23 -0
- package/payload/plugins/toolkit/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/payload/plugins/toolkit/skills/playwright-cli/references/request-mocking.md +87 -0
- package/payload/plugins/toolkit/skills/playwright-cli/references/running-code.md +240 -0
- package/payload/plugins/toolkit/skills/playwright-cli/references/session-management.md +226 -0
- package/payload/plugins/toolkit/skills/playwright-cli/references/spec-driven-testing.md +312 -0
- package/payload/plugins/toolkit/skills/playwright-cli/references/storage-state.md +275 -0
- package/payload/plugins/toolkit/skills/playwright-cli/references/test-generation.md +138 -0
- package/payload/plugins/toolkit/skills/playwright-cli/references/tracing.md +142 -0
- package/payload/plugins/toolkit/skills/playwright-cli/references/video-recording.md +157 -0
- package/payload/plugins/toolkit/skills/playwright-cli/templates/standalone.config.json +7 -0
- package/payload/plugins/toolkit/skills/product-exploration/SKILL.md +64 -0
- package/payload/plugins/toolkit/skills/product-exploration/agents/openai.yaml +5 -0
- package/payload/plugins/toolkit/skills/prototype-first-development/SKILL.md +134 -0
- package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/README.md +88 -0
- package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/app.js +145 -0
- package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/index.html +229 -0
- package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/mock-state.json +60 -0
- package/payload/plugins/toolkit/skills/prototype-first-development/references/implementation-plan-handoff-template.md +61 -0
- package/payload/plugins/toolkit/skills/prototype-first-development/references/prototype-workflow-checklist.md +64 -0
- package/payload/plugins/toolkit/skills/publish-runweave-server/SKILL.md +69 -0
- package/payload/plugins/toolkit/skills/publish-runweave-server/agents/openai.yaml +4 -0
- package/payload/plugins/toolkit/skills/react-best-practices/AGENTS.md +3227 -0
- package/payload/plugins/toolkit/skills/react-best-practices/README.md +127 -0
- package/payload/plugins/toolkit/skills/react-best-practices/SKILL.md +143 -0
- package/payload/plugins/toolkit/skills/react-best-practices/metadata.json +15 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/advanced/event-handler-refs.md +55 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/advanced/init-once.md +42 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/advanced/use-latest.md +39 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/async/api-routes.md +38 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/async/defer-await.md +80 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/async/dependencies.md +52 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/async/parallel.md +28 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/async/suspense-boundaries.md +99 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/barrel-imports.md +59 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/conditional.md +37 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/defer-third-party.md +49 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/dynamic-imports.md +35 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/preload.md +46 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/client/event-listeners.md +78 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/client/localstorage-schema.md +77 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/client/passive-event-listeners.md +48 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/client/swr-dedup.md +56 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/batch-dom-css.md +110 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/cache-function-results.md +80 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/cache-property-access.md +28 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/cache-storage.md +70 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/combine-iterations.md +32 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/early-exit.md +50 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/flatmap-filter.md +55 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/hoist-regexp.md +45 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/index-maps.md +37 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/length-check-first.md +50 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/min-max-loop.md +82 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/set-map-lookups.md +24 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/js/tosorted-immutable.md +57 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/meta/sections.md +46 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/meta/template.md +28 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/activity.md +26 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/animate-svg-wrapper.md +38 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/conditional-render.md +32 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/content-visibility.md +38 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/hoist-jsx.md +36 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/hydration-no-flicker.md +72 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/hydration-suppress-warning.md +26 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/resource-hints.md +89 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/script-defer-async.md +71 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/svg-precision.md +28 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/usetransition-loading.md +75 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/defer-reads.md +39 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/dependencies.md +45 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/derived-state-no-effect.md +40 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/derived-state.md +29 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/functional-setstate.md +77 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/lazy-state-init.md +58 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/memo-with-default-value.md +36 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/memo.md +44 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/move-effect-to-event.md +45 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/no-inline-components.md +83 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/simple-expression-in-memo.md +35 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/transitions.md +40 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/use-ref-transient-values.md +73 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/server/after-nonblocking.md +74 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/server/auth-actions.md +96 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/server/cache-lru.md +41 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/server/cache-react.md +76 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/server/dedup-props.md +65 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/server/hoist-static-io.md +139 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/server/parallel-fetching.md +83 -0
- package/payload/plugins/toolkit/skills/react-best-practices/rules/server/serialization.md +38 -0
- package/payload/plugins/toolkit/skills/recorded-browser-mcp-verification/SKILL.md +8 -0
- package/payload/plugins/toolkit/skills/recorded-browser-mcp-verification/agents/openai.yaml +6 -0
- package/payload/plugins/toolkit/skills/reproduce-before-fix/SKILL.md +93 -0
- package/payload/plugins/toolkit/skills/reproduce-before-fix/agents/openai.yaml +7 -0
- package/payload/plugins/toolkit/skills/review-only/SKILL.md +72 -0
- package/payload/plugins/toolkit/skills/review-with-runtime-evidence/SKILL.md +134 -0
- package/payload/plugins/toolkit/skills/review-with-runtime-evidence/agents/openai.yaml +7 -0
- package/payload/plugins/toolkit/skills/review-with-runtime-evidence/references/contracts.md +114 -0
- package/payload/plugins/toolkit/skills/review-with-runtime-evidence/scripts/classify-runtime-verdict.mjs +140 -0
- package/payload/plugins/toolkit/skills/review-with-runtime-evidence/scripts/run-static-review.mjs +389 -0
- package/payload/plugins/toolkit/skills/review-with-runtime-evidence/scripts/static-review-contract.mjs +243 -0
- package/payload/plugins/toolkit/skills/run-test-cases/SKILL.md +63 -0
- package/payload/plugins/toolkit/skills/runweave-change-validation/SKILL.md +196 -0
- package/payload/plugins/toolkit/skills/runweave-change-validation/agents/openai.yaml +7 -0
- package/payload/plugins/toolkit/skills/runweave-change-validation/scripts/assert-dev-session-status.mjs +181 -0
- package/payload/plugins/toolkit/skills/runweave-dev-session/SKILL.md +126 -0
- package/payload/plugins/toolkit/skills/runweave-dev-session/agents/openai.yaml +7 -0
- package/payload/plugins/toolkit/skills/runweave-management/SKILL.md +47 -0
- package/payload/plugins/toolkit/skills/scheduled-task/SKILL.md +35 -0
- package/payload/plugins/toolkit/skills/shadcn/SKILL.md +245 -0
- package/payload/plugins/toolkit/skills/shadcn/agents/openai.yml +5 -0
- package/payload/plugins/toolkit/skills/shadcn/assets/shadcn-small.png +0 -0
- package/payload/plugins/toolkit/skills/shadcn/assets/shadcn.png +0 -0
- package/payload/plugins/toolkit/skills/shadcn/cli.md +276 -0
- package/payload/plugins/toolkit/skills/shadcn/customization.md +209 -0
- package/payload/plugins/toolkit/skills/shadcn/evals/evals.json +47 -0
- package/payload/plugins/toolkit/skills/shadcn/mcp.md +94 -0
- package/payload/plugins/toolkit/skills/shadcn/rules/base-vs-radix.md +310 -0
- package/payload/plugins/toolkit/skills/shadcn/rules/composition.md +197 -0
- package/payload/plugins/toolkit/skills/shadcn/rules/forms.md +198 -0
- package/payload/plugins/toolkit/skills/shadcn/rules/icons.md +101 -0
- package/payload/plugins/toolkit/skills/shadcn/rules/styling.md +163 -0
- package/payload/plugins/toolkit/skills/suiji/SKILL.md +54 -0
- package/payload/plugins/toolkit/skills/suiji/references/api.md +72 -0
- package/payload/plugins/toolkit/skills/suiji/references/source-adapter.md +40 -0
- package/payload/plugins/toolkit/skills/suiji/references/work-records.md +36 -0
- package/payload/plugins/toolkit/skills/suiji/scripts/source_adapter.py +46 -0
- package/payload/plugins/toolkit/skills/suiji/scripts/suiji.py +358 -0
- package/payload/plugins/toolkit/skills/suiji/scripts/work_records.py +328 -0
- package/payload/plugins/toolkit/skills/suiji/scripts/work_reports.py +75 -0
- package/payload/plugins/toolkit/skills/sync-branch-hard-reset/SKILL.md +59 -0
- package/payload/plugins/toolkit/skills/update-runweave-backend/SKILL.md +90 -0
- package/payload/plugins/toolkit/skills/update-runweave-backend/agents/openai.yaml +4 -0
- package/payload/plugins/toolkit/skills/update-runweave-backend/references/npm-update.md +68 -0
- package/payload/plugins/toolkit/skills/update-runweave-backend/references/systemd.md +34 -0
- package/payload/plugins/toolkit/skills/update-runweave-desktop/SKILL.md +102 -0
- package/payload/plugins/toolkit/skills/update-runweave-ios/SKILL.md +16 -0
- package/payload/plugins/toolkit/skills/update-runweave-ios/references/ios-wireless-recovery.md +54 -0
- package/payload/plugins/toolkit/skills/using-rw/SKILL.md +265 -0
- package/payload/plugins/toolkit/skills/write-plan/SKILL.md +72 -0
- package/payload/plugins/toolkit/skills/write-test-cases/SKILL.md +100 -0
- package/payload/plugins/toolkit/skills/write-test-cases/assets/test-plan-template.yaml +15 -0
- package/payload/plugins/toolkit/skills/write-test-cases/references/coverage-checklist.md +75 -0
- package/payload/plugins/toolkit/skills/write-test-cases/references/design-techniques.md +91 -0
- package/payload/plugins/toolkit/skills/youtube-reading/SKILL.md +35 -0
- package/payload/plugins/toolkit/skills/youtube-reading/agents/openai.yaml +4 -0
- package/payload/plugins/toolkit/skills/youtube-reading/assets/runtime-lock.json +92 -0
- package/payload/plugins/toolkit/skills/youtube-reading/references/content-contract.md +52 -0
- package/payload/plugins/toolkit/skills/youtube-reading/references/setup.md +70 -0
- package/payload/plugins/toolkit/skills/youtube-reading/requirements.lock +9 -0
- package/payload/plugins/toolkit/skills/youtube-reading/scripts/artifacts.py +206 -0
- package/payload/plugins/toolkit/skills/youtube-reading/scripts/runtime.py +424 -0
- package/payload/plugins/toolkit/skills/youtube-reading/scripts/youtube_reading.py +314 -0
- package/payload/plugins/toolkit-release.json +1 -0
- package/payload/pty-host/index.cjs +99 -31
- package/payload/scripts/toolkit/codex-state.mjs +75 -0
- package/payload/scripts/toolkit/release.mjs +210 -0
- package/payload/scripts/toolkit/sync-runtime.mjs +108 -0
- package/payload/scripts/toolkit/sync.mjs +585 -0
- package/payload/server/index.cjs +5 -1
- package/payload/frontend/dist/assets/channel-Bf3IeONI.js +0 -1
- package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-CFsG2SvG.js +0 -1
- package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-CFsG2SvG.js +0 -1
- package/payload/frontend/dist/assets/clone-CeQXm2YN.js +0 -1
- package/payload/frontend/dist/assets/connection-XriXysSc.js +0 -12
- package/payload/frontend/dist/assets/main-Cg6Oo1xK.css +0 -33
- package/payload/frontend/dist/assets/main-H5R-3_w1.js +0 -696
- package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-CzpdUl_0.js +0 -1
- package/payload/frontend/dist/assets/suiji-CO_L5W1X.js +0 -1
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""YouTube source preparation; the calling Agent performs review and translation."""
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import re
|
|
7
|
+
import sys
|
|
8
|
+
import time
|
|
9
|
+
from urllib.parse import parse_qs, urlparse
|
|
10
|
+
|
|
11
|
+
sys.dont_write_bytecode = True
|
|
12
|
+
|
|
13
|
+
import artifacts as a
|
|
14
|
+
import runtime as r
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def normalize_url(url):
|
|
18
|
+
try:
|
|
19
|
+
p = urlparse(url)
|
|
20
|
+
port = p.port
|
|
21
|
+
except ValueError as e:
|
|
22
|
+
raise a.JobError('INVALID_URL', '无效的视频链接。') from e
|
|
23
|
+
if (p.scheme not in {'https', 'http'} or p.hostname not in
|
|
24
|
+
{'youtube.com', 'www.youtube.com', 'm.youtube.com', 'youtu.be', 'www.youtu.be'} or
|
|
25
|
+
p.username or p.password or port not in {None, 443, 80} or
|
|
26
|
+
re.search(r'[\s<>"\x27;|\\]', url)):
|
|
27
|
+
raise a.JobError('INVALID_URL', '仅支持 YouTube 单视频链接。')
|
|
28
|
+
if p.hostname.endswith('youtu.be'):
|
|
29
|
+
video_id = p.path.lstrip('/')
|
|
30
|
+
elif p.path == '/watch':
|
|
31
|
+
video_id = parse_qs(p.query).get('v', [''])[0]
|
|
32
|
+
elif p.path.startswith('/shorts/'):
|
|
33
|
+
video_id = p.path[len('/shorts/'):]
|
|
34
|
+
else:
|
|
35
|
+
video_id = ''
|
|
36
|
+
if not re.fullmatch(r'[A-Za-z0-9_-]{11}', video_id):
|
|
37
|
+
raise a.JobError('INVALID_URL', '链接缺少有效 video ID;频道与纯播放列表不受支持。')
|
|
38
|
+
return video_id, 'https://www.youtube.com/watch?v=' + video_id
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def save(work, manifest):
|
|
42
|
+
manifest['updated_at'] = a.now()
|
|
43
|
+
a.write_json(work / 'manifest.json', manifest)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def status(job, manifest, cache_hit=False):
|
|
47
|
+
return {'status': manifest['stage'], 'job_dir': str(job), 'manifest': str(job / '.work/manifest.json'),
|
|
48
|
+
'cache_hit': cache_hit, 'acquired_at': manifest.get('acquired_at'),
|
|
49
|
+
'next': 'review chunks, write review.json and guide.txt, then finalize' if manifest['stage'] == 'awaiting_ai' else None,
|
|
50
|
+
'reading': str(job / 'reading.md') if manifest['stage'] == 'complete' else None,
|
|
51
|
+
'quality_hints': manifest.get('quality_hints', [])}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def require_runtime(root):
|
|
55
|
+
result = r.doctor(root)
|
|
56
|
+
if not result['ok']:
|
|
57
|
+
raise a.JobError('RUNTIME_INVALID', '; '.join(result['issues']))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def material_identity():
|
|
61
|
+
return a.identity({'runtime_lock': r.LOCK, 'material_version': 4})
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def prepare(url, output_root, runtime_root, timeout_seconds=None, adapter=None):
|
|
65
|
+
video_id, canonical = normalize_url(url)
|
|
66
|
+
runtime_root = Path(runtime_root).expanduser().resolve()
|
|
67
|
+
job = Path(output_root).expanduser().resolve() / video_id
|
|
68
|
+
work = job / '.work'
|
|
69
|
+
with a.job_lock(work):
|
|
70
|
+
manifest_path = work / 'manifest.json'
|
|
71
|
+
manifest = a.read_json(manifest_path) if manifest_path.exists() else {
|
|
72
|
+
'schema_version': 1, 'video_id': video_id, 'canonical_url': canonical,
|
|
73
|
+
'original_url': url, 'stage': 'acquiring', 'created_at': a.now(),
|
|
74
|
+
'quality_hints': [], 'completed_blocks': [], 'timings': {}}
|
|
75
|
+
manifest['runtime_root'] = str(Path(runtime_root).expanduser().resolve())
|
|
76
|
+
manifest['timeout_seconds'] = timeout_seconds
|
|
77
|
+
save(work, manifest)
|
|
78
|
+
try:
|
|
79
|
+
require_runtime(runtime_root)
|
|
80
|
+
source_path = work / 'source.json'
|
|
81
|
+
current_material = material_identity()
|
|
82
|
+
materials_valid = all(not manifest.get(key) or (path.exists() and a.digest(path) == manifest[key])
|
|
83
|
+
for key, path in [('metadata_sha256', work / 'metadata.json'),
|
|
84
|
+
('captions_sha256', work / 'captions.raw.json'),
|
|
85
|
+
('audio_sha256', Path(manifest.get('audio_path') or work / 'missing-audio'))])
|
|
86
|
+
incomplete = any(h.startswith('INCOMPLETE_GAP_CHECK:') for h in manifest['quality_hints'])
|
|
87
|
+
source_valid = (not incomplete and materials_valid and source_path.exists() and manifest.get('source_sha256') == a.digest(source_path)
|
|
88
|
+
and manifest.get('material_identity') == current_material)
|
|
89
|
+
if source_valid:
|
|
90
|
+
a.validate_source(a.read_json(source_path))
|
|
91
|
+
same_review = manifest.get('prompt_version') == a.PROMPT_VERSION and manifest.get('contract_version') == a.CONTRACT_VERSION
|
|
92
|
+
complete = (manifest['stage'] == 'complete' and same_review and (job / 'reading.md').exists()
|
|
93
|
+
and manifest.get('reading_sha256') == a.digest(job / 'reading.md'))
|
|
94
|
+
manifest.update(stage='complete' if complete else 'awaiting_ai', prompt_version=a.PROMPT_VERSION,
|
|
95
|
+
contract_version=a.CONTRACT_VERSION)
|
|
96
|
+
manifest['chunks'] = a.chunk_source(source_path, work)
|
|
97
|
+
manifest['last_cache_hit_at'] = a.now()
|
|
98
|
+
manifest.pop('error', None)
|
|
99
|
+
manifest.pop('resume_from', None)
|
|
100
|
+
save(work, manifest)
|
|
101
|
+
return status(job, manifest, True)
|
|
102
|
+
manifest['stage'] = 'acquiring'
|
|
103
|
+
manifest['quality_hints'] = []
|
|
104
|
+
save(work, manifest)
|
|
105
|
+
adapter = adapter or r.NetworkAdapter(runtime_root, work)
|
|
106
|
+
info_path = work / 'metadata.json'
|
|
107
|
+
acquired_start = time.monotonic()
|
|
108
|
+
if info_path.exists() and manifest.get('metadata_sha256') == a.digest(info_path):
|
|
109
|
+
info = a.read_json(info_path)
|
|
110
|
+
else:
|
|
111
|
+
info = r.acquire_metadata(canonical, adapter)
|
|
112
|
+
if info.get('is_live') or not info.get('duration'):
|
|
113
|
+
raise a.JobError('UNSUPPORTED_VIDEO', '不支持直播或时长未知的视频。')
|
|
114
|
+
a.write_json(info_path, info)
|
|
115
|
+
manifest['metadata_sha256'] = a.digest(info_path)
|
|
116
|
+
manifest['acquired_at'] = a.now()
|
|
117
|
+
language = info.get('language')
|
|
118
|
+
if not language:
|
|
119
|
+
# yt-dlp marks the original auto-caption language with an -orig track.
|
|
120
|
+
original = [k[:-5] for k in info.get('automatic_captions', {}) if k.endswith('-orig')]
|
|
121
|
+
language = original[0] if len(original) == 1 else None
|
|
122
|
+
manifest.update(title=info.get('title') or video_id, channel=info.get('channel') or info.get('uploader'),
|
|
123
|
+
duration_ms=round(info['duration']*1000), source_language=language,
|
|
124
|
+
tool_model_lock=r.LOCK, material_identity=current_material)
|
|
125
|
+
save(work, manifest)
|
|
126
|
+
captions_path = work / 'captions.raw.json'
|
|
127
|
+
if captions_path.exists() and manifest.get('captions_sha256') == a.digest(captions_path):
|
|
128
|
+
captions = a.read_json(captions_path)
|
|
129
|
+
else:
|
|
130
|
+
try:
|
|
131
|
+
captions = adapter.transcripts(video_id, language)
|
|
132
|
+
except Exception as e:
|
|
133
|
+
captions = {'tracks': [], 'segments': [], 'language': language, 'source_kind': None,
|
|
134
|
+
'error': type(e).__name__}
|
|
135
|
+
manifest['quality_hints'].append('CAPTIONS_UNAVAILABLE: ' + type(e).__name__)
|
|
136
|
+
a.write_json(captions_path, captions)
|
|
137
|
+
manifest['captions_sha256'] = a.digest(captions_path)
|
|
138
|
+
save(work, manifest)
|
|
139
|
+
if captions.get('error'):
|
|
140
|
+
manifest['quality_hints'].append('CAPTIONS_UNAVAILABLE: ' + captions['error'])
|
|
141
|
+
segments = []
|
|
142
|
+
for x in captions['segments']:
|
|
143
|
+
text = x['text'].strip()
|
|
144
|
+
if text and x['duration'] > 0:
|
|
145
|
+
segments.append({'start_ms': round(x['start']*1000),
|
|
146
|
+
'end_ms': min(manifest['duration_ms'], round((x['start']+x['duration'])*1000)),
|
|
147
|
+
'text': text, 'language': captions['language'], 'source_kind': captions['source_kind']})
|
|
148
|
+
segments = sorted([x for x in segments if x['end_ms'] > x['start_ms']], key=lambda x: x['start_ms'])
|
|
149
|
+
if segments and (sum(len(x['text']) for x in segments)/max(1, info['duration']) > 80 or
|
|
150
|
+
any('\ufffd' in x['text'] for x in segments)):
|
|
151
|
+
manifest['quality_hints'].append('CAPTIONS_DISTORTED')
|
|
152
|
+
segments = []
|
|
153
|
+
gaps = r.caption_gaps(segments, manifest['duration_ms'])
|
|
154
|
+
if gaps or not segments:
|
|
155
|
+
audio_path = Path(manifest['audio_path']) if manifest.get('audio_path') else None
|
|
156
|
+
try:
|
|
157
|
+
if not audio_path or not audio_path.exists() or a.digest(audio_path) != manifest.get('audio_sha256'):
|
|
158
|
+
audio_path = adapter.audio(canonical)
|
|
159
|
+
manifest.update(audio_path=str(audio_path), audio_sha256=a.digest(audio_path))
|
|
160
|
+
save(work, manifest)
|
|
161
|
+
wav = r.convert_audio(audio_path, work)
|
|
162
|
+
manifest['wav_sha256'] = a.digest(wav)
|
|
163
|
+
except Exception as e:
|
|
164
|
+
if not segments:
|
|
165
|
+
raise a.JobError('AUDIO_ACQUISITION_FAILED', '音频获取失败:' + type(e).__name__) from e
|
|
166
|
+
manifest['quality_hints'].append('INCOMPLETE_GAP_CHECK: ' + type(e).__name__)
|
|
167
|
+
wav = None
|
|
168
|
+
manifest['timings']['acquisition_seconds'] = round(time.monotonic()-acquired_start, 3)
|
|
169
|
+
if wav:
|
|
170
|
+
manifest['stage'] = 'transcribing'
|
|
171
|
+
save(work, manifest)
|
|
172
|
+
def checkpoint(block, hit):
|
|
173
|
+
row = {k: v for k, v in block.items() if k not in {'segments', 'boundary_candidates'}}
|
|
174
|
+
row['cache_hit'] = hit
|
|
175
|
+
manifest['completed_blocks'] = [b for b in manifest['completed_blocks']
|
|
176
|
+
if (b['key'], b['core_start_ms']) != (row['key'], row['core_start_ms'])] + [row]
|
|
177
|
+
save(work, manifest)
|
|
178
|
+
print(json.dumps({'stage': 'transcribing', 'core_end_ms': row['core_end_ms'], 'cache_hit': hit}), file=sys.stderr, flush=True)
|
|
179
|
+
options = {'runtime_root': runtime_root, 'language': (language or 'auto').split('-')[0],
|
|
180
|
+
'timeout_seconds': timeout_seconds, 'on_chunk': checkpoint}
|
|
181
|
+
started = time.monotonic()
|
|
182
|
+
segments = (r.fill_gaps(segments, wav, work, options) if segments else
|
|
183
|
+
r.transcribe_audio(wav, work / 'asr', options))
|
|
184
|
+
manifest['timings']['asr_seconds'] = round(time.monotonic()-started, 3)
|
|
185
|
+
for i, s in enumerate(segments):
|
|
186
|
+
s['id'] = f's{i:06d}'
|
|
187
|
+
source = {'schema_version': 1, 'segments': segments}
|
|
188
|
+
a.validate_source(source)
|
|
189
|
+
a.write_json(source_path, source)
|
|
190
|
+
manifest.update(source_sha256=a.digest(source_path), stage='awaiting_ai',
|
|
191
|
+
prompt_version=a.PROMPT_VERSION, contract_version=a.CONTRACT_VERSION)
|
|
192
|
+
manifest['chunks'] = a.chunk_source(source_path, work)
|
|
193
|
+
manifest['quality_hints'] = sorted(set(manifest['quality_hints']))
|
|
194
|
+
manifest.pop('error', None)
|
|
195
|
+
manifest.pop('resume_from', None)
|
|
196
|
+
save(work, manifest)
|
|
197
|
+
return status(job, manifest)
|
|
198
|
+
except Exception as e:
|
|
199
|
+
manifest.update(resume_from=manifest['stage'], stage='failed',
|
|
200
|
+
error={'code': getattr(e, 'code', 'PROCESS_ERROR'), 'message': str(e)})
|
|
201
|
+
save(work, manifest)
|
|
202
|
+
raise
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def retranscribe(job, start_ms, end_ms):
|
|
206
|
+
work = job / '.work'
|
|
207
|
+
with a.job_lock(work):
|
|
208
|
+
manifest = a.read_json(work / 'manifest.json')
|
|
209
|
+
require_runtime(manifest['runtime_root'])
|
|
210
|
+
wav = work / 'audio.wav'
|
|
211
|
+
if not wav.exists() or a.digest(wav) != manifest.get('wav_sha256'):
|
|
212
|
+
raise a.JobError('AUDIO_MISSING', '重识别需要当前任务经过校验的音频。')
|
|
213
|
+
duration = r.audio_duration(wav)
|
|
214
|
+
if not 0 <= start_ms < end_ms <= duration or end_ms-start_ms > 50000:
|
|
215
|
+
raise a.JobError('RETRY_RANGE', '异常核心区间最多 50 秒;加前后 5 秒后最多 60 秒。')
|
|
216
|
+
start, end = max(0, start_ms-5000), min(duration, end_ms+5000)
|
|
217
|
+
record_id = f'retry-{start}-{end}'
|
|
218
|
+
path = work / 'retranscriptions' / (record_id + '.json')
|
|
219
|
+
if path.exists():
|
|
220
|
+
old = a.read_json(path)
|
|
221
|
+
if old.get('source_sha256') == manifest['source_sha256'] and old.get('audio_sha256') == manifest['wav_sha256']:
|
|
222
|
+
return {'status': 'candidate', 'path': str(path), 'cache_hit': True}
|
|
223
|
+
rows = r.transcribe_audio(wav, work / 'retranscriptions/audio',
|
|
224
|
+
{'runtime_root': manifest['runtime_root'], 'language': (manifest.get('source_language') or 'auto').split('-')[0],
|
|
225
|
+
'start_ms': start, 'end_ms': end, 'vad': False, 'context_ms': 0,
|
|
226
|
+
'timeout_seconds': manifest.get('timeout_seconds')})
|
|
227
|
+
a.write_json(path, {'schema_version': 1, 'id': record_id, 'start_ms': start, 'end_ms': end,
|
|
228
|
+
'source_sha256': manifest['source_sha256'], 'audio_sha256': manifest['wav_sha256'],
|
|
229
|
+
'segments': rows, 'created_at': a.now()})
|
|
230
|
+
return {'status': 'candidate', 'path': str(path), 'cache_hit': False}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def finalize(job, review_path, guide_path):
|
|
234
|
+
work = job / '.work'
|
|
235
|
+
with a.job_lock(work):
|
|
236
|
+
manifest = a.read_json(work / 'manifest.json')
|
|
237
|
+
source_path = work / 'source.json'
|
|
238
|
+
if manifest.get('material_identity') and manifest['material_identity'] != material_identity():
|
|
239
|
+
raise a.JobError('SOURCE_VERSION', '材料处理版本已变化,请先 resume 再校对。')
|
|
240
|
+
if a.digest(source_path) != manifest.get('source_sha256'):
|
|
241
|
+
raise a.JobError('SOURCE_CHANGED', '来源已变化,请 resume 后重新校对。')
|
|
242
|
+
source, review = a.read_json(source_path), a.read_json(review_path)
|
|
243
|
+
guide = Path(guide_path).read_text(encoding='utf-8')
|
|
244
|
+
changes = a.validate_review(source, review, manifest, work)
|
|
245
|
+
article = a.render(manifest, source, review, guide)
|
|
246
|
+
# Validate everything before touching an earlier successful deliverable.
|
|
247
|
+
manifest['stage'] = 'finalizing'
|
|
248
|
+
save(work, manifest)
|
|
249
|
+
try:
|
|
250
|
+
a.write_json(work / 'review.json', review)
|
|
251
|
+
a.atomic_write(work / 'guide.txt', guide)
|
|
252
|
+
a.write_json(work / 'review-changes.json', changes)
|
|
253
|
+
a.atomic_write(job / 'reading.md', article)
|
|
254
|
+
manifest.update(stage='complete', reading_sha256=a.digest(job / 'reading.md'), completed_at=a.now(),
|
|
255
|
+
prompt_version=a.PROMPT_VERSION, contract_version=a.CONTRACT_VERSION,
|
|
256
|
+
needs_review=bool(manifest.get('quality_hints')) or any(x['action'] == 'uncertain' for x in review['segments']))
|
|
257
|
+
manifest.pop('error', None)
|
|
258
|
+
manifest.pop('resume_from', None)
|
|
259
|
+
save(work, manifest)
|
|
260
|
+
return status(job, manifest)
|
|
261
|
+
except OSError as e:
|
|
262
|
+
manifest.update(stage='failed', resume_from='finalizing',
|
|
263
|
+
error={'code': 'FINALIZE_WRITE_FAILED', 'message': str(e)})
|
|
264
|
+
save(work, manifest)
|
|
265
|
+
raise a.JobError('FINALIZE_WRITE_FAILED', str(e)) from e
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def main():
|
|
269
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
270
|
+
sub = parser.add_subparsers(dest='command', required=True)
|
|
271
|
+
for name in ('doctor', 'setup', 'prepare'):
|
|
272
|
+
p = sub.add_parser(name)
|
|
273
|
+
p.add_argument('--runtime-root', type=Path, default=r.DEFAULT_ROOT)
|
|
274
|
+
if name == 'prepare':
|
|
275
|
+
p.add_argument('--url', required=True)
|
|
276
|
+
p.add_argument('--output-root', type=Path, default=Path.home() / 'Documents/YouTube阅读稿')
|
|
277
|
+
p.add_argument('--asr-timeout-seconds', type=float)
|
|
278
|
+
for name in ('resume', 'retranscribe', 'finalize'):
|
|
279
|
+
p = sub.add_parser(name)
|
|
280
|
+
p.add_argument('--job-dir', type=Path, required=True)
|
|
281
|
+
if name == 'retranscribe':
|
|
282
|
+
p.add_argument('--start-ms', type=int, required=True)
|
|
283
|
+
p.add_argument('--end-ms', type=int, required=True)
|
|
284
|
+
if name == 'finalize':
|
|
285
|
+
p.add_argument('--review', type=Path, required=True)
|
|
286
|
+
p.add_argument('--guide', type=Path, required=True)
|
|
287
|
+
args = parser.parse_args()
|
|
288
|
+
try:
|
|
289
|
+
if args.command == 'doctor':
|
|
290
|
+
result = r.doctor(args.runtime_root.expanduser().resolve())
|
|
291
|
+
print(json.dumps(result, ensure_ascii=False))
|
|
292
|
+
return 0 if result['ok'] else 1
|
|
293
|
+
if args.command == 'setup':
|
|
294
|
+
result = r.setup(args.runtime_root)
|
|
295
|
+
elif args.command == 'prepare':
|
|
296
|
+
result = prepare(args.url, args.output_root, args.runtime_root, args.asr_timeout_seconds)
|
|
297
|
+
else:
|
|
298
|
+
job = args.job_dir.expanduser().resolve()
|
|
299
|
+
if args.command == 'resume':
|
|
300
|
+
manifest = a.read_json(job / '.work/manifest.json')
|
|
301
|
+
result = prepare(manifest['canonical_url'], job.parent, manifest['runtime_root'], manifest.get('timeout_seconds'))
|
|
302
|
+
elif args.command == 'retranscribe':
|
|
303
|
+
result = retranscribe(job, args.start_ms, args.end_ms)
|
|
304
|
+
else:
|
|
305
|
+
result = finalize(job, args.review, args.guide)
|
|
306
|
+
print(json.dumps(result, ensure_ascii=False))
|
|
307
|
+
return 0
|
|
308
|
+
except (a.JobError, OSError, ValueError, KeyError, TypeError) as e:
|
|
309
|
+
print(json.dumps({'status': 'failed', 'error_code': getattr(e, 'code', 'INVALID_ARTIFACT'), 'message': str(e)}, ensure_ascii=False))
|
|
310
|
+
return 1
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
if __name__ == '__main__':
|
|
314
|
+
sys.exit(main())
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"0.2.0+codex.93e270581a3a47cddffbf5d5aba197b5b8ca33c78a0f1e3e3e8b7e3326f2bea6","digest":"93e270581a3a47cddffbf5d5aba197b5b8ca33c78a0f1e3e3e8b7e3326f2bea6"}
|
|
@@ -14763,6 +14763,8 @@ var CONFIGURATION_FIELDS = [
|
|
|
14763
14763
|
{ "path": "agents.companion.binary", "type": "string", "domain": "agents.companion", "sensitive": false, "remote": false, "apply": "restart", "description": "\u4F34\u968F\u7A97\u53E3 Agent \u53EF\u6267\u884C\u6587\u4EF6", "environmentKeys": ["RUNWEAVE_COMPANION_AGENT_EXECUTABLE"], "owner": "electron/companion", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u4F7F\u7528\u5DF2\u5B89\u88C5 Codex App \u81EA\u5E26\u6267\u884C\u5165\u53E3\uFF1B\u663E\u5F0F\u503C\u5FC5\u987B\u53EF\u6267\u884C\u3002" }, "migrationSources": ["RUNWEAVE_COMPANION_AGENT_EXECUTABLE"] },
|
|
14764
14764
|
{ "path": "agents.codex.sessionsDirectory", "type": "string", "domain": "agents.codex", "sensitive": false, "remote": false, "apply": "restart", "description": "\u5916\u90E8 Codex \u4F1A\u8BDD\u76EE\u5F55\u5F15\u7528", "environmentKeys": ["RUNWEAVE_CODEX_SESSIONS_DIR"], "owner": "backend+app-server", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u5916\u90E8\u5DE5\u5177\u62E5\u6709\u7684 CODEX_HOME/sessions \u6216\u64CD\u4F5C\u7CFB\u7EDF\u7528\u6237\u76EE\u5F55\u4E0B .codex/sessions\uFF0C\u4EC5\u5F15\u7528\u3002" }, "migrationSources": ["RUNWEAVE_CODEX_SESSIONS_DIR"] },
|
|
14765
14765
|
{ "path": "agents.traex.sessionsDirectory", "type": "string", "domain": "agents.traex", "sensitive": false, "remote": false, "apply": "restart", "description": "\u5916\u90E8 Trae \u4F1A\u8BDD\u76EE\u5F55\u5F15\u7528", "environmentKeys": ["RUNWEAVE_TRAE_SESSIONS_DIR"], "owner": "backend+app-server", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u64CD\u4F5C\u7CFB\u7EDF\u7528\u6237\u76EE\u5F55\u4E0B .trae/cli/sessions\uFF0C\u4EC5\u5F15\u7528\u3002" }, "migrationSources": ["RUNWEAVE_TRAE_SESSIONS_DIR"] },
|
|
14766
|
+
{ "path": "terminal.defaultShell.command", "type": "string", "domain": "terminal.defaultShell", "sensitive": false, "remote": false, "apply": "reload", "description": "\u5F53\u524D\u7535\u8111\u65B0\u7EC8\u7AEF\u7684\u9ED8\u8BA4\u53EF\u6267\u884C\u6587\u4EF6\uFF1B\u7F3A\u7701\u4F7F\u7528\u7CFB\u7EDF Shell\uFF0C\u542F\u52A8\u4E0D\u53EF\u7528\u65F6\u56DE\u9000\u7CFB\u7EDF\u9ED8\u8BA4", "environmentKeys": [], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u7CFB\u7EDF\u8D26\u6237\u767B\u5F55 Shell\uFF1BWindows \u4F7F\u7528 ComSpec\uFF1B\u4E0D\u53EF\u7528\u65F6\u91C7\u7528\u5E73\u53F0\u515C\u5E95" }, "migrationSources": ["new-field:no-legacy-source"] },
|
|
14767
|
+
{ "path": "terminal.defaultShell.args", "type": "array<string>", "domain": "terminal.defaultShell", "sensitive": false, "remote": false, "apply": "reload", "description": "\u9ED8\u8BA4 Shell \u7684\u542F\u52A8\u53C2\u6570\uFF1B\u7A7A\u6570\u7EC4\u660E\u786E\u4E0D\u52A0\u53C2\u6570\uFF0C\u7F3A\u7701\u4FDD\u7559 bash/zsh \u7684 -l \u884C\u4E3A", "environmentKeys": [], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u6839\u636E\u6240\u9009\u7A0B\u5E8F\u89E3\u6790\uFF1Bbash/zsh \u4E3A [-l]\uFF0C\u5176\u4ED6\u4E3A\u7A7A\u6570\u7EC4" }, "migrationSources": ["new-field:no-legacy-source"] },
|
|
14766
14768
|
{ "path": "terminal.tmux.enabled", "type": "boolean", "domain": "terminal", "sensitive": false, "remote": false, "apply": "restart", "description": "tmux \u6301\u4E45\u7EC8\u7AEF\u5F00\u5173", "environmentKeys": ["TERMINAL_TMUX_ENABLED"], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "value": true }, "migrationSources": ["TERMINAL_TMUX_ENABLED"] },
|
|
14767
14769
|
{ "path": "terminal.tmux.binary", "type": "string", "domain": "terminal", "sensitive": false, "remote": false, "apply": "restart", "description": "tmux \u53EF\u6267\u884C\u6587\u4EF6", "environmentKeys": ["TMUX_BINARY"], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "value": "tmux" }, "migrationSources": ["TMUX_BINARY"] },
|
|
14768
14770
|
{ "path": "terminal.tmux.shutdownPolicy", "type": "string", "domain": "terminal", "sensitive": false, "remote": false, "apply": "restart", "description": "\u9000\u51FA\u65F6 tmux \u4FDD\u7559\u7B56\u7565", "environmentKeys": ["TERMINAL_TMUX_SHUTDOWN_POLICY"], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "Stable \u4E3A preserve\uFF0CDev \u4E3A cleanup\u3002" }, "migrationSources": ["TERMINAL_TMUX_SHUTDOWN_POLICY"] },
|
|
@@ -19237,12 +19239,28 @@ var import_node_crypto6 = require("node:crypto");
|
|
|
19237
19239
|
var import_node_module = require("node:module");
|
|
19238
19240
|
var import_node_url = require("node:url");
|
|
19239
19241
|
|
|
19242
|
+
// packages/shared/src/terminal/shell.ts
|
|
19243
|
+
function terminalShellName(command) {
|
|
19244
|
+
return (command.split(/[\\/]/).at(-1) ?? command).toLowerCase().replace(/\.exe$/, "");
|
|
19245
|
+
}
|
|
19246
|
+
function isInteractiveShellLaunch(launch2) {
|
|
19247
|
+
const name = terminalShellName(launch2.command);
|
|
19248
|
+
if (!["sh", "bash", "zsh", "dash", "ksh", "fish", "powershell", "pwsh", "cmd"].includes(name)) return false;
|
|
19249
|
+
return !(launch2.args ?? []).some((arg) => {
|
|
19250
|
+
const value = arg.toLowerCase();
|
|
19251
|
+
if (name === "cmd") return !/^\/(?:d|q|a|u|e:(?:on|off)|f:(?:on|off)|v:(?:on|off))$/.test(value);
|
|
19252
|
+
if (name === "powershell" || name === "pwsh") return !["-nologo", "-noprofile", "-noexit", "-login", "-l"].includes(value);
|
|
19253
|
+
return ["--help", "--version"].includes(value) || !value.startsWith("-") || value === "--" || /^-[^-]*[cs]/.test(value) || /^--(?:command|init-command)(?:=|$)/.test(value);
|
|
19254
|
+
});
|
|
19255
|
+
}
|
|
19256
|
+
|
|
19240
19257
|
// packages/pty-host/src/input-operations.ts
|
|
19241
19258
|
var import_node_crypto4 = require("node:crypto");
|
|
19242
19259
|
var InputOperations = class {
|
|
19243
|
-
constructor(write, isRunning) {
|
|
19260
|
+
constructor(write, isRunning, generation = () => 0) {
|
|
19244
19261
|
this.write = write;
|
|
19245
19262
|
this.isRunning = isRunning;
|
|
19263
|
+
this.generation = generation;
|
|
19246
19264
|
}
|
|
19247
19265
|
operations = /* @__PURE__ */ new Map();
|
|
19248
19266
|
sequences = /* @__PURE__ */ new Map();
|
|
@@ -19297,13 +19315,16 @@ var InputOperations = class {
|
|
|
19297
19315
|
};
|
|
19298
19316
|
this.operations.set(input.operationId, operation);
|
|
19299
19317
|
this.sequences.set(input.sequence, input.operationId);
|
|
19318
|
+
const acceptedGeneration = this.generation();
|
|
19300
19319
|
operation.done = this.tail.then(async () => {
|
|
19301
19320
|
try {
|
|
19302
19321
|
for (const step of input.steps) {
|
|
19322
|
+
if (acceptedGeneration !== this.generation()) throw new Error("HOST_PROCESS_CHANGED");
|
|
19303
19323
|
if (!this.isRunning()) throw new Error("HOST_SESSION_GONE");
|
|
19304
19324
|
if (step.type === "text") this.write(step.data);
|
|
19305
19325
|
else await new Promise((resolve) => setTimeout(resolve, step.ms));
|
|
19306
19326
|
}
|
|
19327
|
+
if (acceptedGeneration !== this.generation()) throw new Error("HOST_PROCESS_CHANGED");
|
|
19307
19328
|
operation.result.state = "written";
|
|
19308
19329
|
} catch (error) {
|
|
19309
19330
|
operation.result.state = "failed";
|
|
@@ -19744,17 +19765,9 @@ var TerminalOutputScreen = class _TerminalOutputScreen {
|
|
|
19744
19765
|
// packages/pty-host/src/sessions.ts
|
|
19745
19766
|
var requireNative = (0, import_node_module.createRequire)((0, import_node_url.fileURLToPath)(__IMPORT_META_URL__));
|
|
19746
19767
|
var HostSession = class {
|
|
19747
|
-
info;
|
|
19748
|
-
buffer = new TerminalOutputRecoveryBuffer();
|
|
19749
|
-
screen;
|
|
19750
|
-
inputs;
|
|
19751
|
-
createDigest;
|
|
19752
|
-
outputListeners = /* @__PURE__ */ new Set();
|
|
19753
|
-
exitListeners = /* @__PURE__ */ new Set();
|
|
19754
|
-
resizeListeners = /* @__PURE__ */ new Set();
|
|
19755
|
-
degraded = false;
|
|
19756
|
-
terminal;
|
|
19757
19768
|
constructor(hostInstanceId, options, prepareEnv) {
|
|
19769
|
+
this.options = options;
|
|
19770
|
+
this.prepareEnv = prepareEnv;
|
|
19758
19771
|
this.createDigest = (0, import_node_crypto6.createHash)("sha256").update(JSON.stringify(options)).digest("hex");
|
|
19759
19772
|
this.info = {
|
|
19760
19773
|
hostInstanceId,
|
|
@@ -19772,28 +19785,75 @@ var HostSession = class {
|
|
|
19772
19785
|
this.degraded = true;
|
|
19773
19786
|
});
|
|
19774
19787
|
this.screen.resize(options.cols, options.rows);
|
|
19775
|
-
|
|
19788
|
+
this.inputs = new InputOperations((data) => this.terminal.write(data), () => this.info.status === "running", () => this.processGeneration);
|
|
19776
19789
|
try {
|
|
19777
|
-
this.
|
|
19778
|
-
name: "xterm-256color",
|
|
19779
|
-
cols: options.cols,
|
|
19780
|
-
rows: options.rows,
|
|
19781
|
-
cwd: options.cwd,
|
|
19782
|
-
env: { ...options.env, ...prepareEnv(this.info.gatewayToken, this.info.terminalSessionId) }
|
|
19783
|
-
});
|
|
19790
|
+
this.spawn(options);
|
|
19784
19791
|
} catch (error) {
|
|
19785
|
-
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
|
|
19789
|
-
|
|
19790
|
-
this.info.pid = this.terminal.pid;
|
|
19791
|
-
for (const frame of this.buffer.append(data)) {
|
|
19792
|
-
if (!this.degraded) this.screen.append(frame);
|
|
19793
|
-
for (const listener of this.outputListeners) listener(frame);
|
|
19792
|
+
try {
|
|
19793
|
+
if (!this.activateFallback(String(error))) throw error;
|
|
19794
|
+
} catch (fallbackError) {
|
|
19795
|
+
this.screen.dispose();
|
|
19796
|
+
throw fallbackError;
|
|
19794
19797
|
}
|
|
19798
|
+
}
|
|
19799
|
+
}
|
|
19800
|
+
info;
|
|
19801
|
+
buffer = new TerminalOutputRecoveryBuffer();
|
|
19802
|
+
screen;
|
|
19803
|
+
inputs;
|
|
19804
|
+
createDigest;
|
|
19805
|
+
outputListeners = /* @__PURE__ */ new Set();
|
|
19806
|
+
exitListeners = /* @__PURE__ */ new Set();
|
|
19807
|
+
resizeListeners = /* @__PURE__ */ new Set();
|
|
19808
|
+
launchListeners = /* @__PURE__ */ new Set();
|
|
19809
|
+
degraded = false;
|
|
19810
|
+
terminal;
|
|
19811
|
+
fallbackActivated = false;
|
|
19812
|
+
closing = false;
|
|
19813
|
+
processGeneration = 0;
|
|
19814
|
+
startupDeadline = 0;
|
|
19815
|
+
emitOutput(data) {
|
|
19816
|
+
for (const frame of this.buffer.append(data)) {
|
|
19817
|
+
if (!this.degraded) this.screen.append(frame);
|
|
19818
|
+
for (const listener of this.outputListeners) listener(frame);
|
|
19819
|
+
}
|
|
19820
|
+
}
|
|
19821
|
+
activateFallback(reason) {
|
|
19822
|
+
if (!this.options.fallback || this.fallbackActivated || this.closing || !isInteractiveShellLaunch(this.options)) return false;
|
|
19823
|
+
this.fallbackActivated = true;
|
|
19824
|
+
this.emitOutput("[Runweave: shell failed to start; using system default: " + this.options.fallback.command + "]\r\n");
|
|
19825
|
+
this.spawn(this.options.fallback, reason);
|
|
19826
|
+
return true;
|
|
19827
|
+
}
|
|
19828
|
+
spawn(launch2, fallbackReason) {
|
|
19829
|
+
const pty = requireNative("node-pty");
|
|
19830
|
+
const started = Date.now();
|
|
19831
|
+
const terminal = pty.spawn(launch2.command, launch2.args, {
|
|
19832
|
+
name: "xterm-256color",
|
|
19833
|
+
cols: this.info.cols,
|
|
19834
|
+
rows: this.info.rows,
|
|
19835
|
+
cwd: this.options.cwd,
|
|
19836
|
+
env: { ...launch2.env, ...this.prepareEnv(this.info.gatewayToken, this.info.terminalSessionId) }
|
|
19795
19837
|
});
|
|
19796
|
-
this.
|
|
19838
|
+
this.startupDeadline = this.options.fallback && isInteractiveShellLaunch(this.options) ? Date.now() + 1e3 : 0;
|
|
19839
|
+
this.processGeneration++;
|
|
19840
|
+
this.terminal = terminal;
|
|
19841
|
+
this.info.pid = terminal.pid;
|
|
19842
|
+
this.info.launch = { command: launch2.command, args: [...launch2.args], ...fallbackReason ? { fallbackReason } : {} };
|
|
19843
|
+
for (const listener of this.launchListeners) listener(this.info.launch);
|
|
19844
|
+
terminal.onData((data) => {
|
|
19845
|
+
if (this.terminal === terminal) this.emitOutput(data);
|
|
19846
|
+
});
|
|
19847
|
+
terminal.onExit((event) => {
|
|
19848
|
+
if (this.terminal !== terminal) return;
|
|
19849
|
+
if (event.exitCode > 0 && Date.now() - started < 1e3) {
|
|
19850
|
+
try {
|
|
19851
|
+
if (this.activateFallback(`Shell exited with code ${event.exitCode}`)) return;
|
|
19852
|
+
} catch (error) {
|
|
19853
|
+
this.emitOutput(`[Runweave: system shell failed to start: ${String(error)}]\r
|
|
19854
|
+
`);
|
|
19855
|
+
}
|
|
19856
|
+
}
|
|
19797
19857
|
this.info.status = "exited";
|
|
19798
19858
|
this.info.exitCode = event.exitCode;
|
|
19799
19859
|
for (const listener of this.exitListeners) listener(event.exitCode);
|
|
@@ -19801,7 +19861,7 @@ var HostSession = class {
|
|
|
19801
19861
|
}
|
|
19802
19862
|
async ready() {
|
|
19803
19863
|
const deadline = Date.now() + 1e4;
|
|
19804
|
-
while (this.terminal.pid < 1 && this.info.status === "running" && Date.now() < deadline)
|
|
19864
|
+
while ((this.terminal.pid < 1 || Date.now() < this.startupDeadline) && this.info.status === "running" && Date.now() < deadline)
|
|
19805
19865
|
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
19806
19866
|
this.info.pid = this.terminal.pid;
|
|
19807
19867
|
if (this.info.pid < 1) {
|
|
@@ -19828,6 +19888,7 @@ var HostSession = class {
|
|
|
19828
19888
|
}
|
|
19829
19889
|
signal(signal) {
|
|
19830
19890
|
if (!["SIGINT", "SIGTERM", "SIGKILL"].includes(signal)) throw new Error("HOST_SIGNAL_INVALID");
|
|
19891
|
+
this.closing = true;
|
|
19831
19892
|
if (process.platform === "win32") {
|
|
19832
19893
|
if (signal === "SIGINT") this.terminal.write("");
|
|
19833
19894
|
else this.close();
|
|
@@ -19835,6 +19896,7 @@ var HostSession = class {
|
|
|
19835
19896
|
}
|
|
19836
19897
|
close() {
|
|
19837
19898
|
if (this.info.status !== "running") return;
|
|
19899
|
+
this.closing = true;
|
|
19838
19900
|
this.terminal.kill();
|
|
19839
19901
|
}
|
|
19840
19902
|
snapshot() {
|
|
@@ -19891,7 +19953,8 @@ var createSchema = external_exports.object({
|
|
|
19891
19953
|
cwd: external_exports.string().min(1),
|
|
19892
19954
|
cols: external_exports.number().int().min(2).max(500),
|
|
19893
19955
|
rows: external_exports.number().int().min(1).max(200),
|
|
19894
|
-
env: external_exports.record(external_exports.string().optional())
|
|
19956
|
+
env: external_exports.record(external_exports.string().optional()),
|
|
19957
|
+
fallback: external_exports.object({ command: external_exports.string().min(1).max(32768), args: external_exports.array(external_exports.string()).max(256), env: external_exports.record(external_exports.string().optional()) }).optional()
|
|
19895
19958
|
});
|
|
19896
19959
|
var wireSchema = external_exports.object({ requestId: external_exports.string().uuid(), token: external_exports.string(), hostInstanceId: external_exports.string().uuid(), action: external_exports.string(), body: external_exports.unknown() });
|
|
19897
19960
|
async function startHost(scope, release) {
|
|
@@ -20061,10 +20124,15 @@ async function startHost(scope, release) {
|
|
|
20061
20124
|
const resized = (cols, rows) => {
|
|
20062
20125
|
if (ready) sendJson(socket, { type: "resize", terminalSessionId: session.info.terminalSessionId, cols, rows, cursor: session.buffer.cursor });
|
|
20063
20126
|
};
|
|
20127
|
+
const launched = (launch2) => {
|
|
20128
|
+
if (ready) sendJson(socket, { type: "launch", terminalSessionId: session.info.terminalSessionId, launch: launch2 });
|
|
20129
|
+
};
|
|
20130
|
+
session.launchListeners.add(launched);
|
|
20064
20131
|
session.outputListeners.add(output);
|
|
20065
20132
|
session.exitListeners.add(exited);
|
|
20066
20133
|
session.resizeListeners.add(resized);
|
|
20067
20134
|
subscriptions.set(session.info.terminalSessionId, () => {
|
|
20135
|
+
session.launchListeners.delete(launched);
|
|
20068
20136
|
session.outputListeners.delete(output);
|
|
20069
20137
|
session.exitListeners.delete(exited);
|
|
20070
20138
|
session.resizeListeners.delete(resized);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { commandExists, runResult } from "./sync-runtime.mjs";
|
|
4
|
+
import { packageMatches } from "./release.mjs";
|
|
5
|
+
|
|
6
|
+
export function codexReleaseInstalled(release, { marketplaceName, pluginName, publishRoot, cacheRoot }) {
|
|
7
|
+
if (!commandExists("codex")) return false;
|
|
8
|
+
const result = runResult("codex", [
|
|
9
|
+
"plugin",
|
|
10
|
+
"list",
|
|
11
|
+
"--marketplace",
|
|
12
|
+
marketplaceName,
|
|
13
|
+
"--json",
|
|
14
|
+
]);
|
|
15
|
+
if (result.status !== 0) return false;
|
|
16
|
+
const installed = JSON.parse(result.stdout).installed?.find(
|
|
17
|
+
(plugin) => plugin.pluginId === `${pluginName}@${marketplaceName}`,
|
|
18
|
+
);
|
|
19
|
+
return (
|
|
20
|
+
installed?.version === release.version &&
|
|
21
|
+
sameDirectory(installed?.marketplaceSource?.source, publishRoot) &&
|
|
22
|
+
packageMatches(
|
|
23
|
+
path.join(
|
|
24
|
+
cacheRoot,
|
|
25
|
+
release.version,
|
|
26
|
+
),
|
|
27
|
+
release.files,
|
|
28
|
+
)
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function sameDirectory(left, right) {
|
|
33
|
+
return typeof left === "string" && (
|
|
34
|
+
left === right || existsSync(left) && existsSync(right) && realpathSync(left) === realpathSync(right)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function collectSessionReferencedCodexVersions(pluginName, marketplaceName, codexHome) {
|
|
39
|
+
if (!commandExists("rg")) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const sessionsDir = path.join(codexHome, "sessions");
|
|
44
|
+
if (!existsSync(sessionsDir)) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const pattern = [
|
|
49
|
+
"plugins/cache",
|
|
50
|
+
marketplaceName,
|
|
51
|
+
pluginName,
|
|
52
|
+
"[0-9]+\\.[0-9]+\\.[0-9]+\\+codex\\.[a-f0-9]+",
|
|
53
|
+
].join("/");
|
|
54
|
+
const result = runResult(
|
|
55
|
+
"rg",
|
|
56
|
+
[
|
|
57
|
+
"--only-matching",
|
|
58
|
+
"--no-filename",
|
|
59
|
+
"--color",
|
|
60
|
+
"never",
|
|
61
|
+
pattern,
|
|
62
|
+
sessionsDir,
|
|
63
|
+
],
|
|
64
|
+
{ quiet: true },
|
|
65
|
+
);
|
|
66
|
+
if (result.status !== 0 && result.status !== 1) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const versionPattern = /[0-9]+\.[0-9]+\.[0-9]+\+codex\.[a-f0-9]+/g;
|
|
71
|
+
return Array.from(
|
|
72
|
+
new Set(`${result.stdout || ""}`.match(versionPattern) ?? []),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|