@kimuson/claude-code-viewer 0.5.5 → 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 +406 -295
- 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,156 +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()
|
|
407
419
|
}),
|
|
408
|
-
|
|
409
|
-
type:
|
|
410
|
-
operation:
|
|
411
|
-
sessionId:
|
|
412
|
-
timestamp:
|
|
420
|
+
z12.object({
|
|
421
|
+
type: z12.literal("queue-operation"),
|
|
422
|
+
operation: z12.literal("dequeue"),
|
|
423
|
+
sessionId: z12.string(),
|
|
424
|
+
timestamp: z12.iso.datetime()
|
|
413
425
|
}),
|
|
414
|
-
|
|
415
|
-
type:
|
|
416
|
-
operation:
|
|
417
|
-
sessionId:
|
|
418
|
-
timestamp:
|
|
426
|
+
z12.object({
|
|
427
|
+
type: z12.literal("queue-operation"),
|
|
428
|
+
operation: z12.literal("remove"),
|
|
429
|
+
sessionId: z12.string(),
|
|
430
|
+
timestamp: z12.iso.datetime()
|
|
419
431
|
}),
|
|
420
|
-
|
|
421
|
-
type:
|
|
422
|
-
operation:
|
|
423
|
-
sessionId:
|
|
424
|
-
timestamp:
|
|
425
|
-
content:
|
|
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()
|
|
426
438
|
})
|
|
427
439
|
]);
|
|
428
440
|
|
|
429
441
|
// src/lib/conversation-schema/entry/SummaryEntrySchema.ts
|
|
430
|
-
import { z as
|
|
431
|
-
var SummaryEntrySchema =
|
|
432
|
-
type:
|
|
433
|
-
summary:
|
|
434
|
-
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()
|
|
435
447
|
});
|
|
436
448
|
|
|
437
449
|
// src/lib/conversation-schema/entry/SystemEntrySchema.ts
|
|
438
|
-
import { z as
|
|
439
|
-
var HookInfoSchema =
|
|
440
|
-
command:
|
|
450
|
+
import { z as z14 } from "zod";
|
|
451
|
+
var HookInfoSchema = z14.object({
|
|
452
|
+
command: z14.string()
|
|
441
453
|
});
|
|
442
454
|
var SystemEntryWithContentSchema = BaseEntrySchema.extend({
|
|
443
|
-
type:
|
|
444
|
-
content:
|
|
445
|
-
toolUseID:
|
|
446
|
-
level:
|
|
447
|
-
subtype:
|
|
455
|
+
type: z14.literal("system"),
|
|
456
|
+
content: z14.string(),
|
|
457
|
+
toolUseID: z14.string(),
|
|
458
|
+
level: z14.enum(["info"]),
|
|
459
|
+
subtype: z14.undefined().optional()
|
|
448
460
|
});
|
|
449
461
|
var StopHookSummaryEntrySchema = BaseEntrySchema.extend({
|
|
450
|
-
type:
|
|
451
|
-
subtype:
|
|
452
|
-
toolUseID:
|
|
453
|
-
level:
|
|
454
|
-
slug:
|
|
455
|
-
hookCount:
|
|
456
|
-
hookInfos:
|
|
457
|
-
hookErrors:
|
|
458
|
-
preventedContinuation:
|
|
459
|
-
stopReason:
|
|
460
|
-
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()
|
|
461
473
|
});
|
|
462
474
|
var LocalCommandEntrySchema = BaseEntrySchema.extend({
|
|
463
|
-
type:
|
|
464
|
-
subtype:
|
|
465
|
-
content:
|
|
466
|
-
level:
|
|
475
|
+
type: z14.literal("system"),
|
|
476
|
+
subtype: z14.literal("local_command"),
|
|
477
|
+
content: z14.string(),
|
|
478
|
+
level: z14.enum(["info"])
|
|
467
479
|
});
|
|
468
480
|
var TurnDurationEntrySchema = BaseEntrySchema.extend({
|
|
469
|
-
type:
|
|
470
|
-
subtype:
|
|
471
|
-
durationMs:
|
|
472
|
-
slug:
|
|
481
|
+
type: z14.literal("system"),
|
|
482
|
+
subtype: z14.literal("turn_duration"),
|
|
483
|
+
durationMs: z14.number(),
|
|
484
|
+
slug: z14.string().optional()
|
|
485
|
+
});
|
|
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()
|
|
473
518
|
});
|
|
474
|
-
var SystemEntrySchema =
|
|
519
|
+
var SystemEntrySchema = z14.union([
|
|
475
520
|
StopHookSummaryEntrySchema,
|
|
476
521
|
LocalCommandEntrySchema,
|
|
477
522
|
TurnDurationEntrySchema,
|
|
523
|
+
CompactBoundaryEntrySchema,
|
|
524
|
+
ApiErrorEntrySchema,
|
|
478
525
|
SystemEntryWithContentSchema
|
|
479
526
|
// Must be last (catch-all for undefined subtype)
|
|
480
527
|
]);
|
|
481
528
|
|
|
482
529
|
// src/lib/conversation-schema/entry/UserEntrySchema.ts
|
|
483
|
-
import { z as
|
|
530
|
+
import { z as z16 } from "zod";
|
|
484
531
|
|
|
485
532
|
// src/lib/conversation-schema/message/UserMessageSchema.ts
|
|
486
|
-
import { z as
|
|
487
|
-
var UserMessageContentSchema =
|
|
488
|
-
|
|
533
|
+
import { z as z15 } from "zod";
|
|
534
|
+
var UserMessageContentSchema = z15.union([
|
|
535
|
+
z15.string(),
|
|
489
536
|
TextContentSchema,
|
|
490
537
|
ToolResultContentSchema,
|
|
491
538
|
ImageContentSchema,
|
|
492
539
|
DocumentContentSchema
|
|
493
540
|
]);
|
|
494
|
-
var UserMessageSchema =
|
|
495
|
-
role:
|
|
496
|
-
content:
|
|
497
|
-
|
|
498
|
-
|
|
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]))
|
|
499
546
|
])
|
|
500
547
|
});
|
|
501
548
|
|
|
502
549
|
// src/lib/conversation-schema/entry/UserEntrySchema.ts
|
|
503
550
|
var UserEntrySchema = BaseEntrySchema.extend({
|
|
504
551
|
// discriminator
|
|
505
|
-
type:
|
|
552
|
+
type: z16.literal("user"),
|
|
506
553
|
// required
|
|
507
554
|
message: UserMessageSchema
|
|
508
555
|
});
|
|
509
556
|
|
|
510
557
|
// src/lib/conversation-schema/index.ts
|
|
511
|
-
var ConversationSchema =
|
|
558
|
+
var ConversationSchema = z17.union([
|
|
512
559
|
UserEntrySchema,
|
|
513
560
|
AssistantEntrySchema,
|
|
514
561
|
SummaryEntrySchema,
|
|
515
562
|
SystemEntrySchema,
|
|
516
563
|
FileHistorySnapshotEntrySchema,
|
|
517
|
-
QueueOperationEntrySchema
|
|
564
|
+
QueueOperationEntrySchema,
|
|
565
|
+
ProgressEntrySchema
|
|
518
566
|
]);
|
|
519
567
|
|
|
520
568
|
// src/server/core/claude-code/functions/parseJsonl.ts
|
|
@@ -550,8 +598,20 @@ var encodeProjectIdFromSessionFilePath = (sessionFilePath) => {
|
|
|
550
598
|
var LayerImpl = Effect2.gen(function* () {
|
|
551
599
|
const fs = yield* FileSystem.FileSystem;
|
|
552
600
|
const path = yield* Path.Path;
|
|
553
|
-
const getAgentSessionByAgentId = (projectId, agentId) => Effect2.gen(function* () {
|
|
601
|
+
const getAgentSessionByAgentId = (projectId, agentId, sessionId) => Effect2.gen(function* () {
|
|
554
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
|
+
}
|
|
555
615
|
const agentFilePath = path.resolve(projectPath, `agent-${agentId}.jsonl`);
|
|
556
616
|
const exists = yield* fs.exists(agentFilePath);
|
|
557
617
|
if (!exists) {
|
|
@@ -578,10 +638,11 @@ import { Context as Context2, Effect as Effect3, Layer as Layer2 } from "effect"
|
|
|
578
638
|
var LayerImpl2 = Effect3.gen(function* () {
|
|
579
639
|
const repository = yield* AgentSessionRepository;
|
|
580
640
|
const getAgentSession = (params) => Effect3.gen(function* () {
|
|
581
|
-
const { projectId, agentId } = params;
|
|
641
|
+
const { projectId, agentId, sessionId } = params;
|
|
582
642
|
const conversations = yield* repository.getAgentSessionByAgentId(
|
|
583
643
|
projectId,
|
|
584
|
-
agentId
|
|
644
|
+
agentId,
|
|
645
|
+
sessionId
|
|
585
646
|
);
|
|
586
647
|
if (conversations === null) {
|
|
587
648
|
return {
|
|
@@ -707,7 +768,7 @@ import { Context as Context7, Effect as Effect9, Layer as Layer9, Option as Opti
|
|
|
707
768
|
// src/server/core/project/services/ProjectMetaService.ts
|
|
708
769
|
import { FileSystem as FileSystem3, Path as Path4 } from "@effect/platform";
|
|
709
770
|
import { Context as Context6, Effect as Effect8, Layer as Layer8, Option, Ref as Ref3 } from "effect";
|
|
710
|
-
import { z as
|
|
771
|
+
import { z as z19 } from "zod";
|
|
711
772
|
|
|
712
773
|
// src/server/lib/storage/FileCacheStorage/index.ts
|
|
713
774
|
import { Context as Context5, Effect as Effect7, Layer as Layer7, Ref as Ref2, Runtime } from "effect";
|
|
@@ -715,7 +776,7 @@ import { Context as Context5, Effect as Effect7, Layer as Layer7, Ref as Ref2, R
|
|
|
715
776
|
// src/server/lib/storage/FileCacheStorage/PersistentService.ts
|
|
716
777
|
import { FileSystem as FileSystem2, Path as Path3 } from "@effect/platform";
|
|
717
778
|
import { Context as Context4, Effect as Effect6, Layer as Layer6 } from "effect";
|
|
718
|
-
import { z as
|
|
779
|
+
import { z as z18 } from "zod";
|
|
719
780
|
|
|
720
781
|
// src/server/lib/config/paths.ts
|
|
721
782
|
import { homedir as homedir2 } from "node:os";
|
|
@@ -727,7 +788,7 @@ var claudeCodeViewerCacheDirPath = resolve(
|
|
|
727
788
|
);
|
|
728
789
|
|
|
729
790
|
// src/server/lib/storage/FileCacheStorage/PersistentService.ts
|
|
730
|
-
var saveSchema =
|
|
791
|
+
var saveSchema = z18.array(z18.tuple([z18.string(), z18.unknown()]));
|
|
731
792
|
var LayerImpl5 = Effect6.gen(function* () {
|
|
732
793
|
const path = yield* Path3.Path;
|
|
733
794
|
const getCacheFilePath = (key) => path.resolve(claudeCodeViewerCacheDirPath, `${key}.json`);
|
|
@@ -840,7 +901,7 @@ var makeFileCacheStorageLayer = (storageKey, schema) => Layer7.effect(
|
|
|
840
901
|
);
|
|
841
902
|
|
|
842
903
|
// src/server/core/project/services/ProjectMetaService.ts
|
|
843
|
-
var ProjectPathSchema =
|
|
904
|
+
var ProjectPathSchema = z19.string().nullable();
|
|
844
905
|
var LayerImpl6 = Effect8.gen(function* () {
|
|
845
906
|
const fs = yield* FileSystem3.FileSystem;
|
|
846
907
|
const path = yield* Path4.Path;
|
|
@@ -1102,12 +1163,12 @@ var scanSkillFilesRecursively = (dirPath) => Effect10.gen(function* () {
|
|
|
1102
1163
|
});
|
|
1103
1164
|
|
|
1104
1165
|
// src/server/core/claude-code/models/ClaudeCodeVersion.ts
|
|
1105
|
-
import { z as
|
|
1166
|
+
import { z as z20 } from "zod";
|
|
1106
1167
|
var versionRegex = /^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/;
|
|
1107
|
-
var versionSchema =
|
|
1108
|
-
major:
|
|
1109
|
-
minor:
|
|
1110
|
-
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))
|
|
1111
1172
|
}).refine(
|
|
1112
1173
|
(data) => [data.major, data.minor, data.patch].every((value) => !Number.isNaN(value))
|
|
1113
1174
|
);
|
|
@@ -1745,26 +1806,26 @@ import { FileSystem as FileSystem9, Path as Path11 } from "@effect/platform";
|
|
|
1745
1806
|
import { Context as Context16, Effect as Effect21, Layer as Layer18, Option as Option3 } from "effect";
|
|
1746
1807
|
|
|
1747
1808
|
// src/server/core/claude-code/functions/parseUserMessage.ts
|
|
1748
|
-
import { z as
|
|
1809
|
+
import { z as z21 } from "zod";
|
|
1749
1810
|
var regExp = /<(?<tag>[^>]+)>(?<content>\s*[^<]*?\s*)<\/\k<tag>>/g;
|
|
1750
|
-
var matchSchema =
|
|
1751
|
-
tag:
|
|
1752
|
-
content:
|
|
1811
|
+
var matchSchema = z21.object({
|
|
1812
|
+
tag: z21.string(),
|
|
1813
|
+
content: z21.string()
|
|
1753
1814
|
});
|
|
1754
|
-
var parsedUserMessageSchema =
|
|
1755
|
-
|
|
1756
|
-
kind:
|
|
1757
|
-
commandName:
|
|
1758
|
-
commandArgs:
|
|
1759
|
-
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()
|
|
1760
1821
|
}),
|
|
1761
|
-
|
|
1762
|
-
kind:
|
|
1763
|
-
stdout:
|
|
1822
|
+
z21.object({
|
|
1823
|
+
kind: z21.literal("local-command"),
|
|
1824
|
+
stdout: z21.string()
|
|
1764
1825
|
}),
|
|
1765
|
-
|
|
1766
|
-
kind:
|
|
1767
|
-
content:
|
|
1826
|
+
z21.object({
|
|
1827
|
+
kind: z21.literal("text"),
|
|
1828
|
+
content: z21.string()
|
|
1768
1829
|
})
|
|
1769
1830
|
]);
|
|
1770
1831
|
var parseUserMessage = (content) => {
|
|
@@ -2059,36 +2120,53 @@ import { Effect as Effect19 } from "effect";
|
|
|
2059
2120
|
var getAgentSessionFilesForSession = (projectPath, sessionId) => Effect19.gen(function* () {
|
|
2060
2121
|
const fs = yield* FileSystem7.FileSystem;
|
|
2061
2122
|
const path = yield* Path9.Path;
|
|
2062
|
-
const
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
const firstLine = content.split("\n")[0];
|
|
2072
|
-
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) {
|
|
2073
2132
|
return false;
|
|
2074
2133
|
}
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
if (typeof firstLineData === "object" && firstLineData !== null && "sessionId" in firstLineData && firstLineData.sessionId === sessionId) {
|
|
2078
|
-
return true;
|
|
2079
|
-
}
|
|
2080
|
-
} catch {
|
|
2081
|
-
return false;
|
|
2134
|
+
if (expectedSessionId !== void 0) {
|
|
2135
|
+
return "sessionId" in firstLineData && firstLineData.sessionId === expectedSessionId;
|
|
2082
2136
|
}
|
|
2137
|
+
return "sessionId" in firstLineData;
|
|
2138
|
+
} catch {
|
|
2083
2139
|
return false;
|
|
2084
|
-
}
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
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)) {
|
|
2089
2150
|
matchingFilePaths.push(filePath);
|
|
2090
2151
|
}
|
|
2091
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
|
+
}
|
|
2092
2170
|
return matchingFilePaths;
|
|
2093
2171
|
});
|
|
2094
2172
|
|
|
@@ -2219,7 +2297,7 @@ var SessionMetaService = class extends Context15.Tag("SessionMetaService")() {
|
|
|
2219
2297
|
}
|
|
2220
2298
|
}
|
|
2221
2299
|
const fileContents = [content, ...agentContents];
|
|
2222
|
-
const { totalCost } = aggregateTokenUsageAndCost(fileContents);
|
|
2300
|
+
const { totalCost, modelName } = aggregateTokenUsageAndCost(fileContents);
|
|
2223
2301
|
const sessionMeta = {
|
|
2224
2302
|
messageCount: lines.length,
|
|
2225
2303
|
firstUserMessage,
|
|
@@ -2227,7 +2305,8 @@ var SessionMetaService = class extends Context15.Tag("SessionMetaService")() {
|
|
|
2227
2305
|
totalUsd: totalCost.totalUsd,
|
|
2228
2306
|
breakdown: totalCost.breakdown,
|
|
2229
2307
|
tokenUsage: totalCost.tokenUsage
|
|
2230
|
-
}
|
|
2308
|
+
},
|
|
2309
|
+
modelName
|
|
2231
2310
|
};
|
|
2232
2311
|
yield* Ref7.update(sessionMetaCacheRef, (cache) => {
|
|
2233
2312
|
cache.set(sessionId, sessionMeta);
|
|
@@ -2333,7 +2412,8 @@ var LayerImpl13 = Effect21.gen(function* () {
|
|
|
2333
2412
|
cacheCreationTokens: 0,
|
|
2334
2413
|
cacheReadTokens: 0
|
|
2335
2414
|
}
|
|
2336
|
-
}
|
|
2415
|
+
},
|
|
2416
|
+
modelName: null
|
|
2337
2417
|
},
|
|
2338
2418
|
conversations: virtualConversation.conversations,
|
|
2339
2419
|
lastModifiedAt: lastConversation !== void 0 ? new Date(lastConversation.timestamp) : /* @__PURE__ */ new Date()
|
|
@@ -2449,7 +2529,8 @@ var LayerImpl13 = Effect21.gen(function* () {
|
|
|
2449
2529
|
cacheCreationTokens: 0,
|
|
2450
2530
|
cacheReadTokens: 0
|
|
2451
2531
|
}
|
|
2452
|
-
}
|
|
2532
|
+
},
|
|
2533
|
+
modelName: null
|
|
2453
2534
|
}
|
|
2454
2535
|
};
|
|
2455
2536
|
}).sort((a, b) => {
|
|
@@ -3019,6 +3100,10 @@ var LayerImpl15 = Effect24.gen(function* () {
|
|
|
3019
3100
|
baseSessionId,
|
|
3020
3101
|
[virtualConversation]
|
|
3021
3102
|
);
|
|
3103
|
+
yield* eventBusService.emit("virtualConversationUpdated", {
|
|
3104
|
+
projectId: sessionProcess.def.projectId,
|
|
3105
|
+
sessionId: baseSessionId
|
|
3106
|
+
});
|
|
3022
3107
|
sessionProcess.def.setNextMessage(input);
|
|
3023
3108
|
return {
|
|
3024
3109
|
sessionProcess,
|
|
@@ -3072,7 +3157,7 @@ var LayerImpl15 = Effect24.gen(function* () {
|
|
|
3072
3157
|
return "break";
|
|
3073
3158
|
}
|
|
3074
3159
|
if (processState.type === "paused") {
|
|
3075
|
-
yield* Effect24.die(
|
|
3160
|
+
return yield* Effect24.die(
|
|
3076
3161
|
new Error("Illegal state: paused is not expected")
|
|
3077
3162
|
);
|
|
3078
3163
|
}
|
|
@@ -3125,6 +3210,10 @@ var LayerImpl15 = Effect24.gen(function* () {
|
|
|
3125
3210
|
sessionFileCreatedPromise.resolve({
|
|
3126
3211
|
sessionId: message.session_id
|
|
3127
3212
|
});
|
|
3213
|
+
yield* eventBusService.emit("virtualConversationUpdated", {
|
|
3214
|
+
projectId: processState.def.projectId,
|
|
3215
|
+
sessionId: message.session_id
|
|
3216
|
+
});
|
|
3128
3217
|
yield* virtualConversationDatabase.deleteVirtualConversations(
|
|
3129
3218
|
message.session_id
|
|
3130
3219
|
);
|
|
@@ -3481,12 +3570,24 @@ var LayerImpl17 = Effect27.gen(function* () {
|
|
|
3481
3570
|
})
|
|
3482
3571
|
);
|
|
3483
3572
|
};
|
|
3573
|
+
const onVirtualConversationUpdated = (event) => {
|
|
3574
|
+
Effect27.runFork(
|
|
3575
|
+
typeSafeSSE.writeSSE("virtualConversationUpdated", {
|
|
3576
|
+
projectId: event.projectId,
|
|
3577
|
+
sessionId: event.sessionId
|
|
3578
|
+
})
|
|
3579
|
+
);
|
|
3580
|
+
};
|
|
3484
3581
|
yield* eventBus.on("sessionListChanged", onSessionListChanged);
|
|
3485
3582
|
yield* eventBus.on("sessionChanged", onSessionChanged);
|
|
3486
3583
|
yield* eventBus.on("agentSessionChanged", onAgentSessionChanged);
|
|
3487
3584
|
yield* eventBus.on("sessionProcessChanged", onSessionProcessChanged);
|
|
3488
3585
|
yield* eventBus.on("heartbeat", onHeartbeat);
|
|
3489
3586
|
yield* eventBus.on("permissionRequested", onPermissionRequested);
|
|
3587
|
+
yield* eventBus.on(
|
|
3588
|
+
"virtualConversationUpdated",
|
|
3589
|
+
onVirtualConversationUpdated
|
|
3590
|
+
);
|
|
3490
3591
|
const { connectionPromise } = adaptInternalEventToSSE(rawStream, {
|
|
3491
3592
|
timeout: 5 * 60 * 1e3,
|
|
3492
3593
|
cleanUp: async () => {
|
|
@@ -3501,6 +3602,10 @@ var LayerImpl17 = Effect27.gen(function* () {
|
|
|
3501
3602
|
);
|
|
3502
3603
|
yield* eventBus.off("heartbeat", onHeartbeat);
|
|
3503
3604
|
yield* eventBus.off("permissionRequested", onPermissionRequested);
|
|
3605
|
+
yield* eventBus.off(
|
|
3606
|
+
"virtualConversationUpdated",
|
|
3607
|
+
onVirtualConversationUpdated
|
|
3608
|
+
);
|
|
3504
3609
|
})
|
|
3505
3610
|
);
|
|
3506
3611
|
}
|
|
@@ -3523,16 +3628,16 @@ import { Path as Path12 } from "@effect/platform";
|
|
|
3523
3628
|
import { Context as Context22, Effect as Effect28, Layer as Layer24, Ref as Ref9 } from "effect";
|
|
3524
3629
|
|
|
3525
3630
|
// src/server/core/events/functions/parseSessionFilePath.ts
|
|
3526
|
-
import
|
|
3631
|
+
import z22 from "zod";
|
|
3527
3632
|
var sessionFileRegExp = /(?<projectId>.*?)\/(?<sessionId>.*?)\.jsonl$/;
|
|
3528
3633
|
var agentFileRegExp = /(?<projectId>.*?)\/agent-(?<agentSessionId>.*?)\.jsonl$/;
|
|
3529
|
-
var sessionFileGroupSchema =
|
|
3530
|
-
projectId:
|
|
3531
|
-
sessionId:
|
|
3634
|
+
var sessionFileGroupSchema = z22.object({
|
|
3635
|
+
projectId: z22.string(),
|
|
3636
|
+
sessionId: z22.string()
|
|
3532
3637
|
});
|
|
3533
|
-
var agentFileGroupSchema =
|
|
3534
|
-
projectId:
|
|
3535
|
-
agentSessionId:
|
|
3638
|
+
var agentFileGroupSchema = z22.object({
|
|
3639
|
+
projectId: z22.string(),
|
|
3640
|
+
agentSessionId: z22.string()
|
|
3536
3641
|
});
|
|
3537
3642
|
var parseSessionFilePath = (filePath) => {
|
|
3538
3643
|
const agentMatch = filePath.match(agentFileRegExp);
|
|
@@ -3630,7 +3735,7 @@ var FileWatcherService = class extends Context22.Tag("FileWatcherService")() {
|
|
|
3630
3735
|
yield* Ref9.set(debounceTimersRef, currentTimers);
|
|
3631
3736
|
})
|
|
3632
3737
|
);
|
|
3633
|
-
},
|
|
3738
|
+
}, 100);
|
|
3634
3739
|
timers.set(debounceKey, newTimer);
|
|
3635
3740
|
yield* Ref9.set(debounceTimersRef, timers);
|
|
3636
3741
|
})
|
|
@@ -4267,12 +4372,12 @@ import { Context as Context26, Data as Data4, Duration, Effect as Effect32, Eith
|
|
|
4267
4372
|
import { Context as Context25, Effect as Effect31, Layer as Layer27, Ref as Ref10 } from "effect";
|
|
4268
4373
|
|
|
4269
4374
|
// src/server/core/platform/schema.ts
|
|
4270
|
-
import { z as
|
|
4271
|
-
var envSchema =
|
|
4375
|
+
import { z as z23 } from "zod";
|
|
4376
|
+
var envSchema = z23.object({
|
|
4272
4377
|
// Frameworks
|
|
4273
|
-
NODE_ENV:
|
|
4274
|
-
NEXT_PHASE:
|
|
4275
|
-
PATH:
|
|
4378
|
+
NODE_ENV: z23.enum(["development", "production", "test"]).optional().default("development"),
|
|
4379
|
+
NEXT_PHASE: z23.string().optional(),
|
|
4380
|
+
PATH: z23.string().optional()
|
|
4276
4381
|
});
|
|
4277
4382
|
|
|
4278
4383
|
// src/server/core/platform/services/EnvService.ts
|
|
@@ -5144,39 +5249,39 @@ import { FileSystem as FileSystem12, Path as Path16 } from "@effect/platform";
|
|
|
5144
5249
|
import { Context as Context29, Data as Data5, Effect as Effect36, Layer as Layer31 } from "effect";
|
|
5145
5250
|
|
|
5146
5251
|
// src/server/core/scheduler/schema.ts
|
|
5147
|
-
import { z as
|
|
5148
|
-
var concurrencyPolicySchema =
|
|
5149
|
-
var cronScheduleSchema =
|
|
5150
|
-
type:
|
|
5151
|
-
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(),
|
|
5152
5257
|
concurrencyPolicy: concurrencyPolicySchema
|
|
5153
5258
|
});
|
|
5154
|
-
var reservedScheduleSchema =
|
|
5155
|
-
type:
|
|
5156
|
-
reservedExecutionTime:
|
|
5259
|
+
var reservedScheduleSchema = z24.object({
|
|
5260
|
+
type: z24.literal("reserved"),
|
|
5261
|
+
reservedExecutionTime: z24.iso.datetime()
|
|
5157
5262
|
});
|
|
5158
|
-
var scheduleSchema =
|
|
5263
|
+
var scheduleSchema = z24.discriminatedUnion("type", [
|
|
5159
5264
|
cronScheduleSchema,
|
|
5160
5265
|
reservedScheduleSchema
|
|
5161
5266
|
]);
|
|
5162
|
-
var messageConfigSchema =
|
|
5163
|
-
content:
|
|
5164
|
-
projectId:
|
|
5165
|
-
baseSessionId:
|
|
5267
|
+
var messageConfigSchema = z24.object({
|
|
5268
|
+
content: z24.string(),
|
|
5269
|
+
projectId: z24.string(),
|
|
5270
|
+
baseSessionId: z24.string().nullable()
|
|
5166
5271
|
});
|
|
5167
|
-
var jobStatusSchema =
|
|
5168
|
-
var schedulerJobSchema =
|
|
5169
|
-
id:
|
|
5170
|
-
name:
|
|
5272
|
+
var jobStatusSchema = z24.enum(["success", "failed"]);
|
|
5273
|
+
var schedulerJobSchema = z24.object({
|
|
5274
|
+
id: z24.string(),
|
|
5275
|
+
name: z24.string(),
|
|
5171
5276
|
schedule: scheduleSchema,
|
|
5172
5277
|
message: messageConfigSchema,
|
|
5173
|
-
enabled:
|
|
5174
|
-
createdAt:
|
|
5175
|
-
lastRunAt:
|
|
5278
|
+
enabled: z24.boolean(),
|
|
5279
|
+
createdAt: z24.string().datetime(),
|
|
5280
|
+
lastRunAt: z24.string().datetime().nullable(),
|
|
5176
5281
|
lastRunStatus: jobStatusSchema.nullable()
|
|
5177
5282
|
});
|
|
5178
|
-
var schedulerConfigSchema =
|
|
5179
|
-
jobs:
|
|
5283
|
+
var schedulerConfigSchema = z24.object({
|
|
5284
|
+
jobs: z24.array(schedulerJobSchema)
|
|
5180
5285
|
});
|
|
5181
5286
|
var newSchedulerJobSchema = schedulerJobSchema.omit({
|
|
5182
5287
|
id: true,
|
|
@@ -5184,7 +5289,7 @@ var newSchedulerJobSchema = schedulerJobSchema.omit({
|
|
|
5184
5289
|
lastRunAt: true,
|
|
5185
5290
|
lastRunStatus: true
|
|
5186
5291
|
}).extend({
|
|
5187
|
-
enabled:
|
|
5292
|
+
enabled: z24.boolean().default(true)
|
|
5188
5293
|
});
|
|
5189
5294
|
var updateSchedulerJobSchema = schedulerJobSchema.partial().pick({
|
|
5190
5295
|
name: true,
|
|
@@ -6847,65 +6952,65 @@ import { Effect as Effect47, Runtime as Runtime3 } from "effect";
|
|
|
6847
6952
|
import { deleteCookie, getCookie as getCookie3, setCookie as setCookie2 } from "hono/cookie";
|
|
6848
6953
|
import { streamSSE } from "hono/streaming";
|
|
6849
6954
|
import prexit from "prexit";
|
|
6850
|
-
import { z as
|
|
6955
|
+
import { z as z29 } from "zod";
|
|
6851
6956
|
|
|
6852
6957
|
// src/server/core/claude-code/schema.ts
|
|
6853
|
-
import { z as
|
|
6854
|
-
var mediaTypeSchema =
|
|
6958
|
+
import { z as z25 } from "zod";
|
|
6959
|
+
var mediaTypeSchema = z25.enum([
|
|
6855
6960
|
"image/png",
|
|
6856
6961
|
"image/jpeg",
|
|
6857
6962
|
"image/gif",
|
|
6858
6963
|
"image/webp"
|
|
6859
6964
|
]);
|
|
6860
|
-
var imageBlockSchema =
|
|
6861
|
-
type:
|
|
6862
|
-
source:
|
|
6863
|
-
type:
|
|
6965
|
+
var imageBlockSchema = z25.object({
|
|
6966
|
+
type: z25.literal("image"),
|
|
6967
|
+
source: z25.object({
|
|
6968
|
+
type: z25.literal("base64"),
|
|
6864
6969
|
media_type: mediaTypeSchema,
|
|
6865
|
-
data:
|
|
6970
|
+
data: z25.string()
|
|
6866
6971
|
})
|
|
6867
6972
|
});
|
|
6868
|
-
var documentBlockSchema =
|
|
6869
|
-
type:
|
|
6870
|
-
source:
|
|
6871
|
-
|
|
6872
|
-
type:
|
|
6873
|
-
media_type:
|
|
6874
|
-
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()
|
|
6875
6980
|
}),
|
|
6876
|
-
|
|
6877
|
-
type:
|
|
6878
|
-
media_type:
|
|
6879
|
-
data:
|
|
6981
|
+
z25.object({
|
|
6982
|
+
type: z25.literal("base64"),
|
|
6983
|
+
media_type: z25.enum(["application/pdf"]),
|
|
6984
|
+
data: z25.string()
|
|
6880
6985
|
})
|
|
6881
6986
|
])
|
|
6882
6987
|
});
|
|
6883
|
-
var userMessageInputSchema =
|
|
6884
|
-
text:
|
|
6885
|
-
images:
|
|
6886
|
-
documents:
|
|
6988
|
+
var userMessageInputSchema = z25.object({
|
|
6989
|
+
text: z25.string().min(1),
|
|
6990
|
+
images: z25.array(imageBlockSchema).optional(),
|
|
6991
|
+
documents: z25.array(documentBlockSchema).optional()
|
|
6887
6992
|
});
|
|
6888
6993
|
|
|
6889
6994
|
// src/server/core/git/schema.ts
|
|
6890
|
-
import { z as
|
|
6891
|
-
var CommitRequestSchema =
|
|
6892
|
-
projectId:
|
|
6893
|
-
files:
|
|
6894
|
-
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)
|
|
6895
7000
|
});
|
|
6896
|
-
var PushRequestSchema =
|
|
6897
|
-
projectId:
|
|
7001
|
+
var PushRequestSchema = z26.object({
|
|
7002
|
+
projectId: z26.string().min(1)
|
|
6898
7003
|
});
|
|
6899
|
-
var CommitResultSuccessSchema =
|
|
6900
|
-
success:
|
|
6901
|
-
commitSha:
|
|
6902
|
-
filesCommitted:
|
|
6903
|
-
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()
|
|
6904
7009
|
});
|
|
6905
|
-
var CommitResultErrorSchema =
|
|
6906
|
-
success:
|
|
6907
|
-
error:
|
|
6908
|
-
errorCode:
|
|
7010
|
+
var CommitResultErrorSchema = z26.object({
|
|
7011
|
+
success: z26.literal(false),
|
|
7012
|
+
error: z26.string(),
|
|
7013
|
+
errorCode: z26.enum([
|
|
6909
7014
|
"EMPTY_MESSAGE",
|
|
6910
7015
|
"NO_FILES",
|
|
6911
7016
|
"PROJECT_NOT_FOUND",
|
|
@@ -6913,22 +7018,22 @@ var CommitResultErrorSchema = z25.object({
|
|
|
6913
7018
|
"HOOK_FAILED",
|
|
6914
7019
|
"GIT_COMMAND_ERROR"
|
|
6915
7020
|
]),
|
|
6916
|
-
details:
|
|
7021
|
+
details: z26.string().optional()
|
|
6917
7022
|
});
|
|
6918
|
-
var CommitResultSchema =
|
|
7023
|
+
var CommitResultSchema = z26.discriminatedUnion("success", [
|
|
6919
7024
|
CommitResultSuccessSchema,
|
|
6920
7025
|
CommitResultErrorSchema
|
|
6921
7026
|
]);
|
|
6922
|
-
var PushResultSuccessSchema =
|
|
6923
|
-
success:
|
|
6924
|
-
remote:
|
|
6925
|
-
branch:
|
|
6926
|
-
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()
|
|
6927
7032
|
});
|
|
6928
|
-
var PushResultErrorSchema =
|
|
6929
|
-
success:
|
|
6930
|
-
error:
|
|
6931
|
-
errorCode:
|
|
7033
|
+
var PushResultErrorSchema = z26.object({
|
|
7034
|
+
success: z26.literal(false),
|
|
7035
|
+
error: z26.string(),
|
|
7036
|
+
errorCode: z26.enum([
|
|
6932
7037
|
"PROJECT_NOT_FOUND",
|
|
6933
7038
|
"NOT_A_REPOSITORY",
|
|
6934
7039
|
"NO_UPSTREAM",
|
|
@@ -6938,26 +7043,26 @@ var PushResultErrorSchema = z25.object({
|
|
|
6938
7043
|
"TIMEOUT",
|
|
6939
7044
|
"GIT_COMMAND_ERROR"
|
|
6940
7045
|
]),
|
|
6941
|
-
details:
|
|
7046
|
+
details: z26.string().optional()
|
|
6942
7047
|
});
|
|
6943
|
-
var PushResultSchema =
|
|
7048
|
+
var PushResultSchema = z26.discriminatedUnion("success", [
|
|
6944
7049
|
PushResultSuccessSchema,
|
|
6945
7050
|
PushResultErrorSchema
|
|
6946
7051
|
]);
|
|
6947
|
-
var CommitAndPushResultSuccessSchema =
|
|
6948
|
-
success:
|
|
6949
|
-
commitSha:
|
|
6950
|
-
filesCommitted:
|
|
6951
|
-
message:
|
|
6952
|
-
remote:
|
|
6953
|
-
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()
|
|
6954
7059
|
});
|
|
6955
|
-
var CommitAndPushResultErrorSchema =
|
|
6956
|
-
success:
|
|
6957
|
-
commitSucceeded:
|
|
6958
|
-
commitSha:
|
|
6959
|
-
error:
|
|
6960
|
-
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([
|
|
6961
7066
|
"EMPTY_MESSAGE",
|
|
6962
7067
|
"NO_FILES",
|
|
6963
7068
|
"PROJECT_NOT_FOUND",
|
|
@@ -6970,29 +7075,29 @@ var CommitAndPushResultErrorSchema = z25.object({
|
|
|
6970
7075
|
"NETWORK_ERROR",
|
|
6971
7076
|
"TIMEOUT"
|
|
6972
7077
|
]),
|
|
6973
|
-
details:
|
|
7078
|
+
details: z26.string().optional()
|
|
6974
7079
|
});
|
|
6975
|
-
var CommitAndPushResultSchema =
|
|
7080
|
+
var CommitAndPushResultSchema = z26.discriminatedUnion("success", [
|
|
6976
7081
|
CommitAndPushResultSuccessSchema,
|
|
6977
7082
|
CommitAndPushResultErrorSchema
|
|
6978
7083
|
]);
|
|
6979
7084
|
|
|
6980
7085
|
// src/server/lib/config/config.ts
|
|
6981
|
-
import
|
|
7086
|
+
import z28 from "zod";
|
|
6982
7087
|
|
|
6983
7088
|
// src/lib/i18n/schema.ts
|
|
6984
|
-
import
|
|
6985
|
-
var localeSchema =
|
|
7089
|
+
import z27 from "zod";
|
|
7090
|
+
var localeSchema = z27.enum(["ja", "en", "zh_CN"]);
|
|
6986
7091
|
|
|
6987
7092
|
// src/server/lib/config/config.ts
|
|
6988
|
-
var userConfigSchema =
|
|
6989
|
-
hideNoUserMessageSession:
|
|
6990
|
-
unifySameTitleSession:
|
|
6991
|
-
enterKeyBehavior:
|
|
6992
|
-
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"),
|
|
6993
7098
|
locale: localeSchema.optional().default("en"),
|
|
6994
|
-
theme:
|
|
6995
|
-
searchHotkey:
|
|
7099
|
+
theme: z28.enum(["light", "dark", "system"]).optional().default("system"),
|
|
7100
|
+
searchHotkey: z28.enum(["ctrl-k", "command-k"]).optional().default("command-k")
|
|
6996
7101
|
});
|
|
6997
7102
|
var defaultUserConfig = userConfigSchema.parse({});
|
|
6998
7103
|
|
|
@@ -7079,7 +7184,7 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7079
7184
|
await next();
|
|
7080
7185
|
}).post(
|
|
7081
7186
|
"/api/auth/login",
|
|
7082
|
-
zValidator("json",
|
|
7187
|
+
zValidator("json", z29.object({ password: z29.string() })),
|
|
7083
7188
|
async (c) => {
|
|
7084
7189
|
const { password } = c.req.valid("json");
|
|
7085
7190
|
if (!authEnabled) {
|
|
@@ -7133,7 +7238,7 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7133
7238
|
return response;
|
|
7134
7239
|
}).get(
|
|
7135
7240
|
"/api/projects/:projectId",
|
|
7136
|
-
zValidator("query",
|
|
7241
|
+
zValidator("query", z29.object({ cursor: z29.string().optional() })),
|
|
7137
7242
|
async (c) => {
|
|
7138
7243
|
const response = await effectToResponse(
|
|
7139
7244
|
c,
|
|
@@ -7148,8 +7253,8 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7148
7253
|
"/api/projects",
|
|
7149
7254
|
zValidator(
|
|
7150
7255
|
"json",
|
|
7151
|
-
|
|
7152
|
-
projectPath:
|
|
7256
|
+
z29.object({
|
|
7257
|
+
projectPath: z29.string().min(1, "Project path is required")
|
|
7153
7258
|
})
|
|
7154
7259
|
),
|
|
7155
7260
|
async (c) => {
|
|
@@ -7184,17 +7289,23 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7184
7289
|
);
|
|
7185
7290
|
return response;
|
|
7186
7291
|
}
|
|
7187
|
-
).get(
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
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) => {
|
|
7198
7309
|
const response = await effectToResponse(
|
|
7199
7310
|
c,
|
|
7200
7311
|
gitController.getCurrentRevisions({
|
|
@@ -7206,9 +7317,9 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7206
7317
|
"/api/projects/:projectId/git/diff",
|
|
7207
7318
|
zValidator(
|
|
7208
7319
|
"json",
|
|
7209
|
-
|
|
7210
|
-
fromRef:
|
|
7211
|
-
toRef:
|
|
7320
|
+
z29.object({
|
|
7321
|
+
fromRef: z29.string().min(1, "fromRef is required"),
|
|
7322
|
+
toRef: z29.string().min(1, "toRef is required")
|
|
7212
7323
|
})
|
|
7213
7324
|
),
|
|
7214
7325
|
async (c) => {
|
|
@@ -7298,10 +7409,10 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7298
7409
|
"/api/cc/session-processes",
|
|
7299
7410
|
zValidator(
|
|
7300
7411
|
"json",
|
|
7301
|
-
|
|
7302
|
-
projectId:
|
|
7412
|
+
z29.object({
|
|
7413
|
+
projectId: z29.string(),
|
|
7303
7414
|
input: userMessageInputSchema,
|
|
7304
|
-
baseSessionId:
|
|
7415
|
+
baseSessionId: z29.string().optional()
|
|
7305
7416
|
})
|
|
7306
7417
|
),
|
|
7307
7418
|
async (c) => {
|
|
@@ -7317,10 +7428,10 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7317
7428
|
"/api/cc/session-processes/:sessionProcessId/continue",
|
|
7318
7429
|
zValidator(
|
|
7319
7430
|
"json",
|
|
7320
|
-
|
|
7321
|
-
projectId:
|
|
7431
|
+
z29.object({
|
|
7432
|
+
projectId: z29.string(),
|
|
7322
7433
|
input: userMessageInputSchema,
|
|
7323
|
-
baseSessionId:
|
|
7434
|
+
baseSessionId: z29.string()
|
|
7324
7435
|
})
|
|
7325
7436
|
),
|
|
7326
7437
|
async (c) => {
|
|
@@ -7335,7 +7446,7 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7335
7446
|
}
|
|
7336
7447
|
).post(
|
|
7337
7448
|
"/api/cc/session-processes/:sessionProcessId/abort",
|
|
7338
|
-
zValidator("json",
|
|
7449
|
+
zValidator("json", z29.object({ projectId: z29.string() })),
|
|
7339
7450
|
async (c) => {
|
|
7340
7451
|
const { sessionProcessId } = c.req.param();
|
|
7341
7452
|
void Effect47.runFork(
|
|
@@ -7347,9 +7458,9 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7347
7458
|
"/api/cc/permission-response",
|
|
7348
7459
|
zValidator(
|
|
7349
7460
|
"json",
|
|
7350
|
-
|
|
7351
|
-
permissionRequestId:
|
|
7352
|
-
decision:
|
|
7461
|
+
z29.object({
|
|
7462
|
+
permissionRequestId: z29.string(),
|
|
7463
|
+
decision: z29.enum(["allow", "deny"])
|
|
7353
7464
|
})
|
|
7354
7465
|
),
|
|
7355
7466
|
async (c) => {
|
|
@@ -7416,9 +7527,9 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7416
7527
|
"/api/fs/file-completion",
|
|
7417
7528
|
zValidator(
|
|
7418
7529
|
"query",
|
|
7419
|
-
|
|
7420
|
-
projectId:
|
|
7421
|
-
basePath:
|
|
7530
|
+
z29.object({
|
|
7531
|
+
projectId: z29.string(),
|
|
7532
|
+
basePath: z29.string().optional().default("/api/")
|
|
7422
7533
|
})
|
|
7423
7534
|
),
|
|
7424
7535
|
async (c) => {
|
|
@@ -7434,9 +7545,9 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7434
7545
|
"/api/fs/directory-browser",
|
|
7435
7546
|
zValidator(
|
|
7436
7547
|
"query",
|
|
7437
|
-
|
|
7438
|
-
currentPath:
|
|
7439
|
-
showHidden:
|
|
7548
|
+
z29.object({
|
|
7549
|
+
currentPath: z29.string().optional(),
|
|
7550
|
+
showHidden: z29.string().optional().transform((val) => val === "true")
|
|
7440
7551
|
})
|
|
7441
7552
|
),
|
|
7442
7553
|
async (c) => {
|
|
@@ -7452,10 +7563,10 @@ var routes = (app, options) => Effect47.gen(function* () {
|
|
|
7452
7563
|
"/api/search",
|
|
7453
7564
|
zValidator(
|
|
7454
7565
|
"query",
|
|
7455
|
-
|
|
7456
|
-
q:
|
|
7457
|
-
limit:
|
|
7458
|
-
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()
|
|
7459
7570
|
})
|
|
7460
7571
|
),
|
|
7461
7572
|
async (c) => {
|