@qvac/harness 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +198 -0
- package/NOTICE.md +13 -0
- package/README.md +68 -0
- package/SECURITY.md +6 -0
- package/dist/harness.bundle +48339 -0
- package/dist/harness.cjs +18 -0
- package/dist/harness.d.ts +8 -0
- package/dist/prebuilds-manifest.json +379 -0
- package/dist-lib/index.d.ts +240 -0
- package/dist-lib/index.js +1063 -0
- package/dist-lib/lib/audio-transcode-bare.d.ts +2 -0
- package/dist-lib/lib/audio-transcode-bare.js +145 -0
- package/dist-lib/lib/audio-transcode-node.d.ts +2 -0
- package/dist-lib/lib/audio-transcode-node.js +6 -0
- package/dist-lib/lib/capabilities/audio-resample.d.ts +14 -0
- package/dist-lib/lib/capabilities/audio-resample.js +72 -0
- package/dist-lib/lib/capabilities/completion.d.ts +288 -0
- package/dist-lib/lib/capabilities/completion.js +1077 -0
- package/dist-lib/lib/capabilities/download.d.ts +46 -0
- package/dist-lib/lib/capabilities/download.js +124 -0
- package/dist-lib/lib/capabilities/embed.d.ts +20 -0
- package/dist-lib/lib/capabilities/embed.js +13 -0
- package/dist-lib/lib/capabilities/kv-cache.d.ts +13 -0
- package/dist-lib/lib/capabilities/kv-cache.js +21 -0
- package/dist-lib/lib/capabilities/prompt-prefix.d.ts +6 -0
- package/dist-lib/lib/capabilities/prompt-prefix.js +10 -0
- package/dist-lib/lib/capabilities/speech-lexicon.d.ts +5 -0
- package/dist-lib/lib/capabilities/speech-lexicon.js +32 -0
- package/dist-lib/lib/capabilities/speech-text.d.ts +6 -0
- package/dist-lib/lib/capabilities/speech-text.js +79 -0
- package/dist-lib/lib/capabilities/tool-names.d.ts +3 -0
- package/dist-lib/lib/capabilities/tool-names.js +3 -0
- package/dist-lib/lib/capabilities/tool-selection.d.ts +43 -0
- package/dist-lib/lib/capabilities/tool-selection.js +60 -0
- package/dist-lib/lib/capabilities/tool-turns.d.ts +9 -0
- package/dist-lib/lib/capabilities/tool-turns.js +101 -0
- package/dist-lib/lib/capabilities/usage-breakdown.d.ts +27 -0
- package/dist-lib/lib/capabilities/usage-breakdown.js +44 -0
- package/dist-lib/lib/capabilities/vision-history.d.ts +3 -0
- package/dist-lib/lib/capabilities/vision-history.js +21 -0
- package/dist-lib/lib/capabilities/voice.d.ts +78 -0
- package/dist-lib/lib/capabilities/voice.js +189 -0
- package/dist-lib/lib/connect.d.ts +76 -0
- package/dist-lib/lib/connect.js +789 -0
- package/dist-lib/lib/context-window.d.ts +7 -0
- package/dist-lib/lib/context-window.js +90 -0
- package/dist-lib/lib/contract-types.d.ts +210 -0
- package/dist-lib/lib/contract-types.js +1 -0
- package/dist-lib/lib/diagram-repair.d.ts +21 -0
- package/dist-lib/lib/diagram-repair.js +58 -0
- package/dist-lib/lib/dns-lookup.d.ts +1 -0
- package/dist-lib/lib/dns-lookup.js +13 -0
- package/dist-lib/lib/error-fields.d.ts +2 -0
- package/dist-lib/lib/error-fields.js +8 -0
- package/dist-lib/lib/fetch-node.d.ts +1 -0
- package/dist-lib/lib/fetch-node.js +1 -0
- package/dist-lib/lib/hardware/capability-probe.d.ts +9 -0
- package/dist-lib/lib/hardware/capability-probe.js +99 -0
- package/dist-lib/lib/hardware/gpu-classify.d.ts +2 -0
- package/dist-lib/lib/hardware/gpu-classify.js +32 -0
- package/dist-lib/lib/hardware/gpu-probe-addon.d.ts +2 -0
- package/dist-lib/lib/hardware/gpu-probe-addon.js +42 -0
- package/dist-lib/lib/hardware/gpu-stats.bare.d.ts +1 -0
- package/dist-lib/lib/hardware/gpu-stats.bare.js +24 -0
- package/dist-lib/lib/hardware/gpu-stats.stub.d.ts +1 -0
- package/dist-lib/lib/hardware/gpu-stats.stub.js +3 -0
- package/dist-lib/lib/hardware/memory-budget.d.ts +8 -0
- package/dist-lib/lib/hardware/memory-budget.js +1 -0
- package/dist-lib/lib/hardware/parsers.d.ts +7 -0
- package/dist-lib/lib/hardware/parsers.js +41 -0
- package/dist-lib/lib/headers-bare.d.ts +1 -0
- package/dist-lib/lib/headers-bare.js +1 -0
- package/dist-lib/lib/headers-node.d.ts +4 -0
- package/dist-lib/lib/headers-node.js +1 -0
- package/dist-lib/lib/helpers/buffer-burst.d.ts +1 -0
- package/dist-lib/lib/helpers/buffer-burst.js +20 -0
- package/dist-lib/lib/helpers/control-tokens.d.ts +7 -0
- package/dist-lib/lib/helpers/control-tokens.js +32 -0
- package/dist-lib/lib/helpers/join-guard.d.ts +6 -0
- package/dist-lib/lib/helpers/join-guard.js +46 -0
- package/dist-lib/lib/helpers/markup-stream-filter.d.ts +5 -0
- package/dist-lib/lib/helpers/markup-stream-filter.js +75 -0
- package/dist-lib/lib/helpers/race-abort.d.ts +5 -0
- package/dist-lib/lib/helpers/race-abort.js +18 -0
- package/dist-lib/lib/helpers/retry-memo.d.ts +5 -0
- package/dist-lib/lib/helpers/retry-memo.js +12 -0
- package/dist-lib/lib/helpers/run-outcome.d.ts +33 -0
- package/dist-lib/lib/helpers/run-outcome.js +204 -0
- package/dist-lib/lib/helpers/spawn-path.d.ts +5 -0
- package/dist-lib/lib/helpers/spawn-path.js +57 -0
- package/dist-lib/lib/helpers/text-coalescer.d.ts +15 -0
- package/dist-lib/lib/helpers/text-coalescer.js +34 -0
- package/dist-lib/lib/helpers/thinking.d.ts +8 -0
- package/dist-lib/lib/helpers/thinking.js +95 -0
- package/dist-lib/lib/helpers/tool-call-markup.d.ts +20 -0
- package/dist-lib/lib/helpers/tool-call-markup.js +201 -0
- package/dist-lib/lib/helpers/tool-intent.d.ts +7 -0
- package/dist-lib/lib/helpers/tool-intent.js +21 -0
- package/dist-lib/lib/helpers/tool-label.d.ts +8 -0
- package/dist-lib/lib/helpers/tool-label.js +131 -0
- package/dist-lib/lib/hooks/built-in/arg-repair.d.ts +5 -0
- package/dist-lib/lib/hooks/built-in/arg-repair.js +88 -0
- package/dist-lib/lib/hooks/built-in/egress.d.ts +5 -0
- package/dist-lib/lib/hooks/built-in/egress.js +29 -0
- package/dist-lib/lib/hooks/built-in/index.d.ts +3 -0
- package/dist-lib/lib/hooks/built-in/index.js +3 -0
- package/dist-lib/lib/hooks/built-in/skill-catalog.d.ts +10 -0
- package/dist-lib/lib/hooks/built-in/skill-catalog.js +17 -0
- package/dist-lib/lib/hooks/pipeline.d.ts +20 -0
- package/dist-lib/lib/hooks/pipeline.js +49 -0
- package/dist-lib/lib/hooks/registry.d.ts +2 -0
- package/dist-lib/lib/hooks/registry.js +6 -0
- package/dist-lib/lib/hooks/run.d.ts +5 -0
- package/dist-lib/lib/hooks/run.js +83 -0
- package/dist-lib/lib/hooks/types.d.ts +57 -0
- package/dist-lib/lib/hooks/types.js +1 -0
- package/dist-lib/lib/log.d.ts +5 -0
- package/dist-lib/lib/log.js +37 -0
- package/dist-lib/lib/model-download-progress.d.ts +22 -0
- package/dist-lib/lib/model-download-progress.js +95 -0
- package/dist-lib/lib/models/context.d.ts +5 -0
- package/dist-lib/lib/models/context.js +12 -0
- package/dist-lib/lib/models/embed-config.d.ts +14 -0
- package/dist-lib/lib/models/embed-config.js +31 -0
- package/dist-lib/lib/models/gpu-selection.d.ts +3 -0
- package/dist-lib/lib/models/gpu-selection.js +26 -0
- package/dist-lib/lib/models/kv-cache.d.ts +4 -0
- package/dist-lib/lib/models/kv-cache.js +6 -0
- package/dist-lib/lib/models/llm-presets.d.ts +10 -0
- package/dist-lib/lib/models/llm-presets.js +58 -0
- package/dist-lib/lib/models/model-catalog-constants.d.ts +29 -0
- package/dist-lib/lib/models/model-catalog-constants.js +103 -0
- package/dist-lib/lib/models/model-catalog.d.ts +125 -0
- package/dist-lib/lib/models/model-catalog.js +371 -0
- package/dist-lib/lib/models/model-delete.d.ts +18 -0
- package/dist-lib/lib/models/model-delete.js +47 -0
- package/dist-lib/lib/models/model-handle.d.ts +18 -0
- package/dist-lib/lib/models/model-handle.js +33 -0
- package/dist-lib/lib/models/model-list.d.ts +42 -0
- package/dist-lib/lib/models/model-list.js +123 -0
- package/dist-lib/lib/models/model-pool.d.ts +116 -0
- package/dist-lib/lib/models/model-pool.js +356 -0
- package/dist-lib/lib/models/model-source.d.ts +6 -0
- package/dist-lib/lib/models/model-source.js +21 -0
- package/dist-lib/lib/models/music-catalog.d.ts +12 -0
- package/dist-lib/lib/models/music-catalog.js +26 -0
- package/dist-lib/lib/models/opencl-cache.d.ts +5 -0
- package/dist-lib/lib/models/opencl-cache.js +50 -0
- package/dist-lib/lib/models/sdk-faults.d.ts +21 -0
- package/dist-lib/lib/models/sdk-faults.js +66 -0
- package/dist-lib/lib/models/tool-dialect.d.ts +2 -0
- package/dist-lib/lib/models/tool-dialect.js +19 -0
- package/dist-lib/lib/models/tts-model-default.d.ts +3 -0
- package/dist-lib/lib/models/tts-model-default.js +13 -0
- package/dist-lib/lib/no-redirect-fetch-bare.d.ts +15 -0
- package/dist-lib/lib/no-redirect-fetch-bare.js +59 -0
- package/dist-lib/lib/no-redirect-fetch-impl.d.ts +39 -0
- package/dist-lib/lib/no-redirect-fetch-impl.js +80 -0
- package/dist-lib/lib/no-redirect-fetch-node.d.ts +4 -0
- package/dist-lib/lib/no-redirect-fetch-node.js +52 -0
- package/dist-lib/lib/prompt.d.ts +22 -0
- package/dist-lib/lib/prompt.js +77 -0
- package/dist-lib/lib/queue.d.ts +9 -0
- package/dist-lib/lib/queue.js +48 -0
- package/dist-lib/lib/resolution-detector.d.ts +5 -0
- package/dist-lib/lib/resolution-detector.js +100 -0
- package/dist-lib/lib/rpc-session.d.ts +8 -0
- package/dist-lib/lib/rpc-session.js +20 -0
- package/dist-lib/lib/sdk-config-loader.node.d.ts +1 -0
- package/dist-lib/lib/sdk-config-loader.node.js +1 -0
- package/dist-lib/lib/sdk-loader.d.ts +30 -0
- package/dist-lib/lib/sdk-loader.js +53 -0
- package/dist-lib/lib/sdk-storage.d.ts +8 -0
- package/dist-lib/lib/sdk-storage.js +24 -0
- package/dist-lib/lib/serve.d.ts +3 -0
- package/dist-lib/lib/serve.js +612 -0
- package/dist-lib/lib/spawn.d.ts +62 -0
- package/dist-lib/lib/spawn.js +71 -0
- package/dist-lib/lib/staging.d.ts +4 -0
- package/dist-lib/lib/staging.js +28 -0
- package/dist-lib/lib/storage.d.ts +18 -0
- package/dist-lib/lib/storage.js +26 -0
- package/dist-lib/lib/tmp-path.d.ts +7 -0
- package/dist-lib/lib/tmp-path.js +17 -0
- package/dist-lib/lib/tool-call-display.d.ts +21 -0
- package/dist-lib/lib/tool-call-display.js +1 -0
- package/dist-lib/lib/tools/catalog.d.ts +13 -0
- package/dist-lib/lib/tools/catalog.js +13 -0
- package/dist-lib/lib/tools/create-documents.d.ts +3 -0
- package/dist-lib/lib/tools/create-documents.js +87 -0
- package/dist-lib/lib/tools/edit-documents.d.ts +3 -0
- package/dist-lib/lib/tools/edit-documents.js +122 -0
- package/dist-lib/lib/tools/edit-image.d.ts +25 -0
- package/dist-lib/lib/tools/edit-image.js +271 -0
- package/dist-lib/lib/tools/exec/adapters/adapter.d.ts +27 -0
- package/dist-lib/lib/tools/exec/adapters/adapter.js +1 -0
- package/dist-lib/lib/tools/exec/adapters/python/attachments.d.ts +26 -0
- package/dist-lib/lib/tools/exec/adapters/python/attachments.js +160 -0
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.d.ts +7 -0
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.js +290 -0
- package/dist-lib/lib/tools/exec/adapters/python/loader.d.ts +11 -0
- package/dist-lib/lib/tools/exec/adapters/python/loader.js +94 -0
- package/dist-lib/lib/tools/exec/adapters/python/memfs.d.ts +47 -0
- package/dist-lib/lib/tools/exec/adapters/python/memfs.js +85 -0
- package/dist-lib/lib/tools/exec/adapters/python/output-policy.d.ts +13 -0
- package/dist-lib/lib/tools/exec/adapters/python/output-policy.js +129 -0
- package/dist-lib/lib/tools/exec/adapters/python/pyodide.d.ts +19 -0
- package/dist-lib/lib/tools/exec/adapters/python/pyodide.js +107 -0
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.d.ts +75 -0
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.js +1094 -0
- package/dist-lib/lib/tools/exec/adapters/python/run-session.d.ts +75 -0
- package/dist-lib/lib/tools/exec/adapters/python/run-session.js +273 -0
- package/dist-lib/lib/tools/exec/adapters/python/wheels.d.ts +38 -0
- package/dist-lib/lib/tools/exec/adapters/python/wheels.js +102 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/client.d.ts +7 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/client.js +188 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/entry.d.ts +1 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/entry.js +105 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/protocol.d.ts +38 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/protocol.js +41 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-bare.d.ts +2 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-bare.js +30 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-node.d.ts +13 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-node.js +45 -0
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.d.ts +12 -0
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.js +20 -0
- package/dist-lib/lib/tools/exec/obsidian/cli-process.d.ts +8 -0
- package/dist-lib/lib/tools/exec/obsidian/cli-process.js +74 -0
- package/dist-lib/lib/tools/exec/obsidian/cli.d.ts +18 -0
- package/dist-lib/lib/tools/exec/obsidian/cli.js +153 -0
- package/dist-lib/lib/tools/exec/obsidian/command.d.ts +5 -0
- package/dist-lib/lib/tools/exec/obsidian/command.js +18 -0
- package/dist-lib/lib/tools/exec/obsidian/guidance.d.ts +5 -0
- package/dist-lib/lib/tools/exec/obsidian/guidance.js +18 -0
- package/dist-lib/lib/tools/exec/obsidian/note-name.d.ts +1 -0
- package/dist-lib/lib/tools/exec/obsidian/note-name.js +6 -0
- package/dist-lib/lib/tools/exec/obsidian/output.d.ts +1 -0
- package/dist-lib/lib/tools/exec/obsidian/output.js +31 -0
- package/dist-lib/lib/tools/exec/obsidian/route.d.ts +19 -0
- package/dist-lib/lib/tools/exec/obsidian/route.js +85 -0
- package/dist-lib/lib/tools/exec/obsidian/safe-path.d.ts +3 -0
- package/dist-lib/lib/tools/exec/obsidian/safe-path.js +56 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-create.d.ts +1 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-create.js +40 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-fs.d.ts +3 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-fs.js +57 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-paths.d.ts +20 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-paths.js +171 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-read.d.ts +11 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-read.js +119 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-write.d.ts +7 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-write.js +134 -0
- package/dist-lib/lib/tools/exec/runner.d.ts +62 -0
- package/dist-lib/lib/tools/exec/runner.js +87 -0
- package/dist-lib/lib/tools/exec/scope.d.ts +3 -0
- package/dist-lib/lib/tools/exec/scope.js +97 -0
- package/dist-lib/lib/tools/exec/shell-argv.d.ts +2 -0
- package/dist-lib/lib/tools/exec/shell-argv.js +48 -0
- package/dist-lib/lib/tools/exec.d.ts +29 -0
- package/dist-lib/lib/tools/exec.js +459 -0
- package/dist-lib/lib/tools/file-glob.d.ts +15 -0
- package/dist-lib/lib/tools/file-glob.js +112 -0
- package/dist-lib/lib/tools/fs/drive.d.ts +26 -0
- package/dist-lib/lib/tools/fs/drive.js +1 -0
- package/dist-lib/lib/tools/fs/glob.d.ts +1 -0
- package/dist-lib/lib/tools/fs/glob.js +34 -0
- package/dist-lib/lib/tools/fs/local.d.ts +2 -0
- package/dist-lib/lib/tools/fs/local.js +29 -0
- package/dist-lib/lib/tools/fs/read.d.ts +2 -0
- package/dist-lib/lib/tools/fs/read.js +17 -0
- package/dist-lib/lib/tools/fs/remote-protocol.d.ts +40 -0
- package/dist-lib/lib/tools/fs/remote-protocol.js +1 -0
- package/dist-lib/lib/tools/fs/remote.d.ts +17 -0
- package/dist-lib/lib/tools/fs/remote.js +131 -0
- package/dist-lib/lib/tools/fs/scope.d.ts +37 -0
- package/dist-lib/lib/tools/fs/scope.js +130 -0
- package/dist-lib/lib/tools/fs/walk.d.ts +15 -0
- package/dist-lib/lib/tools/fs/walk.js +38 -0
- package/dist-lib/lib/tools/fs/write.d.ts +4 -0
- package/dist-lib/lib/tools/fs/write.js +5 -0
- package/dist-lib/lib/tools/generate-image.d.ts +111 -0
- package/dist-lib/lib/tools/generate-image.js +369 -0
- package/dist-lib/lib/tools/generate-music.d.ts +124 -0
- package/dist-lib/lib/tools/generate-music.js +522 -0
- package/dist-lib/lib/tools/grep.d.ts +5 -0
- package/dist-lib/lib/tools/grep.js +158 -0
- package/dist-lib/lib/tools/http-methods.d.ts +1 -0
- package/dist-lib/lib/tools/http-methods.js +1 -0
- package/dist-lib/lib/tools/http-request/encode-fields.d.ts +2 -0
- package/dist-lib/lib/tools/http-request/encode-fields.js +69 -0
- package/dist-lib/lib/tools/http-request/truncate-response.d.ts +1 -0
- package/dist-lib/lib/tools/http-request/truncate-response.js +83 -0
- package/dist-lib/lib/tools/http-request/utils.d.ts +27 -0
- package/dist-lib/lib/tools/http-request/utils.js +84 -0
- package/dist-lib/lib/tools/http-request.d.ts +20 -0
- package/dist-lib/lib/tools/http-request.js +177 -0
- package/dist-lib/lib/tools/mcp/utils.d.ts +47 -0
- package/dist-lib/lib/tools/mcp/utils.js +172 -0
- package/dist-lib/lib/tools/mcp-call.d.ts +14 -0
- package/dist-lib/lib/tools/mcp-call.js +155 -0
- package/dist-lib/lib/tools/model-args.d.ts +1 -0
- package/dist-lib/lib/tools/model-args.js +4 -0
- package/dist-lib/lib/tools/operations/builders.d.ts +17 -0
- package/dist-lib/lib/tools/operations/builders.js +179 -0
- package/dist-lib/lib/tools/operations/compile.d.ts +7 -0
- package/dist-lib/lib/tools/operations/compile.js +92 -0
- package/dist-lib/lib/tools/operations/gmail-message.d.ts +15 -0
- package/dist-lib/lib/tools/operations/gmail-message.js +62 -0
- package/dist-lib/lib/tools/operations/manifest.d.ts +60 -0
- package/dist-lib/lib/tools/operations/manifest.js +50 -0
- package/dist-lib/lib/tools/outbound-guard.d.ts +10 -0
- package/dist-lib/lib/tools/outbound-guard.js +127 -0
- package/dist-lib/lib/tools/private-ip.d.ts +4 -0
- package/dist-lib/lib/tools/private-ip.js +126 -0
- package/dist-lib/lib/tools/rag-search.d.ts +2 -0
- package/dist-lib/lib/tools/rag-search.js +98 -0
- package/dist-lib/lib/tools/read-files.d.ts +5 -0
- package/dist-lib/lib/tools/read-files.js +153 -0
- package/dist-lib/lib/tools/skill.d.ts +10 -0
- package/dist-lib/lib/tools/skill.js +123 -0
- package/dist-lib/lib/tools/skills/auth-resolver.d.ts +43 -0
- package/dist-lib/lib/tools/skills/auth-resolver.js +121 -0
- package/dist-lib/lib/tools/skills/bin-check.d.ts +9 -0
- package/dist-lib/lib/tools/skills/bin-check.js +56 -0
- package/dist-lib/lib/tools/skills/bundled-dir.d.ts +2 -0
- package/dist-lib/lib/tools/skills/bundled-dir.js +117 -0
- package/dist-lib/lib/tools/skills/bundled-hash.d.ts +4 -0
- package/dist-lib/lib/tools/skills/bundled-hash.js +12 -0
- package/dist-lib/lib/tools/skills/catalog.d.ts +60 -0
- package/dist-lib/lib/tools/skills/catalog.js +203 -0
- package/dist-lib/lib/tools/skills/cli-argv.d.ts +9 -0
- package/dist-lib/lib/tools/skills/cli-argv.js +147 -0
- package/dist-lib/lib/tools/skills/cli-schema-check.d.ts +3 -0
- package/dist-lib/lib/tools/skills/cli-schema-check.js +62 -0
- package/dist-lib/lib/tools/skills/cli-schema-load.d.ts +4 -0
- package/dist-lib/lib/tools/skills/cli-schema-load.js +90 -0
- package/dist-lib/lib/tools/skills/cli-schema-types.d.ts +30 -0
- package/dist-lib/lib/tools/skills/cli-schema-types.js +1 -0
- package/dist-lib/lib/tools/skills/cli-schema.d.ts +7 -0
- package/dist-lib/lib/tools/skills/cli-schema.js +35 -0
- package/dist-lib/lib/tools/skills/credential-check.d.ts +20 -0
- package/dist-lib/lib/tools/skills/credential-check.js +94 -0
- package/dist-lib/lib/tools/skills/credential-grants.d.ts +9 -0
- package/dist-lib/lib/tools/skills/credential-grants.js +25 -0
- package/dist-lib/lib/tools/skills/credential-health.d.ts +8 -0
- package/dist-lib/lib/tools/skills/credential-health.js +51 -0
- package/dist-lib/lib/tools/skills/credential-slots.d.ts +7 -0
- package/dist-lib/lib/tools/skills/credential-slots.js +8 -0
- package/dist-lib/lib/tools/skills/frontmatter-parser.d.ts +23 -0
- package/dist-lib/lib/tools/skills/frontmatter-parser.js +68 -0
- package/dist-lib/lib/tools/skills/index.d.ts +5 -0
- package/dist-lib/lib/tools/skills/index.js +5 -0
- package/dist-lib/lib/tools/skills/manifest-parse.d.ts +12 -0
- package/dist-lib/lib/tools/skills/manifest-parse.js +199 -0
- package/dist-lib/lib/tools/skills/manifest.d.ts +47 -0
- package/dist-lib/lib/tools/skills/manifest.js +1 -0
- package/dist-lib/lib/tools/skills/mention-name.d.ts +1 -0
- package/dist-lib/lib/tools/skills/mention-name.js +4 -0
- package/dist-lib/lib/tools/skills/mention.d.ts +6 -0
- package/dist-lib/lib/tools/skills/mention.js +42 -0
- package/dist-lib/lib/tools/skills/obsidian-readiness.d.ts +16 -0
- package/dist-lib/lib/tools/skills/obsidian-readiness.js +95 -0
- package/dist-lib/lib/tools/skills/overlay-crud.d.ts +18 -0
- package/dist-lib/lib/tools/skills/overlay-crud.js +98 -0
- package/dist-lib/lib/tools/skills/overlay-dir.d.ts +2 -0
- package/dist-lib/lib/tools/skills/overlay-dir.js +22 -0
- package/dist-lib/lib/tools/skills/overlay-watch.d.ts +13 -0
- package/dist-lib/lib/tools/skills/overlay-watch.js +44 -0
- package/dist-lib/lib/tools/skills/scope-key.d.ts +7 -0
- package/dist-lib/lib/tools/skills/scope-key.js +7 -0
- package/dist-lib/lib/tools/skills/setup-routes.d.ts +4 -0
- package/dist-lib/lib/tools/skills/setup-routes.js +14 -0
- package/dist-lib/lib/tools/skills/skill-settings.d.ts +16 -0
- package/dist-lib/lib/tools/skills/skill-settings.js +33 -0
- package/dist-lib/lib/tools/skills/skill-state-constants.d.ts +12 -0
- package/dist-lib/lib/tools/skills/skill-state-constants.js +14 -0
- package/dist-lib/lib/tools/skills/skill-state.d.ts +40 -0
- package/dist-lib/lib/tools/skills/skill-state.js +117 -0
- package/dist-lib/lib/tools/skills/tool-grants.d.ts +5 -0
- package/dist-lib/lib/tools/skills/tool-grants.js +14 -0
- package/dist-lib/lib/tools/toolsets.d.ts +8 -0
- package/dist-lib/lib/tools/toolsets.js +20 -0
- package/dist-lib/lib/tools/url-guard.d.ts +8 -0
- package/dist-lib/lib/tools/url-guard.js +40 -0
- package/dist-lib/lib/tools/web-fetch.d.ts +8 -0
- package/dist-lib/lib/tools/web-fetch.js +302 -0
- package/dist-lib/lib/tools/web-search.d.ts +6 -0
- package/dist-lib/lib/tools/web-search.js +55 -0
- package/dist-lib/lib/transport.d.ts +12 -0
- package/dist-lib/lib/transport.js +59 -0
- package/dist-lib/lib/user-agent.d.ts +1 -0
- package/dist-lib/lib/user-agent.js +1 -0
- package/dist-lib/lib/validating-lookup.d.ts +17 -0
- package/dist-lib/lib/validating-lookup.js +25 -0
- package/dist-lib/lib/wav-encode.d.ts +5 -0
- package/dist-lib/lib/wav-encode.js +24 -0
- package/dist-lib/lib/web-fetch/embedded-state.d.ts +1 -0
- package/dist-lib/lib/web-fetch/embedded-state.js +131 -0
- package/dist-lib/lib/web-fetch/extract.d.ts +6 -0
- package/dist-lib/lib/web-fetch/extract.js +65 -0
- package/dist-lib/lib/web-fetch/images.d.ts +3 -0
- package/dist-lib/lib/web-fetch/images.js +43 -0
- package/dist-lib/lib/web-fetch/video.d.ts +5 -0
- package/dist-lib/lib/web-fetch/video.js +42 -0
- package/dist-lib/lib/web-search/engine-registry.d.ts +7 -0
- package/dist-lib/lib/web-search/engine-registry.js +17 -0
- package/dist-lib/lib/web-search/engines/aol.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/aol.js +81 -0
- package/dist-lib/lib/web-search/engines/bing.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/bing.js +111 -0
- package/dist-lib/lib/web-search/engines/brave.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/brave.js +59 -0
- package/dist-lib/lib/web-search/engines/duckduckgo.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/duckduckgo.js +112 -0
- package/dist-lib/lib/web-search/engines/google.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/google.js +92 -0
- package/dist-lib/lib/web-search/engines/wikipedia.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/wikipedia.js +37 -0
- package/dist-lib/lib/web-search/engines/yahoo.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/yahoo.js +81 -0
- package/dist-lib/lib/web-search/fetch-html.d.ts +25 -0
- package/dist-lib/lib/web-search/fetch-html.js +97 -0
- package/dist-lib/lib/web-search/format-results.d.ts +3 -0
- package/dist-lib/lib/web-search/format-results.js +14 -0
- package/dist-lib/lib/web-search/html-helpers.d.ts +3 -0
- package/dist-lib/lib/web-search/html-helpers.js +24 -0
- package/dist-lib/lib/web-search/merge-results.d.ts +2 -0
- package/dist-lib/lib/web-search/merge-results.js +53 -0
- package/dist-lib/lib/web-search/orchestrator.d.ts +14 -0
- package/dist-lib/lib/web-search/orchestrator.js +50 -0
- package/dist-lib/lib/web-search/types.d.ts +34 -0
- package/dist-lib/lib/web-search/types.js +1 -0
- package/dist-lib/lib/web-search/url-helpers.d.ts +1 -0
- package/dist-lib/lib/web-search/url-helpers.js +11 -0
- package/dist-lib/lib/web-search/url-normalize.d.ts +1 -0
- package/dist-lib/lib/web-search/url-normalize.js +25 -0
- package/dist-lib/lib/web-search/user-agents.d.ts +3 -0
- package/dist-lib/lib/web-search/user-agents.js +3 -0
- package/dist-lib/lib/wire.d.ts +50 -0
- package/dist-lib/lib/wire.js +145 -0
- package/dist-lib/schema/baseline.d.ts +8 -0
- package/dist-lib/schema/baseline.js +35 -0
- package/dist-lib/schema/build.d.ts +1 -0
- package/dist-lib/schema/build.js +39 -0
- package/dist-lib/schema/generate.d.ts +20 -0
- package/dist-lib/schema/generate.js +149 -0
- package/dist-lib/schema/harness.d.ts +2 -0
- package/dist-lib/schema/harness.js +745 -0
- package/dist-lib/schema/release-tags.d.ts +5 -0
- package/dist-lib/schema/release-tags.js +58 -0
- package/dist-lib/spec/bind.d.ts +2 -0
- package/dist-lib/spec/bind.js +124 -0
- package/dist-lib/spec/calls.d.ts +3 -0
- package/dist-lib/spec/calls.js +41 -0
- package/dist-lib/spec/hrpc/hrpc.json +356 -0
- package/dist-lib/spec/hrpc/index.d.ts +3 -0
- package/dist-lib/spec/hrpc/index.js +463 -0
- package/dist-lib/spec/hrpc/messages.d.ts +4 -0
- package/dist-lib/spec/hrpc/messages.js +3102 -0
- package/dist-lib/spec/hyperschema/index.js +3102 -0
- package/dist-lib/spec/hyperschema/schema.json +2290 -0
- package/dist-lib/spec/hyperschema/types.d.ts +554 -0
- package/dist-lib/spec/index.d.ts +8 -0
- package/dist-lib/spec/index.js +1 -0
- package/package.json +418 -1
- package/wheels/cffi-2.0.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/cryptography-47.0.0-cp314-abi3-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/defusedxml-0.7.1-py2.py3-none-any.whl +0 -0
- package/wheels/et_xmlfile-2.0.0-py3-none-any.whl +0 -0
- package/wheels/fonttools-4.62.1-py3-none-any.whl +0 -0
- package/wheels/fpdf2-2.8.8-py3-none-any.whl +0 -0
- package/wheels/lxml-6.0.2-cp314-cp314-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/manifest.json +155 -0
- package/wheels/micropip-0.11.1-py3-none-any.whl +0 -0
- package/wheels/openpyxl-3.1.5-py2.py3-none-any.whl +0 -0
- package/wheels/pillow-12.2.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/pycparser-3.0-py3-none-any.whl +0 -0
- package/wheels/pypdf-6.15.0-py3-none-any.whl +0 -0
- package/wheels/python_docx-1.2.0-py3-none-any.whl +0 -0
- package/wheels/python_pptx-1.0.2-py3-none-any.whl +0 -0
- package/wheels/six-1.17.0-py2.py3-none-any.whl +0 -0
- package/wheels/typing_extensions-4.15.0-py3-none-any.whl +0 -0
- package/wheels/xlsxwriter-3.2.9-py3-none-any.whl +0 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { IMAGE_INPUT, OFFICE_READ, PDF_READ, isEscaped, parseInputs, parseOutputs, parsePackages, stripCommentsAndDocstrings, unwrapPythonSource } from "./python-adapter.js";
|
|
2
|
+
const ARTIFACT_OUTPUT = /\.(docx|xlsx|pptx|pdf)$/i;
|
|
3
|
+
const CREATE_PACKAGES = new Map([
|
|
4
|
+
['python-docx', '1.2.0'],
|
|
5
|
+
['openpyxl', '3.1.5'],
|
|
6
|
+
['python-pptx', '1.0.2'],
|
|
7
|
+
['fpdf2', '2.8.8'],
|
|
8
|
+
['pillow', null]
|
|
9
|
+
]);
|
|
10
|
+
const PACKAGE_SPEC = /^([A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?)(?:==([0-9A-Za-z.]+))?$/;
|
|
11
|
+
const IMPORT_ROOTS = new Set(['docx', 'openpyxl', 'pptx', 'fpdf', 'datetime']);
|
|
12
|
+
const BUILDER_ROOTS = new Set(['docx', 'openpyxl', 'pptx', 'fpdf']);
|
|
13
|
+
const IMPORT_FROM = /^\s*from\s+([A-Za-z]\w*(?:\.[A-Za-z]\w*)*)\s+import\s+[A-Za-z]\w*(?:\s+as\s+[A-Za-z]\w*)?(?:\s*,\s*[A-Za-z]\w*(?:\s+as\s+[A-Za-z]\w*)?)*\s*$/;
|
|
14
|
+
const ALLOWED_BUILTINS = new Set([
|
|
15
|
+
'True',
|
|
16
|
+
'False',
|
|
17
|
+
'None',
|
|
18
|
+
'Ellipsis',
|
|
19
|
+
'NotImplemented',
|
|
20
|
+
'Exception',
|
|
21
|
+
'ValueError',
|
|
22
|
+
'KeyError',
|
|
23
|
+
'IndexError',
|
|
24
|
+
'TypeError',
|
|
25
|
+
'RuntimeError',
|
|
26
|
+
'abs',
|
|
27
|
+
'all',
|
|
28
|
+
'any',
|
|
29
|
+
'bool',
|
|
30
|
+
'dict',
|
|
31
|
+
'divmod',
|
|
32
|
+
'enumerate',
|
|
33
|
+
'filter',
|
|
34
|
+
'float',
|
|
35
|
+
'int',
|
|
36
|
+
'len',
|
|
37
|
+
'list',
|
|
38
|
+
'map',
|
|
39
|
+
'max',
|
|
40
|
+
'min',
|
|
41
|
+
'pow',
|
|
42
|
+
'print',
|
|
43
|
+
'range',
|
|
44
|
+
'reversed',
|
|
45
|
+
'round',
|
|
46
|
+
'set',
|
|
47
|
+
'sorted',
|
|
48
|
+
'str',
|
|
49
|
+
'sum',
|
|
50
|
+
'tuple',
|
|
51
|
+
'zip'
|
|
52
|
+
]);
|
|
53
|
+
const PYTHON_BUILTINS = new Set(`ArithmeticError AssertionError AttributeError BaseException BaseExceptionGroup
|
|
54
|
+
BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError
|
|
55
|
+
ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError
|
|
56
|
+
DeprecationWarning EOFError Ellipsis EncodingWarning EnvironmentError Exception
|
|
57
|
+
ExceptionGroup False FileExistsError FileNotFoundError FloatingPointError
|
|
58
|
+
FutureWarning GeneratorExit IOError ImportError ImportWarning IndentationError
|
|
59
|
+
IndexError InterruptedError IsADirectoryError KeyError KeyboardInterrupt
|
|
60
|
+
LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError
|
|
61
|
+
NotImplemented NotImplementedError OSError OverflowError PendingDeprecationWarning
|
|
62
|
+
PermissionError ProcessLookupError PythonFinalizationError RecursionError
|
|
63
|
+
ReferenceError ResourceWarning RuntimeError RuntimeWarning StopAsyncIteration
|
|
64
|
+
StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError
|
|
65
|
+
TimeoutError True TypeError UnboundLocalError UnicodeDecodeError
|
|
66
|
+
UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning
|
|
67
|
+
ValueError Warning ZeroDivisionError abs aiter all anext any ascii bin bool
|
|
68
|
+
breakpoint bytearray bytes callable chr classmethod compile complex copyright
|
|
69
|
+
credits delattr dict dir divmod enumerate eval exec execfile exit filter float
|
|
70
|
+
format frozenset getattr globals hasattr hash help hex id input int isinstance
|
|
71
|
+
issubclass iter len license list locals map max memoryview min next object oct
|
|
72
|
+
open ord pow print property quit range reload repr reversed round set setattr
|
|
73
|
+
slice sorted staticmethod str sum super tuple type unicode vars zip`.split(/\s+/));
|
|
74
|
+
const DENIED_TOKENS = new Set([
|
|
75
|
+
'os',
|
|
76
|
+
'sys',
|
|
77
|
+
'js',
|
|
78
|
+
'pyodide',
|
|
79
|
+
'micropip',
|
|
80
|
+
'builtins',
|
|
81
|
+
'importlib',
|
|
82
|
+
'inspect',
|
|
83
|
+
'ctypes',
|
|
84
|
+
'subprocess',
|
|
85
|
+
'platform',
|
|
86
|
+
'shutil',
|
|
87
|
+
'pathlib',
|
|
88
|
+
'glob',
|
|
89
|
+
'tempfile',
|
|
90
|
+
'gc',
|
|
91
|
+
'socket',
|
|
92
|
+
'requests',
|
|
93
|
+
'urllib',
|
|
94
|
+
'http',
|
|
95
|
+
'ssl',
|
|
96
|
+
'ftplib',
|
|
97
|
+
'smtplib',
|
|
98
|
+
'webbrowser',
|
|
99
|
+
'pickle',
|
|
100
|
+
'marshal',
|
|
101
|
+
'base64',
|
|
102
|
+
'codecs',
|
|
103
|
+
'io',
|
|
104
|
+
'threading',
|
|
105
|
+
'asyncio',
|
|
106
|
+
'async',
|
|
107
|
+
'await',
|
|
108
|
+
'format_map',
|
|
109
|
+
'vformat'
|
|
110
|
+
]);
|
|
111
|
+
const INTROSPECTION_TOKEN = /^(?:gi|cr|ag|f|tb|im|func)_/;
|
|
112
|
+
function isFStringPrefix(code) {
|
|
113
|
+
const prefix = /[A-Za-z]{1,3}$/.exec(code)?.[0] ?? '';
|
|
114
|
+
return prefix.length <= 2 && /f/i.test(prefix);
|
|
115
|
+
}
|
|
116
|
+
export function splitPythonSource(source) {
|
|
117
|
+
let code = '';
|
|
118
|
+
let text = '';
|
|
119
|
+
let i = 0;
|
|
120
|
+
while (i < source.length) {
|
|
121
|
+
const ch = source[i];
|
|
122
|
+
if (ch === '#') {
|
|
123
|
+
while (i < source.length && source[i] !== '\n') {
|
|
124
|
+
text += source[i];
|
|
125
|
+
i++;
|
|
126
|
+
}
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const triple = source.startsWith('"""', i) ? '"""' : source.startsWith("'''", i) ? "'''" : null;
|
|
130
|
+
const quote = triple ?? (ch === '"' || ch === "'" ? ch : null);
|
|
131
|
+
if (quote) {
|
|
132
|
+
const fstring = isFStringPrefix(code);
|
|
133
|
+
const end = scanLiteral(source, i + quote.length, quote, fstring);
|
|
134
|
+
if (!end)
|
|
135
|
+
return null;
|
|
136
|
+
code += '""';
|
|
137
|
+
text += end.text;
|
|
138
|
+
code += end.code;
|
|
139
|
+
i = end.index;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
code += ch;
|
|
143
|
+
i++;
|
|
144
|
+
}
|
|
145
|
+
return { code, text };
|
|
146
|
+
}
|
|
147
|
+
function scanLiteral(source, start, quote, fstring) {
|
|
148
|
+
let text = '';
|
|
149
|
+
let code = '';
|
|
150
|
+
let i = start;
|
|
151
|
+
while (i < source.length) {
|
|
152
|
+
if (source.startsWith(quote, i) && !isEscaped(source, i)) {
|
|
153
|
+
return { index: i + quote.length, text, code };
|
|
154
|
+
}
|
|
155
|
+
const ch = source[i];
|
|
156
|
+
if (fstring && (ch === '{' || ch === '}')) {
|
|
157
|
+
if (source[i + 1] === ch) {
|
|
158
|
+
text += ch + ch;
|
|
159
|
+
i += 2;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (ch === '}')
|
|
163
|
+
return null;
|
|
164
|
+
const interior = scanInterpolation(source, i + 1);
|
|
165
|
+
if (!interior)
|
|
166
|
+
return null;
|
|
167
|
+
code += ` ${interior.code} `;
|
|
168
|
+
text += interior.text;
|
|
169
|
+
i = interior.index;
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
text += ch;
|
|
173
|
+
i++;
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
function scanInterpolation(source, start) {
|
|
178
|
+
let code = '';
|
|
179
|
+
let text = '';
|
|
180
|
+
let depth = 1;
|
|
181
|
+
let nested = null;
|
|
182
|
+
let i = start;
|
|
183
|
+
while (i < source.length) {
|
|
184
|
+
const ch = source[i];
|
|
185
|
+
if (nested) {
|
|
186
|
+
if (ch === nested && !isEscaped(source, i))
|
|
187
|
+
nested = null;
|
|
188
|
+
else
|
|
189
|
+
text += ch;
|
|
190
|
+
i++;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (ch === '"' || ch === "'") {
|
|
194
|
+
nested = ch;
|
|
195
|
+
i++;
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (ch === '{')
|
|
199
|
+
depth++;
|
|
200
|
+
if (ch === '}') {
|
|
201
|
+
depth--;
|
|
202
|
+
if (depth === 0)
|
|
203
|
+
return { index: i + 1, text, code };
|
|
204
|
+
}
|
|
205
|
+
code += ch;
|
|
206
|
+
i++;
|
|
207
|
+
}
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
function isKeywordArgument(code, start, length) {
|
|
211
|
+
const before = code.slice(0, start).trimEnd();
|
|
212
|
+
const last = before[before.length - 1];
|
|
213
|
+
if (last !== '(' && last !== ',')
|
|
214
|
+
return false;
|
|
215
|
+
const after = code.slice(start + length).trimStart();
|
|
216
|
+
return after.startsWith('=') && after[1] !== '=';
|
|
217
|
+
}
|
|
218
|
+
function lintCreateSource(source) {
|
|
219
|
+
const halves = splitPythonSource(source);
|
|
220
|
+
if (!halves)
|
|
221
|
+
return 'write';
|
|
222
|
+
if (halves.text.includes('__'))
|
|
223
|
+
return 'write';
|
|
224
|
+
if (/\\(?:x[0-9A-Fa-f]|u[0-9A-Fa-f]|U[0-9A-Fa-f]|N\{|[0-7])/.test(halves.text))
|
|
225
|
+
return 'write';
|
|
226
|
+
if (/[^\x20-\x7e\t\r\n\f]/.test(halves.code))
|
|
227
|
+
return 'write';
|
|
228
|
+
let builder = false;
|
|
229
|
+
for (const line of halves.code.split('\n')) {
|
|
230
|
+
for (const statement of line.split(';')) {
|
|
231
|
+
if (!/\b(?:from|import)\b/.test(statement))
|
|
232
|
+
continue;
|
|
233
|
+
const match = IMPORT_FROM.exec(statement);
|
|
234
|
+
if (!match)
|
|
235
|
+
return 'write';
|
|
236
|
+
const root = match[1].split('.')[0];
|
|
237
|
+
if (!IMPORT_ROOTS.has(root))
|
|
238
|
+
return 'write';
|
|
239
|
+
if (BUILDER_ROOTS.has(root))
|
|
240
|
+
builder = true;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (!builder)
|
|
244
|
+
return 'write';
|
|
245
|
+
for (const match of halves.code.matchAll(/[A-Za-z_]\w*/g)) {
|
|
246
|
+
const token = match[0];
|
|
247
|
+
if (token.includes('__') || DENIED_TOKENS.has(token) || INTROSPECTION_TOKEN.test(token)) {
|
|
248
|
+
return 'write';
|
|
249
|
+
}
|
|
250
|
+
if (isKeywordArgument(halves.code, match.index, token.length))
|
|
251
|
+
continue;
|
|
252
|
+
if (PYTHON_BUILTINS.has(token) && !ALLOWED_BUILTINS.has(token))
|
|
253
|
+
return 'write';
|
|
254
|
+
}
|
|
255
|
+
const openers = stripCommentsAndDocstrings(source);
|
|
256
|
+
const reads = [new RegExp(OFFICE_READ.source), new RegExp(PDF_READ.source)];
|
|
257
|
+
if (reads.some((pattern) => pattern.test(openers)))
|
|
258
|
+
return 'write';
|
|
259
|
+
return 'read';
|
|
260
|
+
}
|
|
261
|
+
export function pythonCreateEffect(args) {
|
|
262
|
+
const outputs = parseOutputs(args.outputs);
|
|
263
|
+
if (!Array.isArray(outputs) || outputs.length === 0)
|
|
264
|
+
return 'write';
|
|
265
|
+
if (!outputs.every((name) => ARTIFACT_OUTPUT.test(name)))
|
|
266
|
+
return 'write';
|
|
267
|
+
const packages = parsePackages(args.packages);
|
|
268
|
+
if (packages && 'error' in packages)
|
|
269
|
+
return 'write';
|
|
270
|
+
for (const spec of packages ?? []) {
|
|
271
|
+
const match = PACKAGE_SPEC.exec(spec);
|
|
272
|
+
if (!match)
|
|
273
|
+
return 'write';
|
|
274
|
+
const name = match[1].toLowerCase().replace(/[_.]+/g, '-');
|
|
275
|
+
if (!CREATE_PACKAGES.has(name))
|
|
276
|
+
return 'write';
|
|
277
|
+
if (CREATE_PACKAGES.get(name) !== (match[2] ?? null))
|
|
278
|
+
return 'write';
|
|
279
|
+
}
|
|
280
|
+
const inputs = parseInputs(args.inputs);
|
|
281
|
+
if (inputs && 'error' in inputs)
|
|
282
|
+
return 'write';
|
|
283
|
+
if ((inputs ?? []).some((input) => !IMAGE_INPUT.test(input.path)))
|
|
284
|
+
return 'write';
|
|
285
|
+
const command = String(args.command ?? '');
|
|
286
|
+
const source = unwrapPythonSource(command) ?? command;
|
|
287
|
+
if (!source.trim())
|
|
288
|
+
return 'write';
|
|
289
|
+
return lintCreateSource(source);
|
|
290
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import process from 'process';
|
|
2
|
+
import type { LoadPyodideFn } from './run-session.ts';
|
|
3
|
+
type NodeShapedProcess = typeof process & {
|
|
4
|
+
binding(name: string): Record<string, unknown>;
|
|
5
|
+
};
|
|
6
|
+
export declare function nodeShapedProcess(base: typeof process): NodeShapedProcess;
|
|
7
|
+
export declare function pyodideLoadOptions(): {
|
|
8
|
+
packageCacheDir: string;
|
|
9
|
+
} | undefined;
|
|
10
|
+
export declare const defaultLoad: LoadPyodideFn;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import b4a from 'b4a';
|
|
10
|
+
import { constants as fsConstants } from 'fs';
|
|
11
|
+
import process from 'process';
|
|
12
|
+
import { seedPackageCache } from "./wheels.js";
|
|
13
|
+
class B4aTextDecoder {
|
|
14
|
+
encoding;
|
|
15
|
+
constructor(label = 'utf-8') {
|
|
16
|
+
const normalized = String(label).toLowerCase();
|
|
17
|
+
if (normalized.includes('16'))
|
|
18
|
+
this.encoding = 'utf16le';
|
|
19
|
+
else if (/latin1|iso-8859|ascii/.test(normalized))
|
|
20
|
+
this.encoding = 'latin1';
|
|
21
|
+
else
|
|
22
|
+
this.encoding = 'utf8';
|
|
23
|
+
}
|
|
24
|
+
decode(input) {
|
|
25
|
+
if (input === undefined)
|
|
26
|
+
return '';
|
|
27
|
+
const view = input instanceof ArrayBuffer
|
|
28
|
+
? new Uint8Array(input)
|
|
29
|
+
: new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
|
|
30
|
+
return b4a.toString(view, this.encoding);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
class B4aTextEncoder {
|
|
34
|
+
encode(input = '') {
|
|
35
|
+
return new Uint8Array(b4a.from(String(input), 'utf8'));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function nodeShapedProcess(base) {
|
|
39
|
+
return new Proxy(base, {
|
|
40
|
+
get(target, prop) {
|
|
41
|
+
if (prop === 'versions')
|
|
42
|
+
return { ...target.versions, node: '22.0.0' };
|
|
43
|
+
if (prop === 'binding') {
|
|
44
|
+
return (name) => (name === 'constants' ? { fs: fsConstants } : {});
|
|
45
|
+
}
|
|
46
|
+
if (prop === 'getuid')
|
|
47
|
+
return () => 0;
|
|
48
|
+
return Reflect.get(target, prop);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async function shapeBareGlobals() {
|
|
53
|
+
const g = globalThis;
|
|
54
|
+
if (!g.fetch) {
|
|
55
|
+
const bareFetch = await import('bare-fetch');
|
|
56
|
+
g.fetch = bareFetch.default;
|
|
57
|
+
g.Request = bareFetch.Request;
|
|
58
|
+
g.Response = bareFetch.Response;
|
|
59
|
+
g.Headers = bareFetch.Headers;
|
|
60
|
+
}
|
|
61
|
+
if (!g.AbortController) {
|
|
62
|
+
const { AbortController, AbortSignal } = await import('bare-abort-controller');
|
|
63
|
+
g.AbortController = AbortController;
|
|
64
|
+
g.AbortSignal = AbortSignal;
|
|
65
|
+
}
|
|
66
|
+
if (!g.TextDecoder)
|
|
67
|
+
g.TextDecoder = B4aTextDecoder;
|
|
68
|
+
if (!g.TextEncoder)
|
|
69
|
+
g.TextEncoder = B4aTextEncoder;
|
|
70
|
+
if (!g.process)
|
|
71
|
+
g.process = nodeShapedProcess(process);
|
|
72
|
+
if (!g.performance) {
|
|
73
|
+
const origin = Date.now();
|
|
74
|
+
g.performance = { now: () => Date.now() - origin, timeOrigin: origin };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export function pyodideLoadOptions() {
|
|
78
|
+
const cacheDir = process.env.QVAC_PYODIDE_CACHE_DIR;
|
|
79
|
+
if (!cacheDir)
|
|
80
|
+
return undefined;
|
|
81
|
+
return { packageCacheDir: cacheDir };
|
|
82
|
+
}
|
|
83
|
+
export const defaultLoad = async () => {
|
|
84
|
+
if (typeof globalThis.Bare !== 'undefined')
|
|
85
|
+
await shapeBareGlobals();
|
|
86
|
+
const moduleName = 'pyodide';
|
|
87
|
+
const { loadPyodide } = (await import(__rewriteRelativeImportExtension(moduleName)));
|
|
88
|
+
const options = pyodideLoadOptions();
|
|
89
|
+
if (options) {
|
|
90
|
+
seedPackageCache(options.packageCacheDir);
|
|
91
|
+
return (await loadPyodide(options));
|
|
92
|
+
}
|
|
93
|
+
return (await loadPyodide());
|
|
94
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
type Fs = {
|
|
2
|
+
mkdirTree(path: string): void;
|
|
3
|
+
chdir(path: string): void;
|
|
4
|
+
writeFile(path: string, data: Uint8Array): void;
|
|
5
|
+
readFile(path: string, opts: {
|
|
6
|
+
encoding: 'binary';
|
|
7
|
+
}): Uint8Array;
|
|
8
|
+
analyzePath(path: string): {
|
|
9
|
+
exists: boolean;
|
|
10
|
+
};
|
|
11
|
+
readdir(path: string): string[];
|
|
12
|
+
stat(path: string): {
|
|
13
|
+
mode: number;
|
|
14
|
+
size: number;
|
|
15
|
+
};
|
|
16
|
+
lstat(path: string): {
|
|
17
|
+
mode: number;
|
|
18
|
+
};
|
|
19
|
+
isDir(mode: number): boolean;
|
|
20
|
+
isLink(mode: number): boolean;
|
|
21
|
+
unlink(path: string): void;
|
|
22
|
+
rmdir(path: string): void;
|
|
23
|
+
};
|
|
24
|
+
export type Scratch = {
|
|
25
|
+
readonly dir: string;
|
|
26
|
+
readonly cwd: string;
|
|
27
|
+
[Symbol.dispose](): void;
|
|
28
|
+
};
|
|
29
|
+
type InputFile = {
|
|
30
|
+
readonly path: string;
|
|
31
|
+
readonly bytes: Uint8Array;
|
|
32
|
+
};
|
|
33
|
+
export declare function nextScratchDir(fs: Pick<Fs, 'analyzePath'>): string;
|
|
34
|
+
export declare function stageInputFiles(fs: Fs, dir: string, inputs: readonly InputFile[]): void;
|
|
35
|
+
export declare function collectOutputs(fs: Fs, dir: string, names: readonly string[]): {
|
|
36
|
+
files: Map<string, Uint8Array>;
|
|
37
|
+
missing: string[];
|
|
38
|
+
rejected: {
|
|
39
|
+
name: string;
|
|
40
|
+
reason: string;
|
|
41
|
+
}[];
|
|
42
|
+
};
|
|
43
|
+
export declare function removeScratch(fs: Fs, dir: string, previousCwd: string): void;
|
|
44
|
+
export declare function openScratch(fs: Fs & {
|
|
45
|
+
cwd(): string;
|
|
46
|
+
}, workdir?: string): Scratch;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { hlog } from "../../../../log.js";
|
|
2
|
+
import { MAX_OUTPUT_FILE_BYTES, MAX_OUTPUT_TOTAL_BYTES } from "./output-policy.js";
|
|
3
|
+
let runCounter = 0;
|
|
4
|
+
function filePath(dir, name) {
|
|
5
|
+
return `${dir}/${name}`;
|
|
6
|
+
}
|
|
7
|
+
export function nextScratchDir(fs) {
|
|
8
|
+
let candidate = `/tmp/qvac-exec-${++runCounter}`;
|
|
9
|
+
while (fs.analyzePath(candidate).exists)
|
|
10
|
+
candidate = `/tmp/qvac-exec-${++runCounter}`;
|
|
11
|
+
return candidate;
|
|
12
|
+
}
|
|
13
|
+
export function stageInputFiles(fs, dir, inputs) {
|
|
14
|
+
fs.mkdirTree(dir);
|
|
15
|
+
for (const input of inputs)
|
|
16
|
+
fs.writeFile(filePath(dir, input.path), input.bytes);
|
|
17
|
+
}
|
|
18
|
+
function isRegularFile(fs, path) {
|
|
19
|
+
const mode = fs.lstat(path).mode;
|
|
20
|
+
return !fs.isDir(mode) && !fs.isLink(mode);
|
|
21
|
+
}
|
|
22
|
+
export function collectOutputs(fs, dir, names) {
|
|
23
|
+
const files = new Map();
|
|
24
|
+
const missing = [];
|
|
25
|
+
const rejected = [];
|
|
26
|
+
let total = 0;
|
|
27
|
+
for (const name of names) {
|
|
28
|
+
const path = filePath(dir, name);
|
|
29
|
+
if (fs.analyzePath(path).exists && isRegularFile(fs, path)) {
|
|
30
|
+
const size = fs.stat(path).size;
|
|
31
|
+
if (size > MAX_OUTPUT_FILE_BYTES) {
|
|
32
|
+
rejected.push({ name, reason: 'file exceeds maximum output size' });
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (total + size > MAX_OUTPUT_TOTAL_BYTES) {
|
|
36
|
+
rejected.push({ name, reason: 'outputs exceed maximum total size' });
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
files.set(name, new Uint8Array(fs.readFile(path, { encoding: 'binary' })));
|
|
40
|
+
total += size;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
missing.push(name);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { files, missing, rejected };
|
|
47
|
+
}
|
|
48
|
+
function removeTree(fs, dir) {
|
|
49
|
+
for (const name of fs.readdir(dir)) {
|
|
50
|
+
if (name === '.' || name === '..')
|
|
51
|
+
continue;
|
|
52
|
+
const path = filePath(dir, name);
|
|
53
|
+
const mode = fs.lstat(path).mode;
|
|
54
|
+
if (fs.isDir(mode) && !fs.isLink(mode))
|
|
55
|
+
removeTree(fs, path);
|
|
56
|
+
else
|
|
57
|
+
fs.unlink(path);
|
|
58
|
+
}
|
|
59
|
+
fs.rmdir(dir);
|
|
60
|
+
}
|
|
61
|
+
export function removeScratch(fs, dir, previousCwd) {
|
|
62
|
+
try {
|
|
63
|
+
fs.chdir(previousCwd);
|
|
64
|
+
removeTree(fs, dir);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
hlog('python: scratch cleanup failed', {
|
|
68
|
+
dir,
|
|
69
|
+
err: error instanceof Error ? error.message : String(error)
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export function openScratch(fs, workdir) {
|
|
74
|
+
const dir = nextScratchDir(fs);
|
|
75
|
+
const cwd = workdir ? `${dir}/${workdir}` : dir;
|
|
76
|
+
const previousCwd = fs.cwd();
|
|
77
|
+
fs.mkdirTree(cwd);
|
|
78
|
+
return {
|
|
79
|
+
dir,
|
|
80
|
+
cwd,
|
|
81
|
+
[Symbol.dispose]() {
|
|
82
|
+
removeScratch(fs, dir, previousCwd);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const MAX_OUTPUT_FILE_BYTES: number;
|
|
2
|
+
export declare const MAX_OUTPUT_TOTAL_BYTES: number;
|
|
3
|
+
export declare const RUN_OUTPUT_BUDGET_BYTES: number;
|
|
4
|
+
export declare const MAX_OUTPUTS = 8;
|
|
5
|
+
export declare const MAX_INPUTS = 24;
|
|
6
|
+
export declare const MAX_INPUT_TOTAL_BYTES: number;
|
|
7
|
+
export declare function checkFileName(name: string): string | null;
|
|
8
|
+
export declare function checkOutputName(name: string): string | null;
|
|
9
|
+
export declare function checkOutputBytes(name: string, bytes: Uint8Array, runningTotal: number): {
|
|
10
|
+
mimeType: string;
|
|
11
|
+
} | {
|
|
12
|
+
error: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export const MAX_OUTPUT_FILE_BYTES = 25 * 1024 * 1024;
|
|
2
|
+
export const MAX_OUTPUT_TOTAL_BYTES = 50 * 1024 * 1024;
|
|
3
|
+
export const RUN_OUTPUT_BUDGET_BYTES = 150 * 1024 * 1024;
|
|
4
|
+
export const MAX_OUTPUTS = 8;
|
|
5
|
+
export const MAX_INPUTS = 24;
|
|
6
|
+
export const MAX_INPUT_TOTAL_BYTES = 50 * 1024 * 1024;
|
|
7
|
+
const MAX_FILE_NAME_LENGTH = 255;
|
|
8
|
+
const MIME_TYPES = {
|
|
9
|
+
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
10
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
11
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
12
|
+
pdf: 'application/pdf',
|
|
13
|
+
png: 'image/png',
|
|
14
|
+
jpeg: 'image/jpeg',
|
|
15
|
+
jpg: 'image/jpeg',
|
|
16
|
+
gif: 'image/gif',
|
|
17
|
+
webp: 'image/webp',
|
|
18
|
+
csv: 'text/csv',
|
|
19
|
+
json: 'application/json',
|
|
20
|
+
txt: 'text/plain',
|
|
21
|
+
md: 'text/markdown',
|
|
22
|
+
zip: 'application/zip'
|
|
23
|
+
};
|
|
24
|
+
const DENIED_EXTENSIONS = new Set([
|
|
25
|
+
'pptm',
|
|
26
|
+
'docm',
|
|
27
|
+
'xlsm',
|
|
28
|
+
'command',
|
|
29
|
+
'sh',
|
|
30
|
+
'py',
|
|
31
|
+
'app',
|
|
32
|
+
'dmg',
|
|
33
|
+
'scpt',
|
|
34
|
+
'jar'
|
|
35
|
+
]);
|
|
36
|
+
function extensionOf(name) {
|
|
37
|
+
return name.slice(name.lastIndexOf('.') + 1).toLowerCase();
|
|
38
|
+
}
|
|
39
|
+
function isKnownExtension(extension) {
|
|
40
|
+
return extension in MIME_TYPES || DENIED_EXTENSIONS.has(extension);
|
|
41
|
+
}
|
|
42
|
+
function matches(bytes, signature) {
|
|
43
|
+
if (bytes.length < signature.length)
|
|
44
|
+
return false;
|
|
45
|
+
return signature.every((byte, index) => bytes[index] === byte);
|
|
46
|
+
}
|
|
47
|
+
function hasExpectedSignature(extension, bytes) {
|
|
48
|
+
if (extension === 'pptx' || extension === 'docx' || extension === 'xlsx' || extension === 'zip') {
|
|
49
|
+
return matches(bytes, [0x50, 0x4b, 0x03, 0x04]);
|
|
50
|
+
}
|
|
51
|
+
if (extension === 'pdf')
|
|
52
|
+
return matches(bytes, [0x25, 0x50, 0x44, 0x46, 0x2d]);
|
|
53
|
+
if (extension === 'png')
|
|
54
|
+
return matches(bytes, [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
55
|
+
if (extension === 'jpeg' || extension === 'jpg')
|
|
56
|
+
return matches(bytes, [0xff, 0xd8, 0xff]);
|
|
57
|
+
if (extension === 'gif') {
|
|
58
|
+
return (matches(bytes, [0x47, 0x49, 0x46, 0x38, 0x37, 0x61]) ||
|
|
59
|
+
matches(bytes, [0x47, 0x49, 0x46, 0x38, 0x39, 0x61]));
|
|
60
|
+
}
|
|
61
|
+
if (extension === 'webp') {
|
|
62
|
+
return (matches(bytes, [0x52, 0x49, 0x46, 0x46]) && matches(bytes.slice(8), [0x57, 0x45, 0x42, 0x50]));
|
|
63
|
+
}
|
|
64
|
+
return !bytes.includes(0);
|
|
65
|
+
}
|
|
66
|
+
export function checkFileName(name) {
|
|
67
|
+
if (!name)
|
|
68
|
+
return 'file name must not be empty';
|
|
69
|
+
if (/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/.test(name)) {
|
|
70
|
+
return 'file name must not contain control characters';
|
|
71
|
+
}
|
|
72
|
+
if (/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/.test(name)) {
|
|
73
|
+
return 'file name must not contain bidi characters';
|
|
74
|
+
}
|
|
75
|
+
if (/[\u200b-\u200d\u2060\ufeff]/.test(name)) {
|
|
76
|
+
return 'file name must not contain invisible characters';
|
|
77
|
+
}
|
|
78
|
+
if (name.includes('/') || name.includes('\\')) {
|
|
79
|
+
return 'file name must not contain path separators';
|
|
80
|
+
}
|
|
81
|
+
if (name.includes('..'))
|
|
82
|
+
return 'file name must not contain double dots';
|
|
83
|
+
if (name.startsWith('.'))
|
|
84
|
+
return 'file name must not start with a dot';
|
|
85
|
+
if (name.endsWith('.') || name.endsWith(' ')) {
|
|
86
|
+
return 'file name must not end with a dot or space';
|
|
87
|
+
}
|
|
88
|
+
const segments = name.split('.');
|
|
89
|
+
if (segments.slice(1, -1).some((segment) => isKnownExtension(segment.toLowerCase()))) {
|
|
90
|
+
return 'file name must have at most one extension';
|
|
91
|
+
}
|
|
92
|
+
if (name.length > MAX_FILE_NAME_LENGTH)
|
|
93
|
+
return 'file name must be 255 characters or fewer';
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const SUPERSEDED = { ppt: 'pptx', doc: 'docx', xls: 'xlsx' };
|
|
97
|
+
export function checkOutputName(name) {
|
|
98
|
+
const nameError = checkFileName(name);
|
|
99
|
+
if (nameError)
|
|
100
|
+
return nameError;
|
|
101
|
+
const extension = extensionOf(name);
|
|
102
|
+
const mimeType = MIME_TYPES[extension];
|
|
103
|
+
if (DENIED_EXTENSIONS.has(extension) || !mimeType) {
|
|
104
|
+
const saw = extension && extension !== name.toLowerCase()
|
|
105
|
+
? `".${extension}" is not an allowed output type`
|
|
106
|
+
: `"${name}" has no file extension`;
|
|
107
|
+
const instead = SUPERSEDED[extension];
|
|
108
|
+
const fix = instead ? ` — this runtime writes the current format, so name it ".${instead}"` : '';
|
|
109
|
+
return `${saw}${fix}. Allowed: ${Object.keys(MIME_TYPES)
|
|
110
|
+
.map((e) => `.${e}`)
|
|
111
|
+
.join(', ')}`;
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
export function checkOutputBytes(name, bytes, runningTotal) {
|
|
116
|
+
const nameError = checkOutputName(name);
|
|
117
|
+
if (nameError)
|
|
118
|
+
return { error: nameError };
|
|
119
|
+
const extension = extensionOf(name);
|
|
120
|
+
const mimeType = MIME_TYPES[extension];
|
|
121
|
+
if (!hasExpectedSignature(extension, bytes))
|
|
122
|
+
return { error: 'file bytes do not match file type' };
|
|
123
|
+
if (bytes.length > MAX_OUTPUT_FILE_BYTES)
|
|
124
|
+
return { error: 'file exceeds maximum output size' };
|
|
125
|
+
if (runningTotal + bytes.length > MAX_OUTPUT_TOTAL_BYTES) {
|
|
126
|
+
return { error: 'outputs exceed maximum total size' };
|
|
127
|
+
}
|
|
128
|
+
return { mimeType };
|
|
129
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
|
+
import { pyodideLoadOptions } from './loader.ts';
|
|
3
|
+
import { type LoadPyodideFn, type PyodideLike, type PythonRunResult } from './run-session.ts';
|
|
4
|
+
export { pyodideLoadOptions };
|
|
5
|
+
export type { LoadPyodideFn, PyodideLike, PythonRunResult };
|
|
6
|
+
export type RunPythonOptions = {
|
|
7
|
+
readonly timeoutMs?: number;
|
|
8
|
+
readonly maxOutputChars?: number;
|
|
9
|
+
readonly signal?: BareAbortSignal;
|
|
10
|
+
readonly packages?: readonly string[];
|
|
11
|
+
readonly inputs?: readonly {
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly bytes: Uint8Array;
|
|
14
|
+
}[];
|
|
15
|
+
readonly outputs?: readonly string[];
|
|
16
|
+
readonly workdir?: string;
|
|
17
|
+
readonly loadPyodide?: LoadPyodideFn;
|
|
18
|
+
};
|
|
19
|
+
export declare function runPython(code: string, options?: RunPythonOptions): Promise<PythonRunResult>;
|