wicked-crew 0.18.19 → 0.18.21
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 +9 -6
- package/dist/api/ask-paths.d.ts +2 -0
- package/dist/api/ask-paths.d.ts.map +1 -1
- package/dist/api/ask-paths.js +6 -0
- package/dist/api/ask-paths.js.map +1 -1
- package/dist/api/auth.d.ts +7 -5
- package/dist/api/auth.d.ts.map +1 -1
- package/dist/api/auth.js +23 -9
- package/dist/api/auth.js.map +1 -1
- package/dist/api/capture.d.ts +5 -2
- package/dist/api/capture.d.ts.map +1 -1
- package/dist/api/capture.js +13 -10
- package/dist/api/capture.js.map +1 -1
- package/dist/api/chat-attachments.d.ts.map +1 -1
- package/dist/api/chat-attachments.js +69 -19
- package/dist/api/chat-attachments.js.map +1 -1
- package/dist/api/chat-citations.d.ts.map +1 -1
- package/dist/api/chat-citations.js +22 -0
- package/dist/api/chat-citations.js.map +1 -1
- package/dist/api/chat-context.d.ts +16 -1
- package/dist/api/chat-context.d.ts.map +1 -1
- package/dist/api/chat-context.js +75 -14
- package/dist/api/chat-context.js.map +1 -1
- package/dist/api/chat-freshness.js +2 -2
- package/dist/api/chat-freshness.js.map +1 -1
- package/dist/api/chat-history.d.ts +13 -0
- package/dist/api/chat-history.d.ts.map +1 -1
- package/dist/api/chat-history.js +25 -0
- package/dist/api/chat-history.js.map +1 -1
- package/dist/api/chat-jobs.d.ts +67 -6
- package/dist/api/chat-jobs.d.ts.map +1 -1
- package/dist/api/chat-jobs.js +243 -22
- package/dist/api/chat-jobs.js.map +1 -1
- package/dist/api/chat-proposals.d.ts +69 -6
- package/dist/api/chat-proposals.d.ts.map +1 -1
- package/dist/api/chat-proposals.js +310 -49
- package/dist/api/chat-proposals.js.map +1 -1
- package/dist/api/chat-requirements.d.ts.map +1 -1
- package/dist/api/chat-requirements.js +4 -1
- package/dist/api/chat-requirements.js.map +1 -1
- package/dist/api/chat-scope.d.ts +17 -9
- package/dist/api/chat-scope.d.ts.map +1 -1
- package/dist/api/chat-scope.js +55 -21
- package/dist/api/chat-scope.js.map +1 -1
- package/dist/api/cluster-status.d.ts +24 -12
- package/dist/api/cluster-status.d.ts.map +1 -1
- package/dist/api/cluster-status.js +82 -4
- package/dist/api/cluster-status.js.map +1 -1
- package/dist/api/codebase-archive.d.ts +4 -3
- package/dist/api/codebase-archive.d.ts.map +1 -1
- package/dist/api/codebase-archive.js +6 -5
- package/dist/api/codebase-archive.js.map +1 -1
- package/dist/api/delivery-cache.d.ts +2 -0
- package/dist/api/delivery-cache.d.ts.map +1 -1
- package/dist/api/delivery-cache.js +1 -2
- package/dist/api/delivery-cache.js.map +1 -1
- package/dist/api/delivery-index.d.ts +2 -2
- package/dist/api/delivery-index.d.ts.map +1 -1
- package/dist/api/delivery-index.js +1 -2
- package/dist/api/delivery-index.js.map +1 -1
- package/dist/api/eval-compare.d.ts +1 -1
- package/dist/api/eval-compare.js +1 -1
- package/dist/api/eval-sample.d.ts +7 -0
- package/dist/api/eval-sample.d.ts.map +1 -1
- package/dist/api/eval-sample.js +20 -0
- package/dist/api/eval-sample.js.map +1 -1
- package/dist/api/gate-cache.d.ts +1 -0
- package/dist/api/gate-cache.d.ts.map +1 -1
- package/dist/api/gate-cache.js +19 -6
- package/dist/api/gate-cache.js.map +1 -1
- package/dist/api/governance-steering.d.ts +17 -4
- package/dist/api/governance-steering.d.ts.map +1 -1
- package/dist/api/governance-steering.js +56 -7
- package/dist/api/governance-steering.js.map +1 -1
- package/dist/api/mcp.d.ts +12 -2
- package/dist/api/mcp.d.ts.map +1 -1
- package/dist/api/mcp.js +56 -12
- package/dist/api/mcp.js.map +1 -1
- package/dist/api/needs.d.ts +20 -0
- package/dist/api/needs.d.ts.map +1 -1
- package/dist/api/needs.js +120 -19
- package/dist/api/needs.js.map +1 -1
- package/dist/api/onboarding-capture.d.ts +21 -1
- package/dist/api/onboarding-capture.d.ts.map +1 -1
- package/dist/api/onboarding-capture.js +112 -8
- package/dist/api/onboarding-capture.js.map +1 -1
- package/dist/api/policy-landing.d.ts +36 -0
- package/dist/api/policy-landing.d.ts.map +1 -1
- package/dist/api/policy-landing.js +123 -4
- package/dist/api/policy-landing.js.map +1 -1
- package/dist/api/post-hoc-deliver.d.ts.map +1 -1
- package/dist/api/post-hoc-deliver.js +2 -1
- package/dist/api/post-hoc-deliver.js.map +1 -1
- package/dist/api/product.d.ts +1 -1
- package/dist/api/proposal-decisions.d.ts +44 -0
- package/dist/api/proposal-decisions.d.ts.map +1 -0
- package/dist/api/proposal-decisions.js +85 -0
- package/dist/api/proposal-decisions.js.map +1 -0
- package/dist/api/proposal-onboard.d.ts +38 -1
- package/dist/api/proposal-onboard.d.ts.map +1 -1
- package/dist/api/proposal-onboard.js +203 -14
- package/dist/api/proposal-onboard.js.map +1 -1
- package/dist/api/recording.d.ts +1 -1
- package/dist/api/recording.d.ts.map +1 -1
- package/dist/api/recording.js +4 -5
- package/dist/api/recording.js.map +1 -1
- package/dist/api/redeliver.d.ts.map +1 -1
- package/dist/api/redeliver.js +11 -7
- package/dist/api/redeliver.js.map +1 -1
- package/dist/api/repo-input.d.ts.map +1 -1
- package/dist/api/repo-input.js +5 -2
- package/dist/api/repo-input.js.map +1 -1
- package/dist/api/repo-origins.d.ts +24 -0
- package/dist/api/repo-origins.d.ts.map +1 -0
- package/dist/api/repo-origins.js +71 -0
- package/dist/api/repo-origins.js.map +1 -0
- package/dist/api/requirements.d.ts +37 -16
- package/dist/api/requirements.d.ts.map +1 -1
- package/dist/api/requirements.js +73 -2
- package/dist/api/requirements.js.map +1 -1
- package/dist/api/retry-index.d.ts +2 -0
- package/dist/api/retry-index.d.ts.map +1 -1
- package/dist/api/retry-index.js +16 -8
- package/dist/api/retry-index.js.map +1 -1
- package/dist/api/review-change.d.ts +5 -6
- package/dist/api/review-change.d.ts.map +1 -1
- package/dist/api/review-change.js +45 -8
- package/dist/api/review-change.js.map +1 -1
- package/dist/api/roster-standing.d.ts +2 -0
- package/dist/api/roster-standing.d.ts.map +1 -1
- package/dist/api/roster-standing.js +8 -1
- package/dist/api/roster-standing.js.map +1 -1
- package/dist/api/routes.d.ts +55 -12
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +961 -277
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-documents.d.ts +9 -1
- package/dist/api/run-documents.d.ts.map +1 -1
- package/dist/api/run-documents.js +63 -5
- package/dist/api/run-documents.js.map +1 -1
- package/dist/api/run-sources.d.ts +11 -1
- package/dist/api/run-sources.d.ts.map +1 -1
- package/dist/api/run-sources.js +26 -3
- package/dist/api/run-sources.js.map +1 -1
- package/dist/api/run-timing-index.d.ts +47 -0
- package/dist/api/run-timing-index.d.ts.map +1 -1
- package/dist/api/run-timing-index.js +196 -86
- package/dist/api/run-timing-index.js.map +1 -1
- package/dist/api/runtime-state.d.ts +6 -0
- package/dist/api/runtime-state.d.ts.map +1 -1
- package/dist/api/runtime-state.js +14 -3
- package/dist/api/runtime-state.js.map +1 -1
- package/dist/api/seat-agents.d.ts.map +1 -1
- package/dist/api/seat-agents.js +3 -3
- package/dist/api/seat-agents.js.map +1 -1
- package/dist/api/seat-container-login.d.ts +6 -2
- package/dist/api/seat-container-login.d.ts.map +1 -1
- package/dist/api/seat-container-login.js +17 -9
- package/dist/api/seat-container-login.js.map +1 -1
- package/dist/api/seat-governance.d.ts +3 -2
- package/dist/api/seat-governance.d.ts.map +1 -1
- package/dist/api/seat-governance.js +31 -9
- package/dist/api/seat-governance.js.map +1 -1
- package/dist/api/seat-standing.d.ts +8 -0
- package/dist/api/seat-standing.d.ts.map +1 -1
- package/dist/api/seat-standing.js +26 -1
- package/dist/api/seat-standing.js.map +1 -1
- package/dist/api/server.d.ts +7 -0
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +172 -59
- package/dist/api/server.js.map +1 -1
- package/dist/api/stall-watchdog.d.ts +6 -0
- package/dist/api/stall-watchdog.d.ts.map +1 -1
- package/dist/api/stall-watchdog.js +28 -0
- package/dist/api/stall-watchdog.js.map +1 -1
- package/dist/api/start-on-login.d.ts +4 -0
- package/dist/api/start-on-login.d.ts.map +1 -0
- package/dist/api/start-on-login.js +35 -0
- package/dist/api/start-on-login.js.map +1 -0
- package/dist/api/steering-landing.d.ts +33 -8
- package/dist/api/steering-landing.d.ts.map +1 -1
- package/dist/api/steering-landing.js +235 -51
- package/dist/api/steering-landing.js.map +1 -1
- package/dist/api/system-snapshot.d.ts +5 -0
- package/dist/api/system-snapshot.d.ts.map +1 -1
- package/dist/api/system-snapshot.js +22 -10
- package/dist/api/system-snapshot.js.map +1 -1
- package/dist/api/testing.d.ts +2 -2
- package/dist/api/ui-text.js +2 -2
- package/dist/api/ui-text.js.map +1 -1
- package/dist/api/worktree-sweep.d.ts +7 -3
- package/dist/api/worktree-sweep.d.ts.map +1 -1
- package/dist/api/worktree-sweep.js +10 -6
- package/dist/api/worktree-sweep.js.map +1 -1
- package/dist/apps/actions/api-action.js +5 -2
- package/dist/apps/actions/api-action.js.map +1 -1
- package/dist/apps/actions/write-path.d.ts +9 -0
- package/dist/apps/actions/write-path.d.ts.map +1 -1
- package/dist/apps/actions/write-path.js +17 -9
- package/dist/apps/actions/write-path.js.map +1 -1
- package/dist/apps/exec/executor.d.ts +8 -15
- package/dist/apps/exec/executor.d.ts.map +1 -1
- package/dist/apps/exec/executor.js +10 -3
- package/dist/apps/exec/executor.js.map +1 -1
- package/dist/apps/exec/recall.d.ts.map +1 -1
- package/dist/apps/exec/recall.js +4 -4
- package/dist/apps/exec/recall.js.map +1 -1
- package/dist/apps/exec/redescribe.d.ts +37 -0
- package/dist/apps/exec/redescribe.d.ts.map +1 -0
- package/dist/apps/exec/redescribe.js +86 -0
- package/dist/apps/exec/redescribe.js.map +1 -0
- package/dist/apps/exec/source-stage.d.ts +3 -1
- package/dist/apps/exec/source-stage.d.ts.map +1 -1
- package/dist/apps/exec/source-stage.js +13 -3
- package/dist/apps/exec/source-stage.js.map +1 -1
- package/dist/apps/exec/sources.d.ts +6 -0
- package/dist/apps/exec/sources.d.ts.map +1 -1
- package/dist/apps/exec/sources.js +8 -0
- package/dist/apps/exec/sources.js.map +1 -1
- package/dist/apps/git.js +2 -2
- package/dist/apps/git.js.map +1 -1
- package/dist/apps/publish/manifest.d.ts +8 -1
- package/dist/apps/publish/manifest.d.ts.map +1 -1
- package/dist/apps/publish/manifest.js +14 -3
- package/dist/apps/publish/manifest.js.map +1 -1
- package/dist/apps/publish/run.d.ts +15 -2
- package/dist/apps/publish/run.d.ts.map +1 -1
- package/dist/apps/publish/run.js +100 -17
- package/dist/apps/publish/run.js.map +1 -1
- package/dist/apps/routes.d.ts +3 -0
- package/dist/apps/routes.d.ts.map +1 -1
- package/dist/apps/routes.js +58 -2
- package/dist/apps/routes.js.map +1 -1
- package/dist/apps/store.d.ts +24 -3
- package/dist/apps/store.d.ts.map +1 -1
- package/dist/apps/store.js +26 -9
- package/dist/apps/store.js.map +1 -1
- package/dist/apps/turns.d.ts +25 -2
- package/dist/apps/turns.d.ts.map +1 -1
- package/dist/apps/turns.js +276 -11
- package/dist/apps/turns.js.map +1 -1
- package/dist/apps-server/Dockerfile +2 -2
- package/dist/apps-server/runners/sqlite-runner.mjs +67 -12
- package/dist/apps-server/server/lib/bundle/server.mjs +353 -159
- package/dist/cli/governance.d.ts +5 -2
- package/dist/cli/governance.d.ts.map +1 -1
- package/dist/cli/governance.js +8 -5
- package/dist/cli/governance.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/service.d.ts +10 -6
- package/dist/cli/service.d.ts.map +1 -1
- package/dist/cli/service.js +39 -23
- package/dist/cli/service.js.map +1 -1
- package/dist/core/adapter.d.ts +61 -29
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +214 -83
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/ado-deliver-helper.d.ts +2 -1
- package/dist/core/ado-deliver-helper.d.ts.map +1 -1
- package/dist/core/ado-deliver-helper.js +26 -1
- package/dist/core/ado-deliver-helper.js.map +1 -1
- package/dist/core/assurance.d.ts +45 -42
- package/dist/core/assurance.d.ts.map +1 -1
- package/dist/core/assurance.js +74 -67
- package/dist/core/assurance.js.map +1 -1
- package/dist/core/deliver-text.d.ts +14 -0
- package/dist/core/deliver-text.d.ts.map +1 -1
- package/dist/core/deliver-text.js +41 -2
- package/dist/core/deliver-text.js.map +1 -1
- package/dist/core/deliver.d.ts +66 -1
- package/dist/core/deliver.d.ts.map +1 -1
- package/dist/core/deliver.js +183 -10
- package/dist/core/deliver.js.map +1 -1
- package/dist/core/engine-roster.d.ts +2 -0
- package/dist/core/engine-roster.d.ts.map +1 -1
- package/dist/core/engine-roster.js +13 -0
- package/dist/core/engine-roster.js.map +1 -1
- package/dist/core/estate-mcp-client.d.ts +13 -14
- package/dist/core/estate-mcp-client.d.ts.map +1 -1
- package/dist/core/estate-mcp-client.js +49 -68
- package/dist/core/estate-mcp-client.js.map +1 -1
- package/dist/core/exec.d.ts +24 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +45 -2
- package/dist/core/exec.js.map +1 -1
- package/dist/core/linked-issues.d.ts +13 -2
- package/dist/core/linked-issues.d.ts.map +1 -1
- package/dist/core/linked-issues.js +135 -4
- package/dist/core/linked-issues.js.map +1 -1
- package/dist/core/pr-checks-helper.d.ts +8 -4
- package/dist/core/pr-checks-helper.d.ts.map +1 -1
- package/dist/core/pr-checks-helper.js +39 -17
- package/dist/core/pr-checks-helper.js.map +1 -1
- package/dist/core/redeliver.js +2 -2
- package/dist/core/redeliver.js.map +1 -1
- package/dist/core/repo-clone.d.ts +64 -0
- package/dist/core/repo-clone.d.ts.map +1 -0
- package/dist/core/repo-clone.js +306 -0
- package/dist/core/repo-clone.js.map +1 -0
- package/dist/core/repoPaths.d.ts +2 -4
- package/dist/core/repoPaths.d.ts.map +1 -1
- package/dist/core/repoPaths.js +4 -6
- package/dist/core/repoPaths.js.map +1 -1
- package/dist/core/run-identity.d.ts.map +1 -1
- package/dist/core/run-identity.js +3 -0
- package/dist/core/run-identity.js.map +1 -1
- package/dist/core/run-read-lane.d.ts +30 -0
- package/dist/core/run-read-lane.d.ts.map +1 -0
- package/dist/core/run-read-lane.js +103 -0
- package/dist/core/run-read-lane.js.map +1 -0
- package/dist/core/types.d.ts +10 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -1
- package/dist/core/walkthrough-root.d.ts.map +1 -1
- package/dist/core/walkthrough-root.js +3 -5
- package/dist/core/walkthrough-root.js.map +1 -1
- package/dist/core/wicked-home.d.ts +9 -0
- package/dist/core/wicked-home.d.ts.map +1 -0
- package/dist/core/wicked-home.js +25 -0
- package/dist/core/wicked-home.js.map +1 -0
- package/dist/decisions/consider.d.ts +2 -1
- package/dist/decisions/consider.d.ts.map +1 -1
- package/dist/decisions/consider.js +2 -2
- package/dist/decisions/consider.js.map +1 -1
- package/dist/decisions/land.d.ts +2 -0
- package/dist/decisions/land.d.ts.map +1 -1
- package/dist/decisions/land.js +16 -3
- package/dist/decisions/land.js.map +1 -1
- package/dist/decisions/rules-brief.d.ts +4 -1
- package/dist/decisions/rules-brief.d.ts.map +1 -1
- package/dist/decisions/rules-brief.js +3 -2
- package/dist/decisions/rules-brief.js.map +1 -1
- package/dist/editors/conformance-runtime.d.ts +0 -2
- package/dist/editors/conformance-runtime.d.ts.map +1 -1
- package/dist/editors/conformance-runtime.js +0 -4
- package/dist/editors/conformance-runtime.js.map +1 -1
- package/dist/editors/csp.d.ts +6 -0
- package/dist/editors/csp.d.ts.map +1 -1
- package/dist/editors/csp.js +10 -0
- package/dist/editors/csp.js.map +1 -1
- package/dist/editors/pack-install.d.ts +11 -15
- package/dist/editors/pack-install.d.ts.map +1 -1
- package/dist/editors/pack-install.js +52 -65
- package/dist/editors/pack-install.js.map +1 -1
- package/dist/editors/registry.d.ts +31 -13
- package/dist/editors/registry.d.ts.map +1 -1
- package/dist/editors/registry.js +51 -18
- package/dist/editors/registry.js.map +1 -1
- package/dist/editors/routes.d.ts +4 -2
- package/dist/editors/routes.d.ts.map +1 -1
- package/dist/editors/routes.js +23 -6
- package/dist/editors/routes.js.map +1 -1
- package/dist/editors/visuals.d.ts +4 -3
- package/dist/editors/visuals.d.ts.map +1 -1
- package/dist/editors/visuals.js +17 -7
- package/dist/editors/visuals.js.map +1 -1
- package/dist/evals/runner.js +1 -1
- package/dist/evals/runner.js.map +1 -1
- package/dist/evals/shape-corrections.js +1 -1
- package/dist/evals/shape-corrections.js.map +1 -1
- package/dist/evals/shape.d.ts +7 -1
- package/dist/evals/shape.d.ts.map +1 -1
- package/dist/evals/shape.js +26 -6
- package/dist/evals/shape.js.map +1 -1
- package/dist/evals/workflow.d.ts +16 -3
- package/dist/evals/workflow.d.ts.map +1 -1
- package/dist/evals/workflow.js +32 -6
- package/dist/evals/workflow.js.map +1 -1
- package/dist/governance/rule-revision.d.ts +7 -0
- package/dist/governance/rule-revision.d.ts.map +1 -0
- package/dist/governance/rule-revision.js +23 -0
- package/dist/governance/rule-revision.js.map +1 -0
- package/dist/insights/review-service.d.ts +26 -3
- package/dist/insights/review-service.d.ts.map +1 -1
- package/dist/insights/review-service.js +101 -11
- package/dist/insights/review-service.js.map +1 -1
- package/dist/insights/routes.d.ts +2 -1
- package/dist/insights/routes.d.ts.map +1 -1
- package/dist/insights/routes.js +19 -4
- package/dist/insights/routes.js.map +1 -1
- package/dist/insights/run-facts.d.ts +5 -0
- package/dist/insights/run-facts.d.ts.map +1 -1
- package/dist/insights/run-facts.js +15 -0
- package/dist/insights/run-facts.js.map +1 -1
- package/dist/insights/workflow.d.ts +2 -1
- package/dist/insights/workflow.d.ts.map +1 -1
- package/dist/insights/workflow.js +4 -4
- package/dist/insights/workflow.js.map +1 -1
- package/dist/inspect/service.d.ts +3 -2
- package/dist/inspect/service.d.ts.map +1 -1
- package/dist/inspect/service.js +4 -4
- package/dist/inspect/service.js.map +1 -1
- package/dist/interactive/bridge-pool.d.ts +2 -0
- package/dist/interactive/bridge-pool.d.ts.map +1 -1
- package/dist/interactive/bridge-pool.js +18 -8
- package/dist/interactive/bridge-pool.js.map +1 -1
- package/dist/interactive/chat-events.d.ts +3 -0
- package/dist/interactive/chat-events.d.ts.map +1 -1
- package/dist/interactive/chat-events.js +20 -5
- package/dist/interactive/chat-events.js.map +1 -1
- package/dist/interactive/doc-delete-routes.d.ts +1 -0
- package/dist/interactive/doc-delete-routes.d.ts.map +1 -1
- package/dist/interactive/doc-delete-routes.js +126 -123
- package/dist/interactive/doc-delete-routes.js.map +1 -1
- package/dist/interactive/draft-events.d.ts +11 -7
- package/dist/interactive/draft-events.d.ts.map +1 -1
- package/dist/interactive/draft-events.js +29 -22
- package/dist/interactive/draft-events.js.map +1 -1
- package/dist/interactive/draft-skill.d.ts +56 -3
- package/dist/interactive/draft-skill.d.ts.map +1 -1
- package/dist/interactive/draft-skill.js +129 -20
- package/dist/interactive/draft-skill.js.map +1 -1
- package/dist/interactive/landing-guard.d.ts +30 -5
- package/dist/interactive/landing-guard.d.ts.map +1 -1
- package/dist/interactive/landing-guard.js +121 -5
- package/dist/interactive/landing-guard.js.map +1 -1
- package/dist/interactive/proposal-create.d.ts +9 -11
- package/dist/interactive/proposal-create.d.ts.map +1 -1
- package/dist/interactive/proposal-create.js +28 -21
- package/dist/interactive/proposal-create.js.map +1 -1
- package/dist/interactive/proposal-refine.d.ts +4 -4
- package/dist/interactive/proposal-refine.d.ts.map +1 -1
- package/dist/interactive/proposal-refine.js +40 -7
- package/dist/interactive/proposal-refine.js.map +1 -1
- package/dist/interactive/proxy-routes.d.ts +10 -5
- package/dist/interactive/proxy-routes.d.ts.map +1 -1
- package/dist/interactive/proxy-routes.js +108 -11
- package/dist/interactive/proxy-routes.js.map +1 -1
- package/dist/interactive/review-events.js +1 -1
- package/dist/interactive/review-events.js.map +1 -1
- package/dist/interactive/run-units.d.ts.map +1 -1
- package/dist/interactive/run-units.js +3 -2
- package/dist/interactive/run-units.js.map +1 -1
- package/dist/interactive/source-packet.d.ts +13 -1
- package/dist/interactive/source-packet.d.ts.map +1 -1
- package/dist/interactive/source-packet.js +108 -34
- package/dist/interactive/source-packet.js.map +1 -1
- package/dist/knowledge/adapters/toolbox/memory.d.ts +2 -0
- package/dist/knowledge/adapters/toolbox/memory.d.ts.map +1 -0
- package/dist/knowledge/adapters/toolbox/memory.js +43 -0
- package/dist/knowledge/adapters/toolbox/memory.js.map +1 -0
- package/dist/knowledge/adapters/toolbox/supervisor.d.ts +30 -4
- package/dist/knowledge/adapters/toolbox/supervisor.d.ts.map +1 -1
- package/dist/knowledge/adapters/toolbox/supervisor.js +112 -28
- package/dist/knowledge/adapters/toolbox/supervisor.js.map +1 -1
- package/dist/knowledge/estate-write.d.ts +5 -0
- package/dist/knowledge/estate-write.d.ts.map +1 -1
- package/dist/knowledge/estate-write.js +7 -0
- package/dist/knowledge/estate-write.js.map +1 -1
- package/dist/knowledge/gate/gate.d.ts.map +1 -1
- package/dist/knowledge/gate/gate.js +4 -1
- package/dist/knowledge/gate/gate.js.map +1 -1
- package/dist/knowledge/gate/record.d.ts +15 -2
- package/dist/knowledge/gate/record.d.ts.map +1 -1
- package/dist/knowledge/gate/record.js +108 -29
- package/dist/knowledge/gate/record.js.map +1 -1
- package/dist/knowledge/projector.d.ts +60 -5
- package/dist/knowledge/projector.d.ts.map +1 -1
- package/dist/knowledge/projector.js +264 -21
- package/dist/knowledge/projector.js.map +1 -1
- package/dist/knowledge/registry/entry.d.ts +7 -0
- package/dist/knowledge/registry/entry.d.ts.map +1 -1
- package/dist/knowledge/registry/entry.js +4 -0
- package/dist/knowledge/registry/entry.js.map +1 -1
- package/dist/knowledge/shapes/map.d.ts.map +1 -1
- package/dist/knowledge/shapes/map.js +12 -2
- package/dist/knowledge/shapes/map.js.map +1 -1
- package/dist/knowledge/shapes/routes.d.ts +1 -1
- package/dist/knowledge/shapes/routes.d.ts.map +1 -1
- package/dist/knowledge/shapes/routes.js +42 -16
- package/dist/knowledge/shapes/routes.js.map +1 -1
- package/dist/knowledge/shapes/shapes.d.ts +60 -13
- package/dist/knowledge/shapes/shapes.d.ts.map +1 -1
- package/dist/knowledge/shapes/shapes.js +199 -31
- package/dist/knowledge/shapes/shapes.js.map +1 -1
- package/dist/knowledge/shapes/verified.d.ts.map +1 -1
- package/dist/knowledge/shapes/verified.js +3 -2
- package/dist/knowledge/shapes/verified.js.map +1 -1
- package/dist/knowledge/trackers/addresses.d.ts +27 -3
- package/dist/knowledge/trackers/addresses.d.ts.map +1 -1
- package/dist/knowledge/trackers/addresses.js +33 -5
- package/dist/knowledge/trackers/addresses.js.map +1 -1
- package/dist/knowledge/trackers/gate-pm.d.ts.map +1 -1
- package/dist/knowledge/trackers/gate-pm.js +4 -2
- package/dist/knowledge/trackers/gate-pm.js.map +1 -1
- package/dist/knowledge/trackers/projector.d.ts +3 -1
- package/dist/knowledge/trackers/projector.d.ts.map +1 -1
- package/dist/knowledge/trackers/projector.js +59 -8
- package/dist/knowledge/trackers/projector.js.map +1 -1
- package/dist/learn/scheduler.d.ts.map +1 -1
- package/dist/learn/scheduler.js +13 -3
- package/dist/learn/scheduler.js.map +1 -1
- package/dist/learnings/estate.d.ts.map +1 -1
- package/dist/learnings/estate.js +3 -14
- package/dist/learnings/estate.js.map +1 -1
- package/dist/learnings/extract.d.ts +9 -3
- package/dist/learnings/extract.d.ts.map +1 -1
- package/dist/learnings/extract.js +62 -4
- package/dist/learnings/extract.js.map +1 -1
- package/dist/learnings/replacement-lineage.d.ts +3 -2
- package/dist/learnings/replacement-lineage.d.ts.map +1 -1
- package/dist/learnings/replacement-lineage.js +7 -6
- package/dist/learnings/replacement-lineage.js.map +1 -1
- package/dist/learnings/service.d.ts +12 -2
- package/dist/learnings/service.d.ts.map +1 -1
- package/dist/learnings/service.js +30 -5
- package/dist/learnings/service.js.map +1 -1
- package/dist/mcp/broker.d.ts.map +1 -1
- package/dist/mcp/broker.js +19 -5
- package/dist/mcp/broker.js.map +1 -1
- package/dist/mcp/env.d.ts +12 -4
- package/dist/mcp/env.d.ts.map +1 -1
- package/dist/mcp/env.js +24 -4
- package/dist/mcp/env.js.map +1 -1
- package/dist/mcp/estate-relay.d.ts +3 -0
- package/dist/mcp/estate-relay.d.ts.map +1 -1
- package/dist/mcp/estate-relay.js +7 -6
- package/dist/mcp/estate-relay.js.map +1 -1
- package/dist/mcp/invoke.d.ts.map +1 -1
- package/dist/mcp/invoke.js +6 -5
- package/dist/mcp/invoke.js.map +1 -1
- package/dist/mcp/probe.d.ts +14 -1
- package/dist/mcp/probe.d.ts.map +1 -1
- package/dist/mcp/probe.js +55 -10
- package/dist/mcp/probe.js.map +1 -1
- package/dist/mcp/redact.d.ts +1 -1
- package/dist/mcp/redact.d.ts.map +1 -1
- package/dist/mcp/redact.js +61 -4
- package/dist/mcp/redact.js.map +1 -1
- package/dist/mcp/registry-store.d.ts +37 -0
- package/dist/mcp/registry-store.d.ts.map +1 -1
- package/dist/mcp/registry-store.js +43 -0
- package/dist/mcp/registry-store.js.map +1 -1
- package/dist/mcp/registry.d.ts +38 -6
- package/dist/mcp/registry.d.ts.map +1 -1
- package/dist/mcp/registry.js +145 -14
- package/dist/mcp/registry.js.map +1 -1
- package/dist/mcp/rest.js +4 -4
- package/dist/mcp/rest.js.map +1 -1
- package/dist/mcp/run-fence.d.ts +2 -0
- package/dist/mcp/run-fence.d.ts.map +1 -1
- package/dist/mcp/run-fence.js +9 -0
- package/dist/mcp/run-fence.js.map +1 -1
- package/dist/mcp/secrets.d.ts +1 -1
- package/dist/mcp/secrets.d.ts.map +1 -1
- package/dist/mcp/secrets.js +10 -11
- package/dist/mcp/secrets.js.map +1 -1
- package/dist/mcp/upstream-error.d.ts +6 -2
- package/dist/mcp/upstream-error.d.ts.map +1 -1
- package/dist/mcp/upstream-error.js +5 -1
- package/dist/mcp/upstream-error.js.map +1 -1
- package/dist/projects/graph.d.ts +15 -5
- package/dist/projects/graph.d.ts.map +1 -1
- package/dist/projects/graph.js +354 -26
- package/dist/projects/graph.js.map +1 -1
- package/dist/projects/repo-watch.d.ts +2 -2
- package/dist/projects/repo-watch.d.ts.map +1 -1
- package/dist/projects/repo-watch.js +26 -9
- package/dist/projects/repo-watch.js.map +1 -1
- package/dist/projects/routes.d.ts +9 -1
- package/dist/projects/routes.d.ts.map +1 -1
- package/dist/projects/routes.js +63 -6
- package/dist/projects/routes.js.map +1 -1
- package/dist/projects/state-home-preflight.d.ts +5 -0
- package/dist/projects/state-home-preflight.d.ts.map +1 -1
- package/dist/projects/state-home-preflight.js +48 -8
- package/dist/projects/state-home-preflight.js.map +1 -1
- package/dist/projects/state-home-registry.d.ts.map +1 -1
- package/dist/projects/state-home-registry.js +9 -0
- package/dist/projects/state-home-registry.js.map +1 -1
- package/dist/projects/state-home.d.ts +11 -0
- package/dist/projects/state-home.d.ts.map +1 -1
- package/dist/projects/state-home.js +14 -0
- package/dist/projects/state-home.js.map +1 -1
- package/dist/qe/author-workflow.d.ts +4 -0
- package/dist/qe/author-workflow.d.ts.map +1 -1
- package/dist/qe/author-workflow.js +4 -0
- package/dist/qe/author-workflow.js.map +1 -1
- package/dist/qe/test-sets.d.ts +5 -6
- package/dist/qe/test-sets.d.ts.map +1 -1
- package/dist/qe/test-sets.js +4 -3
- package/dist/qe/test-sets.js.map +1 -1
- package/dist/schedules/routes.d.ts +5 -0
- package/dist/schedules/routes.d.ts.map +1 -1
- package/dist/schedules/routes.js +32 -5
- package/dist/schedules/routes.js.map +1 -1
- package/dist/schedules/scheduler.d.ts +8 -1
- package/dist/schedules/scheduler.d.ts.map +1 -1
- package/dist/schedules/scheduler.js +10 -1
- package/dist/schedules/scheduler.js.map +1 -1
- package/dist/schedules/store.d.ts +7 -0
- package/dist/schedules/store.d.ts.map +1 -1
- package/dist/schedules/store.js +19 -4
- package/dist/schedules/store.js.map +1 -1
- package/dist/skills/plugin-source.js +4 -4
- package/dist/skills/plugin-source.js.map +1 -1
- package/dist/sources/ask.d.ts.map +1 -1
- package/dist/sources/ask.js +12 -12
- package/dist/sources/ask.js.map +1 -1
- package/dist/sources/dialer.d.ts +6 -1
- package/dist/sources/dialer.d.ts.map +1 -1
- package/dist/sources/dialer.js +53 -31
- package/dist/sources/dialer.js.map +1 -1
- package/dist/sources/drivers/mysql.d.ts +2 -0
- package/dist/sources/drivers/mysql.d.ts.map +1 -1
- package/dist/sources/drivers/mysql.js +18 -2
- package/dist/sources/drivers/mysql.js.map +1 -1
- package/dist/sources/drivers/postgres.d.ts +2 -0
- package/dist/sources/drivers/postgres.d.ts.map +1 -1
- package/dist/sources/drivers/postgres.js +10 -3
- package/dist/sources/drivers/postgres.js.map +1 -1
- package/dist/sources/drivers/sqlite.d.ts +33 -3
- package/dist/sources/drivers/sqlite.d.ts.map +1 -1
- package/dist/sources/drivers/sqlite.js +18 -6
- package/dist/sources/drivers/sqlite.js.map +1 -1
- package/dist/sources/drivers/types.d.ts +3 -1
- package/dist/sources/drivers/types.d.ts.map +1 -1
- package/dist/sources/drivers/types.js +3 -1
- package/dist/sources/drivers/types.js.map +1 -1
- package/dist/sources/routes.d.ts.map +1 -1
- package/dist/sources/routes.js +1 -0
- package/dist/sources/routes.js.map +1 -1
- package/dist/sources/uploads.d.ts +22 -15
- package/dist/sources/uploads.d.ts.map +1 -1
- package/dist/sources/uploads.js +124 -436
- package/dist/sources/uploads.js.map +1 -1
- package/dist/standing-orders/history.d.ts +5 -3
- package/dist/standing-orders/history.d.ts.map +1 -1
- package/dist/standing-orders/history.js +6 -2
- package/dist/standing-orders/history.js.map +1 -1
- package/dist/standing-orders/parse.d.ts +8 -0
- package/dist/standing-orders/parse.d.ts.map +1 -1
- package/dist/standing-orders/parse.js +52 -5
- package/dist/standing-orders/parse.js.map +1 -1
- package/dist/studio/apps-standalone/fixture.js +3 -3
- package/dist/studio/apps-standalone/runtime.js +1 -1
- package/dist/studio/assets/{KnowledgeGraph-DWw0I8RJ.js → KnowledgeGraph-yP4WsnST.js} +1 -1
- package/dist/studio/assets/index-DNaLjJ7M.css +32 -0
- package/dist/studio/assets/index-DW53FKuT.js +1114 -0
- package/dist/studio/editors/wicked-apps/editor.json +1 -1
- package/dist/studio/editors/wicked-apps/index.html +2 -2
- package/dist/studio/editors/wicked-deck/editor.json +1 -1
- package/dist/studio/editors/wicked-deck/index.html +2 -2
- package/dist/studio/editors/wicked-doc/editor.json +1 -1
- package/dist/studio/editors/wicked-doc/index.html +1 -1
- package/dist/studio/editors/wicked-insights/editor.json +1 -1
- package/dist/studio/editors/wicked-insights/index.html +1 -1
- package/dist/studio/editors/wicked-page/editor.json +1 -1
- package/dist/studio/editors/wicked-page/index.html +1 -1
- package/dist/studio/editors/wicked-video/editor.json +1 -1
- package/dist/studio/editors/wicked-video/index.html +1 -1
- package/dist/studio/index.html +2 -2
- package/dist/studio/testid-inventory.json +1589 -281
- package/dist/team/routes.d.ts +11 -1
- package/dist/team/routes.d.ts.map +1 -1
- package/dist/team/routes.js +8 -4
- package/dist/team/routes.js.map +1 -1
- package/dist/voice/tts.d.ts +12 -0
- package/dist/voice/tts.d.ts.map +1 -1
- package/dist/voice/tts.js +118 -28
- package/dist/voice/tts.js.map +1 -1
- package/dist/workflow-catalog/build-v2.d.ts +34 -0
- package/dist/workflow-catalog/build-v2.d.ts.map +1 -1
- package/dist/workflow-catalog/build-v2.js +131 -10
- package/dist/workflow-catalog/build-v2.js.map +1 -1
- package/dist/workflow-catalog/catalog-data-v2.d.ts +6 -2
- package/dist/workflow-catalog/catalog-data-v2.d.ts.map +1 -1
- package/dist/workflow-catalog/catalog-data-v2.js.map +1 -1
- package/dist/workflow-catalog/catalog-data.d.ts.map +1 -1
- package/dist/workflow-catalog/catalog-data.js +0 -2
- package/dist/workflow-catalog/catalog-data.js.map +1 -1
- package/dist/workflow-catalog/detect.d.ts +18 -3
- package/dist/workflow-catalog/detect.d.ts.map +1 -1
- package/dist/workflow-catalog/detect.js +43 -8
- package/dist/workflow-catalog/detect.js.map +1 -1
- package/dist/workflow-catalog/shape.d.ts +1 -1
- package/dist/working-doc/event-lines.d.ts +12 -2
- package/dist/working-doc/event-lines.d.ts.map +1 -1
- package/dist/working-doc/event-lines.js +62 -10
- package/dist/working-doc/event-lines.js.map +1 -1
- package/dist/working-doc/sections.d.ts +3 -0
- package/dist/working-doc/sections.d.ts.map +1 -1
- package/dist/working-doc/sections.js +5 -0
- package/dist/working-doc/sections.js.map +1 -1
- package/dist/working-doc/service.d.ts +23 -3
- package/dist/working-doc/service.d.ts.map +1 -1
- package/dist/working-doc/service.js +93 -54
- package/dist/working-doc/service.js.map +1 -1
- package/endpoint-manifest.json +148 -8
- package/evals/corpora/shape-v1.json +25 -1
- package/evals/corpora/shape-v1.seat-fixture.json +25 -1
- package/package.json +4 -4
- package/runners/sqlite-runner.mjs +67 -12
- package/runners/upload-parse.d.mts +13 -0
- package/runners/upload-parse.mjs +364 -0
- package/dist/studio/assets/index-C4Xj-zxa.css +0 -32
- package/dist/studio/assets/index-CrNY3d06.js +0 -1109
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
// Upload parsers live only in the killable runner child (crew#1289). Limits come from uploads.ts.
|
|
2
|
+
import { inflateRawSync } from 'node:zlib';
|
|
3
|
+
|
|
4
|
+
const refusal = (code, message) => ({ code, message });
|
|
5
|
+
|
|
6
|
+
// ── CSV ──────────────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
function detectDelimiter(text) {
|
|
9
|
+
// The first record, with quoted fields taken out (a quoted field may hold any delimiter).
|
|
10
|
+
let first = '';
|
|
11
|
+
let quoted = false;
|
|
12
|
+
for (let i = 0; i < text.length && i < 1_000_000; i++) {
|
|
13
|
+
const c = text[i];
|
|
14
|
+
if (c === '"') quoted = !quoted;
|
|
15
|
+
else if (!quoted && (c === '\n' || c === '\r')) break;
|
|
16
|
+
else if (!quoted) first += c;
|
|
17
|
+
}
|
|
18
|
+
const counts = [',', ';', '\t'].map((d) => [d, first.split(d).length]);
|
|
19
|
+
return counts.sort((a, b) => b[1] - a[1])[0]?.[0] ?? ',';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** RFC 4180 rows (quoted fields, doubled quotes, CRLF or LF), bounded by the limits. */
|
|
23
|
+
export function parseCsv(text, limits) {
|
|
24
|
+
const d = detectDelimiter(text);
|
|
25
|
+
const rows = [];
|
|
26
|
+
let row = [];
|
|
27
|
+
let field = '';
|
|
28
|
+
let i = 0;
|
|
29
|
+
let quoted = false;
|
|
30
|
+
const n = text.length;
|
|
31
|
+
const endRow = () => {
|
|
32
|
+
row.push(field);
|
|
33
|
+
field = '';
|
|
34
|
+
if (!(row.length === 1 && row[0] === '')) {
|
|
35
|
+
if (row.length > limits.columns) throw refusal('too_many_columns', `the file has more than ${limits.columns} columns`);
|
|
36
|
+
rows.push(row);
|
|
37
|
+
if (rows.length > limits.rows + 1) throw refusal('too_many_rows', `the file has more than ${limits.rows} rows`);
|
|
38
|
+
}
|
|
39
|
+
row = [];
|
|
40
|
+
};
|
|
41
|
+
while (i < n) {
|
|
42
|
+
const c = text[i];
|
|
43
|
+
if (quoted) {
|
|
44
|
+
if (c === '"') {
|
|
45
|
+
if (text[i + 1] === '"') {
|
|
46
|
+
field += '"';
|
|
47
|
+
i += 2;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
quoted = false;
|
|
51
|
+
i++;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
field += c;
|
|
55
|
+
i++;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (c === '"' && field === '') {
|
|
59
|
+
quoted = true;
|
|
60
|
+
i++;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (c === d) {
|
|
64
|
+
row.push(field);
|
|
65
|
+
field = '';
|
|
66
|
+
if (row.length > limits.columns) throw refusal('too_many_columns', `the file has more than ${limits.columns} columns`);
|
|
67
|
+
i++;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (c === '\r' && text[i + 1] === '\n') {
|
|
71
|
+
endRow();
|
|
72
|
+
i += 2;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (c === '\n' || c === '\r') {
|
|
76
|
+
endRow();
|
|
77
|
+
i++;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
field += c;
|
|
81
|
+
i++;
|
|
82
|
+
}
|
|
83
|
+
if (quoted) throw refusal('bad_csv', 'the file ends inside a quoted field');
|
|
84
|
+
if (field !== '' || row.length > 0) endRow();
|
|
85
|
+
return rows;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ── XLSX (a zip of XML) ──────────────────────────────────────────────────────────────────────
|
|
89
|
+
|
|
90
|
+
function zipEntries(buf) {
|
|
91
|
+
const min = Math.max(0, buf.length - 65_557);
|
|
92
|
+
let eocd = -1;
|
|
93
|
+
for (let i = buf.length - 22; i >= min; i--) {
|
|
94
|
+
if (buf.readUInt32LE(i) === 0x06054b50) {
|
|
95
|
+
eocd = i;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (eocd < 0) throw refusal('bad_xlsx', 'the file is not an XLSX workbook (no zip directory)');
|
|
100
|
+
const count = buf.readUInt16LE(eocd + 10);
|
|
101
|
+
const cdSize = buf.readUInt32LE(eocd + 12);
|
|
102
|
+
const cdOffset = buf.readUInt32LE(eocd + 16);
|
|
103
|
+
if (count === 0xffff || cdOffset === 0xffffffff || cdSize === 0xffffffff) throw refusal('bad_xlsx', 'zip64 workbooks are not supported');
|
|
104
|
+
if (cdOffset + cdSize > buf.length) throw refusal('bad_xlsx', 'the zip directory points past the end of the file');
|
|
105
|
+
const out = [];
|
|
106
|
+
let p = cdOffset;
|
|
107
|
+
for (let k = 0; k < count; k++) {
|
|
108
|
+
if (p + 46 > buf.length || buf.readUInt32LE(p) !== 0x02014b50) throw refusal('bad_xlsx', 'a damaged zip directory');
|
|
109
|
+
const flags = buf.readUInt16LE(p + 8);
|
|
110
|
+
const method = buf.readUInt16LE(p + 10);
|
|
111
|
+
const compressedSize = buf.readUInt32LE(p + 20);
|
|
112
|
+
const size = buf.readUInt32LE(p + 24);
|
|
113
|
+
const nameLen = buf.readUInt16LE(p + 28);
|
|
114
|
+
const extraLen = buf.readUInt16LE(p + 30);
|
|
115
|
+
const commentLen = buf.readUInt16LE(p + 32);
|
|
116
|
+
const localOffset = buf.readUInt32LE(p + 42);
|
|
117
|
+
const name = buf.subarray(p + 46, p + 46 + nameLen).toString('utf8');
|
|
118
|
+
out.push({ name, method, flags, compressedSize, size, localOffset });
|
|
119
|
+
p += 46 + nameLen + extraLen + commentLen;
|
|
120
|
+
}
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
class ZipReader {
|
|
125
|
+
expanded = 0;
|
|
126
|
+
constructor(buf, entries, limits) {
|
|
127
|
+
this.buf = buf;
|
|
128
|
+
this.entries = entries;
|
|
129
|
+
this.limits = limits;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
has(name) {
|
|
133
|
+
return this.entries.some((e) => e.name === name);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** One entry's bytes, inflated with the remaining expansion budget as a HARD cap. */
|
|
137
|
+
read(name) {
|
|
138
|
+
const e = this.entries.find((x) => x.name === name);
|
|
139
|
+
if (e === undefined) throw refusal('bad_xlsx', `the workbook has no ${name}`);
|
|
140
|
+
if ((e.flags & 0x1) !== 0) throw refusal('bad_xlsx', 'encrypted workbooks are not supported');
|
|
141
|
+
const p = e.localOffset;
|
|
142
|
+
if (p + 30 > this.buf.length || this.buf.readUInt32LE(p) !== 0x04034b50) throw refusal('bad_xlsx', 'a damaged zip entry');
|
|
143
|
+
const start = p + 30 + this.buf.readUInt16LE(p + 26) + this.buf.readUInt16LE(p + 28);
|
|
144
|
+
const data = this.buf.subarray(start, start + e.compressedSize);
|
|
145
|
+
const budget = this.limits.expandedBytes - this.expanded;
|
|
146
|
+
if (e.size > budget) throw refusal('too_large', `the workbook expands past ${this.limits.expandedBytes / (1024 * 1024)} MB`);
|
|
147
|
+
let bytes;
|
|
148
|
+
if (e.method === 0) bytes = Buffer.from(data);
|
|
149
|
+
else if (e.method === 8) {
|
|
150
|
+
try {
|
|
151
|
+
bytes = inflateRawSync(data, { maxOutputLength: Math.max(1, budget) });
|
|
152
|
+
} catch (err) {
|
|
153
|
+
const code = err.code;
|
|
154
|
+
if (code === 'ERR_BUFFER_TOO_LARGE' || /buffer|too large|maxOutputLength/i.test(String(err.message))) {
|
|
155
|
+
throw refusal('too_large', `the workbook expands past ${this.limits.expandedBytes / (1024 * 1024)} MB`);
|
|
156
|
+
}
|
|
157
|
+
throw refusal('bad_xlsx', `a zip entry could not be inflated: ${err.message}`);
|
|
158
|
+
}
|
|
159
|
+
} else throw refusal('bad_xlsx', `zip method ${e.method} is not supported`);
|
|
160
|
+
this.expanded += bytes.length;
|
|
161
|
+
if (this.expanded > this.limits.expandedBytes) throw refusal('too_large', `the workbook expands past ${this.limits.expandedBytes / (1024 * 1024)} MB`);
|
|
162
|
+
return bytes.toString('utf8');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function xmlText(s) {
|
|
167
|
+
return s
|
|
168
|
+
.replace(/&#x([0-9a-fA-F]+);/g, (_m, h) => String.fromCodePoint(parseInt(h, 16)))
|
|
169
|
+
.replace(/&#(\d+);/g, (_m, d) => String.fromCodePoint(Number(d)))
|
|
170
|
+
.replace(/</g, '<')
|
|
171
|
+
.replace(/>/g, '>')
|
|
172
|
+
.replace(/"/g, '"')
|
|
173
|
+
.replace(/'/g, "'")
|
|
174
|
+
.replace(/&/g, '&');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function attr(tag, name) {
|
|
178
|
+
const m = new RegExp(`\\s${name}="([^"]*)"`).exec(tag);
|
|
179
|
+
return m === null ? null : xmlText(m[1]);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function colIndex(ref) {
|
|
183
|
+
const letters = /^([A-Z]+)/.exec(ref)?.[1] ?? 'A';
|
|
184
|
+
let n = 0;
|
|
185
|
+
for (const ch of letters) n = n * 26 + (ch.charCodeAt(0) - 64);
|
|
186
|
+
return n - 1;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The bodies of `<tag …>…</tag>` (and `<tag …/>`) in order, scanned linearly. An element whose end
|
|
191
|
+
* never comes ends the scan. `withHead` also answers the opening tag (for attributes).
|
|
192
|
+
*/
|
|
193
|
+
function* elements(xml, tag, withHead = false) {
|
|
194
|
+
const open = `<${tag}`;
|
|
195
|
+
const close = `</${tag}>`;
|
|
196
|
+
let at = 0;
|
|
197
|
+
for (;;) {
|
|
198
|
+
let i = xml.indexOf(open, at);
|
|
199
|
+
while (i >= 0 && !/[\s>/]/.test(xml[i + open.length] ?? '')) i = xml.indexOf(open, i + 1);
|
|
200
|
+
if (i < 0) return;
|
|
201
|
+
const headEnd = xml.indexOf('>', i);
|
|
202
|
+
if (headEnd < 0) return;
|
|
203
|
+
const head = xml.slice(i, headEnd + 1);
|
|
204
|
+
if (head.endsWith('/>')) {
|
|
205
|
+
yield withHead ? { head, body: '' } : '';
|
|
206
|
+
at = headEnd + 1;
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
const end = xml.indexOf(close, headEnd + 1);
|
|
210
|
+
if (end < 0) return;
|
|
211
|
+
const body = xml.slice(headEnd + 1, end);
|
|
212
|
+
yield withHead ? { head, body } : body;
|
|
213
|
+
at = end + close.length;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** The concatenated text of every `<t>` in a fragment (a shared string's runs, an inline string). */
|
|
218
|
+
function texts(fragment) {
|
|
219
|
+
let out = '';
|
|
220
|
+
for (const t of elements(fragment, 't')) out += xmlText(t);
|
|
221
|
+
return out;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** The first sheet of an XLSX workbook as rows of strings. */
|
|
225
|
+
export function parseXlsx(buf, limits) {
|
|
226
|
+
const zip = new ZipReader(buf, zipEntries(buf), limits);
|
|
227
|
+
const workbook = zip.read('xl/workbook.xml');
|
|
228
|
+
const sheetTag = /<sheet\b[^>]*>/.exec(workbook)?.[0];
|
|
229
|
+
if (sheetTag === undefined) throw refusal('bad_xlsx', 'the workbook has no sheet');
|
|
230
|
+
const rid = attr(sheetTag, 'r:id');
|
|
231
|
+
const rels = zip.read('xl/_rels/workbook.xml.rels');
|
|
232
|
+
let target = 'worksheets/sheet1.xml';
|
|
233
|
+
for (const m of rels.matchAll(/<Relationship\b[^>]*>/g)) if (attr(m[0], 'Id') === rid) target = attr(m[0], 'Target') ?? target;
|
|
234
|
+
const sheetPath = target.startsWith('/') ? target.slice(1) : `xl/${target.replace(/^\.\//, '')}`;
|
|
235
|
+
// Every scan below is linear (indexOf from a moving cursor, never a lazy regex over the rest of the
|
|
236
|
+
// text), so a hostile sheet of unclosed tags costs one pass, not one pass per tag.
|
|
237
|
+
const shared = [];
|
|
238
|
+
if (zip.has('xl/sharedStrings.xml')) {
|
|
239
|
+
const sst = zip.read('xl/sharedStrings.xml');
|
|
240
|
+
let sharedBytes = 0;
|
|
241
|
+
for (const si of elements(sst, 'si')) {
|
|
242
|
+
const t = texts(si);
|
|
243
|
+
sharedBytes += t.length;
|
|
244
|
+
if (sharedBytes > limits.expandedBytes) throw refusal('too_large', `the workbook's strings expand past ${limits.expandedBytes / (1024 * 1024)} MB`);
|
|
245
|
+
shared.push(t);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const sheet = zip.read(sheetPath);
|
|
249
|
+
const rows = [];
|
|
250
|
+
// Shared strings are referenced, not copied: count what the cells hold once resolved, so a small
|
|
251
|
+
// sheet repeating one large string cannot become a snapshot far past the expansion limit.
|
|
252
|
+
let cellBytes = 0;
|
|
253
|
+
for (const rowXml of elements(sheet, 'row')) {
|
|
254
|
+
const row = [];
|
|
255
|
+
for (const cell of elements(rowXml, 'c', true)) {
|
|
256
|
+
const ref = attr(cell.head, 'r');
|
|
257
|
+
const t = attr(cell.head, 't');
|
|
258
|
+
const inner = cell.body;
|
|
259
|
+
const vStart = inner.indexOf('<v>');
|
|
260
|
+
const vEnd = vStart < 0 ? -1 : inner.indexOf('</v>', vStart + 3);
|
|
261
|
+
const v = vStart < 0 || vEnd < 0 ? undefined : inner.slice(vStart + 3, vEnd);
|
|
262
|
+
let value = '';
|
|
263
|
+
if (t === 's') value = shared[Number(v)] ?? '';
|
|
264
|
+
else if (t === 'inlineStr') value = texts(inner);
|
|
265
|
+
else if (t === 'b') value = v === '1' ? 'true' : 'false';
|
|
266
|
+
else if (v !== undefined) value = xmlText(v);
|
|
267
|
+
const idx = ref === null ? row.length : colIndex(ref);
|
|
268
|
+
if (idx >= limits.columns) throw refusal('too_many_columns', `the sheet has more than ${limits.columns} columns`);
|
|
269
|
+
while (row.length < idx) row.push('');
|
|
270
|
+
row[idx] = value;
|
|
271
|
+
cellBytes += value.length;
|
|
272
|
+
if (cellBytes > limits.expandedBytes) throw refusal('too_large', `the sheet's values expand past ${limits.expandedBytes / (1024 * 1024)} MB`);
|
|
273
|
+
}
|
|
274
|
+
if (row.length > 0 && row.some((c) => c !== '')) rows.push(row);
|
|
275
|
+
if (rows.length > limits.rows + 1) throw refusal('too_many_rows', `the sheet has more than ${limits.rows} rows`);
|
|
276
|
+
}
|
|
277
|
+
return rows;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// ── Rows → a SQLite snapshot ─────────────────────────────────────────────────────────────────
|
|
281
|
+
|
|
282
|
+
const NUMBER = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
|
|
283
|
+
const DATEISH = /^\d{4}-\d{2}-\d{2}([ T]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Whether to take the first row as the header. Without the person's choice it must look like one AND
|
|
287
|
+
* differ in shape from the data under it (some column whose first cell is a word while its values
|
|
288
|
+
* are numbers or dates): an all-text first row could be a record — a name, an email — and column
|
|
289
|
+
* names are structure an agent sees. A human's explicit choice (`header=yes|no`) wins.
|
|
290
|
+
*/
|
|
291
|
+
export function detectHeader(rows, choice) {
|
|
292
|
+
if (choice !== null) return choice === 'yes';
|
|
293
|
+
const first = rows[0] ?? [];
|
|
294
|
+
if (!looksLikeHeader(first) || rows.length < 2) return false;
|
|
295
|
+
const body = rows.slice(1, 201);
|
|
296
|
+
return first.some((_c, i) => {
|
|
297
|
+
const values = body.map((r) => (r[i] ?? '').trim()).filter((v) => v !== '');
|
|
298
|
+
return values.length > 0 && values.every((v) => NUMBER.test(v) || DATEISH.test(v) || /^(true|false)$/i.test(v));
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* A column name as people write one: a letter or `_` first, then letters, digits, spaces and a little
|
|
304
|
+
* punctuation (`Amount (USD)`, `Q3 %`, `order-id`), at most 64 characters. No `@`, `.`, `:` or `/`:
|
|
305
|
+
* an email address, a domain, a URL or a time is a value, never a name.
|
|
306
|
+
*/
|
|
307
|
+
const NAME_LIKE = /^[\p{L}_][\p{L}\p{N}\p{Zs}_\-()%#&]{0,63}$/u;
|
|
308
|
+
|
|
309
|
+
/** A first row looks like a header when every cell is a distinct column name, none of them data-like. */
|
|
310
|
+
export function looksLikeHeader(first) {
|
|
311
|
+
if (first.length === 0) return false;
|
|
312
|
+
const seen = new Set();
|
|
313
|
+
for (const raw of first) {
|
|
314
|
+
const cell = raw.trim();
|
|
315
|
+
if (cell === '' || NUMBER.test(cell) || DATEISH.test(cell) || /^(true|false)$/i.test(cell) || !NAME_LIKE.test(cell)) return false;
|
|
316
|
+
const k = cell.toLowerCase();
|
|
317
|
+
if (seen.has(k)) return false;
|
|
318
|
+
seen.add(k);
|
|
319
|
+
}
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export function columnNames(first, width, header) {
|
|
324
|
+
const names = [];
|
|
325
|
+
const taken = new Set(); // SQLite compares names case-insensitively
|
|
326
|
+
for (let i = 0; i < width; i++) {
|
|
327
|
+
let n = header ? (first[i] ?? '').trim().replace(/\s+/g, ' ').slice(0, 56) : '';
|
|
328
|
+
if (n === '') n = `col_${i + 1}`;
|
|
329
|
+
let unique = n;
|
|
330
|
+
for (let k = 2; taken.has(unique.toLowerCase()); k++) unique = `${n}_${k}`;
|
|
331
|
+
taken.add(unique.toLowerCase());
|
|
332
|
+
names.push(unique);
|
|
333
|
+
}
|
|
334
|
+
return names;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
const INT64_MIN = -(2n ** 63n);
|
|
338
|
+
const INT64_MAX = 2n ** 63n - 1n;
|
|
339
|
+
|
|
340
|
+
function isInt64(v) {
|
|
341
|
+
if (!/^[+-]?\d{1,20}$/.test(v)) return false;
|
|
342
|
+
const b = BigInt(v);
|
|
343
|
+
return b >= INT64_MIN && b <= INT64_MAX;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** INTEGER (stored exactly, as a 64-bit integer), REAL, or TEXT; an integer past int64 makes the column TEXT. */
|
|
347
|
+
export function inferType(values) {
|
|
348
|
+
let t = null;
|
|
349
|
+
for (const raw of values) {
|
|
350
|
+
const v = raw.trim();
|
|
351
|
+
if (v === '') continue;
|
|
352
|
+
if (/^[+-]?\d+$/.test(v)) {
|
|
353
|
+
if (!isInt64(v)) return 'TEXT';
|
|
354
|
+
t = t ?? 'INTEGER';
|
|
355
|
+
} else if (NUMBER.test(v) && Number.isFinite(Number(v))) t = t === 'TEXT' ? 'TEXT' : 'REAL';
|
|
356
|
+
else return 'TEXT';
|
|
357
|
+
}
|
|
358
|
+
return t ?? 'TEXT';
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export function tableNameFor(filename) {
|
|
362
|
+
const base = filename.replace(/^.*[\\/]/, '').replace(/\.[^.]+$/, '').toLowerCase().replace(/[^a-z0-9_]+/g, '_').replace(/^_+|_+$/g, '');
|
|
363
|
+
return /^[a-z_]/.test(base) && base.length > 0 ? base.slice(0, 63) : `data${base === '' ? '' : `_${base}`}`.slice(0, 63);
|
|
364
|
+
}
|