@capyclaw/ppt-suite 2.4.10 → 2.5.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -42
- package/composition.lock.json +46 -70
- package/contract/ppt-contract.json +310 -11
- package/cordis.patch.yml +5 -25
- package/dsh-suite.json +108 -194
- package/lib/index.mjs +1 -1
- package/node_modules/@capyclaw/asset-service/README.md +48 -0
- package/node_modules/@capyclaw/asset-service/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/asset-service/dsh-suite.json +29 -0
- package/node_modules/@capyclaw/asset-service/lib/host.mjs +14 -0
- package/node_modules/@capyclaw/asset-service/package.json +59 -0
- package/node_modules/@capyclaw/asset-service/src/index.mjs +304 -0
- package/node_modules/@capyclaw/document-workbench/README.md +125 -0
- package/node_modules/@capyclaw/document-workbench/package.json +44 -0
- package/node_modules/@capyclaw/document-workbench/src/bridge/index.mjs +321 -0
- package/node_modules/@capyclaw/document-workbench/src/client/index.mjs +625 -0
- package/node_modules/@capyclaw/document-workbench/src/client/screenshot.mjs +98 -0
- package/node_modules/@capyclaw/document-workbench/src/index.mjs +9 -0
- package/node_modules/@capyclaw/document-workbench/src/model/audit.mjs +101 -0
- package/node_modules/@capyclaw/document-workbench/src/model/conformance.mjs +92 -0
- package/node_modules/@capyclaw/document-workbench/src/model/ids.mjs +56 -0
- package/node_modules/@capyclaw/document-workbench/src/model/index.mjs +18 -0
- package/node_modules/@capyclaw/document-workbench/src/model/locate.mjs +118 -0
- package/node_modules/@capyclaw/document-workbench/src/model/manifest.mjs +148 -0
- package/node_modules/@capyclaw/document-workbench/src/model/ops.mjs +160 -0
- package/node_modules/@capyclaw/document-workbench/src/model/validate.mjs +72 -0
- package/node_modules/@capyclaw/document-workbench/src/ops/index.mjs +93 -0
- package/node_modules/@capyclaw/document-workbench/src/session/context.mjs +103 -0
- package/node_modules/@capyclaw/document-workbench/src/session/index.mjs +394 -0
- package/node_modules/@capyclaw/document-workbench/src/session/lease.mjs +105 -0
- package/node_modules/@capyclaw/document-workbench/src/session/mode.mjs +80 -0
- package/node_modules/@capyclaw/document-workbench/src/session/sanitize.mjs +107 -0
- package/node_modules/@capyclaw/document-workbench/src/session/state.mjs +159 -0
- package/node_modules/@capyclaw/document-workbench/src/session/watch.mjs +63 -0
- package/node_modules/@capyclaw/document-workbench/src/store/file-backend.mjs +158 -0
- package/node_modules/@capyclaw/document-workbench/src/testing/index.mjs +75 -0
- package/node_modules/@capyclaw/editor-host/README.md +37 -0
- package/node_modules/@capyclaw/editor-host/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/editor-host/dsh-suite.json +29 -0
- package/node_modules/@capyclaw/editor-host/lib/host.mjs +14 -0
- package/node_modules/@capyclaw/editor-host/package.json +59 -0
- package/node_modules/@capyclaw/editor-host/src/index.mjs +164 -0
- package/node_modules/@capyclaw/foundation/README.md +51 -0
- package/node_modules/@capyclaw/foundation/abi/bridge.mjs +86 -0
- package/node_modules/@capyclaw/foundation/abi/errors.mjs +63 -0
- package/node_modules/@capyclaw/foundation/abi/index.mjs +35 -0
- package/node_modules/@capyclaw/foundation/abi/kinds.mjs +271 -0
- package/node_modules/@capyclaw/foundation/abi/loader.mjs +345 -0
- package/node_modules/@capyclaw/foundation/abi/schema.mjs +98 -0
- package/node_modules/@capyclaw/foundation/abi/spec.mjs +255 -0
- package/node_modules/@capyclaw/foundation/abi/validate.mjs +24 -0
- package/node_modules/@capyclaw/foundation/abi/version.mjs +82 -0
- package/node_modules/@capyclaw/foundation/cordis.patch.yml +5 -0
- package/node_modules/@capyclaw/foundation/kit/index.mjs +6 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/client-panel.mjs +98 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/host-event.mjs +35 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/http-router.mjs +69 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +55 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +113 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +69 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +120 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/service-provider.mjs +77 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/skill-provider.mjs +56 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/tool-provider.mjs +50 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/ui-panel.mjs +64 -0
- package/node_modules/@capyclaw/foundation/lib/ctx-service.mjs +42 -0
- package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +34 -0
- package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +85 -0
- package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +50 -0
- package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +160 -0
- package/node_modules/@capyclaw/foundation/lib/host.mjs +23 -0
- package/node_modules/@capyclaw/foundation/lib/kernel.mjs +185 -0
- package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +115 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/events.mjs +60 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/log.mjs +51 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +188 -0
- package/node_modules/@capyclaw/foundation/package.json +53 -0
- package/node_modules/@capyclaw/foundation/runtime/index.mjs +20 -0
- package/node_modules/@capyclaw/plugin-kit/INTEGRATION.md +100 -0
- package/node_modules/@capyclaw/plugin-kit/README.md +70 -0
- package/node_modules/@capyclaw/plugin-kit/bin/sync.mjs +103 -0
- package/node_modules/@capyclaw/plugin-kit/package.json +69 -0
- package/node_modules/@capyclaw/plugin-kit/src/cli.mjs +56 -0
- package/node_modules/@capyclaw/plugin-kit/src/config.mjs +142 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +129 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +58 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/shadow.mjs +219 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/transport.js +13 -0
- package/node_modules/@capyclaw/plugin-kit/src/index.mjs +13 -0
- package/node_modules/@capyclaw/plugin-kit/src/pack.mjs +230 -0
- package/node_modules/@capyclaw/plugin-kit/src/runtime/context.mjs +128 -0
- package/node_modules/@capyclaw/plugin-kit/src/self-contained.mjs +307 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/api.mjs +45 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/http.mjs +113 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +150 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/server.mjs +131 -0
- package/node_modules/@capyclaw/plugin-kit/src/skills/provider.mjs +82 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/blob-store.mjs +109 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/content-store.mjs +17 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/journal-store.mjs +89 -0
- package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +57 -0
- package/node_modules/@capyclaw/plugin-kit/src/tools/validate.mjs +150 -0
- package/node_modules/@capyclaw/plugin-kit/src/tuning.mjs +82 -0
- package/node_modules/@capyclaw/plugin-kit/src/util/fs-lock.mjs +132 -0
- package/node_modules/@capyclaw/plugin-kit/src/util/http.mjs +130 -0
- package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +656 -0
- package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +181 -0
- package/node_modules/@capyclaw/portal/README.md +70 -0
- package/node_modules/@capyclaw/portal/lib/index.mjs +387 -0
- package/node_modules/@capyclaw/portal/lib/ledger.mjs +194 -0
- package/node_modules/@capyclaw/portal/lib/portal-agent.ps1 +811 -0
- package/node_modules/@capyclaw/portal/lib/portal-darwin.mjs +183 -0
- package/node_modules/@capyclaw/portal/package.json +40 -0
- package/node_modules/@capyclaw/ppt-editor/LICENSE +661 -0
- package/node_modules/@capyclaw/ppt-editor/README.md +86 -0
- package/node_modules/@capyclaw/ppt-editor/THIRD_PARTY_NOTICES.md +21 -0
- package/node_modules/@capyclaw/ppt-editor/app.js +6298 -0
- package/node_modules/@capyclaw/ppt-editor/contract/ppt-contract.json +1828 -0
- package/node_modules/@capyclaw/ppt-editor/heartbeat-worker.js +129 -0
- package/node_modules/@capyclaw/ppt-editor/index.html +176 -0
- package/node_modules/@capyclaw/ppt-editor/lib/index.mjs +8 -0
- package/node_modules/@capyclaw/ppt-editor/package.json +57 -0
- package/node_modules/@capyclaw/ppt-editor/ppt-full-app.js +381 -0
- package/node_modules/@capyclaw/ppt-skill-api/README.md +3 -0
- package/node_modules/@capyclaw/ppt-skill-api/contract/ppt-contract.json +1828 -0
- package/node_modules/@capyclaw/ppt-skill-api/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/ppt-skill-api/package.json +49 -0
- package/node_modules/@capyclaw/ppt-skill-api/plugin.mjs +15 -0
- package/node_modules/@capyclaw/ppt-skill-api/skills/pptist-api/SKILL.md +137 -0
- package/node_modules/@capyclaw/ppt-skill-api/skills/pptist-api/references/tool-contract.md +1646 -0
- package/node_modules/@capyclaw/ppt-skill-api/skills/pptist-api/references/visual-qa.md +28 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/README.md +3 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/contract/ppt-contract.json +1828 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/package.json +49 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/plugin.mjs +15 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/SKILL.md +83 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/anti-ai-slop.md +18 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/deck-structure.md +42 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/design-tokens.md +36 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/layout-system.md +30 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/page-craft.md +31 -0
- package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/scqa-pyramid.md +26 -0
- package/node_modules/@capyclaw/ppt-workbench/LICENSE +661 -0
- package/node_modules/@capyclaw/ppt-workbench/README.md +173 -0
- package/node_modules/@capyclaw/ppt-workbench/THIRD_PARTY_NOTICES.md +21 -0
- package/node_modules/@capyclaw/ppt-workbench/contract/ppt-contract.json +1828 -0
- package/node_modules/@capyclaw/ppt-workbench/core/audit.js +507 -0
- package/node_modules/@capyclaw/ppt-workbench/core/chart.js +199 -0
- package/node_modules/@capyclaw/ppt-workbench/core/color.js +170 -0
- package/node_modules/@capyclaw/ppt-workbench/core/deck-layout.js +375 -0
- package/node_modules/@capyclaw/ppt-workbench/core/formula.js +80 -0
- package/node_modules/@capyclaw/ppt-workbench/core/hfmath/hershey.js +1763 -0
- package/node_modules/@capyclaw/ppt-workbench/core/hfmath/index.js +1176 -0
- package/node_modules/@capyclaw/ppt-workbench/core/hfmath/stretch.js +41 -0
- package/node_modules/@capyclaw/ppt-workbench/core/hfmath/symbols.js +408 -0
- package/node_modules/@capyclaw/ppt-workbench/core/inspect.js +366 -0
- package/node_modules/@capyclaw/ppt-workbench/core/manuscript/compare.mjs +103 -0
- package/node_modules/@capyclaw/ppt-workbench/core/manuscript/compile.mjs +322 -0
- package/node_modules/@capyclaw/ppt-workbench/core/manuscript/edit.mjs +239 -0
- package/node_modules/@capyclaw/ppt-workbench/core/manuscript/parse.mjs +346 -0
- package/node_modules/@capyclaw/ppt-workbench/core/manuscript/render-html.mjs +84 -0
- package/node_modules/@capyclaw/ppt-workbench/core/manuscript/sync.mjs +101 -0
- package/node_modules/@capyclaw/ppt-workbench/core/measure.js +104 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/browser.js +28 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/chart.js +64 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/deck.js +21 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/element.js +55 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/history.js +11 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/import.js +95 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/index.js +39 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/playback.js +9 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/recolor.js +87 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/slide.js +66 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/table.js +85 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/text.js +35 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops/view.js +13 -0
- package/node_modules/@capyclaw/ppt-workbench/core/ops.js +12 -0
- package/node_modules/@capyclaw/ppt-workbench/core/quick.js +52 -0
- package/node_modules/@capyclaw/ppt-workbench/core/shape-library.js +122 -0
- package/node_modules/@capyclaw/ppt-workbench/core/table.js +178 -0
- package/node_modules/@capyclaw/ppt-workbench/core/text.js +200 -0
- package/node_modules/@capyclaw/ppt-workbench/lib/host.mjs +1 -0
- package/node_modules/@capyclaw/ppt-workbench/package.json +73 -0
- package/node_modules/@capyclaw/ppt-workbench/plugin.mjs +1 -0
- package/node_modules/@capyclaw/ppt-workbench/server/audit.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/bridge-client.mjs +308 -0
- package/node_modules/@capyclaw/ppt-workbench/server/constants.mjs +21 -0
- package/node_modules/@capyclaw/ppt-workbench/server/contract-snapshots.mjs +89 -0
- package/node_modules/@capyclaw/ppt-workbench/server/contract.mjs +24 -0
- package/node_modules/@capyclaw/ppt-workbench/server/deck-layout.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/editor-assets.mjs +132 -0
- package/node_modules/@capyclaw/ppt-workbench/server/embedded-host.mjs +252 -0
- package/node_modules/@capyclaw/ppt-workbench/server/http-utils.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/infra/http.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/infra/runtime/context.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/infra/store/blob-store.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/infra/tuning.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/infra/util/fs-lock.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/infra/workspace/manager.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/mcp/dispatch.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/mcp/handler.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/mcp/instructions.mjs +66 -0
- package/node_modules/@capyclaw/ppt-workbench/server/ppt-shim.mjs +168 -0
- package/node_modules/@capyclaw/ppt-workbench/server/relay.mjs +282 -0
- package/node_modules/@capyclaw/ppt-workbench/server/routes/assets.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/routes/bridge.mjs +74 -0
- package/node_modules/@capyclaw/ppt-workbench/server/routes/editor.mjs +9 -0
- package/node_modules/@capyclaw/ppt-workbench/server/routes/import.mjs +260 -0
- package/node_modules/@capyclaw/ppt-workbench/server/routes/manuscript.mjs +414 -0
- package/node_modules/@capyclaw/ppt-workbench/server/routes/mcp.mjs +17 -0
- package/node_modules/@capyclaw/ppt-workbench/server/routes/session.mjs +36 -0
- package/node_modules/@capyclaw/ppt-workbench/server/runtime/recovery.mjs +9 -0
- package/node_modules/@capyclaw/ppt-workbench/server/runtime/watch.mjs +17 -0
- package/node_modules/@capyclaw/ppt-workbench/server/session-context.mjs +5 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/SHARED_MANIFEST.json +70 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/asset-service.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/editor-host.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/editor/lease.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/service/api.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/service/http.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/service/mcp-http.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/tools/validate.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/tuning.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/util/fs-lock.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/service-host.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/tool-host.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/shared/tuning.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/backends/file-backend.mjs +13 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/checkpoints.mjs +28 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/deck-sanitize.mjs +68 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/doc.mjs +56 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/index.mjs +34 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/journal.mjs +9 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/lease.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/sanitize.mjs +33 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/sessions.mjs +314 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/apply.mjs +33 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/audit.mjs +28 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/chart.mjs +83 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/compose.mjs +97 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/contract.mjs +38 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/deck.mjs +27 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/element.mjs +67 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/export.mjs +99 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/formula.mjs +72 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/history.mjs +29 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/image.mjs +174 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/imagesearch.mjs +203 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/import.mjs +180 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/index.mjs +64 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/inspect.mjs +46 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/line.mjs +58 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/manuscript.mjs +208 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/notes.mjs +33 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/present.mjs +34 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/recolor.mjs +62 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/screenshot.mjs +191 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/shape.mjs +64 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/slide.mjs +81 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/style.mjs +48 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/table.mjs +127 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/task.mjs +52 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/text.mjs +82 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/color.mjs +4 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/image.mjs +78 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/index.mjs +7 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/manuscript-media.mjs +159 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/offline-render.mjs +256 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/pptx-export.mjs +577 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/recolor.mjs +25 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/remote-image.mjs +443 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/slide.mjs +21 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/text-style.mjs +11 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/tooling.mjs +13 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/index.mjs +14 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/kernel/define.mjs +5 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/kernel/ports.mjs +52 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/kernel/registry.mjs +17 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools/model/deck-schema.mjs +105 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tools.mjs +18 -0
- package/node_modules/@capyclaw/ppt-workbench/server/tuning.mjs +93 -0
- package/node_modules/@capyclaw/ppt-workbench/server/validate.mjs +2 -0
- package/node_modules/@capyclaw/ppt-workbench/server/workbench-framework.mjs +305 -0
- package/node_modules/@capyclaw/service-broker/README.md +104 -0
- package/node_modules/@capyclaw/service-broker/cordis.patch.yml +8 -0
- package/node_modules/@capyclaw/service-broker/dsh-suite.json +21 -0
- package/node_modules/@capyclaw/service-broker/lib/control.mjs +193 -0
- package/node_modules/@capyclaw/service-broker/lib/discovery.mjs +109 -0
- package/node_modules/@capyclaw/service-broker/lib/engine.mjs +1236 -0
- package/node_modules/@capyclaw/service-broker/lib/host.mjs +182 -0
- package/node_modules/@capyclaw/service-broker/lib/manifest.mjs +249 -0
- package/node_modules/@capyclaw/service-broker/lib/recovery.mjs +275 -0
- package/node_modules/@capyclaw/service-broker/lib/skills-client.mjs +28 -0
- package/node_modules/@capyclaw/service-broker/lib/spec.mjs +78 -0
- package/node_modules/@capyclaw/service-broker/package.json +65 -0
- package/node_modules/@capyclaw/service-broker/server.mjs +81 -0
- package/node_modules/@capyclaw/service-broker/service.schema.json +62 -0
- package/node_modules/@capyclaw/service-broker/services.json +3 -0
- package/node_modules/@capyclaw/service-host/README.md +86 -0
- package/node_modules/@capyclaw/service-host/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/service-host/dsh-suite.json +29 -0
- package/node_modules/@capyclaw/service-host/lib/host.mjs +22 -0
- package/node_modules/@capyclaw/service-host/package.json +60 -0
- package/node_modules/@capyclaw/service-host/src/index.mjs +571 -0
- package/node_modules/@capyclaw/service-host/src/tuning.mjs +63 -0
- package/node_modules/@capyclaw/skills-service/README.md +31 -0
- package/node_modules/@capyclaw/skills-service/package.json +30 -0
- package/node_modules/@capyclaw/skills-service/server.mjs +237 -0
- package/node_modules/@capyclaw/tool-host/README.md +56 -0
- package/node_modules/@capyclaw/tool-host/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/tool-host/dsh-suite.json +30 -0
- package/node_modules/@capyclaw/tool-host/lib/host.mjs +16 -0
- package/node_modules/@capyclaw/tool-host/package.json +59 -0
- package/node_modules/@capyclaw/tool-host/src/descriptors.mjs +166 -0
- package/node_modules/@capyclaw/tool-host/src/index.mjs +416 -0
- package/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/node/README.md +15 -0
- package/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@types/node/assert.d.ts +1005 -0
- package/node_modules/@types/node/async_hooks.d.ts +586 -0
- package/node_modules/@types/node/buffer.buffer.d.ts +457 -0
- package/node_modules/@types/node/buffer.d.ts +1901 -0
- package/node_modules/@types/node/child_process.d.ts +1453 -0
- package/node_modules/@types/node/cluster.d.ts +578 -0
- package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
- package/node_modules/@types/node/console.d.ts +452 -0
- package/node_modules/@types/node/constants.d.ts +21 -0
- package/node_modules/@types/node/crypto.d.ts +4504 -0
- package/node_modules/@types/node/dgram.d.ts +596 -0
- package/node_modules/@types/node/diagnostics_channel.d.ts +551 -0
- package/node_modules/@types/node/dns/promises.d.ts +477 -0
- package/node_modules/@types/node/dns.d.ts +860 -0
- package/node_modules/@types/node/domain.d.ts +170 -0
- package/node_modules/@types/node/events.d.ts +863 -0
- package/node_modules/@types/node/fs/promises.d.ts +1208 -0
- package/node_modules/@types/node/fs.d.ts +4332 -0
- package/node_modules/@types/node/globals.d.ts +170 -0
- package/node_modules/@types/node/globals.typedarray.d.ts +21 -0
- package/node_modules/@types/node/http.d.ts +1919 -0
- package/node_modules/@types/node/http2.d.ts +2580 -0
- package/node_modules/@types/node/https.d.ts +549 -0
- package/node_modules/@types/node/index.d.ts +92 -0
- package/node_modules/@types/node/inspector.generated.d.ts +2775 -0
- package/node_modules/@types/node/module.d.ts +503 -0
- package/node_modules/@types/node/net.d.ts +924 -0
- package/node_modules/@types/node/os.d.ts +480 -0
- package/node_modules/@types/node/package.json +145 -0
- package/node_modules/@types/node/path.d.ts +191 -0
- package/node_modules/@types/node/perf_hooks.d.ts +860 -0
- package/node_modules/@types/node/process.d.ts +1632 -0
- package/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/node/querystring.d.ts +140 -0
- package/node_modules/@types/node/readline/promises.d.ts +154 -0
- package/node_modules/@types/node/readline.d.ts +715 -0
- package/node_modules/@types/node/repl.d.ts +430 -0
- package/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/node_modules/@types/node/stream/web.d.ts +527 -0
- package/node_modules/@types/node/stream.d.ts +1680 -0
- package/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/node/test.d.ts +1208 -0
- package/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/node_modules/@types/node/timers.d.ts +286 -0
- package/node_modules/@types/node/tls.d.ts +1204 -0
- package/node_modules/@types/node/trace_events.d.ts +171 -0
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +455 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +92 -0
- package/node_modules/@types/node/tty.d.ts +206 -0
- package/node_modules/@types/node/url.d.ts +957 -0
- package/node_modules/@types/node/util.d.ts +2083 -0
- package/node_modules/@types/node/v8.d.ts +753 -0
- package/node_modules/@types/node/vm.d.ts +704 -0
- package/node_modules/@types/node/wasi.d.ts +160 -0
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/events.d.ts +81 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +38 -0
- package/node_modules/@types/node/worker_threads.d.ts +698 -0
- package/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/core-util-is/LICENSE +19 -0
- package/node_modules/core-util-is/README.md +3 -0
- package/node_modules/core-util-is/lib/util.js +107 -0
- package/node_modules/core-util-is/package.json +38 -0
- package/node_modules/https/package.json +15 -0
- package/node_modules/image-size/LICENSE +9 -0
- package/node_modules/image-size/Readme.md +184 -0
- package/node_modules/image-size/bin/image-size.js +53 -0
- package/node_modules/image-size/dist/detector.d.ts +2 -0
- package/node_modules/image-size/dist/detector.js +30 -0
- package/node_modules/image-size/dist/index.d.ts +10 -0
- package/node_modules/image-size/dist/index.js +129 -0
- package/node_modules/image-size/dist/types/bmp.d.ts +2 -0
- package/node_modules/image-size/dist/types/bmp.js +11 -0
- package/node_modules/image-size/dist/types/cur.d.ts +2 -0
- package/node_modules/image-size/dist/types/cur.js +17 -0
- package/node_modules/image-size/dist/types/dds.d.ts +2 -0
- package/node_modules/image-size/dist/types/dds.js +11 -0
- package/node_modules/image-size/dist/types/gif.d.ts +2 -0
- package/node_modules/image-size/dist/types/gif.js +12 -0
- package/node_modules/image-size/dist/types/heif.d.ts +2 -0
- package/node_modules/image-size/dist/types/heif.js +40 -0
- package/node_modules/image-size/dist/types/icns.d.ts +2 -0
- package/node_modules/image-size/dist/types/icns.js +101 -0
- package/node_modules/image-size/dist/types/ico.d.ts +2 -0
- package/node_modules/image-size/dist/types/ico.js +68 -0
- package/node_modules/image-size/dist/types/index.d.ts +23 -0
- package/node_modules/image-size/dist/types/index.js +46 -0
- package/node_modules/image-size/dist/types/interface.d.ts +13 -0
- package/node_modules/image-size/dist/types/interface.js +2 -0
- package/node_modules/image-size/dist/types/j2c.d.ts +2 -0
- package/node_modules/image-size/dist/types/j2c.js +12 -0
- package/node_modules/image-size/dist/types/jp2.d.ts +2 -0
- package/node_modules/image-size/dist/types/jp2.js +27 -0
- package/node_modules/image-size/dist/types/jpg.d.ts +2 -0
- package/node_modules/image-size/dist/types/jpg.js +123 -0
- package/node_modules/image-size/dist/types/jxl-stream.d.ts +2 -0
- package/node_modules/image-size/dist/types/jxl-stream.js +45 -0
- package/node_modules/image-size/dist/types/jxl.d.ts +2 -0
- package/node_modules/image-size/dist/types/jxl.js +59 -0
- package/node_modules/image-size/dist/types/ktx.d.ts +2 -0
- package/node_modules/image-size/dist/types/ktx.js +19 -0
- package/node_modules/image-size/dist/types/png.d.ts +2 -0
- package/node_modules/image-size/dist/types/png.js +35 -0
- package/node_modules/image-size/dist/types/pnm.d.ts +2 -0
- package/node_modules/image-size/dist/types/pnm.js +72 -0
- package/node_modules/image-size/dist/types/psd.d.ts +2 -0
- package/node_modules/image-size/dist/types/psd.js +11 -0
- package/node_modules/image-size/dist/types/svg.d.ts +2 -0
- package/node_modules/image-size/dist/types/svg.js +90 -0
- package/node_modules/image-size/dist/types/tga.d.ts +2 -0
- package/node_modules/image-size/dist/types/tga.js +15 -0
- package/node_modules/image-size/dist/types/tiff.d.ts +2 -0
- package/node_modules/image-size/dist/types/tiff.js +95 -0
- package/node_modules/image-size/dist/types/utils.d.ts +15 -0
- package/node_modules/image-size/dist/types/utils.js +75 -0
- package/node_modules/image-size/dist/types/webp.d.ts +2 -0
- package/node_modules/image-size/dist/types/webp.js +60 -0
- package/node_modules/image-size/dist/utils/bit-reader.d.ts +10 -0
- package/node_modules/image-size/dist/utils/bit-reader.js +44 -0
- package/node_modules/image-size/package.json +81 -0
- package/node_modules/immediate/LICENSE.txt +20 -0
- package/node_modules/immediate/README.md +93 -0
- package/node_modules/immediate/dist/immediate.js +75 -0
- package/node_modules/immediate/dist/immediate.min.js +1 -0
- package/node_modules/immediate/lib/browser.js +69 -0
- package/node_modules/immediate/lib/index.js +73 -0
- package/node_modules/immediate/package.json +42 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -0
- package/node_modules/isarray/.npmignore +1 -0
- package/node_modules/isarray/.travis.yml +4 -0
- package/node_modules/isarray/Makefile +6 -0
- package/node_modules/isarray/README.md +60 -0
- package/node_modules/isarray/component.json +19 -0
- package/node_modules/isarray/index.js +5 -0
- package/node_modules/isarray/package.json +45 -0
- package/node_modules/isarray/test.js +20 -0
- package/node_modules/jszip/.codeclimate.yml +16 -0
- package/node_modules/jszip/.editorconfig +8 -0
- package/node_modules/jszip/.eslintrc.js +43 -0
- package/node_modules/jszip/CHANGES.md +210 -0
- package/node_modules/jszip/LICENSE.markdown +651 -0
- package/node_modules/jszip/README.markdown +33 -0
- package/node_modules/jszip/dist/jszip.js +11586 -0
- package/node_modules/jszip/dist/jszip.min.js +13 -0
- package/node_modules/jszip/index.d.ts +344 -0
- package/node_modules/jszip/lib/base64.js +106 -0
- package/node_modules/jszip/lib/compressedObject.js +74 -0
- package/node_modules/jszip/lib/compressions.js +14 -0
- package/node_modules/jszip/lib/crc32.js +77 -0
- package/node_modules/jszip/lib/defaults.js +11 -0
- package/node_modules/jszip/lib/external.js +18 -0
- package/node_modules/jszip/lib/flate.js +85 -0
- package/node_modules/jszip/lib/generate/ZipFileWorker.js +539 -0
- package/node_modules/jszip/lib/generate/index.js +57 -0
- package/node_modules/jszip/lib/index.js +55 -0
- package/node_modules/jszip/lib/license_header.js +11 -0
- package/node_modules/jszip/lib/load.js +88 -0
- package/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +74 -0
- package/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +42 -0
- package/node_modules/jszip/lib/nodejsUtils.js +57 -0
- package/node_modules/jszip/lib/object.js +384 -0
- package/node_modules/jszip/lib/readable-stream-browser.js +10 -0
- package/node_modules/jszip/lib/reader/ArrayReader.js +57 -0
- package/node_modules/jszip/lib/reader/DataReader.js +116 -0
- package/node_modules/jszip/lib/reader/NodeBufferReader.js +19 -0
- package/node_modules/jszip/lib/reader/StringReader.js +38 -0
- package/node_modules/jszip/lib/reader/Uint8ArrayReader.js +22 -0
- package/node_modules/jszip/lib/reader/readerFor.js +28 -0
- package/node_modules/jszip/lib/signature.js +7 -0
- package/node_modules/jszip/lib/stream/ConvertWorker.js +26 -0
- package/node_modules/jszip/lib/stream/Crc32Probe.js +24 -0
- package/node_modules/jszip/lib/stream/DataLengthProbe.js +29 -0
- package/node_modules/jszip/lib/stream/DataWorker.js +116 -0
- package/node_modules/jszip/lib/stream/GenericWorker.js +263 -0
- package/node_modules/jszip/lib/stream/StreamHelper.js +214 -0
- package/node_modules/jszip/lib/support.js +38 -0
- package/node_modules/jszip/lib/utf8.js +275 -0
- package/node_modules/jszip/lib/utils.js +510 -0
- package/node_modules/jszip/lib/zipEntries.js +261 -0
- package/node_modules/jszip/lib/zipEntry.js +293 -0
- package/node_modules/jszip/lib/zipObject.js +133 -0
- package/node_modules/jszip/package.json +67 -0
- package/node_modules/jszip/sponsors.md +21 -0
- package/node_modules/jszip/tsconfig.json +101 -0
- package/node_modules/jszip/vendor/FileSaver.js +247 -0
- package/node_modules/lie/README.md +62 -0
- package/node_modules/lie/dist/lie.js +350 -0
- package/node_modules/lie/dist/lie.min.js +1 -0
- package/node_modules/lie/dist/lie.polyfill.js +358 -0
- package/node_modules/lie/dist/lie.polyfill.min.js +1 -0
- package/node_modules/lie/lib/browser.js +273 -0
- package/node_modules/lie/lib/index.js +298 -0
- package/node_modules/lie/license.md +7 -0
- package/node_modules/lie/lie.d.ts +244 -0
- package/node_modules/lie/package.json +69 -0
- package/node_modules/lie/polyfill.js +4 -0
- package/node_modules/pako/LICENSE +21 -0
- package/node_modules/pako/README.md +191 -0
- package/node_modules/pako/dist/pako.js +6818 -0
- package/node_modules/pako/dist/pako.min.js +1 -0
- package/node_modules/pako/dist/pako_deflate.js +3997 -0
- package/node_modules/pako/dist/pako_deflate.min.js +1 -0
- package/node_modules/pako/dist/pako_inflate.js +3300 -0
- package/node_modules/pako/dist/pako_inflate.min.js +1 -0
- package/node_modules/pako/index.js +14 -0
- package/node_modules/pako/lib/deflate.js +400 -0
- package/node_modules/pako/lib/inflate.js +423 -0
- package/node_modules/pako/lib/utils/common.js +105 -0
- package/node_modules/pako/lib/utils/strings.js +187 -0
- package/node_modules/pako/lib/zlib/README +59 -0
- package/node_modules/pako/lib/zlib/adler32.js +51 -0
- package/node_modules/pako/lib/zlib/constants.js +68 -0
- package/node_modules/pako/lib/zlib/crc32.js +59 -0
- package/node_modules/pako/lib/zlib/deflate.js +1874 -0
- package/node_modules/pako/lib/zlib/gzheader.js +58 -0
- package/node_modules/pako/lib/zlib/inffast.js +345 -0
- package/node_modules/pako/lib/zlib/inflate.js +1556 -0
- package/node_modules/pako/lib/zlib/inftrees.js +343 -0
- package/node_modules/pako/lib/zlib/messages.js +32 -0
- package/node_modules/pako/lib/zlib/trees.js +1222 -0
- package/node_modules/pako/lib/zlib/zstream.js +47 -0
- package/node_modules/pako/package.json +44 -0
- package/node_modules/pptxgenjs/LICENSE +21 -0
- package/node_modules/pptxgenjs/README.md +284 -0
- package/node_modules/pptxgenjs/dist/pptxgen.bundle.js +3 -0
- package/node_modules/pptxgenjs/dist/pptxgen.bundle.js.map +1 -0
- package/node_modules/pptxgenjs/dist/pptxgen.cjs.js +7445 -0
- package/node_modules/pptxgenjs/dist/pptxgen.es.js +7439 -0
- package/node_modules/pptxgenjs/dist/pptxgen.min.js +3 -0
- package/node_modules/pptxgenjs/dist/pptxgen.min.js.map +1 -0
- package/node_modules/pptxgenjs/package.json +89 -0
- package/node_modules/pptxgenjs/types/index.d.ts +2670 -0
- package/node_modules/process-nextick-args/index.js +45 -0
- package/node_modules/process-nextick-args/license.md +19 -0
- package/node_modules/process-nextick-args/package.json +25 -0
- package/node_modules/process-nextick-args/readme.md +18 -0
- package/node_modules/queue/LICENSE +8 -0
- package/node_modules/queue/index.d.ts +173 -0
- package/node_modules/queue/index.js +195 -0
- package/node_modules/queue/package.json +43 -0
- package/node_modules/queue/readme.md +221 -0
- package/node_modules/readable-stream/.travis.yml +34 -0
- package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
- package/node_modules/readable-stream/GOVERNANCE.md +136 -0
- package/node_modules/readable-stream/LICENSE +47 -0
- package/node_modules/readable-stream/README.md +58 -0
- package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +60 -0
- package/node_modules/readable-stream/duplex-browser.js +1 -0
- package/node_modules/readable-stream/duplex.js +1 -0
- package/node_modules/readable-stream/lib/_stream_duplex.js +131 -0
- package/node_modules/readable-stream/lib/_stream_passthrough.js +47 -0
- package/node_modules/readable-stream/lib/_stream_readable.js +1019 -0
- package/node_modules/readable-stream/lib/_stream_transform.js +214 -0
- package/node_modules/readable-stream/lib/_stream_writable.js +685 -0
- package/node_modules/readable-stream/lib/internal/streams/BufferList.js +78 -0
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +84 -0
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- package/node_modules/readable-stream/package.json +52 -0
- package/node_modules/readable-stream/passthrough.js +1 -0
- package/node_modules/readable-stream/readable-browser.js +7 -0
- package/node_modules/readable-stream/readable.js +19 -0
- package/node_modules/readable-stream/transform.js +1 -0
- package/node_modules/readable-stream/writable-browser.js +1 -0
- package/node_modules/readable-stream/writable.js +8 -0
- package/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/index.js +62 -0
- package/node_modules/safe-buffer/package.json +37 -0
- package/node_modules/setimmediate/LICENSE.txt +20 -0
- package/node_modules/setimmediate/package.json +30 -0
- package/node_modules/setimmediate/setImmediate.js +186 -0
- package/node_modules/string_decoder/.travis.yml +50 -0
- package/node_modules/string_decoder/LICENSE +48 -0
- package/node_modules/string_decoder/README.md +47 -0
- package/node_modules/string_decoder/lib/string_decoder.js +296 -0
- package/node_modules/string_decoder/package.json +31 -0
- package/node_modules/undici-types/README.md +6 -0
- package/node_modules/undici-types/agent.d.ts +31 -0
- package/node_modules/undici-types/api.d.ts +43 -0
- package/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/node_modules/undici-types/cache.d.ts +36 -0
- package/node_modules/undici-types/client.d.ts +97 -0
- package/node_modules/undici-types/connector.d.ts +34 -0
- package/node_modules/undici-types/content-type.d.ts +21 -0
- package/node_modules/undici-types/cookies.d.ts +28 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/node_modules/undici-types/errors.d.ts +128 -0
- package/node_modules/undici-types/fetch.d.ts +209 -0
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +108 -0
- package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici-types/global-origin.d.ts +7 -0
- package/node_modules/undici-types/handlers.d.ts +9 -0
- package/node_modules/undici-types/header.d.ts +4 -0
- package/node_modules/undici-types/index.d.ts +63 -0
- package/node_modules/undici-types/interceptors.d.ts +5 -0
- package/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/node_modules/undici-types/mock-client.d.ts +25 -0
- package/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/node_modules/undici-types/package.json +55 -0
- package/node_modules/undici-types/patch.d.ts +71 -0
- package/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/node_modules/undici-types/pool.d.ts +28 -0
- package/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/node_modules/undici-types/readable.d.ts +61 -0
- package/node_modules/undici-types/webidl.d.ts +220 -0
- package/node_modules/undici-types/websocket.d.ts +131 -0
- package/node_modules/util-deprecate/History.md +16 -0
- package/node_modules/util-deprecate/LICENSE +24 -0
- package/node_modules/util-deprecate/README.md +53 -0
- package/node_modules/util-deprecate/browser.js +67 -0
- package/node_modules/util-deprecate/node.js +6 -0
- package/node_modules/util-deprecate/package.json +27 -0
- package/package.json +54 -21
- package/services.json +1 -20
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 稿件编译器:版式 spec → deck(复用 core/deck-layout.js 的 7 版式 × 4 预设)。
|
|
3
|
+
*
|
|
4
|
+
* 这一层的核心职责不是"排版"(排版已经在引擎里),而是**不许静默近似**:
|
|
5
|
+
* 任何截断、丢弃、推断、未知字段都必须变成结构化 finding 返回给调用方。
|
|
6
|
+
* 没有这一条,稿件真源就退化成一个更隐蔽的猜谜游戏。
|
|
7
|
+
*/
|
|
8
|
+
import { buildDeck, buildSlide } from '../deck-layout.js'
|
|
9
|
+
import { normalizeColor } from '../color.js'
|
|
10
|
+
import { parseManuscript } from './parse.mjs'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 引擎接受的容量上限。**这是临时镜像**,真实来源应当是版式注册表
|
|
14
|
+
* (core/deck-layout.js 里各处 tidy(..., N) 与 slice(0, N))。
|
|
15
|
+
* 镜像的代价是双份维护;做注册表时这些数字应当由注册表导出、engine 反向 import。
|
|
16
|
+
*/
|
|
17
|
+
export const CAPS = {
|
|
18
|
+
cover: { title: 30, kicker: 40, subtitle: 60, foot: 50 },
|
|
19
|
+
section: { title: 30, subtitle: 70 },
|
|
20
|
+
bullets: { title: 28, item: 36, detail: 60 },
|
|
21
|
+
two: { title: 26, heading: 20, item: 30 },
|
|
22
|
+
stat: { title: 26, value: 10, label: 20, note: 80 },
|
|
23
|
+
table: { title: 30 },
|
|
24
|
+
chart: { title: 30 },
|
|
25
|
+
formula: { title: 30, caption: 60 },
|
|
26
|
+
quote: { quote: 120, author: 30 },
|
|
27
|
+
end: { title: 20, subtitle: 60 },
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const LIMITS = { slides: 30, bullets: 6, twoBullets: 4, stats: 3 }
|
|
31
|
+
|
|
32
|
+
const EMPTY_DECK = { title: '', slides: [], theme: null }
|
|
33
|
+
|
|
34
|
+
/** 图表围栏的迷你语法:每行 `键: 值`,series 用 `;` 或 `|` 分隔多组。
|
|
35
|
+
* 为什么不用 JSON:模型写 JSON 容易错一个逗号就整页挂掉,而这里错一个键只是少一条序列。 */
|
|
36
|
+
function parseChartFence(text, page, findings) {
|
|
37
|
+
const out = { type: 'bar', labels: [], series: [], legends: [], options: {} }
|
|
38
|
+
const nums = (s) => s.split(',').map((x) => Number(x.trim())).filter((n) => Number.isFinite(n))
|
|
39
|
+
const strs = (s) => s.split(',').map((x) => x.trim()).filter(Boolean)
|
|
40
|
+
for (const raw of String(text || '').split('\n')) {
|
|
41
|
+
const line = raw.trim()
|
|
42
|
+
if (!line || line.startsWith('#')) continue
|
|
43
|
+
const i = line.indexOf(':')
|
|
44
|
+
if (i < 0) continue
|
|
45
|
+
const k = line.slice(0, i).trim().toLowerCase()
|
|
46
|
+
const v = line.slice(i + 1).trim()
|
|
47
|
+
if (k === 'type') out.type = v || 'bar'
|
|
48
|
+
else if (k === 'labels') out.labels = strs(v)
|
|
49
|
+
else if (k === 'series' || k === 'values') out.series = v.split(/[;|]/).map(nums).filter((a) => a.length)
|
|
50
|
+
else if (k === 'legends') out.legends = strs(v)
|
|
51
|
+
else if (k === 'smooth') out.options.lineSmooth = /^(true|1|yes)$/i.test(v)
|
|
52
|
+
else if (k === 'stack') out.options.stack = /^(true|1|yes)$/i.test(v)
|
|
53
|
+
else if (k === 'horizontal') out.options.horizontalBars = /^(true|1|yes)$/i.test(v)
|
|
54
|
+
else findings.push({ level: 'warn', kind: 'chart-key', where: page.id, message: `chart 围栏里未知的键「${k}」,已忽略` })
|
|
55
|
+
}
|
|
56
|
+
if (!out.series.length && page.fence) {
|
|
57
|
+
findings.push({ level: 'warn', kind: 'chart-empty', where: page.id, message: 'chart 围栏里没有 series,这一页只会画出空坐标轴' })
|
|
58
|
+
}
|
|
59
|
+
if (out.labels.length && out.series.length && out.labels.length !== out.series[0].length) {
|
|
60
|
+
findings.push({ level: 'warn', kind: 'chart-labels-mismatch', where: page.id, message: `labels ${out.labels.length} 个,但第一组 series 有 ${out.series[0].length} 个值` })
|
|
61
|
+
}
|
|
62
|
+
return out
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function pageSpec(page, findings) {
|
|
66
|
+
const f = page.fields
|
|
67
|
+
const where = page.id
|
|
68
|
+
const used = new Set()
|
|
69
|
+
const spec = { layout: page.layout }
|
|
70
|
+
|
|
71
|
+
const put = (key, value) => {
|
|
72
|
+
if (value == null || value === '') return
|
|
73
|
+
spec[key] = value
|
|
74
|
+
used.add(key)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
switch (page.layout) {
|
|
78
|
+
case 'cover':
|
|
79
|
+
put('title', page.title); put('kicker', f.kicker); put('subtitle', f.subtitle); put('foot', f.foot)
|
|
80
|
+
break
|
|
81
|
+
case 'section': {
|
|
82
|
+
put('title', page.title); put('subtitle', f.subtitle)
|
|
83
|
+
if (f.index != null && f.index !== '') {
|
|
84
|
+
const n = Number(f.index)
|
|
85
|
+
if (Number.isFinite(n)) spec.index = n
|
|
86
|
+
else findings.push({ level: 'warn', kind: 'bad-index', where, message: `index 不是数字:「${f.index}」` })
|
|
87
|
+
}
|
|
88
|
+
used.add('index')
|
|
89
|
+
break
|
|
90
|
+
}
|
|
91
|
+
case 'two': {
|
|
92
|
+
put('title', page.title)
|
|
93
|
+
const g = page.groups.slice(0, 2)
|
|
94
|
+
const side = (i) => (g[i] ? { heading: g[i].heading, bullets: g[i].bullets.map((b) => b.text) } : { heading: '', bullets: [] })
|
|
95
|
+
spec.left = side(0)
|
|
96
|
+
spec.right = side(1)
|
|
97
|
+
used.add('left'); used.add('right')
|
|
98
|
+
if (page.groups.length > 2) {
|
|
99
|
+
findings.push({ level: 'warn', kind: 'dropped', where, message: `two 只支持左右两栏,第 3 栏起 ${page.groups.length - 2} 栏被丢弃` })
|
|
100
|
+
}
|
|
101
|
+
break
|
|
102
|
+
}
|
|
103
|
+
case 'stat': {
|
|
104
|
+
put('title', page.title); put('note', f.note)
|
|
105
|
+
spec.stats = page.table.map((r) => ({ value: r[0] || '', label: r[1] || '' }))
|
|
106
|
+
used.add('stats')
|
|
107
|
+
break
|
|
108
|
+
}
|
|
109
|
+
case 'quote':
|
|
110
|
+
spec.quote = page.quoteLines.join(' ')
|
|
111
|
+
spec.author = f.author || page.authorHint || ''
|
|
112
|
+
used.add('quote'); used.add('author')
|
|
113
|
+
break
|
|
114
|
+
case 'table': {
|
|
115
|
+
put('title', page.title)
|
|
116
|
+
spec.rows = page.table.map((r) => r.slice())
|
|
117
|
+
spec.header = true
|
|
118
|
+
used.add('rows'); used.add('header')
|
|
119
|
+
break
|
|
120
|
+
}
|
|
121
|
+
case 'chart': {
|
|
122
|
+
put('title', page.title)
|
|
123
|
+
const c = parseChartFence(page.fence ? page.fence.text : '', page, findings)
|
|
124
|
+
spec.chartType = c.type
|
|
125
|
+
spec.chartData = { labels: c.labels, series: c.series, legends: c.legends }
|
|
126
|
+
if (Object.keys(c.options).length) spec.chartOptions = c.options
|
|
127
|
+
used.add('chart'); used.add('chartType'); used.add('chartData'); used.add('chartOptions')
|
|
128
|
+
break
|
|
129
|
+
}
|
|
130
|
+
case 'formula': {
|
|
131
|
+
put('title', page.title)
|
|
132
|
+
spec.latex = page.latex
|
|
133
|
+
used.add('latex')
|
|
134
|
+
put('caption', f.caption)
|
|
135
|
+
break
|
|
136
|
+
}
|
|
137
|
+
case 'end':
|
|
138
|
+
put('title', page.title || '谢谢观看'); put('subtitle', f.subtitle)
|
|
139
|
+
break
|
|
140
|
+
default:
|
|
141
|
+
put('title', page.title)
|
|
142
|
+
spec.bullets = page.bullets.map((b) => (b.detail ? { text: b.text, detail: b.detail } : b.text))
|
|
143
|
+
used.add('bullets')
|
|
144
|
+
break
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* 视觉层:底色、强调色、备注、图片都属于稿件,不属于 deck 侧后处理。
|
|
148
|
+
* 图片只有 cover / bullets 有位置(版式自带图位),别的版式要说出来而不是静默丢掉。 */
|
|
149
|
+
const color = (key) => {
|
|
150
|
+
const v = f[key]
|
|
151
|
+
if (!v) return
|
|
152
|
+
used.add(key)
|
|
153
|
+
/* 色名也收:「navy」「黑色」都归一成 hex,deck 里只留 CSS 认得的写法。
|
|
154
|
+
认不出的值不静默吞掉——说出来,否则调用方以为改了色。 */
|
|
155
|
+
const hex = normalizeColor(v)
|
|
156
|
+
if (hex) spec[key] = hex
|
|
157
|
+
else findings.push({ level: 'warn', kind: 'bad-color', where, message: `${key} 不是可识别的颜色:「${v}」` })
|
|
158
|
+
}
|
|
159
|
+
color('background')
|
|
160
|
+
color('accent')
|
|
161
|
+
if (f.notes) { spec.notes = f.notes; used.add('notes') }
|
|
162
|
+
const img = page.image || f.image
|
|
163
|
+
if (img) {
|
|
164
|
+
used.add('image')
|
|
165
|
+
if (page.layout === 'cover' || page.layout === 'bullets') spec.image = img
|
|
166
|
+
else findings.push({ level: 'warn', kind: 'image-ignored', where, message: `${page.layout} 版式没有图片位;图片只在 cover / bullets 生效` })
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
for (const key of Object.keys(f)) {
|
|
170
|
+
if (!used.has(key)) {
|
|
171
|
+
findings.push({ level: 'warn', kind: 'field-ignored', where, message: `${page.layout} 版式不接受字段「${key}」,内容未进入 deck` })
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return spec
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** 截断检查:引擎的 tidy() 会 slice + 省略号,这里把它变成可读的报告。 */
|
|
178
|
+
function checkTruncation(page, spec, findings) {
|
|
179
|
+
const caps = CAPS[page.layout] || {}
|
|
180
|
+
const hit = (field, value, cap) => {
|
|
181
|
+
if (!cap || value == null) return
|
|
182
|
+
const s = String(value)
|
|
183
|
+
if (s.length <= cap) return
|
|
184
|
+
findings.push({
|
|
185
|
+
level: 'warn', kind: 'truncated', where: page.id, field,
|
|
186
|
+
message: `${field} ${s.length} 字 > 容量 ${cap},将被截断为「${s.slice(0, cap - 1)}…」`,
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
switch (page.layout) {
|
|
190
|
+
case 'table':
|
|
191
|
+
case 'chart':
|
|
192
|
+
hit('title', spec.title, caps.title)
|
|
193
|
+
break
|
|
194
|
+
case 'formula':
|
|
195
|
+
hit('title', spec.title, caps.title); hit('caption', spec.caption, caps.caption)
|
|
196
|
+
break
|
|
197
|
+
case 'cover':
|
|
198
|
+
hit('title', spec.title, caps.title); hit('kicker', spec.kicker, caps.kicker)
|
|
199
|
+
hit('subtitle', spec.subtitle, caps.subtitle); hit('foot', spec.foot, caps.foot)
|
|
200
|
+
break
|
|
201
|
+
case 'section':
|
|
202
|
+
hit('title', spec.title, caps.title); hit('subtitle', spec.subtitle, caps.subtitle)
|
|
203
|
+
break
|
|
204
|
+
case 'two':
|
|
205
|
+
hit('title', spec.title, caps.title)
|
|
206
|
+
for (const [side, data] of [['left', spec.left], ['right', spec.right]]) {
|
|
207
|
+
hit(`${side}.heading`, data.heading, caps.heading)
|
|
208
|
+
data.bullets.slice(0, LIMITS.twoBullets).forEach((b, k) => hit(`${side}[${k}]`, b, caps.item))
|
|
209
|
+
}
|
|
210
|
+
if (spec.left.bullets.length > LIMITS.twoBullets || spec.right.bullets.length > LIMITS.twoBullets) {
|
|
211
|
+
findings.push({ level: 'warn', kind: 'dropped', where: page.id, message: `每栏最多 ${LIMITS.twoBullets} 条,超出的条目不会显示` })
|
|
212
|
+
}
|
|
213
|
+
break
|
|
214
|
+
case 'stat':
|
|
215
|
+
hit('title', spec.title, caps.title); hit('note', spec.note, caps.note)
|
|
216
|
+
spec.stats.slice(0, LIMITS.stats).forEach((st, k) => { hit(`stats[${k}].value`, st.value, caps.value); hit(`stats[${k}].label`, st.label, caps.label) })
|
|
217
|
+
break
|
|
218
|
+
case 'quote':
|
|
219
|
+
hit('quote', spec.quote, caps.quote); hit('author', spec.author, caps.author)
|
|
220
|
+
break
|
|
221
|
+
case 'end':
|
|
222
|
+
hit('title', spec.title, caps.title); hit('subtitle', spec.subtitle, caps.subtitle)
|
|
223
|
+
break
|
|
224
|
+
default: {
|
|
225
|
+
hit('title', spec.title, caps.title)
|
|
226
|
+
const list = spec.bullets || []
|
|
227
|
+
list.slice(0, LIMITS.bullets).forEach((b, k) => {
|
|
228
|
+
const t = typeof b === 'string' ? b : b.text
|
|
229
|
+
hit(`bullets[${k}]`, t, caps.item)
|
|
230
|
+
if (typeof b === 'object') hit(`bullets[${k}].detail`, b.detail, caps.detail)
|
|
231
|
+
})
|
|
232
|
+
if (list.length > LIMITS.bullets) {
|
|
233
|
+
findings.push({ level: 'warn', kind: 'dropped', where: page.id, message: `bullets 最多 ${LIMITS.bullets} 条,第 ${LIMITS.bullets + 1} 条起被丢弃` })
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @returns {{deck, pages, blockIds, findings, meta, stats}}
|
|
241
|
+
* deck 可直接喂给 deck 端口 / 导出器的 deck JSON
|
|
242
|
+
* blockIds 与 deck.slides 一一对应的稳定 id(稿件块 id,不是页号)
|
|
243
|
+
* findings 结构化问题清单;level=error 时不应把 deck 当作成品
|
|
244
|
+
*/
|
|
245
|
+
export function compileManuscript(src, options = {}) {
|
|
246
|
+
const t0 = process.hrtime.bigint()
|
|
247
|
+
const { meta, pages, findings } = parseManuscript(src)
|
|
248
|
+
|
|
249
|
+
const specs = []
|
|
250
|
+
for (const page of pages) {
|
|
251
|
+
const spec = pageSpec(page, findings)
|
|
252
|
+
checkTruncation(page, spec, findings)
|
|
253
|
+
specs.push(spec)
|
|
254
|
+
}
|
|
255
|
+
if (specs.length > LIMITS.slides) {
|
|
256
|
+
findings.push({ level: 'error', kind: 'too-many-slides', where: 'doc', message: `${specs.length} 页 > 上限 ${LIMITS.slides} 页,超出部分被丢弃` })
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let deck = EMPTY_DECK
|
|
260
|
+
if (specs.length) {
|
|
261
|
+
try {
|
|
262
|
+
/* frontmatter 的 background/accent 同样归一成 hex:'black' / '白色' 这类名字
|
|
263
|
+
原样塞进 deck,编辑器不认(页面还是白底),审计也解析不了(深底分支不触发)。 */
|
|
264
|
+
const metaColor = (key) => {
|
|
265
|
+
const v = meta[key]
|
|
266
|
+
if (!v) return undefined
|
|
267
|
+
const hex = normalizeColor(v)
|
|
268
|
+
if (!hex) {
|
|
269
|
+
findings.push({
|
|
270
|
+
level: 'warn', kind: 'bad-color', where: 'doc',
|
|
271
|
+
message: `${key} 不是可识别的颜色:「${v}」,已回退到预设配色`,
|
|
272
|
+
})
|
|
273
|
+
return undefined
|
|
274
|
+
}
|
|
275
|
+
return hex
|
|
276
|
+
}
|
|
277
|
+
deck = buildDeck({
|
|
278
|
+
title: meta.title, preset: meta.preset, slides: specs,
|
|
279
|
+
background: metaColor('background'), accent: metaColor('accent'),
|
|
280
|
+
})
|
|
281
|
+
} catch (err) {
|
|
282
|
+
/* 构建器对「数据不成立」是抛错的(图表 series 为空、公式 TeX 写错)。
|
|
283
|
+
* 抛出去会变成 500,模型只看到一句英文栈;这里必须变成结构化 error,
|
|
284
|
+
* 才符合「编译问题必报、且能指到某一页」的约定。 */
|
|
285
|
+
findings.push({
|
|
286
|
+
level: 'error', kind: 'build-failed', where: 'deck',
|
|
287
|
+
message: `编译失败:${String((err && err.message) || err)}`,
|
|
288
|
+
})
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const errors = findings.filter((f) => f.level === 'error')
|
|
293
|
+
const warns = findings.filter((f) => f.level === 'warn')
|
|
294
|
+
const info = findings.filter((f) => f.level === 'info')
|
|
295
|
+
const t1 = process.hrtime.bigint()
|
|
296
|
+
|
|
297
|
+
return {
|
|
298
|
+
deck,
|
|
299
|
+
pages,
|
|
300
|
+
blockIds: pages.map((p) => p.id),
|
|
301
|
+
meta,
|
|
302
|
+
findings,
|
|
303
|
+
ok: errors.length === 0,
|
|
304
|
+
stats: {
|
|
305
|
+
ms: Number(t1 - t0) / 1e6,
|
|
306
|
+
slides: deck.slides.length,
|
|
307
|
+
bytes: Buffer.byteLength(String(src ?? ''), 'utf8'),
|
|
308
|
+
deckBytes: Buffer.byteLength(JSON.stringify(deck), 'utf8'),
|
|
309
|
+
errors: errors.length,
|
|
310
|
+
warns: warns.length,
|
|
311
|
+
infos: info.length,
|
|
312
|
+
},
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** 单页编译(给"只改一页"的快路径用,语义与整稿编译一致)。 */
|
|
317
|
+
export function compilePageSrc(src, options = {}) {
|
|
318
|
+
const r = compileManuscript(src, options)
|
|
319
|
+
return r
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export { buildDeck, buildSlide }
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 稿件源文本的块级编辑。
|
|
3
|
+
*
|
|
4
|
+
* 设计约束:
|
|
5
|
+
* 1. 寻址只用**块 id**(`{#p3}` 或按位置派生的 `p3`),不用行号、不用数组下标;
|
|
6
|
+
* 2. 修改以「块」为最小单位:换一条要点 = 重写这一块,不是改 deck 里的某个元素;
|
|
7
|
+
* 3. 只做块级重建,不解析语义——语义交给 compile.mjs,这样两边不会各自演化;
|
|
8
|
+
* 4. 认不出的东西一律进 findings(不静默丢弃)。
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const PAGE_RE = /^##\s+/
|
|
12
|
+
const ATTR_RE = /\{([^}]*)\}\s*$/
|
|
13
|
+
|
|
14
|
+
function attrsOf(header) {
|
|
15
|
+
const m = header.match(ATTR_RE)
|
|
16
|
+
if (!m) return { id: '', attrs: {}, title: header.replace(/^##\s+/, '') }
|
|
17
|
+
const attrs = {}
|
|
18
|
+
let id = ''
|
|
19
|
+
for (const tok of m[1].split(/\s+/).filter(Boolean)) {
|
|
20
|
+
if (tok.startsWith('#')) id = tok.slice(1)
|
|
21
|
+
else {
|
|
22
|
+
const i = tok.indexOf('=')
|
|
23
|
+
if (i > 0) attrs[tok.slice(0, i)] = tok.slice(i + 1)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const title = header.slice(0, m.index).replace(/^##\s+/, '').trim()
|
|
27
|
+
return { id, attrs, title }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** 扫描块:返回带字符区间的块表(front = 第一块之前的全部文本,含 frontmatter)。 */
|
|
31
|
+
export function scanBlocks(src) {
|
|
32
|
+
const text = String(src == null ? '' : src).replace(/\r\n?/g, '\n')
|
|
33
|
+
const blocks = []
|
|
34
|
+
let front = ''
|
|
35
|
+
const re = /^##\s+.*$/gm
|
|
36
|
+
const hits = []
|
|
37
|
+
let m
|
|
38
|
+
while ((m = re.exec(text))) {
|
|
39
|
+
/* 只认行首的 ##:正则带 ^ 与 m 标志,已保证。 */
|
|
40
|
+
hits.push({ start: m.index, end: m.index + m[0].length, header: m[0] })
|
|
41
|
+
}
|
|
42
|
+
if (!hits.length) return { text, front: text, blocks: [] }
|
|
43
|
+
front = text.slice(0, hits[0].start)
|
|
44
|
+
hits.forEach((h, i) => {
|
|
45
|
+
const start = h.start
|
|
46
|
+
const end = i + 1 < hits.length ? hits[i + 1].start : text.length
|
|
47
|
+
const raw = text.slice(start, end)
|
|
48
|
+
const nl = raw.indexOf('\n')
|
|
49
|
+
const body = nl < 0 ? '' : raw.slice(nl + 1)
|
|
50
|
+
const a = attrsOf(h.header)
|
|
51
|
+
blocks.push({
|
|
52
|
+
index: i,
|
|
53
|
+
start,
|
|
54
|
+
end,
|
|
55
|
+
header: h.header,
|
|
56
|
+
title: a.title,
|
|
57
|
+
id: a.id || `p${i + 1}`,
|
|
58
|
+
attrs: a.attrs,
|
|
59
|
+
body: body.replace(/\s+$/, ''),
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
return { text, front, blocks }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const blockText = (b) => {
|
|
66
|
+
const head = b.header
|
|
67
|
+
const body = String(b.body || '').trim()
|
|
68
|
+
return body ? `${head}\n${body}` : head
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function rebuild(front, blocks) {
|
|
72
|
+
const head = String(front || '')
|
|
73
|
+
const joined = blocks.map(blockText).join('\n\n')
|
|
74
|
+
const gap = head && !head.endsWith('\n\n') ? '\n' : ''
|
|
75
|
+
return `${head}${gap}${joined}\n`
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function headerFor({ title, id, attrs, layout }) {
|
|
79
|
+
const a = { ...(attrs || {}) }
|
|
80
|
+
if (layout) a.layout = layout
|
|
81
|
+
const tokens = []
|
|
82
|
+
if (id) tokens.push(`#${id}`)
|
|
83
|
+
for (const k of Object.keys(a)) tokens.push(`${k}=${a[k]}`)
|
|
84
|
+
const tail = tokens.length ? ` {${tokens.join(' ')}}` : ''
|
|
85
|
+
return `## ${String(title || '').trim()}${tail}`
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 块寻址:除了块 id,也接受 `#p3`、纯序号 `3`、以及标题(或其唯一前缀)。
|
|
90
|
+
* 允许这些写法是为了省掉「先读一遍块表」那一次往返——用户说「删第 7 页」时,
|
|
91
|
+
* 模型不必先 ppt_outline 拿到 id 才能动手。歧义时明确拒绝并列出候选,不猜。
|
|
92
|
+
*/
|
|
93
|
+
function resolveRef(blocks, ref) {
|
|
94
|
+
const r = String(ref == null ? '' : ref).trim().replace(/^#/, '')
|
|
95
|
+
if (!r) return { i: -1, how: 'empty' }
|
|
96
|
+
let i = blocks.findIndex((b) => b.id === r)
|
|
97
|
+
if (i >= 0) return { i, how: 'id' }
|
|
98
|
+
if (/^\d+$/.test(r)) {
|
|
99
|
+
const want = `p${Number(r)}`
|
|
100
|
+
i = blocks.findIndex((b) => b.id === want)
|
|
101
|
+
if (i >= 0) return { i, how: 'index' }
|
|
102
|
+
}
|
|
103
|
+
i = blocks.findIndex((b) => b.title === r)
|
|
104
|
+
if (i >= 0) return { i, how: 'title' }
|
|
105
|
+
const hits = []
|
|
106
|
+
blocks.forEach((b, j) => { if (b.title.startsWith(r)) hits.push({ b, j }) })
|
|
107
|
+
if (hits.length === 1) return { i: hits[0].j, how: 'title-prefix' }
|
|
108
|
+
if (hits.length > 1) return { i: -1, how: 'ambiguous', candidates: hits.map((h) => `${h.b.id}「${h.b.title}」`) }
|
|
109
|
+
return { i: -1, how: 'none' }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 应用块级操作。ops 顺序执行;单条失败不中断(全部报出来,让人一次修完)。
|
|
114
|
+
* op 形式:
|
|
115
|
+
* { op:'replace', id, title?, text? } 改标题 / 换正文(正文不含 `## ` 行)
|
|
116
|
+
* { op:'remove', id }
|
|
117
|
+
* { op:'insert', title, text?, id?, layout?, after?, before? }
|
|
118
|
+
* { op:'move', id, after? , before? }
|
|
119
|
+
*/
|
|
120
|
+
export function applyBlockOps(src, ops) {
|
|
121
|
+
const scan = scanBlocks(src)
|
|
122
|
+
let blocks = scan.blocks.map((b) => ({ ...b }))
|
|
123
|
+
const findings = []
|
|
124
|
+
const applied = []
|
|
125
|
+
|
|
126
|
+
const find = (ref) => resolveRef(blocks, ref)
|
|
127
|
+
const fail = (kind, where, message) => findings.push({ level: 'error', kind, where, message })
|
|
128
|
+
const notFound = (ref, verb) => {
|
|
129
|
+
const r = find(ref)
|
|
130
|
+
if (r.how === 'ambiguous') {
|
|
131
|
+
fail('edit-ambiguous', String(ref), `「${ref}」匹配到多块(${r.candidates.join('、')}),${verb}被拒绝;请改用块 id`)
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
const ids = blocks.map((b) => b.id).join(', ')
|
|
135
|
+
fail('edit-block-not-found', String(ref || '?'), `找不到块「${ref}」,没有${verb};现有块:${ids}`)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
for (const op of Array.isArray(ops) ? ops : []) {
|
|
139
|
+
const kind = String(op && op.op || '')
|
|
140
|
+
const id = op && op.id != null ? String(op.id) : ''
|
|
141
|
+
const hit = id ? find(id) : { i: -1 }
|
|
142
|
+
const i = hit.i
|
|
143
|
+
|
|
144
|
+
/** 锚点:找不到/有歧义时返回 -1 并记一条 error(调用方据此放弃这一条)。 */
|
|
145
|
+
const anchor = (ref, verb) => {
|
|
146
|
+
const r = find(ref)
|
|
147
|
+
if (r.i >= 0) return r.i
|
|
148
|
+
if (r.how === 'ambiguous') {
|
|
149
|
+
fail('edit-ambiguous', String(ref), `锚点「${ref}」匹配到多块(${r.candidates.join('、')}),${verb}被拒绝`)
|
|
150
|
+
} else {
|
|
151
|
+
const ids = blocks.map((b) => b.id).join(', ')
|
|
152
|
+
fail('edit-block-not-found', String(ref), `锚点「${ref}」不存在,${verb}被拒绝;现有块:${ids}`)
|
|
153
|
+
}
|
|
154
|
+
return -1
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (kind === 'replace') {
|
|
158
|
+
if (i < 0) { notFound(id, '改动'); continue }
|
|
159
|
+
const b = blocks[i]
|
|
160
|
+
const next = { ...b }
|
|
161
|
+
if (op.title != null || op.layout != null) {
|
|
162
|
+
const a = attrsOf(b.header)
|
|
163
|
+
const attrs = { ...a.attrs }
|
|
164
|
+
/* 换版式也是块级操作:改的是这一块的头,不是 deck 里的元素。 */
|
|
165
|
+
if (op.layout != null) attrs.layout = String(op.layout)
|
|
166
|
+
next.header = headerFor({ title: op.title != null ? op.title : a.title, id: a.id, attrs })
|
|
167
|
+
if (op.title != null) next.title = String(op.title).trim()
|
|
168
|
+
}
|
|
169
|
+
if (op.text != null) next.body = String(op.text).trim()
|
|
170
|
+
blocks[i] = next
|
|
171
|
+
const what = [op.title != null ? '标题' : '', op.text != null ? '正文' : '', op.layout != null ? '版式' : ''].filter(Boolean).join('+')
|
|
172
|
+
applied.push({ op: kind, id: b.id, message: `已替换块「${b.id}」${what}` })
|
|
173
|
+
continue
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (kind === 'remove') {
|
|
177
|
+
if (i < 0) { notFound(id, '删除'); continue }
|
|
178
|
+
const gone = blocks[i]
|
|
179
|
+
blocks.splice(i, 1)
|
|
180
|
+
applied.push({ op: kind, id: gone.id, message: `已删除块「${gone.id}」` })
|
|
181
|
+
continue
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (kind === 'insert') {
|
|
185
|
+
const newId = op.id ? String(op.id) : ''
|
|
186
|
+
if (newId && find(newId).i >= 0) { fail('edit-duplicate-id', newId, `块 id「${newId}」已存在,插入被拒绝`); continue }
|
|
187
|
+
const header = headerFor({ title: op.title, id: newId, layout: op.layout })
|
|
188
|
+
const ni = { index: -1, start: -1, end: -1, header, title: String(op.title || '').trim(), id: newId || '(待生成)', attrs: {}, body: String(op.text || '').trim() }
|
|
189
|
+
let at = blocks.length
|
|
190
|
+
if (op.after) {
|
|
191
|
+
const j = anchor(String(op.after), '插入')
|
|
192
|
+
if (j < 0) continue
|
|
193
|
+
at = j + 1
|
|
194
|
+
} else if (op.before) {
|
|
195
|
+
const j = anchor(String(op.before), '插入')
|
|
196
|
+
if (j < 0) continue
|
|
197
|
+
at = j
|
|
198
|
+
}
|
|
199
|
+
blocks.splice(at, 0, ni)
|
|
200
|
+
applied.push({ op: kind, id: newId || '(待生成)', message: `已在第 ${at + 1} 位插入「${ni.title}」` })
|
|
201
|
+
continue
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (kind === 'move') {
|
|
205
|
+
if (i < 0) { notFound(id, '移动'); continue }
|
|
206
|
+
const moved = blocks[i]
|
|
207
|
+
const [b] = blocks.splice(i, 1)
|
|
208
|
+
let at = blocks.length
|
|
209
|
+
if (op.after) {
|
|
210
|
+
const j = anchor(String(op.after), '移动')
|
|
211
|
+
if (j < 0) { blocks.splice(i, 0, b); continue }
|
|
212
|
+
at = j + 1
|
|
213
|
+
} else if (op.before) {
|
|
214
|
+
const j = anchor(String(op.before), '移动')
|
|
215
|
+
if (j < 0) { blocks.splice(i, 0, b); continue }
|
|
216
|
+
at = j
|
|
217
|
+
}
|
|
218
|
+
blocks.splice(at, 0, b)
|
|
219
|
+
applied.push({ op: kind, id: moved.id, message: `已把「${moved.id}」移到第 ${at + 1} 位` })
|
|
220
|
+
continue
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
fail('edit-unknown-op', kind || '?', `不认识的编辑操作「${kind}」,支持 replace / remove / insert / move`)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* 位置派生 id(p1/p2…)在增删后会变,这里统一把「显式 id」补上,
|
|
227
|
+
* 避免下一次编辑的寻址漂移。 */
|
|
228
|
+
if (findings.length === 0) {
|
|
229
|
+
blocks = blocks.map((b, i) => {
|
|
230
|
+
const explicit = /#\s*[\w-]+/.test(b.header)
|
|
231
|
+
if (explicit) return b
|
|
232
|
+
const a = attrsOf(b.header)
|
|
233
|
+
return { ...b, header: headerFor({ title: a.title, id: `p${i + 1}`, attrs: a.attrs }), id: `p${i + 1}` }
|
|
234
|
+
})
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const nextSrc = findings.length ? String(src == null ? '' : src) : rebuild(scan.front, blocks)
|
|
238
|
+
return { src: nextSrc, applied, findings, changed: !findings.length && nextSrc !== String(src == null ? '' : src) }
|
|
239
|
+
}
|