wicked-crew 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -14
- package/adapters/web-source.lock +1314 -0
- package/dist/api/audit.d.ts +5 -0
- package/dist/api/audit.d.ts.map +1 -1
- package/dist/api/audit.js +20 -0
- package/dist/api/audit.js.map +1 -1
- package/dist/api/auth.d.ts.map +1 -1
- package/dist/api/auth.js +3 -0
- package/dist/api/auth.js.map +1 -1
- package/dist/api/chat-context.js +1 -1
- package/dist/api/chat-history.d.ts +3 -0
- package/dist/api/chat-history.d.ts.map +1 -1
- package/dist/api/chat-history.js +6 -1
- package/dist/api/chat-history.js.map +1 -1
- package/dist/api/chat-jobs.d.ts +30 -1
- package/dist/api/chat-jobs.d.ts.map +1 -1
- package/dist/api/chat-jobs.js +172 -10
- package/dist/api/chat-jobs.js.map +1 -1
- package/dist/api/chat-proposals.d.ts +178 -8
- package/dist/api/chat-proposals.d.ts.map +1 -1
- package/dist/api/chat-proposals.js +775 -54
- package/dist/api/chat-proposals.js.map +1 -1
- package/dist/api/chat-requirements.d.ts +54 -0
- package/dist/api/chat-requirements.d.ts.map +1 -0
- package/dist/api/chat-requirements.js +282 -0
- package/dist/api/chat-requirements.js.map +1 -0
- package/dist/api/chat-scope.d.ts +56 -0
- package/dist/api/chat-scope.d.ts.map +1 -1
- package/dist/api/chat-scope.js +175 -5
- package/dist/api/chat-scope.js.map +1 -1
- package/dist/api/chat-transcripts.d.ts +7 -0
- package/dist/api/chat-transcripts.d.ts.map +1 -1
- package/dist/api/chat-transcripts.js +17 -1
- package/dist/api/chat-transcripts.js.map +1 -1
- package/dist/api/delivery-index.d.ts +109 -5
- package/dist/api/delivery-index.d.ts.map +1 -1
- package/dist/api/delivery-index.js +199 -7
- package/dist/api/delivery-index.js.map +1 -1
- package/dist/api/mcp.d.ts +7 -2
- package/dist/api/mcp.d.ts.map +1 -1
- package/dist/api/mcp.js +1 -1
- package/dist/api/mcp.js.map +1 -1
- package/dist/api/needs.d.ts.map +1 -1
- package/dist/api/needs.js +19 -1
- package/dist/api/needs.js.map +1 -1
- package/dist/api/product.d.ts +9 -2
- package/dist/api/product.d.ts.map +1 -1
- package/dist/api/product.js +10 -2
- package/dist/api/product.js.map +1 -1
- package/dist/api/proposal-theme.d.ts +23 -0
- package/dist/api/proposal-theme.d.ts.map +1 -0
- package/dist/api/proposal-theme.js +30 -0
- package/dist/api/proposal-theme.js.map +1 -0
- package/dist/api/recording.d.ts +70 -10
- package/dist/api/recording.d.ts.map +1 -1
- package/dist/api/recording.js +278 -39
- package/dist/api/recording.js.map +1 -1
- package/dist/api/repo-input.d.ts +55 -0
- package/dist/api/repo-input.d.ts.map +1 -0
- package/dist/api/repo-input.js +113 -0
- package/dist/api/repo-input.js.map +1 -0
- package/dist/api/requirements.d.ts +75 -0
- package/dist/api/requirements.d.ts.map +1 -1
- package/dist/api/requirements.js +97 -9
- package/dist/api/requirements.js.map +1 -1
- package/dist/api/review-change.d.ts +64 -0
- package/dist/api/review-change.d.ts.map +1 -0
- package/dist/api/review-change.js +214 -0
- package/dist/api/review-change.js.map +1 -0
- package/dist/api/roster-standing.d.ts +4 -0
- package/dist/api/roster-standing.d.ts.map +1 -1
- package/dist/api/roster-standing.js +43 -10
- package/dist/api/roster-standing.js.map +1 -1
- package/dist/api/routes.d.ts +63 -6
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +818 -269
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-documents.d.ts +97 -0
- package/dist/api/run-documents.d.ts.map +1 -0
- package/dist/api/run-documents.js +458 -0
- package/dist/api/run-documents.js.map +1 -0
- package/dist/api/run-sources.d.ts +51 -0
- package/dist/api/run-sources.d.ts.map +1 -0
- package/dist/api/run-sources.js +133 -0
- package/dist/api/run-sources.js.map +1 -0
- package/dist/api/runtime-state.d.ts +41 -0
- package/dist/api/runtime-state.d.ts.map +1 -0
- package/dist/api/runtime-state.js +75 -0
- package/dist/api/runtime-state.js.map +1 -0
- package/dist/api/seat-container-login.d.ts +51 -0
- package/dist/api/seat-container-login.d.ts.map +1 -1
- package/dist/api/seat-container-login.js +317 -1
- package/dist/api/seat-container-login.js.map +1 -1
- package/dist/api/seat-images.d.ts.map +1 -1
- package/dist/api/seat-images.js +7 -0
- package/dist/api/seat-images.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 +204 -25
- package/dist/api/server.js.map +1 -1
- package/dist/api/skills.d.ts +8 -0
- package/dist/api/skills.d.ts.map +1 -1
- package/dist/api/skills.js +21 -0
- package/dist/api/skills.js.map +1 -1
- package/dist/api/system-snapshot.d.ts +3 -2
- package/dist/api/system-snapshot.d.ts.map +1 -1
- package/dist/api/system-snapshot.js +19 -6
- package/dist/api/system-snapshot.js.map +1 -1
- package/dist/api/testing.d.ts +3 -3
- package/dist/api/ui-text.d.ts +45 -0
- package/dist/api/ui-text.d.ts.map +1 -0
- package/dist/api/ui-text.js +188 -0
- package/dist/api/ui-text.js.map +1 -0
- package/dist/apps/actions/card.d.ts +62 -0
- package/dist/apps/actions/card.d.ts.map +1 -0
- package/dist/apps/actions/card.js +111 -0
- package/dist/apps/actions/card.js.map +1 -0
- package/dist/apps/actions/write-path.d.ts.map +1 -1
- package/dist/apps/actions/write-path.js +26 -77
- package/dist/apps/actions/write-path.js.map +1 -1
- package/dist/apps/exec/sources.d.ts.map +1 -1
- package/dist/apps/exec/sources.js +3 -0
- package/dist/apps/exec/sources.js.map +1 -1
- package/dist/apps/publish/artifacts.d.ts +18 -0
- package/dist/apps/publish/artifacts.d.ts.map +1 -0
- package/dist/apps/publish/artifacts.js +87 -0
- package/dist/apps/publish/artifacts.js.map +1 -0
- package/dist/apps/publish/check.d.ts +103 -0
- package/dist/apps/publish/check.d.ts.map +1 -0
- package/dist/apps/publish/check.js +235 -0
- package/dist/apps/publish/check.js.map +1 -0
- package/dist/apps/publish/image.d.ts +2 -0
- package/dist/apps/publish/image.d.ts.map +1 -1
- package/dist/apps/publish/image.js +2 -1
- package/dist/apps/publish/image.js.map +1 -1
- package/dist/apps/publish/render.d.ts +71 -0
- package/dist/apps/publish/render.d.ts.map +1 -0
- package/dist/apps/publish/render.js +122 -0
- package/dist/apps/publish/render.js.map +1 -0
- package/dist/apps/publish/run.d.ts +35 -0
- package/dist/apps/publish/run.d.ts.map +1 -0
- package/dist/apps/publish/run.js +127 -0
- package/dist/apps/publish/run.js.map +1 -0
- package/dist/apps/routes.d.ts +54 -2
- package/dist/apps/routes.d.ts.map +1 -1
- package/dist/apps/routes.js +124 -7
- package/dist/apps/routes.js.map +1 -1
- package/dist/apps/spec.d.ts +8 -8
- package/dist/apps/store.d.ts +84 -5
- package/dist/apps/store.d.ts.map +1 -1
- package/dist/apps/store.js +191 -4
- package/dist/apps/store.js.map +1 -1
- package/dist/apps/turns.d.ts +19 -1
- package/dist/apps/turns.d.ts.map +1 -1
- package/dist/apps/turns.js +60 -2
- package/dist/apps/turns.js.map +1 -1
- package/dist/apps/views.d.ts +5 -1
- package/dist/apps/views.d.ts.map +1 -1
- package/dist/apps/views.js +18 -7
- package/dist/apps/views.js.map +1 -1
- package/dist/apps-server/Dockerfile +25 -0
- package/dist/apps-server/runners/sqlite-runner.mjs +110 -0
- package/dist/apps-server/server/lib/bundle/server.mjs +92523 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/LICENSE +22 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/README.md +106 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/enums.d.ts +76 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/enums.js +2 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/esm/enums.js +1 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/esm/index.js +2 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/esm/types.js +1 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/index.d.ts +2 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/index.js +18 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/package.json +36 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/types.d.ts +2488 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/types.js +2 -0
- package/dist/apps-server/server/node_modules/libpg-query/LICENSE +22 -0
- package/dist/apps-server/server/node_modules/libpg-query/README.md +275 -0
- package/dist/apps-server/server/node_modules/libpg-query/package.json +58 -0
- package/dist/apps-server/server/node_modules/libpg-query/wasm/index.cjs +369 -0
- package/dist/apps-server/server/node_modules/libpg-query/wasm/index.d.ts +48 -0
- package/dist/apps-server/server/node_modules/libpg-query/wasm/index.js +344 -0
- package/dist/apps-server/server/node_modules/libpg-query/wasm/libpg-query.js +2 -0
- package/dist/apps-server/server/node_modules/libpg-query/wasm/libpg-query.wasm +0 -0
- package/dist/apps-server/server/shim/host.css +22 -0
- package/dist/apps-server/server/shim/host.js +1 -0
- package/dist/cli/apps-check.d.ts +18 -0
- package/dist/cli/apps-check.d.ts.map +1 -1
- package/dist/cli/apps-check.js +179 -5
- package/dist/cli/apps-check.js.map +1 -1
- package/dist/cli/apps-produce.d.ts +9 -0
- package/dist/cli/apps-produce.d.ts.map +1 -0
- package/dist/cli/apps-produce.js +27 -0
- package/dist/cli/apps-produce.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +15 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/insights-facts.d.ts +17 -0
- package/dist/cli/insights-facts.d.ts.map +1 -0
- package/dist/cli/insights-facts.js +56 -0
- package/dist/cli/insights-facts.js.map +1 -0
- package/dist/core/adapter.d.ts +74 -15
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +245 -53
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/engine-roster.d.ts.map +1 -1
- package/dist/core/engine-roster.js +1 -0
- package/dist/core/engine-roster.js.map +1 -1
- package/dist/core/estate-mcp-client.d.ts +3 -2
- package/dist/core/estate-mcp-client.d.ts.map +1 -1
- package/dist/core/estate-mcp-client.js +3 -2
- package/dist/core/estate-mcp-client.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/types.d.ts +5 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/editors/conformance-runtime.d.ts +107 -0
- package/dist/editors/conformance-runtime.d.ts.map +1 -1
- package/dist/editors/conformance-runtime.js +268 -13
- package/dist/editors/conformance-runtime.js.map +1 -1
- package/dist/editors/csp.d.ts +2 -2
- package/dist/editors/csp.d.ts.map +1 -1
- package/dist/editors/csp.js +4 -2
- package/dist/editors/csp.js.map +1 -1
- package/dist/editors/pack-install.d.ts +28 -13
- package/dist/editors/pack-install.d.ts.map +1 -1
- package/dist/editors/pack-install.js +96 -48
- package/dist/editors/pack-install.js.map +1 -1
- package/dist/editors/registry.d.ts +111 -8
- package/dist/editors/registry.d.ts.map +1 -1
- package/dist/editors/registry.js +183 -7
- package/dist/editors/registry.js.map +1 -1
- package/dist/editors/routes.d.ts +66 -13
- package/dist/editors/routes.d.ts.map +1 -1
- package/dist/editors/routes.js +277 -44
- package/dist/editors/routes.js.map +1 -1
- package/dist/evals/replay.d.ts +6 -0
- package/dist/evals/replay.d.ts.map +1 -1
- package/dist/evals/replay.js +24 -1
- package/dist/evals/replay.js.map +1 -1
- package/dist/evals/routes.d.ts.map +1 -1
- package/dist/evals/routes.js +17 -2
- package/dist/evals/routes.js.map +1 -1
- package/dist/evals/runner.d.ts.map +1 -1
- package/dist/evals/runner.js +5 -0
- package/dist/evals/runner.js.map +1 -1
- package/dist/evals/shape-corrections.d.ts +146 -0
- package/dist/evals/shape-corrections.d.ts.map +1 -0
- package/dist/evals/shape-corrections.js +394 -0
- package/dist/evals/shape-corrections.js.map +1 -0
- package/dist/evals/shape.d.ts +145 -0
- package/dist/evals/shape.d.ts.map +1 -0
- package/dist/evals/shape.js +376 -0
- package/dist/evals/shape.js.map +1 -0
- package/dist/evals/types.d.ts +2 -2
- package/dist/evals/types.d.ts.map +1 -1
- package/dist/evals/types.js +2 -1
- package/dist/evals/types.js.map +1 -1
- package/dist/insights/analyze.d.ts +14 -1
- package/dist/insights/analyze.d.ts.map +1 -1
- package/dist/insights/analyze.js +35 -8
- package/dist/insights/analyze.js.map +1 -1
- package/dist/insights/cost.d.ts +123 -0
- package/dist/insights/cost.d.ts.map +1 -0
- package/dist/insights/cost.js +221 -0
- package/dist/insights/cost.js.map +1 -0
- package/dist/insights/review-service.d.ts +20 -1
- package/dist/insights/review-service.d.ts.map +1 -1
- package/dist/insights/review-service.js +50 -25
- package/dist/insights/review-service.js.map +1 -1
- package/dist/insights/routes.d.ts +29 -0
- package/dist/insights/routes.d.ts.map +1 -1
- package/dist/insights/routes.js +62 -0
- package/dist/insights/routes.js.map +1 -1
- package/dist/insights/run-facts.d.ts +16 -0
- package/dist/insights/run-facts.d.ts.map +1 -1
- package/dist/insights/run-facts.js +26 -3
- package/dist/insights/run-facts.js.map +1 -1
- package/dist/interactive/bridge-pool.d.ts +11 -2
- package/dist/interactive/bridge-pool.d.ts.map +1 -1
- package/dist/interactive/bridge-pool.js +10 -1
- package/dist/interactive/bridge-pool.js.map +1 -1
- package/dist/interactive/chat-events.d.ts +74 -1
- package/dist/interactive/chat-events.d.ts.map +1 -1
- package/dist/interactive/chat-events.js +338 -6
- package/dist/interactive/chat-events.js.map +1 -1
- package/dist/interactive/doc-binding.d.ts +15 -0
- package/dist/interactive/doc-binding.d.ts.map +1 -1
- package/dist/interactive/doc-binding.js +4 -0
- package/dist/interactive/doc-binding.js.map +1 -1
- package/dist/interactive/doc-checks-routes.d.ts +34 -1
- package/dist/interactive/doc-checks-routes.d.ts.map +1 -1
- package/dist/interactive/doc-checks-routes.js +84 -0
- package/dist/interactive/doc-checks-routes.js.map +1 -1
- package/dist/interactive/draft-events.d.ts +7 -0
- package/dist/interactive/draft-events.d.ts.map +1 -1
- package/dist/interactive/draft-events.js +38 -6
- package/dist/interactive/draft-events.js.map +1 -1
- package/dist/interactive/draft-skill.d.ts +76 -6
- package/dist/interactive/draft-skill.d.ts.map +1 -1
- package/dist/interactive/draft-skill.js +219 -17
- package/dist/interactive/draft-skill.js.map +1 -1
- package/dist/interactive/edit-events.d.ts.map +1 -1
- package/dist/interactive/edit-events.js +4 -2
- package/dist/interactive/edit-events.js.map +1 -1
- package/dist/interactive/landing-guard.d.ts +47 -0
- package/dist/interactive/landing-guard.d.ts.map +1 -0
- package/dist/interactive/landing-guard.js +43 -0
- package/dist/interactive/landing-guard.js.map +1 -0
- package/dist/interactive/landing-record.d.ts +68 -0
- package/dist/interactive/landing-record.d.ts.map +1 -0
- package/dist/interactive/landing-record.js +154 -0
- package/dist/interactive/landing-record.js.map +1 -0
- package/dist/interactive/proposal-create.d.ts +3 -1
- package/dist/interactive/proposal-create.d.ts.map +1 -1
- package/dist/interactive/proposal-create.js +14 -2
- package/dist/interactive/proposal-create.js.map +1 -1
- package/dist/interactive/proposal-refine.d.ts +48 -0
- package/dist/interactive/proposal-refine.d.ts.map +1 -0
- package/dist/interactive/proposal-refine.js +99 -0
- package/dist/interactive/proposal-refine.js.map +1 -0
- package/dist/interactive/protected-edits.d.ts +67 -0
- package/dist/interactive/protected-edits.d.ts.map +1 -0
- package/dist/interactive/protected-edits.js +160 -0
- package/dist/interactive/protected-edits.js.map +1 -0
- package/dist/interactive/proxy-routes.js +2 -2
- package/dist/interactive/review-events.js +1 -1
- package/dist/interactive/run-units.d.ts +1 -1
- package/dist/interactive/run-units.d.ts.map +1 -1
- package/dist/interactive/run-units.js +8 -2
- package/dist/interactive/run-units.js.map +1 -1
- package/dist/interactive/source-packet.d.ts +66 -1
- package/dist/interactive/source-packet.d.ts.map +1 -1
- package/dist/interactive/source-packet.js +309 -60
- package/dist/interactive/source-packet.js.map +1 -1
- package/dist/interactive/theme-events.js +1 -1
- package/dist/knowledge/adapters/web/egress.d.ts +99 -0
- package/dist/knowledge/adapters/web/egress.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/egress.js +330 -0
- package/dist/knowledge/adapters/web/egress.js.map +1 -0
- package/dist/knowledge/adapters/web/engine.d.ts +54 -0
- package/dist/knowledge/adapters/web/engine.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/engine.js +101 -0
- package/dist/knowledge/adapters/web/engine.js.map +1 -0
- package/dist/knowledge/adapters/web/fetch.d.ts +131 -0
- package/dist/knowledge/adapters/web/fetch.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/fetch.js +325 -0
- package/dist/knowledge/adapters/web/fetch.js.map +1 -0
- package/dist/knowledge/adapters/web/gate-web.d.ts +182 -0
- package/dist/knowledge/adapters/web/gate-web.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/gate-web.js +496 -0
- package/dist/knowledge/adapters/web/gate-web.js.map +1 -0
- package/dist/knowledge/adapters/web/routes.d.ts +36 -0
- package/dist/knowledge/adapters/web/routes.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/routes.js +99 -0
- package/dist/knowledge/adapters/web/routes.js.map +1 -0
- package/dist/knowledge/adapters/web/searxng.d.ts +89 -0
- package/dist/knowledge/adapters/web/searxng.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/searxng.js +274 -0
- package/dist/knowledge/adapters/web/searxng.js.map +1 -0
- package/dist/knowledge/adapters/web/source.d.ts +65 -0
- package/dist/knowledge/adapters/web/source.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/source.js +192 -0
- package/dist/knowledge/adapters/web/source.js.map +1 -0
- package/dist/knowledge/gate/gate.d.ts +22 -0
- package/dist/knowledge/gate/gate.d.ts.map +1 -1
- package/dist/knowledge/gate/gate.js +62 -1
- package/dist/knowledge/gate/gate.js.map +1 -1
- package/dist/knowledge/gate/sources.d.ts +2 -0
- package/dist/knowledge/gate/sources.d.ts.map +1 -1
- package/dist/knowledge/gate/sources.js +5 -2
- package/dist/knowledge/gate/sources.js.map +1 -1
- package/dist/knowledge/package.d.ts +7 -0
- package/dist/knowledge/package.d.ts.map +1 -1
- package/dist/knowledge/package.js +15 -1
- package/dist/knowledge/package.js.map +1 -1
- package/dist/knowledge/trackers/actions.js +1 -1
- package/dist/knowledge/trackers/actions.js.map +1 -1
- package/dist/knowledge/trackers/bindings.d.ts +3 -3
- package/dist/knowledge/trackers/bindings.d.ts.map +1 -1
- package/dist/knowledge/trackers/bindings.js +36 -23
- package/dist/knowledge/trackers/bindings.js.map +1 -1
- package/dist/knowledge/trackers/routes.js +1 -1
- package/dist/knowledge/trackers/routes.js.map +1 -1
- package/dist/learnings/service.d.ts.map +1 -1
- package/dist/learnings/service.js +2 -0
- package/dist/learnings/service.js.map +1 -1
- package/dist/mcp/broker.d.ts +8 -0
- package/dist/mcp/broker.d.ts.map +1 -1
- package/dist/mcp/broker.js +48 -3
- package/dist/mcp/broker.js.map +1 -1
- package/dist/mcp/estate-relay.d.ts +43 -1
- package/dist/mcp/estate-relay.d.ts.map +1 -1
- package/dist/mcp/estate-relay.js +38 -2
- package/dist/mcp/estate-relay.js.map +1 -1
- package/dist/mcp/registry.d.ts +6 -0
- package/dist/mcp/registry.d.ts.map +1 -1
- package/dist/mcp/registry.js +42 -3
- package/dist/mcp/registry.js.map +1 -1
- package/dist/mcp/run-fence.d.ts +57 -0
- package/dist/mcp/run-fence.d.ts.map +1 -0
- package/dist/mcp/run-fence.js +86 -0
- package/dist/mcp/run-fence.js.map +1 -0
- package/dist/mcp/tool-list.d.ts +5 -0
- package/dist/mcp/tool-list.d.ts.map +1 -1
- package/dist/mcp/tool-list.js +7 -3
- package/dist/mcp/tool-list.js.map +1 -1
- package/dist/presets/routes.d.ts.map +1 -1
- package/dist/presets/routes.js +6 -0
- package/dist/presets/routes.js.map +1 -1
- package/dist/projects/routes.d.ts +1 -1
- package/dist/projects/state-home-preflight.d.ts.map +1 -1
- package/dist/projects/state-home-preflight.js +2 -0
- package/dist/projects/state-home-preflight.js.map +1 -1
- package/dist/setup/tool-path.d.ts +16 -0
- package/dist/setup/tool-path.d.ts.map +1 -0
- package/dist/setup/tool-path.js +66 -0
- package/dist/setup/tool-path.js.map +1 -0
- package/dist/skills/plugin-source.d.ts +42 -88
- package/dist/skills/plugin-source.d.ts.map +1 -1
- package/dist/skills/plugin-source.js +140 -100
- package/dist/skills/plugin-source.js.map +1 -1
- package/dist/skills/runtime.d.ts.map +1 -1
- package/dist/skills/runtime.js +15 -7
- package/dist/skills/runtime.js.map +1 -1
- package/dist/skills/store.d.ts.map +1 -1
- package/dist/skills/store.js +25 -14
- package/dist/skills/store.js.map +1 -1
- package/dist/skills/usage.d.ts +238 -0
- package/dist/skills/usage.d.ts.map +1 -0
- package/dist/skills/usage.js +789 -0
- package/dist/skills/usage.js.map +1 -0
- package/dist/skills/venv.d.ts +18 -2
- package/dist/skills/venv.d.ts.map +1 -1
- package/dist/skills/venv.js +2 -2
- package/dist/skills/venv.js.map +1 -1
- package/dist/sources/routes.d.ts +3 -1
- package/dist/sources/routes.d.ts.map +1 -1
- package/dist/sources/routes.js +11 -0
- package/dist/sources/routes.js.map +1 -1
- package/dist/standing-orders/parse.d.ts +19 -0
- package/dist/standing-orders/parse.d.ts.map +1 -1
- package/dist/standing-orders/parse.js +61 -18
- package/dist/standing-orders/parse.js.map +1 -1
- package/dist/studio/apps-standalone/fixture.html +12 -0
- package/dist/studio/apps-standalone/fixture.js +10 -0
- package/dist/studio/apps-standalone/runtime.css +139 -0
- package/dist/studio/apps-standalone/runtime.js +1 -0
- package/dist/studio/assets/{KnowledgeGraph-Cpm46tEp.js → KnowledgeGraph-AtkRlS3c.js} +1 -1
- package/dist/studio/assets/index-CdbCAs7s.css +32 -0
- package/dist/studio/assets/index-DU_8o4uq.js +1104 -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 +14 -1
- 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 +10 -1
- package/dist/studio/editors/wicked-page/index.html +2 -2
- package/dist/studio/editors/wicked-video/editor.json +7 -2
- package/dist/studio/editors/wicked-video/index.html +14 -11
- package/dist/studio/index.html +2 -2
- package/dist/studio/testid-inventory.json +2069 -242
- package/dist/team/routes.d.ts +1 -1
- package/dist/workflow-catalog/build-v2.d.ts +6 -2
- package/dist/workflow-catalog/build-v2.d.ts.map +1 -1
- package/dist/workflow-catalog/build-v2.js +37 -13
- package/dist/workflow-catalog/build-v2.js.map +1 -1
- package/dist/workflow-catalog/catalog-data-v2.d.ts.map +1 -1
- package/dist/workflow-catalog/catalog-data-v2.js +310 -105
- 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 +2 -20
- package/dist/workflow-catalog/catalog-data.js.map +1 -1
- package/dist/workflow-catalog/detect-service.d.ts +95 -0
- package/dist/workflow-catalog/detect-service.d.ts.map +1 -0
- package/dist/workflow-catalog/detect-service.js +239 -0
- package/dist/workflow-catalog/detect-service.js.map +1 -0
- package/dist/workflow-catalog/detect.d.ts +213 -0
- package/dist/workflow-catalog/detect.d.ts.map +1 -0
- package/dist/workflow-catalog/detect.js +653 -0
- package/dist/workflow-catalog/detect.js.map +1 -0
- package/dist/workflow-catalog/shape.d.ts +3 -1
- package/dist/workflow-catalog/shape.d.ts.map +1 -1
- package/dist/workflow-catalog/shape.js +7 -1
- package/dist/workflow-catalog/shape.js.map +1 -1
- package/dist/working-doc/bridge-backend.js +2 -2
- package/dist/working-doc/event-lines.d.ts +67 -2
- package/dist/working-doc/event-lines.d.ts.map +1 -1
- package/dist/working-doc/event-lines.js +155 -8
- package/dist/working-doc/event-lines.js.map +1 -1
- package/dist/working-doc/notes-index.d.ts +35 -0
- package/dist/working-doc/notes-index.d.ts.map +1 -0
- package/dist/working-doc/notes-index.js +82 -0
- package/dist/working-doc/notes-index.js.map +1 -0
- package/dist/working-doc/routes.js +4 -4
- package/dist/working-doc/sections.js +2 -2
- package/dist/working-doc/service.d.ts +260 -21
- package/dist/working-doc/service.d.ts.map +1 -1
- package/dist/working-doc/service.js +791 -90
- package/dist/working-doc/service.js.map +1 -1
- package/dist/working-doc/store.d.ts +50 -1
- package/dist/working-doc/store.d.ts.map +1 -1
- package/dist/working-doc/store.js +4 -1
- package/dist/working-doc/store.js.map +1 -1
- package/endpoint-manifest.json +187 -3
- package/evals/corpora/shape-corrections-v1.json +594 -0
- package/evals/corpora/shape-corrections-v1.seat-fixture.json +186 -0
- package/evals/corpora/shape-v1.json +2113 -0
- package/evals/corpora/shape-v1.seat-fixture.json +1800 -0
- package/package.json +11 -7
- package/scripts/apps-render.py +226 -0
- package/workflows/detect-shape.json +29 -0
- package/dist/studio/assets/index-BRBwWQMH.css +0 -32
- package/dist/studio/assets/index-CVrWDGRP.js +0 -1097
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DO NOT MODIFY MANUALLY — this is generated from the templates dir
|
|
4
|
+
*
|
|
5
|
+
* To make changes, edit the files in the templates/ directory and run:
|
|
6
|
+
* npm run copy:templates
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.parse = exports.SqlError = void 0;
|
|
27
|
+
exports.formatSqlError = formatSqlError;
|
|
28
|
+
exports.hasSqlDetails = hasSqlDetails;
|
|
29
|
+
exports.loadModule = loadModule;
|
|
30
|
+
exports.parseSync = parseSync;
|
|
31
|
+
__exportStar(require("@pgsql/types"), exports);
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
const libpg_query_js_1 = __importDefault(require("./libpg-query.js"));
|
|
34
|
+
let wasmModule;
|
|
35
|
+
class SqlError extends Error {
|
|
36
|
+
sqlDetails;
|
|
37
|
+
constructor(message, details) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.name = 'SqlError';
|
|
40
|
+
this.sqlDetails = details;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.SqlError = SqlError;
|
|
44
|
+
// Helper function to classify error source
|
|
45
|
+
function getErrorSource(filename) {
|
|
46
|
+
if (!filename)
|
|
47
|
+
return 'unknown';
|
|
48
|
+
if (filename === 'scan.l')
|
|
49
|
+
return 'lexer'; // Lexical analysis errors
|
|
50
|
+
if (filename === 'gram.y')
|
|
51
|
+
return 'parser'; // Grammar/parsing errors
|
|
52
|
+
return filename;
|
|
53
|
+
}
|
|
54
|
+
// Format SQL error with visual position indicator
|
|
55
|
+
function formatSqlError(error, query, options = {}) {
|
|
56
|
+
const { showPosition = true, showQuery = true, color = false, maxQueryLength } = options;
|
|
57
|
+
const lines = [];
|
|
58
|
+
// ANSI color codes
|
|
59
|
+
const red = color ? '\x1b[31m' : '';
|
|
60
|
+
const yellow = color ? '\x1b[33m' : '';
|
|
61
|
+
const reset = color ? '\x1b[0m' : '';
|
|
62
|
+
// Add error message
|
|
63
|
+
lines.push(`${red}Error: ${error.message}${reset}`);
|
|
64
|
+
// Add SQL details if available
|
|
65
|
+
if (error.sqlDetails) {
|
|
66
|
+
const { cursorPosition, fileName, functionName, lineNumber } = error.sqlDetails;
|
|
67
|
+
if (cursorPosition !== undefined && cursorPosition >= 0) {
|
|
68
|
+
lines.push(`Position: ${cursorPosition}`);
|
|
69
|
+
}
|
|
70
|
+
if (fileName || functionName || lineNumber) {
|
|
71
|
+
const details = [];
|
|
72
|
+
if (fileName)
|
|
73
|
+
details.push(`file: ${fileName}`);
|
|
74
|
+
if (functionName)
|
|
75
|
+
details.push(`function: ${functionName}`);
|
|
76
|
+
if (lineNumber)
|
|
77
|
+
details.push(`line: ${lineNumber}`);
|
|
78
|
+
lines.push(`Source: ${details.join(', ')}`);
|
|
79
|
+
}
|
|
80
|
+
// Show query with position marker
|
|
81
|
+
if (showQuery && showPosition && cursorPosition !== undefined && cursorPosition >= 0) {
|
|
82
|
+
let displayQuery = query;
|
|
83
|
+
// Truncate if needed
|
|
84
|
+
if (maxQueryLength && query.length > maxQueryLength) {
|
|
85
|
+
const start = Math.max(0, cursorPosition - Math.floor(maxQueryLength / 2));
|
|
86
|
+
const end = Math.min(query.length, start + maxQueryLength);
|
|
87
|
+
displayQuery = (start > 0 ? '...' : '') +
|
|
88
|
+
query.substring(start, end) +
|
|
89
|
+
(end < query.length ? '...' : '');
|
|
90
|
+
// Adjust cursor position for truncation
|
|
91
|
+
const adjustedPosition = cursorPosition - start + (start > 0 ? 3 : 0);
|
|
92
|
+
lines.push(displayQuery);
|
|
93
|
+
lines.push(' '.repeat(adjustedPosition) + `${yellow}^${reset}`);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
lines.push(displayQuery);
|
|
97
|
+
lines.push(' '.repeat(cursorPosition) + `${yellow}^${reset}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else if (showQuery) {
|
|
102
|
+
// No SQL details, just show the query if requested
|
|
103
|
+
let displayQuery = query;
|
|
104
|
+
if (maxQueryLength && query.length > maxQueryLength) {
|
|
105
|
+
displayQuery = query.substring(0, maxQueryLength) + '...';
|
|
106
|
+
}
|
|
107
|
+
lines.push(`Query: ${displayQuery}`);
|
|
108
|
+
}
|
|
109
|
+
return lines.join('\n');
|
|
110
|
+
}
|
|
111
|
+
// Check if an error has SQL details
|
|
112
|
+
function hasSqlDetails(error) {
|
|
113
|
+
return error instanceof Error &&
|
|
114
|
+
'sqlDetails' in error &&
|
|
115
|
+
typeof error.sqlDetails === 'object' &&
|
|
116
|
+
error.sqlDetails !== null &&
|
|
117
|
+
'message' in error.sqlDetails &&
|
|
118
|
+
'cursorPosition' in error.sqlDetails;
|
|
119
|
+
}
|
|
120
|
+
// After a WASM call throws, the instance is stale: async calls wait for its
|
|
121
|
+
// replacement, while sync calls, which cannot wait, keep using it until the
|
|
122
|
+
// replacement is ready. One replacement loads at a time; the next call retries
|
|
123
|
+
// a failed load.
|
|
124
|
+
let stale = false;
|
|
125
|
+
let loading;
|
|
126
|
+
// Counts WASM calls that threw, so cleanup skips an instance that threw mid-call.
|
|
127
|
+
let failures = 0;
|
|
128
|
+
// Sync calls stop using a stale instance after this many failures on it: past
|
|
129
|
+
// about 45, a stack overflow can make the next one spin forever.
|
|
130
|
+
const MAX_STALE_FAILURES = 10;
|
|
131
|
+
let staleFailures = 0;
|
|
132
|
+
// Set by loadModule({ wasm }); instances are then created from it instead of the file.
|
|
133
|
+
let provided;
|
|
134
|
+
function createModule() {
|
|
135
|
+
const module = provided;
|
|
136
|
+
if (!module)
|
|
137
|
+
return (0, libpg_query_js_1.default)();
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
(0, libpg_query_js_1.default)({
|
|
140
|
+
instantiateWasm(imports, receive) {
|
|
141
|
+
WebAssembly.instantiate(module, imports).then(receive, reject);
|
|
142
|
+
return {};
|
|
143
|
+
},
|
|
144
|
+
}).then(resolve, reject);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function instantiate() {
|
|
148
|
+
if (loading)
|
|
149
|
+
return loading;
|
|
150
|
+
const promise = createModule().then((module) => {
|
|
151
|
+
wasmModule = module;
|
|
152
|
+
stale = false;
|
|
153
|
+
staleFailures = 0;
|
|
154
|
+
loading = undefined;
|
|
155
|
+
}, (error) => {
|
|
156
|
+
loading = undefined;
|
|
157
|
+
throw error;
|
|
158
|
+
});
|
|
159
|
+
loading = promise;
|
|
160
|
+
// Rejects only for the callers awaiting it.
|
|
161
|
+
promise.catch(() => { });
|
|
162
|
+
return promise;
|
|
163
|
+
}
|
|
164
|
+
instantiate();
|
|
165
|
+
// An exception out of a WASM call (V8 stack overflow on deeply nested SQL, a
|
|
166
|
+
// trap, or exit() once the heap limit is hit) skips libpg_query's cleanup and
|
|
167
|
+
// leaves the instance corrupt, so replace it with a fresh one.
|
|
168
|
+
function callWasm(fn) {
|
|
169
|
+
const proc = globalThis.process;
|
|
170
|
+
const exitCode = proc?.exitCode;
|
|
171
|
+
try {
|
|
172
|
+
return fn();
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
failures++;
|
|
176
|
+
stale = true;
|
|
177
|
+
if (++staleFailures >= MAX_STALE_FAILURES)
|
|
178
|
+
wasmModule = undefined;
|
|
179
|
+
instantiate();
|
|
180
|
+
if (proc)
|
|
181
|
+
proc.exitCode = exitCode;
|
|
182
|
+
if (error instanceof Error)
|
|
183
|
+
throw error;
|
|
184
|
+
const reason = typeof error === 'object' && error !== null
|
|
185
|
+
? (error.message ?? error.constructor?.name)
|
|
186
|
+
: error;
|
|
187
|
+
throw new Error(`libpg_query terminated (${reason}), most likely out of WASM memory; parse large inputs in smaller pieces`, { cause: error });
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function ensureLoaded() {
|
|
191
|
+
if (!wasmModule)
|
|
192
|
+
throw new Error("WASM module not initialized. Call `loadModule()` first.");
|
|
193
|
+
}
|
|
194
|
+
// A rest parameter keeps loadModule.length at 0, so `before(loadModule)` is not
|
|
195
|
+
// mistaken for a callback-style hook by test runners.
|
|
196
|
+
async function loadModule(...args) {
|
|
197
|
+
const wasm = args[0]?.wasm;
|
|
198
|
+
if (wasm !== undefined) {
|
|
199
|
+
provided = wasm instanceof WebAssembly.Module
|
|
200
|
+
? wasm
|
|
201
|
+
: await WebAssembly.compile(wasm);
|
|
202
|
+
// An instance loaded from the file, or still loading, is replaced by one from `wasm`.
|
|
203
|
+
await loading?.catch(() => { });
|
|
204
|
+
stale = true;
|
|
205
|
+
}
|
|
206
|
+
while (!wasmModule || stale)
|
|
207
|
+
await instantiate();
|
|
208
|
+
}
|
|
209
|
+
function awaitInit(fn) {
|
|
210
|
+
return (async (...args) => {
|
|
211
|
+
// Re-checked after every await: another call may have failed in between.
|
|
212
|
+
while (!wasmModule || stale)
|
|
213
|
+
await instantiate();
|
|
214
|
+
return fn(...args);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
const SURROGATE = /[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDFFF]/g;
|
|
218
|
+
function stringToPtr(str) {
|
|
219
|
+
ensureLoaded();
|
|
220
|
+
if (typeof str !== 'string') {
|
|
221
|
+
throw new TypeError(`Expected a string, got ${typeof str}`);
|
|
222
|
+
}
|
|
223
|
+
// libpg_query takes a NUL-terminated C string: an embedded NUL would end the
|
|
224
|
+
// parse early and silently drop everything after it.
|
|
225
|
+
if (str.includes('\0')) {
|
|
226
|
+
throw new Error('Query must not contain a NUL (U+0000) character');
|
|
227
|
+
}
|
|
228
|
+
// lengthBytesUTF8 and stringToUTF8 disagree on unpaired surrogates, which cut
|
|
229
|
+
// the query short. Write each as U+FFFD, the same bytes a Postgres driver sends.
|
|
230
|
+
const wellFormed = str.replace(SURROGATE, (s) => (s.length === 2 ? s : '\uFFFD'));
|
|
231
|
+
const size = wasmModule.lengthBytesUTF8(wellFormed) + 1;
|
|
232
|
+
const ptr = wasmModule._malloc(size);
|
|
233
|
+
if (!ptr) {
|
|
234
|
+
throw new Error('Failed to allocate memory for query');
|
|
235
|
+
}
|
|
236
|
+
wasmModule.stringToUTF8(wellFormed, ptr, size);
|
|
237
|
+
return ptr;
|
|
238
|
+
}
|
|
239
|
+
function ptrToString(ptr) {
|
|
240
|
+
ensureLoaded();
|
|
241
|
+
if (typeof ptr !== 'number') {
|
|
242
|
+
throw new TypeError(`Expected a number, got ${typeof ptr}`);
|
|
243
|
+
}
|
|
244
|
+
return wasmModule.UTF8ToString(ptr);
|
|
245
|
+
}
|
|
246
|
+
exports.parse = awaitInit(async (query) => {
|
|
247
|
+
// Pre-validation
|
|
248
|
+
if (query === null || query === undefined) {
|
|
249
|
+
throw new Error('Query cannot be null or undefined');
|
|
250
|
+
}
|
|
251
|
+
if (typeof query !== 'string') {
|
|
252
|
+
throw new Error(`Query must be a string, got ${typeof query}`);
|
|
253
|
+
}
|
|
254
|
+
if (query.trim() === '') {
|
|
255
|
+
throw new Error('Query cannot be empty');
|
|
256
|
+
}
|
|
257
|
+
const queryPtr = stringToPtr(query);
|
|
258
|
+
const failuresBefore = failures;
|
|
259
|
+
let resultPtr = 0;
|
|
260
|
+
try {
|
|
261
|
+
// Call the raw function that returns a struct pointer
|
|
262
|
+
resultPtr = callWasm(() => wasmModule._wasm_parse_query_raw(queryPtr));
|
|
263
|
+
if (!resultPtr) {
|
|
264
|
+
throw new Error('Failed to allocate memory for parse result');
|
|
265
|
+
}
|
|
266
|
+
// Read the PgQueryParseResult struct fields
|
|
267
|
+
// struct { char* parse_tree; char* stderr_buffer; PgQueryError* error; }
|
|
268
|
+
const parseTreePtr = wasmModule.getValue(resultPtr, 'i32'); // offset 0
|
|
269
|
+
const stderrBufferPtr = wasmModule.getValue(resultPtr + 4, 'i32'); // offset 4
|
|
270
|
+
const errorPtr = wasmModule.getValue(resultPtr + 8, 'i32'); // offset 8
|
|
271
|
+
// Check for error
|
|
272
|
+
if (errorPtr) {
|
|
273
|
+
// Read PgQueryError struct fields
|
|
274
|
+
// struct { char* message; char* funcname; char* filename; int lineno; int cursorpos; char* context; }
|
|
275
|
+
const messagePtr = wasmModule.getValue(errorPtr, 'i32'); // offset 0
|
|
276
|
+
const funcnamePtr = wasmModule.getValue(errorPtr + 4, 'i32'); // offset 4
|
|
277
|
+
const filenamePtr = wasmModule.getValue(errorPtr + 8, 'i32'); // offset 8
|
|
278
|
+
const lineno = wasmModule.getValue(errorPtr + 12, 'i32'); // offset 12
|
|
279
|
+
const cursorpos = wasmModule.getValue(errorPtr + 16, 'i32'); // offset 16
|
|
280
|
+
const contextPtr = wasmModule.getValue(errorPtr + 20, 'i32'); // offset 20
|
|
281
|
+
const message = messagePtr ? wasmModule.UTF8ToString(messagePtr) : 'Unknown error';
|
|
282
|
+
const filename = filenamePtr ? wasmModule.UTF8ToString(filenamePtr) : null;
|
|
283
|
+
const errorDetails = {
|
|
284
|
+
message: message,
|
|
285
|
+
cursorPosition: cursorpos > 0 ? cursorpos - 1 : 0, // Convert to 0-based
|
|
286
|
+
fileName: filename || undefined,
|
|
287
|
+
functionName: funcnamePtr ? wasmModule.UTF8ToString(funcnamePtr) : undefined,
|
|
288
|
+
lineNumber: lineno > 0 ? lineno : undefined,
|
|
289
|
+
context: contextPtr ? wasmModule.UTF8ToString(contextPtr) : undefined
|
|
290
|
+
};
|
|
291
|
+
throw new SqlError(message, errorDetails);
|
|
292
|
+
}
|
|
293
|
+
if (!parseTreePtr) {
|
|
294
|
+
throw new Error('libpg_query returned no parse tree: out of WASM memory (heap limit is WASM_MAXIMUM_MEMORY, 1 GiB); parse large inputs in smaller pieces');
|
|
295
|
+
}
|
|
296
|
+
const parseTree = wasmModule.UTF8ToString(parseTreePtr);
|
|
297
|
+
return JSON.parse(parseTree);
|
|
298
|
+
}
|
|
299
|
+
finally {
|
|
300
|
+
if (failures === failuresBefore) {
|
|
301
|
+
wasmModule._free(queryPtr);
|
|
302
|
+
if (resultPtr) {
|
|
303
|
+
wasmModule._wasm_free_parse_result(resultPtr);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
function parseSync(query) {
|
|
309
|
+
// Pre-validation
|
|
310
|
+
if (query === null || query === undefined) {
|
|
311
|
+
throw new Error('Query cannot be null or undefined');
|
|
312
|
+
}
|
|
313
|
+
if (typeof query !== 'string') {
|
|
314
|
+
throw new Error(`Query must be a string, got ${typeof query}`);
|
|
315
|
+
}
|
|
316
|
+
if (query.trim() === '') {
|
|
317
|
+
throw new Error('Query cannot be empty');
|
|
318
|
+
}
|
|
319
|
+
const queryPtr = stringToPtr(query);
|
|
320
|
+
const failuresBefore = failures;
|
|
321
|
+
let resultPtr = 0;
|
|
322
|
+
try {
|
|
323
|
+
// Call the raw function that returns a struct pointer
|
|
324
|
+
resultPtr = callWasm(() => wasmModule._wasm_parse_query_raw(queryPtr));
|
|
325
|
+
if (!resultPtr) {
|
|
326
|
+
throw new Error('Failed to allocate memory for parse result');
|
|
327
|
+
}
|
|
328
|
+
// Read the PgQueryParseResult struct fields
|
|
329
|
+
// struct { char* parse_tree; char* stderr_buffer; PgQueryError* error; }
|
|
330
|
+
const parseTreePtr = wasmModule.getValue(resultPtr, 'i32'); // offset 0
|
|
331
|
+
const stderrBufferPtr = wasmModule.getValue(resultPtr + 4, 'i32'); // offset 4
|
|
332
|
+
const errorPtr = wasmModule.getValue(resultPtr + 8, 'i32'); // offset 8
|
|
333
|
+
// Check for error
|
|
334
|
+
if (errorPtr) {
|
|
335
|
+
// Read PgQueryError struct fields
|
|
336
|
+
// struct { char* message; char* funcname; char* filename; int lineno; int cursorpos; char* context; }
|
|
337
|
+
const messagePtr = wasmModule.getValue(errorPtr, 'i32'); // offset 0
|
|
338
|
+
const funcnamePtr = wasmModule.getValue(errorPtr + 4, 'i32'); // offset 4
|
|
339
|
+
const filenamePtr = wasmModule.getValue(errorPtr + 8, 'i32'); // offset 8
|
|
340
|
+
const lineno = wasmModule.getValue(errorPtr + 12, 'i32'); // offset 12
|
|
341
|
+
const cursorpos = wasmModule.getValue(errorPtr + 16, 'i32'); // offset 16
|
|
342
|
+
const contextPtr = wasmModule.getValue(errorPtr + 20, 'i32'); // offset 20
|
|
343
|
+
const message = messagePtr ? wasmModule.UTF8ToString(messagePtr) : 'Unknown error';
|
|
344
|
+
const filename = filenamePtr ? wasmModule.UTF8ToString(filenamePtr) : null;
|
|
345
|
+
const errorDetails = {
|
|
346
|
+
message: message,
|
|
347
|
+
cursorPosition: cursorpos > 0 ? cursorpos - 1 : 0, // Convert to 0-based
|
|
348
|
+
fileName: filename || undefined,
|
|
349
|
+
functionName: funcnamePtr ? wasmModule.UTF8ToString(funcnamePtr) : undefined,
|
|
350
|
+
lineNumber: lineno > 0 ? lineno : undefined,
|
|
351
|
+
context: contextPtr ? wasmModule.UTF8ToString(contextPtr) : undefined
|
|
352
|
+
};
|
|
353
|
+
throw new SqlError(message, errorDetails);
|
|
354
|
+
}
|
|
355
|
+
if (!parseTreePtr) {
|
|
356
|
+
throw new Error('libpg_query returned no parse tree: out of WASM memory (heap limit is WASM_MAXIMUM_MEMORY, 1 GiB); parse large inputs in smaller pieces');
|
|
357
|
+
}
|
|
358
|
+
const parseTree = wasmModule.UTF8ToString(parseTreePtr);
|
|
359
|
+
return JSON.parse(parseTree);
|
|
360
|
+
}
|
|
361
|
+
finally {
|
|
362
|
+
if (failures === failuresBefore) {
|
|
363
|
+
wasmModule._free(queryPtr);
|
|
364
|
+
if (resultPtr) {
|
|
365
|
+
wasmModule._wasm_free_parse_result(resultPtr);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT MODIFY MANUALLY — this is generated from the templates dir
|
|
3
|
+
*
|
|
4
|
+
* To make changes, edit the files in the templates/ directory and run:
|
|
5
|
+
* npm run copy:templates
|
|
6
|
+
*/
|
|
7
|
+
export * from "@pgsql/types";
|
|
8
|
+
export interface SqlErrorDetails {
|
|
9
|
+
message: string;
|
|
10
|
+
cursorPosition: number;
|
|
11
|
+
fileName?: string;
|
|
12
|
+
functionName?: string;
|
|
13
|
+
lineNumber?: number;
|
|
14
|
+
context?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SqlErrorFormatOptions {
|
|
17
|
+
showPosition?: boolean;
|
|
18
|
+
showQuery?: boolean;
|
|
19
|
+
color?: boolean;
|
|
20
|
+
maxQueryLength?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare class SqlError extends Error {
|
|
23
|
+
sqlDetails?: SqlErrorDetails;
|
|
24
|
+
constructor(message: string, details?: SqlErrorDetails);
|
|
25
|
+
}
|
|
26
|
+
export declare function formatSqlError(error: Error & {
|
|
27
|
+
sqlDetails?: SqlErrorDetails;
|
|
28
|
+
}, query: string, options?: SqlErrorFormatOptions): string;
|
|
29
|
+
export declare function hasSqlDetails(error: any): error is Error & {
|
|
30
|
+
sqlDetails: SqlErrorDetails;
|
|
31
|
+
};
|
|
32
|
+
type WasmCompiledModule = typeof globalThis extends {
|
|
33
|
+
WebAssembly: {
|
|
34
|
+
Module: new (...args: any[]) => infer M;
|
|
35
|
+
};
|
|
36
|
+
} ? M : never;
|
|
37
|
+
export interface LoadModuleOptions {
|
|
38
|
+
/**
|
|
39
|
+
* The contents of `libpg-query.wasm`, or the module compiled from them, for
|
|
40
|
+
* hosts where the wrapper cannot read the file itself (a custom protocol
|
|
41
|
+
* without fetch support, a bundle that inlines assets). Every later instance,
|
|
42
|
+
* including replacements after a failed call, is created from it.
|
|
43
|
+
*/
|
|
44
|
+
wasm?: ArrayBuffer | ArrayBufferView | WasmCompiledModule;
|
|
45
|
+
}
|
|
46
|
+
export declare function loadModule(...args: [options?: LoadModuleOptions]): Promise<void>;
|
|
47
|
+
export declare const parse: (query: string) => Promise<any>;
|
|
48
|
+
export declare function parseSync(query: string): any;
|