devchain-cli 0.6.1 → 0.7.1
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/drizzle/0024_review_tables.sql +71 -0
- package/dist/drizzle/0025_reviews_mode_and_nullable_shas.sql +80 -0
- package/dist/drizzle/0026_review_comments_edited_at.sql +2 -0
- package/dist/drizzle/meta/_journal.json +22 -1
- package/dist/server/common/errors/error-types.d.ts +3 -0
- package/dist/server/common/errors/error-types.js +7 -1
- package/dist/server/common/errors/error-types.js.map +1 -1
- package/dist/server/common/validation/path-validation.d.ts +11 -0
- package/dist/server/common/validation/path-validation.js +197 -0
- package/dist/server/common/validation/path-validation.js.map +1 -0
- package/dist/server/modules/chat/dtos/chat.dto.d.ts +13 -13
- package/dist/server/modules/core/core.module.js +3 -2
- package/dist/server/modules/core/core.module.js.map +1 -1
- package/dist/server/modules/core/services/preflight.service.d.ts +1 -3
- package/dist/server/modules/core/services/preflight.service.js +2 -28
- package/dist/server/modules/core/services/preflight.service.js.map +1 -1
- package/dist/server/modules/core/services/provider-mcp-ensure.service.d.ts +26 -0
- package/dist/server/modules/core/services/provider-mcp-ensure.service.js +224 -0
- package/dist/server/modules/core/services/provider-mcp-ensure.service.js.map +1 -0
- package/dist/server/modules/epics/controllers/epics.controller.d.ts +3 -2
- package/dist/server/modules/epics/controllers/epics.controller.js +16 -6
- package/dist/server/modules/epics/controllers/epics.controller.js.map +1 -1
- package/dist/server/modules/events/catalog/epic.created.d.ts +2 -2
- package/dist/server/modules/events/catalog/index.d.ts +340 -2
- package/dist/server/modules/events/catalog/index.js +12 -0
- package/dist/server/modules/events/catalog/index.js.map +1 -1
- package/dist/server/modules/events/catalog/review.comment.created.d.ts +69 -0
- package/dist/server/modules/events/catalog/review.comment.created.js +30 -0
- package/dist/server/modules/events/catalog/review.comment.created.js.map +1 -0
- package/dist/server/modules/events/catalog/review.comment.deleted.d.ts +30 -0
- package/dist/server/modules/events/catalog/review.comment.deleted.js +17 -0
- package/dist/server/modules/events/catalog/review.comment.deleted.js.map +1 -0
- package/dist/server/modules/events/catalog/review.comment.resolved.d.ts +30 -0
- package/dist/server/modules/events/catalog/review.comment.resolved.js +17 -0
- package/dist/server/modules/events/catalog/review.comment.resolved.js.map +1 -0
- package/dist/server/modules/events/catalog/review.comment.updated.d.ts +39 -0
- package/dist/server/modules/events/catalog/review.comment.updated.js +20 -0
- package/dist/server/modules/events/catalog/review.comment.updated.js.map +1 -0
- package/dist/server/modules/events/catalog/review.created.d.ts +90 -0
- package/dist/server/modules/events/catalog/review.created.js +40 -0
- package/dist/server/modules/events/catalog/review.created.js.map +1 -0
- package/dist/server/modules/events/catalog/review.updated.d.ts +110 -0
- package/dist/server/modules/events/catalog/review.updated.js +35 -0
- package/dist/server/modules/events/catalog/review.updated.js.map +1 -0
- package/dist/server/modules/events/subscribers/index.js +4 -0
- package/dist/server/modules/events/subscribers/index.js.map +1 -1
- package/dist/server/modules/events/subscribers/review-broadcaster.subscriber.d.ts +16 -0
- package/dist/server/modules/events/subscribers/review-broadcaster.subscriber.js +163 -0
- package/dist/server/modules/events/subscribers/review-broadcaster.subscriber.js.map +1 -0
- package/dist/server/modules/events/subscribers/review-comment-notifier.subscriber.d.ts +23 -0
- package/dist/server/modules/events/subscribers/review-comment-notifier.subscriber.js +217 -0
- package/dist/server/modules/events/subscribers/review-comment-notifier.subscriber.js.map +1 -0
- package/dist/server/modules/git/controllers/git.controller.d.ts +24 -0
- package/dist/server/modules/git/controllers/git.controller.js +230 -0
- package/dist/server/modules/git/controllers/git.controller.js.map +1 -0
- package/dist/server/modules/git/dtos/git.dto.d.ts +86 -0
- package/dist/server/modules/git/dtos/git.dto.js +36 -0
- package/dist/server/modules/git/dtos/git.dto.js.map +1 -0
- package/dist/server/modules/git/git.module.d.ts +2 -0
- package/dist/server/modules/git/git.module.js +25 -0
- package/dist/server/modules/git/git.module.js.map +1 -0
- package/dist/server/modules/git/services/git.service.d.ts +71 -0
- package/dist/server/modules/git/services/git.service.js +550 -0
- package/dist/server/modules/git/services/git.service.js.map +1 -0
- package/dist/server/modules/mcp/controllers/mcp-http.controller.js +17 -562
- package/dist/server/modules/mcp/controllers/mcp-http.controller.js.map +1 -1
- package/dist/server/modules/mcp/controllers/mcp-sdk.controller.js +9 -568
- package/dist/server/modules/mcp/controllers/mcp-sdk.controller.js.map +1 -1
- package/dist/server/modules/mcp/dtos/mcp.dto.d.ts +226 -36
- package/dist/server/modules/mcp/dtos/mcp.dto.js +158 -50
- package/dist/server/modules/mcp/dtos/mcp.dto.js.map +1 -1
- package/dist/server/modules/mcp/dtos/schema-registry.d.ts +7 -0
- package/dist/server/modules/mcp/dtos/schema-registry.js +56 -0
- package/dist/server/modules/mcp/dtos/schema-registry.js.map +1 -0
- package/dist/server/modules/mcp/mcp.module.js +2 -0
- package/dist/server/modules/mcp/mcp.module.js.map +1 -1
- package/dist/server/modules/mcp/services/mcp.service.d.ts +9 -1
- package/dist/server/modules/mcp/services/mcp.service.js +702 -33
- package/dist/server/modules/mcp/services/mcp.service.js.map +1 -1
- package/dist/server/modules/mcp/tool-definitions.d.ts +2438 -0
- package/dist/server/modules/mcp/tool-definitions.js +727 -0
- package/dist/server/modules/mcp/tool-definitions.js.map +1 -0
- package/dist/server/modules/mcp/utils/param-suggestion.d.ts +3 -0
- package/dist/server/modules/mcp/utils/param-suggestion.js +95 -0
- package/dist/server/modules/mcp/utils/param-suggestion.js.map +1 -0
- package/dist/server/modules/providers/controllers/providers.controller.d.ts +7 -6
- package/dist/server/modules/providers/controllers/providers.controller.js +12 -107
- package/dist/server/modules/providers/controllers/providers.controller.js.map +1 -1
- package/dist/server/modules/reviews/controllers/reviews.controller.d.ts +28 -0
- package/dist/server/modules/reviews/controllers/reviews.controller.js +369 -0
- package/dist/server/modules/reviews/controllers/reviews.controller.js.map +1 -0
- package/dist/server/modules/reviews/dtos/review.dto.d.ts +195 -0
- package/dist/server/modules/reviews/dtos/review.dto.js +92 -0
- package/dist/server/modules/reviews/dtos/review.dto.js.map +1 -0
- package/dist/server/modules/reviews/reviews.module.d.ts +2 -0
- package/dist/server/modules/reviews/reviews.module.js +27 -0
- package/dist/server/modules/reviews/reviews.module.js.map +1 -0
- package/dist/server/modules/reviews/services/reviews.service.d.ts +86 -0
- package/dist/server/modules/reviews/services/reviews.service.js +464 -0
- package/dist/server/modules/reviews/services/reviews.service.js.map +1 -0
- package/dist/server/modules/reviews/utils/notification-formatter.d.ts +12 -0
- package/dist/server/modules/reviews/utils/notification-formatter.js +60 -0
- package/dist/server/modules/reviews/utils/notification-formatter.js.map +1 -0
- package/dist/server/modules/sessions/services/sessions.service.d.ts +3 -1
- package/dist/server/modules/sessions/services/sessions.service.js +32 -2
- package/dist/server/modules/sessions/services/sessions.service.js.map +1 -1
- package/dist/server/modules/storage/db/schema.d.ts +697 -0
- package/dist/server/modules/storage/db/schema.js +71 -1
- package/dist/server/modules/storage/db/schema.js.map +1 -1
- package/dist/server/modules/storage/interfaces/storage.interface.d.ts +23 -1
- package/dist/server/modules/storage/interfaces/storage.interface.js.map +1 -1
- package/dist/server/modules/storage/local/local-storage.service.d.ts +15 -2
- package/dist/server/modules/storage/local/local-storage.service.js +396 -7
- package/dist/server/modules/storage/local/local-storage.service.js.map +1 -1
- package/dist/server/modules/storage/models/domain.models.d.ts +62 -0
- package/dist/server/templates/claude-claude-swe.json +148 -0
- package/dist/server/templates/claude-codex-advanced-swe.json +139 -0
- package/dist/server/templates/claude-codex-advanced.json +84 -84
- package/dist/server/templates/claude-opus.json +102 -101
- package/dist/server/templates/claude-swe-single.json +105 -0
- package/dist/server/templates/codex-claude-swe.json +148 -0
- package/dist/server/templates/simple-codex.json +74 -74
- package/dist/server/test-setup.js +45 -0
- package/dist/server/test-setup.js.map +1 -1
- package/dist/server/tsconfig.tsbuildinfo +1 -1
- package/dist/server/ui/assets/ReviewDetailPage-I54h-2L-.js +6 -0
- package/dist/server/ui/assets/ReviewsPage-B4ua5hiX.js +19 -0
- package/dist/server/ui/assets/index-CqcmnFBh.css +32 -0
- package/dist/server/ui/assets/index-JbUMpbg7.js +858 -0
- package/dist/server/ui/assets/useReviewSubscription-C0GEsiRw.js +83 -0
- package/dist/server/ui/assets/useReviewSubscription-T3uj2-aP.css +1 -0
- package/dist/server/ui/index.html +2 -2
- package/dist/templates/claude-claude-swe.json +148 -0
- package/dist/templates/claude-codex-advanced-swe.json +139 -0
- package/dist/templates/claude-codex-advanced.json +84 -84
- package/dist/templates/claude-opus.json +102 -101
- package/dist/templates/claude-swe-single.json +105 -0
- package/dist/templates/codex-claude-swe.json +148 -0
- package/dist/templates/simple-codex.json +74 -74
- package/package.json +15 -2
- package/prebuilds/node-pty/darwin-arm64/pty.node +0 -0
- package/prebuilds/node-pty/darwin-arm64/spawn-helper +0 -0
- package/prebuilds/node-pty/darwin-x64/pty.node +0 -0
- package/prebuilds/node-pty/darwin-x64/spawn-helper +0 -0
- package/prebuilds/node-pty/linux-arm64/pty.node +0 -0
- package/prebuilds/node-pty/linux-x64/pty.node +0 -0
- package/prebuilds/node-pty/win32-arm64/conpty/OpenConsole.exe +0 -0
- package/prebuilds/node-pty/win32-arm64/conpty/conpty.dll +0 -0
- package/prebuilds/node-pty/win32-arm64/conpty.node +0 -0
- package/prebuilds/node-pty/win32-arm64/conpty.pdb +0 -0
- package/prebuilds/node-pty/win32-arm64/conpty_console_list.node +0 -0
- package/prebuilds/node-pty/win32-arm64/conpty_console_list.pdb +0 -0
- package/prebuilds/node-pty/win32-arm64/pty.node +0 -0
- package/prebuilds/node-pty/win32-arm64/pty.pdb +0 -0
- package/prebuilds/node-pty/win32-arm64/winpty-agent.exe +0 -0
- package/prebuilds/node-pty/win32-arm64/winpty-agent.pdb +0 -0
- package/prebuilds/node-pty/win32-arm64/winpty.dll +0 -0
- package/prebuilds/node-pty/win32-arm64/winpty.pdb +0 -0
- package/prebuilds/node-pty/win32-x64/conpty/OpenConsole.exe +0 -0
- package/prebuilds/node-pty/win32-x64/conpty/conpty.dll +0 -0
- package/prebuilds/node-pty/win32-x64/conpty.node +0 -0
- package/prebuilds/node-pty/win32-x64/conpty.pdb +0 -0
- package/prebuilds/node-pty/win32-x64/conpty_console_list.node +0 -0
- package/prebuilds/node-pty/win32-x64/conpty_console_list.pdb +0 -0
- package/prebuilds/node-pty/win32-x64/pty.node +0 -0
- package/prebuilds/node-pty/win32-x64/pty.pdb +0 -0
- package/prebuilds/node-pty/win32-x64/winpty-agent.exe +0 -0
- package/prebuilds/node-pty/win32-x64/winpty-agent.pdb +0 -0
- package/prebuilds/node-pty/win32-x64/winpty.dll +0 -0
- package/prebuilds/node-pty/win32-x64/winpty.pdb +0 -0
- package/scripts/postinstall.js +51 -1
- package/dist/server/ui/assets/index-BoDZOB7c.css +0 -32
- package/dist/server/ui/assets/index-hB0e02VB.js +0 -735
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
-- Code Review Tables Migration
|
|
2
|
+
-- Adds reviews, review_comments, and review_comment_targets tables
|
|
3
|
+
|
|
4
|
+
CREATE TABLE `reviews` (
|
|
5
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
6
|
+
`project_id` text NOT NULL,
|
|
7
|
+
`epic_id` text,
|
|
8
|
+
`title` text NOT NULL,
|
|
9
|
+
`description` text,
|
|
10
|
+
`status` text NOT NULL,
|
|
11
|
+
`base_ref` text NOT NULL,
|
|
12
|
+
`head_ref` text NOT NULL,
|
|
13
|
+
`base_sha` text NOT NULL,
|
|
14
|
+
`head_sha` text NOT NULL,
|
|
15
|
+
`created_by` text NOT NULL,
|
|
16
|
+
`created_by_agent_id` text,
|
|
17
|
+
`version` integer DEFAULT 1 NOT NULL,
|
|
18
|
+
`created_at` text NOT NULL,
|
|
19
|
+
`updated_at` text NOT NULL,
|
|
20
|
+
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
21
|
+
FOREIGN KEY (`epic_id`) REFERENCES `epics`(`id`) ON UPDATE no action ON DELETE set null,
|
|
22
|
+
FOREIGN KEY (`created_by_agent_id`) REFERENCES `agents`(`id`) ON UPDATE no action ON DELETE set null
|
|
23
|
+
);
|
|
24
|
+
--> statement-breakpoint
|
|
25
|
+
CREATE INDEX `reviews_project_id_idx` ON `reviews` (`project_id`);
|
|
26
|
+
--> statement-breakpoint
|
|
27
|
+
CREATE INDEX `reviews_epic_id_idx` ON `reviews` (`epic_id`);
|
|
28
|
+
--> statement-breakpoint
|
|
29
|
+
CREATE INDEX `reviews_status_idx` ON `reviews` (`status`);
|
|
30
|
+
--> statement-breakpoint
|
|
31
|
+
CREATE TABLE `review_comments` (
|
|
32
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
33
|
+
`review_id` text NOT NULL,
|
|
34
|
+
`file_path` text,
|
|
35
|
+
`parent_id` text,
|
|
36
|
+
`line_start` integer,
|
|
37
|
+
`line_end` integer,
|
|
38
|
+
`side` text,
|
|
39
|
+
`content` text NOT NULL,
|
|
40
|
+
`comment_type` text NOT NULL,
|
|
41
|
+
`status` text NOT NULL,
|
|
42
|
+
`author_type` text NOT NULL,
|
|
43
|
+
`author_agent_id` text,
|
|
44
|
+
`version` integer DEFAULT 1 NOT NULL,
|
|
45
|
+
`created_at` text NOT NULL,
|
|
46
|
+
`updated_at` text NOT NULL,
|
|
47
|
+
FOREIGN KEY (`review_id`) REFERENCES `reviews`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
48
|
+
FOREIGN KEY (`parent_id`) REFERENCES `review_comments`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
49
|
+
FOREIGN KEY (`author_agent_id`) REFERENCES `agents`(`id`) ON UPDATE no action ON DELETE set null
|
|
50
|
+
);
|
|
51
|
+
--> statement-breakpoint
|
|
52
|
+
CREATE INDEX `review_comments_review_id_idx` ON `review_comments` (`review_id`);
|
|
53
|
+
--> statement-breakpoint
|
|
54
|
+
CREATE INDEX `review_comments_parent_id_idx` ON `review_comments` (`parent_id`);
|
|
55
|
+
--> statement-breakpoint
|
|
56
|
+
CREATE INDEX `review_comments_file_path_idx` ON `review_comments` (`file_path`);
|
|
57
|
+
--> statement-breakpoint
|
|
58
|
+
CREATE INDEX `review_comments_status_idx` ON `review_comments` (`status`);
|
|
59
|
+
--> statement-breakpoint
|
|
60
|
+
CREATE TABLE `review_comment_targets` (
|
|
61
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
62
|
+
`comment_id` text NOT NULL,
|
|
63
|
+
`agent_id` text NOT NULL,
|
|
64
|
+
`created_at` text NOT NULL,
|
|
65
|
+
FOREIGN KEY (`comment_id`) REFERENCES `review_comments`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
66
|
+
FOREIGN KEY (`agent_id`) REFERENCES `agents`(`id`) ON UPDATE no action ON DELETE cascade
|
|
67
|
+
);
|
|
68
|
+
--> statement-breakpoint
|
|
69
|
+
CREATE INDEX `review_comment_targets_comment_id_idx` ON `review_comment_targets` (`comment_id`);
|
|
70
|
+
--> statement-breakpoint
|
|
71
|
+
CREATE INDEX `review_comment_targets_agent_id_idx` ON `review_comment_targets` (`agent_id`);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
-- Reviews schema update for live pre-commit review
|
|
2
|
+
-- 1) Add `mode` column to `reviews`
|
|
3
|
+
-- 2) Make `base_sha` / `head_sha` nullable for working_tree mode
|
|
4
|
+
-- 3) Enforce single active review per project (status != 'closed')
|
|
5
|
+
|
|
6
|
+
PRAGMA foreign_keys=OFF;
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
CREATE TABLE `__new_reviews` (
|
|
9
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
10
|
+
`project_id` text NOT NULL,
|
|
11
|
+
`epic_id` text,
|
|
12
|
+
`title` text NOT NULL,
|
|
13
|
+
`description` text,
|
|
14
|
+
`status` text NOT NULL,
|
|
15
|
+
`mode` text DEFAULT 'commit' NOT NULL,
|
|
16
|
+
`base_ref` text NOT NULL,
|
|
17
|
+
`head_ref` text NOT NULL,
|
|
18
|
+
`base_sha` text,
|
|
19
|
+
`head_sha` text,
|
|
20
|
+
`created_by` text NOT NULL,
|
|
21
|
+
`created_by_agent_id` text,
|
|
22
|
+
`version` integer DEFAULT 1 NOT NULL,
|
|
23
|
+
`created_at` text NOT NULL,
|
|
24
|
+
`updated_at` text NOT NULL,
|
|
25
|
+
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
26
|
+
FOREIGN KEY (`epic_id`) REFERENCES `epics`(`id`) ON UPDATE no action ON DELETE set null,
|
|
27
|
+
FOREIGN KEY (`created_by_agent_id`) REFERENCES `agents`(`id`) ON UPDATE no action ON DELETE set null
|
|
28
|
+
);
|
|
29
|
+
--> statement-breakpoint
|
|
30
|
+
INSERT INTO `__new_reviews` (
|
|
31
|
+
`id`,
|
|
32
|
+
`project_id`,
|
|
33
|
+
`epic_id`,
|
|
34
|
+
`title`,
|
|
35
|
+
`description`,
|
|
36
|
+
`status`,
|
|
37
|
+
`mode`,
|
|
38
|
+
`base_ref`,
|
|
39
|
+
`head_ref`,
|
|
40
|
+
`base_sha`,
|
|
41
|
+
`head_sha`,
|
|
42
|
+
`created_by`,
|
|
43
|
+
`created_by_agent_id`,
|
|
44
|
+
`version`,
|
|
45
|
+
`created_at`,
|
|
46
|
+
`updated_at`
|
|
47
|
+
)
|
|
48
|
+
SELECT
|
|
49
|
+
`id`,
|
|
50
|
+
`project_id`,
|
|
51
|
+
`epic_id`,
|
|
52
|
+
`title`,
|
|
53
|
+
`description`,
|
|
54
|
+
`status`,
|
|
55
|
+
'commit' as `mode`,
|
|
56
|
+
`base_ref`,
|
|
57
|
+
`head_ref`,
|
|
58
|
+
`base_sha`,
|
|
59
|
+
`head_sha`,
|
|
60
|
+
`created_by`,
|
|
61
|
+
`created_by_agent_id`,
|
|
62
|
+
`version`,
|
|
63
|
+
`created_at`,
|
|
64
|
+
`updated_at`
|
|
65
|
+
FROM `reviews`;
|
|
66
|
+
--> statement-breakpoint
|
|
67
|
+
DROP TABLE `reviews`;
|
|
68
|
+
--> statement-breakpoint
|
|
69
|
+
ALTER TABLE `__new_reviews` RENAME TO `reviews`;
|
|
70
|
+
|
|
71
|
+
--> statement-breakpoint
|
|
72
|
+
CREATE INDEX `reviews_project_id_idx` ON `reviews` (`project_id`);
|
|
73
|
+
--> statement-breakpoint
|
|
74
|
+
CREATE INDEX `reviews_epic_id_idx` ON `reviews` (`epic_id`);
|
|
75
|
+
--> statement-breakpoint
|
|
76
|
+
CREATE INDEX `reviews_status_idx` ON `reviews` (`status`);
|
|
77
|
+
--> statement-breakpoint
|
|
78
|
+
CREATE UNIQUE INDEX `reviews_project_active_unique` ON `reviews` (`project_id`) WHERE `status` != 'closed';
|
|
79
|
+
--> statement-breakpoint
|
|
80
|
+
PRAGMA foreign_keys=ON;
|
|
@@ -169,6 +169,27 @@
|
|
|
169
169
|
"when": 1767783341227,
|
|
170
170
|
"tag": "0023_add_guest_description",
|
|
171
171
|
"breakpoints": true
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"idx": 24,
|
|
175
|
+
"version": "7",
|
|
176
|
+
"when": 1769880000000,
|
|
177
|
+
"tag": "0024_review_tables",
|
|
178
|
+
"breakpoints": true
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"idx": 25,
|
|
182
|
+
"version": "7",
|
|
183
|
+
"when": 1769880000001,
|
|
184
|
+
"tag": "0025_reviews_mode_and_nullable_shas",
|
|
185
|
+
"breakpoints": true
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"idx": 26,
|
|
189
|
+
"version": "7",
|
|
190
|
+
"when": 1769880000002,
|
|
191
|
+
"tag": "0026_review_comments_edited_at",
|
|
192
|
+
"breakpoints": true
|
|
172
193
|
}
|
|
173
194
|
]
|
|
174
|
-
}
|
|
195
|
+
}
|
|
@@ -13,6 +13,9 @@ export declare class ValidationError extends AppError {
|
|
|
13
13
|
export declare class ConflictError extends AppError {
|
|
14
14
|
constructor(message: string, details?: Record<string, unknown>);
|
|
15
15
|
}
|
|
16
|
+
export declare class ForbiddenError extends AppError {
|
|
17
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
18
|
+
}
|
|
16
19
|
export declare class OptimisticLockError extends AppError {
|
|
17
20
|
constructor(resource: string, identifier: string, details?: Record<string, unknown>);
|
|
18
21
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnsupportedProviderError = exports.TimeoutError = exports.BusyError = exports.IOError = exports.StorageError = exports.OptimisticLockError = exports.ConflictError = exports.ValidationError = exports.NotFoundError = exports.AppError = void 0;
|
|
3
|
+
exports.UnsupportedProviderError = exports.TimeoutError = exports.BusyError = exports.IOError = exports.StorageError = exports.OptimisticLockError = exports.ForbiddenError = exports.ConflictError = exports.ValidationError = exports.NotFoundError = exports.AppError = void 0;
|
|
4
4
|
class AppError extends Error {
|
|
5
5
|
constructor(message, code, statusCode = 500, details) {
|
|
6
6
|
super(message);
|
|
@@ -30,6 +30,12 @@ class ConflictError extends AppError {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.ConflictError = ConflictError;
|
|
33
|
+
class ForbiddenError extends AppError {
|
|
34
|
+
constructor(message, details) {
|
|
35
|
+
super(message, 'forbidden', 403, details);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.ForbiddenError = ForbiddenError;
|
|
33
39
|
class OptimisticLockError extends AppError {
|
|
34
40
|
constructor(resource, identifier, details) {
|
|
35
41
|
super(`${resource} with identifier ${identifier} was modified by another operation. Please refresh and try again.`, 'optimistic_lock_error', 409, details);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-types.js","sourceRoot":"","sources":["../../../src/common/errors/error-types.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAS,SAAQ,KAAK;IACjC,YACE,OAAe,EACC,IAAY,EACZ,aAAqB,GAAG,EACxB,OAAiC;QAEjD,KAAK,C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AE,OAAiC;QAC5D,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;CACF;AAJD,0BAIC;AAED,MAAa,SAAU,SAAQ,QAAQ;IACrC,YAAY,OAAe,EAAE,OAAiC;QAC5D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CACF;AAJD,8BAIC;AAED,MAAa,YAAa,SAAQ,QAAQ;IACxC,YAAY,OAAe,EAAE,OAAiC;QAC5D,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF;AAJD,oCAIC;AAED,MAAa,wBAAyB,SAAQ,QAAQ;IACpD,YACkB,YAAoB,EACpC,kBAA4B;QAE5B,KAAK,CACH,yBAAyB,YAAY,0BAA0B,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAC9F,sBAAsB,EACtB,GAAG,EACH,EAAE,YAAY,EAAE,kBAAkB,EAAE,CACrC,CAAC;QARc,iBAAY,GAAZ,YAAY,CAAQ;IAStC,CAAC;CACF;AAZD,4DAYC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ValidatedPath {
|
|
2
|
+
absolutePath: string;
|
|
3
|
+
relativePath: string;
|
|
4
|
+
}
|
|
5
|
+
export interface PathValidationOptions {
|
|
6
|
+
allowNonExistent?: boolean;
|
|
7
|
+
errorPrefix?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function validatePathWithinRoot(rootPath: string, filePath: string, options?: PathValidationOptions): ValidatedPath;
|
|
10
|
+
export declare function validateLineBounds(lineStart: number, lineEnd: number, totalLines: number): void;
|
|
11
|
+
export declare function validateResolvedPathWithinRoot(absolutePath: string, rootPath: string, options?: PathValidationOptions): Promise<string>;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validatePathWithinRoot = validatePathWithinRoot;
|
|
4
|
+
exports.validateLineBounds = validateLineBounds;
|
|
5
|
+
exports.validateResolvedPathWithinRoot = validateResolvedPathWithinRoot;
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const promises_1 = require("fs/promises");
|
|
8
|
+
const error_types_1 = require("../errors/error-types");
|
|
9
|
+
function validatePathWithinRoot(rootPath, filePath, options = {}) {
|
|
10
|
+
const errorPrefix = options.errorPrefix ?? 'Path validation failed';
|
|
11
|
+
if (!filePath || typeof filePath !== 'string') {
|
|
12
|
+
throw new error_types_1.ValidationError(`${errorPrefix}: File path is required`, {
|
|
13
|
+
filePath,
|
|
14
|
+
rootPath,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if ((0, path_1.isAbsolute)(filePath)) {
|
|
18
|
+
throw new error_types_1.ValidationError(`${errorPrefix}: Absolute paths are not allowed`, {
|
|
19
|
+
filePath,
|
|
20
|
+
rootPath,
|
|
21
|
+
reason: 'absolute_path',
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (filePath.startsWith('/') || filePath.startsWith('\\')) {
|
|
25
|
+
throw new error_types_1.ValidationError(`${errorPrefix}: Path cannot start with path separator`, {
|
|
26
|
+
filePath,
|
|
27
|
+
rootPath,
|
|
28
|
+
reason: 'leading_separator',
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const normalizedPath = (0, path_1.normalize)(filePath);
|
|
32
|
+
const segments = normalizedPath.split(path_1.sep);
|
|
33
|
+
if (segments.includes('..')) {
|
|
34
|
+
throw new error_types_1.ValidationError(`${errorPrefix}: Path traversal sequences (..) are not allowed`, {
|
|
35
|
+
filePath,
|
|
36
|
+
normalizedPath,
|
|
37
|
+
rootPath,
|
|
38
|
+
reason: 'path_traversal',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (normalizedPath.includes('../') || normalizedPath.includes('..\\')) {
|
|
42
|
+
throw new error_types_1.ValidationError(`${errorPrefix}: Path traversal sequences (..) are not allowed`, {
|
|
43
|
+
filePath,
|
|
44
|
+
normalizedPath,
|
|
45
|
+
rootPath,
|
|
46
|
+
reason: 'path_traversal',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const resolvedRoot = (0, path_1.resolve)(rootPath);
|
|
50
|
+
const absolutePath = (0, path_1.resolve)(resolvedRoot, normalizedPath);
|
|
51
|
+
const relativePath = (0, path_1.relative)(resolvedRoot, absolutePath);
|
|
52
|
+
if (relativePath.startsWith('..')) {
|
|
53
|
+
throw new error_types_1.ValidationError(`${errorPrefix}: Path escapes the root directory`, {
|
|
54
|
+
filePath,
|
|
55
|
+
absolutePath,
|
|
56
|
+
rootPath: resolvedRoot,
|
|
57
|
+
relativePath,
|
|
58
|
+
reason: 'escapes_root',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if ((0, path_1.isAbsolute)(relativePath)) {
|
|
62
|
+
throw new error_types_1.ValidationError(`${errorPrefix}: Path is on a different drive or mount`, {
|
|
63
|
+
filePath,
|
|
64
|
+
absolutePath,
|
|
65
|
+
rootPath: resolvedRoot,
|
|
66
|
+
relativePath,
|
|
67
|
+
reason: 'different_mount',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const rootWithSep = resolvedRoot.endsWith(path_1.sep) ? resolvedRoot : resolvedRoot + path_1.sep;
|
|
71
|
+
if (!absolutePath.startsWith(rootWithSep) && absolutePath !== resolvedRoot) {
|
|
72
|
+
throw new error_types_1.ValidationError(`${errorPrefix}: Resolved path is outside root directory`, {
|
|
73
|
+
filePath,
|
|
74
|
+
absolutePath,
|
|
75
|
+
rootPath: resolvedRoot,
|
|
76
|
+
reason: 'outside_root',
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
absolutePath,
|
|
81
|
+
relativePath,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function validateLineBounds(lineStart, lineEnd, totalLines) {
|
|
85
|
+
if (!Number.isInteger(lineStart) || lineStart < 1) {
|
|
86
|
+
throw new error_types_1.ValidationError('Line start must be a positive integer', {
|
|
87
|
+
lineStart,
|
|
88
|
+
lineEnd,
|
|
89
|
+
totalLines,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (!Number.isInteger(lineEnd) || lineEnd < 1) {
|
|
93
|
+
throw new error_types_1.ValidationError('Line end must be a positive integer', {
|
|
94
|
+
lineStart,
|
|
95
|
+
lineEnd,
|
|
96
|
+
totalLines,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (lineEnd < lineStart) {
|
|
100
|
+
throw new error_types_1.ValidationError('Line end cannot be less than line start', {
|
|
101
|
+
lineStart,
|
|
102
|
+
lineEnd,
|
|
103
|
+
totalLines,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (lineStart > totalLines) {
|
|
107
|
+
throw new error_types_1.ValidationError('Line start exceeds file length', {
|
|
108
|
+
lineStart,
|
|
109
|
+
lineEnd,
|
|
110
|
+
totalLines,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (lineEnd > totalLines) {
|
|
114
|
+
throw new error_types_1.ValidationError('Line end exceeds file length', {
|
|
115
|
+
lineStart,
|
|
116
|
+
lineEnd,
|
|
117
|
+
totalLines,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function validateResolvedPathWithinRoot(absolutePath, rootPath, options = {}) {
|
|
122
|
+
const errorPrefix = options.errorPrefix ?? 'Symlink validation failed';
|
|
123
|
+
const resolvedRoot = (0, path_1.resolve)(rootPath);
|
|
124
|
+
const assertWithinRoot = (pathToCheck) => {
|
|
125
|
+
const rootWithSep = resolvedRoot.endsWith(path_1.sep) ? resolvedRoot : resolvedRoot + path_1.sep;
|
|
126
|
+
if (!pathToCheck.startsWith(rootWithSep) && pathToCheck !== resolvedRoot) {
|
|
127
|
+
throw new error_types_1.ValidationError(`${errorPrefix}: Symlink escapes the root directory`, {
|
|
128
|
+
path: absolutePath,
|
|
129
|
+
realPath: pathToCheck,
|
|
130
|
+
rootPath: resolvedRoot,
|
|
131
|
+
reason: 'symlink_escape',
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
const relativePath = (0, path_1.relative)(resolvedRoot, pathToCheck);
|
|
135
|
+
if (relativePath.startsWith('..') || (0, path_1.isAbsolute)(relativePath)) {
|
|
136
|
+
throw new error_types_1.ValidationError(`${errorPrefix}: Symlink target is outside root directory`, {
|
|
137
|
+
path: absolutePath,
|
|
138
|
+
realPath: pathToCheck,
|
|
139
|
+
rootPath: resolvedRoot,
|
|
140
|
+
relativePath,
|
|
141
|
+
reason: 'symlink_escape',
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
let isSymlink = false;
|
|
146
|
+
try {
|
|
147
|
+
const stats = await (0, promises_1.lstat)(absolutePath);
|
|
148
|
+
isSymlink = stats.isSymbolicLink();
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
if (error.code === 'ENOENT') {
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
const realPath = await (0, promises_1.realpath)(absolutePath);
|
|
159
|
+
assertWithinRoot(realPath);
|
|
160
|
+
return realPath;
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
if (error.code !== 'ENOENT') {
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
if (isSymlink) {
|
|
167
|
+
throw new error_types_1.ValidationError(`${errorPrefix}: Symlink target does not exist`, {
|
|
168
|
+
path: absolutePath,
|
|
169
|
+
rootPath: resolvedRoot,
|
|
170
|
+
reason: 'symlink_target_missing',
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (options.allowNonExistent) {
|
|
174
|
+
let current = (0, path_1.dirname)(absolutePath);
|
|
175
|
+
while (true) {
|
|
176
|
+
try {
|
|
177
|
+
const resolvedAncestor = await (0, promises_1.realpath)(current);
|
|
178
|
+
const tail = (0, path_1.relative)(current, absolutePath);
|
|
179
|
+
const candidatePath = (0, path_1.resolve)(resolvedAncestor, tail);
|
|
180
|
+
assertWithinRoot(candidatePath);
|
|
181
|
+
return candidatePath;
|
|
182
|
+
}
|
|
183
|
+
catch (ancestorError) {
|
|
184
|
+
if (ancestorError.code !== 'ENOENT') {
|
|
185
|
+
throw ancestorError;
|
|
186
|
+
}
|
|
187
|
+
const parent = (0, path_1.dirname)(current);
|
|
188
|
+
if (parent === current)
|
|
189
|
+
break;
|
|
190
|
+
current = parent;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return absolutePath;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=path-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-validation.js","sourceRoot":"","sources":["../../../src/common/validation/path-validation.ts"],"names":[],"mappings":";;AAsDA,wDA2GC;AAUD,gDAwCC;AAoBD,wEAyFC;AAhUD,+BAA8E;AAC9E,0CAA8C;AAC9C,uDAAwD;AAoDxD,SAAgB,sBAAsB,CACpC,QAAgB,EAChB,QAAgB,EAChB,UAAiC,EAAE;IAEnC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,wBAAwB,CAAC;IAGpE,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9C,MAAM,IAAI,6BAAe,CAAC,GAAG,WAAW,yBAAyB,EAAE;YACjE,QAAQ;YACR,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAGD,IAAI,IAAA,iBAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,6BAAe,CAAC,GAAG,WAAW,kCAAkC,EAAE;YAC1E,QAAQ;YACR,QAAQ;YACR,MAAM,EAAE,eAAe;SACxB,CAA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AAgB,GAAG,MAAM,IAAA,mBAAQ,EAAC,OAAO,CAAC,CAAC;oBACjD,MAAM,IAAI,GAAG,IAAA,eAAQ,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;oBAC7C,MAAM,aAAa,GAAG,IAAA,cAAO,EAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;oBACtD,gBAAgB,CAAC,aAAa,CAAC,CAAC;oBAChC,OAAO,aAAa,CAAC;gBACvB,CAAC;gBAAC,OAAO,aAAa,EAAE,CAAC;oBACvB,IAAK,aAAuC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;wBAC/D,MAAM,aAAa,CAAC;oBACtB,CAAC;oBACD,MAAM,MAAM,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,CAAC;oBAChC,IAAI,MAAM,KAAK,OAAO;wBAAE,MAAM;oBAC9B,OAAO,GAAG,MAAM,CAAC;gBACnB,CAAC;YACH,CAAC;QACH,CAAC;QAGD,OAAO,YAAY,CAAC;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -25,8 +25,8 @@ export declare const CreateGroupThreadSchema: z.ZodObject<{
|
|
|
25
25
|
projectId: string;
|
|
26
26
|
agentIds: string[];
|
|
27
27
|
title?: string | undefined;
|
|
28
|
-
createdByType?: "agent" | "user" | "system" | undefined;
|
|
29
28
|
createdByAgentId?: string | undefined;
|
|
29
|
+
createdByType?: "agent" | "user" | "system" | undefined;
|
|
30
30
|
}>;
|
|
31
31
|
export declare const InviteThreadMembersSchema: z.ZodObject<{
|
|
32
32
|
agentIds: z.ZodArray<z.ZodString, "many">;
|
|
@@ -126,10 +126,10 @@ export declare const ThreadSchema: z.ZodObject<{
|
|
|
126
126
|
updatedAt: string;
|
|
127
127
|
projectId: string;
|
|
128
128
|
title: string | null;
|
|
129
|
+
createdByAgentId: string | null;
|
|
129
130
|
isGroup: boolean;
|
|
130
131
|
createdByType: "agent" | "user" | "system";
|
|
131
132
|
createdByUserId: string | null;
|
|
132
|
-
createdByAgentId: string | null;
|
|
133
133
|
members?: string[] | undefined;
|
|
134
134
|
}, {
|
|
135
135
|
id: string;
|
|
@@ -137,10 +137,10 @@ export declare const ThreadSchema: z.ZodObject<{
|
|
|
137
137
|
updatedAt: string;
|
|
138
138
|
projectId: string;
|
|
139
139
|
title: string | null;
|
|
140
|
+
createdByAgentId: string | null;
|
|
140
141
|
isGroup: boolean;
|
|
141
142
|
createdByType: "agent" | "user" | "system";
|
|
142
143
|
createdByUserId: string | null;
|
|
143
|
-
createdByAgentId: string | null;
|
|
144
144
|
members?: string[] | undefined;
|
|
145
145
|
}>;
|
|
146
146
|
export declare const MessageSchema: z.ZodObject<{
|
|
@@ -155,17 +155,17 @@ export declare const MessageSchema: z.ZodObject<{
|
|
|
155
155
|
content: string;
|
|
156
156
|
id: string;
|
|
157
157
|
createdAt: string;
|
|
158
|
-
threadId: string;
|
|
159
158
|
authorType: "agent" | "user" | "system";
|
|
160
159
|
authorAgentId: string | null;
|
|
160
|
+
threadId: string;
|
|
161
161
|
targets?: string[] | undefined;
|
|
162
162
|
}, {
|
|
163
163
|
content: string;
|
|
164
164
|
id: string;
|
|
165
165
|
createdAt: string;
|
|
166
|
-
threadId: string;
|
|
167
166
|
authorType: "agent" | "user" | "system";
|
|
168
167
|
authorAgentId: string | null;
|
|
168
|
+
threadId: string;
|
|
169
169
|
targets?: string[] | undefined;
|
|
170
170
|
}>;
|
|
171
171
|
export declare const ThreadsListSchema: z.ZodObject<{
|
|
@@ -186,10 +186,10 @@ export declare const ThreadsListSchema: z.ZodObject<{
|
|
|
186
186
|
updatedAt: string;
|
|
187
187
|
projectId: string;
|
|
188
188
|
title: string | null;
|
|
189
|
+
createdByAgentId: string | null;
|
|
189
190
|
isGroup: boolean;
|
|
190
191
|
createdByType: "agent" | "user" | "system";
|
|
191
192
|
createdByUserId: string | null;
|
|
192
|
-
createdByAgentId: string | null;
|
|
193
193
|
members?: string[] | undefined;
|
|
194
194
|
}, {
|
|
195
195
|
id: string;
|
|
@@ -197,10 +197,10 @@ export declare const ThreadsListSchema: z.ZodObject<{
|
|
|
197
197
|
updatedAt: string;
|
|
198
198
|
projectId: string;
|
|
199
199
|
title: string | null;
|
|
200
|
+
createdByAgentId: string | null;
|
|
200
201
|
isGroup: boolean;
|
|
201
202
|
createdByType: "agent" | "user" | "system";
|
|
202
203
|
createdByUserId: string | null;
|
|
203
|
-
createdByAgentId: string | null;
|
|
204
204
|
members?: string[] | undefined;
|
|
205
205
|
}>, "many">;
|
|
206
206
|
total: z.ZodNumber;
|
|
@@ -215,10 +215,10 @@ export declare const ThreadsListSchema: z.ZodObject<{
|
|
|
215
215
|
updatedAt: string;
|
|
216
216
|
projectId: string;
|
|
217
217
|
title: string | null;
|
|
218
|
+
createdByAgentId: string | null;
|
|
218
219
|
isGroup: boolean;
|
|
219
220
|
createdByType: "agent" | "user" | "system";
|
|
220
221
|
createdByUserId: string | null;
|
|
221
|
-
createdByAgentId: string | null;
|
|
222
222
|
members?: string[] | undefined;
|
|
223
223
|
}[];
|
|
224
224
|
total: number;
|
|
@@ -231,10 +231,10 @@ export declare const ThreadsListSchema: z.ZodObject<{
|
|
|
231
231
|
updatedAt: string;
|
|
232
232
|
projectId: string;
|
|
233
233
|
title: string | null;
|
|
234
|
+
createdByAgentId: string | null;
|
|
234
235
|
isGroup: boolean;
|
|
235
236
|
createdByType: "agent" | "user" | "system";
|
|
236
237
|
createdByUserId: string | null;
|
|
237
|
-
createdByAgentId: string | null;
|
|
238
238
|
members?: string[] | undefined;
|
|
239
239
|
}[];
|
|
240
240
|
total: number;
|
|
@@ -252,17 +252,17 @@ export declare const MessagesListSchema: z.ZodObject<{
|
|
|
252
252
|
content: string;
|
|
253
253
|
id: string;
|
|
254
254
|
createdAt: string;
|
|
255
|
-
threadId: string;
|
|
256
255
|
authorType: "agent" | "user" | "system";
|
|
257
256
|
authorAgentId: string | null;
|
|
257
|
+
threadId: string;
|
|
258
258
|
targets?: string[] | undefined;
|
|
259
259
|
}, {
|
|
260
260
|
content: string;
|
|
261
261
|
id: string;
|
|
262
262
|
createdAt: string;
|
|
263
|
-
threadId: string;
|
|
264
263
|
authorType: "agent" | "user" | "system";
|
|
265
264
|
authorAgentId: string | null;
|
|
265
|
+
threadId: string;
|
|
266
266
|
targets?: string[] | undefined;
|
|
267
267
|
}>, "many">;
|
|
268
268
|
total: z.ZodNumber;
|
|
@@ -275,9 +275,9 @@ export declare const MessagesListSchema: z.ZodObject<{
|
|
|
275
275
|
content: string;
|
|
276
276
|
id: string;
|
|
277
277
|
createdAt: string;
|
|
278
|
-
threadId: string;
|
|
279
278
|
authorType: "agent" | "user" | "system";
|
|
280
279
|
authorAgentId: string | null;
|
|
280
|
+
threadId: string;
|
|
281
281
|
targets?: string[] | undefined;
|
|
282
282
|
}[];
|
|
283
283
|
total: number;
|
|
@@ -288,9 +288,9 @@ export declare const MessagesListSchema: z.ZodObject<{
|
|
|
288
288
|
content: string;
|
|
289
289
|
id: string;
|
|
290
290
|
createdAt: string;
|
|
291
|
-
threadId: string;
|
|
292
291
|
authorType: "agent" | "user" | "system";
|
|
293
292
|
authorAgentId: string | null;
|
|
293
|
+
threadId: string;
|
|
294
294
|
targets?: string[] | undefined;
|
|
295
295
|
}[];
|
|
296
296
|
total: number;
|
|
@@ -11,6 +11,7 @@ const common_1 = require("@nestjs/common");
|
|
|
11
11
|
const health_controller_1 = require("./controllers/health.controller");
|
|
12
12
|
const preflight_controller_1 = require("./controllers/preflight.controller");
|
|
13
13
|
const preflight_service_1 = require("./services/preflight.service");
|
|
14
|
+
const provider_mcp_ensure_service_1 = require("./services/provider-mcp-ensure.service");
|
|
14
15
|
const storage_module_1 = require("../storage/storage.module");
|
|
15
16
|
const mcp_module_1 = require("../mcp/mcp.module");
|
|
16
17
|
const adapters_1 = require("../providers/adapters");
|
|
@@ -21,8 +22,8 @@ exports.CoreModule = CoreModule = __decorate([
|
|
|
21
22
|
(0, common_1.Module)({
|
|
22
23
|
imports: [storage_module_1.StorageModule, (0, common_1.forwardRef)(() => mcp_module_1.McpModule), adapters_1.ProviderAdaptersModule],
|
|
23
24
|
controllers: [health_controller_1.HealthController, preflight_controller_1.PreflightController],
|
|
24
|
-
providers: [preflight_service_1.PreflightService],
|
|
25
|
-
exports: [preflight_service_1.PreflightService],
|
|
25
|
+
providers: [preflight_service_1.PreflightService, provider_mcp_ensure_service_1.ProviderMcpEnsureService],
|
|
26
|
+
exports: [preflight_service_1.PreflightService, provider_mcp_ensure_service_1.ProviderMcpEnsureService],
|
|
26
27
|
})
|
|
27
28
|
], CoreModule);
|
|
28
29
|
//# sourceMappingURL=core.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.module.js","sourceRoot":"","sources":["../../../src/modules/core/core.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,uEAAmE;AACnE,6EAAyE;AACzE,oEAAgE;AAChE,8DAA0D;AAC1D,kDAA8C;AAC9C,oDAA+D;AAQxD,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IANtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,8BAAa,EAAE,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAS,CAAC,EAAE,iCAAsB,CAAC;QAC7E,WAAW,EAAE,CAAC,oCAAgB,EAAE,0CAAmB,CAAC;QACpD,SAAS,EAAE,CAAC,oCAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"core.module.js","sourceRoot":"","sources":["../../../src/modules/core/core.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,uEAAmE;AACnE,6EAAyE;AACzE,oEAAgE;AAChE,wFAAkF;AAClF,8DAA0D;AAC1D,kDAA8C;AAC9C,oDAA+D;AAQxD,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IANtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,8BAAa,EAAE,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAS,CAAC,EAAE,iCAAsB,CAAC;QAC7E,WAAW,EAAE,CAAC,oCAAgB,EAAE,0CAAmB,CAAC;QACpD,SAAS,EAAE,CAAC,oCAAgB,EAAE,sDAAwB,CAAC;QACvD,OAAO,EAAE,CAAC,oCAAgB,EAAE,sDAAwB,CAAC;KACtD,CAAC;GACW,UAAU,CAAG"}
|
|
@@ -33,8 +33,6 @@ export declare class PreflightService {
|
|
|
33
33
|
private readonly storage;
|
|
34
34
|
private readonly mcpRegistration;
|
|
35
35
|
private readonly adapterFactory;
|
|
36
|
-
private cache;
|
|
37
|
-
private readonly CACHE_TTL_MS;
|
|
38
36
|
constructor(storage: StorageService, mcpRegistration: McpProviderRegistrationService, adapterFactory: ProviderAdapterFactory);
|
|
39
37
|
runChecks(projectPath?: string): Promise<PreflightResult>;
|
|
40
38
|
private evaluateMcpStatus;
|
|
@@ -43,5 +41,5 @@ export declare class PreflightService {
|
|
|
43
41
|
private checkProvider;
|
|
44
42
|
private checkDevchainAccess;
|
|
45
43
|
getCheck(checkName: string, projectPath?: string): Promise<PreflightCheck>;
|
|
46
|
-
clearCache(
|
|
44
|
+
clearCache(_projectPath?: string): void;
|
|
47
45
|
}
|