@superblocksteam/vite-plugin-file-sync 2.0.170 → 2.0.171-next.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/ai-service/agent/prompts/api-prompts.d.ts.map +1 -1
- package/dist/ai-service/agent/prompts/api-prompts.js +4 -6
- package/dist/ai-service/agent/prompts/api-prompts.js.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts +3 -12
- package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js +144 -71
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
- package/dist/ai-service/agent/subagents/testing/types.d.ts +2 -1
- package/dist/ai-service/agent/subagents/testing/types.d.ts.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.d.ts.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.js +47 -36
- package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
- package/dist/ai-service/agent/tool-result-metrics.d.ts +15 -0
- package/dist/ai-service/agent/tool-result-metrics.d.ts.map +1 -1
- package/dist/ai-service/agent/tool-result-metrics.js +28 -0
- package/dist/ai-service/agent/tool-result-metrics.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/analysis.d.ts +24 -2
- package/dist/ai-service/agent/tools/apis/analysis.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/analysis.js +164 -11
- package/dist/ai-service/agent/tools/apis/analysis.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/api-comparator.d.ts +2 -1
- package/dist/ai-service/agent/tools/apis/api-comparator.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/contained-source-reader.d.ts +11 -0
- package/dist/ai-service/agent/tools/apis/contained-source-reader.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/apis/contained-source-reader.js +48 -0
- package/dist/ai-service/agent/tools/apis/contained-source-reader.js.map +1 -0
- package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.d.ts +37 -10
- package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.js +140 -70
- package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/spreadsheet-csv.d.ts +6 -20
- package/dist/ai-service/agent/tools/apis/spreadsheet-csv.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/spreadsheet-csv.js +3 -3
- package/dist/ai-service/agent/tools/apis/spreadsheet-csv.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/test-api-metrics.d.ts +8 -0
- package/dist/ai-service/agent/tools/apis/test-api-metrics.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/apis/test-api-metrics.js +41 -0
- package/dist/ai-service/agent/tools/apis/test-api-metrics.js.map +1 -0
- package/dist/ai-service/agent/tools/apis/test-api-timing.d.ts +27 -0
- package/dist/ai-service/agent/tools/apis/test-api-timing.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/apis/test-api-timing.js +25 -0
- package/dist/ai-service/agent/tools/apis/test-api-timing.js.map +1 -0
- package/dist/ai-service/agent/tools/apis/test-api.d.ts +4 -0
- package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.js +119 -20
- package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -1
- package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts +0 -18
- package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-capture-screenshot.js +2 -2
- package/dist/ai-service/agent/tools/build-capture-screenshot.js.map +1 -1
- package/dist/ai-service/agent/tools/build-install-packages.d.ts +32 -5
- package/dist/ai-service/agent/tools/build-install-packages.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-install-packages.js +20 -19
- package/dist/ai-service/agent/tools/build-install-packages.js.map +1 -1
- package/dist/ai-service/agent/tools/build-manage-checklist.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-manage-packages.d.ts +19 -0
- package/dist/ai-service/agent/tools/build-manage-packages.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/build-manage-packages.js +220 -0
- package/dist/ai-service/agent/tools/build-manage-packages.js.map +1 -0
- package/dist/ai-service/agent/tools/build-read-file.d.ts +5 -14
- package/dist/ai-service/agent/tools/build-read-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-read-file.js +5 -8
- package/dist/ai-service/agent/tools/build-read-file.js.map +1 -1
- package/dist/ai-service/agent/tools/databases/dev-database-tasks.d.ts +2 -90
- package/dist/ai-service/agent/tools/databases/dev-database-tasks.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/databases/dev-database-tasks.js +1 -2
- package/dist/ai-service/agent/tools/databases/dev-database-tasks.js.map +1 -1
- package/dist/ai-service/agent/tools/debug-cache.d.ts +0 -12
- package/dist/ai-service/agent/tools/debug-cache.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/debug-cache.js +1 -1
- package/dist/ai-service/agent/tools/debug-cache.js.map +1 -1
- package/dist/ai-service/agent/tools/index.d.ts +3 -3
- package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/index.js +2 -2
- package/dist/ai-service/agent/tools/index.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/errors.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/errors.js +3 -0
- package/dist/ai-service/agent/tools/integrations/errors.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.d.ts +27 -0
- package/dist/ai-service/agent/tools/integrations/execute-request.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.js +85 -11
- package/dist/ai-service/agent/tools/integrations/execute-request.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/managed-app-database.d.ts +0 -2
- package/dist/ai-service/agent/tools/integrations/managed-app-database.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/managed-app-database.js +1 -1
- package/dist/ai-service/agent/tools/integrations/managed-app-database.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/metadata.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/metadata.js +1 -0
- package/dist/ai-service/agent/tools/integrations/metadata.js.map +1 -1
- package/dist/ai-service/agent/tools/read-state-trackers.d.ts +16 -2
- package/dist/ai-service/agent/tools/read-state-trackers.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/read-state-trackers.js +11 -2
- package/dist/ai-service/agent/tools/read-state-trackers.js.map +1 -1
- package/dist/ai-service/agent/tools.d.ts.map +1 -1
- package/dist/ai-service/agent/tools.js +13 -6
- package/dist/ai-service/agent/tools.js.map +1 -1
- package/dist/ai-service/agent/tools2/registry.d.ts +20 -1
- package/dist/ai-service/agent/tools2/registry.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/registry.js +55 -9
- package/dist/ai-service/agent/tools2/registry.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata-ripgrep.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata-ripgrep.js +25 -0
- package/dist/ai-service/agent/tools2/tools/grep-metadata-ripgrep.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts +8 -2
- package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata.js +17 -0
- package/dist/ai-service/agent/tools2/tools/grep-metadata.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep.js +50 -25
- package/dist/ai-service/agent/tools2/tools/grep.js.map +1 -1
- package/dist/ai-service/agent/utils.d.ts.map +1 -1
- package/dist/ai-service/agent/utils.js +3 -3
- package/dist/ai-service/agent/utils.js.map +1 -1
- package/dist/ai-service/app-interface/file-system-interface.d.ts +0 -6
- package/dist/ai-service/app-interface/file-system-interface.d.ts.map +1 -1
- package/dist/ai-service/app-interface/file-system-interface.js +39 -97
- package/dist/ai-service/app-interface/file-system-interface.js.map +1 -1
- package/dist/ai-service/app-interface/filesystem/handlers/skill-handler.d.ts.map +1 -1
- package/dist/ai-service/app-interface/filesystem/handlers/skill-handler.js +2 -2
- package/dist/ai-service/app-interface/filesystem/handlers/skill-handler.js.map +1 -1
- package/dist/ai-service/app-interface/filesystem/validation.js +1 -1
- package/dist/ai-service/app-interface/filesystem/validation.js.map +1 -1
- package/dist/ai-service/app-interface/npm-package-lookup.d.ts +1 -3
- package/dist/ai-service/app-interface/npm-package-lookup.d.ts.map +1 -1
- package/dist/ai-service/app-interface/npm-package-lookup.js +1 -1
- package/dist/ai-service/app-interface/npm-package-lookup.js.map +1 -1
- package/dist/ai-service/app-interface/pnpm-lockfile.d.ts.map +1 -1
- package/dist/ai-service/app-interface/pnpm-lockfile.js +2 -4
- package/dist/ai-service/app-interface/pnpm-lockfile.js.map +1 -1
- package/dist/ai-service/app-interface/shell.d.ts +38 -15
- package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
- package/dist/ai-service/app-interface/shell.js +646 -48
- package/dist/ai-service/app-interface/shell.js.map +1 -1
- package/dist/ai-service/app-interface/vulnerability-gate.d.ts +7 -0
- package/dist/ai-service/app-interface/vulnerability-gate.d.ts.map +1 -1
- package/dist/ai-service/app-interface/vulnerability-gate.js +16 -6
- package/dist/ai-service/app-interface/vulnerability-gate.js.map +1 -1
- package/dist/ai-service/app-layout.d.ts +3 -0
- package/dist/ai-service/app-layout.d.ts.map +1 -1
- package/dist/ai-service/app-layout.js +14 -0
- package/dist/ai-service/app-layout.js.map +1 -1
- package/dist/ai-service/app-skills/parser.d.ts +2 -1
- package/dist/ai-service/app-skills/parser.d.ts.map +1 -1
- package/dist/ai-service/attachments/store.d.ts +4 -4
- package/dist/ai-service/attachments/store.d.ts.map +1 -1
- package/dist/ai-service/chat/chat-session-store-metrics.d.ts +1 -2
- package/dist/ai-service/chat/chat-session-store-metrics.d.ts.map +1 -1
- package/dist/ai-service/chat/chat-session-store-metrics.js +0 -6
- package/dist/ai-service/chat/chat-session-store-metrics.js.map +1 -1
- package/dist/ai-service/chat/chat-session-store.d.ts +2 -11
- package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
- package/dist/ai-service/chat/chat-session-store.js +21 -4
- package/dist/ai-service/chat/chat-session-store.js.map +1 -1
- package/dist/ai-service/chat/utils.d.ts +1 -2
- package/dist/ai-service/chat/utils.d.ts.map +1 -1
- package/dist/ai-service/chat/utils.js +0 -1
- package/dist/ai-service/chat/utils.js.map +1 -1
- package/dist/ai-service/checklist/persisted-checklist-store.d.ts +3 -3
- package/dist/ai-service/checklist/persisted-checklist-store.d.ts.map +1 -1
- package/dist/ai-service/checklist/persisted-checklist-store.js +4 -2
- package/dist/ai-service/checklist/persisted-checklist-store.js.map +1 -1
- package/dist/ai-service/context/app-context.d.ts +7 -39
- package/dist/ai-service/context/app-context.d.ts.map +1 -1
- package/dist/ai-service/context/app-context.js +29 -110
- package/dist/ai-service/context/app-context.js.map +1 -1
- package/dist/ai-service/context-clear-metrics.d.ts +11 -0
- package/dist/ai-service/context-clear-metrics.d.ts.map +1 -0
- package/dist/ai-service/context-clear-metrics.js +64 -0
- package/dist/ai-service/context-clear-metrics.js.map +1 -0
- package/dist/ai-service/context-download.js +2 -2
- package/dist/ai-service/context-download.js.map +1 -1
- package/dist/ai-service/edit-after-clark.d.ts +0 -5
- package/dist/ai-service/edit-after-clark.d.ts.map +1 -1
- package/dist/ai-service/edit-after-clark.js +1 -1
- package/dist/ai-service/edit-after-clark.js.map +1 -1
- package/dist/ai-service/features.d.ts +20 -4
- package/dist/ai-service/features.d.ts.map +1 -1
- package/dist/ai-service/features.js +20 -4
- package/dist/ai-service/features.js.map +1 -1
- package/dist/ai-service/filter-disabled-tools-for-migration.js +1 -1
- package/dist/ai-service/filter-disabled-tools-for-migration.js.map +1 -1
- package/dist/ai-service/index.d.ts +58 -0
- package/dist/ai-service/index.d.ts.map +1 -1
- package/dist/ai-service/index.js +186 -21
- package/dist/ai-service/index.js.map +1 -1
- package/dist/ai-service/integrations/store.d.ts +6 -0
- package/dist/ai-service/integrations/store.d.ts.map +1 -1
- package/dist/ai-service/integrations/store.js +101 -3
- package/dist/ai-service/integrations/store.js.map +1 -1
- package/dist/ai-service/live-edit-events/forwarder.d.ts +1 -12
- package/dist/ai-service/live-edit-events/forwarder.d.ts.map +1 -1
- package/dist/ai-service/live-edit-events/forwarder.js +1 -7
- package/dist/ai-service/live-edit-events/forwarder.js.map +1 -1
- package/dist/ai-service/llm/context-v2/compaction/client-side.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/compaction/client-side.js +15 -5
- package/dist/ai-service/llm/context-v2/compaction/client-side.js.map +1 -1
- package/dist/ai-service/llm/context-v2/compaction/compaction-strategy.d.ts +6 -0
- package/dist/ai-service/llm/context-v2/compaction/compaction-strategy.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/compaction/server-side.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/compaction/server-side.js +5 -1
- package/dist/ai-service/llm/context-v2/compaction/server-side.js.map +1 -1
- package/dist/ai-service/llm/context-v2/compactor.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/compactor.js +34 -12
- package/dist/ai-service/llm/context-v2/compactor.js.map +1 -1
- package/dist/ai-service/llm/context-v2/context-management.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/context-management.js +9 -0
- package/dist/ai-service/llm/context-v2/context-management.js.map +1 -1
- package/dist/ai-service/llm/context-v2/context-metrics.d.ts +4 -0
- package/dist/ai-service/llm/context-v2/context-metrics.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/context-metrics.js +15 -3
- package/dist/ai-service/llm/context-v2/context-metrics.js.map +1 -1
- package/dist/ai-service/llm/context-v2/context.d.ts +36 -6
- package/dist/ai-service/llm/context-v2/context.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/context.js +72 -28
- package/dist/ai-service/llm/context-v2/context.js.map +1 -1
- package/dist/ai-service/llm/context-v2/manager.d.ts +3 -3
- package/dist/ai-service/llm/context-v2/manager.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/manager.js +13 -7
- package/dist/ai-service/llm/context-v2/manager.js.map +1 -1
- package/dist/ai-service/llm/context-v2/migrations/types.d.ts +2 -1
- package/dist/ai-service/llm/context-v2/migrations/types.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/storage/event-types.d.ts +5 -5
- package/dist/ai-service/llm/context-v2/storage/event-types.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/storage/event-types.js +3 -23
- package/dist/ai-service/llm/context-v2/storage/event-types.js.map +1 -1
- package/dist/ai-service/llm/context-v2/types.d.ts +9 -1
- package/dist/ai-service/llm/context-v2/types.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/types.js.map +1 -1
- package/dist/ai-service/llm/context-v2/uniquify-filenames.d.ts +20 -4
- package/dist/ai-service/llm/context-v2/uniquify-filenames.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/uniquify-filenames.js +128 -29
- package/dist/ai-service/llm/context-v2/uniquify-filenames.js.map +1 -1
- package/dist/ai-service/llm/error.d.ts +1 -1
- package/dist/ai-service/llm/error.d.ts.map +1 -1
- package/dist/ai-service/llm/error.js +57 -7
- package/dist/ai-service/llm/error.js.map +1 -1
- package/dist/ai-service/llm/stream/config.d.ts +3 -3
- package/dist/ai-service/llm/stream/config.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/errors.d.ts +3 -0
- package/dist/ai-service/llm/stream/errors.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/errors.js +72 -4
- package/dist/ai-service/llm/stream/errors.js.map +1 -1
- package/dist/ai-service/llm/stream/observers/workflow-usage.d.ts +0 -6
- package/dist/ai-service/llm/stream/observers/workflow-usage.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/observers/workflow-usage.js +2 -2
- package/dist/ai-service/llm/stream/observers/workflow-usage.js.map +1 -1
- package/dist/ai-service/llm/stream/orchestrator.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/orchestrator.js +6 -1
- package/dist/ai-service/llm/stream/orchestrator.js.map +1 -1
- package/dist/ai-service/managed-native-db-availability.d.ts +5 -2
- package/dist/ai-service/managed-native-db-availability.d.ts.map +1 -1
- package/dist/ai-service/managed-native-db-availability.js +5 -1
- package/dist/ai-service/managed-native-db-availability.js.map +1 -1
- package/dist/ai-service/mcp/embedded-playwright-mcp-server.js +2 -0
- package/dist/ai-service/mcp/embedded-playwright-mcp-server.js.map +1 -1
- package/dist/ai-service/migration-prompt-gating.d.ts +1 -0
- package/dist/ai-service/migration-prompt-gating.d.ts.map +1 -1
- package/dist/ai-service/migration-prompt-gating.js +3 -0
- package/dist/ai-service/migration-prompt-gating.js.map +1 -1
- package/dist/ai-service/migration-turns-log.d.ts +3 -2
- package/dist/ai-service/migration-turns-log.d.ts.map +1 -1
- package/dist/ai-service/migration-turns-log.js.map +1 -1
- package/dist/ai-service/policy-agent-metrics.d.ts +2 -4
- package/dist/ai-service/policy-agent-metrics.d.ts.map +1 -1
- package/dist/ai-service/policy-agent-metrics.js +3 -3
- package/dist/ai-service/policy-agent-metrics.js.map +1 -1
- package/dist/ai-service/policy-gate-remediation-usage.d.ts.map +1 -1
- package/dist/ai-service/policy-gate-remediation-usage.js +29 -19
- package/dist/ai-service/policy-gate-remediation-usage.js.map +1 -1
- package/dist/ai-service/prompt-builder-service/classifiers/prompt-interpret-task.js +1 -1
- package/dist/ai-service/prompt-builder-service/classifiers/prompt-interpret-task.js.map +1 -1
- package/dist/ai-service/recording/types.d.ts +6 -5
- package/dist/ai-service/recording/types.d.ts.map +1 -1
- package/dist/ai-service/skills/system/_registry.generated.d.ts.map +1 -1
- package/dist/ai-service/skills/system/_registry.generated.js +10 -0
- package/dist/ai-service/skills/system/_registry.generated.js.map +1 -1
- package/dist/ai-service/skills/system/app-database/skill.generated.d.ts +2 -0
- package/dist/ai-service/skills/system/app-database/skill.generated.d.ts.map +1 -0
- package/dist/ai-service/skills/system/app-database/skill.generated.js +79 -0
- package/dist/ai-service/skills/system/app-database/skill.generated.js.map +1 -0
- package/dist/ai-service/skills/system/resolve.d.ts +1 -1
- package/dist/ai-service/skills/system/resolve.d.ts.map +1 -1
- package/dist/ai-service/skills/system/resolve.js +25 -2
- package/dist/ai-service/skills/system/resolve.js.map +1 -1
- package/dist/ai-service/skills/system/spreadsheet-import/skill.generated.d.ts +1 -1
- package/dist/ai-service/skills/system/spreadsheet-import/skill.generated.d.ts.map +1 -1
- package/dist/ai-service/skills/system/spreadsheet-import/skill.generated.js +1 -1
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/base-ui-plain.generated.d.ts +2 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/base-ui-plain.generated.d.ts.map +1 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/base-ui-plain.generated.js +5 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/base-ui-plain.generated.js.map +1 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/base-ui-registered.generated.d.ts +2 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/base-ui-registered.generated.d.ts.map +1 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/base-ui-registered.generated.js +5 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/base-ui-registered.generated.js.map +1 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/icons-lucide.generated.d.ts +2 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/icons-lucide.generated.d.ts.map +1 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/icons-lucide.generated.js +32 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/icons-lucide.generated.js.map +1 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/icons-wrapper.generated.d.ts +2 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/icons-wrapper.generated.d.ts.map +1 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/icons-wrapper.generated.js +34 -0
- package/dist/ai-service/skills/system/superblocks-frontend/_variants/icons-wrapper.generated.js.map +1 -0
- package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.d.ts +1 -1
- package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.d.ts.map +1 -1
- package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.js +99 -68
- package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.js.map +1 -1
- package/dist/ai-service/skills/system/superblocks-migration/skill.generated.d.ts +1 -1
- package/dist/ai-service/skills/system/superblocks-migration/skill.generated.d.ts.map +1 -1
- package/dist/ai-service/skills/system/superblocks-migration/skill.generated.js +4 -4
- package/dist/ai-service/skills/system/superblocks-sdk-api/skill.generated.d.ts +1 -1
- package/dist/ai-service/skills/system/superblocks-sdk-api/skill.generated.d.ts.map +1 -1
- package/dist/ai-service/skills/system/superblocks-sdk-api/skill.generated.js +7 -7
- package/dist/ai-service/skills/system/third-party-migration/skill.generated.d.ts +1 -1
- package/dist/ai-service/skills/system/third-party-migration/skill.generated.d.ts.map +1 -1
- package/dist/ai-service/skills/system/third-party-migration/skill.generated.js +1 -1
- package/dist/ai-service/state-machine/clark-fsm.d.ts +2 -3
- package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
- package/dist/ai-service/state-machine/clark-fsm.js +1 -1
- package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/agent-planning.js +1 -4
- package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.js +21 -12
- package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/prompt-degradation-cause.d.ts +63 -0
- package/dist/ai-service/state-machine/helpers/prompt-degradation-cause.d.ts.map +1 -0
- package/dist/ai-service/state-machine/helpers/prompt-degradation-cause.js +96 -0
- package/dist/ai-service/state-machine/helpers/prompt-degradation-cause.js.map +1 -0
- package/dist/ai-service/state-machine/helpers/prompt-degradation-metrics.d.ts +12 -3
- package/dist/ai-service/state-machine/helpers/prompt-degradation-metrics.d.ts.map +1 -1
- package/dist/ai-service/state-machine/helpers/prompt-degradation-metrics.js +89 -17
- package/dist/ai-service/state-machine/helpers/prompt-degradation-metrics.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/prompt-org-claims.d.ts +17 -0
- package/dist/ai-service/state-machine/helpers/prompt-org-claims.d.ts.map +1 -0
- package/dist/ai-service/state-machine/helpers/prompt-org-claims.js +50 -0
- package/dist/ai-service/state-machine/helpers/prompt-org-claims.js.map +1 -0
- package/dist/ai-service/state-machine/helpers/prompt-request-metrics.d.ts +6 -0
- package/dist/ai-service/state-machine/helpers/prompt-request-metrics.d.ts.map +1 -1
- package/dist/ai-service/state-machine/helpers/prompt-request-metrics.js +35 -5
- package/dist/ai-service/state-machine/helpers/prompt-request-metrics.js.map +1 -1
- package/dist/ai-service/state-machine/mocks.d.ts.map +1 -1
- package/dist/ai-service/state-machine/mocks.js +1 -4
- package/dist/ai-service/state-machine/mocks.js.map +1 -1
- package/dist/ai-service/tasks/peer-push.d.ts +2 -1
- package/dist/ai-service/tasks/peer-push.d.ts.map +1 -1
- package/dist/ai-service/test-utils/metrics-harness.d.ts +2 -1
- package/dist/ai-service/test-utils/metrics-harness.d.ts.map +1 -1
- package/dist/ai-service/util/llm-config-utils.d.ts +16 -5
- package/dist/ai-service/util/llm-config-utils.d.ts.map +1 -1
- package/dist/ai-service/util/llm-config-utils.js +25 -3
- package/dist/ai-service/util/llm-config-utils.js.map +1 -1
- package/dist/ai-service/util/parse-jwt.d.ts +5 -1
- package/dist/ai-service/util/parse-jwt.d.ts.map +1 -1
- package/dist/ai-service/util/parse-jwt.js +9 -1
- package/dist/ai-service/util/parse-jwt.js.map +1 -1
- package/dist/app-scope-source.d.ts +13 -0
- package/dist/app-scope-source.d.ts.map +1 -0
- package/dist/app-scope-source.js +68 -0
- package/dist/app-scope-source.js.map +1 -0
- package/dist/extract-api-integrations.d.ts +28 -6
- package/dist/extract-api-integrations.d.ts.map +1 -1
- package/dist/extract-api-integrations.js +166 -98
- package/dist/extract-api-integrations.js.map +1 -1
- package/dist/file-sync-vite-plugin.d.ts +1 -5
- package/dist/file-sync-vite-plugin.d.ts.map +1 -1
- package/dist/file-sync-vite-plugin.js +44 -70
- package/dist/file-sync-vite-plugin.js.map +1 -1
- package/dist/file-system-helpers.d.ts +0 -5
- package/dist/file-system-helpers.d.ts.map +1 -1
- package/dist/file-system-helpers.js +1 -1
- package/dist/file-system-helpers.js.map +1 -1
- package/dist/file-system-manager.d.ts +2 -9
- package/dist/file-system-manager.d.ts.map +1 -1
- package/dist/file-system-manager.js +50 -118
- package/dist/file-system-manager.js.map +1 -1
- package/dist/git-service/index.d.ts.map +1 -1
- package/dist/git-service/index.js +8 -0
- package/dist/git-service/index.js.map +1 -1
- package/dist/lock-service/index.d.ts +24 -0
- package/dist/lock-service/index.d.ts.map +1 -1
- package/dist/lock-service/index.js +74 -2
- package/dist/lock-service/index.js.map +1 -1
- package/dist/migration/integration-write-policy.d.ts +2 -1
- package/dist/migration/integration-write-policy.d.ts.map +1 -1
- package/dist/migration/integration-write-policy.js.map +1 -1
- package/dist/migration/restructure.d.ts +1 -1
- package/dist/migration/restructure.d.ts.map +1 -1
- package/dist/migration/restructure.js +1 -1
- package/dist/migration/restructure.js.map +1 -1
- package/dist/migration/translation-prompt.js +1 -1
- package/dist/migration-templates/app-fullstack/client/components/ui/accordion.tsx +0 -69
- package/dist/migration-templates/app-fullstack/client/components/ui/aspect-ratio.tsx +0 -31
- package/dist/migration-templates/app-fullstack/client/components/ui/avatar.tsx +0 -52
- package/dist/migration-templates/app-fullstack/client/components/ui/badge.tsx +5 -79
- package/dist/migration-templates/app-fullstack/client/components/ui/breadcrumb.tsx +14 -161
- package/dist/migration-templates/app-fullstack/client/components/ui/button.tsx +1 -53
- package/dist/migration-templates/app-fullstack/client/components/ui/calendar.tsx +4 -56
- package/dist/migration-templates/app-fullstack/client/components/ui/card.tsx +0 -34
- package/dist/migration-templates/app-fullstack/client/components/ui/chart.tsx +3 -51
- package/dist/migration-templates/app-fullstack/client/components/ui/checkbox.tsx +0 -42
- package/dist/migration-templates/app-fullstack/client/components/ui/dialog.tsx +0 -55
- package/dist/migration-templates/app-fullstack/client/components/ui/dropdown-menu.tsx +0 -29
- package/dist/migration-templates/app-fullstack/client/components/ui/hover-card.tsx +0 -64
- package/dist/migration-templates/app-fullstack/client/components/ui/input.tsx +0 -57
- package/dist/migration-templates/app-fullstack/client/components/ui/label.tsx +0 -30
- package/dist/migration-templates/app-fullstack/client/components/ui/navigation-menu.tsx +16 -172
- package/dist/migration-templates/app-fullstack/client/components/ui/pagination.tsx +0 -44
- package/dist/migration-templates/app-fullstack/client/components/ui/popover.tsx +0 -64
- package/dist/migration-templates/app-fullstack/client/components/ui/progress.tsx +0 -31
- package/dist/migration-templates/app-fullstack/client/components/ui/scroll-area.tsx +0 -30
- package/dist/migration-templates/app-fullstack/client/components/ui/select.tsx +0 -41
- package/dist/migration-templates/app-fullstack/client/components/ui/separator.tsx +0 -29
- package/dist/migration-templates/app-fullstack/client/components/ui/sheet.tsx +0 -64
- package/dist/migration-templates/app-fullstack/client/components/ui/sidebar.tsx +30 -265
- package/dist/migration-templates/app-fullstack/client/components/ui/slider.tsx +0 -45
- package/dist/migration-templates/app-fullstack/client/components/ui/switch.tsx +0 -41
- package/dist/migration-templates/app-fullstack/client/components/ui/table.tsx +0 -32
- package/dist/migration-templates/app-fullstack/client/components/ui/tabs.tsx +0 -23
- package/dist/migration-templates/app-fullstack/client/components/ui/textarea.tsx +0 -48
- package/dist/migration-templates/app-fullstack/client/components/ui/toggle-group.tsx +0 -81
- package/dist/migration-templates/app-fullstack/client/components/ui/toggle.tsx +0 -46
- package/dist/migration-templates/app-fullstack/client/components/ui/tooltip.tsx +0 -63
- package/dist/migration-templates/app-fullstack/eslint.config.js +7 -0
- package/dist/migration-templates/app-fullstack/package.json +0 -3
- package/dist/parsing/types.d.ts +3 -2
- package/dist/parsing/types.d.ts.map +1 -1
- package/dist/policy-gate-runner.d.ts +1 -1
- package/dist/policy-gate-runner.d.ts.map +1 -1
- package/dist/policy-gate-runner.js.map +1 -1
- package/dist/reconnect-guard-plugin.d.ts +0 -1
- package/dist/reconnect-guard-plugin.d.ts.map +1 -1
- package/dist/reconnect-guard-plugin.js +1 -1
- package/dist/reconnect-guard-plugin.js.map +1 -1
- package/dist/resolver.d.ts +1 -1
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +2 -2
- package/dist/resolver.js.map +1 -1
- package/dist/socket-manager.d.ts.map +1 -1
- package/dist/socket-manager.js +12 -2
- package/dist/socket-manager.js.map +1 -1
- package/dist/source-tracker.d.ts +5 -15
- package/dist/source-tracker.d.ts.map +1 -1
- package/dist/source-tracker.js +28 -66
- package/dist/source-tracker.js.map +1 -1
- package/dist/sync-service/checkpoint-result.d.ts +6 -5
- package/dist/sync-service/checkpoint-result.d.ts.map +1 -1
- package/dist/sync-service/checkpoint-result.js +9 -8
- package/dist/sync-service/checkpoint-result.js.map +1 -1
- package/dist/sync-service/index.d.ts +1 -0
- package/dist/sync-service/index.d.ts.map +1 -1
- package/dist/sync-service/index.js +8 -1
- package/dist/sync-service/index.js.map +1 -1
- package/dist/sync-service/snapshot/types.d.ts +3 -2
- package/dist/sync-service/snapshot/types.d.ts.map +1 -1
- package/dist/util/generation-wait-timeout-error.d.ts +12 -0
- package/dist/util/generation-wait-timeout-error.d.ts.map +1 -0
- package/dist/util/generation-wait-timeout-error.js +16 -0
- package/dist/util/generation-wait-timeout-error.js.map +1 -0
- package/package.json +9 -13
- package/dist/ai-service/agent/tools/apis/sdk-root-documentation.d.ts +0 -20
- package/dist/ai-service/agent/tools/apis/sdk-root-documentation.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/apis/sdk-root-documentation.js +0 -284
- package/dist/ai-service/agent/tools/apis/sdk-root-documentation.js.map +0 -1
- package/dist/migration-templates/app-fullstack/client/components/hooks/use-active-page.ts +0 -73
- package/dist/migration-templates/app-fullstack/client/components/ui/area-chart.tsx +0 -312
- package/dist/migration-templates/app-fullstack/client/components/ui/bar-chart.tsx +0 -264
- package/dist/migration-templates/app-fullstack/client/components/ui/code-block-content.tsx +0 -66
- package/dist/migration-templates/app-fullstack/client/components/ui/date-range-picker.tsx +0 -255
- package/dist/migration-templates/app-fullstack/client/components/ui/file-dropzone.tsx +0 -312
- package/dist/migration-templates/app-fullstack/client/components/ui/file-input.tsx +0 -105
- package/dist/migration-templates/app-fullstack/client/components/ui/icon.tsx +0 -120
- package/dist/migration-templates/app-fullstack/client/components/ui/image.tsx +0 -56
- package/dist/migration-templates/app-fullstack/client/components/ui/line-chart.tsx +0 -264
- package/dist/migration-templates/app-fullstack/client/components/ui/link.tsx +0 -119
- package/dist/migration-templates/app-fullstack/client/components/ui/pie-chart.tsx +0 -181
- package/dist/migration-templates/app-fullstack/client/components/ui/radar-chart.tsx +0 -252
- package/dist/migration-templates/app-fullstack/client/components/ui/radial-chart.tsx +0 -250
- package/dist/refactor/entities.d.ts +0 -6
- package/dist/refactor/entities.d.ts.map +0 -1
- package/dist/refactor/entities.js +0 -65
- package/dist/refactor/entities.js.map +0 -1
- package/dist/refactor/javascript.d.ts +0 -15
- package/dist/refactor/javascript.d.ts.map +0 -1
- package/dist/refactor/javascript.js +0 -283
- package/dist/refactor/javascript.js.map +0 -1
- package/dist/rename-manager.d.ts +0 -28
- package/dist/rename-manager.d.ts.map +0 -1
- package/dist/rename-manager.js +0 -161
- package/dist/rename-manager.js.map +0 -1
|
@@ -44,7 +44,8 @@ import JSON5 from "json5";
|
|
|
44
44
|
import { detect, resolveCommand } from "package-manager-detector";
|
|
45
45
|
import semver from "semver";
|
|
46
46
|
import { normalizePath } from "vite";
|
|
47
|
-
import {
|
|
47
|
+
import { isMap, parseDocument } from "yaml";
|
|
48
|
+
import { isCaretRelease, isProtectedCorePackage, isValidNpmPackageName, isValidNpmVersionSpec, parseOverrideSelector, } from "@superblocksteam/library-shared/types";
|
|
48
49
|
import { bucketNpmRegistryHost, recordNpmInstall, } from "@superblocksteam/telemetry";
|
|
49
50
|
import { applyPackageJsonSubstitutions, readDeclaredDependencies, } from "../../npm/apply-package-json-substitutions.js";
|
|
50
51
|
import { preparePackageJsonForCloudNpm } from "../../npm/prepare-package-json-for-cloud-npm.js";
|
|
@@ -53,7 +54,7 @@ import { getErrorMeta, getLogger } from "../../util/logger.js";
|
|
|
53
54
|
import { ToolExecutionError } from "../agent/tools2/types.js";
|
|
54
55
|
import llmobs from "../llmobs/index.js";
|
|
55
56
|
import { fixLucideDynamicTypeImports, isFixableLucidePath, } from "../transform/lucide-dynamic-type-imports/transformer.js";
|
|
56
|
-
import { NpmInstallBlocked, NpmInstallError, scrubSecrets, } from "../types.js";
|
|
57
|
+
import { NpmInstallBlocked, NpmInstallError, scrubSecrets, stripUnsafeChars, } from "../types.js";
|
|
57
58
|
import { detectAppPackageManager, isPnpmEnabled, podPnpmEnv, } from "./app-package-manager.js";
|
|
58
59
|
import { execCancellable } from "./cancellable-exec.js";
|
|
59
60
|
import { CLARK_APP_BLACKLIST_PATTERNS, APPLICATION_FILE_PATTERNS, STANDARD_IGNORE_PATTERNS, } from "./constants.js";
|
|
@@ -61,7 +62,7 @@ import { DraftManager, validateFileOperation, } from "./filesystem/index.js";
|
|
|
61
62
|
import { Linter } from "./linter.js";
|
|
62
63
|
import { classifyNpmExecStderr, parseNpmJsonDiagnostic, parseNpmJsonError, parseNpmJsonSuccess, } from "./npm-error-parser.js";
|
|
63
64
|
import { prepareForPrivateRegistry, shouldIgnoreInstallScripts, } from "./npm-registry.js";
|
|
64
|
-
import { readPnpmLockfile } from "./pnpm-lockfile.js";
|
|
65
|
+
import { parsePnpmPackageKey, readPnpmLockfile } from "./pnpm-lockfile.js";
|
|
65
66
|
import { parseTypecheckOutputByPath } from "./typecheck-output-parser.js";
|
|
66
67
|
import { applyPackageSubstitutions, runVulnerabilityGate, } from "./vulnerability-gate.js";
|
|
67
68
|
const execPromise = promisify(exec);
|
|
@@ -84,6 +85,51 @@ function ignoreScriptsFlags(packageManager) {
|
|
|
84
85
|
? ["--ignore-scripts", "--ignore-pnpmfile"]
|
|
85
86
|
: ["--ignore-scripts"];
|
|
86
87
|
}
|
|
88
|
+
/** 7 days. Same window as the quarantine holdback. pnpm counts minutes. */
|
|
89
|
+
const QUARANTINE_WINDOW_DAYS = 7;
|
|
90
|
+
function updateAgeArgs(packageManager) {
|
|
91
|
+
if (packageManager === "pnpm") {
|
|
92
|
+
return [`--config.minimum-release-age=${QUARANTINE_WINDOW_DAYS * 24 * 60}`];
|
|
93
|
+
}
|
|
94
|
+
return [`--min-release-age=${QUARANTINE_WINDOW_DAYS}`];
|
|
95
|
+
}
|
|
96
|
+
function versionsByName(packages) {
|
|
97
|
+
const byName = new Map();
|
|
98
|
+
for (const pkg of packages) {
|
|
99
|
+
const versions = byName.get(pkg.name) ?? new Set();
|
|
100
|
+
versions.add(pkg.version);
|
|
101
|
+
byName.set(pkg.name, versions);
|
|
102
|
+
}
|
|
103
|
+
return byName;
|
|
104
|
+
}
|
|
105
|
+
function sameVersions(left, right) {
|
|
106
|
+
if (!left || left.size !== right.size)
|
|
107
|
+
return false;
|
|
108
|
+
for (const version of right) {
|
|
109
|
+
if (!left.has(version))
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
/** Package-manager text from a failed probe, short enough to show the model. */
|
|
115
|
+
function probeFailureText(error) {
|
|
116
|
+
if (!(error instanceof Error))
|
|
117
|
+
return "The package manager failed.";
|
|
118
|
+
const stderr = "stderr" in error && typeof error.stderr === "string"
|
|
119
|
+
? error.stderr.trim()
|
|
120
|
+
: "";
|
|
121
|
+
const stdout = "stdout" in error && typeof error.stdout === "string"
|
|
122
|
+
? error.stdout.trim()
|
|
123
|
+
: "";
|
|
124
|
+
return stripUnsafeChars(scrubSecrets(stderr || stdout || error.message)).slice(0, 500);
|
|
125
|
+
}
|
|
126
|
+
/** Package name behind `npm:prettier@2.8.8`. The alias key is not that package. */
|
|
127
|
+
function npmAliasName(spec) {
|
|
128
|
+
if (!spec?.startsWith("npm:"))
|
|
129
|
+
return undefined;
|
|
130
|
+
const target = spec.slice("npm:".length);
|
|
131
|
+
return parsePnpmPackageKey(target)?.name ?? (target || undefined);
|
|
132
|
+
}
|
|
87
133
|
/** Lowest version a declared range admits; skips `workspace:`/`file:`/`*`/git. */
|
|
88
134
|
function declaredRangeFloor(range) {
|
|
89
135
|
if (range == null || semver.validRange(range) == null)
|
|
@@ -141,6 +187,25 @@ function isNpmErrorEnvelope(parsed) {
|
|
|
141
187
|
* on some shapes; treat those as top-level so a missing field cannot hide a
|
|
142
188
|
* package from the top-level CVE checks.
|
|
143
189
|
*/
|
|
190
|
+
function throwHeldResolution(args) {
|
|
191
|
+
const { caret, substitutions } = args;
|
|
192
|
+
const findings = substitutions.map((entry) => {
|
|
193
|
+
const suggestedVersion = caret && isCaretRelease(`^${entry.toVersion}`)
|
|
194
|
+
? `^${entry.toVersion}`
|
|
195
|
+
: entry.toVersion;
|
|
196
|
+
return {
|
|
197
|
+
advisoryId: entry.reason,
|
|
198
|
+
kind: "cve",
|
|
199
|
+
package: `${entry.name}@${entry.fromVersion}`,
|
|
200
|
+
suggestedVersion,
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
throw new NpmInstallBlocked({
|
|
204
|
+
findings,
|
|
205
|
+
packages: [...new Set(findings.map((finding) => finding.package))],
|
|
206
|
+
reason: "vulnerable_package",
|
|
207
|
+
});
|
|
208
|
+
}
|
|
144
209
|
function isRootNodeModulesPath(entryPath) {
|
|
145
210
|
if (typeof entryPath !== "string" || entryPath.length === 0)
|
|
146
211
|
return true;
|
|
@@ -211,6 +276,117 @@ const DEFAULT_COPY_DIRECTORY_EXCLUDES = new Set([
|
|
|
211
276
|
* - Code quality tools (linting, type checking)
|
|
212
277
|
* - Package management
|
|
213
278
|
*/
|
|
279
|
+
function isJsonRecord(value) {
|
|
280
|
+
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* npm reads overrides from package.json. pnpm 12 ignores that field.
|
|
284
|
+
* `parent>dep` is nested. `name@range` stays a flat key.
|
|
285
|
+
* A nested value stays until that key is replaced.
|
|
286
|
+
*/
|
|
287
|
+
function packageJsonWithFlatOverrides(args) {
|
|
288
|
+
const { changes, source } = args;
|
|
289
|
+
const parsed = JSON.parse(source);
|
|
290
|
+
if (!isJsonRecord(parsed)) {
|
|
291
|
+
throw new Error("package.json is not a JSON object");
|
|
292
|
+
}
|
|
293
|
+
const buckets = [];
|
|
294
|
+
if (isJsonRecord(parsed.overrides))
|
|
295
|
+
buckets.push(parsed.overrides);
|
|
296
|
+
for (const change of changes) {
|
|
297
|
+
const selector = parseOverrideSelector(change.name);
|
|
298
|
+
if (selector?.kind === "parent") {
|
|
299
|
+
let found = false;
|
|
300
|
+
for (const bucket of buckets) {
|
|
301
|
+
const current = bucket[selector.parent];
|
|
302
|
+
if (change.version === null) {
|
|
303
|
+
if (!isJsonRecord(current) || !(selector.child in current))
|
|
304
|
+
continue;
|
|
305
|
+
delete current[selector.child];
|
|
306
|
+
if (Object.keys(current).length === 0)
|
|
307
|
+
delete bucket[selector.parent];
|
|
308
|
+
found = true;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (current === undefined)
|
|
312
|
+
continue;
|
|
313
|
+
if (!isJsonRecord(current)) {
|
|
314
|
+
throw new Error(`package.json overrides for ${selector.parent} is not an object`);
|
|
315
|
+
}
|
|
316
|
+
current[selector.child] = change.version;
|
|
317
|
+
found = true;
|
|
318
|
+
}
|
|
319
|
+
if (found || change.version === null)
|
|
320
|
+
continue;
|
|
321
|
+
if (parsed.overrides === undefined)
|
|
322
|
+
parsed.overrides = {};
|
|
323
|
+
if (!isJsonRecord(parsed.overrides)) {
|
|
324
|
+
throw new Error("package.json overrides is not an object");
|
|
325
|
+
}
|
|
326
|
+
parsed.overrides[selector.parent] = {
|
|
327
|
+
[selector.child]: change.version,
|
|
328
|
+
};
|
|
329
|
+
if (!buckets.includes(parsed.overrides))
|
|
330
|
+
buckets.push(parsed.overrides);
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
let found = false;
|
|
334
|
+
for (const bucket of buckets) {
|
|
335
|
+
if (!(change.name in bucket))
|
|
336
|
+
continue;
|
|
337
|
+
found = true;
|
|
338
|
+
if (change.version === null)
|
|
339
|
+
delete bucket[change.name];
|
|
340
|
+
else
|
|
341
|
+
bucket[change.name] = change.version;
|
|
342
|
+
}
|
|
343
|
+
if (found || change.version === null)
|
|
344
|
+
continue;
|
|
345
|
+
if (parsed.overrides === undefined)
|
|
346
|
+
parsed.overrides = {};
|
|
347
|
+
if (!isJsonRecord(parsed.overrides)) {
|
|
348
|
+
throw new Error("package.json overrides is not an object");
|
|
349
|
+
}
|
|
350
|
+
parsed.overrides[change.name] = change.version;
|
|
351
|
+
if (!buckets.includes(parsed.overrides))
|
|
352
|
+
buckets.push(parsed.overrides);
|
|
353
|
+
}
|
|
354
|
+
if (isJsonRecord(parsed.overrides) &&
|
|
355
|
+
Object.keys(parsed.overrides).length === 0) {
|
|
356
|
+
delete parsed.overrides;
|
|
357
|
+
}
|
|
358
|
+
return `${JSON.stringify(parsed, null, 2)}\n`;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Override keys in pnpm-workspace.yaml. pnpm 12 reads this file and ignores
|
|
362
|
+
* overrides in package.json. A selector stays a string key.
|
|
363
|
+
*/
|
|
364
|
+
function workspaceYamlWithFlatOverrides(args) {
|
|
365
|
+
const { changes, source } = args;
|
|
366
|
+
const doc = parseDocument(source);
|
|
367
|
+
if (doc.errors.length > 0) {
|
|
368
|
+
throw new Error("pnpm-workspace.yaml is not valid YAML");
|
|
369
|
+
}
|
|
370
|
+
const current = doc.get("overrides");
|
|
371
|
+
if (current != null && !isMap(current)) {
|
|
372
|
+
throw new Error("pnpm-workspace.yaml overrides is not a map");
|
|
373
|
+
}
|
|
374
|
+
for (const change of changes) {
|
|
375
|
+
if (change.version === null) {
|
|
376
|
+
if (doc.has("overrides"))
|
|
377
|
+
doc.deleteIn(["overrides", change.name]);
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
doc.setIn(["overrides", change.name], change.version);
|
|
381
|
+
}
|
|
382
|
+
const next = doc.get("overrides");
|
|
383
|
+
if (isMap(next) && next.items.length === 0)
|
|
384
|
+
doc.delete("overrides");
|
|
385
|
+
const text = doc.toString();
|
|
386
|
+
if (text.length === 0)
|
|
387
|
+
return "";
|
|
388
|
+
return text.endsWith("\n") ? text : `${text}\n`;
|
|
389
|
+
}
|
|
214
390
|
let AppShell = (() => {
|
|
215
391
|
let _instanceExtraInitializers = [];
|
|
216
392
|
let _readFiles_decorators;
|
|
@@ -219,6 +395,8 @@ let AppShell = (() => {
|
|
|
219
395
|
let _warmLinterCache_decorators;
|
|
220
396
|
let _runNpmInstall_decorators;
|
|
221
397
|
let _runPackageManagerInstall_decorators;
|
|
398
|
+
let _setPackageOverrides_decorators;
|
|
399
|
+
let _updatePackages_decorators;
|
|
222
400
|
let _installSpecificPackages_decorators;
|
|
223
401
|
let _uninstallPackages_decorators;
|
|
224
402
|
let _saveGeneratedArtifact_decorators;
|
|
@@ -239,6 +417,8 @@ let AppShell = (() => {
|
|
|
239
417
|
_warmLinterCache_decorators = [llmobs.decorate({ kind: "task", name: "AppShell.warmLinterCache" })];
|
|
240
418
|
_runNpmInstall_decorators = [llmobs.decorate({ kind: "task", name: "AppShell.runNpmInstall" })];
|
|
241
419
|
_runPackageManagerInstall_decorators = [llmobs.decorate({ kind: "task", name: "AppShell.runPackageManagerInstall" })];
|
|
420
|
+
_setPackageOverrides_decorators = [llmobs.decorate({ kind: "task", name: "AppShell.setPackageOverrides" })];
|
|
421
|
+
_updatePackages_decorators = [llmobs.decorate({ kind: "task", name: "AppShell.updatePackages" })];
|
|
242
422
|
_installSpecificPackages_decorators = [llmobs.decorate({
|
|
243
423
|
kind: "task",
|
|
244
424
|
name: "AppShell.installSpecificPackages",
|
|
@@ -259,6 +439,8 @@ let AppShell = (() => {
|
|
|
259
439
|
__esDecorate(this, null, _warmLinterCache_decorators, { kind: "method", name: "warmLinterCache", static: false, private: false, access: { has: obj => "warmLinterCache" in obj, get: obj => obj.warmLinterCache }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
260
440
|
__esDecorate(this, null, _runNpmInstall_decorators, { kind: "method", name: "runNpmInstall", static: false, private: false, access: { has: obj => "runNpmInstall" in obj, get: obj => obj.runNpmInstall }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
261
441
|
__esDecorate(this, null, _runPackageManagerInstall_decorators, { kind: "method", name: "runPackageManagerInstall", static: false, private: false, access: { has: obj => "runPackageManagerInstall" in obj, get: obj => obj.runPackageManagerInstall }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
442
|
+
__esDecorate(this, null, _setPackageOverrides_decorators, { kind: "method", name: "setPackageOverrides", static: false, private: false, access: { has: obj => "setPackageOverrides" in obj, get: obj => obj.setPackageOverrides }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
443
|
+
__esDecorate(this, null, _updatePackages_decorators, { kind: "method", name: "updatePackages", static: false, private: false, access: { has: obj => "updatePackages" in obj, get: obj => obj.updatePackages }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
262
444
|
__esDecorate(this, null, _installSpecificPackages_decorators, { kind: "method", name: "installSpecificPackages", static: false, private: false, access: { has: obj => "installSpecificPackages" in obj, get: obj => obj.installSpecificPackages }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
263
445
|
__esDecorate(this, null, _uninstallPackages_decorators, { kind: "method", name: "uninstallPackages", static: false, private: false, access: { has: obj => "uninstallPackages" in obj, get: obj => obj.uninstallPackages }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
264
446
|
__esDecorate(this, null, _saveGeneratedArtifact_decorators, { kind: "method", name: "saveGeneratedArtifact", static: false, private: false, access: { has: obj => "saveGeneratedArtifact" in obj, get: obj => obj.saveGeneratedArtifact }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
@@ -300,8 +482,9 @@ let AppShell = (() => {
|
|
|
300
482
|
reportNpmInstallBlocked;
|
|
301
483
|
/**
|
|
302
484
|
* Optional sink for privacy-safe install-gate USER_EVENT reports. One call
|
|
303
|
-
* per gated AppShell install (`install_all` / `install_specific`
|
|
304
|
-
* outcome + runner only. Prefetch and uninstall never
|
|
485
|
+
* per gated AppShell install (`install_all` / `install_specific` /
|
|
486
|
+
* `update`) with outcome + runner only. Prefetch and uninstall never
|
|
487
|
+
* report.
|
|
305
488
|
*/
|
|
306
489
|
reportNpmInstallOutcome;
|
|
307
490
|
/**
|
|
@@ -757,12 +940,15 @@ let AppShell = (() => {
|
|
|
757
940
|
}
|
|
758
941
|
/**
|
|
759
942
|
* Report a gated install outcome for Snowflake USER_EVENTs. Only
|
|
760
|
-
* `install_all` and `
|
|
761
|
-
* Fire-and-forget: a reporting failure must never break the install.
|
|
943
|
+
* `install_all`, `install_specific`, and `update` run the vulnerability
|
|
944
|
+
* gate. Fire-and-forget: a reporting failure must never break the install.
|
|
762
945
|
*/
|
|
763
946
|
maybeReportInstallOutcome(runner, outcome) {
|
|
764
|
-
if (runner !== "install_all" &&
|
|
947
|
+
if (runner !== "install_all" &&
|
|
948
|
+
runner !== "install_specific" &&
|
|
949
|
+
runner !== "update") {
|
|
765
950
|
return;
|
|
951
|
+
}
|
|
766
952
|
if (!this.reportNpmInstallOutcome)
|
|
767
953
|
return;
|
|
768
954
|
try {
|
|
@@ -1128,6 +1314,56 @@ let AppShell = (() => {
|
|
|
1128
1314
|
}
|
|
1129
1315
|
return results;
|
|
1130
1316
|
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Versions `npm update` / `pnpm update` would install. A failed probe does
|
|
1319
|
+
* not fall back to the lockfile: that tree is the one already installed.
|
|
1320
|
+
*/
|
|
1321
|
+
async resolveUpdateTree(args) {
|
|
1322
|
+
const { abortSignal, ignoreScripts, packages, updatePackageNames } = args;
|
|
1323
|
+
let resolved;
|
|
1324
|
+
try {
|
|
1325
|
+
resolved = await this.resolveTreeViaNpmDryRun({
|
|
1326
|
+
abortSignal,
|
|
1327
|
+
ignoreScripts,
|
|
1328
|
+
npmCommand: "update",
|
|
1329
|
+
specs: updatePackageNames,
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
catch (err) {
|
|
1333
|
+
if (abortSignal?.aborted ||
|
|
1334
|
+
(err instanceof Error && err.name === "AbortError")) {
|
|
1335
|
+
throw err;
|
|
1336
|
+
}
|
|
1337
|
+
return { resolves: false, topLevel: [], tree: [] };
|
|
1338
|
+
}
|
|
1339
|
+
if (!resolved.resolves) {
|
|
1340
|
+
return { resolves: false, topLevel: [], tree: [] };
|
|
1341
|
+
}
|
|
1342
|
+
const wanted = new Set(updatePackageNames.length > 0
|
|
1343
|
+
? updatePackageNames
|
|
1344
|
+
: (packages ?? []).map((pkg) => pkg.name));
|
|
1345
|
+
for (const pkg of packages ?? []) {
|
|
1346
|
+
if (!wanted.has(pkg.name))
|
|
1347
|
+
continue;
|
|
1348
|
+
const alias = npmAliasName(pkg.version);
|
|
1349
|
+
if (alias)
|
|
1350
|
+
wanted.add(alias);
|
|
1351
|
+
}
|
|
1352
|
+
const topLevel = [];
|
|
1353
|
+
const seen = new Set();
|
|
1354
|
+
for (const pkg of resolved.topLevel) {
|
|
1355
|
+
if (!wanted.has(pkg.name) || seen.has(pkg.name))
|
|
1356
|
+
continue;
|
|
1357
|
+
seen.add(pkg.name);
|
|
1358
|
+
topLevel.push(pkg);
|
|
1359
|
+
}
|
|
1360
|
+
return {
|
|
1361
|
+
resolves: true,
|
|
1362
|
+
topLevel,
|
|
1363
|
+
tree: resolved.tree,
|
|
1364
|
+
unnamed: resolved.unnamed,
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1131
1367
|
/**
|
|
1132
1368
|
* Mode 1: npm dry-run + lockfile.
|
|
1133
1369
|
* Mode 2: `topLevel` is always declared package.json floors (CVE remediations).
|
|
@@ -1135,7 +1371,16 @@ let AppShell = (() => {
|
|
|
1135
1371
|
* rewrite). Local stays floors-only — pnpm + lingering `workspace:*` mean
|
|
1136
1372
|
* full-tree coverage is not available there.
|
|
1137
1373
|
*/
|
|
1138
|
-
async resolveInstallTree(
|
|
1374
|
+
async resolveInstallTree(args) {
|
|
1375
|
+
const { abortSignal, ignoreScripts, mode, packages, updatePackageNames } = args;
|
|
1376
|
+
if (mode === "all" && updatePackageNames !== undefined) {
|
|
1377
|
+
return await this.resolveUpdateTree({
|
|
1378
|
+
abortSignal,
|
|
1379
|
+
ignoreScripts,
|
|
1380
|
+
packages,
|
|
1381
|
+
updatePackageNames,
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1139
1384
|
if (mode === "all") {
|
|
1140
1385
|
const topLevel = [];
|
|
1141
1386
|
for (const pkg of packages ?? []) {
|
|
@@ -1150,7 +1395,12 @@ let AppShell = (() => {
|
|
|
1150
1395
|
const fromLock = await this.readPackagesFromPackageLock();
|
|
1151
1396
|
let dryTree = [];
|
|
1152
1397
|
try {
|
|
1153
|
-
dryTree = (await this.resolveTreeViaNpmDryRun(
|
|
1398
|
+
dryTree = (await this.resolveTreeViaNpmDryRun({
|
|
1399
|
+
abortSignal,
|
|
1400
|
+
ignoreScripts,
|
|
1401
|
+
npmCommand: "install",
|
|
1402
|
+
specs: [],
|
|
1403
|
+
})).tree;
|
|
1154
1404
|
}
|
|
1155
1405
|
catch (err) {
|
|
1156
1406
|
// Do not continue remediation after cancel.
|
|
@@ -1170,7 +1420,11 @@ let AppShell = (() => {
|
|
|
1170
1420
|
return { resolves: true, topLevel, tree: [...byKey.values()] };
|
|
1171
1421
|
}
|
|
1172
1422
|
const specs = (packages ?? []).map((pkg) => pkg.version ? `${pkg.name}@${pkg.version}` : pkg.name);
|
|
1173
|
-
const resolved = await this.resolveTreeViaNpmDryRun(
|
|
1423
|
+
const resolved = await this.resolveTreeViaNpmDryRun({
|
|
1424
|
+
abortSignal,
|
|
1425
|
+
ignoreScripts,
|
|
1426
|
+
specs,
|
|
1427
|
+
});
|
|
1174
1428
|
// Prefer dry-run concrete pins for top-level. Never inject the raw
|
|
1175
1429
|
// requested range/`latest` string into the lookup tree — the index
|
|
1176
1430
|
// keys on concrete versions, and a range would fail coverage checks.
|
|
@@ -1209,16 +1463,23 @@ let AppShell = (() => {
|
|
|
1209
1463
|
unnamed: resolved.unnamed,
|
|
1210
1464
|
};
|
|
1211
1465
|
}
|
|
1212
|
-
async resolveTreeViaNpmDryRun(
|
|
1466
|
+
async resolveTreeViaNpmDryRun(probe) {
|
|
1467
|
+
const { abortSignal, ignoreScripts, npmCommand = "install", specs } = probe;
|
|
1213
1468
|
if (isPnpmEnabled() && (await this.appPackageManager()) === "pnpm") {
|
|
1214
|
-
return this.resolveTreeViaPnpmLockfile(
|
|
1469
|
+
return this.resolveTreeViaPnpmLockfile({
|
|
1470
|
+
abortSignal,
|
|
1471
|
+
ignoreScripts,
|
|
1472
|
+
npmCommand,
|
|
1473
|
+
specs,
|
|
1474
|
+
});
|
|
1215
1475
|
}
|
|
1216
1476
|
const args = [
|
|
1217
|
-
|
|
1477
|
+
npmCommand,
|
|
1218
1478
|
"--dry-run",
|
|
1219
1479
|
"--json",
|
|
1220
1480
|
"--fund=false",
|
|
1221
1481
|
"--audit=false",
|
|
1482
|
+
...(npmCommand === "update" ? updateAgeArgs("npm") : []),
|
|
1222
1483
|
// `--` so a spec that looks like an option (`--registry=…`,
|
|
1223
1484
|
// `--userconfig=…`) is parsed as a package name instead of
|
|
1224
1485
|
// reconfiguring the probe: the gate scans the tree this resolves, so a
|
|
@@ -1284,7 +1545,11 @@ let AppShell = (() => {
|
|
|
1284
1545
|
* more packages than get installed, never fewer. The app's locked tree is
|
|
1285
1546
|
* scanned from its lockfile in `resolveInstallTree`.
|
|
1286
1547
|
*/
|
|
1287
|
-
async resolveTreeViaPnpmLockfile(
|
|
1548
|
+
async resolveTreeViaPnpmLockfile(probe) {
|
|
1549
|
+
const { abortSignal, ignoreScripts, npmCommand = "install", specs } = probe;
|
|
1550
|
+
// A member of a parent workspace has no lockfile in this copy, so the
|
|
1551
|
+
// probe fails closed. It does not write the shared lockfile. Cloud edit
|
|
1552
|
+
// is one app and does not hit that case.
|
|
1288
1553
|
const dir = await mkdtemp(path.join(os.tmpdir(), "sb-pnpm-resolve-"));
|
|
1289
1554
|
try {
|
|
1290
1555
|
for (const file of [
|
|
@@ -1306,17 +1571,26 @@ let AppShell = (() => {
|
|
|
1306
1571
|
"--lockfile-only",
|
|
1307
1572
|
...(ignoreScripts ? ignoreScriptsFlags("pnpm") : ["--ignore-scripts"]),
|
|
1308
1573
|
];
|
|
1309
|
-
const onlyNewPackages =
|
|
1574
|
+
const onlyNewPackages = npmCommand === "install" &&
|
|
1575
|
+
specs.length > 0 &&
|
|
1310
1576
|
(await this.lockfileIsUpToDate(dir, flags, abortSignal));
|
|
1311
1577
|
if (onlyNewPackages) {
|
|
1312
1578
|
await this.keepOnlyNewPackages(dir);
|
|
1313
1579
|
}
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1580
|
+
const ageArgs = npmCommand === "update" ? updateAgeArgs("pnpm") : [];
|
|
1581
|
+
const args = npmCommand === "update"
|
|
1582
|
+
? [
|
|
1583
|
+
"update",
|
|
1584
|
+
...flags,
|
|
1585
|
+
...ageArgs,
|
|
1586
|
+
...(specs.length > 0 ? ["--", ...specs] : []),
|
|
1587
|
+
]
|
|
1588
|
+
: specs.length > 0
|
|
1589
|
+
? ["add", ...flags, "--", ...specs]
|
|
1590
|
+
: // The lockfile has to be allowed to change, as on the real
|
|
1591
|
+
// install. pnpm 12 already allows that with `--lockfile-only`
|
|
1592
|
+
// under `CI=true`; the flag says so outright. `pnpm add` rejects it.
|
|
1593
|
+
["install", ...flags, "--no-frozen-lockfile"];
|
|
1320
1594
|
await execFilePromise("pnpm", args, {
|
|
1321
1595
|
cwd: dir,
|
|
1322
1596
|
env: this.installLogEnv(),
|
|
@@ -1324,8 +1598,14 @@ let AppShell = (() => {
|
|
|
1324
1598
|
maxBuffer: NPM_JSON_MAX_BUFFER,
|
|
1325
1599
|
});
|
|
1326
1600
|
const locked = readPnpmLockfile(await fsReadFile(path.join(dir, "pnpm-lock.yaml"), "utf8"));
|
|
1327
|
-
if (!locked)
|
|
1328
|
-
return {
|
|
1601
|
+
if (!locked) {
|
|
1602
|
+
return {
|
|
1603
|
+
failure: "pnpm wrote a lockfile that could not be read.",
|
|
1604
|
+
resolves: false,
|
|
1605
|
+
topLevel: [],
|
|
1606
|
+
tree: [],
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1329
1609
|
// A tarball or git package already in the app's lockfile is already
|
|
1330
1610
|
// installed; only the ones this install adds are new.
|
|
1331
1611
|
const installed = new Set((await this.readPackagesFromPackageLock())?.unnamed);
|
|
@@ -1340,12 +1620,36 @@ let AppShell = (() => {
|
|
|
1340
1620
|
(error instanceof Error && error.name === "AbortError")) {
|
|
1341
1621
|
throw error;
|
|
1342
1622
|
}
|
|
1343
|
-
return {
|
|
1623
|
+
return {
|
|
1624
|
+
failure: probeFailureText(error),
|
|
1625
|
+
resolves: false,
|
|
1626
|
+
topLevel: [],
|
|
1627
|
+
tree: [],
|
|
1628
|
+
};
|
|
1344
1629
|
}
|
|
1345
1630
|
finally {
|
|
1346
1631
|
await rm(dir, { recursive: true, force: true });
|
|
1347
1632
|
}
|
|
1348
1633
|
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Nearest directory that contains `pnpm-workspace.yaml`. The lockfile for a
|
|
1636
|
+
* workspace member lives there, not beside the member's package.json.
|
|
1637
|
+
*/
|
|
1638
|
+
async pnpmWorkspaceRoot() {
|
|
1639
|
+
let dir = path.resolve(this.appRootDirPath);
|
|
1640
|
+
for (;;) {
|
|
1641
|
+
try {
|
|
1642
|
+
await access(path.join(dir, "pnpm-workspace.yaml"));
|
|
1643
|
+
return dir;
|
|
1644
|
+
}
|
|
1645
|
+
catch {
|
|
1646
|
+
const parent = path.dirname(dir);
|
|
1647
|
+
if (parent === dir)
|
|
1648
|
+
return null;
|
|
1649
|
+
dir = parent;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1349
1653
|
/**
|
|
1350
1654
|
* Whether the app's lockfile, as copied into `dir`, already accounts for its
|
|
1351
1655
|
* manifest, overrides and pnpmfile: pnpm's frozen install, offline, so it
|
|
@@ -1390,7 +1694,6 @@ let AppShell = (() => {
|
|
|
1390
1694
|
if (parsed == null || typeof parsed !== "object") {
|
|
1391
1695
|
return { tree: [], topLevel: [], resolves: true };
|
|
1392
1696
|
}
|
|
1393
|
-
const record = parsed;
|
|
1394
1697
|
const tree = [];
|
|
1395
1698
|
const root = [];
|
|
1396
1699
|
const seen = new Set();
|
|
@@ -1407,24 +1710,25 @@ let AppShell = (() => {
|
|
|
1407
1710
|
if (isRootNodeModulesPath(entryPath))
|
|
1408
1711
|
root.push({ name, version });
|
|
1409
1712
|
};
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1713
|
+
const list = (key) => {
|
|
1714
|
+
const value = Reflect.get(parsed, key);
|
|
1715
|
+
return Array.isArray(value) ? value : [];
|
|
1716
|
+
};
|
|
1717
|
+
const pushEntry = (entry) => {
|
|
1718
|
+
push(Reflect.get(entry, "name"), Reflect.get(entry, "version"), Reflect.get(entry, "path"));
|
|
1719
|
+
};
|
|
1720
|
+
for (const entry of list("add")) {
|
|
1721
|
+
if (entry == null || typeof entry !== "object")
|
|
1722
|
+
continue;
|
|
1723
|
+
pushEntry(entry);
|
|
1417
1724
|
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
const to = change.to;
|
|
1426
|
-
push(to.name, to.version, to.path);
|
|
1427
|
-
}
|
|
1725
|
+
for (const entry of list("change")) {
|
|
1726
|
+
if (entry == null || typeof entry !== "object")
|
|
1727
|
+
continue;
|
|
1728
|
+
const to = Reflect.get(entry, "to");
|
|
1729
|
+
if (to == null || typeof to !== "object")
|
|
1730
|
+
continue;
|
|
1731
|
+
pushEntry(to);
|
|
1428
1732
|
}
|
|
1429
1733
|
const topLevelNames = new Set(specs.map((spec) => {
|
|
1430
1734
|
if (spec.startsWith("@")) {
|
|
@@ -1437,14 +1741,29 @@ let AppShell = (() => {
|
|
|
1437
1741
|
// A dependency's nested copy shares the requested name but is a different
|
|
1438
1742
|
// version, and vouching for it would let the requested one install
|
|
1439
1743
|
// unchecked.
|
|
1440
|
-
|
|
1744
|
+
// No specs means the whole update. Root entries are the pins it would adopt.
|
|
1745
|
+
const topLevel = topLevelNames.size === 0
|
|
1746
|
+
? root
|
|
1747
|
+
: root.filter((pkg) => topLevelNames.has(pkg.name));
|
|
1748
|
+
// npm 11 prints `added` / `changed` counts. A positive count with no
|
|
1749
|
+
// package list is not an empty tree: the update would install versions
|
|
1750
|
+
// this probe did not name.
|
|
1751
|
+
const added = Reflect.get(parsed, "added");
|
|
1752
|
+
const changed = Reflect.get(parsed, "changed");
|
|
1753
|
+
const positive = (value) => typeof value === "number" && value > 0;
|
|
1754
|
+
if (tree.length === 0 && (positive(added) || positive(changed))) {
|
|
1755
|
+
return { resolves: false, topLevel: [], tree: [] };
|
|
1756
|
+
}
|
|
1441
1757
|
return { tree, topLevel, resolves: true };
|
|
1442
1758
|
}
|
|
1443
1759
|
async readPackagesFromPackageLock() {
|
|
1444
1760
|
// A pnpm app's installed tree is in `pnpm-lock.yaml`; a `package-lock.json`
|
|
1445
1761
|
// left over from its npm days would describe packages pnpm never installs.
|
|
1446
1762
|
if (isPnpmEnabled() && (await this.appPackageManager()) === "pnpm") {
|
|
1447
|
-
|
|
1763
|
+
// A workspace member's lockfile sits next to `pnpm-workspace.yaml`,
|
|
1764
|
+
// which may be a parent of the app. The app directory often has none.
|
|
1765
|
+
const root = await this.pnpmWorkspaceRoot();
|
|
1766
|
+
const locked = readPnpmLockfile(await fsReadFile(path.join(root ?? this.appRootDirPath, "pnpm-lock.yaml"), "utf8").catch(() => ""));
|
|
1448
1767
|
return locked ? { ...locked, resolves: true } : null;
|
|
1449
1768
|
}
|
|
1450
1769
|
const lockPath = path.join(this.appRootDirPath, "package-lock.json");
|
|
@@ -1526,9 +1845,15 @@ let AppShell = (() => {
|
|
|
1526
1845
|
if (!this.packageLookup) {
|
|
1527
1846
|
return { substitutions: [] };
|
|
1528
1847
|
}
|
|
1529
|
-
const
|
|
1848
|
+
const declared = mode === "all"
|
|
1530
1849
|
? await readDeclaredDependencies(this.appRootDirPath)
|
|
1531
1850
|
: args.packages;
|
|
1851
|
+
// A named update may rewrite only those packages. An empty list still
|
|
1852
|
+
// means every declared dependency.
|
|
1853
|
+
const named = args.updatePackageNames;
|
|
1854
|
+
const packages = named && named.length > 0
|
|
1855
|
+
? (declared ?? []).filter((pkg) => named.includes(pkg.name))
|
|
1856
|
+
: declared;
|
|
1532
1857
|
return await runVulnerabilityGate({
|
|
1533
1858
|
abortSignal,
|
|
1534
1859
|
capabilities: {
|
|
@@ -1538,9 +1863,24 @@ let AppShell = (() => {
|
|
|
1538
1863
|
getLogger().warn(message, getErrorMeta(error));
|
|
1539
1864
|
},
|
|
1540
1865
|
pickQuarantineHoldback: this.packageLookup.pickQuarantineHoldback,
|
|
1541
|
-
resolveInstallTree: async (resolveArgs) => await this.resolveInstallTree(
|
|
1542
|
-
|
|
1866
|
+
resolveInstallTree: async (resolveArgs) => await this.resolveInstallTree({
|
|
1867
|
+
abortSignal: resolveArgs.abortSignal,
|
|
1868
|
+
ignoreScripts,
|
|
1869
|
+
mode: resolveArgs.mode,
|
|
1870
|
+
packages: resolveArgs.packages,
|
|
1871
|
+
...(args.updatePackageNames !== undefined
|
|
1872
|
+
? { updatePackageNames: args.updatePackageNames }
|
|
1873
|
+
: {}),
|
|
1874
|
+
}),
|
|
1875
|
+
resolvePackageSpecs: async (resolveArgs) => await this.resolveTreeViaNpmDryRun({
|
|
1876
|
+
abortSignal: resolveArgs.abortSignal,
|
|
1877
|
+
ignoreScripts,
|
|
1878
|
+
specs: resolveArgs.specs,
|
|
1879
|
+
}),
|
|
1543
1880
|
},
|
|
1881
|
+
...(args.updatePackageNames !== undefined
|
|
1882
|
+
? { checkUpdatePins: true }
|
|
1883
|
+
: {}),
|
|
1544
1884
|
cveUserOverride,
|
|
1545
1885
|
mode,
|
|
1546
1886
|
packages,
|
|
@@ -1788,6 +2128,264 @@ let AppShell = (() => {
|
|
|
1788
2128
|
this.observeNpmInstall("install_all", capturedFetchResult, outcome, Date.now() - installStart, capturedPackageManager);
|
|
1789
2129
|
}
|
|
1790
2130
|
}
|
|
2131
|
+
/**
|
|
2132
|
+
* Edit one targeted override, then install. The name is `parent>dep` or
|
|
2133
|
+
* `name@range`. The version is a caret release such as `^1.2.3`. pnpm 12
|
|
2134
|
+
* reads the map from pnpm-workspace.yaml. npm reads it from package.json.
|
|
2135
|
+
* Every concrete version the change adds goes through the specific install
|
|
2136
|
+
* gate. A block or a holdback restores the file. No lockfile means every
|
|
2137
|
+
* resolved package counts as new.
|
|
2138
|
+
*/
|
|
2139
|
+
async setPackageOverrides(args) {
|
|
2140
|
+
const { abortSignal, changes } = args;
|
|
2141
|
+
if (changes.length === 0) {
|
|
2142
|
+
throw new Error("No override changes were given.");
|
|
2143
|
+
}
|
|
2144
|
+
const invalidNames = changes.filter((change) => {
|
|
2145
|
+
if (parseOverrideSelector(change.name))
|
|
2146
|
+
return false;
|
|
2147
|
+
// A removal can still delete a flat key already in the file.
|
|
2148
|
+
return change.version !== null || !isValidNpmPackageName(change.name);
|
|
2149
|
+
});
|
|
2150
|
+
if (invalidNames.length > 0) {
|
|
2151
|
+
throw new Error(`Override name must be parent>package or name@range: ${invalidNames.map((change) => change.name).join(", ")}.`);
|
|
2152
|
+
}
|
|
2153
|
+
const invalidVersions = changes.filter((change) => change.version !== null && !isCaretRelease(change.version));
|
|
2154
|
+
if (invalidVersions.length > 0) {
|
|
2155
|
+
throw new Error(`Override version must be a caret release such as ^1.2.3: ${invalidVersions.map((change) => change.name).join(", ")}.`);
|
|
2156
|
+
}
|
|
2157
|
+
const protectedTargets = [
|
|
2158
|
+
...new Set(changes.flatMap((change) => {
|
|
2159
|
+
if (change.version === null)
|
|
2160
|
+
return [];
|
|
2161
|
+
const selector = parseOverrideSelector(change.name);
|
|
2162
|
+
if (!selector)
|
|
2163
|
+
return [];
|
|
2164
|
+
const target = selector.kind === "parent" ? selector.child : selector.name;
|
|
2165
|
+
return isProtectedCorePackage(target) ? [target] : [];
|
|
2166
|
+
})),
|
|
2167
|
+
];
|
|
2168
|
+
if (protectedTargets.length > 0) {
|
|
2169
|
+
throw new Error(`Refusing to override protected core package(s): ${protectedTargets.join(", ")}. ` +
|
|
2170
|
+
"These are required by the Superblocks platform (dev server, build pipeline, or app runtime) and must keep the version the app declares.");
|
|
2171
|
+
}
|
|
2172
|
+
const manifestPath = path.join(this.appRootDirPath, "package.json");
|
|
2173
|
+
const packageManager = await this.installingPackageManager();
|
|
2174
|
+
const workspaceFile = packageManager === "pnpm"
|
|
2175
|
+
? path.join((await this.pnpmWorkspaceRoot()) ?? this.appRootDirPath, "pnpm-workspace.yaml")
|
|
2176
|
+
: undefined;
|
|
2177
|
+
// null means the file was not there. A string is the text to restore.
|
|
2178
|
+
let yamlOriginal = null;
|
|
2179
|
+
if (workspaceFile) {
|
|
2180
|
+
try {
|
|
2181
|
+
yamlOriginal = await this.enqueueFsOperation("readWorkspaceOverrides", () => fsReadFile(workspaceFile, "utf8"));
|
|
2182
|
+
}
|
|
2183
|
+
catch (error) {
|
|
2184
|
+
const missing = typeof error === "object" &&
|
|
2185
|
+
error !== null &&
|
|
2186
|
+
"code" in error &&
|
|
2187
|
+
error.code === "ENOENT";
|
|
2188
|
+
if (!missing)
|
|
2189
|
+
throw error;
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
let installStarted = false;
|
|
2193
|
+
let original = "";
|
|
2194
|
+
let savedOriginal = false;
|
|
2195
|
+
try {
|
|
2196
|
+
return await this.withAuthFailedRetry(async (registryFetchResult) => {
|
|
2197
|
+
this.maybeShortCircuitForUnreachable(registryFetchResult, changes.map((change) => change.name));
|
|
2198
|
+
await this.maybePreparePackageJsonForCloudNpm();
|
|
2199
|
+
if (!savedOriginal) {
|
|
2200
|
+
original = await this.enqueueFsOperation("readPackageJson", () => fsReadFile(manifestPath, "utf8"));
|
|
2201
|
+
savedOriginal = true;
|
|
2202
|
+
}
|
|
2203
|
+
const next = packageJsonWithFlatOverrides({
|
|
2204
|
+
changes,
|
|
2205
|
+
source: original,
|
|
2206
|
+
});
|
|
2207
|
+
await this.enqueueFsOperation("writePackageOverrides", () => writeFile(manifestPath, next));
|
|
2208
|
+
if (workspaceFile) {
|
|
2209
|
+
const nextYaml = workspaceYamlWithFlatOverrides({
|
|
2210
|
+
changes,
|
|
2211
|
+
source: yamlOriginal ?? "",
|
|
2212
|
+
});
|
|
2213
|
+
await this.enqueueFsOperation("writeWorkspaceOverrides", async () => {
|
|
2214
|
+
if (nextYaml.length === 0) {
|
|
2215
|
+
await rm(workspaceFile, { force: true });
|
|
2216
|
+
return;
|
|
2217
|
+
}
|
|
2218
|
+
await writeFile(workspaceFile, nextYaml);
|
|
2219
|
+
});
|
|
2220
|
+
}
|
|
2221
|
+
const ignoreScripts = shouldIgnoreInstallScripts(registryFetchResult);
|
|
2222
|
+
const before = await this.readPackagesFromPackageLock();
|
|
2223
|
+
const beforeVersions = versionsByName(before?.tree ?? []);
|
|
2224
|
+
const after = await this.resolveTreeViaNpmDryRun({
|
|
2225
|
+
abortSignal,
|
|
2226
|
+
ignoreScripts,
|
|
2227
|
+
npmCommand: "install",
|
|
2228
|
+
specs: [],
|
|
2229
|
+
});
|
|
2230
|
+
if (!after.resolves) {
|
|
2231
|
+
const detail = after.failure?.trim();
|
|
2232
|
+
throw new Error(detail
|
|
2233
|
+
? `Could not resolve packages after the override change. ${detail}`
|
|
2234
|
+
: "Could not resolve packages after the override change.");
|
|
2235
|
+
}
|
|
2236
|
+
const beforeUnnamed = new Set(before?.unnamed ?? []);
|
|
2237
|
+
const newUnnamed = (after.unnamed ?? []).filter((key) => !beforeUnnamed.has(key));
|
|
2238
|
+
if (newUnnamed.length > 0) {
|
|
2239
|
+
throw new NpmInstallBlocked({
|
|
2240
|
+
findings: newUnnamed.map((pkg) => ({
|
|
2241
|
+
advisoryId: "index_unavailable",
|
|
2242
|
+
kind: "index_unavailable",
|
|
2243
|
+
package: pkg,
|
|
2244
|
+
})),
|
|
2245
|
+
packages: newUnnamed,
|
|
2246
|
+
reason: "vulnerable_package",
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2249
|
+
const afterVersions = versionsByName(after.tree);
|
|
2250
|
+
const seenPins = new Set();
|
|
2251
|
+
// A name whose version set changed is checked in full. Promoting a
|
|
2252
|
+
// version that already sat somewhere in the old tree still counts.
|
|
2253
|
+
const changedPins = after.tree.filter((pkg) => {
|
|
2254
|
+
const key = `${pkg.name}@${pkg.version}`;
|
|
2255
|
+
if (seenPins.has(key))
|
|
2256
|
+
return false;
|
|
2257
|
+
seenPins.add(key);
|
|
2258
|
+
const afterSet = afterVersions.get(pkg.name) ?? new Set();
|
|
2259
|
+
return !sameVersions(beforeVersions.get(pkg.name), afterSet);
|
|
2260
|
+
});
|
|
2261
|
+
if (changedPins.length > 0) {
|
|
2262
|
+
const remediation = await this.maybeRemediateVulnerabilities({
|
|
2263
|
+
abortSignal,
|
|
2264
|
+
ignoreScripts,
|
|
2265
|
+
mode: "specific",
|
|
2266
|
+
packages: changedPins.map((pkg) => ({
|
|
2267
|
+
name: pkg.name,
|
|
2268
|
+
version: pkg.version,
|
|
2269
|
+
})),
|
|
2270
|
+
});
|
|
2271
|
+
if (remediation.substitutions.length > 0) {
|
|
2272
|
+
throwHeldResolution({
|
|
2273
|
+
caret: true,
|
|
2274
|
+
substitutions: remediation.substitutions,
|
|
2275
|
+
});
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
installStarted = true;
|
|
2279
|
+
return await this.runPackageManagerInstall(abortSignal);
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
catch (error) {
|
|
2283
|
+
// Once the install has started, the lockfile matches the new manifest.
|
|
2284
|
+
// Rolling package.json back would leave those two files apart.
|
|
2285
|
+
if (savedOriginal && !installStarted) {
|
|
2286
|
+
await this.enqueueFsOperation("restorePackageOverrides", () => writeFile(manifestPath, original)).catch((restoreError) => {
|
|
2287
|
+
getLogger().error("Failed to restore package.json after an override change", getErrorMeta(restoreError));
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
if (workspaceFile && !installStarted) {
|
|
2291
|
+
const file = workspaceFile;
|
|
2292
|
+
await this.enqueueFsOperation("restoreWorkspaceOverrides", async () => {
|
|
2293
|
+
if (yamlOriginal === null) {
|
|
2294
|
+
await rm(file, { force: true });
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
await writeFile(file, yamlOriginal);
|
|
2298
|
+
}).catch((restoreError) => {
|
|
2299
|
+
getLogger().error("Failed to restore pnpm-workspace.yaml after an override change", getErrorMeta(restoreError));
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
if (!installStarted) {
|
|
2303
|
+
this.maybeReportBlockedInstall(error, "install_specific");
|
|
2304
|
+
}
|
|
2305
|
+
throw error;
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
/**
|
|
2309
|
+
* `npm update` / `pnpm update`. Moves installed versions to the newest
|
|
2310
|
+
* release the ranges in package.json already allow. Does not add a package
|
|
2311
|
+
* and does not change those ranges. The vulnerability gate scans the tree
|
|
2312
|
+
* the update would install. Protected-package removal stays on
|
|
2313
|
+
* `uninstallPackages`.
|
|
2314
|
+
*/
|
|
2315
|
+
async updatePackages(packages, abortSignal) {
|
|
2316
|
+
const requested = packages ?? [];
|
|
2317
|
+
const invalidRequested = requested.filter((name) => !isValidNpmPackageName(name));
|
|
2318
|
+
if (invalidRequested.length > 0) {
|
|
2319
|
+
throw new Error(`Invalid package name(s): ${invalidRequested.join(", ")}.`);
|
|
2320
|
+
}
|
|
2321
|
+
const installStart = Date.now();
|
|
2322
|
+
let outcome = "success";
|
|
2323
|
+
let capturedFetchResult;
|
|
2324
|
+
let capturedPackageManager;
|
|
2325
|
+
try {
|
|
2326
|
+
return await this.withAuthFailedRetry(async (registryFetchResult) => {
|
|
2327
|
+
capturedFetchResult = registryFetchResult;
|
|
2328
|
+
this.maybeShortCircuitForUnreachable(registryFetchResult, requested);
|
|
2329
|
+
const packageManagerAgent = await this.installingPackageManager();
|
|
2330
|
+
await this.maybePreparePackageJsonForCloudNpm();
|
|
2331
|
+
capturedPackageManager = packageManagerAgent;
|
|
2332
|
+
const remediation = await this.maybeRemediateVulnerabilities({
|
|
2333
|
+
abortSignal,
|
|
2334
|
+
ignoreScripts: shouldIgnoreInstallScripts(registryFetchResult),
|
|
2335
|
+
mode: "all",
|
|
2336
|
+
updatePackageNames: requested,
|
|
2337
|
+
});
|
|
2338
|
+
if (remediation.substitutions.length > 0) {
|
|
2339
|
+
throwHeldResolution({
|
|
2340
|
+
caret: false,
|
|
2341
|
+
substitutions: remediation.substitutions,
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
const ignoreScripts = shouldIgnoreInstallScripts(registryFetchResult);
|
|
2345
|
+
const isNpm = packageManagerAgent === "npm";
|
|
2346
|
+
const ageArgs = updateAgeArgs(isNpm ? "npm" : "pnpm");
|
|
2347
|
+
const baseArgs = isNpm
|
|
2348
|
+
? [
|
|
2349
|
+
"--fund=false",
|
|
2350
|
+
"--audit=false",
|
|
2351
|
+
"--json",
|
|
2352
|
+
...ageArgs,
|
|
2353
|
+
...requested,
|
|
2354
|
+
]
|
|
2355
|
+
: [...ageArgs, ...requested];
|
|
2356
|
+
const resolved = resolveCommand(packageManagerAgent, "upgrade", ignoreScripts
|
|
2357
|
+
? [...ignoreScriptsFlags(packageManagerAgent), ...baseArgs]
|
|
2358
|
+
: baseArgs);
|
|
2359
|
+
if (!resolved) {
|
|
2360
|
+
throw new Error(`Could not determine upgrade command for ${packageManagerAgent}`);
|
|
2361
|
+
}
|
|
2362
|
+
let stdout;
|
|
2363
|
+
try {
|
|
2364
|
+
({ stdout } = await execPromise(`${resolved.command} ${resolved.args.join(" ")}`, {
|
|
2365
|
+
cwd: this.appRootDirPath,
|
|
2366
|
+
env: this.installLogEnv(),
|
|
2367
|
+
signal: abortSignal,
|
|
2368
|
+
maxBuffer: NPM_JSON_MAX_BUFFER,
|
|
2369
|
+
}));
|
|
2370
|
+
}
|
|
2371
|
+
catch (error) {
|
|
2372
|
+
if (isNpm) {
|
|
2373
|
+
throw this.classifyNpmExecError(error, undefined, registryFetchResult);
|
|
2374
|
+
}
|
|
2375
|
+
throw this.classifyPnpmExecError(error, undefined, registryFetchResult);
|
|
2376
|
+
}
|
|
2377
|
+
return isNpm ? (parseNpmJsonSuccess(stdout) ?? stdout) : stdout;
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
catch (err) {
|
|
2381
|
+
outcome = outcomeFromInstallError(err);
|
|
2382
|
+
this.maybeReportBlockedInstall(err, "update");
|
|
2383
|
+
throw err;
|
|
2384
|
+
}
|
|
2385
|
+
finally {
|
|
2386
|
+
this.observeNpmInstall("update", capturedFetchResult, outcome, Date.now() - installStart, capturedPackageManager);
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
1791
2389
|
async installSpecificPackages(packages, abortSignal, options) {
|
|
1792
2390
|
if (!packages || packages.length === 0) {
|
|
1793
2391
|
throw new Error("No packages specified for installation");
|