@kimuson/claude-code-viewer 0.5.4 → 0.5.6
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/main.js +415 -285
- package/dist/main.js.map +4 -4
- package/dist/static/assets/{ProtectedRoute-BKa2KNL5.js → ProtectedRoute-BgPTqfAJ.js} +1 -1
- package/dist/static/assets/{eye-BuuMK_10.js → eye-HGnuNHNq.js} +1 -1
- package/dist/static/assets/{index-if6WtkX7.js → index-BgCTiChu.js} +1 -1
- package/dist/static/assets/{index-CPXteyzl.js → index-MC7Mcsm_.js} +1 -1
- package/dist/static/assets/{index-B5f8xC3F.js → index-o-QkXv15.js} +31 -31
- package/dist/static/assets/{label-CBuy4auH.js → label-Dbrhlt6Q.js} +1 -1
- package/dist/static/assets/{login-Umq8wXxy.js → login-DLFikBnP.js} +1 -1
- package/dist/static/assets/messages-B5irpNQT.js +1 -0
- package/dist/static/assets/messages-D3U3CVR4.js +1 -0
- package/dist/static/assets/messages-Di1s38Te.js +1 -0
- package/dist/static/assets/{session-DTsxKUn0.js → session-CmUhDy9N.js} +1 -1
- package/dist/static/assets/{session-k-eoDLbo.js → session-FUMUCSUK.js} +59 -57
- package/dist/static/index.html +1 -1
- package/package.json +1 -1
- package/dist/static/assets/messages-BJ1VgsgX.js +0 -1
- package/dist/static/assets/messages-IXcunSHt.js +0 -1
- package/dist/static/assets/messages-oFJMtVzX.js +0 -1
package/dist/main.js
CHANGED
|
@@ -7,7 +7,7 @@ import { Effect as Effect49 } from "effect";
|
|
|
7
7
|
// package.json
|
|
8
8
|
var package_default = {
|
|
9
9
|
name: "@kimuson/claude-code-viewer",
|
|
10
|
-
version: "0.5.
|
|
10
|
+
version: "0.5.6",
|
|
11
11
|
description: "A full-featured web-based Claude Code client that provides complete interactive functionality for managing Claude Code projects.",
|
|
12
12
|
type: "module",
|
|
13
13
|
license: "MIT",
|
|
@@ -229,7 +229,7 @@ import { FileSystem, Path } from "@effect/platform";
|
|
|
229
229
|
import { Context, Effect as Effect2, Layer } from "effect";
|
|
230
230
|
|
|
231
231
|
// src/lib/conversation-schema/index.ts
|
|
232
|
-
import { z as
|
|
232
|
+
import { z as z17 } from "zod";
|
|
233
233
|
|
|
234
234
|
// src/lib/conversation-schema/entry/AssistantEntrySchema.ts
|
|
235
235
|
import { z as z8 } from "zod";
|
|
@@ -336,7 +336,8 @@ var BaseEntrySchema = z7.object({
|
|
|
336
336
|
toolUseResult: z7.unknown().optional(),
|
|
337
337
|
// スキーマがツールごとに異なりすぎるし利用もしなそうなので unknown
|
|
338
338
|
gitBranch: z7.string().optional(),
|
|
339
|
-
isCompactSummary: z7.boolean().optional()
|
|
339
|
+
isCompactSummary: z7.boolean().optional(),
|
|
340
|
+
agentId: z7.string().optional()
|
|
340
341
|
});
|
|
341
342
|
|
|
342
343
|
// src/lib/conversation-schema/entry/AssistantEntrySchema.ts
|
|
@@ -365,141 +366,203 @@ var FileHistorySnapshotEntrySchema = z9.object({
|
|
|
365
366
|
isSnapshotUpdate: z9.boolean()
|
|
366
367
|
});
|
|
367
368
|
|
|
369
|
+
// src/lib/conversation-schema/entry/ProgressEntrySchema.ts
|
|
370
|
+
import { z as z10 } from "zod";
|
|
371
|
+
var ProgressEntrySchema = BaseEntrySchema.extend({
|
|
372
|
+
// discriminator
|
|
373
|
+
type: z10.literal("progress"),
|
|
374
|
+
// required
|
|
375
|
+
data: z10.record(z10.string(), z10.any()),
|
|
376
|
+
toolUseID: z10.string().optional(),
|
|
377
|
+
parentToolUseID: z10.string().optional()
|
|
378
|
+
});
|
|
379
|
+
|
|
368
380
|
// src/lib/conversation-schema/entry/QueueOperationEntrySchema.ts
|
|
369
|
-
import { z as
|
|
381
|
+
import { z as z12 } from "zod";
|
|
370
382
|
|
|
371
383
|
// src/lib/conversation-schema/content/DocumentContentSchema.ts
|
|
372
|
-
import { z as
|
|
373
|
-
var DocumentContentSchema =
|
|
374
|
-
type:
|
|
375
|
-
source:
|
|
376
|
-
|
|
377
|
-
media_type:
|
|
378
|
-
type:
|
|
379
|
-
data:
|
|
384
|
+
import { z as z11 } from "zod";
|
|
385
|
+
var DocumentContentSchema = z11.object({
|
|
386
|
+
type: z11.literal("document"),
|
|
387
|
+
source: z11.union([
|
|
388
|
+
z11.object({
|
|
389
|
+
media_type: z11.literal("text/plain"),
|
|
390
|
+
type: z11.literal("text"),
|
|
391
|
+
data: z11.string()
|
|
380
392
|
}),
|
|
381
|
-
|
|
382
|
-
media_type:
|
|
383
|
-
type:
|
|
384
|
-
data:
|
|
393
|
+
z11.object({
|
|
394
|
+
media_type: z11.enum(["application/pdf"]),
|
|
395
|
+
type: z11.literal("base64"),
|
|
396
|
+
data: z11.string()
|
|
385
397
|
})
|
|
386
398
|
])
|
|
387
399
|
});
|
|
388
400
|
|
|
389
401
|
// src/lib/conversation-schema/entry/QueueOperationEntrySchema.ts
|
|
390
|
-
var QueueOperationContentSchema =
|
|
391
|
-
|
|
402
|
+
var QueueOperationContentSchema = z12.union([
|
|
403
|
+
z12.string(),
|
|
392
404
|
TextContentSchema,
|
|
393
405
|
ToolResultContentSchema,
|
|
394
406
|
ImageContentSchema,
|
|
395
407
|
DocumentContentSchema
|
|
396
408
|
]);
|
|
397
|
-
var QueueOperationEntrySchema =
|
|
398
|
-
|
|
399
|
-
type:
|
|
400
|
-
operation:
|
|
401
|
-
content:
|
|
402
|
-
|
|
403
|
-
|
|
409
|
+
var QueueOperationEntrySchema = z12.union([
|
|
410
|
+
z12.object({
|
|
411
|
+
type: z12.literal("queue-operation"),
|
|
412
|
+
operation: z12.literal("enqueue"),
|
|
413
|
+
content: z12.union([
|
|
414
|
+
z12.string(),
|
|
415
|
+
z12.array(z12.union([z12.string(), QueueOperationContentSchema]))
|
|
404
416
|
]),
|
|
405
|
-
sessionId:
|
|
406
|
-
timestamp:
|
|
417
|
+
sessionId: z12.string(),
|
|
418
|
+
timestamp: z12.iso.datetime()
|
|
419
|
+
}),
|
|
420
|
+
z12.object({
|
|
421
|
+
type: z12.literal("queue-operation"),
|
|
422
|
+
operation: z12.literal("dequeue"),
|
|
423
|
+
sessionId: z12.string(),
|
|
424
|
+
timestamp: z12.iso.datetime()
|
|
407
425
|
}),
|
|
408
|
-
|
|
409
|
-
type:
|
|
410
|
-
operation:
|
|
411
|
-
sessionId:
|
|
412
|
-
timestamp:
|
|
426
|
+
z12.object({
|
|
427
|
+
type: z12.literal("queue-operation"),
|
|
428
|
+
operation: z12.literal("remove"),
|
|
429
|
+
sessionId: z12.string(),
|
|
430
|
+
timestamp: z12.iso.datetime()
|
|
413
431
|
}),
|
|
414
|
-
|
|
415
|
-
type:
|
|
416
|
-
operation:
|
|
417
|
-
sessionId:
|
|
418
|
-
timestamp:
|
|
432
|
+
z12.object({
|
|
433
|
+
type: z12.literal("queue-operation"),
|
|
434
|
+
operation: z12.literal("popAll"),
|
|
435
|
+
sessionId: z12.string(),
|
|
436
|
+
timestamp: z12.iso.datetime(),
|
|
437
|
+
content: z12.string().optional()
|
|
419
438
|
})
|
|
420
439
|
]);
|
|
421
440
|
|
|
422
441
|
// src/lib/conversation-schema/entry/SummaryEntrySchema.ts
|
|
423
|
-
import { z as
|
|
424
|
-
var SummaryEntrySchema =
|
|
425
|
-
type:
|
|
426
|
-
summary:
|
|
427
|
-
leafUuid:
|
|
442
|
+
import { z as z13 } from "zod";
|
|
443
|
+
var SummaryEntrySchema = z13.object({
|
|
444
|
+
type: z13.literal("summary"),
|
|
445
|
+
summary: z13.string(),
|
|
446
|
+
leafUuid: z13.string().uuid()
|
|
428
447
|
});
|
|
429
448
|
|
|
430
449
|
// src/lib/conversation-schema/entry/SystemEntrySchema.ts
|
|
431
|
-
import { z as
|
|
432
|
-
var HookInfoSchema =
|
|
433
|
-
command:
|
|
450
|
+
import { z as z14 } from "zod";
|
|
451
|
+
var HookInfoSchema = z14.object({
|
|
452
|
+
command: z14.string()
|
|
434
453
|
});
|
|
435
454
|
var SystemEntryWithContentSchema = BaseEntrySchema.extend({
|
|
436
|
-
type:
|
|
437
|
-
content:
|
|
438
|
-
toolUseID:
|
|
439
|
-
level:
|
|
440
|
-
subtype:
|
|
455
|
+
type: z14.literal("system"),
|
|
456
|
+
content: z14.string(),
|
|
457
|
+
toolUseID: z14.string(),
|
|
458
|
+
level: z14.enum(["info"]),
|
|
459
|
+
subtype: z14.undefined().optional()
|
|
441
460
|
});
|
|
442
461
|
var StopHookSummaryEntrySchema = BaseEntrySchema.extend({
|
|
443
|
-
type:
|
|
444
|
-
subtype:
|
|
445
|
-
toolUseID:
|
|
446
|
-
level:
|
|
447
|
-
slug:
|
|
448
|
-
hookCount:
|
|
449
|
-
hookInfos:
|
|
450
|
-
hookErrors:
|
|
451
|
-
preventedContinuation:
|
|
452
|
-
stopReason:
|
|
453
|
-
hasOutput:
|
|
462
|
+
type: z14.literal("system"),
|
|
463
|
+
subtype: z14.literal("stop_hook_summary"),
|
|
464
|
+
toolUseID: z14.string(),
|
|
465
|
+
level: z14.enum(["info", "suggestion"]),
|
|
466
|
+
slug: z14.string().optional(),
|
|
467
|
+
hookCount: z14.number(),
|
|
468
|
+
hookInfos: z14.array(HookInfoSchema),
|
|
469
|
+
hookErrors: z14.array(z14.unknown()),
|
|
470
|
+
preventedContinuation: z14.boolean(),
|
|
471
|
+
stopReason: z14.string(),
|
|
472
|
+
hasOutput: z14.boolean()
|
|
454
473
|
});
|
|
455
474
|
var LocalCommandEntrySchema = BaseEntrySchema.extend({
|
|
456
|
-
type:
|
|
457
|
-
subtype:
|
|
458
|
-
content:
|
|
459
|
-
level:
|
|
475
|
+
type: z14.literal("system"),
|
|
476
|
+
subtype: z14.literal("local_command"),
|
|
477
|
+
content: z14.string(),
|
|
478
|
+
level: z14.enum(["info"])
|
|
479
|
+
});
|
|
480
|
+
var TurnDurationEntrySchema = BaseEntrySchema.extend({
|
|
481
|
+
type: z14.literal("system"),
|
|
482
|
+
subtype: z14.literal("turn_duration"),
|
|
483
|
+
durationMs: z14.number(),
|
|
484
|
+
slug: z14.string().optional()
|
|
460
485
|
});
|
|
461
|
-
var
|
|
486
|
+
var CompactBoundaryEntrySchema = BaseEntrySchema.extend({
|
|
487
|
+
type: z14.literal("system"),
|
|
488
|
+
subtype: z14.literal("compact_boundary"),
|
|
489
|
+
content: z14.string(),
|
|
490
|
+
level: z14.enum(["info"]),
|
|
491
|
+
slug: z14.string().optional(),
|
|
492
|
+
logicalParentUuid: z14.string().optional(),
|
|
493
|
+
compactMetadata: z14.object({
|
|
494
|
+
trigger: z14.string(),
|
|
495
|
+
preTokens: z14.number()
|
|
496
|
+
}).optional()
|
|
497
|
+
});
|
|
498
|
+
var ApiErrorEntrySchema = BaseEntrySchema.extend({
|
|
499
|
+
type: z14.literal("system"),
|
|
500
|
+
subtype: z14.literal("api_error"),
|
|
501
|
+
level: z14.enum(["error", "warning", "info"]),
|
|
502
|
+
error: z14.object({
|
|
503
|
+
status: z14.number().optional(),
|
|
504
|
+
headers: z14.record(z14.string(), z14.unknown()).optional(),
|
|
505
|
+
requestID: z14.string().nullable().optional(),
|
|
506
|
+
error: z14.object({
|
|
507
|
+
type: z14.string(),
|
|
508
|
+
error: z14.object({
|
|
509
|
+
type: z14.string(),
|
|
510
|
+
message: z14.string()
|
|
511
|
+
}).optional(),
|
|
512
|
+
message: z14.string().optional()
|
|
513
|
+
}).optional()
|
|
514
|
+
}),
|
|
515
|
+
retryInMs: z14.number().optional(),
|
|
516
|
+
retryAttempt: z14.number().optional(),
|
|
517
|
+
maxRetries: z14.number().optional()
|
|
518
|
+
});
|
|
519
|
+
var SystemEntrySchema = z14.union([
|
|
462
520
|
StopHookSummaryEntrySchema,
|
|
463
521
|
LocalCommandEntrySchema,
|
|
522
|
+
TurnDurationEntrySchema,
|
|
523
|
+
CompactBoundaryEntrySchema,
|
|
524
|
+
ApiErrorEntrySchema,
|
|
464
525
|
SystemEntryWithContentSchema
|
|
526
|
+
// Must be last (catch-all for undefined subtype)
|
|
465
527
|
]);
|
|
466
528
|
|
|
467
529
|
// src/lib/conversation-schema/entry/UserEntrySchema.ts
|
|
468
|
-
import { z as
|
|
530
|
+
import { z as z16 } from "zod";
|
|
469
531
|
|
|
470
532
|
// src/lib/conversation-schema/message/UserMessageSchema.ts
|
|
471
|
-
import { z as
|
|
472
|
-
var UserMessageContentSchema =
|
|
473
|
-
|
|
533
|
+
import { z as z15 } from "zod";
|
|
534
|
+
var UserMessageContentSchema = z15.union([
|
|
535
|
+
z15.string(),
|
|
474
536
|
TextContentSchema,
|
|
475
537
|
ToolResultContentSchema,
|
|
476
538
|
ImageContentSchema,
|
|
477
539
|
DocumentContentSchema
|
|
478
540
|
]);
|
|
479
|
-
var UserMessageSchema =
|
|
480
|
-
role:
|
|
481
|
-
content:
|
|
482
|
-
|
|
483
|
-
|
|
541
|
+
var UserMessageSchema = z15.object({
|
|
542
|
+
role: z15.literal("user"),
|
|
543
|
+
content: z15.union([
|
|
544
|
+
z15.string(),
|
|
545
|
+
z15.array(z15.union([z15.string(), UserMessageContentSchema]))
|
|
484
546
|
])
|
|
485
547
|
});
|
|
486
548
|
|
|
487
549
|
// src/lib/conversation-schema/entry/UserEntrySchema.ts
|
|
488
550
|
var UserEntrySchema = BaseEntrySchema.extend({
|
|
489
551
|
// discriminator
|
|
490
|
-
type:
|
|
552
|
+
type: z16.literal("user"),
|
|
491
553
|
// required
|
|
492
554
|
message: UserMessageSchema
|
|
493
555
|
});
|
|
494
556
|
|
|
495
557
|
// src/lib/conversation-schema/index.ts
|
|
496
|
-
var ConversationSchema =
|
|
558
|
+
var ConversationSchema = z17.union([
|
|
497
559
|
UserEntrySchema,
|
|
498
560
|
AssistantEntrySchema,
|
|
499
561
|
SummaryEntrySchema,
|
|
500
562
|
SystemEntrySchema,
|
|
501
563
|
FileHistorySnapshotEntrySchema,
|
|
502
|
-
QueueOperationEntrySchema
|
|
564
|
+
QueueOperationEntrySchema,
|
|
565
|
+
ProgressEntrySchema
|
|
503
566
|
]);
|
|
504
567
|
|
|
505
568
|
// src/server/core/claude-code/functions/parseJsonl.ts
|
|
@@ -535,8 +598,20 @@ var encodeProjectIdFromSessionFilePath = (sessionFilePath) => {
|
|
|
535
598
|
var LayerImpl = Effect2.gen(function* () {
|
|
536
599
|
const fs = yield* FileSystem.FileSystem;
|
|
537
600
|
const path = yield* Path.Path;
|
|
538
|
-
const getAgentSessionByAgentId = (projectId, agentId) => Effect2.gen(function* () {
|
|
601
|
+
const getAgentSessionByAgentId = (projectId, agentId, sessionId) => Effect2.gen(function* () {
|
|
539
602
|
const projectPath = decodeProjectId(projectId);
|
|
603
|
+
if (sessionId) {
|
|
604
|
+
const newPath = path.resolve(
|
|
605
|
+
projectPath,
|
|
606
|
+
sessionId,
|
|
607
|
+
"subagents",
|
|
608
|
+
`agent-${agentId}.jsonl`
|
|
609
|
+
);
|
|
610
|
+
if (yield* fs.exists(newPath)) {
|
|
611
|
+
const content2 = yield* fs.readFileString(newPath);
|
|
612
|
+
return parseJsonl(content2);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
540
615
|
const agentFilePath = path.resolve(projectPath, `agent-${agentId}.jsonl`);
|
|
541
616
|
const exists = yield* fs.exists(agentFilePath);
|
|
542
617
|
if (!exists) {
|
|
@@ -563,10 +638,11 @@ import { Context as Context2, Effect as Effect3, Layer as Layer2 } from "effect"
|
|
|
563
638
|
var LayerImpl2 = Effect3.gen(function* () {
|
|
564
639
|
const repository = yield* AgentSessionRepository;
|
|
565
640
|
const getAgentSession = (params) => Effect3.gen(function* () {
|
|
566
|
-
const { projectId, agentId } = params;
|
|
641
|
+
const { projectId, agentId, sessionId } = params;
|
|
567
642
|
const conversations = yield* repository.getAgentSessionByAgentId(
|
|
568
643
|
projectId,
|
|
569
|
-
agentId
|
|
644
|
+
agentId,
|
|
645
|
+
sessionId
|
|
570
646
|
);
|
|
571
647
|
if (conversations === null) {
|
|
572
648
|
return {
|
|
@@ -692,7 +768,7 @@ import { Context as Context7, Effect as Effect9, Layer as Layer9, Option as Opti
|
|
|
692
768
|
// src/server/core/project/services/ProjectMetaService.ts
|
|
693
769
|
import { FileSystem as FileSystem3, Path as Path4 } from "@effect/platform";
|
|
694
770
|
import { Context as Context6, Effect as Effect8, Layer as Layer8, Option, Ref as Ref3 } from "effect";
|
|
695
|
-
import { z as
|
|
771
|
+
import { z as z19 } from "zod";
|
|
696
772
|
|
|
697
773
|
// src/server/lib/storage/FileCacheStorage/index.ts
|
|
698
774
|
import { Context as Context5, Effect as Effect7, Layer as Layer7, Ref as Ref2, Runtime } from "effect";
|
|
@@ -700,7 +776,7 @@ import { Context as Context5, Effect as Effect7, Layer as Layer7, Ref as Ref2, R
|
|
|
700
776
|
// src/server/lib/storage/FileCacheStorage/PersistentService.ts
|
|
701
777
|
import { FileSystem as FileSystem2, Path as Path3 } from "@effect/platform";
|
|
702
778
|
import { Context as Context4, Effect as Effect6, Layer as Layer6 } from "effect";
|
|
703
|
-
import { z as
|
|
779
|
+
import { z as z18 } from "zod";
|
|
704
780
|
|
|
705
781
|
// src/server/lib/config/paths.ts
|
|
706
782
|
import { homedir as homedir2 } from "node:os";
|
|
@@ -712,7 +788,7 @@ var claudeCodeViewerCacheDirPath = resolve(
|
|
|
712
788
|
);
|
|
713
789
|
|
|
714
790
|
// src/server/lib/storage/FileCacheStorage/PersistentService.ts
|
|
715
|
-
var saveSchema =
|
|
791
|
+
var saveSchema = z18.array(z18.tuple([z18.string(), z18.unknown()]));
|
|
716
792
|
var LayerImpl5 = Effect6.gen(function* () {
|
|
717
793
|
const path = yield* Path3.Path;
|
|
718
794
|
const getCacheFilePath = (key) => path.resolve(claudeCodeViewerCacheDirPath, `${key}.json`);
|
|
@@ -825,7 +901,7 @@ var makeFileCacheStorageLayer = (storageKey, schema) => Layer7.effect(
|
|
|
825
901
|
);
|
|
826
902
|
|
|
827
903
|
// src/server/core/project/services/ProjectMetaService.ts
|
|
828
|
-
var ProjectPathSchema =
|
|
904
|
+
var ProjectPathSchema = z19.string().nullable();
|
|
829
905
|
var LayerImpl6 = Effect8.gen(function* () {
|
|
830
906
|
const fs = yield* FileSystem3.FileSystem;
|
|
831
907
|
const path = yield* Path4.Path;
|
|
@@ -1087,12 +1163,12 @@ var scanSkillFilesRecursively = (dirPath) => Effect10.gen(function* () {
|
|
|
1087
1163
|
});
|
|
1088
1164
|
|
|
1089
1165
|
// src/server/core/claude-code/models/ClaudeCodeVersion.ts
|
|
1090
|
-
import { z as
|
|
1166
|
+
import { z as z20 } from "zod";
|
|
1091
1167
|
var versionRegex = /^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/;
|
|
1092
|
-
var versionSchema =
|
|
1093
|
-
major:
|
|
1094
|
-
minor:
|
|
1095
|
-
patch:
|
|
1168
|
+
var versionSchema = z20.object({
|
|
1169
|
+
major: z20.string().transform((value) => Number.parseInt(value, 10)),
|
|
1170
|
+
minor: z20.string().transform((value) => Number.parseInt(value, 10)),
|
|
1171
|
+
patch: z20.string().transform((value) => Number.parseInt(value, 10))
|
|
1096
1172
|
}).refine(
|
|
1097
1173
|
(data) => [data.major, data.minor, data.patch].every((value) => !Number.isNaN(value))
|
|
1098
1174
|
);
|
|
@@ -1262,6 +1338,8 @@ var query3 = (prompt, options) => {
|
|
|
1262
1338
|
const options2 = {
|
|
1263
1339
|
pathToClaudeCodeExecutable: claudeCodeExecutablePath,
|
|
1264
1340
|
...baseOptions,
|
|
1341
|
+
disallowedTools: ["AskUserQuestion"],
|
|
1342
|
+
// Cannot answer from web interface instead of CLI
|
|
1265
1343
|
...availableFeatures.canUseTool ? { canUseTool, permissionMode } : {
|
|
1266
1344
|
permissionMode: "bypassPermissions"
|
|
1267
1345
|
}
|
|
@@ -1295,6 +1373,8 @@ var query3 = (prompt, options) => {
|
|
|
1295
1373
|
prompt,
|
|
1296
1374
|
options: {
|
|
1297
1375
|
...baseOptions,
|
|
1376
|
+
disallowedTools: ["AskUserQuestion"],
|
|
1377
|
+
// Cannot answer from web interface instead of CLI
|
|
1298
1378
|
permissionMode: (
|
|
1299
1379
|
// fallback unsupported permission modes
|
|
1300
1380
|
permissionMode === "delegate" || permissionMode === "dontAsk" ? "bypassPermissions" : permissionMode
|
|
@@ -1726,26 +1806,26 @@ import { FileSystem as FileSystem9, Path as Path11 } from "@effect/platform";
|
|
|
1726
1806
|
import { Context as Context16, Effect as Effect21, Layer as Layer18, Option as Option3 } from "effect";
|
|
1727
1807
|
|
|
1728
1808
|
// src/server/core/claude-code/functions/parseUserMessage.ts
|
|
1729
|
-
import { z as
|
|
1809
|
+
import { z as z21 } from "zod";
|
|
1730
1810
|
var regExp = /<(?<tag>[^>]+)>(?<content>\s*[^<]*?\s*)<\/\k<tag>>/g;
|
|
1731
|
-
var matchSchema =
|
|
1732
|
-
tag:
|
|
1733
|
-
content:
|
|
1811
|
+
var matchSchema = z21.object({
|
|
1812
|
+
tag: z21.string(),
|
|
1813
|
+
content: z21.string()
|
|
1734
1814
|
});
|
|
1735
|
-
var parsedUserMessageSchema =
|
|
1736
|
-
|
|
1737
|
-
kind:
|
|
1738
|
-
commandName:
|
|
1739
|
-
commandArgs:
|
|
1740
|
-
commandMessage:
|
|
1815
|
+
var parsedUserMessageSchema = z21.union([
|
|
1816
|
+
z21.object({
|
|
1817
|
+
kind: z21.literal("command"),
|
|
1818
|
+
commandName: z21.string(),
|
|
1819
|
+
commandArgs: z21.string().optional(),
|
|
1820
|
+
commandMessage: z21.string().optional()
|
|
1741
1821
|
}),
|
|
1742
|
-
|
|
1743
|
-
kind:
|
|
1744
|
-
stdout:
|
|
1822
|
+
z21.object({
|
|
1823
|
+
kind: z21.literal("local-command"),
|
|
1824
|
+
stdout: z21.string()
|
|
1745
1825
|
}),
|
|
1746
|
-
|
|
1747
|
-
kind:
|
|
1748
|
-
content:
|
|
1826
|
+
z21.object({
|
|
1827
|
+
kind: z21.literal("text"),
|
|
1828
|
+
content: z21.string()
|
|
1749
1829
|
})
|
|
1750
1830
|
]);
|
|
1751
1831
|
var parseUserMessage = (content) => {
|
|
@@ -2040,36 +2120,53 @@ import { Effect as Effect19 } from "effect";
|
|
|
2040
2120
|
var getAgentSessionFilesForSession = (projectPath, sessionId) => Effect19.gen(function* () {
|
|
2041
2121
|
const fs = yield* FileSystem7.FileSystem;
|
|
2042
2122
|
const path = yield* Path9.Path;
|
|
2043
|
-
const
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
const firstLine = content.split("\n")[0];
|
|
2053
|
-
if (!firstLine || firstLine.trim() === "") {
|
|
2123
|
+
const isValidAgentFile = (filePath, expectedSessionId) => Effect19.gen(function* () {
|
|
2124
|
+
const content = yield* fs.readFileString(filePath);
|
|
2125
|
+
const firstLine = content.split("\n")[0];
|
|
2126
|
+
if (!firstLine || firstLine.trim() === "") {
|
|
2127
|
+
return false;
|
|
2128
|
+
}
|
|
2129
|
+
try {
|
|
2130
|
+
const firstLineData = JSON.parse(firstLine);
|
|
2131
|
+
if (typeof firstLineData !== "object" || firstLineData === null) {
|
|
2054
2132
|
return false;
|
|
2055
2133
|
}
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
if (typeof firstLineData === "object" && firstLineData !== null && "sessionId" in firstLineData && firstLineData.sessionId === sessionId) {
|
|
2059
|
-
return true;
|
|
2060
|
-
}
|
|
2061
|
-
} catch {
|
|
2062
|
-
return false;
|
|
2134
|
+
if (expectedSessionId !== void 0) {
|
|
2135
|
+
return "sessionId" in firstLineData && firstLineData.sessionId === expectedSessionId;
|
|
2063
2136
|
}
|
|
2137
|
+
return "sessionId" in firstLineData;
|
|
2138
|
+
} catch {
|
|
2064
2139
|
return false;
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2140
|
+
}
|
|
2141
|
+
}).pipe(Effect19.catchAll(() => Effect19.succeed(false)));
|
|
2142
|
+
const matchingFilePaths = [];
|
|
2143
|
+
const rootEntries = yield* fs.readDirectory(projectPath);
|
|
2144
|
+
const rootAgentFiles = rootEntries.filter(
|
|
2145
|
+
(filename) => filename.startsWith("agent-") && filename.endsWith(".jsonl")
|
|
2146
|
+
);
|
|
2147
|
+
for (const agentFile of rootAgentFiles) {
|
|
2148
|
+
const filePath = path.join(projectPath, agentFile);
|
|
2149
|
+
if (yield* isValidAgentFile(filePath, sessionId)) {
|
|
2070
2150
|
matchingFilePaths.push(filePath);
|
|
2071
2151
|
}
|
|
2072
2152
|
}
|
|
2153
|
+
const subagentsDir = path.join(projectPath, sessionId, "subagents");
|
|
2154
|
+
const subagentsDirExists = yield* fs.exists(subagentsDir);
|
|
2155
|
+
if (subagentsDirExists) {
|
|
2156
|
+
const subagentEntries = yield* fs.readDirectory(subagentsDir).pipe(
|
|
2157
|
+
Effect19.catchAll(() => Effect19.succeed([]))
|
|
2158
|
+
// Handle permission or other errors gracefully
|
|
2159
|
+
);
|
|
2160
|
+
const subagentFiles = subagentEntries.filter(
|
|
2161
|
+
(filename) => filename.startsWith("agent-") && filename.endsWith(".jsonl")
|
|
2162
|
+
);
|
|
2163
|
+
for (const agentFile of subagentFiles) {
|
|
2164
|
+
const filePath = path.join(subagentsDir, agentFile);
|
|
2165
|
+
if (yield* isValidAgentFile(filePath, void 0)) {
|
|
2166
|
+
matchingFilePaths.push(filePath);
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2073
2170
|
return matchingFilePaths;
|
|
2074
2171
|
});
|
|
2075
2172
|
|
|
@@ -2200,7 +2297,7 @@ var SessionMetaService = class extends Context15.Tag("SessionMetaService")() {
|
|
|
2200
2297
|
}
|
|
2201
2298
|
}
|
|
2202
2299
|
const fileContents = [content, ...agentContents];
|
|
2203
|
-
const { totalCost } = aggregateTokenUsageAndCost(fileContents);
|
|
2300
|
+
const { totalCost, modelName } = aggregateTokenUsageAndCost(fileContents);
|
|
2204
2301
|
const sessionMeta = {
|
|
2205
2302
|
messageCount: lines.length,
|
|
2206
2303
|
firstUserMessage,
|
|
@@ -2208,7 +2305,8 @@ var SessionMetaService = class extends Context15.Tag("SessionMetaService")() {
|
|
|
2208
2305
|
totalUsd: totalCost.totalUsd,
|
|
2209
2306
|
breakdown: totalCost.breakdown,
|
|
2210
2307
|
tokenUsage: totalCost.tokenUsage
|
|
2211
|
-
}
|
|
2308
|
+
},
|
|
2309
|
+
modelName
|
|
2212
2310
|
};
|
|
2213
2311
|
yield* Ref7.update(sessionMetaCacheRef, (cache) => {
|
|
2214
2312
|
cache.set(sessionId, sessionMeta);
|
|
@@ -2314,7 +2412,8 @@ var LayerImpl13 = Effect21.gen(function* () {
|
|
|
2314
2412
|
cacheCreationTokens: 0,
|
|
2315
2413
|
cacheReadTokens: 0
|
|
2316
2414
|
}
|
|
2317
|
-
}
|
|
2415
|
+
},
|
|
2416
|
+
modelName: null
|
|
2318
2417
|
},
|
|
2319
2418
|
conversations: virtualConversation.conversations,
|
|
2320
2419
|
lastModifiedAt: lastConversation !== void 0 ? new Date(lastConversation.timestamp) : /* @__PURE__ */ new Date()
|
|
@@ -2430,7 +2529,8 @@ var LayerImpl13 = Effect21.gen(function* () {
|
|
|
2430
2529
|
cacheCreationTokens: 0,
|
|
2431
2530
|
cacheReadTokens: 0
|
|
2432
2531
|
}
|
|
2433
|
-
}
|
|
2532
|
+
},
|
|
2533
|
+
modelName: null
|
|
2434
2534
|
}
|
|
2435
2535
|
};
|
|
2436
2536
|
}).sort((a, b) => {
|
|
@@ -3000,6 +3100,10 @@ var LayerImpl15 = Effect24.gen(function* () {
|
|
|
3000
3100
|
baseSessionId,
|
|
3001
3101
|
[virtualConversation]
|
|
3002
3102
|
);
|
|
3103
|
+
yield* eventBusService.emit("virtualConversationUpdated", {
|
|
3104
|
+
projectId: sessionProcess.def.projectId,
|
|
3105
|
+
sessionId: baseSessionId
|
|
3106
|
+
});
|
|
3003
3107
|
sessionProcess.def.setNextMessage(input);
|
|
3004
3108
|
return {
|
|
3005
3109
|
sessionProcess,
|
|
@@ -3053,7 +3157,7 @@ var LayerImpl15 = Effect24.gen(function* () {
|
|
|
3053
3157
|
return "break";
|
|
3054
3158
|
}
|
|
3055
3159
|
if (processState.type === "paused") {
|
|
3056
|
-
yield* Effect24.die(
|
|
3160
|
+
return yield* Effect24.die(
|
|
3057
3161
|
new Error("Illegal state: paused is not expected")
|
|
3058
3162
|
);
|
|
3059
3163
|
}
|
|
@@ -3106,6 +3210,10 @@ var LayerImpl15 = Effect24.gen(function* () {
|
|
|
3106
3210
|
sessionFileCreatedPromise.resolve({
|
|
3107
3211
|
sessionId: message.session_id
|
|
3108
3212
|
});
|
|
3213
|
+
yield* eventBusService.emit("virtualConversationUpdated", {
|
|
3214
|
+
projectId: processState.def.projectId,
|
|
3215
|
+
sessionId: message.session_id
|
|
3216
|
+
});
|
|
3109
3217
|
yield* virtualConversationDatabase.deleteVirtualConversations(
|
|
3110
3218
|
message.session_id
|
|
3111
3219
|
);
|
|
@@ -3462,12 +3570,24 @@ var LayerImpl17 = Effect27.gen(function* () {
|
|
|
3462
3570
|
})
|
|
3463
3571
|
);
|
|
3464
3572
|
};
|
|
3573
|
+
const onVirtualConversationUpdated = (event) => {
|
|
3574
|
+
Effect27.runFork(
|
|
3575
|
+
typeSafeSSE.writeSSE("virtualConversationUpdated", {
|
|
3576
|
+
projectId: event.projectId,
|
|
3577
|
+
sessionId: event.sessionId
|
|
3578
|
+
})
|
|
3579
|
+
);
|
|
3580
|
+
};
|
|
3465
3581
|
yield* eventBus.on("sessionListChanged", onSessionListChanged);
|
|
3466
3582
|
yield* eventBus.on("sessionChanged", onSessionChanged);
|
|
3467
3583
|
yield* eventBus.on("agentSessionChanged", onAgentSessionChanged);
|
|
3468
3584
|
yield* eventBus.on("sessionProcessChanged", onSessionProcessChanged);
|
|
3469
3585
|
yield* eventBus.on("heartbeat", onHeartbeat);
|
|
3470
3586
|
yield* eventBus.on("permissionRequested", onPermissionRequested);
|
|
3587
|
+
yield* eventBus.on(
|
|
3588
|
+
"virtualConversationUpdated",
|
|
3589
|
+
onVirtualConversationUpdated
|
|
3590
|
+
);
|
|
3471
3591
|
const { connectionPromise } = adaptInternalEventToSSE(rawStream, {
|
|
3472
3592
|
timeout: 5 * 60 * 1e3,
|
|
3473
3593
|
cleanUp: async () => {
|
|
@@ -3482,6 +3602,10 @@ var LayerImpl17 = Effect27.gen(function* () {
|
|
|
3482
3602
|
);
|
|
3483
3603
|
yield* eventBus.off("heartbeat", onHeartbeat);
|
|
3484
3604
|
yield* eventBus.off("permissionRequested", onPermissionRequested);
|
|
3605
|
+
yield* eventBus.off(
|
|
3606
|
+
"virtualConversationUpdated",
|
|
3607
|
+
onVirtualConversationUpdated
|
|
3608
|
+
);
|
|
3485
3609
|
})
|
|
3486
3610
|
);
|
|
3487
3611
|
}
|
|
@@ -3504,16 +3628,16 @@ import { Path as Path12 } from "@effect/platform";
|
|
|
3504
3628
|
import { Context as Context22, Effect as Effect28, Layer as Layer24, Ref as Ref9 } from "effect";
|
|
3505
3629
|
|
|
3506
3630
|
// src/server/core/events/functions/parseSessionFilePath.ts
|
|
3507
|
-
import
|
|
3631
|
+
import z22 from "zod";
|
|
3508
3632
|
var sessionFileRegExp = /(?<projectId>.*?)\/(?<sessionId>.*?)\.jsonl$/;
|
|
3509
3633
|
var agentFileRegExp = /(?<projectId>.*?)\/agent-(?<agentSessionId>.*?)\.jsonl$/;
|
|
3510
|
-
var sessionFileGroupSchema =
|
|
3511
|
-
projectId:
|
|
3512
|
-
sessionId:
|
|
3634
|
+
var sessionFileGroupSchema = z22.object({
|
|
3635
|
+
projectId: z22.string(),
|
|
3636
|
+
sessionId: z22.string()
|
|
3513
3637
|
});
|
|
3514
|
-
var agentFileGroupSchema =
|
|
3515
|
-
projectId:
|
|
3516
|
-
agentSessionId:
|
|
3638
|
+
var agentFileGroupSchema = z22.object({
|
|
3639
|
+
projectId: z22.string(),
|
|
3640
|
+
agentSessionId: z22.string()
|
|
3517
3641
|
});
|
|
3518
3642
|
var parseSessionFilePath = (filePath) => {
|
|
3519
3643
|
const agentMatch = filePath.match(agentFileRegExp);
|
|
@@ -3611,7 +3735,7 @@ var FileWatcherService = class extends Context22.Tag("FileWatcherService")() {
|
|
|
3611
3735
|
yield* Ref9.set(debounceTimersRef, currentTimers);
|
|
3612
3736
|
})
|
|
3613
3737
|
);
|
|
3614
|
-
},
|
|
3738
|
+
}, 100);
|
|
3615
3739
|
timers.set(debounceKey, newTimer);
|
|
3616
3740
|
yield* Ref9.set(debounceTimersRef, timers);
|
|
3617
3741
|
})
|
|
@@ -4248,12 +4372,12 @@ import { Context as Context26, Data as Data4, Duration, Effect as Effect32, Eith
|
|
|
4248
4372
|
import { Context as Context25, Effect as Effect31, Layer as Layer27, Ref as Ref10 } from "effect";
|
|
4249
4373
|
|
|
4250
4374
|
// src/server/core/platform/schema.ts
|
|
4251
|
-
import { z as
|
|
4252
|
-
var envSchema =
|
|
4375
|
+
import { z as z23 } from "zod";
|
|
4376
|
+
var envSchema = z23.object({
|
|
4253
4377
|
// Frameworks
|
|
4254
|
-
NODE_ENV:
|
|
4255
|
-
NEXT_PHASE:
|
|
4256
|
-
PATH:
|
|
4378
|
+
NODE_ENV: z23.enum(["development", "production", "test"]).optional().default("development"),
|
|
4379
|
+
NEXT_PHASE: z23.string().optional(),
|
|
4380
|
+
PATH: z23.string().optional()
|
|
4257
4381
|
});
|
|
4258
4382
|
|
|
4259
4383
|
// src/server/core/platform/services/EnvService.ts
|
|
@@ -5125,39 +5249,39 @@ import { FileSystem as FileSystem12, Path as Path16 } from "@effect/platform";
|
|
|
5125
5249
|
import { Context as Context29, Data as Data5, Effect as Effect36, Layer as Layer31 } from "effect";
|
|
5126
5250
|
|
|
5127
5251
|
// src/server/core/scheduler/schema.ts
|
|
5128
|
-
import { z as
|
|
5129
|
-
var concurrencyPolicySchema =
|
|
5130
|
-
var cronScheduleSchema =
|
|
5131
|
-
type:
|
|
5132
|
-
expression:
|
|
5252
|
+
import { z as z24 } from "zod";
|
|
5253
|
+
var concurrencyPolicySchema = z24.enum(["skip", "run"]);
|
|
5254
|
+
var cronScheduleSchema = z24.object({
|
|
5255
|
+
type: z24.literal("cron"),
|
|
5256
|
+
expression: z24.string(),
|
|
5133
5257
|
concurrencyPolicy: concurrencyPolicySchema
|
|
5134
5258
|
});
|
|
5135
|
-
var reservedScheduleSchema =
|
|
5136
|
-
type:
|
|
5137
|
-
reservedExecutionTime:
|
|
5259
|
+
var reservedScheduleSchema = z24.object({
|
|
5260
|
+
type: z24.literal("reserved"),
|
|
5261
|
+
reservedExecutionTime: z24.iso.datetime()
|
|
5138
5262
|
});
|
|
5139
|
-
var scheduleSchema =
|
|
5263
|
+
var scheduleSchema = z24.discriminatedUnion("type", [
|
|
5140
5264
|
cronScheduleSchema,
|
|
5141
5265
|
reservedScheduleSchema
|
|
5142
5266
|
]);
|
|
5143
|
-
var messageConfigSchema =
|
|
5144
|
-
content:
|
|
5145
|
-
projectId:
|
|
5146
|
-
baseSessionId:
|
|
5267
|
+
var messageConfigSchema = z24.object({
|
|
5268
|
+
content: z24.string(),
|
|
5269
|
+
projectId: z24.string(),
|
|
5270
|
+
baseSessionId: z24.string().nullable()
|
|
5147
5271
|
});
|
|
5148
|
-
var jobStatusSchema =
|
|
5149
|
-
var schedulerJobSchema =
|
|
5150
|
-
id:
|
|
5151
|
-
name:
|
|
5272
|
+
var jobStatusSchema = z24.enum(["success", "failed"]);
|
|
5273
|
+
var schedulerJobSchema = z24.object({
|
|
5274
|
+
id: z24.string(),
|
|
5275
|
+
name: z24.string(),
|
|
5152
5276
|
schedule: scheduleSchema,
|
|
5153
5277
|
message: messageConfigSchema,
|
|
5154
|
-
enabled:
|
|
5155
|
-
createdAt:
|
|
5156
|
-
lastRunAt:
|
|
5278
|
+
enabled: z24.boolean(),
|
|
5279
|
+
createdAt: z24.string().datetime(),
|
|
5280
|
+
lastRunAt: z24.string().datetime().nullable(),
|
|
5157
5281
|
lastRunStatus: jobStatusSchema.nullable()
|
|
5158
5282
|
});
|
|
5159
|
-
var schedulerConfigSchema =
|
|
5160
|
-
jobs:
|
|
5283
|
+
var schedulerConfigSchema = z24.object({
|
|
5284
|
+
jobs: z24.array(schedulerJobSchema)
|
|
5161
5285
|
});
|
|
5162
5286
|
var newSchedulerJobSchema = schedulerJobSchema.omit({
|
|
5163
5287
|
id: true,
|
|
@@ -5165,7 +5289,7 @@ var newSchedulerJobSchema = schedulerJobSchema.omit({
|
|
|
5165
5289
|
lastRunAt: true,
|
|
5166
5290
|
lastRunStatus: true
|
|
5167
5291
|
}).extend({
|
|
5168
|
-
enabled:
|
|
5292
|
+
enabled: z24.boolean().default(true)
|
|
5169
5293
|
});
|
|
5170
5294
|
var updateSchedulerJobSchema = schedulerJobSchema.partial().pick({
|
|
5171
5295
|
name: true,
|
|
@@ -6828,65 +6952,65 @@ import { Effect as Effect47, Runtime as Runtime3 } from "effect";
|
|
|
6828
6952
|
import { deleteCookie, getCookie as getCookie3, setCookie as setCookie2 } from "hono/cookie";
|
|
6829
6953
|
import { streamSSE } from "hono/streaming";
|
|
6830
6954
|
import prexit from "prexit";
|
|
6831
|
-
import { z as
|
|
6955
|
+
import { z as z29 } from "zod";
|
|
6832
6956
|
|
|
6833
6957
|
// src/server/core/claude-code/schema.ts
|
|
6834
|
-
import { z as
|
|
6835
|
-
var mediaTypeSchema =
|
|
6958
|
+
import { z as z25 } from "zod";
|
|
6959
|
+
var mediaTypeSchema = z25.enum([
|
|
6836
6960
|
"image/png",
|
|
6837
6961
|
"image/jpeg",
|
|
6838
6962
|
"image/gif",
|
|
6839
6963
|
"image/webp"
|
|
6840
6964
|
]);
|
|
6841
|
-
var imageBlockSchema =
|
|
6842
|
-
type:
|
|
6843
|
-
source:
|
|
6844
|
-
type:
|
|
6965
|
+
var imageBlockSchema = z25.object({
|
|
6966
|
+
type: z25.literal("image"),
|
|
6967
|
+
source: z25.object({
|
|
6968
|
+
type: z25.literal("base64"),
|
|
6845
6969
|
media_type: mediaTypeSchema,
|
|
6846
|
-
data:
|
|
6970
|
+
data: z25.string()
|
|
6847
6971
|
})
|
|
6848
6972
|
});
|
|
6849
|
-
var documentBlockSchema =
|
|
6850
|
-
type:
|
|
6851
|
-
source:
|
|
6852
|
-
|
|
6853
|
-
type:
|
|
6854
|
-
media_type:
|
|
6855
|
-
data:
|
|
6973
|
+
var documentBlockSchema = z25.object({
|
|
6974
|
+
type: z25.literal("document"),
|
|
6975
|
+
source: z25.union([
|
|
6976
|
+
z25.object({
|
|
6977
|
+
type: z25.literal("text"),
|
|
6978
|
+
media_type: z25.enum(["text/plain"]),
|
|
6979
|
+
data: z25.string()
|
|
6856
6980
|
}),
|
|
6857
|
-
|
|
6858
|
-
type:
|
|
6859
|
-
media_type:
|
|
6860
|
-
data:
|
|
6981
|
+
z25.object({
|
|
6982
|
+
type: z25.literal("base64"),
|
|
6983
|
+
media_type: z25.enum(["application/pdf"]),
|
|
6984
|
+
data: z25.string()
|
|
6861
6985
|
})
|
|
6862
6986
|
])
|
|
6863
6987
|
});
|
|
6864
|
-
var userMessageInputSchema =
|
|
6865
|
-
text:
|
|
6866
|
-
images:
|
|
6867
|
-
documents:
|
|
6988
|
+
var userMessageInputSchema = z25.object({
|
|
6989
|
+
text: z25.string().min(1),
|
|
6990
|
+
images: z25.array(imageBlockSchema).optional(),
|
|
6991
|
+
documents: z25.array(documentBlockSchema).optional()
|
|
6868
6992
|
});
|
|
6869
6993
|
|
|
6870
6994
|
// src/server/core/git/schema.ts
|
|
6871
|
-
import { z as
|
|
6872
|
-
var CommitRequestSchema =
|
|
6873
|
-
projectId:
|
|
6874
|
-
files:
|
|
6875
|
-
message:
|
|
6995
|
+
import { z as z26 } from "zod";
|
|
6996
|
+
var CommitRequestSchema = z26.object({
|
|
6997
|
+
projectId: z26.string().min(1),
|
|
6998
|
+
files: z26.array(z26.string().min(1)).min(1),
|
|
6999
|
+
message: z26.string().trim().min(1)
|
|
6876
7000
|
});
|
|
6877
|
-
var PushRequestSchema =
|
|
6878
|
-
projectId:
|
|
7001
|
+
var PushRequestSchema = z26.object({
|
|
7002
|
+
projectId: z26.string().min(1)
|
|
6879
7003
|
});
|
|
6880
|
-
var CommitResultSuccessSchema =
|
|
6881
|
-
success:
|
|
6882
|
-
commitSha:
|
|
6883
|
-
filesCommitted:
|
|
6884
|
-
message:
|
|
7004
|
+
var CommitResultSuccessSchema = z26.object({
|
|
7005
|
+
success: z26.literal(true),
|
|
7006
|
+
commitSha: z26.string().length(40),
|
|
7007
|
+
filesCommitted: z26.number().int().positive(),
|
|
7008
|
+
message: z26.string()
|
|
6885
7009
|
});
|
|
6886
|
-
var CommitResultErrorSchema =
|
|
6887
|
-
success:
|
|
6888
|
-
error:
|
|
6889
|
-
errorCode:
|
|
7010
|
+
var CommitResultErrorSchema = z26.object({
|
|
7011
|
+
success: z26.literal(false),
|
|
7012
|
+
error: z26.string(),
|
|
7013
|
+
errorCode: z26.enum([
|
|
6890
7014
|
"EMPTY_MESSAGE",
|
|
6891
7015
|
"NO_FILES",
|
|
6892
7016
|
"PROJECT_NOT_FOUND",
|
|
@@ -6894,22 +7018,22 @@ var CommitResultErrorSchema = z25.object({
|
|
|
6894
7018
|
"HOOK_FAILED",
|
|
6895
7019
|
"GIT_COMMAND_ERROR"
|
|
6896
7020
|
]),
|
|
6897
|
-
details:
|
|
7021
|
+
details: z26.string().optional()
|
|
6898
7022
|
});
|
|
6899
|
-
var CommitResultSchema =
|
|
7023
|
+
var CommitResultSchema = z26.discriminatedUnion("success", [
|
|
6900
7024
|
CommitResultSuccessSchema,
|
|
6901
7025
|
CommitResultErrorSchema
|
|
6902
7026
|
]);
|
|
6903
|
-
var PushResultSuccessSchema =
|
|
6904
|
-
success:
|
|
6905
|
-
remote:
|
|
6906
|
-
branch:
|
|
6907
|
-
objectsPushed:
|
|
7027
|
+
var PushResultSuccessSchema = z26.object({
|
|
7028
|
+
success: z26.literal(true),
|
|
7029
|
+
remote: z26.string(),
|
|
7030
|
+
branch: z26.string(),
|
|
7031
|
+
objectsPushed: z26.number().int().optional()
|
|
6908
7032
|
});
|
|
6909
|
-
var PushResultErrorSchema =
|
|
6910
|
-
success:
|
|
6911
|
-
error:
|
|
6912
|
-
errorCode:
|
|
7033
|
+
var PushResultErrorSchema = z26.object({
|
|
7034
|
+
success: z26.literal(false),
|
|
7035
|
+
error: z26.string(),
|
|
7036
|
+
errorCode: z26.enum([
|
|
6913
7037
|
"PROJECT_NOT_FOUND",
|
|
6914
7038
|
"NOT_A_REPOSITORY",
|
|
6915
7039
|
"NO_UPSTREAM",
|
|
@@ -6919,26 +7043,26 @@ var PushResultErrorSchema = z25.object({
|
|
|
6919
7043
|
"TIMEOUT",
|
|
6920
7044
|
"GIT_COMMAND_ERROR"
|
|
6921
7045
|
]),
|
|
6922
|
-
details:
|
|
7046
|
+
details: z26.string().optional()
|
|
6923
7047
|
});
|
|
6924
|
-
var PushResultSchema =
|
|
7048
|
+
var PushResultSchema = z26.discriminatedUnion("success", [
|
|
6925
7049
|
PushResultSuccessSchema,
|
|
6926
7050
|
PushResultErrorSchema
|
|
6927
7051
|
]);
|
|
6928
|
-
var CommitAndPushResultSuccessSchema =
|
|
6929
|
-
success:
|
|
6930
|
-
commitSha:
|
|
6931
|
-
filesCommitted:
|
|
6932
|
-
message:
|
|
6933
|
-
remote:
|
|
6934
|
-
branch:
|
|
7052
|
+
var CommitAndPushResultSuccessSchema = z26.object({
|
|
7053
|
+
success: z26.literal(true),
|
|
7054
|
+
commitSha: z26.string().length(40),
|
|
7055
|
+
filesCommitted: z26.number().int().positive(),
|
|
7056
|
+
message: z26.string(),
|
|
7057
|
+
remote: z26.string(),
|
|
7058
|
+
branch: z26.string()
|
|
6935
7059
|
});
|
|
6936
|
-
var CommitAndPushResultErrorSchema =
|
|
6937
|
-
success:
|
|
6938
|
-
commitSucceeded:
|
|
6939
|
-
commitSha:
|
|
6940
|
-
error:
|
|
6941
|
-
errorCode:
|
|
7060
|
+
var CommitAndPushResultErrorSchema = z26.object({
|
|
7061
|
+
success: z26.literal(false),
|
|
7062
|
+
commitSucceeded: z26.boolean(),
|
|
7063
|
+
commitSha: z26.string().length(40).optional(),
|
|
7064
|
+
error: z26.string(),
|
|
7065
|
+
errorCode: z26.enum([
|
|
6942
7066
|
"EMPTY_MESSAGE",
|
|
6943
7067
|
"NO_FILES",
|
|
6944
7068
|
"PROJECT_NOT_FOUND",
|
|
@@ -6951,29 +7075,29 @@ var CommitAndPushResultErrorSchema = z25.object({
|
|
|
6951
7075
|
"NETWORK_ERROR",
|
|
6952
7076
|
"TIMEOUT"
|
|
6953
7077
|
]),
|
|
6954
|
-
details:
|
|
7078
|
+
details: z26.string().optional()
|
|
6955
7079
|
});
|
|
6956
|
-
var CommitAndPushResultSchema =
|
|
7080
|
+
var CommitAndPushResultSchema = z26.discriminatedUnion("success", [
|
|
6957
7081
|
CommitAndPushResultSuccessSchema,
|
|
6958
7082
|
CommitAndPushResultErrorSchema
|
|
6959
7083
|
]);
|
|
6960
7084
|
|
|
6961
7085
|
// src/server/lib/config/config.ts
|
|
6962
|
-
import
|
|
7086
|
+
import z28 from "zod";
|
|
6963
7087
|
|
|
6964
7088
|
// src/lib/i18n/schema.ts
|
|
6965
|
-
import
|
|
6966
|
-
var localeSchema =
|
|
7089
|
+
import z27 from "zod";
|
|
7090
|
+
var localeSchema = z27.enum(["ja", "en", "zh_CN"]);
|
|
6967
7091
|
|
|
6968
7092
|
// src/server/lib/config/config.ts
|
|
6969
|
-
var userConfigSchema =
|
|
6970
|
-
hideNoUserMessageSession:
|
|
6971
|
-
unifySameTitleSession:
|
|
6972
|
-
enterKeyBehavior:
|
|
6973
|
-
permissionMode:
|
|
7093
|
+
var userConfigSchema = z28.object({
|
|
7094
|
+
hideNoUserMessageSession: z28.boolean().optional().default(true),
|
|
7095
|
+
unifySameTitleSession: z28.boolean().optional().default(false),
|
|
7096
|
+
enterKeyBehavior: z28.enum(["shift-enter-send", "enter-send", "command-enter-send"]).optional().default("shift-enter-send"),
|
|
7097
|
+
permissionMode: z28.enum(["acceptEdits", "bypassPermissions", "default", "plan"]).optional().default("default"),
|
|
6974
7098
|
locale: localeSchema.optional().default("en"),
|
|
6975
|
-
theme:
|
|
6976
|
-
searchHotkey:
|
|
7099
|
+
theme: z28.enum(["light", "dark", "system"]).optional().default("system"),
|
|
7100
|
+
searchHotkey: z28.enum(["ctrl-k", "command-k"]).optional().default("command-k")
|
|
6977
7101
|
});
|
|
6978
7102
|
var defaultUserConfig = userConfigSchema.parse({});
|
|
6979
7103
|
|
|
@@ -7060,7 +7184,7 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7060
7184
|
await next();
|
|
7061
7185
|
}).post(
|
|
7062
7186
|
"/api/auth/login",
|
|
7063
|
-
zValidator("json",
|
|
7187
|
+
zValidator("json", z29.object({ password: z29.string() })),
|
|
7064
7188
|
async (c) => {
|
|
7065
7189
|
const { password } = c.req.valid("json");
|
|
7066
7190
|
if (!authEnabled) {
|
|
@@ -7114,7 +7238,7 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7114
7238
|
return response;
|
|
7115
7239
|
}).get(
|
|
7116
7240
|
"/api/projects/:projectId",
|
|
7117
|
-
zValidator("query",
|
|
7241
|
+
zValidator("query", z29.object({ cursor: z29.string().optional() })),
|
|
7118
7242
|
async (c) => {
|
|
7119
7243
|
const response = await effectToResponse(
|
|
7120
7244
|
c,
|
|
@@ -7129,8 +7253,8 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7129
7253
|
"/api/projects",
|
|
7130
7254
|
zValidator(
|
|
7131
7255
|
"json",
|
|
7132
|
-
|
|
7133
|
-
projectPath:
|
|
7256
|
+
z29.object({
|
|
7257
|
+
projectPath: z29.string().min(1, "Project path is required")
|
|
7134
7258
|
})
|
|
7135
7259
|
),
|
|
7136
7260
|
async (c) => {
|
|
@@ -7165,17 +7289,23 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7165
7289
|
);
|
|
7166
7290
|
return response;
|
|
7167
7291
|
}
|
|
7168
|
-
).get(
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7292
|
+
).get(
|
|
7293
|
+
"/api/projects/:projectId/agent-sessions/:agentId",
|
|
7294
|
+
zValidator("query", z29.object({ sessionId: z29.string().optional() })),
|
|
7295
|
+
async (c) => {
|
|
7296
|
+
const { projectId, agentId } = c.req.param();
|
|
7297
|
+
const { sessionId } = c.req.valid("query");
|
|
7298
|
+
const response = await effectToResponse(
|
|
7299
|
+
c,
|
|
7300
|
+
agentSessionController.getAgentSession({
|
|
7301
|
+
projectId,
|
|
7302
|
+
agentId,
|
|
7303
|
+
sessionId
|
|
7304
|
+
}).pipe(Effect47.provide(runtime))
|
|
7305
|
+
);
|
|
7306
|
+
return response;
|
|
7307
|
+
}
|
|
7308
|
+
).get("/api/projects/:projectId/git/current-revisions", async (c) => {
|
|
7179
7309
|
const response = await effectToResponse(
|
|
7180
7310
|
c,
|
|
7181
7311
|
gitController.getCurrentRevisions({
|
|
@@ -7187,9 +7317,9 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7187
7317
|
"/api/projects/:projectId/git/diff",
|
|
7188
7318
|
zValidator(
|
|
7189
7319
|
"json",
|
|
7190
|
-
|
|
7191
|
-
fromRef:
|
|
7192
|
-
toRef:
|
|
7320
|
+
z29.object({
|
|
7321
|
+
fromRef: z29.string().min(1, "fromRef is required"),
|
|
7322
|
+
toRef: z29.string().min(1, "toRef is required")
|
|
7193
7323
|
})
|
|
7194
7324
|
),
|
|
7195
7325
|
async (c) => {
|
|
@@ -7279,10 +7409,10 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7279
7409
|
"/api/cc/session-processes",
|
|
7280
7410
|
zValidator(
|
|
7281
7411
|
"json",
|
|
7282
|
-
|
|
7283
|
-
projectId:
|
|
7412
|
+
z29.object({
|
|
7413
|
+
projectId: z29.string(),
|
|
7284
7414
|
input: userMessageInputSchema,
|
|
7285
|
-
baseSessionId:
|
|
7415
|
+
baseSessionId: z29.string().optional()
|
|
7286
7416
|
})
|
|
7287
7417
|
),
|
|
7288
7418
|
async (c) => {
|
|
@@ -7298,10 +7428,10 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7298
7428
|
"/api/cc/session-processes/:sessionProcessId/continue",
|
|
7299
7429
|
zValidator(
|
|
7300
7430
|
"json",
|
|
7301
|
-
|
|
7302
|
-
projectId:
|
|
7431
|
+
z29.object({
|
|
7432
|
+
projectId: z29.string(),
|
|
7303
7433
|
input: userMessageInputSchema,
|
|
7304
|
-
baseSessionId:
|
|
7434
|
+
baseSessionId: z29.string()
|
|
7305
7435
|
})
|
|
7306
7436
|
),
|
|
7307
7437
|
async (c) => {
|
|
@@ -7316,7 +7446,7 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7316
7446
|
}
|
|
7317
7447
|
).post(
|
|
7318
7448
|
"/api/cc/session-processes/:sessionProcessId/abort",
|
|
7319
|
-
zValidator("json",
|
|
7449
|
+
zValidator("json", z29.object({ projectId: z29.string() })),
|
|
7320
7450
|
async (c) => {
|
|
7321
7451
|
const { sessionProcessId } = c.req.param();
|
|
7322
7452
|
void Effect47.runFork(
|
|
@@ -7328,9 +7458,9 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7328
7458
|
"/api/cc/permission-response",
|
|
7329
7459
|
zValidator(
|
|
7330
7460
|
"json",
|
|
7331
|
-
|
|
7332
|
-
permissionRequestId:
|
|
7333
|
-
decision:
|
|
7461
|
+
z29.object({
|
|
7462
|
+
permissionRequestId: z29.string(),
|
|
7463
|
+
decision: z29.enum(["allow", "deny"])
|
|
7334
7464
|
})
|
|
7335
7465
|
),
|
|
7336
7466
|
async (c) => {
|
|
@@ -7397,9 +7527,9 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7397
7527
|
"/api/fs/file-completion",
|
|
7398
7528
|
zValidator(
|
|
7399
7529
|
"query",
|
|
7400
|
-
|
|
7401
|
-
projectId:
|
|
7402
|
-
basePath:
|
|
7530
|
+
z29.object({
|
|
7531
|
+
projectId: z29.string(),
|
|
7532
|
+
basePath: z29.string().optional().default("/api/")
|
|
7403
7533
|
})
|
|
7404
7534
|
),
|
|
7405
7535
|
async (c) => {
|
|
@@ -7415,9 +7545,9 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7415
7545
|
"/api/fs/directory-browser",
|
|
7416
7546
|
zValidator(
|
|
7417
7547
|
"query",
|
|
7418
|
-
|
|
7419
|
-
currentPath:
|
|
7420
|
-
showHidden:
|
|
7548
|
+
z29.object({
|
|
7549
|
+
currentPath: z29.string().optional(),
|
|
7550
|
+
showHidden: z29.string().optional().transform((val) => val === "true")
|
|
7421
7551
|
})
|
|
7422
7552
|
),
|
|
7423
7553
|
async (c) => {
|
|
@@ -7433,10 +7563,10 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7433
7563
|
"/api/search",
|
|
7434
7564
|
zValidator(
|
|
7435
7565
|
"query",
|
|
7436
|
-
|
|
7437
|
-
q:
|
|
7438
|
-
limit:
|
|
7439
|
-
projectId:
|
|
7566
|
+
z29.object({
|
|
7567
|
+
q: z29.string().min(2),
|
|
7568
|
+
limit: z29.string().optional().transform((val) => val ? parseInt(val, 10) : void 0),
|
|
7569
|
+
projectId: z29.string().optional()
|
|
7440
7570
|
})
|
|
7441
7571
|
),
|
|
7442
7572
|
async (c) => {
|