allyhub 0.15.3 → 0.16.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/CHANGELOG.md +9 -0
- package/dist/commands/add.js +1 -1
- package/dist/commands/cloud-tools.js +1 -1
- package/dist/commands/dev.js +5 -5
- package/dist/commands/doctor.js +3 -3
- package/dist/commands/frames/doc.js +1 -1
- package/dist/commands/inspect/common.js +3 -3
- package/dist/commands/inspect/facts.js +2 -2
- package/dist/commands/inspect/layout.js +1 -1
- package/dist/commands/mail.js +6 -6
- package/dist/commands/render.js +1 -1
- package/dist/main.js +8 -8
- package/dist/node_modules/@allyhub/3d-extension/dist/cli/scenery-text.js +2 -2
- package/dist/node_modules/@allyhub/3d-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/browser/package.json +1 -1
- package/dist/node_modules/@allyhub/build/dist/file-check.d.ts +2 -2
- package/dist/node_modules/@allyhub/build/dist/index.d.ts +1 -1
- package/dist/node_modules/@allyhub/build/dist/inspect-view.d.ts +1 -1
- package/dist/node_modules/@allyhub/build/dist/inspect-view.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/prepare.js +3 -3
- package/dist/node_modules/@allyhub/build/dist/work.d.ts +9 -1
- package/dist/node_modules/@allyhub/build/dist/work.js +3 -3
- package/dist/node_modules/@allyhub/build/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-extension/skills/allyhub/references/canvas.md +2 -2
- package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/check/package.json +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/blobs.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/client.d.ts +12 -3
- package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/index.d.ts +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/cloud/package.json +1 -1
- package/dist/node_modules/@allyhub/components/package.json +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/deletion.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/inputs.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/project.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/record.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/writer.js +3 -2
- package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/doc/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
- package/dist/node_modules/@allyhub/export/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/website.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/items.d.ts +30 -4
- package/dist/node_modules/@allyhub/formats/dist/items.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/layout.d.ts +15 -4
- package/dist/node_modules/@allyhub/formats/dist/layout.js +1 -1
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/i18n/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/i18n/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/workspace.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/image-extension/skills/allyhub/references/images.md +3 -3
- package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
- package/dist/node_modules/@allyhub/image-render/package.json +1 -1
- package/dist/node_modules/@allyhub/image-runtime/dist/load.js +2 -2
- package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/jobs/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-extension/skills/allyhub/references/linkedin.md +1 -1
- package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
- package/dist/node_modules/@allyhub/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/media/package.json +1 -1
- package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/LICENSE +241 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/data/leads.csv +5 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/markup.json +19 -0
- package/dist/node_modules/@allyhub/office-extension/markup/document/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/document/briefs/launch.docx +0 -0
- package/dist/node_modules/@allyhub/office-extension/markup/document/markup.json +11 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/decks/pitch.pptx +0 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/markup.json +11 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/data/plans.xlsx +0 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/markup.json +10 -0
- package/dist/node_modules/@allyhub/office-extension/package.json +124 -0
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/dist/source.d.ts +2 -0
- package/dist/node_modules/@allyhub/piece/dist/source.js +1 -1
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/dist/part-keys.js +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +10 -5
- package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +7 -0
- package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/blobs.d.ts +9 -0
- package/dist/node_modules/@allyhub/protocol/dist/blobs.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cli.d.ts +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud-computer.d.ts +77 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud-computer.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +39 -9
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +15 -15
- package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +441 -5
- package/dist/node_modules/@allyhub/protocol/dist/events.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/files.d.ts +2 -2
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +8 -0
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +5 -5
- package/dist/node_modules/@allyhub/protocol/dist/kinds.d.ts +15 -0
- package/dist/node_modules/@allyhub/protocol/dist/kinds.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/paywall.d.ts +134 -0
- package/dist/node_modules/@allyhub/protocol/dist/paywall.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/place.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/presence.d.ts +3 -3
- package/dist/node_modules/@allyhub/protocol/dist/purposes.d.ts +47 -0
- package/dist/node_modules/@allyhub/protocol/dist/purposes.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/shares.d.ts +52 -5
- package/dist/node_modules/@allyhub/protocol/dist/shares.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/sidebar-deletion.d.ts +34 -0
- package/dist/node_modules/@allyhub/protocol/dist/sidebar-deletion.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/sites.d.ts +1 -0
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +21 -52
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/studio-server.d.ts +264 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-server.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-tool-calls.d.ts +18 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-tool-calls.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-window-requests.d.ts +97 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-window-requests.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/teams.d.ts +3 -2
- package/dist/node_modules/@allyhub/protocol/dist/teams.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +20 -20
- package/dist/node_modules/@allyhub/protocol/dist/turns.d.ts +71 -0
- package/dist/node_modules/@allyhub/protocol/dist/turns.js +2 -0
- package/dist/node_modules/@allyhub/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub/registry/package.json +1 -1
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scaffold/dist/index.js +4 -4
- package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/cli/sheet.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/package.json +3 -3
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/cli/slides.js +2 -2
- package/dist/node_modules/@allyhub/slides-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/audio-icon.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/package.json +5 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/draw.js +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/slide-css.js +20 -0
- package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/stage/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/runtime/stage.html +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/runtime/stage.js +2 -2
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/dist/runtime.js +15 -15
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/telemetry/dist/doc.js +17 -2
- package/dist/node_modules/@allyhub/telemetry/dist/level.js +2 -2
- package/dist/node_modules/@allyhub/telemetry/dist/levels.js +2 -0
- package/dist/node_modules/@allyhub/telemetry/dist/scrub.js +1 -1
- package/dist/node_modules/@allyhub/telemetry/package.json +5 -1
- package/dist/node_modules/@allyhub/text-extension/markup/markup.json +1 -1
- package/dist/node_modules/@allyhub/text-extension/markup-file/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/text-extension/markup-file/archive/assets.zip +0 -0
- package/dist/node_modules/@allyhub/text-extension/markup-file/markup.json +10 -0
- package/dist/node_modules/@allyhub/text-extension/package.json +35 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/cli/reference-text.js +3 -3
- package/dist/node_modules/@allyhub/video-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/website/package.json +1 -1
- package/dist/node_modules/@allyhub/website-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/x-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/x-extension/skills/allyhub/references/x.md +1 -1
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +13 -12
- package/dist/project.js +1 -1
- package/dist/telemetry.js +3 -3
- package/dist/text/console-text.js +2 -2
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-arPHIJYC.js → abnfDiagram-WEYOIA3C-B1AxOB-Y.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-XPJlj9Iq.js → architecture-WOLXFQ4H-C-7xKJ2Z.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-BZNJvOtd.js → architectureDiagram-ZHVYKT53-CyWb8_iD.js} +1 -1
- package/editor-web/assets/arrow-down-B8VUPCGi.js +1 -0
- package/editor-web/assets/arrow-up-Ds4juY8X.js +1 -0
- package/editor-web/assets/{article-Ck2ii-gZ.js → article-CTKW7Eo0.js} +2 -2
- package/editor-web/assets/article-qt4W_BKH.js +3 -0
- package/editor-web/assets/{audio-lines-1s1eRs4Q.js → audio-lines-PZj77e7t.js} +1 -1
- package/editor-web/assets/{bar-button-6Perrucg.js → bar-button-J9vbfzTx.js} +1 -1
- package/editor-web/assets/{blockDiagram-RJAE7QA3-B4L2P9Zz.js → blockDiagram-RJAE7QA3-uii4-7Ix.js} +4 -4
- package/editor-web/assets/browser-C1XuTMlp.js +1 -0
- package/editor-web/assets/{c4Diagram-XDPPPE54-D5t2-Sm8.js → c4Diagram-XDPPPE54-BtL5Z-wF.js} +1 -1
- package/editor-web/assets/channel-dEO-yacZ.js +1 -0
- package/editor-web/assets/chart-amT4lgX3.js +2 -0
- package/editor-web/assets/chart-file-HE-uXGmJ.js +1 -0
- package/editor-web/assets/{chart-no-axes-column-CJmeYOSo.js → chart-no-axes-column-Be0lFcGF.js} +1 -1
- package/editor-web/assets/{chunk-2E7WHVMD-bWUHKM6h.js → chunk-2E7WHVMD-BJjuZYBs.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-CGGaxE7r.js → chunk-4EMNKR2T-nzPdUHaI.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-BXCHI3wC.js → chunk-55XCU76K-CH52E3Nl.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-H4tWSKhS.js → chunk-7S6XSTFO-Ba4LNKCV.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-kyBZy8vG.js → chunk-AQDTSKZB-Co9SmoqD.js} +1 -1
- package/editor-web/assets/chunk-DSNLSHJZ-BHRvxRGi.js +127 -0
- package/editor-web/assets/{chunk-HAGFOTED-P8dIUq9O.js → chunk-HAGFOTED-F5Wd8ETY.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-B_BAZXMj.js → chunk-HNE4Q36P-C_E0__p9.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-Bubl63jI.js → chunk-NQOKRVIF-BvrtbbWm.js} +17 -17
- package/editor-web/assets/{chunk-UHW7PFBP-DYGk0ZDz.js → chunk-UHW7PFBP-D0HTPXRF.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-BLFRyEGi.js → chunk-VQ5W62QI-B9hF2YMk.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-kiwalF_c.js → chunk-WQQL4CDK-D7N3o-Ub.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-D-bT0L2N.js → chunk-YZO67HFG-XaLSrI_W.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-C_P5nPKV.js → chunk-ZAUX2LTX-sXc6qmw-.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-Deizt1PO.js → chunk-ZCHMQSOR-B0X6sNMX.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-PUtBnliw.js → classDiagram-v2-4MYWR3UA-CjXVvOUp.js} +7 -7
- package/editor-web/assets/code-CD-CbJG9.js +1 -0
- package/editor-web/assets/{collaborator--S95EupA.js → collaborator-BU4qU7O3.js} +1 -1
- package/editor-web/assets/{copy-DvOiv9Ra.js → copy-CuJSs0nI.js} +1 -1
- package/editor-web/assets/{createLucideIcon-REX213UO.js → createLucideIcon-lm_6n8YT.js} +1 -1
- package/editor-web/assets/csv-Bwre9FdI.js +11 -0
- package/editor-web/assets/{cynefin-EF2NZ3EQ-C09G_QFD.js → cynefin-EF2NZ3EQ-PQ9VyM9v.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-JxxJ5-Ov.js → cynefinDiagram-WF24UDRP-KXuXFAhX.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-6DkhWeGP.js → dagre-NK4GIZVX-CBTyfYD5.js} +1 -1
- package/editor-web/assets/deck-C-p17098.js +1 -0
- package/editor-web/assets/{diagram-CBK3MWTC-kI_Q07du.js → diagram-CBK3MWTC-CsVO64Bf.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-FYaR41qP.js → diagram-I5XIIV2D-fzbUm1St.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-29WBGOdl.js → diagram-ODIL2UCW-up6ihgN5.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-BFZJ9s9P.js → diagram-PFBEJUXE-T6hVBoCD.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-BSNFe4e-.js → diagram-RJA3I4VV-BDntFeuR.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-Cb1wZgqj.js → diagram-TYUNFSNR-Dv1-mqbf.js} +16 -16
- package/editor-web/assets/dist-B-lYrbqX.js +43 -0
- package/editor-web/assets/dist-B94TkgAP.js +18 -0
- package/editor-web/assets/dist-BW8IR8bR.js +17 -0
- package/editor-web/assets/dist-Ba5Kv4A-.js +4 -0
- package/editor-web/assets/{dist-BrGYx10E.js → dist-Bd8IxQPP.js} +1 -1
- package/editor-web/assets/dist-Bfs4cZI_.js +24 -0
- package/editor-web/assets/dist-C66KgS8g.js +19 -0
- package/editor-web/assets/dist-CBeeIAlh.js +1 -0
- package/editor-web/assets/{dist-DXUMNYNX.js → dist-CHKVUdcE.js} +4 -4
- package/editor-web/assets/dist-CWXGbcPB.js +3 -0
- package/editor-web/assets/{dist-BaCVkpwc.js → dist-D3C6FyrO.js} +1 -1
- package/editor-web/assets/{dist-BuG-vxxb.js → dist-DhMagA-B.js} +3 -3
- package/editor-web/assets/{dist-BlqK1Oua.js → dist-DruvDNQe.js} +1 -1
- package/editor-web/assets/dist-DxcrMrCR.js +6 -0
- package/editor-web/assets/dist-DzjSp2i2.js +17 -0
- package/editor-web/assets/{dist-CnbKC_fW.js → dist-_ooK0TT9.js} +1 -1
- package/editor-web/assets/dist-aTV6Rwon.js +530 -0
- package/editor-web/assets/dist-mrWPE-br.js +1 -0
- package/editor-web/assets/docx-draw-CeiLkccT.js +4 -0
- package/editor-web/assets/docx-preview-pcg9ioe3.js +21 -0
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-t3vO5qHB.js → ebnfDiagram-V4P3TTPT-CZzljBYN.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-DfIcGBDb.js → elk-QONTBCTQ-6vNb82av.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-Bgy1PYQf.js → erDiagram-KYQIGQAA-B8smxURG.js} +2 -2
- package/editor-web/assets/esm-CNi9O1ya.js +21 -0
- package/editor-web/assets/{eventmodeling-K75KTNOO-b8j935GM.js → eventmodeling-K75KTNOO-CngIhoUF.js} +1 -1
- package/editor-web/assets/{file-exclamation-point-C_fX4fpI.js → file-exclamation-point-_L3ElCJ5.js} +1 -1
- package/editor-web/assets/file-question-mark-DlIjUK37.js +1 -0
- package/editor-web/assets/flowDiagram-IUGLLWBU-CL0AVU4Y.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-B6C_nkwn.js → ganttDiagram-R7GPNTJY-BtzqHUiP.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-CWtulOri.js → gitGraph-VSP46ZUC-DOOpoQDh.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-BT80Z9gj.js → gitGraphDiagram-PDYL7XHY-Cu4T8UUo.js} +1 -1
- package/editor-web/assets/{group-pebHQTdP.js → group-BdrTp7gi.js} +1 -1
- package/editor-web/assets/{hint-CKIaljPY.js → hint-rlht0uxG.js} +1 -1
- package/editor-web/assets/index-BCjGdcPh.js +28 -0
- package/editor-web/assets/index-D9ng69En.css +2 -0
- package/editor-web/assets/{info-OHQRW6UA-CyWiLOaB.js → info-OHQRW6UA-CiNozx0c.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-3TQgBeRh.js → infoDiagram-MVDRKAX5-A3mxzTmc.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-C3RAGFl7.js → ishikawaDiagram-HPEHV2GE-CIbVgY0Z.js} +1 -1
- package/editor-web/assets/iso-ahTwmFwH.js +56 -0
- package/editor-web/assets/{italic-CtlNOXN9.js → italic-zw4_eUNF.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-B3ZJp3pT.js → journeyDiagram-BOSHW7O7-BwPXFmyS.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-ChjUoDH7.js → kanban-definition-FNSA4HC5-biRlEeb1.js} +4 -4
- package/editor-web/assets/{link-CW2KxKT_.js → link-DopSU3aa.js} +1 -1
- package/editor-web/assets/{mermaid-parser.core-CqJ7hTUI.js → mermaid-parser.core-ikwPmNne.js} +3 -3
- package/editor-web/assets/mermaid.core-B4GR7QVa.js +44 -0
- package/editor-web/assets/{mindmap-definition-6OY57UG3-Di0DNds3.js → mindmap-definition-6OY57UG3-BN8aiUmO.js} +3 -3
- package/editor-web/assets/minus-CbPnUIOy.js +1 -0
- package/editor-web/assets/{packet-JDAUHWVQ-CkCyk5LQ.js → packet-JDAUHWVQ-DWesZv6p.js} +1 -1
- package/editor-web/assets/{pegDiagram-ECIUJNBX-DGyUszOM.js → pegDiagram-ECIUJNBX-Bh3QEAL_.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-D56l6NOA.js → pie-XZMESJXO-DT1ANL51.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-C6Gy4c9c.js → pieDiagram-GNMPY74T-xXxgiv6O.js} +1 -1
- package/editor-web/assets/{progress-I2qmIfF4.js → progress-CwKcXARv.js} +1 -1
- package/editor-web/assets/props-form-BwZY8ZWd.js +1 -0
- package/editor-web/assets/purify.es-B9ve_eFf.js +3 -0
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-CWfkAwXQ.js → quadrantDiagram-D57K4MC3-BGzRd8iZ.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-BhyQtVw_.js → radar-ABXABTNO-C-rmMB0D.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-CyOyOgY6.js → railroad-I3PHUGI6-CvLOq2i8.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-ExhYWNk4.js → railroad-abnf-LNEFI6M7-DMsb025s.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-B7vR6DFd.js → railroad-ebnf-DWYD2UWJ-5bvVcIvh.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-hqCnhLuG.js → railroad-peg-JR7BVNR7-LKZ9-9ja.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-D5X_R2ve.js → railroadDiagram-Y72NRBL7-DVBhzkmC.js} +1 -1
- package/editor-web/assets/{react-Bk7NnOLX.js → react-Edyoga_4.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-CIP8sDsk.js → requirementDiagram-EQYSW5RA-B5RyzWna.js} +1 -1
- package/editor-web/assets/{row-k2eAfT-g.js → row-C_svyL8o.js} +1 -1
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-BKDJlzrK.js → sankeyDiagram-SY24JHO5-BvOJG-gB.js} +1 -1
- package/editor-web/assets/schemas-BmdNnDyt.js +1 -0
- package/editor-web/assets/{scissors-BURkYWPv.js → scissors-B_xOiUhd.js} +1 -1
- package/editor-web/assets/{search-jKDvFIEU.js → search-Ba2BbT6T.js} +1 -1
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-CkRLYFZ7.js → sequenceDiagram-BLEHNHQU-BI7-Daqy.js} +1 -1
- package/editor-web/assets/{session-CUCSWPTE.js → session-D8E3nUwU.js} +1 -1
- package/editor-web/assets/{sigma-CY2Chbro.js → sigma-DSUsJhMn.js} +1 -1
- package/editor-web/assets/slides-bj0WJT_G.js +1 -0
- package/editor-web/assets/snapshots-CuflsO8Q.js +1 -0
- package/editor-web/assets/{sound-DUCxe9eC.js → sound-bTlco_K3.js} +1 -1
- package/editor-web/assets/{split-Cjm6rVDC.js → split-BrF9ECYb.js} +2 -2
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-CCvwoTcz.js → stateDiagram-v2-A6IESKWZ-C01p8WHX.js} +7 -7
- package/editor-web/assets/{sticky-note-C5qUDHhC.js → sticky-note-BdkIu5_D.js} +1 -1
- package/editor-web/assets/{strikethrough-DP-7tMz0.js → strikethrough-BwXWi4zg.js} +1 -1
- package/editor-web/assets/{surface-BocGwSox.js → surface-DtCjIlrq.js} +1 -1
- package/editor-web/assets/svg-CWIBMIQ9.js +1 -0
- package/editor-web/assets/{swatch-DGdJ5SeN.js → swatch-DhztHwPU.js} +1 -1
- package/editor-web/assets/{swimlanes-B3ENRKFQ-BXgW4pi4.js → swimlanes-B3ENRKFQ-B00P2SqG.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-ChmNuO4G.js +8 -0
- package/editor-web/assets/{switch-Dwqxw1kp.js → switch-8MU4Nfxe.js} +1 -1
- package/editor-web/assets/{syntax-DSsHrzWF.js → syntax-CU_WPKxt.js} +1 -1
- package/editor-web/assets/{table-CTjNpE4W.js → table-DRbddzx0.js} +1 -1
- package/editor-web/assets/tabs-CloHB5Z4.js +1 -0
- package/editor-web/assets/tag-CIfWT8B_.js +1 -0
- package/editor-web/assets/text-align-start-Cic2-TLh.js +1 -0
- package/editor-web/assets/{textarea-BNH6Y1-o.js → textarea-D7TnPwv1.js} +1 -1
- package/editor-web/assets/{timeline-definition-JXYKGLGB-BwuUmgv1.js → timeline-definition-JXYKGLGB-BIBoOYJY.js} +3 -3
- package/editor-web/assets/{treeView-D4JQ5SDB-Da35tnkE.js → treeView-D4JQ5SDB-CL6DL8V0.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-4TcJReov.js → treemap-SAJKECNS-CPLGr0WY.js} +1 -1
- package/editor-web/assets/{undo-2-DUGGyBdX.js → undo-2-C47jrRp5.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-wj02og_C.js → usecaseDiagram-WPOLBNNX-L03lK2bO.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-Cun6o3pg.js → vennDiagram-Q3Y3IDCW-B5tKKP_-.js} +3 -3
- package/editor-web/assets/{video-DkuN7Uu7.js → video-BWUznyLR.js} +1 -1
- package/editor-web/assets/{wardley-7MLQ67FV-DiL2aSXm.js → wardley-7MLQ67FV-vsBpXT56.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-Cll7rTnv.js → wardleyDiagram-IVAIDKWA-CMCnVUgh.js} +1 -1
- package/editor-web/assets/{whole-word-6DliXke2.js → whole-word-D3ZAtnkw.js} +1 -1
- package/editor-web/assets/{words-QKSIyC_P.js → words-0Ww2RyT4.js} +1 -1
- package/editor-web/assets/{words-B-7GbYO2.js → words-XlXG79Ur.js} +1 -1
- package/editor-web/assets/workbook-C1QR6Cts.js +45 -0
- package/editor-web/assets/x-DlhyIKuu.js +41 -0
- package/editor-web/assets/{xychartDiagram-4URNHDU4-s55eVncs.js → xychartDiagram-4URNHDU4-C9XkBiEO.js} +1 -1
- package/editor-web/assets/{zoom-in-C4lxmIDE.js → zoom-in-PgsC94hP.js} +1 -1
- package/editor-web/index.html +8 -7
- package/package.json +2 -2
- package/editor-web/assets/arrow-down-DzZjFrBL.js +0 -1
- package/editor-web/assets/arrow-up-hdmh9LVD.js +0 -1
- package/editor-web/assets/article-v30Q5cvX.js +0 -3
- package/editor-web/assets/channel-B8881pqR.js +0 -1
- package/editor-web/assets/chart-BC3kUUDD.js +0 -2
- package/editor-web/assets/chunk-DSNLSHJZ-BlB7YIMo.js +0 -129
- package/editor-web/assets/code-BID_OoRp.js +0 -1
- package/editor-web/assets/dist-B3RkByp0.js +0 -1
- package/editor-web/assets/dist-BAeqmRLA.js +0 -530
- package/editor-web/assets/dist-CGJv5-SE.js +0 -45
- package/editor-web/assets/dist-CUdvgRW5.js +0 -1
- package/editor-web/assets/dist-DhKxOqdu.js +0 -43
- package/editor-web/assets/dist-Dx2yV02v.js +0 -6
- package/editor-web/assets/dist-QuK0-suW.js +0 -24
- package/editor-web/assets/dist-Sl2_j-4w.js +0 -38
- package/editor-web/assets/dist-b5nFx4mV.js +0 -3
- package/editor-web/assets/dist-tteqAu5L.js +0 -4
- package/editor-web/assets/flowDiagram-IUGLLWBU-CnzC5OOy.js +0 -1
- package/editor-web/assets/index-C3A0pCmH.css +0 -2
- package/editor-web/assets/index-CFqSJBZ-.js +0 -28
- package/editor-web/assets/mermaid.core-DR2O-coV.js +0 -44
- package/editor-web/assets/minus-D1tgAHbU.js +0 -1
- package/editor-web/assets/props-form-gwp-8pGV.js +0 -1
- package/editor-web/assets/schemas-B89k2jEC.js +0 -1
- package/editor-web/assets/slides-BdaWgL_N.js +0 -1
- package/editor-web/assets/snapshots-CTS2iez5.js +0 -56
- package/editor-web/assets/svg-nJtFNJ-7.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-AFpLq-Wf.js +0 -8
- package/editor-web/assets/tabs-B0bv2mMP.js +0 -1
- package/editor-web/assets/x-BsePFh6d.js +0 -41
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{mkdir as te,readFile as
|
|
3
|
-
`).slice(0,3).join(" ")}`,{}))}}const J=new Set;return{root:e,kinds:n.kinds,files:a,items:
|
|
4
|
-
`)),
|
|
2
|
+
import{mkdir as te,readFile as ne,readdir as ie,writeFile as oe}from"node:fs/promises";import{join as $}from"node:path";import{BAKE_DIR as U,CACHE_DIR as ae,CONFIG_FILES as re,ConfigSchema as T,TEXT_DIR as j,itemsOf as ce,pointEntriesIn as le,WORK_FILE as w}from"@allyhub/formats";import{problem as p}from"@allyhub/diagnostics";import{looksOf as q,resolveDims as fe}from"@allyhub/piece";import{readData as de}from"./data.js";import{dependenciesOf as me,listFiles as ue}from"./files.js";import{readWork as he}from"./work.js";import{fontStyles as pe}from"./fonts.js";import{kindBuildOf as G}from"./kind-build.js";import{readMedia as ge}from"./media.js";import{readMessages as we}from"./messages.js";import{MetaLoader as be}from"./meta.js";import{allyhubPlugin as ke,mediaHref as V}from"./plugin.js";import{buildPluginModules as $e,stageAdditions as ye}from"./build-plugins.js";import{checkImports as xe,discover as Oe,parse as Se}from"./scan.js";import{writeMessageTypes as je}from"./types.js";import{resolveUses as Me}from"./uses.js";import{bundleForStage as Ee,loadUserVite as Ae}from"./vite.js";import{nodeStackPlace as ve}from"./places.js";export const inTime=(e,n)=>n.find(t=>t.id===e.kind)?.pages!==!0;export function itemProblem(e){switch(e.code){case"unknown-kind":return p("AK-M002",`${w} lists ${e.file} as a ${e.kind}, a kind no extension here contributes.`,{where:{file:w}});case"no-editor":return p("AK-M002",`${w} lists ${e.file} with no kind, and no editor here opens a file of its name. Name its kind, or take it out of the list.`,{where:{file:w}});case"missing":return p("AK-M002",`${w} lists ${e.file}, which is not in the project. Write it, or take it out of the list.`,{where:{file:w}});case"same-id":return p("AK-M003",`${w} lists ${e.files.join(" and ")}, one id (${e.id}) for two pieces, so only the first is shown: rename one, or list it once.`,{where:{file:w}})}}export function loadFailure(e,n,t){const a=t?`${n} (at ${t.file}:${String(t.line)}:${String(t.column)})`:n,f=/\b(window|document|navigator|self|HTMLElement|customElements) is not defined/u.test(n);return p("AK-R001",f?`${e} uses something at its top level that only exists in the browser (${a}). The top level of a piece module must load in Node: move it into the output's function, or import it inside a component.`:`Failed to load ${e}: ${a}`,{where:t?{file:t.file,line:t.line}:{file:e}})}export const issuesText=e=>e.issues.map(n=>`${n.path.map(String).join(".")||"(root)"}: ${n.message}`).join("; ");async function Fe(e){return(await ie($(e,U)).catch(()=>[])).filter(t=>/^[0-9a-f]+\.[\w-]+\.bin$/u.test(t)).map(t=>`${U}/${t}`)}async function Te(e){const n=[],t=new Set;for(const a of e){const f=await G(a)?.catch(()=>{});!f?.config||t.has(f)||(t.add(f),n.push(f.config))}return n}export async function prepare(e,n){const t=[],a=await ue(e),f=await he(e);for(const m of f.problems)t.push(p("AK-M002",m,{where:{file:w}}));const r=ce(f.work,n.kinds,new Set(a));for(const m of r.problems)t.push(itemProblem(m));const d=await me(e),c=await ge(e,[...a,...await Fe(e)]),i=await ye(n.kinds,e,(m,g)=>{t.push(p("AK-R001",`The build plugins module ${m} did not load, so the stage's bundles go without it: ${g instanceof Error?g.message:String(g)}`,{}))}),y=new be({root:e,media:c,dependencies:[...d],user:!0,lent:{...i.lent},sdk:{...i.sdk},bound:{...i.bound},buildPlugins:$e(n.kinds)},n.metaTimeout);try{let m=T.parse({});const g=re.find(s=>a.includes(s));if(g){const s=await y.request({type:"config",file:g});if(t.push(...s.problems),!s.ok)t.push(loadFailure(g,s.error??"",ve(s.stack,e)));else{const o=s.value??{},l=await Te(n.kinds),u=new Set(l.flatMap(h=>Object.keys(h.shape??{}))),k=T.safeParse(Object.fromEntries(Object.entries(o).filter(([h])=>!u.has(h)||Object.hasOwn(T.shape,h)))),W=l.map(h=>h.safeParse(o)),H=[...k.success?[]:[issuesText(k.error)],...W.flatMap(h=>h.success?[]:[issuesText(h.error)])];if(k.success&&H.length===0){m=k.data;for(const h of W)h.success&&(m={...m,...h.data})}else t.push(p("AK-M001",`${g} is not valid: ${H.join("; ")}.`,{where:{file:g}}))}}const K=m.defaults?.format,D=typeof K=="string"?K:"16x9",M=pe(e,m);for(const s of M.missing)t.push(p("AK-A001",`allyhub.config's fonts name ${s}, which is not in the project or its packages.`,{where:{file:g??"allyhub.config.ts"}}));const x=await we(e,a,{...m.locales?{locales:m.locales}:{},text:m.text??j});t.push(...x.problems);const z=a.filter(s=>/\.(ts|tsx|js|jsx|mts|mjs)$/u.test(s)&&!s.endsWith(".d.ts")),E=new Map;for(const s of z){const o=Se(s,await ne($(e,s),"utf8"));E.set(s,o),t.push(...xe(s,o,d,new Set(Object.keys(i.lent)),new Set(Object.keys(i.sdk))))}const I=[];for(const[s,o]of E){if(!Oe(s,o).components)continue;const l=await y.request({type:"components",file:s});if(t.push(...l.problems),!!l.ok)for(const u of l.value??[])typeof u.name=="string"&&typeof u.export=="string"&&I.push({name:u.name,file:s,export:u.export,...typeof u.label=="string"||typeof u.label=="object"&&u.label!==null?{label:u.label}:{}})}const R=await De(r.items,n.kinds,t),P=new Map,_=(s,o)=>({root:e,files:a,meta:y,media:c,messages:x,defaultFormat:D,config:m,lent:s,data:o,parsed:l=>E.get(l),claim:(l,u)=>{const k=P.get(l);return k===void 0&&P.set(l,u),k},contributionsTo:()=>[]}),N=(s,o)=>({...s,contributionsTo:l=>le(n.kinds,o.kind,l)}),b=[];let O={};const Q=_({},{}),A=new Map,v=new Map,L=(s,o)=>{A.set(s,[...A.get(s)??[],...o.files??[]]),o.uses&&o.uses.length>0&&v.set(s,[...v.get(s)??[],...o.uses])};for(const s of r.items){const o=await R.get(s)?.lend?.(s,N(Q,s));o&&(b.push(o),L(s,o),O={...O,...o.data})}const B={...await de(e,a.filter(s=>!r.items.some(o=>o.entry===s)),m.text??j),...O},Y=_(O,B);for(const s of r.items){const o=await R.get(s)?.read?.(s,N(Y,s));o&&(b.push(o),L(s,o));const l=new Set([s.entry]);s.files=[{path:s.entry,role:"entry"},...(A.get(s)??[]).filter(u=>!l.has(u.path)&&!!l.add(u.path))]}for(const s of b)t.push(...s.problems??[]);t.push(...Me(r.items,n.kinds,v));const Z=b.flatMap(s=>s.piece?[s.piece]:[]),ee=b.flatMap(s=>s.doc?[s.doc]:[]),se=b.flatMap(s=>s.sheet?[s.sheet]:[]),C=[...b.filter(s=>s.piece),...b.filter(s=>!s.piece)].flatMap(s=>s.stage?[s.stage]:[]),S=x.locales[0];await je(e,S===void 0?{}:x.messages[S]??{},S===void 0?void 0:x.files[S]);let F;if(n.buildDir&&C.length>0){const s=Object.fromEntries(await Promise.all(C.map(async l=>[l.name,await Ke(e,l)]))),o=await Ae(e);try{const l=await Ee({root:e,entries:s,outDir:n.buildDir,plugins:[ke({root:e,media:c,dependencies:d,fonts:()=>M.styles,stageEntries:new Set(Object.values(s)),lent:i.lent,sdk:i.sdk,bound:i.bound}),...i.plugins],...o?{user:o}:{}}),u=await i.written(n.buildDir);F={dir:n.buildDir,chunks:l,beside:u}}catch(l){t.push(p("AK-R001",`The pieces could not be bundled for the stage: ${l.message.split(`
|
|
3
|
+
`).slice(0,3).join(" ")}`,{}))}}const J=new Set;return{root:e,kinds:n.kinds,files:a,items:r.items,config:m,defaultFormat:D,dependencies:[...d].sort(),messages:x,media:c,data:B,docs:ee,sheets:se,pieces:Z,components:I,fonts:M.styles,...F?{bundle:F}:{},problems:t.filter(s=>{const o=`${s.code}|${s.message}|${s.where?.file??""}|${String(s.where?.line??"")}`;return J.has(o)?!1:(J.add(o),!0)})}}finally{await y.close()}}export const BUILD_FOLDER="build/",stageName=e=>e.replaceAll("/","__"),stageId=e=>"components"in e?e.place:e.id;export function stageItem(e,n){return e.pieces.find(t=>t.id===n)??e.docs.find(t=>t.place===n&&t.components.length>0)}async function Ke(e,n){const t=n.components??[];if(t.length===0&&n.module!==void 0)return $(e,n.module);const a=$(e,ae,"stage-entries");await te(a,{recursive:!0});const f=$(a,`${n.name}.ts`),r=[...new Set(t.map(c=>c.module))],d=[`// The components ${n.of??n.module??n.name} shows by their module (generated by the build).`,...n.module===void 0?[]:[`export { default } from ${JSON.stringify($(e,n.module))};`],...r.map((c,i)=>`import * as m${String(i)} from ${JSON.stringify($(e,c))};`),"export const components = {",...t.map(c=>` ${JSON.stringify(c.of)}: m${String(r.indexOf(c.module))}[${JSON.stringify(c.name)}],`),"};",""];return await oe(f,d.join(`
|
|
4
|
+
`)),f}async function De(e,n,t){const a=new Map,f=new Map;for(const r of e){if(!a.has(r.kind)){const c=n.find(i=>i.id===r.kind);a.set(r.kind,await G(c)?.catch(i=>{t.push(p("AK-R001",`The ${c?.extension??r.kind} extension's build module did not load, so its items are not read: ${i instanceof Error?i.message:String(i)}`,{}))}))}const d=a.get(r.kind);d&&f.set(r,d)}return f}function X(e,n){const t=[],a=new Set,f=new Set,r=d=>{if(f.has(d))return;f.add(d);const c=e.bundle?.chunks.chunks[d];if(c){d!==n&&t.push(`${BUILD_FOLDER}${d}`);for(const i of c.css)a.add(`${BUILD_FOLDER}${i}`);for(const i of c.imports)r(i)}};return r(n),{imports:t,styles:[...a]}}export function sourceOf(e,n){if("components"in n)return Re(e,n);const t=n,a=BUILD_FOLDER,f=stageName(t.id),r=e.bundle?.chunks.entries[f];if(!r)throw new Error(`${t.id} was not bundled for the stage.`);const{imports:d,styles:c}=X(e,r.file);return{piece:t.id,file:t.file,module:`${a}${r.file}`,imports:d,styles:c,dims:t.dims,...t.matrix?{matrix:{space:t.matrix.space,rules:t.matrix.rules}}:{},format:t.format,locales:e.messages.locales,messages:e.messages.messages,anchors:e.messages.anchors,text:e.config.text??j,...t.script===void 0?{}:{script:t.script},media:Object.fromEntries(Object.entries(e.media).map(([i,y])=>[i,{...y,url:V(i)}])),data:e.data,kind:t.kind,...t.loads,...q(e.config),pieces:Object.fromEntries(e.pieces.map(i=>[i.id,{file:i.file,dims:i.dims,format:i.format,...i.matrix?{matrix:{space:i.matrix.space,rules:i.matrix.rules}}:{}}]))}}const Ie="1920x1080";function Re(e,n){const t=stageName(n.place),a=e.bundle?.chunks.entries[t];if(!a)throw new Error(`${n.place} shows no component: it has no stage bundle.`);const{imports:f,styles:r}=X(e,a.file);return{kind:"doc",piece:n.place,file:n.file,module:`${BUILD_FOLDER}${a.file}`,imports:f,styles:r,dims:fe(void 0,{locales:e.messages.locales}),format:Ie,locales:e.messages.locales,messages:e.messages.messages,anchors:e.messages.anchors,text:e.config.text??j,media:Object.fromEntries(Object.entries(e.media).map(([d,c])=>[d,{...c,url:V(d)}])),data:e.data,...q(e.config)}}
|
|
@@ -18,13 +18,21 @@ export declare function projectItems(root: string, kinds: KindTable, files?: rea
|
|
|
18
18
|
* Nothing when the file is listed already.
|
|
19
19
|
*/
|
|
20
20
|
export declare function listWork(root: string, item: WorkItem): Promise<void>;
|
|
21
|
+
/** A piece taken out of the list as it was written there: its entry, every field of it, and the headings it stood under, outermost first. */
|
|
22
|
+
export interface UnlistedEntry {
|
|
23
|
+
entry: Record<string, unknown>;
|
|
24
|
+
groups: string[];
|
|
25
|
+
}
|
|
21
26
|
/**
|
|
22
27
|
* The project's list without the pieces whose file is `gone` or under it
|
|
23
28
|
* (a file or a folder removed), the rest of it, comments included, as it
|
|
24
|
-
* was, and the pieces taken out
|
|
29
|
+
* was, and the pieces taken out: as pieces (`items`), and as they were
|
|
30
|
+
* written, with the headings over each (`entries`, what puts one back
|
|
31
|
+
* where it was); undefined when it names none of them.
|
|
25
32
|
*/
|
|
26
33
|
export declare function unlistedWork(text: string, gone: string): {
|
|
27
34
|
text: string;
|
|
28
35
|
items: WorkItem[];
|
|
36
|
+
entries: UnlistedEntry[];
|
|
29
37
|
} | undefined;
|
|
30
38
|
//# sourceMappingURL=work.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFile as
|
|
3
|
-
`)[0]??""}`]}}const
|
|
4
|
-
`),t=
|
|
2
|
+
import{readFile as w,writeFile as W}from"node:fs/promises";import{join as k}from"node:path";import{itemsOf as b,parseWork as v,WORK_FILE as c,WorkItemSchema as O}from"@allyhub/formats";import{isMap as g,isScalar as y,isSeq as M,parseDocument as S,parse as $,visit as h}from"yaml";import{listFiles as F}from"./files.js";export async function readWork(s){const r=await w(k(s,c),"utf8").catch(()=>{});if(r===void 0)return{work:{work:[]},problems:[]};let e;try{e=$(r)}catch(t){return{work:{work:[]},problems:[`${c} is not valid YAML: ${t.message.split(`
|
|
3
|
+
`)[0]??""}`]}}const o=v(e);return o.ok?{work:o.value,problems:[]}:{work:{work:[]},problems:o.problems.map(t=>`${c}: ${t}`)}}export async function projectItems(s,r,e,o){const{work:t,problems:n}=await readWork(s);return{...b(t,r,new Set(e??await F(s)),o),listProblems:n}}export async function listWork(s,r){const e=k(s,c),o=await w(e,"utf8").catch(()=>`work: []
|
|
4
|
+
`),t=S(o),n=t.toJS()?.work;if(JSON.stringify(n??[]).includes(JSON.stringify(r.file)))return;Array.isArray(n)||t.set("work",t.createNode([]));const a=t.get("work",!0);M(a)&&(a.flow=!1),t.addIn(["work"],r),await W(e,t.toString())}export function unlistedWork(s,r){const e=S(s),o=[],t=[];return h(e,{Map(n,i,a){if(!g(i))return;const u=i.get("file",!0);if(!y(u)||typeof u.value!="string")return;const p=u.value.replace(/^\.\//u,"");if(p!==r&&!p.startsWith(`${r}/`))return;const l=i.toJSON(),d=O.safeParse(l);d.success&&o.push(d.data);const x=a.flatMap(m=>{if(!g(m))return[];const f=m.get("group",!0);return y(f)&&typeof f.value=="string"?[f.value]:[]});return t.push({entry:l,groups:x}),h.REMOVE}}),t.length>0?{text:e.toString(),items:o,entries:t}:void 0}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# references/canvas.md
|
|
2
2
|
|
|
3
|
-
A canvas lays a project's work out to be seen together, compared and talked over: a launch's outputs side by side, two cuts of a video, a mood board, candidates with your reasons beside them. It
|
|
3
|
+
A canvas lays a project's work out to be seen together, compared and talked over: a launch's outputs side by side, two cuts of a video, a mood board, candidates with your reasons beside them. It shows the project's own items, with notes and edges between them, and stays in the project as a place to work. It is a `.canvas` file (JSON Canvas, as Obsidian writes it) anywhere in the project, written by hand and listed in `allyhub.yaml` for the person to see it.
|
|
4
4
|
|
|
5
5
|
- `allyhub help canvases` lists the commands and prints where the SDK's `canvas.md` is. Read it before writing a canvas.
|
|
6
6
|
- **The person moves things and adds notes and edges in the same file.** Read it before you change it, and keep what they put there.
|
|
7
|
-
- `allyhub inspect canvas <file>` lists what it holds and where, without drawing it
|
|
7
|
+
- `allyhub inspect canvas <file>` lists what it holds and where, without drawing it. It is handed over as any item is.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{mkdir as p,readFile as w,writeFile as
|
|
2
|
+
import{mkdir as p,readFile as w,writeFile as S}from"node:fs/promises";import{dirname as b}from"node:path";import{BLOBS_MAX as d,BlobsResponseSchema as y}from"@allyhub/protocol";import{CloudError as g}from"./errors.js";const k=4,A=30*6e4,v=3*6e4;export class BlobStore{cloud;path;file;known;constructor(i,s){this.cloud=i,this.path=s.path,this.file=s.file}async load(){if(this.known)return this.known;if(this.file===void 0)return this.known=new Set;try{this.known=new Set(JSON.parse(await w(this.file,"utf8")))}catch{this.known=new Set}return this.known}async save(){this.file!==void 0&&(await p(b(this.file),{recursive:!0}),await S(this.file,JSON.stringify([...this.known??[]])))}async forget(i){const s=await this.load();for(const n of i)s.delete(n);await this.save()}async put(i){let s=0;const n=await this.load(),o=new Map;for(const e of i)n.has(e.sha256)||o.set(e.sha256,e);const l=[...o.values()];for(let e=0;e<l.length;e+=d){const c=l.slice(e,e+d),{uploads:a}=y.parse(await this.cloud.json(this.path,{method:"POST",signal:AbortSignal.timeout(v),body:{blobs:c.map(t=>({sha256:t.sha256,size:t.size,contentType:t.type}))}}));let f=0;const u=async()=>{for(;f<a.length;){const t=a[f++],r=t&&o.get(t.sha256);if(!t||!r)continue;const m=r.bytes??await w(r.file??""),h=await this.cloud.config.fetch(t.url,{method:"PUT",headers:t.headers,body:new Uint8Array(m),signal:AbortSignal.timeout(A)});if(!h.ok)throw new g("blob-refused",`Storage refused a blob: ${String(h.status)} ${(await h.text()).slice(0,200)}`);s+=1}};await Promise.all(Array.from({length:Math.min(k,a.length)},u));for(const t of c)n.add(t.sha256);await this.save()}return s}}
|
|
@@ -13,13 +13,22 @@ export interface Key {
|
|
|
13
13
|
}
|
|
14
14
|
/** Removes anything key-shaped from text that may reach the screen. */
|
|
15
15
|
export declare function scrub(text: string, key?: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Work no person asked for (a Studio server's save on its clock), run so
|
|
18
|
+
* that every call it makes to AllyHub says so (BACKGROUND_HEADER): a
|
|
19
|
+
* refusal of one is marked as background. What it answers.
|
|
20
|
+
*/
|
|
21
|
+
export declare function callsMadeInBackground<T>(work: () => Promise<T>): Promise<T>;
|
|
16
22
|
export declare class Cloud {
|
|
17
23
|
readonly config: CloudConfig;
|
|
18
24
|
constructor(config: CloudConfig);
|
|
19
25
|
/**
|
|
20
|
-
* Run by an agent in Studio, Studio is told a call was refused for
|
|
21
|
-
* credits,
|
|
22
|
-
*
|
|
26
|
+
* Run by an agent in Studio, Studio is told a call was refused for what
|
|
27
|
+
* buying fixes (credits, a plan, storage), with what it was and its
|
|
28
|
+
* numbers, and opens its paywall for the person (docs/design/paywall.md).
|
|
29
|
+
* Never fails the command: a Studio that does not answer in a second is
|
|
30
|
+
* left. One from before the paywall knows only credits, at its old
|
|
31
|
+
* address, and is told of them there.
|
|
23
32
|
*/
|
|
24
33
|
private tellStudio;
|
|
25
34
|
get url(): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{createHash as
|
|
2
|
+
import{AsyncLocalStorage as _}from"node:async_hooks";import{createHash as b}from"node:crypto";import{BACKGROUND_HEADER as A,COMMAND_LINE_PAYWALL_MET as E,DEVICE_HEADER as O,EXIT as c,IDEMPOTENCY_KEY_HEADER as k,ORGANIZATION_HEADER as g,paywallNumbersOfData as S,paywallReasonOfCode as $,planPageAddress as y}from"@allyhub/protocol";import{accessOf as N,SignedOut as x}from"./credentials.js";import{userAgent as z}from"./device.js";import{CloudError as h,notSignedIn as p,unreachable as w}from"./errors.js";export function scrub(u,n){let t=u.replace(/(authorization)\s*[:=]\s*[^\r\n]+/giu,"$1: <redacted>");return t=t.replace(/\bahk_[A-Za-z0-9_-]+/gu,"<api-key>"),t=t.replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]+/gu,"<token>"),n&&(t=t.split(n).join("<key>")),t}const I="/api/tools",m=new _;export function callsMadeInBackground(u){return m.run(!0,u)}export class Cloud{config;constructor(n){this.config=n}async tellStudio(n,t,i){const r=this.config.studioHost;if(r===void 0)return;const s={reason:n,what:t.startsWith(I)?"tool":"command",numbers:S(i)},e=(d,o)=>fetch(`${r}/${d}`,{method:"POST",signal:AbortSignal.timeout(1e3),...o===void 0?{}:{headers:{"content-type":"application/json"},body:o}}).then(async f=>(await f.body?.cancel(),f.status),()=>{});await e(E,JSON.stringify(s))===404&&n==="insufficient_credits"&&await e("out-of-credits")}get url(){return this.config.url}async key(n={}){const t=this.config.apiKey;if(t)return{key:t,source:"env",account:b("sha256").update(t).digest("hex")};try{const i=await N(this.config,n);if(!i)return;const r=i.credentials.account.organization?.id,s=i.credentials.device;return{key:i.token,source:"oauth",account:i.credentials.account.id,expiresAt:i.expiresAt,...r===void 0?{}:{organization:r},...s===void 0?{}:{device:s}}}catch(i){if(i instanceof x)return;throw w(this.url,i)}}async requireKey(){const n=await this.key();if(!n)throw p();return n}keyedFetch=async(n,t)=>{const i=this.config.client===void 0?void 0:await z(this.config.client),r=d=>{const o=new Headers(t?.headers);return o.set("authorization",`Bearer ${d.key}`),i!==void 0&&!o.has("user-agent")&&o.set("user-agent",i),this.config.traceparent!==void 0&&!o.has("traceparent")&&o.set("traceparent",this.config.traceparent),d.organization!==void 0&&!o.has(g)&&o.set(g,d.organization),d.device!==void 0&&o.set(O,d.device),m.getStore()===!0&&o.set(A,"1"),this.config.fetch(n,{...t,headers:o})},s=await this.requireKey(),e=await r(s);if(e.status!==401||s.source!=="oauth"||t?.body instanceof ReadableStream||n instanceof Request)return e;const a=await this.key({refused:s.key});return a===void 0?e:(await e.body?.cancel(),r(a))};async json(n,t={}){const i=t.auth!==!1,r=i?await this.requireKey():void 0,s=r?.key,e=t.organization??r?.organization;let a;try{a=await(i?this.keyedFetch:this.config.fetch)(`${this.url}${n}`,{redirect:"error",signal:t.signal??AbortSignal.timeout(3e4),method:t.method??"GET",headers:{accept:"application/json",...t.body===void 0?{}:{"content-type":"application/json"},...t.organization===void 0?{}:{[g]:t.organization},...t.idempotencyKey===void 0?{}:{[k]:t.idempotencyKey}},...t.body===void 0?{}:{body:JSON.stringify(t.body)}})}catch(l){throw l instanceof h?l:w(this.url,l)}const d=await a.text(),o=a.ok?void 0:T(d,a.status,s,this.url,e),f=$(o?.code);if(f!==void 0&&await this.tellStudio(f,n,o?.data),o&&a.status!==401)throw o;if(a.status===403)throw new h("forbidden","This AllyHub account does not have access to this operation.",{exit:c.auth,status:403});if(a.status===401)throw p(i?"This computer's AllyHub sign-in is not valid any more.":void 0);if(!a.ok)throw new h("api-error",`${this.url}${n} answered ${String(a.status)}: ${scrub(d.slice(0,300),s)}`,{exit:a.status>=500?c.platform:c.usage,status:a.status});if(a.status!==204)try{return JSON.parse(d)}catch{throw new h("api-error",`${this.url}${n} did not answer JSON.`,{exit:c.platform,status:a.status})}}}const R={bad_input:c.usage,insufficient_credits:c.auth,plan_required:c.auth,tool_off:c.auth,storage_full:c.auth,limit_reached:c.auth,forbidden:c.auth,not_found:c.notFound,conflict:c.conflict};function T(u,n,t,i,r){let s;try{s=JSON.parse(u)}catch{return}const e=s?.error;if(typeof e?.code!="string"||typeof e.message!="string")return;const a=e.code==="insufficient_credits"?`Buy credits at ${y(i,{organization:r,open:"credits"})}, or ask an owner or admin of the team to.`:e.code==="plan_required"?`Subscribe at ${y(i,{organization:r,open:"plans"})}, or ask an owner or admin of the team to.`:e.code==="tool_off"?`Turn it on in Capabilities at ${i}/, or ask an owner or admin of the team to.`:typeof e.hint=="string"?e.hint:void 0;return new h(e.code.replaceAll("_","-"),scrub(e.message,t),{exit:R[e.code]??c.platform,status:n,...a===void 0?{}:{hint:a},...typeof e.data=="object"&&e.data!==null?{data:e.data}:{}})}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { cloudConfig, hostsText, type CloudConfig } from "./config.js";
|
|
2
2
|
export { CloudError, cloudWork, notSignedIn, SIGN_IN } from "./errors.js";
|
|
3
|
-
export { Cloud, scrub, type Key } from "./client.js";
|
|
3
|
+
export { Cloud, callsMadeInBackground, scrub, type Key } from "./client.js";
|
|
4
4
|
export { SignedOut, accessOf, accountOf, authServer, chooseOrganization, forgetCredentials, readCredentials, signInWithCode, signInWithDevice, signOut, writeCredentials, type Credentials, } from "./credentials.js";
|
|
5
5
|
export { SIGN_IN_WAIT_MS, openBrowser, signIn, signInByEmail, signInDevice, signInInBackground, signedInAs, type SignInHint, } from "./signin.js";
|
|
6
6
|
export { osKeychain, type Keychain, type KeychainEntry } from "./keychain.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export{cloudConfig,hostsText}from"./config.js";export{CloudError,cloudWork,notSignedIn,SIGN_IN}from"./errors.js";export{Cloud,scrub}from"./client.js";export{SignedOut,accessOf,accountOf,authServer,chooseOrganization,forgetCredentials,readCredentials,signInWithCode,signInWithDevice,signOut,writeCredentials}from"./credentials.js";export{SIGN_IN_WAIT_MS,openBrowser,signIn,signInByEmail,signInDevice,signInInBackground,signedInAs}from"./signin.js";export{osKeychain}from"./keychain.js";export{LoopbackError,startLoopback}from"./loopback.js";export{pkcePair,randomState}from"./pkce.js";export{billingSummary,browserLink,organizations,webLink}from"./token.js";export{BlobStore}from"./blobs.js";export{Hashes,hashFolder,sha256Of}from"./hashes.js";export{addDeployment,changeSite,createSite,goLive,listSites,removeSite,siteDetail,unpublishSite}from"./sites.js";export{createMailAlias,mailbox,rawMail,readMail,replyMail,searchMail,sendMail}from"./mail.js";export{CATALOG_CACHE_SECONDS,findTool,loadCatalog}from"./catalog.js";export{POLL_SECONDS,READ_SECONDS,RETRY_SECONDS,WAIT_SECONDS,callTool,resumeJob}from"./call.js";export{REUSE_LEFT_MS,UPLOAD_CONCURRENCY,UPLOAD_TYPES,uploadFiles,urlExpiry,withKnownUploads}from"./uploads.js";export{BASE64_FROM,LARGE_FROM,canonical,genRecord,inputHash,isSecretName,namedFile,readGen,recordInput,recordOutput,toolWords,withoutSignature,writeGen,writeWords}from"./records.js";export{makeSay,sayInput}from"./voice.js";
|
|
2
|
+
export{cloudConfig,hostsText}from"./config.js";export{CloudError,cloudWork,notSignedIn,SIGN_IN}from"./errors.js";export{Cloud,callsMadeInBackground,scrub}from"./client.js";export{SignedOut,accessOf,accountOf,authServer,chooseOrganization,forgetCredentials,readCredentials,signInWithCode,signInWithDevice,signOut,writeCredentials}from"./credentials.js";export{SIGN_IN_WAIT_MS,openBrowser,signIn,signInByEmail,signInDevice,signInInBackground,signedInAs}from"./signin.js";export{osKeychain}from"./keychain.js";export{LoopbackError,startLoopback}from"./loopback.js";export{pkcePair,randomState}from"./pkce.js";export{billingSummary,browserLink,organizations,webLink}from"./token.js";export{BlobStore}from"./blobs.js";export{Hashes,hashFolder,sha256Of}from"./hashes.js";export{addDeployment,changeSite,createSite,goLive,listSites,removeSite,siteDetail,unpublishSite}from"./sites.js";export{createMailAlias,mailbox,rawMail,readMail,replyMail,searchMail,sendMail}from"./mail.js";export{CATALOG_CACHE_SECONDS,findTool,loadCatalog}from"./catalog.js";export{POLL_SECONDS,READ_SECONDS,RETRY_SECONDS,WAIT_SECONDS,callTool,resumeJob}from"./call.js";export{REUSE_LEFT_MS,UPLOAD_CONCURRENCY,UPLOAD_TYPES,uploadFiles,urlExpiry,withKnownUploads}from"./uploads.js";export{BASE64_FROM,LARGE_FROM,canonical,genRecord,inputHash,isSecretName,namedFile,readGen,recordInput,recordOutput,toolWords,withoutSignature,writeGen,writeWords}from"./records.js";export{makeSay,sayInput}from"./voice.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{readFile as p,readdir as m,rm as h}from"node:fs/promises";import{join as a}from"node:path";import{listsFile as d,TRASH_DIR as y,WORK_FILE as E}from"@allyhub/formats";import{isInput as l}from"./inputs.js";export const TRASH_KEPT_DAYS=30,DELETED_FILE="deleted.json";const O=(e,n)=>n===e.entry||e.files!==void 0&&d(e.files,n)||e.inputs.some(o=>l(o,n));export function movesOfDeletion(e){const{target:n}=e,o=new Set([n.entry]);for(const t of e.files)(n.files!==void 0&&d(n.files,t)||n.inputs.some(c=>c!==""&&l(c,t)))&&o.add(t);o.delete(E);const s=e.others.some(t=>t.ofKind&&t.files===void 0),i=new Set(e.listed),r=[],f=[];for(const t of[...o].sort())i.has(t)||e.others.some(u=>O(u,t))||s&&t!==n.entry?f.push(t):r.push(t);return{moves:r,stays:f}}export const utcStampOf=e=>`${e.toISOString().slice(0,19).replaceAll("-","").replaceAll(":","")}Z`;export function shortNameOf(e){const o=(e.split("/").pop()??"").replace(/[^A-Za-z0-9._-]+/gu,"-").replace(/^[-.]+|-+$/gu,"").slice(0,40);return o===""?"item":o}export async function emptyTrashOlderThan(e,n,o){const s=a(e,y),i=await m(s,{withFileTypes:!0}).catch(t=>{if(hasErrorCode(t,"ENOENT","ENOTDIR"))return[];throw t}),r=o.getTime()-n*24*60*60*1e3,f=[];for(const t of i){if(!t.isDirectory())continue;const c=await T(a(s,t.name,DELETED_FILE));c===void 0||c>=r||(await h(a(s,t.name),{recursive:!0,force:!0}),f.push(t.name))}return f}async function T(e){let n;try{n=await p(e,"utf8")}catch(r){if(hasErrorCode(r,"ENOENT","ENOTDIR"))return;throw r}let o;try{o=JSON.parse(n)}catch(r){if(r instanceof SyntaxError)return;throw r}const s=typeof o=="object"&&o!==null&&"deletedAt"in o?o.deletedAt:void 0;if(typeof s!="string")return;const i=Date.parse(s);return Number.isNaN(i)?void 0:i}export const hasErrorCode=(e,...n)=>typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&n.includes(e.code);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export{PING_MS,RAW_PATH,RPC_PATH,forwardedHost,startDevServer}from"./server.js";export{ProjectServer,SERVER_METHODS}from"./project.js";export{Writer,LIST_LIMIT,UPLOAD_MAX_BYTES}from"./writer.js";export{Watcher}from"./watcher.js";export{Presence}from"./presence.js";export{changedLines}from"./texts.js";export{writeProblems,dataFileOf}from"./validate.js";export{pathProblem,versionOf}from"./paths.js";export{SETTLE_MS}from"./background.js";export{recordTree}from"./record.js";export{itemPreview,projectName}from"./card.js";export{downloadsFolder,hasFileManager,revealFile}from"./reveal.js";
|
|
2
|
+
export{PING_MS,RAW_PATH,RPC_PATH,forwardedHost,startDevServer}from"./server.js";export{ProjectServer,SERVER_METHODS}from"./project.js";export{Writer,LIST_LIMIT,UPLOAD_MAX_BYTES}from"./writer.js";export{DELETED_FILE,TRASH_KEPT_DAYS,movesOfDeletion}from"./deletion.js";export{Watcher}from"./watcher.js";export{Presence}from"./presence.js";export{changedLines}from"./texts.js";export{writeProblems,dataFileOf}from"./validate.js";export{pathProblem,versionOf}from"./paths.js";export{SETTLE_MS}from"./background.js";export{recordTree}from"./record.js";export{itemPreview,projectName}from"./card.js";export{downloadsFolder,hasFileManager,revealFile}from"./reveal.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{listsFile as c}from"@allyhub/formats";const
|
|
2
|
+
import{listsFile as c}from"@allyhub/formats";export const isInput=(r,t)=>r===""||r.endsWith("/")?t.startsWith(r):r===t;export class Inputs{recorded=new Map;set(t,s,o){let e=this.recorded.get(t);e||(e=new Map,this.recorded.set(t,e)),e.set(s,new Set(o))}add(t,s,o){const e=this.recorded.get(t)?.get(s);e?e.add(o):this.set(t,s,[o])}of(t){const s=new Set;for(const o of this.recorded.get(t)?.values()??[])for(const e of o)s.add(e);return s}affected(t,s){const o=new Map;for(const e of t){const f=[...this.of(e.id)],n=s.filter(d=>d===e.entry||e.files!==void 0&&c(e.files,d)||f.some(i=>isInput(i,d)));n.length>0&&o.set(e.id,n)}return o}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{
|
|
2
|
+
import{isListedFile as v,itemNameOf as g,listedWork as T,listsFile as k,projectPath as S}from"@allyhub/formats";import{randomBytes as E}from"node:crypto";import{isAbsolute as y,relative as j,resolve as I,sep as P}from"node:path";import{AGENT_NAME as N,FILE_METHODS as R,HOST_METHODS as x,JSONRPC as c,PRESENCE_METHODS as D,PROJECT_TOOLS as l,RPC_ERROR as d,RequestSchema as M,RpcError as f,answer as p}from"@allyhub/protocol";import{listFiles as _,projectItems as C,readWork as F}from"@allyhub/build";import{Checker as A,Indexer as J}from"./background.js";import{TRASH_KEPT_DAYS as H,movesOfDeletion as L}from"./deletion.js";import{Exports as q}from"./exports.js";import{downloadsFolder as W,hasFileManager as B,revealFile as $}from"./reveal.js";import{Live as K}from"./live.js";import{Inputs as U}from"./inputs.js";import{Pages as Y}from"./pages.js";import{fileIn as O}from"./paths.js";import{kindContext as G}from"./kinds.js";import{Presence as V}from"./presence.js";import{Texts as X}from"./texts.js";import{contributedTool as z,contributedTools as Q,projectToolContext as Z,toolHandlers as ee}from"./tools.js";import{Watcher as te}from"./watcher.js";import{Writer as se}from"./writer.js";export const SERVER_METHODS={...R,"tools/call":x["tools/call"],...D};const ie=5e3,ne="sidebar";export class ProjectServer{root;writer;watcher;live;exports;presence;inputs=new U;pages;texts;placing=Promise.resolve();telling=Promise.resolve();listed;extensions;reveal;checker;serving;indexer;clients=new Map;contributed;services;held=new Map;unhearJobs;constructor(e){this.root=I(e.root),this.services={...e.jobs===void 0?{}:{jobs:e.jobs},...e.cloud===void 0?{}:{cloud:e.cloud},...e.env===void 0?{}:{env:e.env},...e.ports===void 0?{}:{ports:e.ports}},this.unhearJobs=e.jobs?.on(t=>{if(!y(t.about.id))return;const s=j(this.root,t.about.id);s===""||s.startsWith("..")||y(s)||this.notify("jobs/changed",{job:t,item:s.split(P).join("/")})})??(()=>{}),this.contributed=Q(e.kinds),this.extensions=e.extensions,this.live=new K(this.root,{kinds:e.kinds,...e.gpu===void 0?{}:{gpu:e.gpu},recordInputs:(t,s,r)=>{const n=[...r];this.listedItems().then(a=>{const h=a.find(u=>u.entry===t);h&&this.inputs.set(h.id,s,n)})}}),this.pages=new Y({root:this.root,ports:e.ports,inputs:this.inputs}),this.presence=new V(t=>{this.notify("presence/changed",{collaborators:t})}),this.texts=new X(this.root),this.watcher=new te(this.root,(t,s)=>{this.sendTo(this.watchOwner(t),"files/changed",{watch:t,changes:s})},(t,s)=>{this.live.moved(t),this.notify("project/changed",{revision:t}),this.checker?.schedule(),this.telling=this.telling.then(()=>this.tellItems(s))},{by:{kind:"agent",name:N},moved:t=>{this.placing=this.placing.then(()=>this.wroteOutside(t))}}),this.writer=new se(this.root,e.kinds,(t,s)=>{for(const r of t)this.texts.set(r.path,r.text);this.watcher.wrote(t.map(({path:r,version:n})=>({path:r,version:n})),s)},e.writable),this.reveal=e.reveal===!1?void 0:e.reveal??(B()?$:void 0),this.exports=new q(this.root,e.kinds,t=>{this.notify("export/changed",{job:t})},e.jobs===void 0?void 0:{jobs:e.jobs,nameOf:async t=>{const{items:s}=await this.tool("project/items",{}),r=s.find(n=>n.id===t);return g(r??{id:t})}},{...e.extensions?{processors:e.extensions.exportProcessors(),analyses:e.extensions.mediaAnalyses()}:{},...this.reveal===void 0||e.exportsTo===!1?{}:{saveTo:e.exportsTo??W}});const i=e.index??process.env.ALLYHUB_NO_INDEX!=="1";if(e.check!==!1){const t=i?new J({root:this.root,analyses:e.extensions?.mediaAnalyses()??[],env:e.env??process.env,emit:r=>{this.notify("index/changed",{jobs:r})},made:()=>{this.checker?.schedule(!0)}}):void 0;this.indexer=t;const s=e.extensions?.fileEditors();this.checker=new A({live:this.live,...s===void 0?{}:{files:s},emit:r=>{this.notify("check/changed",r)},...t?{needs:r=>{t.want(r)}}:{},...e.settle===void 0?{}:{settle:e.settle}})}}static open(e){const i=new ProjectServer(e);return i.watcher.start(),i.checker?.schedule(),i.texts.warm(),Promise.resolve(i)}async settled(){await this.watcher.settled(),await this.placing,await this.telling}async tellItems(e){if(e.length===0)return;const i=await this.listedItems();for(const[t,s]of this.inputs.affected(i,e))this.notify("items/changed",{item:t,paths:s})}async wroteOutside(e){let i;for(const s of e){const{changed:r,lines:n}=await this.texts.changed(s).catch(()=>({changed:!1,lines:void 0}));r&&(i={path:s,...n})}if(i===void 0)return;const t=await this.itemOf(i.path);this.presence.agent({doing:"editing",...t===void 0?{}:{item:t},source:i})}async itemOf(e){const i=await this.listedItems(),t=i.filter(s=>s.dir!==""&&e.startsWith(`${s.dir}/`)).sort((s,r)=>r.dir.length-s.dir.length);return(i.find(s=>s.entry===e)??i.find(s=>s.files!==void 0&&k(s.files,e))??t[0])?.id}async listedItems(){const e=Date.now();return this.listed!==void 0&&e-this.listed.at<ie||(this.listed={at:e,items:this.tool("project/items",{}).then(t=>t.items,()=>[])}),await this.listed?.items??[]}owners=new Map;watchOwner(e){return this.owners.get(e)}connect(e,i={}){const t=`c${E(6).toString("hex")}`;this.clients.set(t,e);const s=this.handlersFor(t,i.origin);return{id:t,receive:async r=>{const n=await this.answerOne(s,r);n&&e(n)},close:()=>{this.clients.delete(t),this.watcher.forget(t);for(const[r,n]of this.owners)n===t&&this.owners.delete(r)}}}channel(){const e=new Set,i=this.connect(t=>{const s=JSON.parse(JSON.stringify(t));queueMicrotask(()=>{for(const r of e)r(s)})});return{send:t=>{i.receive(JSON.parse(JSON.stringify(t)))},listen:t=>(e.add(t),()=>e.delete(t)),close:()=>{i.close()}}}notify(e,i){for(const t of this.clients.values())t({jsonrpc:c,method:e,params:i})}sendTo(e,i,t){e!==void 0&&this.clients.get(e)?.({jsonrpc:c,method:i,params:t})}async answerOne(e,i){const t=M.safeParse(i);if(!t.success){const r=i?.id;return typeof r!="string"&&typeof r!="number"?void 0:{jsonrpc:c,id:r,error:{code:d.invalidRequest,message:"Not a JSON-RPC request."}}}const s=t.data;return Object.hasOwn(x,s.method)&&s.method!=="tools/call"?{jsonrpc:c,id:s.id,error:{code:d.methodNotFound,message:`${s.method} is answered by the page that hosts the editor, not by allyhub dev's server.`}}:p(SERVER_METHODS,e,s)}handlersFor(e,i){const{writer:t,watcher:s}=this,r=this.toolSet(()=>this.serving?.tree(i));return{"files/read":({path:n})=>t.read(n),"files/write":async({path:n,text:a,over:h})=>({version:await t.write(n,a,h,e)}),"files/upload":async({dir:n,name:a,data:h})=>({path:await t.upload(n,a,Buffer.from(h,"base64"),e)}),"files/url":async({path:n})=>{if(await O(this.root,n),!this.serving)throw new f(d.unavailable,"This server serves no files over HTTP: only allyhub dev's does.");return{url:this.serving.file(i,n)}},"files/list":({dir:n})=>t.list(n),"files/move":async({from:n,to:a})=>({rewritten:await t.move(n,a,e)}),"files/remove":async({path:n})=>({trash:await t.remove(n,e)}),"files/trash":async()=>({entries:await t.trash()}),"files/restore":async({id:n})=>({path:await t.restore(n,e)}),"files/watch":async({paths:n})=>{for(const h of n)await O(this.root,h);const a=await s.watch(e,n);return this.owners.set(a,e),{watch:a}},"files/unwatch":({watch:n})=>(this.owners.get(n)===e&&(s.unwatch(n),this.owners.delete(n)),Promise.resolve({})),"tools/call":async({name:n,arguments:a})=>({result:await this.runTool(r,n,a)}),"presence/get":()=>Promise.resolve({collaborators:this.presence.list()})}}toolSet(e){const i=this.toolContext(e);return{core:ee(i),context:Z(i)}}async runTool(e,i,t){const s={jsonrpc:c,id:0,method:i,params:t},r=Object.hasOwn(l,i)?void 0:this.contributed.get(i);let n;if(r===void 0)n=await p(l,e.core,s);else{const a=await z(r).catch(h=>{throw new f(d.internal,h instanceof Error?h.message:String(h))});n=await p({[i]:a},{[i]:h=>a.run(h,e.context)},s)}if("error"in n)throw new f(n.error.code,n.error.message,n.error.data);return n.result}hasTool(e){return Object.hasOwn(l,e)||this.contributed.has(e)}toolContext(e){return{live:this.live,checker:this.checker,exports:this.exports,reveal:this.reveal,tree:e,extensions:this.extensions,services:this.services,held:this.held,kindContext:G(this.root,i=>this.hasTool(i),(i,t)=>this.tool(i,t)),inputs:this.inputs,pages:this.pages}}async tool(e,i,t={}){const s=await this.runTool(this.toolSet(()=>t.tree??this.serving?.tree(void 0)),e,i);return Object.hasOwn(l,e)?l[e].result.parse(s):s}async planDeletionOfItem(e){const i=await _(this.root),{listed:t}=await C(this.root,this.live.kinds,i,this.extensions?.fileEditors()??[]),s=t.find(o=>o.id===e);if(s===void 0)throw new f(d.notFound,`There is no item ${e}.`);const r=this.live.latest(),n=new Map((r?.items??[]).map(o=>[o.id,o.files])),a=o=>{const m=!v(o);return{id:o.id,entry:o.entry,ofKind:m,files:m?n.get(o.id):[{path:o.entry}],inputs:[...this.inputs.of(o.id)]}},{work:h}=await F(this.root),{moves:u,stays:b}=L({target:a(s),others:t.filter(o=>o.id!==e).map(a),listed:T(h).map(o=>S(o.file)).filter(o=>o!==s.entry),files:i}),w=r?.pieces.find(o=>o.place===e)?.title;return{item:e,name:g(s,typeof w=="string"?w:void 0),...v(s)?{}:{kind:s.kind},entry:s.entry,moves:u,stays:b}}deleteItemFromSidebar(e,i={}){return this.writer.moveToTrashAndUnlist({planNow:()=>this.planDeletionOfItem(e),keptDays:i.keptDays??H,...i.now===void 0?{}:{now:i.now}},ne)}async close(){this.unhearJobs(),this.presence.close(),this.watcher.close(),this.clients.clear();for(const e of[...this.held.values()].reverse())await Promise.resolve(e.dispose()).catch(()=>{});this.held.clear(),await this.pages.close(),await this.checker?.close(),await this.indexer?.close(),await this.exports.close(),await this.live.close()}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readdir as
|
|
2
|
+
import{readdir as ee,realpath as te,stat as oe}from"node:fs/promises";import{setTimeout as se}from"node:timers/promises";import{join as b,relative as ie,sep as ne}from"node:path";import{openPage as re}from"@allyhub/browser";import{KeyedStore as ae}from"@allyhub/project";import{NEVER_CANCELLED as ce}from"@allyhub/extension-api";import{COMPONENT_STILLS_MAX as z,KindSnapshotSchema as fe,RpcError as H,SNAPSHOT_TREE as p,pieceSourcePath as de,snapshotAnswerPath as v,snapshotPreviewPath as le,stillPath as U,stillsIndexKey as ue,stillsIndexPath as me}from"@allyhub/protocol";import{runtimeFiles as pe}from"@allyhub/stage-page";import{itemPreview as he}from"./card.js";import{kindContext as we,kindItem as ge}from"./kinds.js";import{mediaTypeOf as R}from"@allyhub/formats";import{Reach as ye,pieceBundle as $e,pieceNames as be,reachedCheck as ke,reachedSource as Se}from"./reach.js";import{matteFile as Ee}from"./tree.js";const je="assets/";export const PAGE_RECORDING={width:1440,height:900,timeout:3e4,settle:1500};const x="https://tree.invalid/";function A(n){return typeof n=="string"?n.startsWith(x)?n.slice(x.length):n:Array.isArray(n)?n.map(A):n!==null&&typeof n=="object"?Object.fromEntries(Object.entries(n).map(([w,a])=>[w,A(a)])):n}const j=n=>new TextEncoder().encode(JSON.stringify(n));async function V(n){return(await ee(n,{recursive:!0,withFileTypes:!0}).catch(()=>[])).filter(a=>a.isFile()).map(a=>ie(n,b(a.parentPath,a.name)).split(ne).join("/"))}const Pe=n=>oe(n).then(w=>w.isFile(),()=>!1);export async function recordTree(n,w={}){const{project:a}=n,{live:u,root:g}=a;await a.watcher.settled();const P=new Map,y=(e,t,o=R(e))=>{P.set(e,{path:e,type:o,file:t})},N=(e,t)=>{P.set(e,{path:e,type:R(e),file:t,immutable:!0})},k=(e,t,o=R(e))=>{P.set(e,{path:e,type:o,bytes:t})},I=async(e,t)=>{for(const o of await V(t))y(`${e}${o}`,b(t,o))},X=u.revision,c=await u.prepared(),M=new Map;if(n.ui!==void 0)for(const e of await V(n.ui))(e.startsWith(je)?N:y)(`${p.editor}${e}`,b(n.ui,e));for(const[e,t]of await pe())y(`${p.runtime}${e}`,t);const T=async(e,t)=>{let o;try{o={result:A(await a.tool(e,t,{tree:x}))}}catch(s){o={error:s instanceof H?{code:s.code,message:s.message}:{code:-32603,message:s instanceof Error?s.message:""}}}const i=v(e,t);k(i,j(o));const f=t.item;return typeof f=="string"&&M.set(f,[...M.get(f)??[],i]),o},q=we(g,e=>a.hasTool(e),async(e,t)=>{const o=await T(e,t);if(o.error)throw new H(o.error.code,o.error.message);return o.result}),Q=async(e,t,o)=>{const i=new Map;for(const h of o)i.set(ue(h),h);if(i.size===0)return;const f=ae.of(g,"stills"),s={stills:{}},m=d.of(e),r=[...i];for(let h=0;h<r.length;h+=z){const E=r.slice(h,h+z);(await a.tool("components/stills",{item:e,...t===""?{}:{version:t},components:E.map(([,$])=>$)},{tree:x}).catch(()=>{}))?.stills.forEach(($,Z)=>{const K=E[Z]?.[0];!$||K===void 0||(s.stills[K]=$.key,y(U($.key),f.path(`${$.key}.webp`),"image/webp"),m?.tree.add(U($.key)))})}const l=me(e,t);k(l,j(s),"application/json"),m?.tree.add(l)},_=(await T("project/items",{})).result,O=(_?.items??[]).filter(e=>e.kind!==void 0),Y=new Map(c.items.map(e=>[e.id,e.files])),d=new ye(O.map(e=>({...e,files:Y.get(e.id)??e.files})),c.files,(c.bundle?.beside??[]).map(e=>`${p.build}${e}`)),S=a.checker?.state,C=S===void 0||S.status==="waiting"||S.status==="running"?{status:"off",revision:u.revision,problems:S?.problems??[],facts:S?.facts??[]}:S;k(v("check/results",{}),j({result:C}));for(const e of d.items){const t=d.of(e),o=new Set(c.pieces.filter(s=>s.place===e).map(s=>s.id)),i=O.find(s=>s.id===e)?.entry,f=s=>s===i||d.itemsOf(s).includes(e);t?.own.push({path:v("project/items",{}),type:"application/json",bytes:j({result:{..._,items:O.filter(s=>s.id===e)}})},{path:v("check/results",{}),type:"application/json",bytes:j({result:ke(C,o,f)})})}for(const e of c.bundle?.chunks.files??[])N(`${p.build}${e}`,b(u.pieceDir,e));for(const e of c.bundle?.beside??[])await I(`${p.build}${e}`,b(u.pieceDir,e));const D=new Set(Object.keys(c.media));for(const e of Object.keys(c.media)){const t=Ee(g,c.media[e]);t!==void 0&&await Pe(t)&&y(`${p.matte}${e}`,t,"video/mp4")}const F=new Map,L=new Map,W=e=>({file:(t,o,i)=>{y(`${e}${t}`,o,i)},folder:(t,o)=>I(`${e}${t}`,o),bytes:(t,o,i)=>{k(`${e}${t}`,o,i)},media:t=>{D.add(t)}});for(const e of O){const t=await a.extensions?.kindProvider(e.kind);if(!t?.snapshot)continue;const o=await Promise.resolve(t.snapshot(ge(e),q,ce)).catch(()=>{}),i=fe.safeParse(o??{});if(!i.success)continue;const{stills:f,shows:s,routes:m,page:r}=i.data;r&&F.set(e.id,{...r.folder===void 0?{}:{folder:r.folder},...r.file===void 0?{}:{file:r.file}}),s&&L.set(e.id,{media:new Set(s.media),data:new Set(s.data)});for(const l of f??[])await T("components/stage",{item:e.id,version:l.version}),l.version===""&&await T("components/stage",{item:e.id}),await Q(e.id,l.version,l.components);for(const[l,h]of Object.entries(m??{})){const E=await u.routes.route(l).catch(()=>{});if(E?.route.recordItem)for(const J of h)await E.route.recordItem(J,W(l),E.context).catch(()=>{})}}for(const e of D)y(`${p.media}${e}`,b(g,e));for(const[e,t]of F){const o=await a.tool("items/page",{item:e,...t}).catch(()=>{});if(!o)continue;const i=new URL(o.url).origin,f=await re(await u.browser(),{width:PAGE_RECORDING.width,height:PAGE_RECORDING.height,allow:s=>s===i||s.startsWith(`${i}/`)}).catch(()=>{});if(f)try{await f.goto(o.url,{timeoutMs:PAGE_RECORDING.timeout}),await f.evaluate("document.fonts.ready.then(() => true)",{timeoutMs:PAGE_RECORDING.timeout}),await se(PAGE_RECORDING.settle)}catch{}finally{await f.close()}}for(const e of d.items){const t=d.of(e);if(t)for(const o of a.inputs.of(e))if(o===""||o.endsWith("/"))for(const i of c.files)i.startsWith(o)&&t.files.add(i);else c.files.includes(o)&&t.files.add(o)}for(const e of u.routes.specs.keys()){const t=await u.routes.route(e).catch(()=>{});t?.route.record&&await t.route.record(W(e),t.context).catch(()=>{})}const B=[g,await te(g).catch(()=>g)];for(const e of c.pieces){const t=await u.source(e.id).catch(()=>{});if(!t)continue;const o=$e(c.bundle?.chunks,e.id),i=be({prepared:c,piece:e,reach:d,modules:o.modules,roots:B,reads:a.checker?.reads.get(e.id),shows:L.get(e.place)}),f=c.pieces.filter(r=>r.id!==e.id&&!B.some(l=>o.modules.has(b(l,r.file)))).map(r=>r.id),s=de(e.id);k(s,j(Se(t,i,f)));const m=d.of(e.place);if(m){m.tree.add(s);for(const r of o.files)m.tree.add(`${p.build}${r}`);for(const r of i.media)m.tree.add(`${p.media}${r}`),m.tree.add(`${p.matte}${r}`),m.files.add(r)}}for(const[e,t]of M)for(const o of t)d.of(e)?.tree.add(o);for(const e of c.docs)for(const t of e.shows)d.of(e.place)?.files.add(t);for(const e of c.sheets)for(const t of e.files)d.of(e.place)?.files.add(t);const G=w.preview===!1?void 0:w.preview??(e=>he(n,e));if(G)for(const e of O){const t=await G(e).catch(()=>{});if(t===void 0)continue;const o=le(e.id);k(o,Buffer.from(JSON.stringify(t)),"application/json"),d.of(e.id)?.tree.add(o)}return{revision:X,files:[...P.values()],reach:d.done(new Set(P.keys())),routes:u.routes.loads()}}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{randomBytes as
|
|
3
|
-
`),this.wrote(
|
|
2
|
+
import{randomBytes as q}from"node:crypto";import{mkdir as $,readFile as O,readdir as I,rename as x,rm as N,stat as j,writeFile as A}from"node:fs/promises";import{dirname as g,extname as B,join as h,posix as C}from"node:path";import D from"write-file-atomic";import{listWork as H,moveEdits as z,movedPath as P,unlistedWork as M}from"@allyhub/build";import{CACHE_DIR as K,TRASH_DIR as f,WORK_FILE as S,WorkItemSchema as X}from"@allyhub/formats";import{RPC_ERROR as d,RpcError as p}from"@allyhub/protocol";import{DELETED_FILE as Y,emptyTrashOlderThan as G,hasErrorCode as Q,shortNameOf as V,utcStampOf as Z}from"./deletion.js";import{current as F,fileIn as m,pathProblem as J,versionOf as b}from"./paths.js";import{writeProblems as tt}from"./validate.js";export const UPLOAD_MAX_BYTES=200*1024*1024,LIST_LIMIT=5e3;const et=[K,f];function it(v){const i=(v.split(/[/\\]/u).pop()??"").replace(/\p{Cc}/gu,"").replace(/^\.+/u,"").trim();return i===""?"file":i}export class Writer{root;kinds;wrote;writable;queue=Promise.resolve();constructor(t,i,n=()=>{},o=()=>Promise.resolve()){this.root=t,this.kinds=i,this.wrote=n,this.writable=o}serial(t){const i=async()=>(await this.writable(),t()),n=this.queue.then(i,i);return this.queue=n.catch(()=>{}),n}async read(t){const i=await F(await m(this.root,t));return i?{text:i.bytes.toString("utf8"),version:i.version}:{text:"",version:null}}write(t,i,n,o){return this.serial(async()=>{const s=await m(this.root,t,{write:!0}),a=await F(s),w=a?.version??null;if(w!==n)throw new p(d.conflict,`${t} changed since it was read.`,{text:a?.bytes.toString("utf8")??"",version:w});const c=await tt(t,i,this.kinds,this.root);if(c.length>0)throw new p(d.invalid,`${t} would not be a file AllyHub can read: ${c[0]??""}`,{problems:c});const r=b(i);return r===w||(await $(g(s),{recursive:!0}),await D(s,i),this.wrote([{path:t,version:r,text:i}],o)),r})}upload(t,i,n,o){return n.length>UPLOAD_MAX_BYTES?Promise.reject(new p(d.invalid,`${i} is larger than ${String(UPLOAD_MAX_BYTES/1024/1024)} MB.`)):this.serial(async()=>{const s=it(i),a=B(s),w=s.slice(0,s.length-a.length);for(let c=1;;c++){const r=c===1?s:`${w}-${String(c)}${a}`,e=t===""?r:`${t}/${r}`,u=await m(this.root,e,{write:!0});if(!await y(u))return await $(g(u),{recursive:!0}),await A(u,n,{flag:"wx"}),this.wrote([{path:e,version:b(n)}],o),e}})}move(t,i,n){return this.serial(async()=>{const o=await m(this.root,t,{write:!0}),s=await m(this.root,i,{write:!0});if(i===t||i.startsWith(`${t}/`))throw new p(d.invalid,`${t} cannot move into itself.`);if(!await y(o))throw new p(d.notFound,`There is no ${t}.`);if(await y(s))throw new p(d.conflict,`${i} is taken.`,{text:"",version:null});const a=await z(this.root,t,i);for(const e of a)await D(h(this.root,e.path),e.text);const w=await R(t,o);await $(g(s),{recursive:!0}),await x(o,s);const c=w.map(e=>({path:e,version:null}));for(const e of w){const u=P(e,t,i);c.push({path:u,version:(await F(h(this.root,u)))?.version??null})}const r=a.map(e=>P(e.path,t,i));for(const e of a)P(e.path,t,i)===e.path&&c.push({path:e.path,version:b(e.text)});return this.wrote(c,n),r})}remove(t,i){return this.serial(async()=>{const n=await m(this.root,t,{write:!0});if(!await y(n))throw new p(d.notFound,`There is no ${t}.`);const o=await R(t,n),s=`${String(Date.now())}-${q(4).toString("hex")}`,a=h(this.root,f,s,...t.split("/"));await $(g(a),{recursive:!0}),await x(n,a);const w=o.map(k=>({path:k,version:null})),c=h(this.root,S),r=await O(c,"utf8").catch(()=>{}),e=r===void 0?void 0:M(r,t);e!==void 0&&(await D(c,e.text),w.push({path:S,version:b(e.text)}));const u={path:t,removed:Date.now(),...e===void 0?{}:{listed:e.items}};return await A(h(this.root,f,`${s}.json`),`${JSON.stringify(u)}
|
|
3
|
+
`),this.wrote(w,i),s})}moveToTrashAndUnlist(t,i){return this.serial(async()=>{const n=await t.planNow(),{item:o,name:s,kind:a,entry:w}=n,c=(t.now??(()=>new Date))();await G(this.root,t.keptDays,c);const r=`${Z(c)}-${V(o)}`;let e=`${f}/${r}`;for(let l=2;await y(h(this.root,e));l++)e=`${f}/${r}-${String(l)}`;const u=h(this.root,S),k=await O(u,"utf8").catch(l=>{if(!Q(l,"ENOENT"))throw l}),T=k===void 0?void 0:M(k,w),W=[];try{for(const l of n.moves){const E=await m(this.root,l,{write:!0}),L=h(this.root,e,...l.split("/"));await $(g(L),{recursive:!0}),await x(E,L),W.push(l)}}catch(l){for(const E of W.reverse())await x(h(this.root,e,...E.split("/")),h(this.root,...E.split("/")));throw await N(h(this.root,e),{recursive:!0,force:!0}),l}const U={deletedAt:c.toISOString(),item:o,name:s,...a===void 0?{}:{kind:a},listed:T?.entries??[],files:n.moves.map(l=>({path:l}))};await $(h(this.root,e),{recursive:!0}),await A(h(this.root,e,Y),`${JSON.stringify(U,null,2)}
|
|
4
|
+
`);const _=n.moves.map(l=>({path:l,version:null}));return T!==void 0&&(await D(u,T.text),_.push({path:S,version:b(T.text)})),this.wrote(_,i),{plan:n,trash:e,moved:n.moves}})}async trash(){const t=h(this.root,f),i=await I(t).catch(()=>[]),n=[];for(const o of i){if(!o.endsWith(".json"))continue;const s=await O(h(t,o),"utf8").then(a=>JSON.parse(a)).catch(()=>{});typeof s?.path!="string"||typeof s.removed!="number"||J(s.path)!==void 0||n.push({id:o.slice(0,-5),path:s.path,removed:s.removed})}return n.sort((o,s)=>s.removed-o.removed)}restore(t,i){return this.serial(async()=>{const n=(await this.trash()).find(e=>e.id===t);if(!n)throw new p(d.notFound,`Nothing in the bin is ${t}.`);const o=await m(this.root,n.path,{write:!0});if(await y(o))throw new p(d.conflict,`${n.path} is there again: move it before putting this back.`,{text:"",version:null});const s=h(this.root,f,t,...n.path.split("/")),a=await O(h(this.root,f,`${t}.json`),"utf8").then(e=>JSON.parse(e).listed).catch(()=>{});await $(g(o),{recursive:!0}),await x(s,o),await N(h(this.root,f,t),{recursive:!0,force:!0}),await N(h(this.root,f,`${t}.json`),{force:!0});const w=await R(n.path,o),c=(Array.isArray(a)?a:[]).flatMap(e=>{const u=X.safeParse(e);return u.success?[u.data]:[]});for(const e of c)await H(this.root,e);c.length>0&&w.push(S);const r=[];for(const e of w)r.push({path:e,version:(await F(h(this.root,e)))?.version??null});return this.wrote(r,i),n.path})}async list(t){const i=t===""?this.root:await m(this.root,t),n=[],o=[],s=async(a,w)=>{const c=await I(a,{withFileTypes:!0}).catch(()=>[]);for(const r of c.sort((e,u)=>e.name.localeCompare(u.name))){if(n.length>=LIST_LIMIT)return;const e=w===""?r.name:`${w}/${r.name}`;if(J(e)===void 0&&!(et.some(u=>e===u)&&!(t===e||t.startsWith(`${e}/`)))){if(r.isDirectory())o.push(e),await s(h(a,r.name),e);else if(r.isFile()){const u=await j(h(a,r.name)).catch(()=>{});u&&n.push({path:e,size:u.size,modified:u.mtimeMs})}}}};return await s(i,t),{files:n,dirs:o}}}const y=v=>j(v).then(()=>!0,()=>!1);async function R(v,t){const i=await j(t).catch(()=>{});if(!i)return[];if(!i.isDirectory())return[v];const n=[],o=await I(t,{recursive:!0,withFileTypes:!0});for(const s of o)s.isFile()&&n.push(C.join(v,C.relative(t.split("\\").join("/"),h(s.parentPath,s.name).split("\\").join("/"))));return n}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFile as D}from"node:fs/promises";import{join as E,relative as y,sep as S}from"node:path";import{z as o}from"zod";import{PROJECT_DIR as T,allFindings as C,defineView as O}from"@allyhub/build";import{countFacts as _,filterFacts as I}from"@allyhub/diagnostics";import{blockNumbers as G,everyBlock as K,parseDoc as N}from"@allyhub/doc";import{DocPageError as z,PAGE_FACT_DEFAULTS as k,PAGE_FACT_KINDS as p,blockLines as B,docPages as R,pageFacts as J}from"@allyhub/doc-print";import{dirOf as M,itemIdOf as U}from"@allyhub/formats";import{CommandError as f,EXIT as h}from"@allyhub/protocol";import{findDoc as V,fromBuild as W,pagesOf as X}from"./cli/find.js";import{looks as q,picturePath as H,save as Q,workPath as Y}from"./cli/pictures.js";const $=(e,i)=>`${String(e)} ${i}${e===1?"":"s"}`,Z=O({input:o.strictObject({doc:o.string().describe("The doc, by its file or its id in allyhub.yaml"),kind:o.array(o.string()).optional().describe(`Only facts of these kinds: ${p.join(", ")}`),headingLines:o.number().int().min(1).default(k.headingLines).describe("A heading is listed when fewer lines than this follow it on its page"),shortLine:o.number().int().min(0).default(k.shortChars).describe("A paragraph's last line is listed when it holds this many letters or fewer (punctuation not counted)"),all:C("every heading and every paragraph's last line"),page:o.string().optional().describe("Draw only these pages, large: 2, 2-4, 1,5"),out:o.string().optional().describe("Where the picture goes; default .allyhub/work/inspect/<doc>/pages.webp"),dir:T}),positional:["doc"],examples:["allyhub inspect pages launch/plan","allyhub inspect pages launch/plan --kind page-split,page-heading","allyhub inspect pages launch/plan --page 3-4 --all"],async run(e,i){const s=await i.root(e.dir),r=await V(s,i.cwd,e.doc);if(r===void 0)throw new f("not-found",`${e.doc} is not a doc.`,{exit:h.notFound,hint:"Name a doc by its file or its id in allyhub.yaml."});for(const t of e.kind??[])if(!p.includes(t))throw new f("bad-kind",`A doc's pages give no fact of kind ${t}.`,{exit:h.usage,hint:`Kinds: ${p.join(", ")}.`});const c=y(s,r).split(S).join("/"),a=U(c),l=N(await D(r,"utf8")),F=B(l),{stills:j,measures:v,data:u,sources:L}=await W(r,a,t=>i.session(s,t)),g=new Map;for(const[t,P]of G(l.blocks)){const
|
|
2
|
+
import{readFile as D}from"node:fs/promises";import{join as E,relative as y,sep as S}from"node:path";import{z as o}from"zod";import{PROJECT_DIR as T,allFindings as C,defineView as O}from"@allyhub/build";import{countFacts as _,filterFacts as I}from"@allyhub/diagnostics";import{blockNumbers as G,everyBlock as K,parseDoc as N}from"@allyhub/doc";import{DocPageError as z,PAGE_FACT_DEFAULTS as k,PAGE_FACT_KINDS as p,blockLines as B,docPages as R,pageFacts as J}from"@allyhub/doc-print";import{dirOf as M,itemIdOf as U}from"@allyhub/formats";import{CommandError as f,EXIT as h}from"@allyhub/protocol";import{findDoc as V,fromBuild as W,pagesOf as X}from"./cli/find.js";import{looks as q,picturePath as H,save as Q,workPath as Y}from"./cli/pictures.js";const $=(e,i)=>`${String(e)} ${i}${e===1?"":"s"}`,Z=O({input:o.strictObject({doc:o.string().describe("The doc, by its file or its id in allyhub.yaml"),kind:o.array(o.string()).optional().describe(`Only facts of these kinds: ${p.join(", ")}`),headingLines:o.number().int().min(1).default(k.headingLines).describe("A heading is listed when fewer lines than this follow it on its page"),shortLine:o.number().int().min(0).default(k.shortChars).describe("A paragraph's last line is listed when it holds this many letters or fewer (punctuation not counted)"),all:C("every heading and every paragraph's last line"),page:o.string().optional().describe("Draw only these pages, large: 2, 2-4, 1,5"),out:o.string().optional().describe("Where the picture goes; default .allyhub/work/inspect/<doc>/pages.webp"),dir:T}),positional:["doc"],examples:["allyhub inspect pages launch/plan","allyhub inspect pages launch/plan --kind page-split,page-heading","allyhub inspect pages launch/plan --page 3-4 --all"],async run(e,i){const s=await i.root(e.dir),r=await V(s,i.cwd,e.doc);if(r===void 0)throw new f("not-found",`${e.doc} is not a doc.`,{exit:h.notFound,hint:"Name a doc by its file or its id in allyhub.yaml."});for(const t of e.kind??[])if(!p.includes(t))throw new f("bad-kind",`A doc's pages give no fact of kind ${t}.`,{exit:h.usage,hint:`Kinds: ${p.join(", ")}.`});const c=y(s,r).split(S).join("/"),a=U(c),l=N(await D(r,"utf8")),F=B(l),{stills:j,measures:v,data:u,sources:L}=await W(r,a,t=>i.session(s,t)),g=new Map;for(const[t,P]of G(l.blocks)){const b=F.get(t);b!==void 0&&t.type!=="columns"&&g.set(P,String(b))}const A=e.page===void 0?void 0:X(e.page);let n;try{n=await R({root:s,doc:{file:c,dir:M(c),path:a,...u===void 0?{}:{data:u},sources:L},pages:A,stills:j,format:q(),outlines:g,onFetch:()=>{i.progress("Getting pdf.js, once, to draw a doc's pages…")}})}catch(t){throw t instanceof z?new f("not-found",t.message,{exit:h.notFound,hint:`Pages are 1 to ${String(t.count)}.`}):t}const m=J(l,n.layout,a,{headingLines:e.headingLines,shortChars:e.shortLine,all:e.all},[...K(l.blocks)].some(t=>t.type==="toc")?n.printing:void 0,v),d=I(m,{kinds:i.factKinds(e.kind,s)}),w=await Q(H(i.cwd,e.out,E(Y(s,"inspect",a),"pages.png")),n.picture);return{value:{doc:a,pages:n.count,paper:n.paper,picture:w,facts:d,counts:_(d),total:m.length},text:[`${a}: ${$(n.count,"page")} of ${String(n.paper.width)} × ${String(n.paper.height)} mm. The picture: ${y(i.cwd,w)} (each block outlined and labelled by its line in the doc's file, the space at each page's foot shaded).`,`${$(d.length,"fact")}: measurements for you to judge; sizes are mm on the paper, lines are its file's; --json has every one.`,...i.factLines(d,{all:e.all})].join(`
|
|
3
3
|
`)}}}),x={pages:Z};export default x;
|