create-windy 0.8.3 → 0.10.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/dist/cli.js +2714 -1944
- package/package.json +2 -2
- package/template/.agents/skills/windy-business-module/SKILL.md +33 -1
- package/template/.windy-template.json +6 -2
- package/template/AGENTS.md +4 -0
- package/template/README.md +2 -0
- package/template/apps/agent-server/Dockerfile +92 -22
- package/template/apps/agent-server/README.md +47 -85
- package/template/apps/agent-server/documents/office.py +216 -0
- package/template/apps/agent-server/documents/query_report.py +136 -0
- package/template/apps/agent-server/documents/smoke.py +177 -0
- package/template/apps/agent-server/documents/test_boundaries.py +185 -0
- package/template/apps/agent-server/host-contracts.ts +56 -0
- package/template/apps/agent-server/install-native.ts +167 -0
- package/template/apps/agent-server/main.ts +179 -0
- package/template/apps/agent-server/native/EXTENSIONS.md +46 -0
- package/template/apps/agent-server/native/admission.ts +73 -0
- package/template/apps/agent-server/native/authorization.test.ts +176 -0
- package/template/apps/agent-server/native/authorization.ts +118 -0
- package/template/apps/agent-server/native/boundary-io.ts +93 -0
- package/template/apps/agent-server/native/boundary-product.ts +107 -0
- package/template/apps/agent-server/native/boundary-project.test.ts +247 -0
- package/template/apps/agent-server/native/boundary-project.ts +188 -0
- package/template/apps/agent-server/native/boundary.ts +188 -0
- package/template/apps/agent-server/native/compaction-policy.test.ts +175 -0
- package/template/apps/agent-server/native/config.ts +95 -0
- package/template/apps/agent-server/native/conversation-instructions.ts +9 -0
- package/template/apps/agent-server/native/extensions.test.ts +190 -0
- package/template/apps/agent-server/native/extensions.ts +31 -0
- package/template/apps/agent-server/native/host-profile.test.ts +91 -0
- package/template/apps/agent-server/native/host-profile.ts +33 -0
- package/template/apps/agent-server/native/host-test-fixture.ts +13 -0
- package/template/apps/agent-server/native/http.ts +129 -0
- package/template/apps/agent-server/native/lifecycle.test.ts +285 -0
- package/template/apps/agent-server/native/lifecycle.ts +136 -0
- package/template/apps/agent-server/native/manager.ts +292 -0
- package/template/apps/agent-server/native/native.test.ts +207 -0
- package/template/apps/agent-server/native/office-preview.test.ts +50 -0
- package/template/apps/agent-server/native/office-preview.ts +25 -0
- package/template/apps/agent-server/native/parallel-harness.ts +244 -0
- package/template/apps/agent-server/native/parallel-mcp-fixture.ts +97 -0
- package/template/apps/agent-server/native/parallel.test.ts +256 -0
- package/template/apps/agent-server/native/profile-composition.test.ts +147 -0
- package/template/apps/agent-server/native/profile.ts +307 -0
- package/template/apps/agent-server/native/request.ts +61 -0
- package/template/apps/agent-server/native/session-conflict.test.ts +235 -0
- package/template/apps/agent-server/native/session-conflict.ts +21 -0
- package/template/apps/agent-server/native/shared-skills.test.ts +128 -0
- package/template/apps/agent-server/native/shared-skills.ts +240 -0
- package/template/apps/agent-server/native/socket-lifecycle.test.ts +48 -0
- package/template/apps/agent-server/native/socket.ts +130 -0
- package/template/apps/agent-server/native/storage-lifecycle.test.ts +218 -0
- package/template/apps/agent-server/native/storage.ts +188 -0
- package/template/apps/agent-server/native/stream-authorization.test.ts +89 -0
- package/template/apps/agent-server/native/worker.ts +77 -0
- package/template/apps/agent-server/native-download.test.ts +119 -0
- package/template/apps/agent-server/native-download.ts +145 -0
- package/template/apps/agent-server/package.json +64 -0
- package/template/apps/agent-server/plugins/access.mjs +126 -0
- package/template/apps/agent-server/plugins/branding/README.md +9 -0
- package/template/apps/agent-server/plugins/branding/brand.css +85 -0
- package/template/apps/agent-server/plugins/branding/client.js +338 -0
- package/template/apps/agent-server/plugins/branding/index.mjs +35 -0
- package/template/apps/agent-server/plugins/branding/loading.d.mts +2 -0
- package/template/apps/agent-server/plugins/branding/loading.mjs +66 -0
- package/template/apps/agent-server/plugins/branding/loading.test.ts +89 -0
- package/template/apps/agent-server/plugins/branding/package.json +21 -0
- package/template/apps/agent-server/plugins/branding.test.ts +294 -0
- package/template/apps/agent-server/plugins/compaction.mjs +83 -0
- package/template/apps/agent-server/plugins/compaction.test.ts +91 -0
- package/template/apps/agent-server/plugins/confine-network.py +57 -0
- package/template/apps/agent-server/plugins/default-skills.test.ts +62 -0
- package/template/apps/agent-server/plugins/downloads/README.md +28 -0
- package/template/apps/agent-server/plugins/downloads/client.js +126 -0
- package/template/apps/agent-server/plugins/downloads/downloads.test.ts +222 -0
- package/template/apps/agent-server/plugins/downloads/index.d.mts +19 -0
- package/template/apps/agent-server/plugins/downloads/index.mjs +180 -0
- package/template/apps/agent-server/plugins/downloads/package.json +20 -0
- package/template/apps/agent-server/plugins/drop-overlay/README.md +24 -0
- package/template/apps/agent-server/plugins/drop-overlay/drop-overlay.test.ts +199 -0
- package/template/apps/agent-server/plugins/drop-overlay/index.d.mts +8 -0
- package/template/apps/agent-server/plugins/drop-overlay/index.mjs +12 -0
- package/template/apps/agent-server/plugins/drop-overlay/style.css +102 -0
- package/template/apps/agent-server/plugins/locale/client.js +61 -0
- package/template/apps/agent-server/plugins/locale/index.d.mts +9 -0
- package/template/apps/agent-server/plugins/locale/index.mjs +16 -0
- package/template/apps/agent-server/plugins/locale/locale.test.ts +217 -0
- package/template/apps/agent-server/plugins/locale/package.json +19 -0
- package/template/apps/agent-server/plugins/parallel.mjs +146 -0
- package/template/apps/agent-server/plugins/preset-registry.d.mts +2 -0
- package/template/apps/agent-server/plugins/preset-registry.mjs +41 -0
- package/template/apps/agent-server/plugins/preset-registry.test.ts +46 -0
- package/template/apps/agent-server/plugins/questions.d.mts +25 -0
- package/template/apps/agent-server/plugins/questions.mjs +142 -0
- package/template/apps/agent-server/plugins/questions.test.ts +105 -0
- package/template/apps/agent-server/plugins/settings/README.md +17 -0
- package/template/apps/agent-server/plugins/settings/client.js +102 -0
- package/template/apps/agent-server/plugins/settings/index.mjs +17 -0
- package/template/apps/agent-server/plugins/settings/package.json +19 -0
- package/template/apps/agent-server/plugins/settings/settings.test.ts +129 -0
- package/template/apps/agent-server/plugins/settings-controller.d.mts +4 -0
- package/template/apps/agent-server/plugins/settings-controller.mjs +31 -0
- package/template/apps/agent-server/plugins/settings-controller.test.ts +17 -0
- package/template/apps/agent-server/plugins/settings-dispatch.test.ts +34 -0
- package/template/apps/agent-server/plugins/shared-skills.d.mts +15 -0
- package/template/apps/agent-server/plugins/shared-skills.mjs +82 -0
- package/template/apps/agent-server/plugins/shared-skills.test.ts +51 -0
- package/template/apps/agent-server/plugins/skill-library/README.md +11 -0
- package/template/apps/agent-server/plugins/skill-library/archive.test.ts +43 -0
- package/template/apps/agent-server/plugins/skill-library/bundle.mjs +234 -0
- package/template/apps/agent-server/plugins/skill-library/client-chunks.test.ts +110 -0
- package/template/apps/agent-server/plugins/skill-library/client-form-mount.test.ts +139 -0
- package/template/apps/agent-server/plugins/skill-library/client-form.test.ts +261 -0
- package/template/apps/agent-server/plugins/skill-library/client-ui.test.ts +268 -0
- package/template/apps/agent-server/plugins/skill-library/client-use.test.ts +158 -0
- package/template/apps/agent-server/plugins/skill-library/client.editor.js +93 -0
- package/template/apps/agent-server/plugins/skill-library/client.form.js +316 -0
- package/template/apps/agent-server/plugins/skill-library/client.js +348 -0
- package/template/apps/agent-server/plugins/skill-library/client.request.js +52 -0
- package/template/apps/agent-server/plugins/skill-library/client.transfer.js +48 -0
- package/template/apps/agent-server/plugins/skill-library/client.use.js +46 -0
- package/template/apps/agent-server/plugins/skill-library/default-roots.test.ts +84 -0
- package/template/apps/agent-server/plugins/skill-library/draft.d.mts +17 -0
- package/template/apps/agent-server/plugins/skill-library/draft.mjs +152 -0
- package/template/apps/agent-server/plugins/skill-library/draft.test.ts +287 -0
- package/template/apps/agent-server/plugins/skill-library/index.d.mts +49 -0
- package/template/apps/agent-server/plugins/skill-library/index.mjs +226 -0
- package/template/apps/agent-server/plugins/skill-library/package.json +24 -0
- package/template/apps/agent-server/plugins/skill-library/presentation/README.md +27 -0
- package/template/apps/agent-server/plugins/skill-library/presentation/UPSTREAM.md +54 -0
- package/template/apps/agent-server/plugins/skill-library/presentation/boot.test.ts +150 -0
- package/template/apps/agent-server/plugins/skill-library/presentation/client.js +146 -0
- package/template/apps/agent-server/plugins/skill-library/presentation/client.test.ts +195 -0
- package/template/apps/agent-server/plugins/skill-library/presentation/index.d.mts +9 -0
- package/template/apps/agent-server/plugins/skill-library/presentation/index.mjs +30 -0
- package/template/apps/agent-server/plugins/skill-library/presentation/metadata.test.ts +82 -0
- package/template/apps/agent-server/plugins/skill-library/presentation/package.json +21 -0
- package/template/apps/agent-server/plugins/skill-library/presentation/react-boot.test.ts +162 -0
- package/template/apps/agent-server/plugins/skill-library/skills.test.ts +342 -0
- package/template/apps/agent-server/plugins/skill-library/storage.mjs +293 -0
- package/template/apps/agent-server/plugins/skill-library/style.css +229 -0
- package/template/apps/agent-server/plugins/skill-library/test-fixture.ts +77 -0
- package/template/apps/agent-server/plugins/skill-library/workflow.d.mts +18 -0
- package/template/apps/agent-server/plugins/skill-library/workflow.mjs +189 -0
- package/template/apps/agent-server/plugins/skill-library/workflow.test.ts +164 -0
- package/template/apps/agent-server/plugins/skills/README.md +5 -0
- package/template/apps/agent-server/plugins/skills/windy-data-summary/SKILL.md +14 -0
- package/template/apps/agent-server/plugins/skills/windy-extension-guide/SKILL.md +14 -0
- package/template/apps/agent-server/plugins/skills/windy-office/SKILL.md +14 -0
- package/template/apps/agent-server/plugins/skills/windy-skill-capture/SKILL.md +14 -0
- package/template/apps/agent-server/plugins/skills/windy-source-compare/SKILL.md +14 -0
- package/template/apps/agent-server/plugins/subprocess.mjs +40 -0
- package/template/apps/agent-server/plugins/theme/README.md +22 -0
- package/template/apps/agent-server/plugins/theme/client.js +18 -0
- package/template/apps/agent-server/plugins/theme/index.d.mts +9 -0
- package/template/apps/agent-server/plugins/theme/index.mjs +18 -0
- package/template/apps/agent-server/plugins/theme/package.json +19 -0
- package/template/apps/agent-server/plugins/theme/source-tokens.ts +81 -0
- package/template/apps/agent-server/plugins/theme/sync-tokens.ts +12 -0
- package/template/apps/agent-server/plugins/theme/theme.test.ts +193 -0
- package/template/apps/agent-server/plugins/theme/tokens.json +162 -0
- package/template/apps/agent-server/plugins/tool-catalog/README.md +82 -0
- package/template/apps/agent-server/plugins/tool-catalog/categories.mjs +111 -0
- package/template/apps/agent-server/plugins/tool-catalog/categories.test.ts +118 -0
- package/template/apps/agent-server/plugins/tool-catalog/client-cache.test.ts +264 -0
- package/template/apps/agent-server/plugins/tool-catalog/client.js +333 -0
- package/template/apps/agent-server/plugins/tool-catalog/client.test.ts +136 -0
- package/template/apps/agent-server/plugins/tool-catalog/discovery.d.mts +42 -0
- package/template/apps/agent-server/plugins/tool-catalog/discovery.mjs +245 -0
- package/template/apps/agent-server/plugins/tool-catalog/discovery.test.ts +291 -0
- package/template/apps/agent-server/plugins/tool-catalog/index.d.mts +5 -0
- package/template/apps/agent-server/plugins/tool-catalog/index.mjs +91 -0
- package/template/apps/agent-server/plugins/tool-catalog/package.json +23 -0
- package/template/apps/agent-server/plugins/tool-catalog/presentation.d.mts +21 -0
- package/template/apps/agent-server/plugins/tool-catalog/presentation.mjs +153 -0
- package/template/apps/agent-server/plugins/tool-catalog/presentation.test.ts +166 -0
- package/template/apps/agent-server/plugins/tool-catalog/routes.test.ts +209 -0
- package/template/apps/agent-server/plugins/tool-catalog/style.css +155 -0
- package/template/apps/agent-server/plugins/tool-catalog/use-tool.test.ts +160 -0
- package/template/apps/agent-server/plugins/tool-presentation/README.md +7 -0
- package/template/apps/agent-server/plugins/tool-presentation/build-client.ts +29 -0
- package/template/apps/agent-server/plugins/tool-presentation/client.js +312 -0
- package/template/apps/agent-server/plugins/tool-presentation/client.results.js +9 -0
- package/template/apps/agent-server/plugins/tool-presentation/client.test.ts +178 -0
- package/template/apps/agent-server/plugins/tool-presentation/index.mjs +10 -0
- package/template/apps/agent-server/plugins/tool-presentation/package.json +24 -0
- package/template/apps/agent-server/plugins/tool-presentation/result-discovery.mjs +43 -0
- package/template/apps/agent-server/plugins/tool-presentation/result-model.d.mts +51 -0
- package/template/apps/agent-server/plugins/tool-presentation/result-model.mjs +96 -0
- package/template/apps/agent-server/plugins/workspace/README.md +5 -0
- package/template/apps/agent-server/plugins/workspace/index.mjs +8 -0
- package/template/apps/agent-server/plugins/workspace/package.json +10 -0
- package/template/apps/agent-server/plugins/workspace/style.css +124 -0
- package/template/apps/agent-server/project/host.ts +13 -0
- package/template/apps/agent-server/runtime/artifacts.ts +115 -0
- package/template/apps/agent-server/runtime/audit.nodecheck.ts +60 -0
- package/template/apps/agent-server/runtime/capacity.ts +61 -0
- package/template/apps/agent-server/runtime/client-completion-budget.nodecheck.ts +92 -0
- package/template/apps/agent-server/runtime/compatibility.ts +39 -0
- package/template/apps/agent-server/runtime/completions.ts +320 -0
- package/template/apps/agent-server/runtime/config.ts +246 -0
- package/template/apps/agent-server/runtime/context-budget.ts +70 -0
- package/template/apps/agent-server/runtime/context-plugin.ts +306 -0
- package/template/apps/agent-server/runtime/context.nodecheck.ts +241 -0
- package/template/apps/agent-server/runtime/contracts.ts +201 -0
- package/template/apps/agent-server/runtime/dsh-engine.ts +198 -0
- package/template/apps/agent-server/runtime/evaluation-plugin.ts +115 -0
- package/template/apps/agent-server/runtime/evaluation.nodecheck.ts +194 -0
- package/template/apps/agent-server/runtime/events.ts +71 -0
- package/template/apps/agent-server/runtime/governance.ts +194 -0
- package/template/apps/agent-server/runtime/index.ts +339 -0
- package/template/apps/agent-server/runtime/internal-output.ts +37 -0
- package/template/apps/agent-server/runtime/isolation.nodecheck.ts +287 -0
- package/template/apps/agent-server/runtime/model-payload.ts +97 -0
- package/template/apps/agent-server/runtime/model-plugin.ts +308 -0
- package/template/apps/agent-server/runtime/model-route.ts +34 -0
- package/template/apps/agent-server/runtime/model-usage.ts +51 -0
- package/template/apps/agent-server/runtime/model-wire.ts +45 -0
- package/template/apps/agent-server/runtime/native-authorization.nodecheck.ts +126 -0
- package/template/apps/agent-server/runtime/native-completion.nodecheck.ts +81 -0
- package/template/apps/agent-server/runtime/output-validation.ts +66 -0
- package/template/apps/agent-server/runtime/production-capacity.nodecheck.ts +121 -0
- package/template/apps/agent-server/runtime/questions-workflow.nodecheck.ts +251 -0
- package/template/apps/agent-server/runtime/report-breakdown.ts +79 -0
- package/template/apps/agent-server/runtime/reporting.ts +219 -0
- package/template/apps/agent-server/runtime/run-completion.ts +39 -0
- package/template/apps/agent-server/runtime/run-request-digest.ts +18 -0
- package/template/apps/agent-server/runtime/runtime-test-fixtures.ts +264 -0
- package/template/apps/agent-server/runtime/runtime.nodecheck.ts +150 -0
- package/template/apps/agent-server/runtime/store-idempotency.nodecheck.ts +74 -0
- package/template/apps/agent-server/runtime/store.ts +324 -0
- package/template/apps/agent-server/runtime/structured-output-mode.nodecheck.ts +51 -0
- package/template/apps/agent-server/runtime/tool-name.ts +6 -0
- package/template/apps/agent-server/runtime/tool-plugin.ts +201 -0
- package/template/apps/agent-server/runtime/vision-readiness.ts +200 -0
- package/template/apps/agent-server/scripts/confinement-check.mjs +103 -0
- package/template/apps/agent-server/scripts/coordinator-check.mjs +344 -0
- package/template/apps/agent-server/scripts/documents-delivery-check.mjs +309 -0
- package/template/apps/agent-server/scripts/office-preview-check.mjs +92 -0
- package/template/apps/agent-server/scripts/test-confinement.ts +58 -0
- package/template/apps/agent-server/scripts/test-coordinator.ts +36 -0
- package/template/apps/agent-server/scripts/test-runtime.ts +46 -0
- package/template/apps/agent-server/tsconfig.json +21 -0
- package/template/apps/server/Dockerfile +5 -1
- package/template/apps/server/package.json +14 -10
- package/template/apps/server/scripts/check-dsh-platform-example.ts +251 -0
- package/template/apps/server/scripts/validate-module-composition-once.ts +2 -0
- package/template/apps/server/scripts/validate-module-composition.ts +8 -4
- package/template/apps/server/src/admin/routes.test.ts +29 -1
- package/template/apps/server/src/admin/routes.ts +20 -2
- package/template/apps/server/src/agent/client-session/completion.ts +1 -1
- package/template/apps/server/src/agent/client-session/manifest-admission.ts +1 -1
- package/template/apps/server/src/agent/client-session/request.ts +1 -1
- package/template/apps/server/src/agent/context-version-routes.ts +37 -13
- package/template/apps/server/src/agent/dsh-runtime-wire.test.ts +33 -0
- package/template/apps/server/src/agent/governance-runtime.ts +41 -0
- package/template/apps/server/src/agent/remote-runtime-response.ts +1 -1
- package/template/apps/server/src/agent/run-contracts.ts +1 -0
- package/template/apps/server/src/agent/run-definition-support.ts +9 -0
- package/template/apps/server/src/agent/run-facade.ts +1 -1
- package/template/apps/server/src/agent/run-input-verification.ts +1 -1
- package/template/apps/server/src/agent/run-routes.ts +1 -14
- package/template/apps/server/src/agent/run-start-preparation.ts +1 -1
- package/template/apps/server/src/agent/runtime-bootstrap-input.ts +2 -0
- package/template/apps/server/src/agent/runtime-bootstrap.ts +49 -157
- package/template/apps/server/src/agent/runtime-disabled-composition.ts +2 -1
- package/template/apps/server/src/agent/runtime-tool-composition.ts +2 -0
- package/template/apps/server/src/agent/session-invalidation/authorization-revocation.ts +54 -0
- package/template/apps/server/src/agent/session-runtime-composition.ts +1 -51
- package/template/apps/server/src/agent/unavailable-routes.ts +13 -2
- package/template/apps/server/src/agent/workflow-runtime-bootstrap.ts +9 -0
- package/template/apps/server/src/agent-skills/access.ts +88 -0
- package/template/apps/server/src/agent-skills/bootstrap.ts +49 -0
- package/template/apps/server/src/agent-skills/builtin-registration.ts +83 -0
- package/template/apps/server/src/agent-skills/builtins.ts +19 -0
- package/template/apps/server/src/agent-skills/bundle-zip.ts +163 -0
- package/template/apps/server/src/agent-skills/bundle.test.ts +79 -0
- package/template/apps/server/src/agent-skills/bundle.ts +133 -0
- package/template/apps/server/src/agent-skills/contracts.ts +46 -0
- package/template/apps/server/src/agent-skills/drizzle-repository.ts +125 -0
- package/template/apps/server/src/agent-skills/input.ts +29 -0
- package/template/apps/server/src/agent-skills/postgres.integration.test.ts +348 -0
- package/template/apps/server/src/agent-skills/read-routes.test.ts +116 -0
- package/template/apps/server/src/agent-skills/reader.ts +108 -0
- package/template/apps/server/src/agent-skills/repository.ts +105 -0
- package/template/apps/server/src/agent-skills/routes.ts +176 -0
- package/template/apps/server/src/agent-skills/service.test.ts +295 -0
- package/template/apps/server/src/agent-skills/service.ts +301 -0
- package/template/apps/server/src/agent-workflow/preset-registry.test.ts +137 -0
- package/template/apps/server/src/agent-workflow/preset-registry.ts +191 -0
- package/template/apps/server/src/agent-workflow/preset-routes.test.ts +94 -0
- package/template/apps/server/src/agent-workflow/preset-routes.ts +45 -0
- package/template/apps/server/src/agent-workflow/runtime-composition.ts +3 -0
- package/template/apps/server/src/agent-workflow/service.ts +17 -1
- package/template/apps/server/src/ai-artifact/media-resource-route.test.ts +134 -0
- package/template/apps/server/src/ai-artifact/routes.ts +1 -1
- package/template/apps/server/src/ai-artifact/runtime.ts +12 -0
- package/template/apps/server/src/ai-runtime-readiness/operation-port.test-support.ts +1 -1
- package/template/apps/server/src/ai-runtime-readiness/operation-port.ts +8 -0
- package/template/apps/server/src/ai-runtime-report/service.test.ts +10 -7
- package/template/apps/server/src/ai-runtime-report/service.ts +1 -1
- package/template/apps/server/src/ai-runtime-security/internal-token.ts +14 -0
- package/template/apps/server/src/app/agent-workflow-presets.ts +4 -0
- package/template/apps/server/src/app/antivirus-composition.test.ts +63 -0
- package/template/apps/server/src/app/antivirus-composition.ts +29 -0
- package/template/apps/server/src/app/dsh-skill-draft-audit.test.ts +195 -0
- package/template/apps/server/src/app/dsh-skill-draft-audit.ts +115 -0
- package/template/apps/server/src/app/dsh-workbench-audit.test.ts +71 -0
- package/template/apps/server/src/app/dsh-workbench-audit.ts +34 -0
- package/template/apps/server/src/app/dsh-workbench-handshake.test.ts +63 -0
- package/template/apps/server/src/app/dsh-workbench-handshake.ts +48 -0
- package/template/apps/server/src/app/dsh-workbench-http.test.ts +96 -0
- package/template/apps/server/src/app/dsh-workbench-lan-origin.test.ts +114 -0
- package/template/apps/server/src/app/dsh-workbench-launch.test.ts +70 -0
- package/template/apps/server/src/app/dsh-workbench-origin.test.ts +54 -0
- package/template/apps/server/src/app/dsh-workbench-proxy.ts +205 -0
- package/template/apps/server/src/app/dsh-workbench-session-conflict.test.ts +61 -0
- package/template/apps/server/src/app/dsh-workbench-session.ts +59 -0
- package/template/apps/server/src/app/dsh-workbench-socket-audit.test.ts +116 -0
- package/template/apps/server/src/app/dsh-workbench-socket.test.ts +246 -0
- package/template/apps/server/src/app/dsh-workbench-socket.ts +272 -0
- package/template/apps/server/src/app/dsh-workbench-test-support.ts +158 -0
- package/template/apps/server/src/app/dsh-workbench.test.ts +213 -0
- package/template/apps/server/src/app/dsh-workbench.ts +279 -0
- package/template/apps/server/src/app/workbench-public-origin.ts +16 -0
- package/template/apps/server/src/configuration/definition.ts +15 -11
- package/template/apps/server/src/data-governance/user-plaintext-routes.test.ts +3 -0
- package/template/apps/server/src/document/facade-support.ts +2 -2
- package/template/apps/server/src/document/facade.ts +2 -2
- package/template/apps/server/src/document/output-artifact-composition.ts +9 -5
- package/template/apps/server/src/document/output-artifact.test-support.ts +1 -1
- package/template/apps/server/src/embedding/facade.ts +1 -1
- package/template/apps/server/src/embedding/input.ts +1 -1
- package/template/apps/server/src/embedding/routes.ts +1 -1
- package/template/apps/server/src/http-app.ts +31 -0
- package/template/apps/server/src/index.ts +60 -60
- package/template/apps/server/src/license/routes.ts +4 -1
- package/template/apps/server/src/license/runtime-business-access.test.ts +261 -0
- package/template/apps/server/src/mcp/adapter.ts +1 -0
- package/template/apps/server/src/media-runtime/composition.ts +157 -0
- package/template/apps/server/src/media-runtime/media-only-composition.ts +44 -0
- package/template/apps/server/src/media-runtime/module-ai-port-factory.test.ts +69 -0
- package/template/apps/server/src/media-runtime/module-ai-port-factory.ts +72 -0
- package/template/apps/server/src/{agent → media-runtime}/runtime-readiness-sources.ts +14 -6
- package/template/apps/server/src/media-runtime/shared-composition.ts +104 -0
- package/template/apps/server/src/module-composition.test.ts +45 -0
- package/template/apps/server/src/module-composition.ts +57 -2
- package/template/apps/server/src/module-host/ai-operation-port.ts +97 -30
- package/template/apps/server/src/module-host/ai-operation-speech-normalize.test.ts +1 -1
- package/template/apps/server/src/module-host/http-runtime.ts +9 -3
- package/template/apps/server/src/module-host/static-route-authorization.test.ts +6 -3
- package/template/apps/server/src/module-host/storage-authorization-binding.test.ts +4 -0
- package/template/apps/server/src/module-runtime-validation.ts +2 -0
- package/template/apps/server/src/observability/bootstrap.ts +12 -0
- package/template/apps/server/src/observability/diagnostic-failure-recorder.ts +94 -0
- package/template/apps/server/src/observability/diagnostic-http-contract.test.ts +42 -0
- package/template/apps/server/src/observability/diagnostic-index.test.ts +89 -0
- package/template/apps/server/src/observability/diagnostic-index.ts +113 -0
- package/template/apps/server/src/observability/diagnostic-repository.ts +96 -0
- package/template/apps/server/src/platform-app-bootstrap.ts +42 -0
- package/template/apps/server/src/platform-http-runtime.ts +7 -1
- package/template/apps/server/src/runtime-development.test.ts +25 -0
- package/template/apps/server/src/runtime-development.ts +6 -44
- package/template/apps/server/src/runtime-feature.ts +5 -1
- package/template/apps/server/src/runtime.ts +3 -0
- package/template/apps/server/src/settings/drizzle-watermark-repository.ts +35 -4
- package/template/apps/server/src/settings/watermark-repository.ts +14 -0
- package/template/apps/server/src/settings/watermark-routes.test.ts +84 -2
- package/template/apps/server/src/settings/watermark-routes.ts +109 -0
- package/template/apps/server/src/settings/watermark-transfer.ts +79 -0
- package/template/apps/server/src/speech/facade-validation.ts +1 -1
- package/template/apps/server/src/speech/facade.ts +2 -2
- package/template/apps/server/src/startup-composition-validation.test.ts +32 -0
- package/template/apps/server/src/startup-finalization.ts +2 -0
- package/template/apps/server/src/startup-runtime.ts +77 -0
- package/template/apps/server/src/system/ai-runtime-build.ts +3 -0
- package/template/apps/server/src/system/ai-runtime-configuration.test.ts +36 -0
- package/template/apps/server/src/system/ai-runtime-configuration.ts +58 -0
- package/template/apps/server/src/system/diagnostic-routes.test.ts +123 -0
- package/template/apps/server/src/system/diagnostic-routes.ts +101 -0
- package/template/apps/server/src/system/environment-policy-reader.test.ts +74 -0
- package/template/apps/server/src/system/environment-policy-reader.ts +62 -0
- package/template/apps/server/src/system/feature-environment-assessment.test.ts +148 -0
- package/template/apps/server/src/system/feature-environment-assessment.ts +179 -0
- package/template/apps/server/src/system/host-diagnostics.test.ts +155 -0
- package/template/apps/server/src/system/host-diagnostics.ts +225 -0
- package/template/apps/server/src/system/menu-registry.test.ts +26 -0
- package/template/apps/server/src/system/menu-registry.ts +9 -7
- package/template/apps/server/src/system/operations.test.ts +5 -0
- package/template/apps/server/src/system/operations.ts +36 -12
- package/template/apps/server/src/system/role-authorization-postgres.integration.test.ts +181 -0
- package/template/apps/web/Dockerfile +15 -3
- package/template/apps/web/dev/dev-port.test.ts +6 -6
- package/template/apps/web/dev/dev-port.ts +1 -1
- package/template/apps/web/dev/start.ts +27 -11
- package/template/apps/web/dsh-workbench-location.ts +21 -0
- package/template/apps/web/dsh-workbench-proxy.test.ts +121 -0
- package/template/apps/web/dsh-workbench-proxy.ts +194 -0
- package/template/apps/web/index.html +1 -0
- package/template/apps/web/package.json +18 -16
- package/template/apps/web/runtime-server.test.ts +22 -1
- package/template/apps/web/runtime-server.ts +6 -0
- package/template/apps/web/server.ts +27 -6
- package/template/apps/web/src/App.vue +6 -3
- package/template/apps/web/src/assets/windy.svg +4 -0
- package/template/apps/web/src/components/auth/LoginForm.vue +2 -2
- package/template/apps/web/src/components/auth/PasswordChangeForm.vue +14 -3
- package/template/apps/web/src/components/common/FormDialog.vue +1 -1
- package/template/apps/web/src/components/license/LicenseFlow.webtest.ts +3 -0
- package/template/apps/web/src/components/license/LicenseMachineCodeQr.vue +99 -0
- package/template/apps/web/src/components/license/LicenseMachineCodeQr.webtest.ts +83 -0
- package/template/apps/web/src/components/license/LicensePairingCard.vue +1 -1
- package/template/apps/web/src/components/license/LicenseStatusCard.vue +14 -2
- package/template/apps/web/src/composables/useLoginFlow.ts +13 -1
- package/template/apps/web/src/composables/usePlatformSettings.ts +1 -1
- package/template/apps/web/src/composables/useWatermarkSettings.ts +1 -0
- package/template/apps/web/src/layout/AppSidebar.vue +5 -9
- package/template/apps/web/src/layout/AppSidebar.webtest.ts +4 -1
- package/template/apps/web/src/pages/auth/ChangePasswordPage.vue +67 -6
- package/template/apps/web/src/pages/auth/LoginPage.vue +3 -12
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.vue +30 -0
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationWorkbench.vue +25 -14
- package/template/apps/web/src/pages/configuration/components/TimeZoneSelect.vue +55 -0
- package/template/apps/web/src/pages/errors/PlatformErrorPage.vue +6 -0
- package/template/apps/web/src/pages/errors/PlatformErrorPage.webtest.ts +14 -1
- package/template/apps/web/src/pages/errors/error-page-extension.ts +1 -0
- package/template/apps/web/src/pages/profile/PersonalSettingsPage.vue +64 -11
- package/template/apps/web/src/pages/profile/PersonalSettingsPage.webtest.ts +21 -1
- package/template/apps/web/src/pages/settings/BrandingSettingsSection.vue +7 -18
- package/template/apps/web/src/pages/settings/BrandingSettingsSection.webtest.ts +9 -4
- package/template/apps/web/src/pages/settings/GlobalSettingsPage.vue +51 -6
- package/template/apps/web/src/pages/settings/GlobalSettingsPage.webtest.ts +19 -3
- package/template/apps/web/src/pages/settings/WatermarkSettingsSection.vue +1 -0
- package/template/apps/web/src/pages/settings/WatermarkYamlTransfer.vue +211 -0
- package/template/apps/web/src/pages/system/AgentNativePage.vue +44 -0
- package/template/apps/web/src/pages/system/AgentWorkflowPage.vue +20 -7
- package/template/apps/web/src/pages/system/DiagnosticLookupPage.vue +71 -0
- package/template/apps/web/src/pages/system/DiagnosticLookupPage.webtest.ts +102 -0
- package/template/apps/web/src/pages/system/SystemAgentSkillsPage.vue +88 -0
- package/template/apps/web/src/pages/system/SystemOperationsPage.vue +23 -0
- package/template/apps/web/src/pages/system/components/DiagnosticLogList.vue +120 -0
- package/template/apps/web/src/pages/system/components/DiagnosticRecordDetails.vue +52 -0
- package/template/apps/web/src/pages/system/components/OperationEnvironmentPanel.vue +237 -0
- package/template/apps/web/src/pages/system/components/OperationFeatureAssessmentPanel.vue +131 -0
- package/template/apps/web/src/pages/system/components/PagedSelectionList.vue +31 -24
- package/template/apps/web/src/pages/system/components/SystemResourceActions.vue +2 -1
- package/template/apps/web/src/pages/system/components/SystemResourceEditor.vue +11 -2
- package/template/apps/web/src/pages/system/components/SystemResourcePage.vue +1 -0
- package/template/apps/web/src/pages/system/components/SystemResourcePage.webtest.ts +6 -2
- package/template/apps/web/src/pages/system/components/agent-skills/AgentSkillDetailDialog.vue +166 -0
- package/template/apps/web/src/pages/system/components/agent-skills/AgentSkillGovernanceActionDialog.vue +51 -0
- package/template/apps/web/src/pages/system/components/agent-skills/AgentSkillImportDialog.vue +329 -0
- package/template/apps/web/src/pages/system/components/agent-skills/AgentSkillImportDialog.webtest.ts +96 -0
- package/template/apps/web/src/pages/system/components/agent-skills/AgentSkillsTable.vue +69 -0
- package/template/apps/web/src/pages/system/components/agent-workbench/SessionReplayTimeline.vue +18 -9
- package/template/apps/web/src/pages/system/components/agent-workbench/TestRunComposer.vue +66 -34
- package/template/apps/web/src/pages/system/components/agent-workbench/ToolCatalogPanel.vue +48 -33
- package/template/apps/web/src/pages/system/components/agent-workbench/ToolCatalogPanel.webtest.ts +9 -2
- package/template/apps/web/src/pages/system/components/agent-workbench/ToolRuleDetail.vue +23 -16
- package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowPresetCatalog.vue +82 -0
- package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowPresetCatalog.webtest.ts +57 -0
- package/template/apps/web/src/pages/system/components/dictionary-bulk/DictionaryBulkJobDetail.vue +10 -7
- package/template/apps/web/src/pages/system/components/user-account/RolePermissionSummary.vue +81 -57
- package/template/apps/web/src/pages/system/components/user-account/UserRoleSelector.vue +6 -4
- package/template/apps/web/src/pages/system/components/user-account/UserRoleSelector.webtest.ts +20 -4
- package/template/apps/web/src/pages/system/composables/useAgentSkillsGovernance.ts +105 -0
- package/template/apps/web/src/pages/system/composables/useAgentWorkflowPresets.ts +44 -0
- package/template/apps/web/src/pages/system/composables/useDiagnosticLookup.ts +64 -0
- package/template/apps/web/src/pages/system/resource-config.ts +9 -0
- package/template/apps/web/src/pages/work-orders/WorkOrderListPage.vue +1 -1
- package/template/apps/web/src/router/disabled-feature-loading.webtest.ts +78 -0
- package/template/apps/web/src/router/error-navigation.ts +3 -1
- package/template/apps/web/src/router/error-navigation.webtest.ts +14 -2
- package/template/apps/web/src/router/index.ts +11 -55
- package/template/apps/web/src/router/manifest-routes.ts +2 -3
- package/template/apps/web/src/router/platform-admin-pages.ts +38 -0
- package/template/apps/web/src/router/platform-admin-route-bindings.ts +12 -4
- package/template/apps/web/src/services/agent-skills-api.ts +55 -0
- package/template/apps/web/src/services/agent-workflow-api.ts +12 -0
- package/template/apps/web/src/services/diagnostics-api.ts +24 -0
- package/template/apps/web/src/services/http.ts +18 -0
- package/template/apps/web/src/services/http.webtest.ts +51 -0
- package/template/apps/web/src/services/operations-api.ts +4 -0
- package/template/apps/web/src/services/platform-settings-api.ts +35 -1
- package/template/apps/web/vite.config.ts +47 -2
- package/template/deploy/dsh/README.md +5 -0
- package/template/deploy/dsh/documents/README.md +9 -0
- package/template/deploy/dsh/documents/requirements.in +6 -0
- package/template/deploy/dsh/documents/requirements.lock +72 -0
- package/template/deploy/environment/windy.environment.example.yaml +53 -0
- package/template/docker-compose.yml +27 -11
- package/template/docs/adr/0004-embedded-dsh-runtime.md +9 -0
- package/template/docs/architecture/agent-admin-workbench-implementation.md +73 -0
- package/template/docs/architecture/agent-admin-workbench-plan.md +41 -0
- package/template/docs/architecture/agent-harness.md +2 -0
- package/template/docs/architecture/agent-runtime-compatibility.md +2 -0
- package/template/docs/architecture/agent-workflow.md +8 -0
- package/template/docs/architecture/durable-jobs.md +17 -0
- package/template/docs/architecture/embedded-dsh-integration.md +44 -0
- package/template/docs/development/dsh-plugins.md +55 -0
- package/template/docs/development/performance-engineering.md +24 -0
- package/template/docs/operations/admin-settings-yaml.md +29 -0
- package/template/docs/operations/dsh-agent-migration.md +98 -0
- package/template/docs/operations/environment-capabilities.md +185 -0
- package/template/docs/platform/agent-production-store.md +5 -78
- package/template/docs/platform/agent-runtime-observability.md +2 -0
- package/template/docs/platform/agent-runtime.md +2 -0
- package/template/docs/platform/agent-skills.md +25 -0
- package/template/docs/platform/module-configuration.md +18 -3
- package/template/docs/platform/platform-authentication.md +1 -1
- package/template/package.json +13 -10
- package/template/packages/config/package.json +2 -2
- package/template/packages/config/src/definition.ts +14 -4
- package/template/packages/config/src/environment-loader.ts +27 -3
- package/template/packages/config/src/platform-ai-runtime.test.ts +94 -0
- package/template/packages/config/src/platform.ts +5 -2
- package/template/packages/database/drizzle/0064_dsh_skills_diagnostics.sql +42 -0
- package/template/packages/database/drizzle/0065_durable_job_lease_snapshot_lookup.sql +1 -0
- package/template/packages/database/drizzle/0066_agent_source_sequence_bigint.sql +3 -0
- package/template/packages/database/drizzle/0067_media_runtime_access.sql +46 -0
- package/template/packages/database/drizzle/meta/0064_snapshot.json +15349 -0
- package/template/packages/database/drizzle/meta/0065_snapshot.json +15370 -0
- package/template/packages/database/drizzle/meta/0066_snapshot.json +15370 -0
- package/template/packages/database/drizzle/meta/0067_snapshot.json +15370 -0
- package/template/packages/database/drizzle/meta/_journal.json +28 -0
- package/template/packages/database/package.json +4 -4
- package/template/packages/database/src/schema/agent-session.ts +4 -3
- package/template/packages/database/src/schema/agent-skills.ts +65 -0
- package/template/packages/database/src/schema/diagnostics.ts +27 -0
- package/template/packages/database/src/schema/durable-jobs.ts +4 -0
- package/template/packages/database/src/schema/index.ts +10 -0
- package/template/packages/database/src/schema-durable-recovery.test.ts +21 -1
- package/template/packages/database/src/schema-source-sequence.test.ts +24 -0
- package/template/packages/example-work-order/package.json +2 -2
- package/template/packages/modules/package.json +1 -1
- package/template/packages/modules/src/admin-ui-boundary.test.ts +33 -0
- package/template/packages/modules/src/composition.ts +11 -28
- package/template/packages/modules/src/manifest.ts +2 -0
- package/template/packages/modules/src/menu-composition.ts +24 -0
- package/template/packages/modules/src/system-admin-routes.ts +26 -2
- package/template/packages/modules/src/system-admin-ui-catalog.ts +23 -11
- package/template/packages/modules/src/system-agent-admin-bindings.ts +2 -0
- package/template/packages/modules/src/system-agent-admin-menus.ts +20 -0
- package/template/packages/modules/src/system-agent-audit-actions.ts +3 -0
- package/template/packages/modules/src/system-agent-dsh.ts +119 -0
- package/template/packages/modules/src/system-ai-api-bindings.ts +0 -16
- package/template/packages/modules/src/system-api-control-plane.ts +9 -1
- package/template/packages/modules/src/system-api-permissions.ts +16 -0
- package/template/packages/modules/src/system-api-watermark.ts +21 -0
- package/template/packages/modules/src/system-audit-actions.ts +14 -1
- package/template/packages/modules/src/system-features.ts +25 -2
- package/template/packages/modules/src/system-media-api-bindings.ts +97 -0
- package/template/packages/modules/src/system-module-audit-selection.ts +27 -0
- package/template/packages/modules/src/system-module-catalog.test.ts +13 -6
- package/template/packages/modules/src/system-module-catalog.ts +12 -267
- package/template/packages/modules/src/system-module-definitions.ts +260 -0
- package/template/packages/modules/src/system-modules-access.test.ts +2 -0
- package/template/packages/modules/src/system-modules.test.ts +7 -1
- package/template/packages/modules/src/system-modules.ts +39 -16
- package/template/packages/modules/src/system-permissions.ts +22 -0
- package/template/packages/server-sdk/package.json +2 -2
- package/template/packages/shared/index.ts +15 -0
- package/template/packages/shared/package.json +1 -1
- package/template/packages/shared/src/agent-skills.ts +68 -0
- package/template/packages/shared/src/agent-workflow-presets.ts +26 -0
- package/template/packages/shared/src/diagnostics.ts +13 -0
- package/template/packages/shared/src/environment-assessment.ts +68 -0
- package/template/packages/shared/src/environment-policy.ts +205 -0
- package/template/packages/shared/src/license-console-capabilities.ts +7 -0
- package/template/packages/shared/src/license.ts +1 -0
- package/template/packages/shared/src/module-configuration.ts +2 -1
- package/template/packages/shared/src/rbac.ts +1 -0
- package/template/scripts/operations/collect-device-info.py +230 -0
- package/template/apps/agent-server/install-python-dependencies.sh +0 -92
- package/template/apps/agent-server/pyproject.toml +0 -51
- package/template/apps/agent-server/src/southwind_agent_server/__init__.py +0 -5
- package/template/apps/agent-server/src/southwind_agent_server/app.py +0 -344
- package/template/apps/agent-server/src/southwind_agent_server/approval_resolution.py +0 -30
- package/template/apps/agent-server/src/southwind_agent_server/artifact_input.py +0 -153
- package/template/apps/agent-server/src/southwind_agent_server/asgi.py +0 -8
- package/template/apps/agent-server/src/southwind_agent_server/attempt_context.py +0 -199
- package/template/apps/agent-server/src/southwind_agent_server/attempt_context_projection.py +0 -203
- package/template/apps/agent-server/src/southwind_agent_server/client_completion_contracts.py +0 -61
- package/template/apps/agent-server/src/southwind_agent_server/client_completion_governance.py +0 -82
- package/template/apps/agent-server/src/southwind_agent_server/client_completion_routes.py +0 -121
- package/template/apps/agent-server/src/southwind_agent_server/client_completion_runtime.py +0 -158
- package/template/apps/agent-server/src/southwind_agent_server/config.py +0 -267
- package/template/apps/agent-server/src/southwind_agent_server/context_message_digest.py +0 -24
- package/template/apps/agent-server/src/southwind_agent_server/context_version_contracts.py +0 -71
- package/template/apps/agent-server/src/southwind_agent_server/context_version_port.py +0 -307
- package/template/apps/agent-server/src/southwind_agent_server/contracts.py +0 -297
- package/template/apps/agent-server/src/southwind_agent_server/deterministic.py +0 -63
- package/template/apps/agent-server/src/southwind_agent_server/engine.py +0 -134
- package/template/apps/agent-server/src/southwind_agent_server/engine_capacity.py +0 -31
- package/template/apps/agent-server/src/southwind_agent_server/engine_identity.py +0 -2
- package/template/apps/agent-server/src/southwind_agent_server/fingerprint.py +0 -61
- package/template/apps/agent-server/src/southwind_agent_server/health_routes.py +0 -93
- package/template/apps/agent-server/src/southwind_agent_server/http_helpers.py +0 -62
- package/template/apps/agent-server/src/southwind_agent_server/lease.py +0 -15
- package/template/apps/agent-server/src/southwind_agent_server/multimodal.py +0 -76
- package/template/apps/agent-server/src/southwind_agent_server/openai_engine.py +0 -329
- package/template/apps/agent-server/src/southwind_agent_server/openai_engine_validation.py +0 -165
- package/template/apps/agent-server/src/southwind_agent_server/openai_provider.py +0 -345
- package/template/apps/agent-server/src/southwind_agent_server/postgres_report_insert.py +0 -37
- package/template/apps/agent-server/src/southwind_agent_server/postgres_report_queries.py +0 -235
- package/template/apps/agent-server/src/southwind_agent_server/postgres_report_replay.py +0 -44
- package/template/apps/agent-server/src/southwind_agent_server/postgres_report_status.py +0 -83
- package/template/apps/agent-server/src/southwind_agent_server/postgres_report_store.py +0 -336
- package/template/apps/agent-server/src/southwind_agent_server/postgres_report_summary.py +0 -304
- package/template/apps/agent-server/src/southwind_agent_server/postgres_store.py +0 -335
- package/template/apps/agent-server/src/southwind_agent_server/postgres_store_backend.py +0 -333
- package/template/apps/agent-server/src/southwind_agent_server/provider_audit.py +0 -144
- package/template/apps/agent-server/src/southwind_agent_server/provider_governance.py +0 -309
- package/template/apps/agent-server/src/southwind_agent_server/provider_output_guidance.py +0 -34
- package/template/apps/agent-server/src/southwind_agent_server/readiness_pin.py +0 -37
- package/template/apps/agent-server/src/southwind_agent_server/report_lifecycle.py +0 -218
- package/template/apps/agent-server/src/southwind_agent_server/report_metrics.py +0 -149
- package/template/apps/agent-server/src/southwind_agent_server/report_presenter.py +0 -300
- package/template/apps/agent-server/src/southwind_agent_server/report_routes.py +0 -132
- package/template/apps/agent-server/src/southwind_agent_server/report_store.py +0 -298
- package/template/apps/agent-server/src/southwind_agent_server/report_store_protocol.py +0 -75
- package/template/apps/agent-server/src/southwind_agent_server/report_types.py +0 -118
- package/template/apps/agent-server/src/southwind_agent_server/run_admission.py +0 -64
- package/template/apps/agent-server/src/southwind_agent_server/run_capacity.py +0 -59
- package/template/apps/agent-server/src/southwind_agent_server/runtime_budget.py +0 -74
- package/template/apps/agent-server/src/southwind_agent_server/runtime_compatibility.py +0 -89
- package/template/apps/agent-server/src/southwind_agent_server/runtime_factory.py +0 -105
- package/template/apps/agent-server/src/southwind_agent_server/runtime_logging.py +0 -57
- package/template/apps/agent-server/src/southwind_agent_server/service.py +0 -325
- package/template/apps/agent-server/src/southwind_agent_server/service_control.py +0 -64
- package/template/apps/agent-server/src/southwind_agent_server/service_errors.py +0 -4
- package/template/apps/agent-server/src/southwind_agent_server/service_execution.py +0 -34
- package/template/apps/agent-server/src/southwind_agent_server/service_tasks.py +0 -34
- package/template/apps/agent-server/src/southwind_agent_server/signal_events.py +0 -53
- package/template/apps/agent-server/src/southwind_agent_server/sqlite_catalog.py +0 -118
- package/template/apps/agent-server/src/southwind_agent_server/sqlite_errors.py +0 -2
- package/template/apps/agent-server/src/southwind_agent_server/sqlite_schema.py +0 -73
- package/template/apps/agent-server/src/southwind_agent_server/sqlite_serialization.py +0 -16
- package/template/apps/agent-server/src/southwind_agent_server/sqlite_store.py +0 -350
- package/template/apps/agent-server/src/southwind_agent_server/sse.py +0 -41
- package/template/apps/agent-server/src/southwind_agent_server/store.py +0 -255
- package/template/apps/agent-server/src/southwind_agent_server/store_cipher.py +0 -40
- package/template/apps/agent-server/src/southwind_agent_server/structured_logging.py +0 -145
- package/template/apps/agent-server/src/southwind_agent_server/telemetry.py +0 -93
- package/template/apps/agent-server/src/southwind_agent_server/tool_host.py +0 -152
- package/template/apps/agent-server/src/southwind_agent_server/trajectory.py +0 -137
- package/template/apps/agent-server/src/southwind_agent_server/unavailable_engine.py +0 -58
- package/template/apps/agent-server/src/southwind_agent_server/vision_probe.py +0 -87
- package/template/apps/agent-server/src/southwind_agent_server/vision_requirement.py +0 -28
- package/template/apps/agent-server/src/southwind_agent_server/vlm_readiness.py +0 -247
- package/template/apps/agent-server/tests/__init__.py +0 -1
- package/template/apps/agent-server/tests/openai_provider_test_support.py +0 -131
- package/template/apps/agent-server/tests/test_api.py +0 -305
- package/template/apps/agent-server/tests/test_artifact_input.py +0 -110
- package/template/apps/agent-server/tests/test_client_completion.py +0 -230
- package/template/apps/agent-server/tests/test_config.py +0 -106
- package/template/apps/agent-server/tests/test_fingerprint.py +0 -10
- package/template/apps/agent-server/tests/test_multimodal.py +0 -81
- package/template/apps/agent-server/tests/test_openai_provider.py +0 -320
- package/template/apps/agent-server/tests/test_postgres_report_status.py +0 -59
- package/template/apps/agent-server/tests/test_postgres_report_summary.py +0 -298
- package/template/apps/agent-server/tests/test_postgres_store.py +0 -135
- package/template/apps/agent-server/tests/test_provider_attempt_reporting.py +0 -140
- package/template/apps/agent-server/tests/test_provider_governance.py +0 -276
- package/template/apps/agent-server/tests/test_report_attempt_lifecycle.py +0 -126
- package/template/apps/agent-server/tests/test_report_resilience.py +0 -183
- package/template/apps/agent-server/tests/test_report_routes.py +0 -143
- package/template/apps/agent-server/tests/test_report_store.py +0 -347
- package/template/apps/agent-server/tests/test_report_summary_parity.py +0 -116
- package/template/apps/agent-server/tests/test_report_terminal_sync.py +0 -177
- package/template/apps/agent-server/tests/test_run_capacity.py +0 -112
- package/template/apps/agent-server/tests/test_run_operational_logging.py +0 -114
- package/template/apps/agent-server/tests/test_runtime_compatibility.py +0 -119
- package/template/apps/agent-server/tests/test_runtime_factory_readiness.py +0 -52
- package/template/apps/agent-server/tests/test_sqlite_store.py +0 -182
- package/template/apps/agent-server/tests/test_structured_logging.py +0 -142
- package/template/apps/agent-server/tests/test_telemetry.py +0 -25
- package/template/apps/agent-server/tests/test_tool_approval.py +0 -28
- package/template/apps/agent-server/tests/test_tool_structured_output.py +0 -347
- package/template/apps/agent-server/tests/test_trajectory.py +0 -91
- package/template/apps/agent-server/tests/test_vision_readiness_enforcement.py +0 -72
- package/template/apps/agent-server/tests/test_vlm_readiness.py +0 -106
- package/template/apps/agent-server/uv.lock +0 -831
- package/template/apps/server/src/agent/module-ai-port-factory.ts +0 -41
- /package/template/apps/server/src/{agent → ai-runtime-security}/execution-grants.ts +0 -0
- /package/template/apps/server/src/{agent → ai-runtime-security}/idempotency-key.test.ts +0 -0
- /package/template/apps/server/src/{agent → ai-runtime-security}/idempotency-key.ts +0 -0
- /package/template/apps/server/src/{agent → ai-runtime-security}/provider-input-governance.test.ts +0 -0
- /package/template/apps/server/src/{agent → ai-runtime-security}/provider-input-governance.ts +0 -0
- /package/template/apps/server/src/{agent → media-runtime}/required-environment.ts +0 -0
- /package/template/apps/server/src/{agent → media-runtime}/runtime-readiness-sources.test.ts +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Windy业务工具目录与按需加载
|
|
2
|
+
|
|
3
|
+
工具事实来源是官方 MCP bridge 通过现有身份获得并注册的 `mcp__windy__*` 工具。
|
|
4
|
+
不另建业务工具 allowlist,不复制输入输出 Schema,也不扩大业务 MCP 暴露面。
|
|
5
|
+
|
|
6
|
+
DSH 的 MCP bridge 默认注册全部完整 Schema。当前 `openai-completions` 适配器
|
|
7
|
+
没有可直接使用的通用延迟搜索协议;单独添加 `deferLoading` 会让工具被过滤且无法发现。
|
|
8
|
+
本插件在同 Agent 的 `createScope` 注册官方 `NativeToolExecutor`,仅在公开 `describe`
|
|
9
|
+
边界裁剪本轮模型工具声明,执行仍委托官方 executor;配合 `tools.guard` 拒绝未加载的调用。
|
|
10
|
+
发现入口也注册到该 Scope,原 MCP 定义、step admission 与授权限制保持不变。
|
|
11
|
+
新版 `system-prompt/assemble` 只处理提示文本,不再承担工具声明裁剪;Windy native profile
|
|
12
|
+
禁用 PTC,本插件不为其它 executor 提供兼容回退。
|
|
13
|
+
每个 Agent 初始业务工具仅看到
|
|
14
|
+
`discover_business_tools`,其目录预览最多 12 项、1600 字符。模型先搜索/翻页查询每页
|
|
15
|
+
20 项的简洁目录,再从实际工具名称选择最多 8 项,在该 Agent 后续模型请求中声明所选工具的原始完整 Schema。
|
|
16
|
+
选择会替换该 Agent 已加载的业务工具,父子 Agent 分别选择,不向其它会话注册。
|
|
17
|
+
原生文件、脚本、子 Agent 等非业务工具保持原有装配。
|
|
18
|
+
|
|
19
|
+
目录刷新、MCP 重连和工具注册变化会重新校验各 Agent 的选择;被移除或被既有
|
|
20
|
+
Agent 限制排除的工具立即撤销。插件不复制业务定义、不覆盖 scoped restriction,
|
|
21
|
+
业务调用始终通过原 ToolRuntime 与官方 MCP 定义执行,服务端逐次校验 Feature、License、RBAC、Scope 和输入输出契约。发现工具
|
|
22
|
+
不接受 Actor、权限、范围或任意工具名。
|
|
23
|
+
|
|
24
|
+
设置「工具」使用认证本机 `/windy/tool-catalog` 接口读取实时 registry,支持搜索、
|
|
25
|
+
分页及刷新,合并实时业务目录与活跃 Agent 的工作区工具,显示中文名称、简短说明及
|
|
26
|
+
使用方式。页面不暴露参数 Schema、业务结果、
|
|
27
|
+
连接凭据或其它用户目录。当前连接发现目录不代表权限永久有效,实际执行继续重授权。
|
|
28
|
+
|
|
29
|
+
工具发现与目录浏览本身不计作业务处理成功,不补写系统效能贡献;底层业务调用仍使用
|
|
30
|
+
原有 Tool 审计和版本化计量规则。
|
|
31
|
+
|
|
32
|
+
## 中文展示契约
|
|
33
|
+
|
|
34
|
+
设置目录保留内部 `name` 供模型选择与 keyed dispatch,另外返回 `displayName`、`summary`、
|
|
35
|
+
`sourceLabel`、`strategyLabel`。界面主标题与描述只消费中文展示字段,不展示执行 ID、
|
|
36
|
+
原始 description 或底座名称。业务中文名读取同一 Actor 边界的标准 MCP `tools/list`
|
|
37
|
+
中由 Manifest 提供的 `title`(兼容 `annotations.title`),不从内部工具名猜业务类型。
|
|
38
|
+
映射适配覆盖官方 server-qualified 命名的普通、含点号和超长哈希编码,并有真实官方
|
|
39
|
+
MCP bridge 测试。标题缺失或元数据暂不可用时显示中文通用标题。
|
|
40
|
+
|
|
41
|
+
元数据读取在后台进行,不阻塞 Agent 插件启动;请求使用当前 Worker Token,经已有
|
|
42
|
+
MCP 边界重授权,单次最长 5 秒,同一时刻合并请求。成功缓存 15 秒,失败不缓存,设置
|
|
43
|
+
刷新可重试。只保存中文标题与说明,不保存业务内容、Schema 或连接凭据。
|
|
44
|
+
|
|
45
|
+
本机工具使用受限中文映射,包括文件、脚本、协作、后台任务、目标、会话、定时任务及
|
|
46
|
+
终端;未识别扩展显示「工作区工具」。摘要优先现有中文首句,最多 44 字,含底座或契约
|
|
47
|
+
实现称谓时使用中文通用说明,不调用模型翻译。
|
|
48
|
+
|
|
49
|
+
## 业务分类与计数
|
|
50
|
+
|
|
51
|
+
MCP `tools/list` 的 `_meta["windy/moduleKey"]`、`_meta["windy/moduleLabel"]` 直接来自工具
|
|
52
|
+
注册源所属 Manifest 的 `name` 和 `label`,只携带展示归属。元数据适配仅保存这两个字段与
|
|
53
|
+
现有中文标题/说明,不透传其它 `_meta`、权限凭据、Schema 或业务结果。
|
|
54
|
+
业务分类使用真实所属模块,例如 `system.identity/身份管理`;
|
|
55
|
+
不根据执行名、哈希、中文标题或用户材料推测归属。当前属于情报档案模块的人员工具仍归该模块,
|
|
56
|
+
未来拆分真实模块后分类会随 Manifest 自动变化。元数据缺失时使用 `business/业务工具`。
|
|
57
|
+
原生工具使用明确静态映射:`workspace.files/文件`、`workspace.commands/命令`、
|
|
58
|
+
`workspace.collaboration/协作`、`workspace.tasks/任务`、`workspace.sessions/会话`、
|
|
59
|
+
`workspace.discovery/工具与技能`;未知扩展归 `workspace.other/其他工作区工具`。
|
|
60
|
+
|
|
61
|
+
目录项目新增 `categoryKey`、`categoryLabel`;响应增加 `category`、`matchedTotal` 和
|
|
62
|
+
`groups: [{ categoryKey, categoryLabel, count }]`。`groups.count` 与 `matchedTotal` 基于当前
|
|
63
|
+
实际工具 registry 和本次 `query` 的整个命中集合,位于分类筛选和分页之前;`total` 为再按
|
|
64
|
+
`category` 筛选后的总数,`items` 是这个结果集的当前页。分组计数不受当前页大小影响。
|
|
65
|
+
搜索同时匹配分类中文名,因此模块中文名称能找到该模块的工具。
|
|
66
|
+
|
|
67
|
+
`GET /windy/tool-catalog` 与 `discover_business_tools` 均接受可选 `category`;空值代表全部,
|
|
68
|
+
非空值必须逐字来自当前真实可见目录的分类 Key,不能凭名称猜分类。未知或已移除的分类由
|
|
69
|
+
HTTP 返回 400、发现工具返回明确错误;分类筛选不能增加工具权限、改变已加载 Schema,
|
|
70
|
+
也不能绕过原 MCP 的 Feature、License、RBAC、Scope 和逐次执行校验。
|
|
71
|
+
|
|
72
|
+
设置布局与插件页对齐为紧凑网格:页面标题 20px/500/28px,卡片标题 14px/500/20px,
|
|
73
|
+
简介和说明 13px/400/20px;展示中文名称、简短说明和使用方式,来源与执行 ID 不占据
|
|
74
|
+
主内容。对话展示由 `../tool-presentation/` 复用官方公开插槽,详情见该插件说明。
|
|
75
|
+
|
|
76
|
+
## 从目录使用工具
|
|
77
|
+
|
|
78
|
+
卡片是可由键盘激活的完整点击区域。点击后通过官方 Session 公开引用和输入事件把中文工具意图带入当前对话,保留已有文字、附件和引用,不自动发送、不直接运行工具。输入处于提交/命令状态、对话切换或草稿版本变化时拒绝写入,错误显示在该卡片附近。没有当前会话时,复用官方工作区新会话入口准备草稿,不伪造业务范围。相同意图已在草稿尾部时不会重复追加。
|
|
79
|
+
|
|
80
|
+
分类导航使用服务端返回的正式业务模块及明确的工作区工具分类,不解析哈希执行名。搜索时重置到全部,分类变更重置页码;已撤销分类返回 400 时回到全部。分组计数覆盖搜索命中的全量可见目录,列表分页只影响当前卡片集合。
|
|
81
|
+
|
|
82
|
+
设置面板在当前组件实例内按搜索词、分类和页码缓存最近 24 组成功结果;切回已读取的分类或页码直接显示缓存,超出上限淘汰最久未使用项。点击「刷新」会清空整个面板缓存并重新查询当前筛选。失败与已取消请求不缓存,旧请求不会覆盖新选择;关闭面板后缓存随组件释放,不写入浏览器存储,也不在插件实例或用户之间共享。缓存仅减少目录查询,实际工具执行仍逐次重授权。
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const nativeGroups = [
|
|
2
|
+
[
|
|
3
|
+
"files",
|
|
4
|
+
"文件",
|
|
5
|
+
[
|
|
6
|
+
"delete",
|
|
7
|
+
"read",
|
|
8
|
+
"write",
|
|
9
|
+
"edit",
|
|
10
|
+
"glob",
|
|
11
|
+
"grep",
|
|
12
|
+
"read_image",
|
|
13
|
+
"present",
|
|
14
|
+
"working_directory",
|
|
15
|
+
"load_workspace_dependencies",
|
|
16
|
+
],
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"commands",
|
|
20
|
+
"命令",
|
|
21
|
+
[
|
|
22
|
+
"exec",
|
|
23
|
+
"exec_command",
|
|
24
|
+
"write_stdin",
|
|
25
|
+
"bash",
|
|
26
|
+
"run_code",
|
|
27
|
+
"terminal_open",
|
|
28
|
+
"terminal_send",
|
|
29
|
+
"terminal_read",
|
|
30
|
+
"terminal_signal",
|
|
31
|
+
"terminal_close",
|
|
32
|
+
"terminal_list",
|
|
33
|
+
],
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
"collaboration",
|
|
37
|
+
"协作",
|
|
38
|
+
[
|
|
39
|
+
"list_agents",
|
|
40
|
+
"spawn_teammate",
|
|
41
|
+
"interrupt_agent",
|
|
42
|
+
"wait_subagents",
|
|
43
|
+
"list_subagent_models",
|
|
44
|
+
"subagent",
|
|
45
|
+
"send_message",
|
|
46
|
+
"wait",
|
|
47
|
+
"wait_agent",
|
|
48
|
+
"ask_user_question",
|
|
49
|
+
],
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
"tasks",
|
|
53
|
+
"任务",
|
|
54
|
+
[
|
|
55
|
+
"job_output",
|
|
56
|
+
"job_list",
|
|
57
|
+
"job_kill",
|
|
58
|
+
"get_goal",
|
|
59
|
+
"create_goal",
|
|
60
|
+
"update_goal",
|
|
61
|
+
"todo_write",
|
|
62
|
+
"schedule_create",
|
|
63
|
+
"schedule_list",
|
|
64
|
+
"schedule_update",
|
|
65
|
+
"schedule_delete",
|
|
66
|
+
],
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
"sessions",
|
|
70
|
+
"会话",
|
|
71
|
+
[
|
|
72
|
+
"session_search",
|
|
73
|
+
"session_event_search",
|
|
74
|
+
"session_trace",
|
|
75
|
+
"session_event_trace",
|
|
76
|
+
"session_event_read",
|
|
77
|
+
],
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
"discovery",
|
|
81
|
+
"工具与技能",
|
|
82
|
+
[
|
|
83
|
+
"discover_business_tools",
|
|
84
|
+
"skill",
|
|
85
|
+
"explain_feature",
|
|
86
|
+
"save_workflow_skill",
|
|
87
|
+
],
|
|
88
|
+
],
|
|
89
|
+
];
|
|
90
|
+
const nativeCategories = new Map(
|
|
91
|
+
nativeGroups.flatMap(([key, label, names]) =>
|
|
92
|
+
names.map((name) => [
|
|
93
|
+
name,
|
|
94
|
+
{ categoryKey: `workspace.${key}`, categoryLabel: label },
|
|
95
|
+
]),
|
|
96
|
+
),
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
/** Business ownership comes exclusively from actor-authorized Manifest metadata. */
|
|
100
|
+
export function categoryMetadata(tool, supplied) {
|
|
101
|
+
if (tool.name.startsWith("mcp__windy__"))
|
|
102
|
+
return supplied?.moduleKey && supplied?.moduleLabel
|
|
103
|
+
? { categoryKey: supplied.moduleKey, categoryLabel: supplied.moduleLabel }
|
|
104
|
+
: { categoryKey: "business", categoryLabel: "业务工具" };
|
|
105
|
+
return (
|
|
106
|
+
nativeCategories.get(tool.name) ?? {
|
|
107
|
+
categoryKey: "workspace.other",
|
|
108
|
+
categoryLabel: "其他工作区工具",
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
3
|
+
import { catalogue } from "./discovery.mjs";
|
|
4
|
+
import { displayMetadata } from "./presentation.mjs";
|
|
5
|
+
|
|
6
|
+
test("categories use authoritative module metadata, never an execution name or hash", () => {
|
|
7
|
+
const key = "mcp__windy__case_get_hiddenhash";
|
|
8
|
+
expect(displayMetadata({ name: key })).toMatchObject({
|
|
9
|
+
categoryKey: "business",
|
|
10
|
+
categoryLabel: "业务工具",
|
|
11
|
+
});
|
|
12
|
+
expect(
|
|
13
|
+
displayMetadata(
|
|
14
|
+
{ name: key },
|
|
15
|
+
new Map([
|
|
16
|
+
[
|
|
17
|
+
key,
|
|
18
|
+
{
|
|
19
|
+
displayName: "读取资料",
|
|
20
|
+
moduleKey: "intelligence",
|
|
21
|
+
moduleLabel: "情报档案",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
]),
|
|
25
|
+
),
|
|
26
|
+
).toMatchObject({ categoryKey: "intelligence", categoryLabel: "情报档案" });
|
|
27
|
+
for (const [name, categoryKey] of [
|
|
28
|
+
["read", "workspace.files"],
|
|
29
|
+
["exec_command", "workspace.commands"],
|
|
30
|
+
["subagent", "workspace.collaboration"],
|
|
31
|
+
["job_list", "workspace.tasks"],
|
|
32
|
+
["session_search", "workspace.sessions"],
|
|
33
|
+
["unknown_extension", "workspace.other"],
|
|
34
|
+
])
|
|
35
|
+
expect(displayMetadata({ name }).categoryKey).toBe(categoryKey);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("group counts cover the searched authorized directory before category filtering and pagination", () => {
|
|
39
|
+
const tools = Array.from({ length: 40 }, (_, index) => ({
|
|
40
|
+
name: `mcp__windy__opaque_${index}`,
|
|
41
|
+
description: "合成查询",
|
|
42
|
+
parameters: { secretSchema: "never-forward" },
|
|
43
|
+
}));
|
|
44
|
+
tools.push(
|
|
45
|
+
...["read", "exec", "unknown_extension"].map((name) => ({
|
|
46
|
+
name,
|
|
47
|
+
description: "工作区操作",
|
|
48
|
+
parameters: { secretSchema: "never-forward" },
|
|
49
|
+
})),
|
|
50
|
+
);
|
|
51
|
+
const metadata = new Map(
|
|
52
|
+
tools.slice(0, 40).map((tool, index) => [
|
|
53
|
+
tool.name,
|
|
54
|
+
{
|
|
55
|
+
displayName: "业务读取",
|
|
56
|
+
moduleKey: index < 30 ? "case" : "analysis",
|
|
57
|
+
moduleLabel: index < 30 ? "案件" : "分析",
|
|
58
|
+
},
|
|
59
|
+
]),
|
|
60
|
+
);
|
|
61
|
+
metadata.set("mcp__windy__not_in_actor_scope", {
|
|
62
|
+
displayName: "不可见",
|
|
63
|
+
moduleKey: "private",
|
|
64
|
+
moduleLabel: "不可见模块",
|
|
65
|
+
});
|
|
66
|
+
const ctx = {
|
|
67
|
+
tools: { schemas: () => tools },
|
|
68
|
+
agents: { list: () => [] },
|
|
69
|
+
} as unknown as Context;
|
|
70
|
+
const options = { includeNative: true, metadata, pageSize: 5, page: 2 };
|
|
71
|
+
const all = catalogue(ctx, options);
|
|
72
|
+
expect(all).toMatchObject({
|
|
73
|
+
total: 43,
|
|
74
|
+
matchedTotal: 43,
|
|
75
|
+
category: "",
|
|
76
|
+
page: 2,
|
|
77
|
+
});
|
|
78
|
+
expect(all.items).toHaveLength(5);
|
|
79
|
+
expect(all.groups.find((group) => group.categoryKey === "case")?.count).toBe(
|
|
80
|
+
30,
|
|
81
|
+
);
|
|
82
|
+
expect(
|
|
83
|
+
all.groups.find((group) => group.categoryKey === "analysis")?.count,
|
|
84
|
+
).toBe(10);
|
|
85
|
+
expect(all.groups.reduce((count, group) => count + group.count, 0)).toBe(43);
|
|
86
|
+
expect(all.groups.some((group) => group.categoryKey === "private")).toBe(
|
|
87
|
+
false,
|
|
88
|
+
);
|
|
89
|
+
const selected = catalogue(ctx, { ...options, category: "case" });
|
|
90
|
+
expect(selected).toMatchObject({
|
|
91
|
+
total: 30,
|
|
92
|
+
matchedTotal: 43,
|
|
93
|
+
category: "case",
|
|
94
|
+
});
|
|
95
|
+
expect(selected.items).toHaveLength(5);
|
|
96
|
+
expect(selected.items.every((tool) => tool.categoryKey === "case")).toBe(
|
|
97
|
+
true,
|
|
98
|
+
);
|
|
99
|
+
expect(selected.groups).toEqual(all.groups);
|
|
100
|
+
const search = catalogue(ctx, {
|
|
101
|
+
...options,
|
|
102
|
+
category: "case",
|
|
103
|
+
query: "案件",
|
|
104
|
+
});
|
|
105
|
+
expect(search.total).toBe(30);
|
|
106
|
+
expect(search.groups).toEqual([
|
|
107
|
+
{ categoryKey: "case", categoryLabel: "案件", count: 30 },
|
|
108
|
+
]);
|
|
109
|
+
expect(
|
|
110
|
+
catalogue(ctx, { ...options, category: "case", query: "no-match" }).total,
|
|
111
|
+
).toBe(0);
|
|
112
|
+
expect(() => catalogue(ctx, { ...options, category: "private" })).toThrow(
|
|
113
|
+
"TOOL_CATEGORY_NOT_IN_AUTHORIZED_CATALOGUE",
|
|
114
|
+
);
|
|
115
|
+
tools.splice(0, 1);
|
|
116
|
+
expect(catalogue(ctx, { ...options, category: "case" }).total).toBe(29);
|
|
117
|
+
expect(JSON.stringify(selected)).not.toContain("never-forward");
|
|
118
|
+
});
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { runInNewContext } from "node:vm";
|
|
4
|
+
|
|
5
|
+
type Element = {
|
|
6
|
+
type: string;
|
|
7
|
+
props: Record<string, unknown>;
|
|
8
|
+
children: unknown[];
|
|
9
|
+
};
|
|
10
|
+
type Effect = { deps: unknown[]; cleanup?: () => void };
|
|
11
|
+
const groups = [
|
|
12
|
+
{ categoryKey: "case", categoryLabel: "案件", count: 21 },
|
|
13
|
+
{ categoryKey: "analysis", categoryLabel: "分析", count: 1 },
|
|
14
|
+
];
|
|
15
|
+
function catalogue(label = "全部", page = 1) {
|
|
16
|
+
return {
|
|
17
|
+
total: 22,
|
|
18
|
+
matchedTotal: 22,
|
|
19
|
+
pageSize: 20,
|
|
20
|
+
groups,
|
|
21
|
+
items: [{ name: `${label}-${page}`, displayName: label }],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function fixture(fetchResult?: (url: URL) => Promise<Response>) {
|
|
25
|
+
const hooks: unknown[] = [];
|
|
26
|
+
const effects = new Map<number, Effect>();
|
|
27
|
+
const timers = new Map<number, () => Promise<void>>();
|
|
28
|
+
const pending: (() => void)[] = [];
|
|
29
|
+
const requests: URL[] = [];
|
|
30
|
+
let cursor = 0,
|
|
31
|
+
timerId = 0,
|
|
32
|
+
dirty = true;
|
|
33
|
+
let render!: () => Element;
|
|
34
|
+
let tree!: Element;
|
|
35
|
+
let plugin!: { apply(ctx: unknown): void };
|
|
36
|
+
runInNewContext(readFileSync(new URL("client.js", import.meta.url), "utf8"), {
|
|
37
|
+
URL,
|
|
38
|
+
URLSearchParams,
|
|
39
|
+
AbortController,
|
|
40
|
+
document: { baseURI: "https://example.test/agent/" },
|
|
41
|
+
fetch: async (url: URL) => {
|
|
42
|
+
requests.push(url);
|
|
43
|
+
return fetchResult
|
|
44
|
+
? fetchResult(url)
|
|
45
|
+
: Response.json(
|
|
46
|
+
catalogue(
|
|
47
|
+
url.searchParams.get("category") || "全部",
|
|
48
|
+
Number(url.searchParams.get("page")),
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
},
|
|
52
|
+
setTimeout: (run: () => Promise<void>) => {
|
|
53
|
+
timers.set(++timerId, run);
|
|
54
|
+
return timerId;
|
|
55
|
+
},
|
|
56
|
+
clearTimeout: (id: number) => timers.delete(id),
|
|
57
|
+
window: {
|
|
58
|
+
__ModuleLoader__: {
|
|
59
|
+
load(definition: {
|
|
60
|
+
factory(require: (name: string) => unknown): typeof plugin;
|
|
61
|
+
}) {
|
|
62
|
+
plugin = definition.factory((name: string) =>
|
|
63
|
+
name === "react"
|
|
64
|
+
? {
|
|
65
|
+
createElement(
|
|
66
|
+
type:
|
|
67
|
+
| string
|
|
68
|
+
| ((props: Record<string, unknown>) => Element),
|
|
69
|
+
props: Record<string, unknown>,
|
|
70
|
+
...children: unknown[]
|
|
71
|
+
) {
|
|
72
|
+
return typeof type === "function"
|
|
73
|
+
? type({ ...props, children })
|
|
74
|
+
: { type, props, children };
|
|
75
|
+
},
|
|
76
|
+
useState(initial: unknown) {
|
|
77
|
+
const index = cursor++;
|
|
78
|
+
if (!(index in hooks)) hooks[index] = initial;
|
|
79
|
+
return [
|
|
80
|
+
hooks[index],
|
|
81
|
+
(next: unknown) => {
|
|
82
|
+
hooks[index] =
|
|
83
|
+
typeof next === "function"
|
|
84
|
+
? next(hooks[index])
|
|
85
|
+
: next;
|
|
86
|
+
dirty = true;
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
},
|
|
90
|
+
useRef(initial: unknown) {
|
|
91
|
+
const index = cursor++;
|
|
92
|
+
return (hooks[index] ||= { current: initial });
|
|
93
|
+
},
|
|
94
|
+
useEffect(
|
|
95
|
+
run: () => (() => void) | undefined,
|
|
96
|
+
deps: unknown[],
|
|
97
|
+
) {
|
|
98
|
+
const index = cursor++;
|
|
99
|
+
const previous = effects.get(index);
|
|
100
|
+
if (
|
|
101
|
+
!previous ||
|
|
102
|
+
deps.some((value, i) => value !== previous.deps[i])
|
|
103
|
+
) {
|
|
104
|
+
pending.push(() => {
|
|
105
|
+
previous?.cleanup?.();
|
|
106
|
+
effects.set(index, { deps, cleanup: run() });
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
: { Button: "button", Input: "input", Tag: "span" },
|
|
112
|
+
);
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
plugin.apply({
|
|
118
|
+
slots: {
|
|
119
|
+
inject: (_name: string, run: () => void) => run(),
|
|
120
|
+
register: (_row: unknown, component: typeof render) => {
|
|
121
|
+
render = component;
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
function flush() {
|
|
126
|
+
for (let attempts = 0; dirty && attempts < 20; attempts++) {
|
|
127
|
+
dirty = false;
|
|
128
|
+
cursor = 0;
|
|
129
|
+
tree = render();
|
|
130
|
+
pending.splice(0).forEach((run) => run());
|
|
131
|
+
}
|
|
132
|
+
return tree;
|
|
133
|
+
}
|
|
134
|
+
function elements(value: unknown): Element[] {
|
|
135
|
+
if (!value || typeof value !== "object" || !("type" in value)) return [];
|
|
136
|
+
const element = value as Element;
|
|
137
|
+
return [element, ...element.children.flatMap(elements)];
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
requests,
|
|
141
|
+
flush,
|
|
142
|
+
click(label: string) {
|
|
143
|
+
const button = elements(flush()).find(
|
|
144
|
+
(element) =>
|
|
145
|
+
element.type === "button" && element.children.includes(label),
|
|
146
|
+
);
|
|
147
|
+
if (!button) throw Error(`missing button ${label}`);
|
|
148
|
+
expect(button.props.disabled).not.toBe(true);
|
|
149
|
+
(button.props.onClick as () => void)();
|
|
150
|
+
flush();
|
|
151
|
+
},
|
|
152
|
+
search(value: string) {
|
|
153
|
+
const input = elements(flush()).find(
|
|
154
|
+
(element) => element.type === "input",
|
|
155
|
+
)!;
|
|
156
|
+
(input.props.onChange as (event: { target: { value: string } }) => void)({
|
|
157
|
+
target: { value },
|
|
158
|
+
});
|
|
159
|
+
flush();
|
|
160
|
+
},
|
|
161
|
+
async load() {
|
|
162
|
+
flush();
|
|
163
|
+
const runs = [...timers.values()];
|
|
164
|
+
timers.clear();
|
|
165
|
+
await Promise.all(runs.map((run) => run()));
|
|
166
|
+
flush();
|
|
167
|
+
},
|
|
168
|
+
visible: () => JSON.stringify(flush()),
|
|
169
|
+
unmount: () => {
|
|
170
|
+
for (const effect of effects.values()) effect.cleanup?.();
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
test("switching tabs, query and pages reuses only the matching cached results; refresh invalidates all", async () => {
|
|
176
|
+
const f = fixture();
|
|
177
|
+
await f.load();
|
|
178
|
+
f.click("案件 21");
|
|
179
|
+
await f.load();
|
|
180
|
+
f.click("分析 1");
|
|
181
|
+
await f.load();
|
|
182
|
+
f.click("案件 21");
|
|
183
|
+
await f.load();
|
|
184
|
+
expect(f.requests).toHaveLength(3);
|
|
185
|
+
expect(f.visible()).toContain('"aria-label":"使用case"');
|
|
186
|
+
f.click("下一页");
|
|
187
|
+
await f.load();
|
|
188
|
+
f.click("上一页");
|
|
189
|
+
await f.load();
|
|
190
|
+
expect(f.requests).toHaveLength(4);
|
|
191
|
+
f.search("查询");
|
|
192
|
+
await f.load();
|
|
193
|
+
f.search("");
|
|
194
|
+
await f.load();
|
|
195
|
+
expect(f.requests).toHaveLength(5);
|
|
196
|
+
f.click("刷新");
|
|
197
|
+
await f.load();
|
|
198
|
+
expect(f.requests).toHaveLength(6);
|
|
199
|
+
f.click("案件 21");
|
|
200
|
+
await f.load();
|
|
201
|
+
expect(f.requests).toHaveLength(7);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
test("failed queries retry, and cache is not shared with another mounted panel", async () => {
|
|
205
|
+
let failures = 1;
|
|
206
|
+
const f = fixture(async (url) => {
|
|
207
|
+
if (url.searchParams.get("category") === "case" && failures--)
|
|
208
|
+
return new Response(null, { status: 503 });
|
|
209
|
+
return Response.json(catalogue());
|
|
210
|
+
});
|
|
211
|
+
await f.load();
|
|
212
|
+
f.click("案件 21");
|
|
213
|
+
await f.load();
|
|
214
|
+
expect(f.visible()).toContain("工具目录暂不可用");
|
|
215
|
+
f.click("全部 0");
|
|
216
|
+
await f.load();
|
|
217
|
+
f.click("案件 21");
|
|
218
|
+
await f.load();
|
|
219
|
+
expect(f.requests).toHaveLength(3);
|
|
220
|
+
expect(f.visible()).not.toContain("工具目录暂不可用");
|
|
221
|
+
f.unmount();
|
|
222
|
+
const next = fixture();
|
|
223
|
+
await next.load();
|
|
224
|
+
expect(next.requests).toHaveLength(1);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
test("cancelled requests cannot overwrite the next tab or enter its cache", async () => {
|
|
228
|
+
let complete!: (response: Response) => void;
|
|
229
|
+
const f = fixture(async (url) =>
|
|
230
|
+
url.searchParams.get("category") === "case"
|
|
231
|
+
? new Promise<Response>((resolve) => {
|
|
232
|
+
complete = resolve;
|
|
233
|
+
})
|
|
234
|
+
: Response.json(catalogue()),
|
|
235
|
+
);
|
|
236
|
+
await f.load();
|
|
237
|
+
f.click("案件 21");
|
|
238
|
+
const old = f.load();
|
|
239
|
+
f.click("分析 1");
|
|
240
|
+
await f.load();
|
|
241
|
+
complete(Response.json(catalogue("旧案件响应")));
|
|
242
|
+
await old;
|
|
243
|
+
expect(f.visible()).not.toContain("旧案件响应");
|
|
244
|
+
f.click("案件 21");
|
|
245
|
+
const retry = f.load();
|
|
246
|
+
expect(f.requests).toHaveLength(4);
|
|
247
|
+
complete(Response.json(catalogue()));
|
|
248
|
+
await retry;
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
test("cache evicts the least recently used result after 24 distinct filters", async () => {
|
|
252
|
+
const f = fixture();
|
|
253
|
+
await f.load();
|
|
254
|
+
for (let i = 0; i < 24; i++) {
|
|
255
|
+
f.search(`工具${i}`);
|
|
256
|
+
await f.load();
|
|
257
|
+
}
|
|
258
|
+
f.search("工具0");
|
|
259
|
+
await f.load();
|
|
260
|
+
expect(f.requests).toHaveLength(25);
|
|
261
|
+
f.search("");
|
|
262
|
+
await f.load();
|
|
263
|
+
expect(f.requests).toHaveLength(26);
|
|
264
|
+
});
|