@superblocksteam/vite-plugin-file-sync 2.0.86 → 2.0.87-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 +33 -0
- package/dist/ai-service/agent/prompts/api-prompts.d.ts.map +1 -0
- package/dist/ai-service/agent/prompts/api-prompts.js +446 -0
- package/dist/ai-service/agent/prompts/api-prompts.js.map +1 -0
- 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 +16 -154
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js.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 +13 -2
- package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/analysis.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/analysis.js +159 -15
- package/dist/ai-service/agent/tools/apis/analysis.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts +12 -0
- package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-api-docs.js +3 -3
- package/dist/ai-service/agent/tools/apis/get-api-docs.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-integration-types.d.ts +12 -0
- package/dist/ai-service/agent/tools/apis/get-integration-types.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/apis/get-integration-types.js +76 -0
- package/dist/ai-service/agent/tools/apis/get-integration-types.js.map +1 -0
- package/dist/ai-service/agent/tools/apis/integration-types.js +4 -4
- package/dist/ai-service/agent/tools/apis/integration-types.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.js +5 -4
- package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -1
- package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-capture-screenshot.js +23 -0
- package/dist/ai-service/agent/tools/build-capture-screenshot.js.map +1 -1
- package/dist/ai-service/agent/tools/build-debug.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-debug.js +13 -1
- package/dist/ai-service/agent/tools/build-debug.js.map +1 -1
- package/dist/ai-service/agent/tools/index.d.ts +1 -0
- package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/index.js +1 -0
- package/dist/ai-service/agent/tools/index.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.js +14 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/internal.d.ts +1 -0
- package/dist/ai-service/agent/tools/integrations/internal.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/internal.js +9 -4
- package/dist/ai-service/agent/tools/integrations/internal.js.map +1 -1
- package/dist/ai-service/agent/tools.d.ts.map +1 -1
- package/dist/ai-service/agent/tools.js +19 -9
- package/dist/ai-service/agent/tools.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/web-fetch.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/web-fetch.js +7 -1
- package/dist/ai-service/agent/tools2/tools/web-fetch.js.map +1 -1
- package/dist/ai-service/agent/utils.d.ts.map +1 -1
- package/dist/ai-service/agent/utils.js +11 -0
- package/dist/ai-service/agent/utils.js.map +1 -1
- package/dist/ai-service/app-interface/filesystem/index.d.ts +4 -1
- package/dist/ai-service/app-interface/filesystem/index.d.ts.map +1 -1
- package/dist/ai-service/app-interface/filesystem/index.js +3 -1
- package/dist/ai-service/app-interface/filesystem/index.js.map +1 -1
- package/dist/ai-service/app-interface/filesystem/path-validator.d.ts +43 -0
- package/dist/ai-service/app-interface/filesystem/path-validator.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/path-validator.js +9 -0
- package/dist/ai-service/app-interface/filesystem/path-validator.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/sdk-path-validator.d.ts +50 -0
- package/dist/ai-service/app-interface/filesystem/sdk-path-validator.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/sdk-path-validator.js +68 -0
- package/dist/ai-service/app-interface/filesystem/sdk-path-validator.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/validation.d.ts +25 -8
- package/dist/ai-service/app-interface/filesystem/validation.d.ts.map +1 -1
- package/dist/ai-service/app-interface/filesystem/validation.js +52 -28
- package/dist/ai-service/app-interface/filesystem/validation.js.map +1 -1
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts +1 -0
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts.map +1 -1
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.js +4 -1
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.js.map +1 -1
- package/dist/ai-service/app-interface/filesystem/yaml-path-validator.d.ts +49 -0
- package/dist/ai-service/app-interface/filesystem/yaml-path-validator.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/yaml-path-validator.js +67 -0
- package/dist/ai-service/app-interface/filesystem/yaml-path-validator.js.map +1 -0
- package/dist/ai-service/app-interface/shell.d.ts +5 -2
- package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
- package/dist/ai-service/app-interface/shell.js +11 -6
- package/dist/ai-service/app-interface/shell.js.map +1 -1
- package/dist/ai-service/chat/chat-session-store.js +3 -3
- package/dist/ai-service/chat/chat-session-store.js.map +1 -1
- package/dist/ai-service/clark-provider/clark-provider.d.ts +1 -0
- package/dist/ai-service/clark-provider/clark-provider.d.ts.map +1 -1
- package/dist/ai-service/clark-provider/clark-provider.js +6 -1
- package/dist/ai-service/clark-provider/clark-provider.js.map +1 -1
- package/dist/ai-service/features.d.ts +4 -0
- package/dist/ai-service/features.d.ts.map +1 -1
- package/dist/ai-service/features.js +4 -0
- package/dist/ai-service/features.js.map +1 -1
- package/dist/ai-service/index.d.ts +16 -0
- package/dist/ai-service/index.d.ts.map +1 -1
- package/dist/ai-service/index.js +101 -10
- package/dist/ai-service/index.js.map +1 -1
- package/dist/ai-service/judge/judge-eval-service-runner.d.ts.map +1 -1
- package/dist/ai-service/judge/judge-eval-service-runner.js +2 -0
- package/dist/ai-service/judge/judge-eval-service-runner.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 +4 -4
- 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 +11 -2
- package/dist/ai-service/llm/context-v2/phase1-tool-summarizer.js.map +1 -1
- package/dist/ai-service/llm/context-v2/prompts/compaction.d.ts +1 -1
- package/dist/ai-service/llm/context-v2/prompts/compaction.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/prompts/compaction.js +15 -6
- package/dist/ai-service/llm/context-v2/prompts/compaction.js.map +1 -1
- package/dist/ai-service/llm/context-v2/types.d.ts +4 -9
- package/dist/ai-service/llm/context-v2/types.d.ts.map +1 -1
- package/dist/ai-service/llm/context-v2/types.js +15 -45
- package/dist/ai-service/llm/context-v2/types.js.map +1 -1
- package/dist/ai-service/llm/stream/retry-engine.d.ts +4 -0
- package/dist/ai-service/llm/stream/retry-engine.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/retry-engine.js +24 -1
- package/dist/ai-service/llm/stream/retry-engine.js.map +1 -1
- package/dist/ai-service/llm/types.d.ts +4 -1
- package/dist/ai-service/llm/types.d.ts.map +1 -1
- package/dist/ai-service/skills/system/superblocks-api/references/graphql.generated.d.ts +1 -1
- package/dist/ai-service/skills/system/superblocks-api/references/graphql.generated.d.ts.map +1 -1
- package/dist/ai-service/skills/system/superblocks-api/references/graphql.generated.js +28 -21
- package/dist/ai-service/skills/system/superblocks-api/references/graphql.generated.js.map +1 -1
- package/dist/ai-service/skills/system/superblocks-api/skill.generated.d.ts +1 -1
- package/dist/ai-service/skills/system/superblocks-api/skill.generated.d.ts.map +1 -1
- package/dist/ai-service/skills/system/superblocks-api/skill.generated.js +286 -116
- package/dist/ai-service/skills/system/superblocks-api/skill.generated.js.map +1 -1
- package/dist/ai-service/state-machine/clark-fsm.d.ts +7 -0
- package/dist/ai-service/state-machine/clark-fsm.d.ts.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 +14 -12
- package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/idle.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/idle.js +18 -10
- package/dist/ai-service/state-machine/handlers/idle.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/peer.d.ts +5 -0
- package/dist/ai-service/state-machine/helpers/peer.d.ts.map +1 -1
- package/dist/ai-service/state-machine/helpers/peer.js +19 -0
- package/dist/ai-service/state-machine/helpers/peer.js.map +1 -1
- package/dist/ai-service/template-renderer.d.ts +2 -1
- package/dist/ai-service/template-renderer.d.ts.map +1 -1
- package/dist/ai-service/template-renderer.js +28 -3
- package/dist/ai-service/template-renderer.js.map +1 -1
- package/dist/ai-service/types.d.ts +2 -0
- package/dist/ai-service/types.d.ts.map +1 -1
- package/dist/ai-service/types.js.map +1 -1
- package/dist/lock-service/activity-tracker.d.ts +5 -0
- package/dist/lock-service/activity-tracker.d.ts.map +1 -1
- package/dist/lock-service/activity-tracker.js +13 -0
- package/dist/lock-service/activity-tracker.js.map +1 -1
- package/dist/lock-service/index.d.ts +8 -0
- package/dist/lock-service/index.d.ts.map +1 -1
- package/dist/lock-service/index.js +54 -0
- package/dist/lock-service/index.js.map +1 -1
- package/dist/socket-manager.d.ts.map +1 -1
- package/dist/socket-manager.js +9 -0
- package/dist/socket-manager.js.map +1 -1
- package/dist/sync-service/index.d.ts.map +1 -1
- package/dist/sync-service/index.js +40 -7
- package/dist/sync-service/index.js.map +1 -1
- package/dist/util/log-sanitizer.d.ts +1 -0
- package/dist/util/log-sanitizer.d.ts.map +1 -1
- package/dist/util/log-sanitizer.js +8 -0
- package/dist/util/log-sanitizer.js.map +1 -1
- package/package.json +22 -11
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK mode path validator implementation.
|
|
3
|
+
*
|
|
4
|
+
* Handles path validation for the nested template structure:
|
|
5
|
+
* - APIs: server/apis/ApiName/api.ts
|
|
6
|
+
* - Pages: client/pages/PageName/index.tsx
|
|
7
|
+
* - App root: client/App.tsx
|
|
8
|
+
* - No scope files in SDK mode
|
|
9
|
+
*/
|
|
10
|
+
import type { PathValidator } from "./path-validator.js";
|
|
11
|
+
/**
|
|
12
|
+
* Path validator for SDK mode (nested structure).
|
|
13
|
+
*
|
|
14
|
+
* In SDK mode:
|
|
15
|
+
* - APIs are at server/apis/ (e.g., server/apis/MyApi/api.ts)
|
|
16
|
+
* - Pages are at client/pages/ (e.g., client/pages/Home/index.tsx)
|
|
17
|
+
* - App root is client/App.tsx
|
|
18
|
+
* - Scope files do not exist in SDK mode
|
|
19
|
+
*/
|
|
20
|
+
export declare class SdkPathValidator implements PathValidator {
|
|
21
|
+
readonly apiPrefix = "server/apis";
|
|
22
|
+
readonly pagesPrefix = "client/pages";
|
|
23
|
+
readonly appRoot = "client/App.tsx";
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a path is an API file path.
|
|
26
|
+
* In SDK mode, API files start with "server/apis/".
|
|
27
|
+
*/
|
|
28
|
+
isApiFilePath(filePath: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if a path is a direct page path (client/pages/xyz.tsx rather than client/pages/xyz/index.tsx).
|
|
31
|
+
* Direct page paths are not allowed - pages must be in subdirectories.
|
|
32
|
+
*/
|
|
33
|
+
isDirectPagePath(filePath: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Checks if a path is a scope file.
|
|
36
|
+
* SDK mode does not use scope files, so this always returns false.
|
|
37
|
+
*/
|
|
38
|
+
isScopeFile(_filePath: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get directories that are protected from modification.
|
|
41
|
+
* In SDK mode, pages are under client/pages, not at root level.
|
|
42
|
+
*/
|
|
43
|
+
getProtectedDirectories(): readonly string[];
|
|
44
|
+
/**
|
|
45
|
+
* Check if a path should bypass blacklist checks.
|
|
46
|
+
* In SDK mode, server/apis/ and client/pages/ directories have special handling.
|
|
47
|
+
*/
|
|
48
|
+
shouldBypassBlacklist(relativePath: string, _firstDir: string): boolean;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=sdk-path-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-path-validator.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/sdk-path-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,YAAW,aAAa;IACpD,QAAQ,CAAC,SAAS,iBAAiB;IACnC,QAAQ,CAAC,WAAW,kBAAkB;IACtC,QAAQ,CAAC,OAAO,oBAAoB;IAEpC;;;OAGG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIxC;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI3C;;;OAGG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIvC;;;OAGG;IACH,uBAAuB,IAAI,SAAS,MAAM,EAAE;IAI5C;;;OAGG;IACH,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;CAYxE"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK mode path validator implementation.
|
|
3
|
+
*
|
|
4
|
+
* Handles path validation for the nested template structure:
|
|
5
|
+
* - APIs: server/apis/ApiName/api.ts
|
|
6
|
+
* - Pages: client/pages/PageName/index.tsx
|
|
7
|
+
* - App root: client/App.tsx
|
|
8
|
+
* - No scope files in SDK mode
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Path validator for SDK mode (nested structure).
|
|
12
|
+
*
|
|
13
|
+
* In SDK mode:
|
|
14
|
+
* - APIs are at server/apis/ (e.g., server/apis/MyApi/api.ts)
|
|
15
|
+
* - Pages are at client/pages/ (e.g., client/pages/Home/index.tsx)
|
|
16
|
+
* - App root is client/App.tsx
|
|
17
|
+
* - Scope files do not exist in SDK mode
|
|
18
|
+
*/
|
|
19
|
+
export class SdkPathValidator {
|
|
20
|
+
apiPrefix = "server/apis";
|
|
21
|
+
pagesPrefix = "client/pages";
|
|
22
|
+
appRoot = "client/App.tsx";
|
|
23
|
+
/**
|
|
24
|
+
* Checks if a path is an API file path.
|
|
25
|
+
* In SDK mode, API files start with "server/apis/".
|
|
26
|
+
*/
|
|
27
|
+
isApiFilePath(filePath) {
|
|
28
|
+
return filePath.startsWith("server/apis/");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Checks if a path is a direct page path (client/pages/xyz.tsx rather than client/pages/xyz/index.tsx).
|
|
32
|
+
* Direct page paths are not allowed - pages must be in subdirectories.
|
|
33
|
+
*/
|
|
34
|
+
isDirectPagePath(filePath) {
|
|
35
|
+
return /^client\/pages\/[^/]+\.tsx$/.test(filePath);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Checks if a path is a scope file.
|
|
39
|
+
* SDK mode does not use scope files, so this always returns false.
|
|
40
|
+
*/
|
|
41
|
+
isScopeFile(_filePath) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get directories that are protected from modification.
|
|
46
|
+
* In SDK mode, pages are under client/pages, not at root level.
|
|
47
|
+
*/
|
|
48
|
+
getProtectedDirectories() {
|
|
49
|
+
return [".git", "node_modules", ".superblocks"];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Check if a path should bypass blacklist checks.
|
|
53
|
+
* In SDK mode, server/apis/ and client/pages/ directories have special handling.
|
|
54
|
+
*/
|
|
55
|
+
shouldBypassBlacklist(relativePath, _firstDir) {
|
|
56
|
+
// server/apis/ directory is allowed for API file operations
|
|
57
|
+
if (relativePath.startsWith("server/apis/")) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
// client/pages/ directory - allow files in subdirectories
|
|
61
|
+
// Direct page paths like client/pages/Foo.tsx will be caught by isDirectPagePath check
|
|
62
|
+
if (relativePath.startsWith("client/pages/")) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=sdk-path-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-path-validator.js","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/sdk-path-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;GAQG;AACH,MAAM,OAAO,gBAAgB;IAClB,SAAS,GAAG,aAAa,CAAC;IAC1B,WAAW,GAAG,cAAc,CAAC;IAC7B,OAAO,GAAG,gBAAgB,CAAC;IAEpC;;;OAGG;IACH,aAAa,CAAC,QAAgB;QAC5B,OAAO,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,QAAgB;QAC/B,OAAO,6BAA6B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,SAAiB;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACH,uBAAuB;QACrB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,cAAc,CAAU,CAAC;IAC3D,CAAC;IAED;;;OAGG;IACH,qBAAqB,CAAC,YAAoB,EAAE,SAAiB;QAC3D,4DAA4D;QAC5D,IAAI,YAAY,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;YAC5C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,0DAA0D;QAC1D,uFAAuF;QACvF,IAAI,YAAY,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -3,8 +3,19 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides centralized validation logic for all filesystem operations,
|
|
5
5
|
* including blacklist checking, path restrictions, and operation-specific rules.
|
|
6
|
+
*
|
|
7
|
+
* Supports both YAML mode (flat structure) and SDK mode (nested structure)
|
|
8
|
+
* through the PathValidator abstraction.
|
|
6
9
|
*/
|
|
7
10
|
import { type FileOperation, type FileOperationValidationOptions } from "../constants.js";
|
|
11
|
+
import type { PathValidator } from "./path-validator.js";
|
|
12
|
+
/**
|
|
13
|
+
* Creates the appropriate path validator based on feature flag.
|
|
14
|
+
*
|
|
15
|
+
* @param sdkApiEnabled - Whether SDK API mode is enabled
|
|
16
|
+
* @returns PathValidator implementation for the appropriate mode
|
|
17
|
+
*/
|
|
18
|
+
export declare function createPathValidator(sdkApiEnabled: boolean): PathValidator;
|
|
8
19
|
/**
|
|
9
20
|
* Error thrown when a file operation fails validation.
|
|
10
21
|
*/
|
|
@@ -13,26 +24,29 @@ export declare class FileValidationError extends Error {
|
|
|
13
24
|
constructor(message: string, code: "BLACKLISTED" | "API_FILE" | "SCOPE_FILE" | "PACKAGE_JSON" | "DIRECT_PAGE" | "ROOT_DIR" | "READ_REQUIRED");
|
|
14
25
|
}
|
|
15
26
|
/**
|
|
16
|
-
* Checks if a path is an API file path
|
|
27
|
+
* Checks if a path is an API file path.
|
|
17
28
|
*
|
|
18
29
|
* @param filePath - Relative file path to check
|
|
30
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
19
31
|
* @returns true if the path is an API file path
|
|
20
32
|
*/
|
|
21
|
-
export declare function isApiFilePath(filePath: string): boolean;
|
|
33
|
+
export declare function isApiFilePath(filePath: string, validator?: PathValidator): boolean;
|
|
22
34
|
/**
|
|
23
35
|
* Checks if a path is a direct page path (pages/xyz.tsx rather than pages/xyz/index.tsx).
|
|
24
36
|
*
|
|
25
37
|
* @param filePath - Relative file path to check
|
|
38
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
26
39
|
* @returns true if the path is a direct page file
|
|
27
40
|
*/
|
|
28
|
-
export declare function isDirectPagePath(filePath: string): boolean;
|
|
41
|
+
export declare function isDirectPagePath(filePath: string, validator?: PathValidator): boolean;
|
|
29
42
|
/**
|
|
30
43
|
* Checks if a path is a scope file.
|
|
31
44
|
*
|
|
32
45
|
* @param filePath - Relative file path to check
|
|
46
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
33
47
|
* @returns true if the path is a scope file
|
|
34
48
|
*/
|
|
35
|
-
export declare function isScopeFile(filePath: string): boolean;
|
|
49
|
+
export declare function isScopeFile(filePath: string, validator?: PathValidator): boolean;
|
|
36
50
|
/**
|
|
37
51
|
* Checks if a path is the package.json file.
|
|
38
52
|
*
|
|
@@ -44,10 +58,11 @@ export declare function isPackageJson(filePath: string): boolean;
|
|
|
44
58
|
* Checks if a path is in the blacklist.
|
|
45
59
|
*
|
|
46
60
|
* @param relativePath - Relative path to check
|
|
47
|
-
* @param
|
|
61
|
+
* @param _appRootDirPath - Application root directory for relative path calculation
|
|
62
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
48
63
|
* @returns Error message if blacklisted, null otherwise
|
|
49
64
|
*/
|
|
50
|
-
export declare function checkBlacklist(relativePath: string, _appRootDirPath: string): string | null;
|
|
65
|
+
export declare function checkBlacklist(relativePath: string, _appRootDirPath: string, validator?: PathValidator): string | null;
|
|
51
66
|
/**
|
|
52
67
|
* Validates a file operation against all applicable rules.
|
|
53
68
|
*
|
|
@@ -55,17 +70,19 @@ export declare function checkBlacklist(relativePath: string, _appRootDirPath: st
|
|
|
55
70
|
* @param relativePath - Relative path of the file
|
|
56
71
|
* @param appRootDirPath - Application root directory
|
|
57
72
|
* @param options - Optional validation options to override defaults
|
|
73
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
58
74
|
* @throws FileValidationError if validation fails
|
|
59
75
|
*/
|
|
60
|
-
export declare function validateFileOperation(operation: FileOperation, relativePath: string, appRootDirPath: string, options?: Partial<FileOperationValidationOptions
|
|
76
|
+
export declare function validateFileOperation(operation: FileOperation, relativePath: string, appRootDirPath: string, options?: Partial<FileOperationValidationOptions>, validator?: PathValidator): void;
|
|
61
77
|
/**
|
|
62
78
|
* Recursively checks if a directory contains any blacklisted content.
|
|
63
79
|
*
|
|
64
80
|
* @param entries - Directory entries to scan
|
|
81
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
65
82
|
* @returns Error message if blacklisted content found, null otherwise
|
|
66
83
|
*/
|
|
67
84
|
export declare function checkDirectoryContentBlacklist(entries: Array<{
|
|
68
85
|
name: string;
|
|
69
86
|
isDirectory: boolean;
|
|
70
|
-
}
|
|
87
|
+
}>, validator?: PathValidator): string | null;
|
|
71
88
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/validation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,8BAA8B,EACpC,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAA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OAAO,CAAA;CAAE,CAAC,EACtD,SAAS,GAAE,aAAgC,GAC1C,MAAM,GAAG,IAAI,CA2Bf"}
|
|
@@ -3,9 +3,25 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides centralized validation logic for all filesystem operations,
|
|
5
5
|
* including blacklist checking, path restrictions, and operation-specific rules.
|
|
6
|
+
*
|
|
7
|
+
* Supports both YAML mode (flat structure) and SDK mode (nested structure)
|
|
8
|
+
* through the PathValidator abstraction.
|
|
6
9
|
*/
|
|
7
10
|
import path from "node:path";
|
|
8
11
|
import { FILE_OPERATION_BLACKLIST, DEFAULT_VALIDATION_OPTIONS, } from "../constants.js";
|
|
12
|
+
import { SdkPathValidator } from "./sdk-path-validator.js";
|
|
13
|
+
import { YamlPathValidator } from "./yaml-path-validator.js";
|
|
14
|
+
/**
|
|
15
|
+
* Creates the appropriate path validator based on feature flag.
|
|
16
|
+
*
|
|
17
|
+
* @param sdkApiEnabled - Whether SDK API mode is enabled
|
|
18
|
+
* @returns PathValidator implementation for the appropriate mode
|
|
19
|
+
*/
|
|
20
|
+
export function createPathValidator(sdkApiEnabled) {
|
|
21
|
+
return sdkApiEnabled ? new SdkPathValidator() : new YamlPathValidator();
|
|
22
|
+
}
|
|
23
|
+
/** Default path validator (YAML mode for backwards compatibility) */
|
|
24
|
+
const defaultValidator = new YamlPathValidator();
|
|
9
25
|
/**
|
|
10
26
|
* Error thrown when a file operation fails validation.
|
|
11
27
|
*/
|
|
@@ -18,31 +34,34 @@ export class FileValidationError extends Error {
|
|
|
18
34
|
}
|
|
19
35
|
}
|
|
20
36
|
/**
|
|
21
|
-
* Checks if a path is an API file path
|
|
37
|
+
* Checks if a path is an API file path.
|
|
22
38
|
*
|
|
23
39
|
* @param filePath - Relative file path to check
|
|
40
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
24
41
|
* @returns true if the path is an API file path
|
|
25
42
|
*/
|
|
26
|
-
export function isApiFilePath(filePath) {
|
|
27
|
-
return
|
|
43
|
+
export function isApiFilePath(filePath, validator = defaultValidator) {
|
|
44
|
+
return validator.isApiFilePath(filePath);
|
|
28
45
|
}
|
|
29
46
|
/**
|
|
30
47
|
* Checks if a path is a direct page path (pages/xyz.tsx rather than pages/xyz/index.tsx).
|
|
31
48
|
*
|
|
32
49
|
* @param filePath - Relative file path to check
|
|
50
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
33
51
|
* @returns true if the path is a direct page file
|
|
34
52
|
*/
|
|
35
|
-
export function isDirectPagePath(filePath) {
|
|
36
|
-
return
|
|
53
|
+
export function isDirectPagePath(filePath, validator = defaultValidator) {
|
|
54
|
+
return validator.isDirectPagePath(filePath);
|
|
37
55
|
}
|
|
38
56
|
/**
|
|
39
57
|
* Checks if a path is a scope file.
|
|
40
58
|
*
|
|
41
59
|
* @param filePath - Relative file path to check
|
|
60
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
42
61
|
* @returns true if the path is a scope file
|
|
43
62
|
*/
|
|
44
|
-
export function isScopeFile(filePath) {
|
|
45
|
-
return
|
|
63
|
+
export function isScopeFile(filePath, validator = defaultValidator) {
|
|
64
|
+
return validator.isScopeFile(filePath);
|
|
46
65
|
}
|
|
47
66
|
/**
|
|
48
67
|
* Checks if a path is the package.json file.
|
|
@@ -66,10 +85,11 @@ function matchesProtectedPattern(fileName) {
|
|
|
66
85
|
* Checks if a path is in the blacklist.
|
|
67
86
|
*
|
|
68
87
|
* @param relativePath - Relative path to check
|
|
69
|
-
* @param
|
|
88
|
+
* @param _appRootDirPath - Application root directory for relative path calculation
|
|
89
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
70
90
|
* @returns Error message if blacklisted, null otherwise
|
|
71
91
|
*/
|
|
72
|
-
export function checkBlacklist(relativePath, _appRootDirPath) {
|
|
92
|
+
export function checkBlacklist(relativePath, _appRootDirPath, validator = defaultValidator) {
|
|
73
93
|
const fileName = path.basename(relativePath);
|
|
74
94
|
// Check if it's the app root
|
|
75
95
|
if (relativePath === "" || relativePath === ".") {
|
|
@@ -79,25 +99,26 @@ export function checkBlacklist(relativePath, _appRootDirPath) {
|
|
|
79
99
|
if (FILE_OPERATION_BLACKLIST.exactPaths.includes(fileName)) {
|
|
80
100
|
return `Cannot operate on protected file: ${fileName}`;
|
|
81
101
|
}
|
|
102
|
+
// Get protected directories from validator
|
|
103
|
+
const protectedDirs = validator.getProtectedDirectories();
|
|
82
104
|
// Check protected directories
|
|
83
|
-
if (
|
|
105
|
+
if (protectedDirs.includes(fileName)) {
|
|
84
106
|
return `Cannot operate on protected directory: ${fileName}`;
|
|
85
107
|
}
|
|
86
108
|
// Check if path starts with a protected directory
|
|
87
109
|
const firstDir = relativePath.split("/")[0];
|
|
88
|
-
if (firstDir &&
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (firstDir === "apis") {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
// Special case: pages directory - allow files in subdirectories
|
|
95
|
-
// Direct page paths like pages/Foo.tsx will be caught by isDirectPagePath check
|
|
96
|
-
if (firstDir === "pages") {
|
|
110
|
+
if (firstDir && protectedDirs.includes(firstDir)) {
|
|
111
|
+
// Check if validator allows this path to bypass blacklist
|
|
112
|
+
if (validator.shouldBypassBlacklist(relativePath, firstDir)) {
|
|
97
113
|
return null;
|
|
98
114
|
}
|
|
99
115
|
return `Cannot operate on files in protected directory: ${firstDir}`;
|
|
100
116
|
}
|
|
117
|
+
// For SDK mode, also check nested protected paths (e.g., client/pages)
|
|
118
|
+
// Allow special directories like server/apis/ and client/pages/
|
|
119
|
+
if (validator.shouldBypassBlacklist(relativePath, firstDir ?? "")) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
101
122
|
// Check patterns
|
|
102
123
|
if (matchesProtectedPattern(fileName)) {
|
|
103
124
|
return `Cannot operate on protected file matching pattern: ${fileName}`;
|
|
@@ -111,26 +132,27 @@ export function checkBlacklist(relativePath, _appRootDirPath) {
|
|
|
111
132
|
* @param relativePath - Relative path of the file
|
|
112
133
|
* @param appRootDirPath - Application root directory
|
|
113
134
|
* @param options - Optional validation options to override defaults
|
|
135
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
114
136
|
* @throws FileValidationError if validation fails
|
|
115
137
|
*/
|
|
116
|
-
export function validateFileOperation(operation, relativePath, appRootDirPath, options) {
|
|
138
|
+
export function validateFileOperation(operation, relativePath, appRootDirPath, options, validator = defaultValidator) {
|
|
117
139
|
const opts = {
|
|
118
140
|
...DEFAULT_VALIDATION_OPTIONS[operation],
|
|
119
141
|
...options,
|
|
120
142
|
};
|
|
121
143
|
// Check blacklist
|
|
122
144
|
if (opts.checkBlacklist) {
|
|
123
|
-
const blacklistError = checkBlacklist(relativePath, appRootDirPath);
|
|
145
|
+
const blacklistError = checkBlacklist(relativePath, appRootDirPath, validator);
|
|
124
146
|
if (blacklistError) {
|
|
125
147
|
throw new FileValidationError(blacklistError, "BLACKLISTED");
|
|
126
148
|
}
|
|
127
149
|
}
|
|
128
150
|
// Check API files
|
|
129
|
-
if (!opts.allowApiFiles && isApiFilePath(relativePath)) {
|
|
151
|
+
if (!opts.allowApiFiles && isApiFilePath(relativePath, validator)) {
|
|
130
152
|
throw new FileValidationError(`Directly ${operation === "write" ? "writing to" : operation === "delete" ? "deleting" : "operating on"} API files is not allowed. Use the API interface instead.`, "API_FILE");
|
|
131
153
|
}
|
|
132
154
|
// Check scope files
|
|
133
|
-
if (!opts.allowScopeFiles && isScopeFile(relativePath)) {
|
|
155
|
+
if (!opts.allowScopeFiles && isScopeFile(relativePath, validator)) {
|
|
134
156
|
throw new FileValidationError("Directly operating on scope files is not allowed. Use the appropriate tool.", "SCOPE_FILE");
|
|
135
157
|
}
|
|
136
158
|
// Check package.json
|
|
@@ -138,17 +160,20 @@ export function validateFileOperation(operation, relativePath, appRootDirPath, o
|
|
|
138
160
|
throw new FileValidationError("Directly editing package.json is not allowed. Use the build_installPackages tool instead.", "PACKAGE_JSON");
|
|
139
161
|
}
|
|
140
162
|
// Check direct page paths
|
|
141
|
-
if (!opts.allowDirectPagePath && isDirectPagePath(relativePath)) {
|
|
142
|
-
|
|
163
|
+
if (!opts.allowDirectPagePath && isDirectPagePath(relativePath, validator)) {
|
|
164
|
+
const pagesPrefix = validator.pagesPrefix;
|
|
165
|
+
throw new FileValidationError(`Direct file creation in the pages directory is not allowed. Please create files within subdirectories (e.g., ${pagesPrefix}/yourFeature/index.tsx)`, "DIRECT_PAGE");
|
|
143
166
|
}
|
|
144
167
|
}
|
|
145
168
|
/**
|
|
146
169
|
* Recursively checks if a directory contains any blacklisted content.
|
|
147
170
|
*
|
|
148
171
|
* @param entries - Directory entries to scan
|
|
172
|
+
* @param validator - Optional path validator (defaults to YAML mode)
|
|
149
173
|
* @returns Error message if blacklisted content found, null otherwise
|
|
150
174
|
*/
|
|
151
|
-
export function checkDirectoryContentBlacklist(entries) {
|
|
175
|
+
export function checkDirectoryContentBlacklist(entries, validator = defaultValidator) {
|
|
176
|
+
const protectedDirs = validator.getProtectedDirectories();
|
|
152
177
|
for (const entry of entries) {
|
|
153
178
|
const fileName = entry.name;
|
|
154
179
|
// Check exact paths
|
|
@@ -156,8 +181,7 @@ export function checkDirectoryContentBlacklist(entries) {
|
|
|
156
181
|
return `Cannot remove protected file: ${fileName}`;
|
|
157
182
|
}
|
|
158
183
|
// Check protected directories
|
|
159
|
-
if (entry.isDirectory &&
|
|
160
|
-
FILE_OPERATION_BLACKLIST.directories.includes(fileName)) {
|
|
184
|
+
if (entry.isDirectory && protectedDirs.includes(fileName)) {
|
|
161
185
|
return `Cannot remove protected directory: ${fileName}`;
|
|
162
186
|
}
|
|
163
187
|
// Check patterns
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/validation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/validation.ts"],"names":[],"mappings":"AAAA;;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{
|
|
128
128
|
useSystemSkills?: boolean;
|
|
129
|
+
sdkApiEnabled?: boolean;
|
|
129
130
|
}): VirtualFileSystem;
|
|
130
131
|
//# sourceMappingURL=virtual-file-system.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-file-system.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/virtual-file-system.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAA4B;IAE5C;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAIlD;;OAEG;IACH,WAAW,IAAI,SAAS,kBAAkB,EAAE;IAI5C;;;;;OAKG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAI/D;;;;;OAKG;IACH,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAI3E;;;;;OAKG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIpC;;;;;;;;;OASG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIrC;;;;;OAKG;IACH,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAKjD;;;;;OAKG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAKvD;;;;;OAKG;IACH,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAU3C;;;;;OAKG;IACH,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAUjD;;;;;;OAMG;IACG,IAAI,CACR,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAQ9B;;;;;;;OAOG;IACG,KAAK,CACT,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC;IAQhB;;;;;;;OAOG;IACG,MAAM,CACV,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,MAAM,EAAE,CAAC;CAOrB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,CAAC,EAAE;IACvD,eAAe,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"virtual-file-system.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/virtual-file-system.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAA4B;IAE5C;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAIlD;;OAEG;IACH,WAAW,IAAI,SAAS,kBAAkB,EAAE;IAI5C;;;;;OAKG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAI/D;;;;;OAKG;IACH,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAI3E;;;;;OAKG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIpC;;;;;;;;;OASG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIrC;;;;;OAKG;IACH,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAKjD;;;;;OAKG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAKvD;;;;;OAKG;IACH,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAU3C;;;;;OAKG;IACH,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAUjD;;;;;;OAMG;IACG,IAAI,CACR,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAQ9B;;;;;;;OAOG;IACG,KAAK,CACT,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC;IAQhB;;;;;;;OAOG;IACG,MAAM,CACV,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,MAAM,EAAE,CAAC;CAOrB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,CAAC,EAAE;IACvD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,iBAAiB,CAYpB"}
|
|
@@ -177,7 +177,10 @@ export class VirtualFileSystem {
|
|
|
177
177
|
*/
|
|
178
178
|
export function createDefaultVirtualFileSystem(options) {
|
|
179
179
|
const vfs = new VirtualFileSystem();
|
|
180
|
-
|
|
180
|
+
// ApiFileHandler transforms YAML API files to virtual TS - only needed in YAML mode
|
|
181
|
+
if (!options?.sdkApiEnabled) {
|
|
182
|
+
vfs.registerHandler(new ApiFileHandler());
|
|
183
|
+
}
|
|
181
184
|
if (options?.useSystemSkills) {
|
|
182
185
|
vfs.registerHandler(new SkillFileHandler());
|
|
183
186
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-file-system.js","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/virtual-file-system.ts"],"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AC,WAAW,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,sCAAsC,WAAW,EAAE,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,CACV,WAAmB,EACnB,OAA6B;QAE7B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,sCAAsC,WAAW,EAAE,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,
|
|
1
|
+
{"version":3,"file":"virtual-file-system.js","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/virtual-file-system.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAS/D;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,iBAAiB;IACpB,QAAQ,GAAyB,EAAE,CAAC;IAE5C;;;;OAIG;IACH,eAAe,CAAC,OAA2B;QACzC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,WAAmB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,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pD,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,OAG9C;IACC,MAAM,GAAG,GAAG,IAAI,iBAAiB,EAAE,CAAC;IACpC,oFAAoF;IACpF,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC;QAC5B,GAAG,CAAC,eAAe,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,OAAO,EAAE,eAAe,EAAE,CAAC;QAC7B,GAAG,CAAC,eAAe,CAAC,IAAI,gBAAgB,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* YAML mode path validator implementation.
|
|
3
|
+
*
|
|
4
|
+
* Handles path validation for the flat template structure:
|
|
5
|
+
* - APIs: apis/ApiName/api.yaml
|
|
6
|
+
* - Pages: pages/PageName/index.tsx
|
|
7
|
+
* - App root: App.tsx
|
|
8
|
+
* - Scope file: scope.ts
|
|
9
|
+
*/
|
|
10
|
+
import type { PathValidator } from "./path-validator.js";
|
|
11
|
+
/**
|
|
12
|
+
* Path validator for YAML mode (flat structure).
|
|
13
|
+
*
|
|
14
|
+
* In YAML mode:
|
|
15
|
+
* - APIs are at apis/ (e.g., apis/MyApi/api.yaml)
|
|
16
|
+
* - Pages are at pages/ (e.g., pages/Home/index.tsx)
|
|
17
|
+
* - App root is App.tsx
|
|
18
|
+
* - Scope files (scope.ts) are protected from direct modification
|
|
19
|
+
*/
|
|
20
|
+
export declare class YamlPathValidator implements PathValidator {
|
|
21
|
+
readonly apiPrefix = "apis";
|
|
22
|
+
readonly pagesPrefix = "pages";
|
|
23
|
+
readonly appRoot = "App.tsx";
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a path is an API file path.
|
|
26
|
+
* In YAML mode, API files start with "apis/".
|
|
27
|
+
*/
|
|
28
|
+
isApiFilePath(filePath: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if a path is a direct page path (pages/xyz.tsx rather than pages/xyz/index.tsx).
|
|
31
|
+
* Direct page paths are not allowed - pages must be in subdirectories.
|
|
32
|
+
*/
|
|
33
|
+
isDirectPagePath(filePath: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Checks if a path is a scope file.
|
|
36
|
+
* Scope files are protected from direct modification.
|
|
37
|
+
*/
|
|
38
|
+
isScopeFile(filePath: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get directories that are protected from modification.
|
|
41
|
+
*/
|
|
42
|
+
getProtectedDirectories(): readonly string[];
|
|
43
|
+
/**
|
|
44
|
+
* Check if a path should bypass blacklist checks.
|
|
45
|
+
* In YAML mode, apis/ and pages/ directories have special handling.
|
|
46
|
+
*/
|
|
47
|
+
shouldBypassBlacklist(_relativePath: string, firstDir: string): boolean;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=yaml-path-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-path-validator.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/yaml-path-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IACrD,QAAQ,CAAC,SAAS,UAAU;IAC5B,QAAQ,CAAC,WAAW,WAAW;IAC/B,QAAQ,CAAC,OAAO,aAAa;IAE7B;;;OAGG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIxC;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI3C;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAItC;;OAEG;IACH,uBAAuB,IAAI,SAAS,MAAM,EAAE;IAI5C;;;OAGG;IACH,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;CAYxE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* YAML mode path validator implementation.
|
|
3
|
+
*
|
|
4
|
+
* Handles path validation for the flat template structure:
|
|
5
|
+
* - APIs: apis/ApiName/api.yaml
|
|
6
|
+
* - Pages: pages/PageName/index.tsx
|
|
7
|
+
* - App root: App.tsx
|
|
8
|
+
* - Scope file: scope.ts
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Path validator for YAML mode (flat structure).
|
|
12
|
+
*
|
|
13
|
+
* In YAML mode:
|
|
14
|
+
* - APIs are at apis/ (e.g., apis/MyApi/api.yaml)
|
|
15
|
+
* - Pages are at pages/ (e.g., pages/Home/index.tsx)
|
|
16
|
+
* - App root is App.tsx
|
|
17
|
+
* - Scope files (scope.ts) are protected from direct modification
|
|
18
|
+
*/
|
|
19
|
+
export class YamlPathValidator {
|
|
20
|
+
apiPrefix = "apis";
|
|
21
|
+
pagesPrefix = "pages";
|
|
22
|
+
appRoot = "App.tsx";
|
|
23
|
+
/**
|
|
24
|
+
* Checks if a path is an API file path.
|
|
25
|
+
* In YAML mode, API files start with "apis/".
|
|
26
|
+
*/
|
|
27
|
+
isApiFilePath(filePath) {
|
|
28
|
+
return filePath.startsWith("apis/");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Checks if a path is a direct page path (pages/xyz.tsx rather than pages/xyz/index.tsx).
|
|
32
|
+
* Direct page paths are not allowed - pages must be in subdirectories.
|
|
33
|
+
*/
|
|
34
|
+
isDirectPagePath(filePath) {
|
|
35
|
+
return /^pages\/[^/]+\.tsx$/.test(filePath);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Checks if a path is a scope file.
|
|
39
|
+
* Scope files are protected from direct modification.
|
|
40
|
+
*/
|
|
41
|
+
isScopeFile(filePath) {
|
|
42
|
+
return filePath === "scope.ts" || filePath.endsWith("/scope.ts");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get directories that are protected from modification.
|
|
46
|
+
*/
|
|
47
|
+
getProtectedDirectories() {
|
|
48
|
+
return [".git", "node_modules", ".superblocks", "pages"];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Check if a path should bypass blacklist checks.
|
|
52
|
+
* In YAML mode, apis/ and pages/ directories have special handling.
|
|
53
|
+
*/
|
|
54
|
+
shouldBypassBlacklist(_relativePath, firstDir) {
|
|
55
|
+
// apis directory is allowed for virtual file operations
|
|
56
|
+
if (firstDir === "apis") {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
// pages directory - allow files in subdirectories
|
|
60
|
+
// Direct page paths like pages/Foo.tsx will be caught by isDirectPagePath check
|
|
61
|
+
if (firstDir === "pages") {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=yaml-path-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-path-validator.js","sourceRoot":"","sources":["../../../../src/ai-service/app-interface/filesystem/yaml-path-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAiB;IACnB,SAAS,GAAG,MAAM,CAAC;IACnB,WAAW,GAAG,OAAO,CAAC;IACtB,OAAO,GAAG,SAAS,CAAC;IAE7B;;;OAGG;IACH,aAAa,CAAC,QAAgB;QAC5B,OAAO,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,QAAgB;QAC/B,OAAO,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,QAAgB;QAC1B,OAAO,QAAQ,KAAK,UAAU,IAAI,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACH,uBAAuB;QACrB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,CAAU,CAAC;IACpE,CAAC;IAED;;;OAGG;IACH,qBAAqB,CAAC,aAAqB,EAAE,QAAgB;QAC3D,wDAAwD;QACxD,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,kDAAkD;QAClD,gFAAgF;QAChF,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GlobOptionsWithFileTypesUnset } from "glob";
|
|
2
2
|
import { type FileArtifact } from "../types.js";
|
|
3
|
-
import { type DraftChanges, type FileMetadata } from "./filesystem/index.js";
|
|
3
|
+
import { type DraftChanges, type FileMetadata, type PathValidator } from "./filesystem/index.js";
|
|
4
4
|
import type { VirtualFileSystem } from "./filesystem/index.js";
|
|
5
5
|
import type { DraftInterface } from "../../draft-interface.js";
|
|
6
6
|
import type { IOperationQueue } from "../../util/operation-queue.js";
|
|
@@ -33,18 +33,21 @@ export declare class AppShell {
|
|
|
33
33
|
private readonly draftManager?;
|
|
34
34
|
private readonly templateRenderer?;
|
|
35
35
|
private readonly virtualFs;
|
|
36
|
+
private readonly pathValidator;
|
|
36
37
|
/**
|
|
37
38
|
* Tracks files that must be read before they can be written.
|
|
38
39
|
* Used to enforce read-before-write pattern for AI safety.
|
|
39
40
|
*/
|
|
40
41
|
private readonly requiredReads;
|
|
41
|
-
constructor({ appRootDirPath, fsOperationQueue, messageSender, draftInterface, templateRenderer, virtualFileSystem, }: {
|
|
42
|
+
constructor({ appRootDirPath, fsOperationQueue, messageSender, draftInterface, templateRenderer, virtualFileSystem, pathValidator, }: {
|
|
42
43
|
appRootDirPath: string;
|
|
43
44
|
fsOperationQueue: IOperationQueue;
|
|
44
45
|
messageSender?: (message: any) => Promise<void>;
|
|
45
46
|
draftInterface?: DraftInterface;
|
|
46
47
|
templateRenderer?: TemplateRenderer;
|
|
47
48
|
virtualFileSystem: VirtualFileSystem;
|
|
49
|
+
/** Path validator for template-specific path restrictions */
|
|
50
|
+
pathValidator: PathValidator;
|
|
48
51
|
});
|
|
49
52
|
readFiles(patterns: string[], globOptions?: GlobOptionsWithFileTypesUnset, enableAppBlacklist?: boolean): Promise<FileArtifact[]>;
|
|
50
53
|
runTypecheck(abortSignal?: AbortSignal): Promise<Record<string, string[]> | null>;
|