@superblocksteam/vite-plugin-file-sync 2.0.0-SNAPSHOT.84af65cd215b6ca1 → 2.0.0-SNAPSHOT.8b97ef3ec8173084
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/build-base-system-prompt.d.ts.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js +18 -16
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
- package/dist/ai-service/agent/tool-result-metrics.d.ts +10 -1
- package/dist/ai-service/agent/tool-result-metrics.d.ts.map +1 -1
- package/dist/ai-service/agent/tool-result-metrics.js +13 -2
- package/dist/ai-service/agent/tool-result-metrics.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.d.ts +51 -2
- package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.js +136 -12
- package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -1
- package/dist/ai-service/agent/tools/build-copy-directory.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-copy-file.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-copy-utils.d.ts +8 -8
- package/dist/ai-service/agent/tools/build-delete-file.d.ts +1 -2
- package/dist/ai-service/agent/tools/build-delete-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-delete-file.js +2 -0
- package/dist/ai-service/agent/tools/build-delete-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-edit-file.d.ts +1 -2
- package/dist/ai-service/agent/tools/build-edit-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-edit-file.js +2 -0
- package/dist/ai-service/agent/tools/build-edit-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-install-packages.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-manage-checklist.d.ts +2 -2
- package/dist/ai-service/agent/tools/build-multi-edit-file.d.ts +1 -2
- package/dist/ai-service/agent/tools/build-multi-edit-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-multi-edit-file.js +2 -0
- package/dist/ai-service/agent/tools/build-multi-edit-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-read-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-read-file.js +31 -18
- package/dist/ai-service/agent/tools/build-read-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-rename-file.d.ts +1 -2
- package/dist/ai-service/agent/tools/build-rename-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-rename-file.js +2 -0
- package/dist/ai-service/agent/tools/build-rename-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-write-file.d.ts +2 -2
- package/dist/ai-service/agent/tools/build-write-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-write-file.js +11 -2
- package/dist/ai-service/agent/tools/build-write-file.js.map +1 -1
- package/dist/ai-service/agent/tools/debug-cache.d.ts +11 -0
- package/dist/ai-service/agent/tools/debug-cache.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/debug-cache.js +62 -14
- package/dist/ai-service/agent/tools/debug-cache.js.map +1 -1
- package/dist/ai-service/agent/tools/get-logs.d.ts +3 -3
- package/dist/ai-service/agent/tools/integrations/execute-request.d.ts +34 -34
- package/dist/ai-service/agent/tools/page-edit-guidance.d.ts +2 -0
- package/dist/ai-service/agent/tools/page-edit-guidance.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/page-edit-guidance.js +11 -0
- package/dist/ai-service/agent/tools/page-edit-guidance.js.map +1 -0
- package/dist/ai-service/agent/tools/report-security-findings.d.ts +15 -15
- package/dist/ai-service/agent/tools.d.ts +32 -0
- package/dist/ai-service/agent/tools.d.ts.map +1 -1
- package/dist/ai-service/agent/tools.js +54 -33
- package/dist/ai-service/agent/tools.js.map +1 -1
- package/dist/ai-service/agent/tools2/registry.d.ts +1 -1
- package/dist/ai-service/agent/tools2/registry.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/registry.js +21 -4
- package/dist/ai-service/agent/tools2/registry.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/git.d.ts +2 -2
- package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts +1 -1
- package/dist/ai-service/agent/tools2/tools/grep.d.ts +1 -1
- package/dist/ai-service/agent/tools2/tools/list-attachments.d.ts +1 -1
- package/dist/ai-service/agent/tools2/tools/update-test-case-status.d.ts +2 -2
- package/dist/ai-service/agent/tools2/tools/web-fetch.d.ts +1 -1
- package/dist/ai-service/app-interface/filesystem/draft-manager.d.ts +2 -1
- package/dist/ai-service/app-interface/filesystem/draft-manager.d.ts.map +1 -1
- package/dist/ai-service/app-interface/filesystem/draft-manager.js +3 -0
- package/dist/ai-service/app-interface/filesystem/draft-manager.js.map +1 -1
- package/dist/ai-service/app-interface/shell.d.ts +28 -8
- package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
- package/dist/ai-service/app-interface/shell.js +118 -94
- package/dist/ai-service/app-interface/shell.js.map +1 -1
- package/dist/ai-service/app-interface/typecheck-output-parser.d.ts +9 -0
- package/dist/ai-service/app-interface/typecheck-output-parser.d.ts.map +1 -0
- package/dist/ai-service/app-interface/typecheck-output-parser.js +21 -0
- package/dist/ai-service/app-interface/typecheck-output-parser.js.map +1 -0
- package/dist/ai-service/attachments/parse-data-url.d.ts +5 -0
- package/dist/ai-service/attachments/parse-data-url.d.ts.map +1 -0
- package/dist/ai-service/attachments/parse-data-url.js +14 -0
- package/dist/ai-service/attachments/parse-data-url.js.map +1 -0
- package/dist/ai-service/chat/chat-session-store.d.ts +0 -8
- package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
- package/dist/ai-service/chat/chat-session-store.js +34 -611
- package/dist/ai-service/chat/chat-session-store.js.map +1 -1
- package/dist/ai-service/chat/utils.d.ts +2 -6
- package/dist/ai-service/chat/utils.d.ts.map +1 -1
- package/dist/ai-service/chat/utils.js +2 -95
- package/dist/ai-service/chat/utils.js.map +1 -1
- package/dist/ai-service/index.d.ts +10 -8
- package/dist/ai-service/index.d.ts.map +1 -1
- package/dist/ai-service/index.js +128 -54
- package/dist/ai-service/index.js.map +1 -1
- package/dist/ai-service/judge/tools/playwright-action.d.ts +1 -1
- package/dist/ai-service/llm/client.d.ts.map +1 -1
- package/dist/ai-service/llm/client.js +4 -4
- package/dist/ai-service/llm/client.js.map +1 -1
- package/dist/ai-service/llm/context-v2/context.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/context.js +10 -5
- package/dist/ai-service/llm/context-v2/context.js.map +1 -1
- package/dist/ai-service/llm/context-v2/phase1-tool-summarizer.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/phase1-tool-summarizer.js +2 -1
- package/dist/ai-service/llm/context-v2/phase1-tool-summarizer.js.map +1 -1
- package/dist/ai-service/llm/context-v2/truncation-fallback.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/truncation-fallback.js +2 -1
- package/dist/ai-service/llm/context-v2/truncation-fallback.js.map +1 -1
- package/dist/ai-service/llm/context-v2/well-formed-text.d.ts +24 -0
- package/dist/ai-service/llm/context-v2/well-formed-text.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/well-formed-text.js +73 -0
- package/dist/ai-service/llm/context-v2/well-formed-text.js.map +1 -0
- package/dist/ai-service/llm/stream/observers/logging.d.ts +6 -0
- package/dist/ai-service/llm/stream/observers/logging.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/observers/logging.js +44 -3
- package/dist/ai-service/llm/stream/observers/logging.js.map +1 -1
- package/dist/ai-service/llm/stream/orchestrator.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/orchestrator.js +8 -2
- package/dist/ai-service/llm/stream/orchestrator.js.map +1 -1
- package/dist/ai-service/security/secret-scanner-service.d.ts +3 -6
- package/dist/ai-service/security/secret-scanner-service.d.ts.map +1 -1
- package/dist/ai-service/security/secret-scanner-service.js +229 -97
- package/dist/ai-service/security/secret-scanner-service.js.map +1 -1
- package/dist/ai-service/security/secret-scanner.d.ts +28 -5
- package/dist/ai-service/security/secret-scanner.d.ts.map +1 -1
- package/dist/ai-service/security/secret-scanner.js +197 -42
- package/dist/ai-service/security/secret-scanner.js.map +1 -1
- 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 +58 -7
- package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.js.map +1 -1
- 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 -0
- package/dist/ai-service/skills/system/third-party-migration/skill.generated.js.map +1 -1
- package/dist/ai-service/state-machine/clark-fsm.d.ts +2 -0
- package/dist/ai-service/state-machine/clark-fsm.d.ts.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 +1 -11
- package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/runtime-reviewing.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/runtime-reviewing.js +21 -2
- package/dist/ai-service/state-machine/handlers/runtime-reviewing.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/prompt-request-metrics.d.ts +1 -1
- package/dist/ai-service/transform/api-builder/shared.d.ts.map +1 -1
- package/dist/ai-service/transform/api-builder/shared.js +2 -1
- package/dist/ai-service/transform/api-builder/shared.js.map +1 -1
- package/dist/dev-server-ws-smoke-client.d.ts.map +1 -1
- package/dist/dev-server-ws-smoke-client.js +1 -0
- package/dist/dev-server-ws-smoke-client.js.map +1 -1
- package/dist/draft-interface.d.ts +8 -0
- package/dist/draft-interface.d.ts.map +1 -1
- package/dist/file-sync-vite-plugin.d.ts +17 -1
- package/dist/file-sync-vite-plugin.d.ts.map +1 -1
- package/dist/file-sync-vite-plugin.js +125 -10
- package/dist/file-sync-vite-plugin.js.map +1 -1
- package/dist/file-system-helpers.d.ts +2 -2
- package/dist/file-system-helpers.d.ts.map +1 -1
- package/dist/file-system-helpers.js +2 -12
- package/dist/file-system-helpers.js.map +1 -1
- package/dist/lock-service/index.d.ts +1 -0
- package/dist/lock-service/index.d.ts.map +1 -1
- package/dist/lock-service/index.js +14 -7
- package/dist/lock-service/index.js.map +1 -1
- package/dist/migration-templates/app-fullstack/.gitignore +50 -0
- package/dist/parsing/imports.d.ts +22 -0
- package/dist/parsing/imports.d.ts.map +1 -1
- package/dist/parsing/imports.js +71 -0
- package/dist/parsing/imports.js.map +1 -1
- package/dist/parsing/page.d.ts.map +1 -1
- package/dist/parsing/page.js +3 -9
- package/dist/parsing/page.js.map +1 -1
- package/dist/parsing/parse-tsx-module.d.ts +4 -0
- package/dist/parsing/parse-tsx-module.d.ts.map +1 -0
- package/dist/parsing/parse-tsx-module.js +13 -0
- package/dist/parsing/parse-tsx-module.js.map +1 -0
- package/dist/plugin-options.d.ts +4 -0
- package/dist/plugin-options.d.ts.map +1 -1
- package/dist/plugin-options.js.map +1 -1
- package/dist/policy-gate-callback-mapper.d.ts +2 -1
- package/dist/policy-gate-callback-mapper.d.ts.map +1 -1
- package/dist/policy-gate-callback-mapper.js +3 -5
- package/dist/policy-gate-callback-mapper.js.map +1 -1
- package/dist/policy-gate-run-registry.d.ts +4 -2
- package/dist/policy-gate-run-registry.d.ts.map +1 -1
- package/dist/policy-gate-run-registry.js +17 -2
- package/dist/policy-gate-run-registry.js.map +1 -1
- package/dist/policy-gate-runner.d.ts.map +1 -1
- package/dist/policy-gate-runner.js +36 -7
- package/dist/policy-gate-runner.js.map +1 -1
- package/dist/resolver.d.ts +2 -1
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +4 -6
- package/dist/resolver.js.map +1 -1
- package/dist/router-parser-metrics.d.ts +2 -0
- package/dist/router-parser-metrics.d.ts.map +1 -0
- package/dist/router-parser-metrics.js +13 -0
- package/dist/router-parser-metrics.js.map +1 -0
- package/dist/router-parser.d.ts +11 -1
- package/dist/router-parser.d.ts.map +1 -1
- package/dist/router-parser.js +43 -16
- package/dist/router-parser.js.map +1 -1
- package/dist/scan-scope-merge.d.ts +1 -1
- package/dist/scan-scope-merge.js +1 -1
- package/dist/socket-manager.d.ts.map +1 -1
- package/dist/socket-manager.js +75 -28
- package/dist/socket-manager.js.map +1 -1
- package/dist/source-tracker.d.ts.map +1 -1
- package/dist/source-tracker.js +2 -6
- package/dist/source-tracker.js.map +1 -1
- package/dist/sync-service/index.d.ts +8 -21
- package/dist/sync-service/index.d.ts.map +1 -1
- package/dist/sync-service/index.js +130 -46
- package/dist/sync-service/index.js.map +1 -1
- package/dist/sync-service/page-reference-guard.d.ts +17 -0
- package/dist/sync-service/page-reference-guard.d.ts.map +1 -0
- package/dist/sync-service/page-reference-guard.js +170 -0
- package/dist/sync-service/page-reference-guard.js.map +1 -0
- package/dist/sync-service/snapshot/upload-snapshot.d.ts.map +1 -1
- package/dist/sync-service/snapshot/upload-snapshot.js +20 -0
- package/dist/sync-service/snapshot/upload-snapshot.js.map +1 -1
- package/dist/util/logger.d.ts +2 -0
- package/dist/util/logger.d.ts.map +1 -1
- package/dist/util/logger.js.map +1 -1
- package/dist/util.d.ts +3 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +2 -2
- package/dist/util.js.map +1 -1
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-base-system-prompt.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/agent/prompts/build-base-system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACd,MAAM,uCAAuC,CAAC;AAQ/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAStD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,wBAAwB,EAAE,OAAO,CAAC;IAClC,MAAM,CAAC,EAAE,YAAY,GAAG,gBAAgB,GAAG,aAAa,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,iBAAiB,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAEpE;AAED,eAAO,MAAM,qBAAqB,GAChC,QAAQ,eAAe,EACvB,OAAO,MAAM,EACb,eAAe,MAAM,EACrB,sBAAsB,MAAM,EAC5B,yBAAyB,MAAM,EAC/B,iBAAiB,cAAc,EAC/B,mCAAiC,EACjC,YAAY,aAAa,EACzB,wCAAsC,EACtC,UAAU,mBAAmB,
|
|
1
|
+
{"version":3,"file":"build-base-system-prompt.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/agent/prompts/build-base-system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACd,MAAM,uCAAuC,CAAC;AAQ/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAStD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,wBAAwB,EAAE,OAAO,CAAC;IAClC,MAAM,CAAC,EAAE,YAAY,GAAG,gBAAgB,GAAG,aAAa,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,iBAAiB,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAEpE;AAED,eAAO,MAAM,qBAAqB,GAChC,QAAQ,eAAe,EACvB,OAAO,MAAM,EACb,eAAe,MAAM,EACrB,sBAAsB,MAAM,EAC5B,yBAAyB,MAAM,EAC/B,iBAAiB,cAAc,EAC/B,mCAAiC,EACjC,YAAY,aAAa,EACzB,wCAAsC,EACtC,UAAU,mBAAmB,WA6e9B,CAAC;AA+oBF;;;;;;;;;GASG;AACH,wBAAgB,iCAAiC,CAC/C,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACnD,SAAS,CAAC,EAAE,aAAa,GACxB,MAAM,CAiBR"}
|
|
@@ -96,6 +96,7 @@ ${config.features.integrationSetupEnabled
|
|
|
96
96
|
In 'Build' mode, you have full access to all tools that allow you to read and write files, modify application components, and interact with data sources and integrations.
|
|
97
97
|
Before editing a file, you should read it first to understand its current state.
|
|
98
98
|
Edits to unread files will be rejected.
|
|
99
|
+
When an edit or write reports success, the change landed. Do not re-read the file just to verify it.
|
|
99
100
|
|
|
100
101
|
**Remembering Application Knowledge:**
|
|
101
102
|
If the user says "/remember", "remember this", "always use X", "make sure you never Y", or otherwise asks you to save a persistent preference or rule about this application, first check existing knowledge entries via available read tools (\`build_readFile\` over \`skills/app/*\` and relevant on-demand knowledge files) and avoid drafting duplicates. Then call \`rememberKnowledge\` to draft entries for approval only when net-new or revised knowledge is needed.
|
|
@@ -186,6 +187,7 @@ Only start the Git setup flow when the user explicitly asks to connect or use Gi
|
|
|
186
187
|
? buildAppBuilderModelGuidanceBlock(config.features.appBuilderModelGuidance, coreModel)
|
|
187
188
|
: "";
|
|
188
189
|
const sdkApiEnabled = config.features.sdkApiEnabled ?? false;
|
|
190
|
+
const frontendPathPrefix = sdkApiEnabled ? "client/" : "";
|
|
189
191
|
const thirdPartyImportEnabled = config.features.thirdPartyImportEnabled ?? false;
|
|
190
192
|
const currentDate = new Date().toISOString().split("T")[0];
|
|
191
193
|
const useSkills = config.features.useSystemSkills;
|
|
@@ -197,7 +199,7 @@ Only start the Git setup flow when the user explicitly asks to connect or use Gi
|
|
|
197
199
|
// Use detailed guidance sections if skills are disabled OR if skills failed to load
|
|
198
200
|
const detailedGuidance = skillsLoaded
|
|
199
201
|
? ""
|
|
200
|
-
: buildDetailedGuidanceSections(sdkApiEnabled);
|
|
202
|
+
: buildDetailedGuidanceSections(sdkApiEnabled, frontendPathPrefix);
|
|
201
203
|
// Log knowledge sections for debugging
|
|
202
204
|
logger.info("Building system prompt with knowledge sections", {
|
|
203
205
|
hasAlwaysInjectFacts: !!factsSection,
|
|
@@ -349,9 +351,9 @@ ALWAYS read components using tools like \`grep\` and \`glob\` when you do not ha
|
|
|
349
351
|
- Note: The tool will automatically prompt users for API and page deletions, so be confident in your deletions
|
|
350
352
|
|
|
351
353
|
**Page names must DESCRIBE the page:**
|
|
352
|
-
- A new app starts with one empty page at
|
|
354
|
+
- A new app starts with one empty page at \`${frontendPathPrefix}pages/Home\` wired as the \`/\` index route — build the app's landing content there and keep it named \`Home\` unless the user asks for something else
|
|
353
355
|
- In a multi-page app, every page you add beyond that one gets a descriptive PascalCase name for what it shows (e.g. \`Dashboard\`, \`Inventory\`, \`TopBuilders\`) — page names are user-visible in the editor's page switcher, so name them the way you'd label a nav item
|
|
354
|
-
- Rename the starter page only if the app's landing route is really something other than a home page (e.g. \`Overview\`):
|
|
356
|
+
- Rename the starter page only if the app's landing route is really something other than a home page (e.g. \`Overview\`): create or copy every file under \`${frontendPathPrefix}pages/Home/\` into the new directory and wait for each operation to complete without an error, update \`${frontendPathPrefix}router.tsx\` and wait for it to complete without an error, then delete the old files. Never use \`build_renameFile\` for a page while the router references its old path. Keep the landing page as the \`/\` index route
|
|
355
357
|
- NEVER name a page \`Page1\` (or \`Page2\`, \`Page3\`, ...)
|
|
356
358
|
|
|
357
359
|
**Seeking user input is CRITICAL:**
|
|
@@ -566,13 +568,13 @@ Load knowledge that matches your current task before implementing solutions.
|
|
|
566
568
|
* Detailed guidance sections - only included when skills feature is DISABLED.
|
|
567
569
|
* When skills are enabled, this content is available via skill files instead.
|
|
568
570
|
*/
|
|
569
|
-
function buildDetailedGuidanceSections(sdkApiEnabled) {
|
|
571
|
+
function buildDetailedGuidanceSections(sdkApiEnabled, frontendPathPrefix) {
|
|
570
572
|
return /*md*/ `
|
|
571
573
|
<visual_excellence_first>
|
|
572
574
|
**CRITICAL: Prioritize Visual Excellence from the Start**
|
|
573
575
|
|
|
574
576
|
When building applications, follow this hierarchy:
|
|
575
|
-
1. **Design System Enhancement**: Start by enhancing index.css with app-specific colors, shadows, gradients, and utilities that match the target aesthetic
|
|
577
|
+
1. **Design System Enhancement**: Start by enhancing ${frontendPathPrefix}index.css with app-specific colors, shadows, gradients, and utilities that match the target aesthetic
|
|
576
578
|
2. **Professional Layout Architecture**: Use sophisticated layouts with proper spacing, responsive design, and visual hierarchy - not just basic container stacking
|
|
577
579
|
3. **Rich Interactive Components**: Leverage advanced components (cards, sliders, dropdowns, toggles) with proper variants and states
|
|
578
580
|
4. **Visual Polish**: Add depth through shadows, smooth transitions, skeleton loaders for loading states, hover effects, and proper typography hierarchy
|
|
@@ -724,7 +726,7 @@ function MyComponent() {
|
|
|
724
726
|
## App.tsx Layout Structure
|
|
725
727
|
|
|
726
728
|
**For single-page applications:**
|
|
727
|
-
- Put all content in pages/<pageName>/index.tsx
|
|
729
|
+
- Put all content in ${frontendPathPrefix}pages/<pageName>/index.tsx
|
|
728
730
|
- Use components to compose and build the page
|
|
729
731
|
- Keep App.tsx minimal with just <AppProvider> and <Outlet />
|
|
730
732
|
|
|
@@ -808,7 +810,7 @@ ${sdkApiEnabled ? "" : buildYamlApiSection()}
|
|
|
808
810
|
You **must** use \`react-router@7\` in data mode for routing. The framework and declarative modes are **not** supported.
|
|
809
811
|
Standard patterns apply: \`useNavigate()\`, \`useParams()\`, \`useSearchParams()\`.
|
|
810
812
|
If you add new pages or rename page files or export names, you **must** update the router.
|
|
811
|
-
The starter
|
|
813
|
+
The starter \`${frontendPathPrefix}pages/Home\` page is bound to the \`/\` index route; keep an index route wired to whichever page is the app's landing page.
|
|
812
814
|
</navigation>
|
|
813
815
|
|
|
814
816
|
<component_usage_guidance>
|
|
@@ -835,7 +837,7 @@ When building ANY feature:
|
|
|
835
837
|
|
|
836
838
|
**❌ WRONG - Everything in one page file (NEVER DO THIS):**
|
|
837
839
|
\`\`\`tsx
|
|
838
|
-
// pages/Products/index.tsx - BAD! Monolithic page
|
|
840
|
+
// ${frontendPathPrefix}pages/Products/index.tsx - BAD! Monolithic page
|
|
839
841
|
const ProductsPage = () => {
|
|
840
842
|
return (
|
|
841
843
|
<div className="flex flex-col gap-3">
|
|
@@ -853,7 +855,7 @@ const ProductsPage = () => {
|
|
|
853
855
|
|
|
854
856
|
**✅ CORRECT - Break into components:**
|
|
855
857
|
\`\`\`tsx
|
|
856
|
-
// components/ProductCard/index.tsx - Extract to component
|
|
858
|
+
// ${frontendPathPrefix}components/ProductCard/index.tsx - Extract to component
|
|
857
859
|
import { Card } from "@/components/ui/card";
|
|
858
860
|
import { Button } from "@/components/ui/button";
|
|
859
861
|
|
|
@@ -875,7 +877,7 @@ export default function ProductCard(props: ProductCardProps) {
|
|
|
875
877
|
);
|
|
876
878
|
}
|
|
877
879
|
|
|
878
|
-
// pages/Products/index.tsx - Clean composition
|
|
880
|
+
// ${frontendPathPrefix}pages/Products/index.tsx - Clean composition
|
|
879
881
|
import { useState } from "react";
|
|
880
882
|
import ProductCard from "@/components/ProductCard";
|
|
881
883
|
|
|
@@ -911,7 +913,7 @@ You should create a component when (examples, not exhaustive):
|
|
|
911
913
|
### Example: List Component with Filtering
|
|
912
914
|
|
|
913
915
|
\`\`\`tsx
|
|
914
|
-
// components/ProductGrid/index.tsx
|
|
916
|
+
// ${frontendPathPrefix}components/ProductGrid/index.tsx
|
|
915
917
|
import { Card } from "@/components/ui/card";
|
|
916
918
|
|
|
917
919
|
type ProductGridProps = {
|
|
@@ -958,7 +960,7 @@ export default function ProductGrid(props: ProductGridProps) {
|
|
|
958
960
|
|
|
959
961
|
Pass data from page state to component props:
|
|
960
962
|
\`\`\`tsx
|
|
961
|
-
// pages/Products/index.tsx
|
|
963
|
+
// ${frontendPathPrefix}pages/Products/index.tsx
|
|
962
964
|
import { useState } from "react";
|
|
963
965
|
import {
|
|
964
966
|
Select,
|
|
@@ -1012,7 +1014,7 @@ const ProductsPage = () => {
|
|
|
1012
1014
|
<design_system_guidance>
|
|
1013
1015
|
## Tailwind CSS v4 Design System
|
|
1014
1016
|
|
|
1015
|
-
**All design tokens are defined in
|
|
1017
|
+
**All design tokens are defined in \`${frontendPathPrefix}index.css\`**. Apps come with a professional black-and-white theme by default.
|
|
1016
1018
|
|
|
1017
1019
|
### Semantic Tokens Rule
|
|
1018
1020
|
**ALWAYS use semantic tokens** (\`bg-background\`, \`text-foreground\`, \`border-border\`, \`shadow-card\`) — NEVER raw Tailwind utilities (\`bg-white\`, \`text-black\`, \`shadow-lg\`).
|
|
@@ -1021,7 +1023,7 @@ const ProductsPage = () => {
|
|
|
1021
1023
|
❌ WRONG: \`<Card className="bg-white text-black border-gray-200" />\`
|
|
1022
1024
|
|
|
1023
1025
|
### When to Modify index.css
|
|
1024
|
-
Only modify
|
|
1026
|
+
Only modify \`${frontendPathPrefix}index.css\` when:
|
|
1025
1027
|
- User explicitly requests branding/theme changes
|
|
1026
1028
|
- Replicating a specific brand look (e.g., Yelp, Instacart)
|
|
1027
1029
|
- Feature requests (lists, filters, CRUD) do NOT require changes
|
|
@@ -1048,11 +1050,11 @@ Create reusable component variants instead of one-off styles:
|
|
|
1048
1050
|
Variants use semantic tokens and are defined in component files using \`cva()\`.
|
|
1049
1051
|
|
|
1050
1052
|
## Component System
|
|
1051
|
-
All base UI components in the
|
|
1053
|
+
All base UI components in the \`${frontendPathPrefix}components/ui\` directory are Shadcn/Radix UI components and adhere to the Shadcn design system.
|
|
1052
1054
|
|
|
1053
1055
|
You should always attempt to use an existing component before creating a new one.
|
|
1054
1056
|
|
|
1055
|
-
**REQUIRED:** Grep for an existing component in the
|
|
1057
|
+
**REQUIRED:** Grep for an existing component in the \`${frontendPathPrefix}components/ui\` directory and read it's source code if you believe you already have a component that resolves the user's request. If there is not, you can create your own component in the \`${frontendPathPrefix}components\` directory.
|
|
1056
1058
|
</design_system_guidance>
|
|
1057
1059
|
`;
|
|
1058
1060
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-base-system-prompt.js","sourceRoot":"","sources":["../../../../src/ai-service/agent/prompts/build-base-system-prompt.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,GAAG,iBAAiB,CAAC,4BAA4B,CAAC,CAAC;AA4C/D;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,UAAmB;IACzD,OAAO,UAAU,KAAK,SAAS,CAAC;AAClC,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,MAAuB,EACvB,IAAa,EACb,YAAqB,EACrB,mBAA4B,EAC5B,sBAA+B,EAC/B,cAA+B,EAC/B,yBAAyB,GAAG,KAAK,EACjC,SAAyB,EACzB,8BAA8B,GAAG,KAAK,EACtC,OAA6B,EAC7B,EAAE;IACF,MAAM,qBAAqB,GAAG,OAAO,EAAE,OAAO,KAAK,iBAAiB,CAAC;IACrE,uEAAuE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,EAAE;;;;;;;;EASrzB,MAAM,CAAC,QAAQ,CAAC,uBAAuB;YACrC,CAAC,CAAC;;;;;;;;;;;qLAW+K;YACjL,CAAC,CAAC,EACN
|
|
1
|
+
{"version":3,"file":"build-base-system-prompt.js","sourceRoot":"","sources":["../../../../src/ai-service/agent/prompts/build-base-system-prompt.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,GAAG,iBAAiB,CAAC,4BAA4B,CAAC,CAAC;AA4C/D;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,UAAmB;IACzD,OAAO,UAAU,KAAK,SAAS,CAAC;AAClC,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,MAAuB,EACvB,IAAa,EACb,YAAqB,EACrB,mBAA4B,EAC5B,sBAA+B,EAC/B,cAA+B,EAC/B,yBAAyB,GAAG,KAAK,EACjC,SAAyB,EACzB,8BAA8B,GAAG,KAAK,EACtC,OAA6B,EAC7B,EAAE;IACF,MAAM,qBAAqB,GAAG,OAAO,EAAE,OAAO,KAAK,iBAAiB,CAAC;IACrE,uEAAuE;IACvE,2EAA2E;IAC3E,2EAA2E;IAC3E,aAAa;IACb,MAAM,kBAAkB,GAA6C,CAAC,MAAM;SACzE,QAAQ,CAAC,gBAAgB;QAC1B,CAAC,CAAC,SAAS;QAC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yBAAyB;;CAE1O,CAAC;AACF,CAAC;AAED,MAAM,uBAAuB,GAAG,MAAM,CAAC;;;;;;;;CAQtC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Tool } from "./tools2/types.js";
|
|
2
2
|
export declare const DEFAULT_MAX_OUTPUT_CHARS = 25000;
|
|
3
3
|
export declare const TOOL_EXECUTION_RESULT_CHARS_METRIC = "superblocks.clark.tool.execution.result_chars";
|
|
4
|
+
export type ToolExecutionOutcome = "error" | "success" | "timeout";
|
|
4
5
|
/**
|
|
5
6
|
* Character length of a tool result as the model receives it.
|
|
6
7
|
*
|
|
@@ -15,6 +16,14 @@ export declare function measureToolResultChars(tool: Pick<Tool, "toModelOutput">
|
|
|
15
16
|
output: unknown;
|
|
16
17
|
toolCallId: string;
|
|
17
18
|
}): number;
|
|
18
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Character length of a thrown tool result as the model receives it.
|
|
21
|
+
*
|
|
22
|
+
* Failed tools never go through `toModelOutput`; the AI SDK puts
|
|
23
|
+
* `error.message` (or `String(error)`) into the conversation, so measuring
|
|
24
|
+
* the successful converter would miss the text that actually lands.
|
|
25
|
+
*/
|
|
26
|
+
export declare function measureThrownToolResultChars(error: unknown): number;
|
|
27
|
+
export declare function recordToolExecutionResultChars(toolName: string, chars: number, stepNumber: number, outcome: ToolExecutionOutcome): void;
|
|
19
28
|
export declare function _resetToolResultMetricsForTesting(): void;
|
|
20
29
|
//# sourceMappingURL=tool-result-metrics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result-metrics.d.ts","sourceRoot":"","sources":["../../../src/ai-service/agent/tool-result-metrics.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAI9C,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAG/C,eAAO,MAAM,kCAAkC,kDACE,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-result-metrics.d.ts","sourceRoot":"","sources":["../../../src/ai-service/agent/tool-result-metrics.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAI9C,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAG/C,eAAO,MAAM,kCAAkC,kDACE,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAyEnE;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,EACjC,IAAI,EAAE;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC5D,MAAM,CA2DR;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAInE;AAYD,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,oBAAoB,GAC5B,IAAI,CAON;AAUD,wBAAgB,iCAAiC,IAAI,IAAI,CAGxD"}
|
|
@@ -40,7 +40,7 @@ function resolveResultCharsHistogram() {
|
|
|
40
40
|
cachedMeter = meter;
|
|
41
41
|
cachedResultCharsHistogram = meter.createHistogram(TOOL_EXECUTION_RESULT_CHARS_METRIC, {
|
|
42
42
|
advice: { explicitBucketBoundaries: RESULT_CHARS_BUCKET_BOUNDARIES },
|
|
43
|
-
description: "Character length of the text a Clark tool result adds to the conversation.",
|
|
43
|
+
description: "Character length of the text a Clark tool result adds to the conversation, including failed and timed-out calls.",
|
|
44
44
|
unit: "{char}",
|
|
45
45
|
});
|
|
46
46
|
return cachedResultCharsHistogram;
|
|
@@ -121,6 +121,16 @@ export function measureToolResultChars(tool, args) {
|
|
|
121
121
|
return serializedLength(modelOutput);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Character length of a thrown tool result as the model receives it.
|
|
126
|
+
*
|
|
127
|
+
* Failed tools never go through `toModelOutput`; the AI SDK puts
|
|
128
|
+
* `error.message` (or `String(error)`) into the conversation, so measuring
|
|
129
|
+
* the successful converter would miss the text that actually lands.
|
|
130
|
+
*/
|
|
131
|
+
export function measureThrownToolResultChars(error) {
|
|
132
|
+
return serializedLength(error instanceof Error ? error.message : String(error));
|
|
133
|
+
}
|
|
124
134
|
function contentPartTextLength(part) {
|
|
125
135
|
if (!part || typeof part !== "object") {
|
|
126
136
|
return 0;
|
|
@@ -130,8 +140,9 @@ function contentPartTextLength(part) {
|
|
|
130
140
|
? typed.text.length
|
|
131
141
|
: 0;
|
|
132
142
|
}
|
|
133
|
-
export function recordToolExecutionResultChars(toolName, chars, stepNumber) {
|
|
143
|
+
export function recordToolExecutionResultChars(toolName, chars, stepNumber, outcome) {
|
|
134
144
|
resolveResultCharsHistogram().record(chars, {
|
|
145
|
+
outcome,
|
|
135
146
|
over_char_limit: String(chars > DEFAULT_MAX_OUTPUT_CHARS),
|
|
136
147
|
step_number: formatStepNumber(stepNumber),
|
|
137
148
|
tool_name: toolName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result-metrics.js","sourceRoot":"","sources":["../../../src/ai-service/agent/tool-result-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,oBAAoB,CAAC;AAIzD,yGAAyG;AACzG,uDAAuD;AACvD,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAE/C,MAAM,UAAU,GAAG,kCAAkC,CAAC;AACtD,MAAM,CAAC,MAAM,kCAAkC,GAC7C,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-result-metrics.js","sourceRoot":"","sources":["../../../src/ai-service/agent/tool-result-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,M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IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACnD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACpC,OAAO,IAAI,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,gBAAgB,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,iCAAiC;IAC/C,WAAW,GAAG,SAAS,CAAC;IACxB,0BAA0B,GAAG,SAAS,CAAC;AACzC,CAAC"}
|
|
@@ -55,7 +55,7 @@ export declare function buildIntegrationDocumentation(integrationIds: string[],
|
|
|
55
55
|
export declare function getRelevantExamples(integrationIds: string[], services: ClarkStateHandlerParams): string;
|
|
56
56
|
export declare const getApiDocsToolFactory: import("../../tools2/types.js").ToolFactory<ClarkStateHandlerParams, import("../../tools2/types.js").Tool<{
|
|
57
57
|
integrationIds?: string[] | undefined;
|
|
58
|
-
sections?: ("checklist" | "examples" | "error-handling" | "core" | "
|
|
58
|
+
sections?: ("types" | "checklist" | "examples" | "error-handling" | "core" | "integration-workflow" | "scoping" | "patterns" | "sql-best-practices" | "database-naming" | "response-interface" | "runtime-safety" | "error-recovery" | "loop-control" | "api-structure" | "critical-mistakes" | "built-in-blocks")[] | undefined;
|
|
59
59
|
verbosity?: "minimal" | "standard" | "comprehensive" | undefined;
|
|
60
60
|
}, {
|
|
61
61
|
documentation: string;
|
|
@@ -8,10 +8,59 @@ export declare const testApiToolFactory: import("../../tools2/types.js").ToolFac
|
|
|
8
8
|
clark: Clark;
|
|
9
9
|
services: ClarkStateHandlerParams;
|
|
10
10
|
}, import("../../tools2/types.js").Tool<{
|
|
11
|
-
inputs: Record<string, any>;
|
|
12
11
|
apiName: string;
|
|
12
|
+
inputs: Record<string, any>;
|
|
13
13
|
timeout?: number | undefined;
|
|
14
14
|
description?: string | undefined;
|
|
15
15
|
omitStepOutputs?: boolean | undefined;
|
|
16
|
-
},
|
|
16
|
+
}, {
|
|
17
|
+
message: string;
|
|
18
|
+
result: {
|
|
19
|
+
issueCount?: number | undefined;
|
|
20
|
+
includedIssueCount?: number | undefined;
|
|
21
|
+
isPartial?: boolean | undefined;
|
|
22
|
+
success: boolean;
|
|
23
|
+
error: {
|
|
24
|
+
code: string;
|
|
25
|
+
message: string;
|
|
26
|
+
details?: unknown;
|
|
27
|
+
} | undefined;
|
|
28
|
+
systemError?: undefined;
|
|
29
|
+
};
|
|
30
|
+
apiName: string;
|
|
31
|
+
} | {
|
|
32
|
+
message: string;
|
|
33
|
+
result: {
|
|
34
|
+
isPartial?: boolean | undefined;
|
|
35
|
+
success: boolean;
|
|
36
|
+
outputs: {};
|
|
37
|
+
systemError?: undefined;
|
|
38
|
+
};
|
|
39
|
+
apiName: string;
|
|
40
|
+
} | {
|
|
41
|
+
message: string;
|
|
42
|
+
result: {
|
|
43
|
+
success: boolean;
|
|
44
|
+
systemError: string;
|
|
45
|
+
};
|
|
46
|
+
apiName: string;
|
|
47
|
+
} | {
|
|
48
|
+
message: string;
|
|
49
|
+
result: import("./api-executor.js").ApiExecutionResult;
|
|
50
|
+
apiName: string;
|
|
51
|
+
} | {
|
|
52
|
+
message: string;
|
|
53
|
+
result: {
|
|
54
|
+
outputs: string;
|
|
55
|
+
stepOutputs: Record<string, {
|
|
56
|
+
error?: any;
|
|
57
|
+
output?: any;
|
|
58
|
+
}> | undefined;
|
|
59
|
+
success: boolean;
|
|
60
|
+
errors?: import("./api-executor.js").ApiExecutionError[];
|
|
61
|
+
systemError?: string;
|
|
62
|
+
executionTime?: number;
|
|
63
|
+
};
|
|
64
|
+
apiName: string;
|
|
65
|
+
}>>;
|
|
17
66
|
//# sourceMappingURL=test-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-api.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/agent/tools/apis/test-api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test-api.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/agent/tools/apis/test-api.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EACV,KAAK,EACL,uBAAuB,EACxB,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAEL,eAAe,EAGhB,MAAM,uBAAuB,CAAC;AAo4B/B,eAAO,MAAM,uBAAuB,GAClC,UAAU,uBAAuB,EACjC,QAAQ;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EAClD,SAAS,KAAK,KACb,OAAO,CAAC,eAAe,CAkEzB,CAAC;AAEF,eAAO,MAAM,kBAAkB;WAMpB,KAAK;cACF,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqLpC,CAAC"}
|
|
@@ -3,13 +3,14 @@ import { z } from "zod";
|
|
|
3
3
|
import { AiEntityType, AiPermissionType, } from "@superblocksteam/library-shared/types";
|
|
4
4
|
import { DATABASE_LIFECYCLE_MANAGED_BY, LanguagePluginID, } from "@superblocksteam/shared";
|
|
5
5
|
import { normalizeIntegrationWritePolicyForEnforcement } from "../../../../migration/integration-write-policy.js";
|
|
6
|
-
import { safeJsonParse, safeJsonStringify, } from "../../../../util/log-sanitizer.js";
|
|
6
|
+
import { safeJsonParse, safeJsonStringify, sanitizeLogMessage, } from "../../../../util/log-sanitizer.js";
|
|
7
7
|
import { getErrorMeta, getLogger, getPrefixedLogger, } from "../../../../util/logger.js";
|
|
8
8
|
import { readPersistedChecklist } from "../../../checklist/persisted-checklist-store.js";
|
|
9
9
|
import { callPeer } from "../../../util/call-peer.js";
|
|
10
10
|
import { ORCHESTRATOR_PEER_RPC_TIMEOUT_MS } from "../../../util/rpc-timeout.js";
|
|
11
11
|
import { createToolFactory, PermissionLevel, ToolCategory, ToolExecutionError, } from "../../tools2/types.js";
|
|
12
12
|
import { codeBlock } from "../../tools2/utils.js";
|
|
13
|
+
import { createTypeScriptCheckFunction, debugCache } from "../debug-cache.js";
|
|
13
14
|
import { MAX_QUERY_RESPONSE_TOKENS, truncateToTokens, } from "../integrations/internal.js";
|
|
14
15
|
import { isManagedAppDatabaseIntegration } from "../integrations/managed-app-database.js";
|
|
15
16
|
import { containsMutations, extractIntegrationIdsFromSource, extractMutations, } from "./analysis.js";
|
|
@@ -28,6 +29,110 @@ async function resolveSdkApiRegistryEntry(apiName, services) {
|
|
|
28
29
|
pathExists: (relativePath) => services.appShell.pathExists(relativePath),
|
|
29
30
|
});
|
|
30
31
|
}
|
|
32
|
+
const MAX_SDK_ERROR_MESSAGE_CHARS = 4_000;
|
|
33
|
+
// truncateToTokens uses three characters per token. This 15,000-character
|
|
34
|
+
// budget leaves room for the tool envelope under the 25,000-character limiter.
|
|
35
|
+
const MAX_SDK_ERROR_TOKENS = 5_000;
|
|
36
|
+
const MAX_SDK_ERROR_DETAILS_TOKENS = 3_000;
|
|
37
|
+
const sdkApiErrorSchema = z.object({
|
|
38
|
+
message: z.string(),
|
|
39
|
+
code: z.string(),
|
|
40
|
+
details: z.unknown().optional(),
|
|
41
|
+
});
|
|
42
|
+
function capSdkError(error) {
|
|
43
|
+
if (!error) {
|
|
44
|
+
return {
|
|
45
|
+
error: undefined,
|
|
46
|
+
truncated: false,
|
|
47
|
+
beforeChars: 0,
|
|
48
|
+
afterChars: 0,
|
|
49
|
+
detailsSurvived: false,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const serializedError = safeJsonStringify(error);
|
|
53
|
+
const beforeChars = serializedError.length;
|
|
54
|
+
const sanitizedError = safeJsonParse(sanitizeLogMessage(serializedError));
|
|
55
|
+
const input = sdkApiErrorSchema.safeParse(sanitizedError);
|
|
56
|
+
const normalized = input.success
|
|
57
|
+
? input.data
|
|
58
|
+
: { code: "UNKNOWN", message: safeJsonStringify(sanitizedError) };
|
|
59
|
+
const { code, message, details } = normalized;
|
|
60
|
+
const summary = message.length > MAX_SDK_ERROR_MESSAGE_CHARS
|
|
61
|
+
? `${message.slice(0, MAX_SDK_ERROR_MESSAGE_CHARS)}\n... [error message truncated, ${message.length} chars total]`
|
|
62
|
+
: message;
|
|
63
|
+
let issueCount;
|
|
64
|
+
let detailsToCap = details;
|
|
65
|
+
if (details && typeof details === "object" && !Array.isArray(details)) {
|
|
66
|
+
const { issues, ...otherDetails } = details;
|
|
67
|
+
if (Array.isArray(issues)) {
|
|
68
|
+
issueCount = issues.length;
|
|
69
|
+
detailsToCap = { issues, ...otherDetails };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const cappedDetails = detailsToCap === undefined
|
|
73
|
+
? undefined
|
|
74
|
+
: truncateToTokens(detailsToCap, MAX_SDK_ERROR_DETAILS_TOKENS);
|
|
75
|
+
let parsedDetails;
|
|
76
|
+
if (cappedDetails) {
|
|
77
|
+
if (typeof detailsToCap === "string") {
|
|
78
|
+
parsedDetails = cappedDetails.result;
|
|
79
|
+
}
|
|
80
|
+
else if (detailsToCap === null) {
|
|
81
|
+
parsedDetails = null;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
parsedDetails = safeJsonParse(cappedDetails.result);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const capped = truncateToTokens({
|
|
88
|
+
message: summary,
|
|
89
|
+
code,
|
|
90
|
+
...(parsedDetails !== undefined && { details: parsedDetails }),
|
|
91
|
+
}, MAX_SDK_ERROR_TOKENS);
|
|
92
|
+
const parsed = sdkApiErrorSchema.safeParse(safeJsonParse(capped.result));
|
|
93
|
+
const cappedError = parsed.success
|
|
94
|
+
? parsed.data
|
|
95
|
+
: { message: summary, code: code.slice(0, MAX_SDK_ERROR_MESSAGE_CHARS) };
|
|
96
|
+
const cappedErrorDetails = cappedError.details;
|
|
97
|
+
const includedIssues = cappedErrorDetails &&
|
|
98
|
+
typeof cappedErrorDetails === "object" &&
|
|
99
|
+
!Array.isArray(cappedErrorDetails) &&
|
|
100
|
+
Array.isArray(cappedErrorDetails.issues)
|
|
101
|
+
? cappedErrorDetails.issues
|
|
102
|
+
: undefined;
|
|
103
|
+
const afterChars = safeJsonStringify(cappedError).length;
|
|
104
|
+
return {
|
|
105
|
+
error: cappedError,
|
|
106
|
+
truncated: capped.truncated ||
|
|
107
|
+
cappedDetails?.truncated === true ||
|
|
108
|
+
summary !== message,
|
|
109
|
+
beforeChars,
|
|
110
|
+
afterChars,
|
|
111
|
+
detailsSurvived: cappedErrorDetails !== undefined,
|
|
112
|
+
issueCount,
|
|
113
|
+
includedIssueCount: includedIssues?.length,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function logSdkTruncation(logger, apiName, attributes) {
|
|
117
|
+
const boundedAttributes = {
|
|
118
|
+
"clark.testapi.sdk_error.api_name": apiName.slice(0, 200),
|
|
119
|
+
"clark.testapi.sdk_error.before_chars": attributes.beforeChars,
|
|
120
|
+
"clark.testapi.sdk_error.after_chars": attributes.afterChars,
|
|
121
|
+
"clark.testapi.sdk_error.details_survived": attributes.detailsSurvived,
|
|
122
|
+
...(attributes.issueCount !== undefined && {
|
|
123
|
+
"clark.testapi.sdk_error.issue_count": attributes.issueCount,
|
|
124
|
+
}),
|
|
125
|
+
...(attributes.includedIssueCount !== undefined && {
|
|
126
|
+
"clark.testapi.sdk_error.included_issue_count": attributes.includedIssueCount,
|
|
127
|
+
}),
|
|
128
|
+
};
|
|
129
|
+
if (logger.warnStructured) {
|
|
130
|
+
logger.warnStructured("SDK API result truncated", boundedAttributes);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
logger.warn("SDK API result truncated", boundedAttributes);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
31
136
|
/**
|
|
32
137
|
* Execute an SDK API via the editor socket (aiExecuteSdkApi).
|
|
33
138
|
* Runs a TypeScript typecheck first to catch errors before execution.
|
|
@@ -40,7 +145,7 @@ async function executeSdkApi({ apiName, inputs, clark, services, logger, }) {
|
|
|
40
145
|
// Run TypeScript check before execution to catch type errors
|
|
41
146
|
logger.info(`Starting TypeScript check for API file: ${apiTsPath}`);
|
|
42
147
|
try {
|
|
43
|
-
const typecheckErrors = await services.appShell.
|
|
148
|
+
const typecheckErrors = await debugCache.getTypeScriptErrorsByPath(createTypeScriptCheckFunction(services.appShell, clark.context.abortController?.signal), { abortSignal: clark.context.abortController?.signal });
|
|
44
149
|
logger.info(`TypeScript check completed. Has errors: ${!!typecheckErrors}, error file count: ${typecheckErrors ? Object.keys(typecheckErrors).length : 0}`);
|
|
45
150
|
if (typecheckErrors) {
|
|
46
151
|
const apiErrors = [];
|
|
@@ -62,7 +167,8 @@ async function executeSdkApi({ apiName, inputs, clark, services, logger, }) {
|
|
|
62
167
|
}
|
|
63
168
|
catch (error) {
|
|
64
169
|
if (error instanceof Error &&
|
|
65
|
-
error.message.includes("TypeScript errors in API")
|
|
170
|
+
(error.message.includes("TypeScript errors in API") ||
|
|
171
|
+
error.message.includes("Type check did not complete"))) {
|
|
66
172
|
throw error;
|
|
67
173
|
}
|
|
68
174
|
logger.warn(`TypeScript check failed, proceeding with execution: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -101,18 +207,29 @@ async function executeSdkApi({ apiName, inputs, clark, services, logger, }) {
|
|
|
101
207
|
logger.info(`aiExecuteSdkApi returned for ${apiName}: success=${result.success}, hasOutput=${!!result.output}, hasError=${!!result.error}`);
|
|
102
208
|
if (result.success === undefined) {
|
|
103
209
|
logger.error(`aiExecuteSdkApi returned malformed result (no success field) for ${apiName}`);
|
|
210
|
+
const serializedResult = safeJsonStringify(result);
|
|
211
|
+
const sanitizedResult = sanitizeLogMessage(serializedResult);
|
|
212
|
+
const cappedRawResult = truncateToTokens(safeJsonParse(sanitizedResult) ?? sanitizedResult, MAX_SDK_ERROR_TOKENS);
|
|
213
|
+
if (cappedRawResult.truncated) {
|
|
214
|
+
logSdkTruncation(logger, apiName, {
|
|
215
|
+
beforeChars: serializedResult.length,
|
|
216
|
+
afterChars: cappedRawResult.result.length,
|
|
217
|
+
detailsSurvived: false,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
104
220
|
return {
|
|
105
221
|
message: `API ${apiName} execution returned unexpected result format. This may indicate the API file failed to load or has syntax errors. Check the browser console for details.`,
|
|
106
222
|
result: {
|
|
107
223
|
success: false,
|
|
108
224
|
systemError: "Malformed response from API execution",
|
|
109
|
-
rawResult: result,
|
|
225
|
+
rawResult: safeJsonParse(cappedRawResult.result) ?? cappedRawResult.result,
|
|
226
|
+
...(cappedRawResult.truncated && { isPartial: true }),
|
|
110
227
|
},
|
|
111
228
|
apiName,
|
|
112
229
|
};
|
|
113
230
|
}
|
|
114
231
|
if (result.success === false) {
|
|
115
|
-
logger.warn(`SDK API execution returned error for ${apiName}
|
|
232
|
+
logger.warn(`SDK API execution returned an error for ${apiName}`);
|
|
116
233
|
clark.context.apiTestingState ??= {
|
|
117
234
|
untested: new Set(),
|
|
118
235
|
failed: new Set(),
|
|
@@ -121,15 +238,22 @@ async function executeSdkApi({ apiName, inputs, clark, services, logger, }) {
|
|
|
121
238
|
};
|
|
122
239
|
clark.context.apiTestingState.failed.add(apiName);
|
|
123
240
|
clark.context.apiTestingState.passed.delete(apiName);
|
|
124
|
-
const
|
|
241
|
+
const capped = capSdkError(result.error);
|
|
242
|
+
if (capped.truncated) {
|
|
243
|
+
logSdkTruncation(logger, apiName, capped);
|
|
244
|
+
}
|
|
125
245
|
return {
|
|
126
246
|
message: `API ${apiName} FAILED with unhandled errors. Do NOT show a success message to the user - investigate and fix the error.
|
|
127
247
|
|
|
128
|
-
|
|
129
|
-
${errorSummary || "No specific error details available."}`,
|
|
248
|
+
${capped.error ? "The error details are included in the result below." : "No specific error details are available."}`,
|
|
130
249
|
result: {
|
|
131
250
|
success: false,
|
|
132
|
-
error:
|
|
251
|
+
error: capped.error,
|
|
252
|
+
...(capped.truncated && { isPartial: true }),
|
|
253
|
+
...(capped.issueCount !== undefined && {
|
|
254
|
+
issueCount: capped.issueCount,
|
|
255
|
+
includedIssueCount: capped.includedIssueCount ?? 0,
|
|
256
|
+
}),
|
|
133
257
|
},
|
|
134
258
|
apiName,
|
|
135
259
|
};
|
|
@@ -605,9 +729,9 @@ export const checkTestApiPermissions = async (services, input, _clark) => {
|
|
|
605
729
|
export const testApiToolFactory = createToolFactory("testApi", ({ clark, services, }) => {
|
|
606
730
|
return {
|
|
607
731
|
category: ToolCategory.DEBUG,
|
|
608
|
-
timeoutMs: 300_000, //
|
|
609
|
-
//
|
|
610
|
-
skipOutputLimit: (
|
|
732
|
+
timeoutMs: 300_000, // API executions can exceed the default 60-second timeout.
|
|
733
|
+
// SDK API results are capped before they reach the shared output limiter.
|
|
734
|
+
skipOutputLimit: () => !!services.features.sdkApiEnabled,
|
|
611
735
|
description: `
|
|
612
736
|
Execute an API to test its behavior. This triggers the API through the normal UI execution path,
|
|
613
737
|
so the execution will be visible in the application UI with full trace details.
|