@p4code/cli 0.1.42 → 0.1.43
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/bin.mjs +192 -5
- package/dist/client/assets/{DiffPanel-Fkx320pf.js → DiffPanel-DxLjTzhm.js} +3 -3
- package/dist/client/assets/{FilePreviewPanel-C2yNJGyo.js → FilePreviewPanel-BU7Mk4RS.js} +5 -5
- package/dist/client/assets/PreviewPanel-CXo-rO6p.js +2 -0
- package/dist/client/assets/{PullRequestCodeTab-Dfo7dBea.js → PullRequestCodeTab-DZ21ejVE.js} +4 -4
- package/dist/client/assets/arrow-right-D65fEYm2.js +2 -0
- package/dist/client/assets/{fileCommentAnnotations-BlpdYBe1.js → fileCommentAnnotations-BYDMZrEt.js} +2 -2
- package/dist/client/assets/index-B_53grxr.css +1 -0
- package/dist/client/assets/{index-CtyxZK6c.js → index-JhM5IhMk.js} +229 -223
- package/dist/client/assets/{renderFileChildren-CP7za9_L.js → renderFileChildren-D1Bb4hre.js} +2 -2
- package/dist/client/assets/terminal-links-94yCfJ0N.js +46 -0
- package/dist/client/assets/{toggle-group-M7OekiUB.js → toggle-group-C7yP6sy7.js} +2 -2
- package/dist/client/index.html +3 -3
- package/package.json +1 -1
- package/dist/client/assets/PreviewPanel-1ZLXoIEg.js +0 -2
- package/dist/client/assets/arrow-right-D8Wjnujk.js +0 -2
- package/dist/client/assets/index-aHlWbnM4.css +0 -1
- package/dist/client/assets/terminal-links-C80Bdiy3.js +0 -46
package/dist/bin.mjs
CHANGED
|
@@ -237,7 +237,7 @@ const make$87 = () => {
|
|
|
237
237
|
const layer$79 = Layer.sync(NetService, make$87);
|
|
238
238
|
//#endregion
|
|
239
239
|
//#region package.json
|
|
240
|
-
var version = "0.1.
|
|
240
|
+
var version = "0.1.43";
|
|
241
241
|
//#endregion
|
|
242
242
|
//#region src/config.ts
|
|
243
243
|
/**
|
|
@@ -1929,7 +1929,9 @@ const OrchestrationThreadShell = Schema$1.Struct({
|
|
|
1929
1929
|
latestUserMessageAt: Schema$1.NullOr(IsoDateTime),
|
|
1930
1930
|
hasPendingApprovals: Schema$1.Boolean,
|
|
1931
1931
|
hasPendingUserInput: Schema$1.Boolean,
|
|
1932
|
-
hasActionableProposedPlan: Schema$1.Boolean
|
|
1932
|
+
hasActionableProposedPlan: Schema$1.Boolean,
|
|
1933
|
+
hasBackgroundTasks: Schema$1.optional(Schema$1.Boolean),
|
|
1934
|
+
scheduledWakeAt: Schema$1.optional(Schema$1.NullOr(IsoDateTime))
|
|
1933
1935
|
});
|
|
1934
1936
|
const OrchestrationShellSnapshot = Schema$1.Struct({
|
|
1935
1937
|
snapshotSequence: NonNegativeInt,
|
|
@@ -6132,6 +6134,7 @@ Schema$1.Literals([
|
|
|
6132
6134
|
"task.started",
|
|
6133
6135
|
"task.progress",
|
|
6134
6136
|
"task.completed",
|
|
6137
|
+
"wake.scheduled",
|
|
6135
6138
|
"hook.started",
|
|
6136
6139
|
"hook.progress",
|
|
6137
6140
|
"hook.completed",
|
|
@@ -6181,6 +6184,7 @@ const UserInputResolvedType = Schema$1.Literal("user-input.resolved");
|
|
|
6181
6184
|
const TaskStartedType = Schema$1.Literal("task.started");
|
|
6182
6185
|
const TaskProgressType = Schema$1.Literal("task.progress");
|
|
6183
6186
|
const TaskCompletedType = Schema$1.Literal("task.completed");
|
|
6187
|
+
const WakeScheduledType = Schema$1.Literal("wake.scheduled");
|
|
6184
6188
|
const HookStartedType = Schema$1.Literal("hook.started");
|
|
6185
6189
|
const HookProgressType = Schema$1.Literal("hook.progress");
|
|
6186
6190
|
const HookCompletedType = Schema$1.Literal("hook.completed");
|
|
@@ -6434,6 +6438,11 @@ const TaskCompletedPayload = Schema$1.Struct({
|
|
|
6434
6438
|
usage: Schema$1.optional(Schema$1.Unknown),
|
|
6435
6439
|
toolUseId: Schema$1.optional(TrimmedNonEmptyStringSchema$1)
|
|
6436
6440
|
});
|
|
6441
|
+
const WakeScheduledPayload = Schema$1.Struct({
|
|
6442
|
+
/** When the agent expects to resume; null cancels a previous schedule. */
|
|
6443
|
+
wakeAt: Schema$1.NullOr(IsoDateTime),
|
|
6444
|
+
reason: Schema$1.optional(TrimmedNonEmptyStringSchema$1)
|
|
6445
|
+
});
|
|
6437
6446
|
const HookStartedPayload = Schema$1.Struct({
|
|
6438
6447
|
hookId: TrimmedNonEmptyStringSchema$1,
|
|
6439
6448
|
hookName: TrimmedNonEmptyStringSchema$1,
|
|
@@ -6681,6 +6690,16 @@ const ProviderRuntimeTaskCompletedEvent = Schema$1.Struct({
|
|
|
6681
6690
|
type: TaskCompletedType,
|
|
6682
6691
|
payload: TaskCompletedPayload
|
|
6683
6692
|
});
|
|
6693
|
+
/**
|
|
6694
|
+
* The agent asked to be woken again later instead of ending its work, e.g. a
|
|
6695
|
+
* self-paced loop scheduling its next tick. `wakeAt` is null when the agent
|
|
6696
|
+
* cancelled the schedule, which ends the pending state.
|
|
6697
|
+
*/
|
|
6698
|
+
const ProviderRuntimeWakeScheduledEvent = Schema$1.Struct({
|
|
6699
|
+
...ProviderRuntimeEventBase.fields,
|
|
6700
|
+
type: WakeScheduledType,
|
|
6701
|
+
payload: WakeScheduledPayload
|
|
6702
|
+
});
|
|
6684
6703
|
const ProviderRuntimeHookStartedEvent = Schema$1.Struct({
|
|
6685
6704
|
...ProviderRuntimeEventBase.fields,
|
|
6686
6705
|
type: HookStartedType,
|
|
@@ -6803,6 +6822,7 @@ Schema$1.Union([
|
|
|
6803
6822
|
ProviderRuntimeTaskStartedEvent,
|
|
6804
6823
|
ProviderRuntimeTaskProgressEvent,
|
|
6805
6824
|
ProviderRuntimeTaskCompletedEvent,
|
|
6825
|
+
ProviderRuntimeWakeScheduledEvent,
|
|
6806
6826
|
ProviderRuntimeHookStartedEvent,
|
|
6807
6827
|
ProviderRuntimeHookProgressEvent,
|
|
6808
6828
|
ProviderRuntimeHookCompletedEvent,
|
|
@@ -14467,6 +14487,30 @@ var _044_TaskExternalRefRemoved_default = Effect.gen(function* () {
|
|
|
14467
14487
|
yield* sql`ALTER TABLE tasks DROP COLUMN external_ref_json`;
|
|
14468
14488
|
});
|
|
14469
14489
|
//#endregion
|
|
14490
|
+
//#region src/persistence/Migrations/045_ProjectionThreadsBackgroundWork.ts
|
|
14491
|
+
/**
|
|
14492
|
+
* Work an agent leaves running outside the visible turn: tasks it backgrounded
|
|
14493
|
+
* and wake-ups it scheduled for itself. Both outlive the turn that started
|
|
14494
|
+
* them, so without these columns the thread reads as idle while work is still
|
|
14495
|
+
* pending.
|
|
14496
|
+
*
|
|
14497
|
+
* `background_task_count` is derived from the thread's task activities the same
|
|
14498
|
+
* way `pending_approval_count` is derived from approvals, so existing threads
|
|
14499
|
+
* pick up a correct value the next time their shell summary refreshes; a `0`
|
|
14500
|
+
* default is right for every thread until then.
|
|
14501
|
+
*/
|
|
14502
|
+
var _045_ProjectionThreadsBackgroundWork_default = Effect.gen(function* () {
|
|
14503
|
+
const sql = yield* SqlClient.SqlClient;
|
|
14504
|
+
yield* sql`
|
|
14505
|
+
ALTER TABLE projection_threads
|
|
14506
|
+
ADD COLUMN background_task_count INTEGER NOT NULL DEFAULT 0
|
|
14507
|
+
`;
|
|
14508
|
+
yield* sql`
|
|
14509
|
+
ALTER TABLE projection_threads
|
|
14510
|
+
ADD COLUMN scheduled_wake_at TEXT
|
|
14511
|
+
`;
|
|
14512
|
+
});
|
|
14513
|
+
//#endregion
|
|
14470
14514
|
//#region src/persistence/Migrations.ts
|
|
14471
14515
|
/**
|
|
14472
14516
|
* MigrationsLive - Migration runner with inline loader
|
|
@@ -14707,6 +14751,11 @@ const migrationEntries = [
|
|
|
14707
14751
|
44,
|
|
14708
14752
|
"TaskExternalRefRemoved",
|
|
14709
14753
|
_044_TaskExternalRefRemoved_default
|
|
14754
|
+
],
|
|
14755
|
+
[
|
|
14756
|
+
45,
|
|
14757
|
+
"ProjectionThreadsBackgroundWork",
|
|
14758
|
+
_045_ProjectionThreadsBackgroundWork_default
|
|
14710
14759
|
]
|
|
14711
14760
|
];
|
|
14712
14761
|
const makeMigrationLoader = (throughId) => Migrator.fromRecord(Object.fromEntries(migrationEntries.filter(([id]) => throughId === void 0 || id <= throughId).map(([id, name, migration]) => [`${id}_${name}`, migration])));
|
|
@@ -23594,6 +23643,10 @@ const ProjectionThread = Schema$1.Struct({
|
|
|
23594
23643
|
pendingApprovalCount: NonNegativeInt,
|
|
23595
23644
|
pendingUserInputCount: NonNegativeInt,
|
|
23596
23645
|
hasActionableProposedPlan: NonNegativeInt,
|
|
23646
|
+
/** Tasks the agent backgrounded that have not reported a terminal status. */
|
|
23647
|
+
backgroundTaskCount: NonNegativeInt,
|
|
23648
|
+
/** When the agent asked to be woken again, e.g. a self-scheduled loop. */
|
|
23649
|
+
scheduledWakeAt: Schema$1.NullOr(IsoDateTime),
|
|
23597
23650
|
deletedAt: Schema$1.NullOr(IsoDateTime)
|
|
23598
23651
|
});
|
|
23599
23652
|
const GetProjectionThreadInput = Schema$1.Struct({ threadId: ThreadId });
|
|
@@ -24483,6 +24536,8 @@ const makeProjectionThreadRepository = Effect.gen(function* () {
|
|
|
24483
24536
|
pending_approval_count,
|
|
24484
24537
|
pending_user_input_count,
|
|
24485
24538
|
has_actionable_proposed_plan,
|
|
24539
|
+
background_task_count,
|
|
24540
|
+
scheduled_wake_at,
|
|
24486
24541
|
deleted_at
|
|
24487
24542
|
)
|
|
24488
24543
|
VALUES (
|
|
@@ -24508,6 +24563,8 @@ const makeProjectionThreadRepository = Effect.gen(function* () {
|
|
|
24508
24563
|
${row.pendingApprovalCount},
|
|
24509
24564
|
${row.pendingUserInputCount},
|
|
24510
24565
|
${row.hasActionableProposedPlan},
|
|
24566
|
+
${row.backgroundTaskCount},
|
|
24567
|
+
${row.scheduledWakeAt},
|
|
24511
24568
|
${row.deletedAt}
|
|
24512
24569
|
)
|
|
24513
24570
|
ON CONFLICT (thread_id)
|
|
@@ -24533,6 +24590,8 @@ const makeProjectionThreadRepository = Effect.gen(function* () {
|
|
|
24533
24590
|
pending_approval_count = excluded.pending_approval_count,
|
|
24534
24591
|
pending_user_input_count = excluded.pending_user_input_count,
|
|
24535
24592
|
has_actionable_proposed_plan = excluded.has_actionable_proposed_plan,
|
|
24593
|
+
background_task_count = excluded.background_task_count,
|
|
24594
|
+
scheduled_wake_at = excluded.scheduled_wake_at,
|
|
24536
24595
|
deleted_at = excluded.deleted_at
|
|
24537
24596
|
`
|
|
24538
24597
|
});
|
|
@@ -24563,6 +24622,8 @@ const makeProjectionThreadRepository = Effect.gen(function* () {
|
|
|
24563
24622
|
pending_approval_count AS "pendingApprovalCount",
|
|
24564
24623
|
pending_user_input_count AS "pendingUserInputCount",
|
|
24565
24624
|
has_actionable_proposed_plan AS "hasActionableProposedPlan",
|
|
24625
|
+
background_task_count AS "backgroundTaskCount",
|
|
24626
|
+
scheduled_wake_at AS "scheduledWakeAt",
|
|
24566
24627
|
deleted_at AS "deletedAt"
|
|
24567
24628
|
FROM projection_threads
|
|
24568
24629
|
WHERE thread_id = ${threadId}
|
|
@@ -24595,6 +24656,8 @@ const makeProjectionThreadRepository = Effect.gen(function* () {
|
|
|
24595
24656
|
pending_approval_count AS "pendingApprovalCount",
|
|
24596
24657
|
pending_user_input_count AS "pendingUserInputCount",
|
|
24597
24658
|
has_actionable_proposed_plan AS "hasActionableProposedPlan",
|
|
24659
|
+
background_task_count AS "backgroundTaskCount",
|
|
24660
|
+
scheduled_wake_at AS "scheduledWakeAt",
|
|
24598
24661
|
deleted_at AS "deletedAt"
|
|
24599
24662
|
FROM projection_threads
|
|
24600
24663
|
WHERE project_id = ${projectId}
|
|
@@ -24829,6 +24892,50 @@ function isStalePendingApprovalFailureDetail(detail) {
|
|
|
24829
24892
|
if (detail === null) return false;
|
|
24830
24893
|
return detail.includes("stale pending approval request") || detail.includes("unknown pending approval request") || detail.includes("unknown pending permission request");
|
|
24831
24894
|
}
|
|
24895
|
+
function extractActivityTaskId(payload) {
|
|
24896
|
+
if (typeof payload !== "object" || payload === null) return null;
|
|
24897
|
+
const taskId = payload.taskId;
|
|
24898
|
+
return typeof taskId === "string" && taskId.length > 0 ? taskId : null;
|
|
24899
|
+
}
|
|
24900
|
+
/**
|
|
24901
|
+
* Tasks the agent started that never reported a terminal status. A task that
|
|
24902
|
+
* outlives its turn is the case worth surfacing: the session goes back to idle
|
|
24903
|
+
* while the task keeps running, so nothing else in the shell shows the work.
|
|
24904
|
+
*
|
|
24905
|
+
* Counted rather than flagged so a lost completion can only strand one task,
|
|
24906
|
+
* and read as a boolean by the shell.
|
|
24907
|
+
*/
|
|
24908
|
+
function deriveBackgroundTaskCountFromActivities(activities) {
|
|
24909
|
+
const openTaskIds = /* @__PURE__ */ new Set();
|
|
24910
|
+
const ordered = [...activities].toSorted((left, right) => left.createdAt.localeCompare(right.createdAt) || left.activityId.localeCompare(right.activityId));
|
|
24911
|
+
for (const activity of ordered) {
|
|
24912
|
+
if (activity.kind !== "task.started" && activity.kind !== "task.completed") continue;
|
|
24913
|
+
const taskId = extractActivityTaskId(activity.payload);
|
|
24914
|
+
if (taskId === null) continue;
|
|
24915
|
+
if (activity.kind === "task.started") openTaskIds.add(taskId);
|
|
24916
|
+
else openTaskIds.delete(taskId);
|
|
24917
|
+
}
|
|
24918
|
+
return openTaskIds.size;
|
|
24919
|
+
}
|
|
24920
|
+
/**
|
|
24921
|
+
* The wake-up the agent is still waiting on, or null when it is not waiting.
|
|
24922
|
+
*
|
|
24923
|
+
* A schedule belongs to the turn that made it: once a newer turn exists the
|
|
24924
|
+
* agent already woke (or was given new work), so the pending state ends without
|
|
24925
|
+
* needing the wake time to pass. A cancelling event carries a null `wakeAt` and
|
|
24926
|
+
* ends it early.
|
|
24927
|
+
*/
|
|
24928
|
+
function deriveScheduledWakeAtFromActivities(input) {
|
|
24929
|
+
const ordered = [...input.activities].toSorted((left, right) => left.createdAt.localeCompare(right.createdAt) || left.activityId.localeCompare(right.activityId));
|
|
24930
|
+
for (let index = ordered.length - 1; index >= 0; index -= 1) {
|
|
24931
|
+
const activity = ordered[index];
|
|
24932
|
+
if (activity === void 0 || activity.kind !== "wake.scheduled") continue;
|
|
24933
|
+
if (activity.turnId !== null && activity.turnId !== input.latestTurnId) return null;
|
|
24934
|
+
const wakeAt = (typeof activity.payload === "object" && activity.payload !== null ? activity.payload : null)?.wakeAt;
|
|
24935
|
+
return typeof wakeAt === "string" && wakeAt.length > 0 ? wakeAt : null;
|
|
24936
|
+
}
|
|
24937
|
+
return null;
|
|
24938
|
+
}
|
|
24832
24939
|
function derivePendingUserInputCountFromActivities(activities) {
|
|
24833
24940
|
const openRequestIds = /* @__PURE__ */ new Set();
|
|
24834
24941
|
const ordered = [...activities].toSorted((left, right) => left.createdAt.localeCompare(right.createdAt) || left.activityId.localeCompare(right.activityId));
|
|
@@ -25029,6 +25136,11 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
|
|
|
25029
25136
|
for (const message of messages) if (message.role === "user" && (latestUserMessageAt === null || message.createdAt > latestUserMessageAt)) latestUserMessageAt = message.createdAt;
|
|
25030
25137
|
const pendingApprovalCount = pendingApprovals.filter((approval) => approval.status === "pending").length;
|
|
25031
25138
|
const pendingUserInputCount = derivePendingUserInputCountFromActivities(activities);
|
|
25139
|
+
const backgroundTaskCount = deriveBackgroundTaskCountFromActivities(activities);
|
|
25140
|
+
const scheduledWakeAt = deriveScheduledWakeAtFromActivities({
|
|
25141
|
+
latestTurnId: existingRow.value.latestTurnId,
|
|
25142
|
+
activities
|
|
25143
|
+
});
|
|
25032
25144
|
const hasActionableProposedPlan = deriveHasActionableProposedPlan({
|
|
25033
25145
|
latestTurnId: existingRow.value.latestTurnId,
|
|
25034
25146
|
proposedPlans
|
|
@@ -25038,6 +25150,8 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
|
|
|
25038
25150
|
latestUserMessageAt,
|
|
25039
25151
|
pendingApprovalCount,
|
|
25040
25152
|
pendingUserInputCount,
|
|
25153
|
+
backgroundTaskCount,
|
|
25154
|
+
scheduledWakeAt,
|
|
25041
25155
|
hasActionableProposedPlan: hasActionableProposedPlan ? 1 : 0
|
|
25042
25156
|
});
|
|
25043
25157
|
});
|
|
@@ -25066,6 +25180,8 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
|
|
|
25066
25180
|
latestUserMessageAt: null,
|
|
25067
25181
|
pendingApprovalCount: 0,
|
|
25068
25182
|
pendingUserInputCount: 0,
|
|
25183
|
+
backgroundTaskCount: 0,
|
|
25184
|
+
scheduledWakeAt: null,
|
|
25069
25185
|
hasActionableProposedPlan: 0,
|
|
25070
25186
|
deletedAt: null
|
|
25071
25187
|
});
|
|
@@ -26542,6 +26658,8 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
26542
26658
|
pending_approval_count AS "pendingApprovalCount",
|
|
26543
26659
|
pending_user_input_count AS "pendingUserInputCount",
|
|
26544
26660
|
has_actionable_proposed_plan AS "hasActionableProposedPlan",
|
|
26661
|
+
background_task_count AS "backgroundTaskCount",
|
|
26662
|
+
scheduled_wake_at AS "scheduledWakeAt",
|
|
26545
26663
|
deleted_at AS "deletedAt"
|
|
26546
26664
|
FROM projection_threads
|
|
26547
26665
|
ORDER BY created_at ASC, thread_id ASC
|
|
@@ -26574,6 +26692,8 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
26574
26692
|
pending_approval_count AS "pendingApprovalCount",
|
|
26575
26693
|
pending_user_input_count AS "pendingUserInputCount",
|
|
26576
26694
|
has_actionable_proposed_plan AS "hasActionableProposedPlan",
|
|
26695
|
+
background_task_count AS "backgroundTaskCount",
|
|
26696
|
+
scheduled_wake_at AS "scheduledWakeAt",
|
|
26577
26697
|
deleted_at AS "deletedAt"
|
|
26578
26698
|
FROM projection_threads
|
|
26579
26699
|
WHERE deleted_at IS NULL
|
|
@@ -26608,6 +26728,8 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
26608
26728
|
pending_approval_count AS "pendingApprovalCount",
|
|
26609
26729
|
pending_user_input_count AS "pendingUserInputCount",
|
|
26610
26730
|
has_actionable_proposed_plan AS "hasActionableProposedPlan",
|
|
26731
|
+
background_task_count AS "backgroundTaskCount",
|
|
26732
|
+
scheduled_wake_at AS "scheduledWakeAt",
|
|
26611
26733
|
deleted_at AS "deletedAt"
|
|
26612
26734
|
FROM projection_threads
|
|
26613
26735
|
WHERE deleted_at IS NULL
|
|
@@ -26942,6 +27064,8 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
26942
27064
|
pending_approval_count AS "pendingApprovalCount",
|
|
26943
27065
|
pending_user_input_count AS "pendingUserInputCount",
|
|
26944
27066
|
has_actionable_proposed_plan AS "hasActionableProposedPlan",
|
|
27067
|
+
background_task_count AS "backgroundTaskCount",
|
|
27068
|
+
scheduled_wake_at AS "scheduledWakeAt",
|
|
26945
27069
|
deleted_at AS "deletedAt"
|
|
26946
27070
|
FROM projection_threads
|
|
26947
27071
|
WHERE thread_id = ${threadId}
|
|
@@ -27418,7 +27542,9 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
27418
27542
|
latestUserMessageAt: row.latestUserMessageAt,
|
|
27419
27543
|
hasPendingApprovals: row.pendingApprovalCount > 0,
|
|
27420
27544
|
hasPendingUserInput: row.pendingUserInputCount > 0,
|
|
27421
|
-
hasActionableProposedPlan: row.hasActionableProposedPlan > 0
|
|
27545
|
+
hasActionableProposedPlan: row.hasActionableProposedPlan > 0,
|
|
27546
|
+
hasBackgroundTasks: row.backgroundTaskCount > 0,
|
|
27547
|
+
scheduledWakeAt: row.scheduledWakeAt
|
|
27422
27548
|
}) : Result.failVoid),
|
|
27423
27549
|
updatedAt: updatedAt ?? "1970-01-01T00:00:00.000Z"
|
|
27424
27550
|
};
|
|
@@ -27474,7 +27600,9 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
27474
27600
|
latestUserMessageAt: row.latestUserMessageAt,
|
|
27475
27601
|
hasPendingApprovals: row.pendingApprovalCount > 0,
|
|
27476
27602
|
hasPendingUserInput: row.pendingUserInputCount > 0,
|
|
27477
|
-
hasActionableProposedPlan: row.hasActionableProposedPlan > 0
|
|
27603
|
+
hasActionableProposedPlan: row.hasActionableProposedPlan > 0,
|
|
27604
|
+
hasBackgroundTasks: row.backgroundTaskCount > 0,
|
|
27605
|
+
scheduledWakeAt: row.scheduledWakeAt
|
|
27478
27606
|
})),
|
|
27479
27607
|
updatedAt: updatedAt ?? "1970-01-01T00:00:00.000Z"
|
|
27480
27608
|
};
|
|
@@ -27566,7 +27694,9 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
27566
27694
|
latestUserMessageAt: threadRow.value.latestUserMessageAt,
|
|
27567
27695
|
hasPendingApprovals: threadRow.value.pendingApprovalCount > 0,
|
|
27568
27696
|
hasPendingUserInput: threadRow.value.pendingUserInputCount > 0,
|
|
27569
|
-
hasActionableProposedPlan: threadRow.value.hasActionableProposedPlan > 0
|
|
27697
|
+
hasActionableProposedPlan: threadRow.value.hasActionableProposedPlan > 0,
|
|
27698
|
+
hasBackgroundTasks: threadRow.value.backgroundTaskCount > 0,
|
|
27699
|
+
scheduledWakeAt: threadRow.value.scheduledWakeAt
|
|
27570
27700
|
});
|
|
27571
27701
|
});
|
|
27572
27702
|
const getThreadDetailById = (threadId) => Effect.gen(function* () {
|
|
@@ -62809,6 +62939,26 @@ function extractPlanStepsFromTodoInput(input) {
|
|
|
62809
62939
|
status: todo.status === "completed" ? "completed" : todo.status === "in_progress" ? "inProgress" : "pending"
|
|
62810
62940
|
}));
|
|
62811
62941
|
}
|
|
62942
|
+
/**
|
|
62943
|
+
* The tool an agent uses to park its own work until later: it stops producing
|
|
62944
|
+
* output and the session goes idle, but the thread is not done. Reading the
|
|
62945
|
+
* call is the only signal P4 gets — the CLI reports nothing when the timer is
|
|
62946
|
+
* armed.
|
|
62947
|
+
*/
|
|
62948
|
+
const WAKE_SCHEDULING_TOOL_NAME = "ScheduleWakeup";
|
|
62949
|
+
/**
|
|
62950
|
+
* The wake this call arms, or null when it cancels one. Returns undefined when
|
|
62951
|
+
* the call says nothing about a wake (a malformed or partial input), so the
|
|
62952
|
+
* caller can leave the thread's existing state alone.
|
|
62953
|
+
*/
|
|
62954
|
+
function readScheduledWakeAt(input, completedAt) {
|
|
62955
|
+
if (input.stop === true) return null;
|
|
62956
|
+
const delaySeconds = input.delaySeconds;
|
|
62957
|
+
if (typeof delaySeconds !== "number" || !Number.isFinite(delaySeconds) || delaySeconds < 0) return;
|
|
62958
|
+
const completedAtMs = Date.parse(completedAt);
|
|
62959
|
+
if (Number.isNaN(completedAtMs)) return;
|
|
62960
|
+
return new Date(completedAtMs + delaySeconds * 1e3).toISOString();
|
|
62961
|
+
}
|
|
62812
62962
|
function isClaudeTaskTool(toolName) {
|
|
62813
62963
|
return toolName === "TaskCreate" || toolName === "TaskUpdate" || toolName === "TaskList";
|
|
62814
62964
|
}
|
|
@@ -64103,6 +64253,30 @@ const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* (claudeSettin
|
|
|
64103
64253
|
payload: message
|
|
64104
64254
|
}
|
|
64105
64255
|
});
|
|
64256
|
+
if (!toolResult.isError && tool.toolName === WAKE_SCHEDULING_TOOL_NAME) {
|
|
64257
|
+
const wakeAt = readScheduledWakeAt(tool.input, completedStamp.createdAt);
|
|
64258
|
+
if (wakeAt !== void 0) {
|
|
64259
|
+
const wakeStamp = yield* makeEventStamp();
|
|
64260
|
+
yield* offerRuntimeEvent({
|
|
64261
|
+
type: "wake.scheduled",
|
|
64262
|
+
eventId: wakeStamp.eventId,
|
|
64263
|
+
provider: PROVIDER$6,
|
|
64264
|
+
createdAt: wakeStamp.createdAt,
|
|
64265
|
+
threadId: context.session.threadId,
|
|
64266
|
+
...context.turnState ? { turnId: asCanonicalTurnId(context.turnState.turnId) } : {},
|
|
64267
|
+
payload: {
|
|
64268
|
+
wakeAt,
|
|
64269
|
+
...typeof tool.input.reason === "string" && tool.input.reason.trim().length > 0 ? { reason: tool.input.reason.trim() } : {}
|
|
64270
|
+
},
|
|
64271
|
+
providerRefs: nativeProviderRefs(context, { providerItemId: tool.itemId }),
|
|
64272
|
+
raw: {
|
|
64273
|
+
source: "claude.sdk.message",
|
|
64274
|
+
method: "claude/user",
|
|
64275
|
+
payload: message
|
|
64276
|
+
}
|
|
64277
|
+
});
|
|
64278
|
+
}
|
|
64279
|
+
}
|
|
64106
64280
|
if (!toolResult.isError && applyClaudeTaskToolResult(context.claudeTasks, tool, toolUseResult)) yield* emitClaudeTaskPlanUpdated(context, {
|
|
64107
64281
|
toolUseId: tool.itemId,
|
|
64108
64282
|
rawMethod: "claude/user",
|
|
@@ -99806,6 +99980,19 @@ function runtimeEventToActivities(event, taskTitle, compressMode) {
|
|
|
99806
99980
|
turnId: toTurnId$1(event.turnId) ?? null,
|
|
99807
99981
|
...maybeSequence
|
|
99808
99982
|
}];
|
|
99983
|
+
case "wake.scheduled": return [{
|
|
99984
|
+
id: event.eventId,
|
|
99985
|
+
createdAt: event.createdAt,
|
|
99986
|
+
tone: "info",
|
|
99987
|
+
kind: "wake.scheduled",
|
|
99988
|
+
summary: event.payload.wakeAt === null ? "Wake-up cancelled" : "Wake-up scheduled",
|
|
99989
|
+
payload: {
|
|
99990
|
+
wakeAt: event.payload.wakeAt,
|
|
99991
|
+
...event.payload.reason ? { detail: truncateDetail(event.payload.reason) } : {}
|
|
99992
|
+
},
|
|
99993
|
+
turnId: toTurnId$1(event.turnId) ?? null,
|
|
99994
|
+
...maybeSequence
|
|
99995
|
+
}];
|
|
99809
99996
|
case "thread.state.changed":
|
|
99810
99997
|
if (event.payload.state !== "compacted") return [];
|
|
99811
99998
|
return [{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$r as i,$s as a,As as o,Js as s,Lc as c,Mp as ee,Os as te,Q as ne,S as l,Yr as u,ac as d,an as f,b as p,ci as m,di as re,dn as ie,en as h,fi as g,hc as _,i as v,j as y,js as b,ks as x,li as S,ni as C,nt as w,ri as ae,u as oe,uc as T,ui as E,v as D,y as O,z as k}from"./terminal-links-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$r as i,$s as a,As as o,Js as s,Lc as c,Mp as ee,Os as te,Q as ne,S as l,Yr as u,ac as d,an as f,b as p,ci as m,di as re,dn as ie,en as h,fi as g,hc as _,i as v,j as y,js as b,ks as x,li as S,ni as C,nt as w,ri as ae,u as oe,uc as T,ui as E,v as D,y as O,z as k}from"./terminal-links-94yCfJ0N.js";import{t as A}from"./arrow-right-D65fEYm2.js";import{a as se,i as j,n as M,o as ce,r as le,s as ue,t as de}from"./toggle-group-C7yP6sy7.js";import{$n as fe,F as pe,Fr as me,Hr as he,I as ge,Ir as _e,J as ve,L as N,Lr as ye,Qn as be,Wr as xe,_ as Se,ar as Ce,at as we,ct as Te,dt as Ee,er as De,fi as Oe,h as ke,ir as Ae,lt as je,nr as Me,or as Ne,ot as Pe,pi as Fe,pr as Ie,q as Le,rr as Re,st as ze,tr as Be,ut as Ve,zn as He,zr as Ue}from"./index-JhM5IhMk.js";import{a as P,n as We}from"./fileCommentAnnotations-BYDMZrEt.js";var Ge=b(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),F=e(n(),1);function Ke({threadRef:e,filePath:t,activeCwd:n,openInEditor:r}){if(e){D.getState().openFile(e,t);return}r(n?v(t,n):t)}var I=r();function qe(e,t){let n=(0,I.c)(4),r=He(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}var L=t(),Je=[];function Ye(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function R(e,t,n){let r=Ye(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function Xe(e){let t=(0,I.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:s,className:c,renderHeaderPrefix:ee}=e,te=h($e),ne=h(B),l;t[0]===a?l=t[1]:(l=e=>e.getComposerDraft(a)?.reviewComments??Je,t[0]=a,t[1]=l);let u=h(l),[d,p]=(0,F.useState)(null),[m,re]=(0,F.useState)(null),g;t[2]===n?g=t[3]:(g=new Map(n.map(Qe)),t[2]=n,t[3]=g);let _=g,v;if(t[4]!==m||t[5]!==n||t[6]!==u||t[7]!==r){let e;t[9]!==m||t[10]!==u||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:a}=e,o=u.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=ie(t,n);return r?R(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=m?.fileKey===i?[...o,m.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:Pe(`${a?`1`:`0`}:${s.flatMap(z).join(`:`)}`)}},t[9]=m,t[10]=u,t[11]=r,t[12]=e):e=t[12],v=n.map(e),t[4]=m,t[5]=n,t[6]=u,t[7]=r,t[8]=v}else v=t[8];let y=v,b;t[13]!==a||t[14]!==m?.annotation||t[15]!==ne?(b=e=>{p(null),m?.annotation.metadata.entries.some(t=>t.id===e)?re(null):ne(a,e)},t[13]=a,t[14]=m?.annotation,t[15]=ne,t[16]=b):b=t[16];let x=b,S;t[17]!==te||t[18]!==a||t[19]!==m||t[20]!==_||t[21]!==r||t[22]!==i?(S=(e,t)=>{let n=m?.annotation.metadata.entries.find(t=>t.id===e),o=m?_.get(m.fileKey):void 0;if(!n||!o)return;let s=f({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});s&&te(a,s),p(null),re(null)},t[17]=te,t[18]=a,t[19]=m,t[20]=_,t[21]=r,t[22]=i,t[23]=S):S=t[23];let C=S,w;t[24]!==_||t[25]!==r||t[26]!==i?(w=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=_.get(n.id);if(!a)return;let o=We(),s=f({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});s&&re({fileKey:n.id,annotation:{side:Ye(e),lineNumber:e.end,metadata:{entries:[{id:o,kind:`draft`,range:e,rangeLabel:s.rangeLabel,text:``}]}}})},t[24]=_,t[25]=r,t[26]=i,t[27]=w):w=t[27];let ae=w,oe=m!==null,T;t[28]===s?T=t[29]:(T=s?{ref:s}:{},t[28]=s,t[29]=T);let E;t[30]===c?E=t[31]:(E=c?{className:c}:{},t[30]=c,t[31]=E);let D=!oe,O=!oe,k;t[32]!==ae||t[33]!==o||t[34]!==O||t[35]!==D?(k={...o,enableGutterUtility:D,enableLineSelection:O,onLineSelectionEnd:ae},t[32]=ae,t[33]=o,t[34]=O,t[35]=D,t[36]=k):k=t[36];let A;t[37]===ee?A=t[38]:(A=e=>e.type===`diff`?ee(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=ee,t[38]=A);let j;t[39]!==x||t[40]!==C?(j=e=>(0,L.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,L.jsx)(P,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>x(e.id),onComment:t=>C(e.id,t),onDelete:()=>x(e.id)},e.id))}),t[39]=x,t[40]=C,t[41]=j):j=t[41];let M;return t[42]!==y||t[43]!==d||t[44]!==k||t[45]!==A||t[46]!==j||t[47]!==T||t[48]!==E?(M=(0,L.jsx)(se,{...T,...E,items:y,selectedLines:d,onSelectedLinesChange:p,options:k,renderHeaderPrefix:A,renderAnnotation:j}),t[42]=y,t[43]=d,t[44]=k,t[45]=A,t[46]=j,t[47]=T,t[48]=E,t[49]=M):M=t[49],M}function z(e){return e.metadata.entries.map(Ze)}function Ze(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Qe(e){return[e.fileKey,e]}function B(e){return e.removeReviewComment}function $e(e){return e.addReviewComment}function et(e){return{diffPreview:a(e,{label:`environment-data:review:diff-preview`,tag:c.reviewGetDiffPreview,staleTimeMs:5e3})}}var tt=et(w);function V(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function nt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&V(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function rt(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var H=`__automatic_base_ref__`,it=new Set,at=`
|
|
2
2
|
[data-diffs-header],
|
|
3
3
|
[data-diff],
|
|
4
4
|
[data-file],
|
|
@@ -94,5 +94,5 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
|
|
|
94
94
|
color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;
|
|
95
95
|
text-decoration-color: currentColor;
|
|
96
96
|
}
|
|
97
|
-
`;function U({mode:e=`inline`,composerDraftTarget:t,initialGitScope:n}){let{resolvedTheme:r}=oe(),a=Ue(),[c]=(0,F.useState)(n),[f,ie]=(0,F.useState)(`stacked`),[h,v]=(0,F.useState)(a.wordWrap),[b,w]=(0,F.useState)(a.diffIgnoreWhitespace),[D,se]=(0,F.useState)(``),[Se,Fe]=(0,F.useState)(()=>({scopeKey:null,fileKeys:it})),He=(0,F.useRef)(null),P=ee({strict:!1,select:e=>k(e)}),We=P?.threadId??null,I=ye(P),Je=I?.projectId??null,Ye=_e(I&&Je?{environmentId:I.environmentId,projectId:Je}:null),R=I?.worktreePath??Ye?.workspaceRoot,z=s(ne.configValueAtom(I?.environmentId??null)),Ze=Pe(I?.environmentId??null,z?.availableEditors??[]),Qe=y(I!=null&&R!=null?me.status({environmentId:I.environmentId,input:{cwd:R}}):null),B=N(e=>ge(e.byThreadKey,P,c===`unstaged`)),$e=Qe.data?.isRepo??!0,{turnDiffSummaries:et,inferredCheckpointTurnCountByTurnId:V}=pe(I),U=(0,F.useMemo)(()=>[...et].toSorted((e,t)=>{let n=e.checkpointTurnCount??V[e.turnId]??0,r=t.checkpointTurnCount??V[t.turnId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[V,et]);(0,F.useEffect)(()=>{!P||B.kind!==`turn`||N.getState().reconcileTurnSelection(P,U.map(e=>e.turnId))},[B,U,P]);let W=B.kind===`turn`?B.turnId:null,G=B.kind===`unstaged`?`unstaged`:`branch`,K=B.kind===`branch`?B.baseRef:null,ot=B.kind===`turn`?B.filePath:null,st=B.kind===`turn`?B.revealRequestId:0,q=W===null?void 0:U.find(e=>e.turnId===W)??U[0],J=q&&(q.checkpointTurnCount??V[q.turnId]),ct=U[0],lt=W===null?G===`unstaged`?`Working tree`:`Branch changes`:q?.turnId===ct?.turnId?`Latest turn`:`Turn ${J??`?`}`,ut=q?`turn:${q.turnId}`:G,Y=P?`${P.environmentId}:${P.threadId}:${ut}`:null,dt=Se.scopeKey===Y?Se.fileKeys:it,ft=q?`Turn ${J??`?`}`:G===`unstaged`?`Working tree`:`Branch changes`,pt=(0,F.useMemo)(()=>typeof J==`number`?{fromTurnCount:Math.max(0,J-1),toTurnCount:J}:null,[J]),mt=qe({environmentId:I?.environmentId??null,threadId:We,fromTurnCount:pt?.fromTurnCount??null,toTurnCount:pt?.toTurnCount??null,ignoreWhitespace:b,cacheScope:q?`turn:${q.turnId}`:null},{enabled:$e&&q!==void 0}),ht=y(W===null&&I&&R?tt.diffPreview({environmentId:I.environmentId,input:{cwd:R,...K?{baseRef:K}:{},ignoreWhitespace:b}}):null),gt=W===null&&ht.error?.includes(`configured workspace root`)===!0&&z?.cwd!==void 0&&z.cwd!==R,_t=y(gt&&I&&z?tt.diffPreview({environmentId:I.environmentId,input:{cwd:z.cwd,...K?{baseRef:K}:{},ignoreWhitespace:b}}):null),X=gt?_t:ht,Z=X.data?.sources.find(e=>e.kind===(G===`unstaged`?`working-tree`:`branch-range`)),vt=y(W===null&&G===`branch`&&I&&X.data?.cwd?me.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...D.trim().length>0?{query:D.trim()}:{},limit:100}}):null),yt=y(W===null&&G===`branch`&&I&&X.data?.cwd?me.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...D.trim().length>0?{query:D.trim()}:{},limit:100}}):null),bt=nt(vt.data?.refs.filter(e=>e.name!==Z?.headRef)??[],yt.data?.refs??[]),xt=rt(bt,D),St=e=>K&&K===e.remote?.name?K:e.local?.name??e.remote?.name??e.id,Ct=[H,...bt.map(St)],wt=[...D.trim().length===0?[H]:[],...xt.map(St)],Tt=Z?.diff,Et=q?mt.data?.diff:Tt,Dt=!q&&Z?.truncated===!0,Ot=q?mt.isPending:X.isPending,kt=q?mt.error:X.error,At=typeof Et==`string`&&Et.trim().length===0,Q=(0,F.useMemo)(()=>Me(Et,`diff-panel:${r}`,{compactPartialHunkOffsets:W===null}),[r,Et,W]),jt=(0,F.useMemo)(()=>!Q||Q.kind!==`files`?[]:Q.files.toSorted((e,t)=>Ee(e).localeCompare(Ee(t),void 0,{numeric:!0,sensitivity:`base`})),[Q]),$=(0,F.useMemo)(()=>jt.map(e=>{let t=we(e);return{fileDiff:e,filePath:Ee(e),fileKey:t,collapsed:dt.has(t)}}),[dt,jt]),Mt=(0,F.useMemo)(()=>$.map(e=>e.fileKey),[$]),Nt=le(Mt,dt),Pt=(0,F.useMemo)(()=>Te(jt),[jt]);(0,F.useEffect)(()=>{if(!ot)return;let e=$.find(e=>e.filePath===ot);e&&He.current?.scrollTo({type:`item`,id:e.fileKey,align:`start`})},[$,ot,st]);let Ft=(0,F.useCallback)(e=>{Ke({threadRef:P,filePath:e,activeCwd:R,openInEditor:e=>{(async()=>{let t=await Ze(e);t._tag===`Failure`&&!d(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,...P?{environmentId:P.environmentId,threadId:P.threadId}:{},..._(T(t))})})()}})},[R,Ze,P]),It=(0,F.useCallback)(e=>{Fe(t=>{let n=new Set(t.scopeKey===Y?t.fileKeys:[]);return n.has(e)?n.delete(e):n.add(e),{scopeKey:Y,fileKeys:n}})},[Y]),Lt=(0,F.useCallback)(()=>{Fe(e=>{let t=e.scopeKey===Y?e.fileKeys:it;return{scopeKey:Y,fileKeys:j(Mt,t)}})},[Y,Mt]),Rt=e=>{P&&N.getState().selectTurn(P,e)},zt=e=>{P&&N.getState().selectGitScope(P,e)},Bt=e=>{P&&N.getState().selectBranchBaseRef(P,e)};return(0,L.jsx)(ve,{mode:e,header:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]`,children:[(0,L.jsxs)(i,{children:[(0,L.jsxs)(re,{className:`inline-flex h-6 max-w-full items-center gap-1 rounded-md bg-muted/70 px-2 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Diff scope: ${lt}`,children:[(0,L.jsx)(`span`,{className:`truncate`,children:lt}),(0,L.jsx)(x,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,L.jsxs)(ae,{align:`start`,className:`w-60`,children:[(0,L.jsx)(C,{className:W===null&&G===`unstaged`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`unstaged`),children:(0,L.jsx)(`span`,{children:`Working tree`})}),(0,L.jsx)(C,{className:W===null&&G===`branch`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`branch`),children:(0,L.jsx)(`span`,{children:`Branch changes`})}),(0,L.jsx)(C,{className:W!==null&&q?.turnId===ct?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>{ct&&Rt(ct.turnId)},children:(0,L.jsx)(`span`,{children:`Latest turn`})}),(0,L.jsxs)(m,{children:[(0,L.jsx)(E,{children:`Turn`}),(0,L.jsx)(S,{className:`w-64`,children:U.map(e=>{let t=e.checkpointTurnCount??V[e.turnId]??`?`;return(0,L.jsxs)(C,{className:e.turnId===q?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>Rt(e.turnId),children:[(0,L.jsxs)(`span`,{children:[`Turn `,t]}),(0,L.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-muted-foreground`,children:Ae(e.completedAt,a.timestampFormat)})]},e.turnId)})})]})]})]}),W===null&&G===`branch`&&Z?.baseRef&&(0,L.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground`,title:`${Z.headRef??`HEAD`} → ${Z.baseRef}`,"aria-label":`Comparing ${Z.headRef??`HEAD`} against ${Z.baseRef}`,children:[(0,L.jsx)(`span`,{className:`min-w-0 max-w-48 truncate`,children:Z.headRef??`HEAD`}),(0,L.jsx)(A,{className:`size-3.5 shrink-0 opacity-70`}),(0,L.jsxs)(fe,{items:Ct,filteredItems:wt,value:K??H,onOpenChange:e=>{e||se(``)},onValueChange:e=>{e&&Bt(e===H?null:e)},children:[(0,L.jsxs)(Ce,{className:`inline-flex min-w-0 max-w-48 items-center gap-1 overflow-hidden rounded-md px-1.5 py-1 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Change comparison target. Currently ${Z.baseRef}`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:Z.baseRef}),(0,L.jsx)(x,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,L.jsxs)(je,{align:`start`,className:`w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden [&>[data-slot=combobox-popup]]:min-w-0 [&>[data-slot=combobox-popup]]:overflow-hidden`,children:[(0,L.jsx)(`div`,{className:`min-w-0 shrink-0 px-3 pt-2.5`,children:(0,L.jsxs)(`div`,{className:`relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring`,children:[(0,L.jsx)(xe,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55`}),(0,L.jsx)(Be,{className:`[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5`,inputClassName:`rounded-none bg-transparent text-sm`,placeholder:`Search refs...`,showTrigger:!1,size:`sm`,unstyled:!0,value:D,onChange:e=>se(e.target.value)})]})}),(0,L.jsxs)(`div`,{className:`grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-[10px] text-muted-foreground uppercase tracking-wide`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`}),(0,L.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center`,children:[(0,L.jsx)(`span`,{children:`Branch`}),(0,L.jsx)(`span`,{className:`text-right`,children:`Remote`})]})]}),(0,L.jsx)(De,{children:`No matching refs.`}),(0,L.jsxs)(Re,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,L.jsx)(Ne,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:H,children:(0,L.jsx)(`span`,{className:`block min-w-0 truncate`,children:`Automatic`})}),bt.map(e=>{let t=St(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,L.jsx)(Ne,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:t,children:(0,L.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden`,children:[(0,L.jsx)(`span`,{className:`block min-w-0 truncate pe-2`,children:e.label}),n?(0,L.jsx)(`div`,{className:`flex justify-end`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,L.jsx)(be,{"aria-label":`Use remote version of ${e.label}`,checked:r,className:`[--thumb-size:--spacing(3)]`,onCheckedChange:t=>{let n=t?e.remote?.name:e.local?.name;n&&Bt(n)}})}):e.remote?(0,L.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,title:`Remote only`,children:(0,L.jsx)(o,{"aria-hidden":`true`,className:`size-3`})}):null]})},e.id)})]})]})]})]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[$.length>0&&(0,L.jsx)(ke,{additions:Pt.additions,deletions:Pt.deletions,className:`mr-1 text-[11px]`,layout:`inline`}),$.length>0&&(0,L.jsxs)(O,{children:[(0,L.jsx)(l,{render:(0,L.jsx)(u,{type:`button`,size:`icon-xs`,variant:`outline`,"aria-label":Nt?`Expand all files`:`Collapse all files`,onClick:Lt}),children:Nt?(0,L.jsx)(Oe,{className:`size-3`}):(0,L.jsx)(Ie,{className:`size-3`})}),(0,L.jsx)(p,{side:`top`,children:Nt?`Expand all files`:`Collapse all files`})]}),(0,L.jsxs)(M,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[f],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&ie(t)},children:[(0,L.jsx)(de,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,L.jsx)(ce,{className:`size-3`})}),(0,L.jsx)(de,{"aria-label":`Split diff view`,value:`split`,children:(0,L.jsx)(ue,{className:`size-3`})})]}),(0,L.jsxs)(O,{children:[(0,L.jsx)(l,{render:(0,L.jsx)(de,{"aria-label":h?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`outline`,size:`xs`,pressed:h,onPressedChange:e=>{v(!!e)}}),children:(0,L.jsx)(he,{className:`size-3`})}),(0,L.jsx)(p,{side:`top`,children:h?`Disable line wrapping`:`Enable line wrapping`})]}),(0,L.jsxs)(O,{children:[(0,L.jsx)(l,{render:(0,L.jsx)(de,{"aria-label":b?`Show whitespace changes`:`Hide whitespace changes`,variant:`outline`,size:`xs`,pressed:b,onPressedChange:e=>{w(!!e)}}),children:(0,L.jsx)(Ge,{className:`size-3`})}),(0,L.jsx)(p,{side:`top`,children:b?`Show whitespace changes`:`Hide whitespace changes`})]})]})]}),children:I?$e?W!==null&&U.length===0?(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{className:`diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[Dt&&(0,L.jsx)(`p`,{className:`shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-[11px] text-muted-foreground`,children:`This diff was truncated because it exceeded the preview limit. The changes shown are incomplete.`}),kt&&!Q&&(0,L.jsx)(`div`,{className:`px-3`,children:(0,L.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:kt})}),Q?Q.kind===`files`?(0,L.jsx)(`div`,{className:`min-h-0 flex-1`,onClickCapture:e=>{let t=(e.nativeEvent.composedPath?.()??[]).find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent?.trim();t&&Ft(t)},children:(0,L.jsx)(Xe,{viewerRef:He,className:`diff-render-surface h-full min-h-0 overflow-auto`,files:$,sectionId:ut,sectionTitle:ft,composerDraftTarget:t,renderHeaderPrefix:(e,t,n)=>{let r=Ee(e);return(0,L.jsxs)(O,{children:[(0,L.jsx)(l,{render:(0,L.jsx)(`button`,{type:`button`,className:g(`inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 transition-colors hover:bg-foreground/10 focus-visible:outline-hidden`,ze(e)),"aria-label":n?`Expand ${r}`:`Collapse ${r}`,"aria-expanded":!n,onClick:e=>{e.stopPropagation(),It(t)}}),children:n?(0,L.jsx)(te,{className:`size-4`}):(0,L.jsx)(x,{className:`size-4`})}),(0,L.jsx)(p,{side:`top`,children:n?`Expand diff`:`Collapse diff`})]})},options:{diffStyle:f===`split`?`split`:`unified`,lineDiffType:`none`,overflow:h?`wrap`:`scroll`,theme:Ve(r),themeType:r,unsafeCSS:at,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:33},layout:{paddingTop:0,paddingBottom:8,gap:8}}},Y??ut)}):(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:Q.reason}),(0,L.jsx)(`pre`,{className:g(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,h?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:Q.text})]})}):Ot?(0,L.jsx)(Le,{label:q?`Loading checkpoint diff...`:G===`unstaged`?`Loading working tree diff...`:`Loading branch diff...`}):(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,L.jsx)(`p`,{children:At?`No net changes in this selection.`:`No patch available for this selection.`})})]})}):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`})})}export{Se as DiffWorkerPoolProvider,U as default};
|
|
98
|
-
//# sourceMappingURL=DiffPanel-
|
|
97
|
+
`;function U({mode:e=`inline`,composerDraftTarget:t,initialGitScope:n}){let{resolvedTheme:r}=oe(),a=Ue(),[c]=(0,F.useState)(n),[f,ie]=(0,F.useState)(`stacked`),[h,v]=(0,F.useState)(a.wordWrap),[b,w]=(0,F.useState)(a.diffIgnoreWhitespace),[D,se]=(0,F.useState)(``),[Se,Pe]=(0,F.useState)(()=>({scopeKey:null,fileKeys:it})),He=(0,F.useRef)(null),P=ee({strict:!1,select:e=>k(e)}),We=P?.threadId??null,I=ye(P),Je=I?.projectId??null,Ye=_e(I&&Je?{environmentId:I.environmentId,projectId:Je}:null),R=I?.worktreePath??Ye?.workspaceRoot,z=s(ne.configValueAtom(I?.environmentId??null)),Ze=Ne(I?.environmentId??null,z?.availableEditors??[]),Qe=y(I!=null&&R!=null?me.status({environmentId:I.environmentId,input:{cwd:R}}):null),B=N(e=>ge(e.byThreadKey,P,c===`unstaged`)),$e=Qe.data?.isRepo??!0,{turnDiffSummaries:et,inferredCheckpointTurnCountByTurnId:V}=pe(I),U=(0,F.useMemo)(()=>[...et].toSorted((e,t)=>{let n=e.checkpointTurnCount??V[e.turnId]??0,r=t.checkpointTurnCount??V[t.turnId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[V,et]);(0,F.useEffect)(()=>{!P||B.kind!==`turn`||N.getState().reconcileTurnSelection(P,U.map(e=>e.turnId))},[B,U,P]);let W=B.kind===`turn`?B.turnId:null,G=B.kind===`unstaged`?`unstaged`:`branch`,K=B.kind===`branch`?B.baseRef:null,ot=B.kind===`turn`?B.filePath:null,st=B.kind===`turn`?B.revealRequestId:0,q=W===null?void 0:U.find(e=>e.turnId===W)??U[0],J=q&&(q.checkpointTurnCount??V[q.turnId]),ct=U[0],lt=W===null?G===`unstaged`?`Working tree`:`Branch changes`:q?.turnId===ct?.turnId?`Latest turn`:`Turn ${J??`?`}`,ut=q?`turn:${q.turnId}`:G,Y=P?`${P.environmentId}:${P.threadId}:${ut}`:null,dt=Se.scopeKey===Y?Se.fileKeys:it,ft=q?`Turn ${J??`?`}`:G===`unstaged`?`Working tree`:`Branch changes`,pt=(0,F.useMemo)(()=>typeof J==`number`?{fromTurnCount:Math.max(0,J-1),toTurnCount:J}:null,[J]),mt=qe({environmentId:I?.environmentId??null,threadId:We,fromTurnCount:pt?.fromTurnCount??null,toTurnCount:pt?.toTurnCount??null,ignoreWhitespace:b,cacheScope:q?`turn:${q.turnId}`:null},{enabled:$e&&q!==void 0}),ht=y(W===null&&I&&R?tt.diffPreview({environmentId:I.environmentId,input:{cwd:R,...K?{baseRef:K}:{},ignoreWhitespace:b}}):null),gt=W===null&&ht.error?.includes(`configured workspace root`)===!0&&z?.cwd!==void 0&&z.cwd!==R,_t=y(gt&&I&&z?tt.diffPreview({environmentId:I.environmentId,input:{cwd:z.cwd,...K?{baseRef:K}:{},ignoreWhitespace:b}}):null),X=gt?_t:ht,Z=X.data?.sources.find(e=>e.kind===(G===`unstaged`?`working-tree`:`branch-range`)),vt=y(W===null&&G===`branch`&&I&&X.data?.cwd?me.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...D.trim().length>0?{query:D.trim()}:{},limit:100}}):null),yt=y(W===null&&G===`branch`&&I&&X.data?.cwd?me.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...D.trim().length>0?{query:D.trim()}:{},limit:100}}):null),bt=nt(vt.data?.refs.filter(e=>e.name!==Z?.headRef)??[],yt.data?.refs??[]),xt=rt(bt,D),St=e=>K&&K===e.remote?.name?K:e.local?.name??e.remote?.name??e.id,Ct=[H,...bt.map(St)],wt=[...D.trim().length===0?[H]:[],...xt.map(St)],Tt=Z?.diff,Et=q?mt.data?.diff:Tt,Dt=!q&&Z?.truncated===!0,Ot=q?mt.isPending:X.isPending,kt=q?mt.error:X.error,At=typeof Et==`string`&&Et.trim().length===0,Q=(0,F.useMemo)(()=>je(Et,`diff-panel:${r}`,{compactPartialHunkOffsets:W===null}),[r,Et,W]),jt=(0,F.useMemo)(()=>!Q||Q.kind!==`files`?[]:Q.files.toSorted((e,t)=>Ee(e).localeCompare(Ee(t),void 0,{numeric:!0,sensitivity:`base`})),[Q]),$=(0,F.useMemo)(()=>jt.map(e=>{let t=we(e);return{fileDiff:e,filePath:Ee(e),fileKey:t,collapsed:dt.has(t)}}),[dt,jt]),Mt=(0,F.useMemo)(()=>$.map(e=>e.fileKey),[$]),Nt=le(Mt,dt),Pt=(0,F.useMemo)(()=>Te(jt),[jt]);(0,F.useEffect)(()=>{if(!ot)return;let e=$.find(e=>e.filePath===ot);e&&He.current?.scrollTo({type:`item`,id:e.fileKey,align:`start`})},[$,ot,st]);let Ft=(0,F.useCallback)(e=>{Ke({threadRef:P,filePath:e,activeCwd:R,openInEditor:e=>{(async()=>{let t=await Ze(e);t._tag===`Failure`&&!d(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,...P?{environmentId:P.environmentId,threadId:P.threadId}:{},..._(T(t))})})()}})},[R,Ze,P]),It=(0,F.useCallback)(e=>{Pe(t=>{let n=new Set(t.scopeKey===Y?t.fileKeys:[]);return n.has(e)?n.delete(e):n.add(e),{scopeKey:Y,fileKeys:n}})},[Y]),Lt=(0,F.useCallback)(()=>{Pe(e=>{let t=e.scopeKey===Y?e.fileKeys:it;return{scopeKey:Y,fileKeys:j(Mt,t)}})},[Y,Mt]),Rt=e=>{P&&N.getState().selectTurn(P,e)},zt=e=>{P&&N.getState().selectGitScope(P,e)},Bt=e=>{P&&N.getState().selectBranchBaseRef(P,e)};return(0,L.jsx)(ve,{mode:e,header:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]`,children:[(0,L.jsxs)(i,{children:[(0,L.jsxs)(re,{className:`inline-flex h-6 max-w-full items-center gap-1 rounded-md bg-muted/70 px-2 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Diff scope: ${lt}`,children:[(0,L.jsx)(`span`,{className:`truncate`,children:lt}),(0,L.jsx)(x,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,L.jsxs)(ae,{align:`start`,className:`w-60`,children:[(0,L.jsx)(C,{className:W===null&&G===`unstaged`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`unstaged`),children:(0,L.jsx)(`span`,{children:`Working tree`})}),(0,L.jsx)(C,{className:W===null&&G===`branch`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`branch`),children:(0,L.jsx)(`span`,{children:`Branch changes`})}),(0,L.jsx)(C,{className:W!==null&&q?.turnId===ct?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>{ct&&Rt(ct.turnId)},children:(0,L.jsx)(`span`,{children:`Latest turn`})}),(0,L.jsxs)(m,{children:[(0,L.jsx)(E,{children:`Turn`}),(0,L.jsx)(S,{className:`w-64`,children:U.map(e=>{let t=e.checkpointTurnCount??V[e.turnId]??`?`;return(0,L.jsxs)(C,{className:e.turnId===q?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>Rt(e.turnId),children:[(0,L.jsxs)(`span`,{children:[`Turn `,t]}),(0,L.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-muted-foreground`,children:Ie(e.completedAt,a.timestampFormat)})]},e.turnId)})})]})]})]}),W===null&&G===`branch`&&Z?.baseRef&&(0,L.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground`,title:`${Z.headRef??`HEAD`} → ${Z.baseRef}`,"aria-label":`Comparing ${Z.headRef??`HEAD`} against ${Z.baseRef}`,children:[(0,L.jsx)(`span`,{className:`min-w-0 max-w-48 truncate`,children:Z.headRef??`HEAD`}),(0,L.jsx)(A,{className:`size-3.5 shrink-0 opacity-70`}),(0,L.jsxs)(fe,{items:Ct,filteredItems:wt,value:K??H,onOpenChange:e=>{e||se(``)},onValueChange:e=>{e&&Bt(e===H?null:e)},children:[(0,L.jsxs)(Ce,{className:`inline-flex min-w-0 max-w-48 items-center gap-1 overflow-hidden rounded-md px-1.5 py-1 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Change comparison target. Currently ${Z.baseRef}`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:Z.baseRef}),(0,L.jsx)(x,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,L.jsxs)(Ae,{align:`start`,className:`w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden [&>[data-slot=combobox-popup]]:min-w-0 [&>[data-slot=combobox-popup]]:overflow-hidden`,children:[(0,L.jsx)(`div`,{className:`min-w-0 shrink-0 px-3 pt-2.5`,children:(0,L.jsxs)(`div`,{className:`relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring`,children:[(0,L.jsx)(xe,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55`}),(0,L.jsx)(Be,{className:`[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5`,inputClassName:`rounded-none bg-transparent text-sm`,placeholder:`Search refs...`,showTrigger:!1,size:`sm`,unstyled:!0,value:D,onChange:e=>se(e.target.value)})]})}),(0,L.jsxs)(`div`,{className:`grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-[10px] text-muted-foreground uppercase tracking-wide`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`}),(0,L.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center`,children:[(0,L.jsx)(`span`,{children:`Branch`}),(0,L.jsx)(`span`,{className:`text-right`,children:`Remote`})]})]}),(0,L.jsx)(De,{children:`No matching refs.`}),(0,L.jsxs)(Re,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,L.jsx)(Me,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:H,children:(0,L.jsx)(`span`,{className:`block min-w-0 truncate`,children:`Automatic`})}),bt.map(e=>{let t=St(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,L.jsx)(Me,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:t,children:(0,L.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden`,children:[(0,L.jsx)(`span`,{className:`block min-w-0 truncate pe-2`,children:e.label}),n?(0,L.jsx)(`div`,{className:`flex justify-end`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,L.jsx)(be,{"aria-label":`Use remote version of ${e.label}`,checked:r,className:`[--thumb-size:--spacing(3)]`,onCheckedChange:t=>{let n=t?e.remote?.name:e.local?.name;n&&Bt(n)}})}):e.remote?(0,L.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,title:`Remote only`,children:(0,L.jsx)(o,{"aria-hidden":`true`,className:`size-3`})}):null]})},e.id)})]})]})]})]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[$.length>0&&(0,L.jsx)(ke,{additions:Pt.additions,deletions:Pt.deletions,className:`mr-1 text-[11px]`,layout:`inline`}),$.length>0&&(0,L.jsxs)(O,{children:[(0,L.jsx)(l,{render:(0,L.jsx)(u,{type:`button`,size:`icon-xs`,variant:`outline`,"aria-label":Nt?`Expand all files`:`Collapse all files`,onClick:Lt}),children:Nt?(0,L.jsx)(Oe,{className:`size-3`}):(0,L.jsx)(Fe,{className:`size-3`})}),(0,L.jsx)(p,{side:`top`,children:Nt?`Expand all files`:`Collapse all files`})]}),(0,L.jsxs)(M,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[f],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&ie(t)},children:[(0,L.jsx)(de,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,L.jsx)(ce,{className:`size-3`})}),(0,L.jsx)(de,{"aria-label":`Split diff view`,value:`split`,children:(0,L.jsx)(ue,{className:`size-3`})})]}),(0,L.jsxs)(O,{children:[(0,L.jsx)(l,{render:(0,L.jsx)(de,{"aria-label":h?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`outline`,size:`xs`,pressed:h,onPressedChange:e=>{v(!!e)}}),children:(0,L.jsx)(he,{className:`size-3`})}),(0,L.jsx)(p,{side:`top`,children:h?`Disable line wrapping`:`Enable line wrapping`})]}),(0,L.jsxs)(O,{children:[(0,L.jsx)(l,{render:(0,L.jsx)(de,{"aria-label":b?`Show whitespace changes`:`Hide whitespace changes`,variant:`outline`,size:`xs`,pressed:b,onPressedChange:e=>{w(!!e)}}),children:(0,L.jsx)(Ge,{className:`size-3`})}),(0,L.jsx)(p,{side:`top`,children:b?`Show whitespace changes`:`Hide whitespace changes`})]})]})]}),children:I?$e?W!==null&&U.length===0?(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{className:`diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[Dt&&(0,L.jsx)(`p`,{className:`shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-[11px] text-muted-foreground`,children:`This diff was truncated because it exceeded the preview limit. The changes shown are incomplete.`}),kt&&!Q&&(0,L.jsx)(`div`,{className:`px-3`,children:(0,L.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:kt})}),Q?Q.kind===`files`?(0,L.jsx)(`div`,{className:`min-h-0 flex-1`,onClickCapture:e=>{let t=(e.nativeEvent.composedPath?.()??[]).find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent?.trim();t&&Ft(t)},children:(0,L.jsx)(Xe,{viewerRef:He,className:`diff-render-surface h-full min-h-0 overflow-auto`,files:$,sectionId:ut,sectionTitle:ft,composerDraftTarget:t,renderHeaderPrefix:(e,t,n)=>{let r=Ee(e);return(0,L.jsxs)(O,{children:[(0,L.jsx)(l,{render:(0,L.jsx)(`button`,{type:`button`,className:g(`inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 transition-colors hover:bg-foreground/10 focus-visible:outline-hidden`,ze(e)),"aria-label":n?`Expand ${r}`:`Collapse ${r}`,"aria-expanded":!n,onClick:e=>{e.stopPropagation(),It(t)}}),children:n?(0,L.jsx)(te,{className:`size-4`}):(0,L.jsx)(x,{className:`size-4`})}),(0,L.jsx)(p,{side:`top`,children:n?`Expand diff`:`Collapse diff`})]})},options:{diffStyle:f===`split`?`split`:`unified`,lineDiffType:`none`,overflow:h?`wrap`:`scroll`,theme:Ve(r),themeType:r,unsafeCSS:at,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:33},layout:{paddingTop:0,paddingBottom:8,gap:8}}},Y??ut)}):(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:Q.reason}),(0,L.jsx)(`pre`,{className:g(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,h?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:Q.text})]})}):Ot?(0,L.jsx)(Le,{label:q?`Loading checkpoint diff...`:G===`unstaged`?`Loading working tree diff...`:`Loading branch diff...`}):(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,L.jsx)(`p`,{children:At?`No net changes in this selection.`:`No patch available for this selection.`})})]})}):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`})})}export{Se as DiffWorkerPoolProvider,U as default};
|
|
98
|
+
//# sourceMappingURL=DiffPanel-DxLjTzhm.js.map
|