@tutti-os/agent-gui 0.0.94 → 0.0.95
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/README.md +48 -32
- package/dist/AgentGUI-CwBLYtv-.d.ts +992 -0
- package/dist/agent-conversation/index.d.ts +5 -7
- package/dist/agent-conversation/index.js +12 -8
- package/dist/agent-conversation/index.js.map +1 -1
- package/dist/agent-env/index.d.ts +10 -36
- package/dist/agent-env/index.js +1 -56
- package/dist/agent-env/index.js.map +1 -1
- package/dist/agent-gui.d.ts +21 -0
- package/dist/agent-gui.js +39 -0
- package/dist/agent-message-center/index.d.ts +145 -124
- package/dist/agent-message-center/index.js +1374 -1316
- package/dist/agent-message-center/index.js.map +1 -1
- package/dist/{agentConversationVM-Cl4G0Lln.d.ts → agentConversationVM-C335TR6S.d.ts} +112 -7
- package/dist/agentFileMentionContracts-Czvz6YMI.d.ts +107 -0
- package/dist/{agentGuiNodeTypes-CAioPXK9.d.ts → agentGuiNodeTypes-DppADPHW.d.ts} +96 -148
- package/dist/agentPlanPromptDispatch-C7cCMjve.d.ts +37 -0
- package/dist/agents.d.ts +13 -0
- package/dist/agents.js +13 -0
- package/dist/app/renderer/agentactivity.css +126 -80
- package/dist/app/renderer/assets/icons/agent-vinyls/tutti-vinyl.png +0 -0
- package/dist/app/renderer/assets/icons/open-link-lined.svg +4 -0
- package/dist/{chunk-P72YLKC6.js → chunk-3R2D4E57.js} +3127 -3398
- package/dist/chunk-3R2D4E57.js.map +1 -0
- package/dist/chunk-4YG7YK7S.js +23 -0
- package/dist/chunk-4YG7YK7S.js.map +1 -0
- package/dist/chunk-5X7YDOC6.js +42 -0
- package/dist/chunk-5X7YDOC6.js.map +1 -0
- package/dist/{chunk-IBIMGLCD.js → chunk-7J4K6WKB.js} +1 -1
- package/dist/chunk-7J4K6WKB.js.map +1 -0
- package/dist/{chunk-BXVPOGYK.js → chunk-7PFDA2HQ.js} +505 -504
- package/dist/chunk-7PFDA2HQ.js.map +1 -0
- package/dist/{chunk-AWAIUYG4.js → chunk-7RDD3EWP.js} +513 -555
- package/dist/chunk-7RDD3EWP.js.map +1 -0
- package/dist/{chunk-UBDPV34P.js → chunk-AOS2VWU6.js} +1355 -1305
- package/dist/chunk-AOS2VWU6.js.map +1 -0
- package/dist/{chunk-E5FOXRUM.js → chunk-BFNJKTDV.js} +295 -255
- package/dist/chunk-BFNJKTDV.js.map +1 -0
- package/dist/{chunk-5FE7M42A.js → chunk-BIHBXWK5.js} +2 -2
- package/dist/{chunk-7BUYFVRI.js → chunk-C5FV4UGI.js} +2921 -2944
- package/dist/chunk-C5FV4UGI.js.map +1 -0
- package/dist/{chunk-SCLLP5DO.js → chunk-CRO2MV2Y.js} +36 -46
- package/dist/chunk-CRO2MV2Y.js.map +1 -0
- package/dist/chunk-FGLQZ6I4.js +9 -0
- package/dist/chunk-FGLQZ6I4.js.map +1 -0
- package/dist/chunk-H6IQ63DQ.js +14 -0
- package/dist/chunk-H6IQ63DQ.js.map +1 -0
- package/dist/{chunk-IGY4ASUF.js → chunk-JX2SIXNL.js} +1293 -1702
- package/dist/chunk-JX2SIXNL.js.map +1 -0
- package/dist/chunk-KAL4XZMA.js +231 -0
- package/dist/chunk-KAL4XZMA.js.map +1 -0
- package/dist/chunk-KJQERFKX.js +259 -0
- package/dist/chunk-KJQERFKX.js.map +1 -0
- package/dist/chunk-LQVXBT65.js +491 -0
- package/dist/chunk-LQVXBT65.js.map +1 -0
- package/dist/{chunk-554VG7ZW.js → chunk-NITOD7WF.js} +2 -2
- package/dist/{chunk-7LMJXF4R.js → chunk-NJAZ7LQM.js} +20 -16
- package/dist/chunk-NJAZ7LQM.js.map +1 -0
- package/dist/chunk-NX3CZJXW.js +25 -0
- package/dist/chunk-NX3CZJXW.js.map +1 -0
- package/dist/chunk-O6W72SEP.js +93 -0
- package/dist/chunk-O6W72SEP.js.map +1 -0
- package/dist/chunk-RY6GIO3K.js +31700 -0
- package/dist/chunk-RY6GIO3K.js.map +1 -0
- package/dist/{chunk-XDV4ZRVK.js → chunk-UGVI47X6.js} +98 -37
- package/dist/chunk-UGVI47X6.js.map +1 -0
- package/dist/{chunk-XW4CVBUH.js → chunk-UQJPV6HP.js} +18 -11
- package/dist/chunk-UQJPV6HP.js.map +1 -0
- package/dist/{chunk-GAPTLVII.js → chunk-VF22EG3F.js} +1 -1
- package/dist/{chunk-GAPTLVII.js.map → chunk-VF22EG3F.js.map} +1 -1
- package/dist/{chunk-45FF4DQU.js → chunk-WEDMAVX2.js} +22 -24
- package/dist/chunk-WEDMAVX2.js.map +1 -0
- package/dist/{chunk-MATIJPGF.js → chunk-XMO45GKA.js} +531 -401
- package/dist/chunk-XMO45GKA.js.map +1 -0
- package/dist/{chunk-ZUW4B5AT.js → chunk-YE25HN6T.js} +6 -9
- package/dist/chunk-YE25HN6T.js.map +1 -0
- package/dist/context-mention-palette/index.d.ts +3 -2
- package/dist/context-mention-palette/index.js +19 -14
- package/dist/custom-mention.d.ts +44 -0
- package/dist/custom-mention.js +17 -0
- package/dist/custom-mention.js.map +1 -0
- package/dist/dock-icons.d.ts +6 -0
- package/dist/dock-icons.js +11 -0
- package/dist/dock-icons.js.map +1 -0
- package/dist/i18n/index.d.ts +850 -841
- package/dist/i18n/index.js +2 -2
- package/dist/index.d.ts +52 -1061
- package/dist/index.js +72 -35530
- package/dist/index.js.map +1 -1
- package/dist/mention-search.d.ts +226 -0
- package/dist/mention-search.js +29 -0
- package/dist/mention-search.js.map +1 -0
- package/dist/open-link-lined-JWEKUKME.svg +4 -0
- package/dist/provider-icons.d.ts +6 -0
- package/dist/provider-icons.js +12 -0
- package/dist/provider-icons.js.map +1 -0
- package/dist/provider-identity.d.ts +9 -0
- package/dist/provider-identity.js +21 -0
- package/dist/provider-identity.js.map +1 -0
- package/dist/runtime-BBNdWgDU.d.ts +10 -0
- package/dist/{types-PLFZ8SBX.d.ts → types-DX2bxgB8.d.ts} +28 -83
- package/dist/workbench/contribution.d.ts +32 -40
- package/dist/workbench/contribution.js +10 -6
- package/dist/workbench/index.d.ts +3 -2
- package/dist/workbench/index.js +24 -20
- package/dist/workbench/launch.d.ts +2 -5
- package/dist/workbench/launch.js +4 -3
- package/dist/workbench/providerCatalog.js +2 -1
- package/dist/workbench/sessionTitle.d.ts +4 -3
- package/dist/workbench/sessionTitle.js +4 -3
- package/dist/workbench/state.d.ts +1 -1
- package/dist/workbench/state.js +3 -2
- package/dist/workbench/types.d.ts +0 -3
- package/dist/workbench/types.js +1 -1
- package/dist/workspace-agent-generated-files.d.ts +20 -2
- package/dist/workspace-agent-generated-files.js +7 -6
- package/dist/workspaceAgentActivityListTypes-C7gPWYiA.d.ts +71 -0
- package/package.json +63 -26
- package/dist/AgentMentionSearchController-DD_WOred.d.ts +0 -241
- package/dist/AgentMessageMarkdown-DeYPURtF.d.ts +0 -7
- package/dist/chunk-45FF4DQU.js.map +0 -1
- package/dist/chunk-4HP6V2YA.js +0 -207
- package/dist/chunk-4HP6V2YA.js.map +0 -1
- package/dist/chunk-7BUYFVRI.js.map +0 -1
- package/dist/chunk-7LMJXF4R.js.map +0 -1
- package/dist/chunk-AWAIUYG4.js.map +0 -1
- package/dist/chunk-BXVPOGYK.js.map +0 -1
- package/dist/chunk-E5FOXRUM.js.map +0 -1
- package/dist/chunk-IBIMGLCD.js.map +0 -1
- package/dist/chunk-IGY4ASUF.js.map +0 -1
- package/dist/chunk-LR4FA5X6.js +0 -368
- package/dist/chunk-LR4FA5X6.js.map +0 -1
- package/dist/chunk-MATIJPGF.js.map +0 -1
- package/dist/chunk-MKHDRIGN.js +0 -71
- package/dist/chunk-MKHDRIGN.js.map +0 -1
- package/dist/chunk-P72YLKC6.js.map +0 -1
- package/dist/chunk-SCLLP5DO.js.map +0 -1
- package/dist/chunk-UBDPV34P.js.map +0 -1
- package/dist/chunk-VAKFNNKT.js +0 -410
- package/dist/chunk-VAKFNNKT.js.map +0 -1
- package/dist/chunk-XDV4ZRVK.js.map +0 -1
- package/dist/chunk-XW4CVBUH.js.map +0 -1
- package/dist/chunk-ZUW4B5AT.js.map +0 -1
- package/dist/plan-decision-ops.d.ts +0 -70
- package/dist/plan-decision-ops.js +0 -19
- package/dist/queued-prompt-runtime.d.ts +0 -115
- package/dist/queued-prompt-runtime.js +0 -9
- package/dist/workspaceAgentActivityListViewModel-BzV-cf0D.d.ts +0 -340
- package/dist/workspaceLinkActions-DS9LWqzI.d.ts +0 -74
- /package/dist/{plan-decision-ops.js.map → agent-gui.js.map} +0 -0
- /package/dist/{queued-prompt-runtime.js.map → agents.js.map} +0 -0
- /package/dist/{chunk-5FE7M42A.js.map → chunk-BIHBXWK5.js.map} +0 -0
- /package/dist/{chunk-554VG7ZW.js.map → chunk-NITOD7WF.js.map} +0 -0
|
@@ -1,20 +1,138 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PLAN_IMPLEMENTATION_ACTION_FEEDBACK,
|
|
3
|
-
PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
|
|
4
|
-
PLAN_IMPLEMENTATION_ACTION_SKIP
|
|
5
|
-
} from "./chunk-MKHDRIGN.js";
|
|
6
1
|
import {
|
|
7
2
|
AgentGUIConversation_styles_default,
|
|
8
3
|
MessageSquareMoreIcon,
|
|
9
4
|
extractAgentMcpToolTarget
|
|
10
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-C5FV4UGI.js";
|
|
11
6
|
import {
|
|
12
7
|
getOptionalAgentHostApi,
|
|
13
8
|
useOptionalAgentHostApi
|
|
14
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KAL4XZMA.js";
|
|
15
10
|
import {
|
|
16
11
|
translate
|
|
17
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BIHBXWK5.js";
|
|
13
|
+
|
|
14
|
+
// shared/engine/useEngineSelector.ts
|
|
15
|
+
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/with-selector.js";
|
|
16
|
+
function useEngineSelector(engine, selector, isEqual) {
|
|
17
|
+
return useSyncExternalStoreWithSelector(
|
|
18
|
+
engine.subscribe,
|
|
19
|
+
engine.getSnapshot,
|
|
20
|
+
engine.getSnapshot,
|
|
21
|
+
selector,
|
|
22
|
+
isEqual
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// shared/agentConversation/planImplementationPresentation.ts
|
|
27
|
+
var PLAN_IMPLEMENTATION_PROMPT = "Implement the plan.";
|
|
28
|
+
var PLAN_IMPLEMENTATION_ACTION_IMPLEMENT = "implement";
|
|
29
|
+
var PLAN_IMPLEMENTATION_ACTION_FEEDBACK = "feedback";
|
|
30
|
+
var PLAN_IMPLEMENTATION_ACTION_SKIP = "skip";
|
|
31
|
+
function planImplementationPromptFromPlanTurn(planTurnId, title) {
|
|
32
|
+
return {
|
|
33
|
+
kind: "plan-implementation",
|
|
34
|
+
requestId: planTurnId,
|
|
35
|
+
title
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function itemTime(item) {
|
|
39
|
+
return item.occurredAtUnixMs ?? item.createdAtUnixMs ?? item.seq ?? 0;
|
|
40
|
+
}
|
|
41
|
+
function isPlanItem(item) {
|
|
42
|
+
return item.payload?.messageKind === "plan";
|
|
43
|
+
}
|
|
44
|
+
function latestPlanTurnId(timelineItems) {
|
|
45
|
+
let latestTurnId = null;
|
|
46
|
+
let latestTime = Number.NEGATIVE_INFINITY;
|
|
47
|
+
for (const item of timelineItems) {
|
|
48
|
+
const turnId = item.turnId?.trim();
|
|
49
|
+
if (!turnId) continue;
|
|
50
|
+
const time = itemTime(item);
|
|
51
|
+
if (time >= latestTime) {
|
|
52
|
+
latestTime = time;
|
|
53
|
+
latestTurnId = turnId;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (!latestTurnId) return null;
|
|
57
|
+
return timelineItems.some(
|
|
58
|
+
(item) => item.turnId?.trim() === latestTurnId && isPlanItem(item)
|
|
59
|
+
) ? latestTurnId : null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// shared/agentConversation/agentPlanPromptDispatch.ts
|
|
63
|
+
import {
|
|
64
|
+
selectPlanDecisionForTurn,
|
|
65
|
+
selectWorkspaceAgentConsumerSession
|
|
66
|
+
} from "@tutti-os/agent-activity-core";
|
|
67
|
+
function selectAgentPlanPromptTurn(state, agentSessionId, requestId) {
|
|
68
|
+
const latestTurn = selectWorkspaceAgentConsumerSession(
|
|
69
|
+
state,
|
|
70
|
+
agentSessionId
|
|
71
|
+
)?.latestTurn;
|
|
72
|
+
return latestTurn?.turnId === requestId && latestTurn.phase === "settled" && latestTurn.outcome === "completed" ? latestTurn : null;
|
|
73
|
+
}
|
|
74
|
+
function dispatchAgentPlanPromptAction(input) {
|
|
75
|
+
const turn = selectAgentPlanPromptTurn(
|
|
76
|
+
input.engine.getSnapshot(),
|
|
77
|
+
input.agentSessionId,
|
|
78
|
+
input.requestId
|
|
79
|
+
);
|
|
80
|
+
if (!turn) return false;
|
|
81
|
+
const scopeKey = [
|
|
82
|
+
"plan-implementation",
|
|
83
|
+
input.workspaceId,
|
|
84
|
+
input.agentSessionId,
|
|
85
|
+
turn.turnId
|
|
86
|
+
].join(":");
|
|
87
|
+
if (input.action === PLAN_IMPLEMENTATION_ACTION_IMPLEMENT) {
|
|
88
|
+
const existing = selectPlanDecisionForTurn(
|
|
89
|
+
input.engine.getSnapshot(),
|
|
90
|
+
input.agentSessionId,
|
|
91
|
+
turn.turnId
|
|
92
|
+
);
|
|
93
|
+
input.engine.dispatch({
|
|
94
|
+
type: "plan/decisionRequested",
|
|
95
|
+
action: "implement",
|
|
96
|
+
agentSessionId: input.agentSessionId,
|
|
97
|
+
commandId: `plan-decision:${scopeKey}`,
|
|
98
|
+
idempotencyKey: scopeKey,
|
|
99
|
+
promptKind: "plan-implementation",
|
|
100
|
+
requestId: input.requestId,
|
|
101
|
+
turnId: turn.turnId,
|
|
102
|
+
workspaceId: input.workspaceId,
|
|
103
|
+
...existing?.status === "failed" || existing?.status === "unknown" ? { retry: true } : {},
|
|
104
|
+
timeoutMs: 3e4
|
|
105
|
+
});
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
if (input.action === PLAN_IMPLEMENTATION_ACTION_SKIP) {
|
|
109
|
+
input.engine.dispatch({
|
|
110
|
+
type: "plan/skipped",
|
|
111
|
+
agentSessionId: input.agentSessionId,
|
|
112
|
+
requestId: input.requestId,
|
|
113
|
+
turnId: turn.turnId,
|
|
114
|
+
workspaceId: input.workspaceId
|
|
115
|
+
});
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
const text = input.feedbackText?.trim() ?? "";
|
|
119
|
+
if (!text) return false;
|
|
120
|
+
const requestedAtUnixMs = (input.nowUnixMs ?? Date.now)();
|
|
121
|
+
input.engine.dispatch({
|
|
122
|
+
type: "plan/feedbackRequested",
|
|
123
|
+
agentSessionId: input.agentSessionId,
|
|
124
|
+
clientSubmitId: `${scopeKey}:feedback:${requestedAtUnixMs}`,
|
|
125
|
+
content: [{ type: "text", text }],
|
|
126
|
+
displayPrompt: text,
|
|
127
|
+
expiresAtUnixMs: requestedAtUnixMs + 12e4,
|
|
128
|
+
requestedAtUnixMs,
|
|
129
|
+
requestId: input.requestId,
|
|
130
|
+
runtimeContent: [{ type: "text", text }],
|
|
131
|
+
turnId: turn.turnId,
|
|
132
|
+
workspaceId: input.workspaceId
|
|
133
|
+
});
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
18
136
|
|
|
19
137
|
// shared/agentConversation/approvalOptionPresentation.ts
|
|
20
138
|
function approvalOptionDisplayLabel(option, intent = {}) {
|
|
@@ -261,22 +379,8 @@ function numericValue(value) {
|
|
|
261
379
|
}
|
|
262
380
|
|
|
263
381
|
// shared/agentConversation/components/AgentInteractivePromptSurface.tsx
|
|
264
|
-
import {
|
|
265
|
-
|
|
266
|
-
useEffect,
|
|
267
|
-
useMemo,
|
|
268
|
-
useRef,
|
|
269
|
-
useState
|
|
270
|
-
} from "react";
|
|
271
|
-
import {
|
|
272
|
-
Button,
|
|
273
|
-
ShortcutBadge,
|
|
274
|
-
Spinner,
|
|
275
|
-
Tooltip,
|
|
276
|
-
TooltipContent,
|
|
277
|
-
TooltipProvider,
|
|
278
|
-
TooltipTrigger
|
|
279
|
-
} from "@tutti-os/ui-system";
|
|
382
|
+
import { useMemo as useMemo2, useState as useState2 } from "react";
|
|
383
|
+
import { Button } from "@tutti-os/ui-system";
|
|
280
384
|
|
|
281
385
|
// shared/agentConversation/interactiveAnswerPayload.ts
|
|
282
386
|
function buildAskUserAnswerPayload(answersByQuestionId) {
|
|
@@ -286,160 +390,226 @@ function buildAskUserAnswerPayload(answersByQuestionId) {
|
|
|
286
390
|
return { answers, answersByQuestionId };
|
|
287
391
|
}
|
|
288
392
|
|
|
289
|
-
// shared/agentConversation/components/
|
|
290
|
-
import {
|
|
393
|
+
// shared/agentConversation/components/AgentInteractiveDecisionPromptSurfaces.tsx
|
|
394
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
395
|
+
import { ShortcutBadge } from "@tutti-os/ui-system";
|
|
396
|
+
|
|
397
|
+
// shared/agentConversation/components/interactivePromptPresentation.tsx
|
|
398
|
+
import {
|
|
399
|
+
Spinner,
|
|
400
|
+
Tooltip,
|
|
401
|
+
TooltipContent,
|
|
402
|
+
TooltipProvider,
|
|
403
|
+
TooltipTrigger
|
|
404
|
+
} from "@tutti-os/ui-system";
|
|
405
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
291
406
|
var COMMAND_TOOLTIP_DELAY_MS = 1e3;
|
|
292
|
-
function
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
previewMode = false,
|
|
299
|
-
isSubmitting,
|
|
300
|
-
onSubmit,
|
|
301
|
-
labels
|
|
302
|
-
}) {
|
|
303
|
-
"use memo";
|
|
304
|
-
if (prompt.kind === "approval") {
|
|
305
|
-
return /* @__PURE__ */ jsx(
|
|
306
|
-
ApprovalPromptSurface,
|
|
307
|
-
{
|
|
308
|
-
prompt,
|
|
309
|
-
embedded,
|
|
310
|
-
edgeGlow,
|
|
311
|
-
keyboardShortcuts,
|
|
312
|
-
previewMode,
|
|
313
|
-
isSubmitting,
|
|
314
|
-
onSubmit,
|
|
315
|
-
labels
|
|
316
|
-
}
|
|
317
|
-
);
|
|
407
|
+
function isEnterLikeKey(event) {
|
|
408
|
+
return event.key === "Enter" || event.code === "Enter" || event.code === "NumpadEnter";
|
|
409
|
+
}
|
|
410
|
+
function isEditableKeyboardTarget(target) {
|
|
411
|
+
if (!(target instanceof HTMLElement)) {
|
|
412
|
+
return false;
|
|
318
413
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
embedded,
|
|
326
|
-
edgeGlow,
|
|
327
|
-
previewMode,
|
|
328
|
-
isSubmitting,
|
|
329
|
-
onSubmit,
|
|
330
|
-
labels
|
|
331
|
-
}
|
|
332
|
-
);
|
|
414
|
+
const tagName = target.tagName.toLowerCase();
|
|
415
|
+
return tagName === "input" || tagName === "textarea" || tagName === "select" || target.isContentEditable;
|
|
416
|
+
}
|
|
417
|
+
function approvalOptionShortcutLabel(optionIndex, isDarwin) {
|
|
418
|
+
if (optionIndex === 0) {
|
|
419
|
+
return translate("agentHost.agentGui.shortcutEnter");
|
|
333
420
|
}
|
|
334
|
-
if (
|
|
335
|
-
return
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
previewMode,
|
|
343
|
-
isSubmitting,
|
|
344
|
-
onSubmit,
|
|
345
|
-
labels
|
|
346
|
-
}
|
|
347
|
-
);
|
|
421
|
+
if (optionIndex === 1) {
|
|
422
|
+
return isDarwin ? translate("agentHost.agentGui.shortcutCmdEnter") : translate("agentHost.agentGui.shortcutCtrEnter");
|
|
423
|
+
}
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
function isDarwinPlatform(platform) {
|
|
427
|
+
if (platform) {
|
|
428
|
+
return platform === "darwin";
|
|
348
429
|
}
|
|
430
|
+
if (typeof navigator === "undefined") {
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
const userAgentPlatform = "userAgentData" in navigator ? navigator.userAgentData?.platform : void 0;
|
|
434
|
+
const navigatorPlatform = userAgentPlatform ?? navigator.platform ?? "";
|
|
435
|
+
return /mac/i.test(navigatorPlatform);
|
|
436
|
+
}
|
|
437
|
+
function InteractiveOptionSpinner() {
|
|
438
|
+
"use memo";
|
|
349
439
|
return /* @__PURE__ */ jsx(
|
|
350
|
-
|
|
440
|
+
Spinner,
|
|
351
441
|
{
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
embedded,
|
|
355
|
-
edgeGlow,
|
|
356
|
-
previewMode,
|
|
357
|
-
isSubmitting,
|
|
358
|
-
onSubmit,
|
|
359
|
-
labels
|
|
442
|
+
className: AgentGUIConversation_styles_default.interactiveOptionSpinner,
|
|
443
|
+
testId: "agent-interactive-option-spinner"
|
|
360
444
|
}
|
|
361
445
|
);
|
|
362
446
|
}
|
|
363
|
-
function
|
|
364
|
-
prompt,
|
|
365
|
-
embedded = false,
|
|
366
|
-
edgeGlow = false,
|
|
367
|
-
isSubmitting,
|
|
368
|
-
onSubmit
|
|
369
|
-
}) {
|
|
447
|
+
function SendFilledIcon() {
|
|
370
448
|
"use memo";
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
"
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
"aria-label": interactiveOptionLabel(
|
|
382
|
-
option.label,
|
|
383
|
-
option.description
|
|
384
|
-
),
|
|
385
|
-
disabled: isSubmitting,
|
|
386
|
-
onClick: () => onSubmit({
|
|
387
|
-
requestId: prompt.requestId,
|
|
388
|
-
action: "submit",
|
|
389
|
-
payload: {
|
|
390
|
-
...buildAskUserAnswerPayload({
|
|
391
|
-
[question.id]: option.label
|
|
392
|
-
})
|
|
393
|
-
}
|
|
394
|
-
}),
|
|
395
|
-
children: [
|
|
396
|
-
/* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
|
|
397
|
-
option.description ? /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null
|
|
398
|
-
]
|
|
399
|
-
},
|
|
400
|
-
option.label
|
|
401
|
-
)) }) : question.options.length > 0 ? (
|
|
402
|
-
// Multi-select / multi-question prompts can't be answered with a
|
|
403
|
-
// single click here, so the options are shown as read-only
|
|
404
|
-
// context instead of being silently omitted. Answering still
|
|
405
|
-
// happens in the full conversation via the card's "open
|
|
406
|
-
// conversation" jump.
|
|
407
|
-
/* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => /* @__PURE__ */ jsxs(
|
|
408
|
-
"div",
|
|
449
|
+
return /* @__PURE__ */ jsx(
|
|
450
|
+
"svg",
|
|
451
|
+
{
|
|
452
|
+
width: "24",
|
|
453
|
+
height: "24",
|
|
454
|
+
viewBox: "0 0 24 24",
|
|
455
|
+
fill: "none",
|
|
456
|
+
"aria-hidden": "true",
|
|
457
|
+
children: /* @__PURE__ */ jsx(
|
|
458
|
+
"path",
|
|
409
459
|
{
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
option.label
|
|
417
|
-
)) })
|
|
418
|
-
) : null
|
|
419
|
-
] }) : null }) });
|
|
460
|
+
d: "M2.74311 8.80587C2.84592 8.40096 3.14571 8.08844 3.54551 7.97033L18.5197 3.51569C18.9336 3.39383 19.3809 3.5054 19.6881 3.81262C19.9951 4.11984 20.1076 4.56798 19.9857 4.9817L15.5311 19.9559C15.413 20.3557 15.1005 20.6555 14.6956 20.7583C14.2895 20.8597 13.869 20.7438 13.5721 20.4469L10.455 15.1823C10.8585 14.6483 12.1563 12.9094 14.3475 9.96528C14.6086 9.70419 14.6382 9.31168 14.4138 9.08692C14.1891 8.86221 13.796 8.8913 13.5348 9.15252L8.31088 13.0423L3.05316 9.92799C2.7562 9.63104 2.64049 9.21071 2.74311 8.80587Z",
|
|
461
|
+
fill: "currentColor"
|
|
462
|
+
}
|
|
463
|
+
)
|
|
464
|
+
}
|
|
465
|
+
);
|
|
420
466
|
}
|
|
421
|
-
function
|
|
422
|
-
prompt
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
467
|
+
function interactivePromptClassName(embedded) {
|
|
468
|
+
return embedded ? `${AgentGUIConversation_styles_default.interactivePrompt} agent-gui-conversation__interactive-prompt--embedded` : AgentGUIConversation_styles_default.interactivePrompt;
|
|
469
|
+
}
|
|
470
|
+
function interactivePromptCardClassName(edgeGlow) {
|
|
471
|
+
return edgeGlow ? `${AgentGUIConversation_styles_default.interactivePromptCard} agent-gui-edge-glow` : AgentGUIConversation_styles_default.interactivePromptCard;
|
|
472
|
+
}
|
|
473
|
+
function formatToolDetails(input) {
|
|
474
|
+
return getPromptToolDetails(input).map((detail) => ({
|
|
475
|
+
kind: detail.kind,
|
|
476
|
+
label: promptToolDetailLabel(detail.kind),
|
|
477
|
+
value: detail.value,
|
|
478
|
+
...detail.meta ? { meta: detail.meta } : {}
|
|
479
|
+
}));
|
|
480
|
+
}
|
|
481
|
+
function PromptDetailValue({
|
|
482
|
+
detail,
|
|
483
|
+
previewMode
|
|
430
484
|
}) {
|
|
431
485
|
"use memo";
|
|
432
|
-
|
|
433
|
-
(
|
|
434
|
-
|
|
486
|
+
if (detail.kind !== "command") {
|
|
487
|
+
return /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: detail.value });
|
|
488
|
+
}
|
|
489
|
+
return /* @__PURE__ */ jsx(
|
|
490
|
+
CommandTextWithTooltip,
|
|
491
|
+
{
|
|
492
|
+
value: detail.value,
|
|
493
|
+
testId: "agent-interactive-command-detail",
|
|
494
|
+
tooltipsEnabled: !previewMode
|
|
495
|
+
}
|
|
435
496
|
);
|
|
436
|
-
|
|
437
|
-
|
|
497
|
+
}
|
|
498
|
+
function CommandTextWithTooltip({
|
|
499
|
+
value,
|
|
500
|
+
testId,
|
|
501
|
+
tooltipsEnabled = true
|
|
502
|
+
}) {
|
|
503
|
+
"use memo";
|
|
504
|
+
const content = /* @__PURE__ */ jsx(
|
|
505
|
+
"span",
|
|
506
|
+
{
|
|
507
|
+
className: `${AgentGUIConversation_styles_default.interactiveOptionDescription} ${AgentGUIConversation_styles_default.interactiveOptionCommandDescription}`,
|
|
508
|
+
"data-agent-interactive-command-detail": testId === "agent-interactive-command-detail" ? "true" : void 0,
|
|
509
|
+
"data-agent-interactive-command-prefix-option": testId === "agent-interactive-command-prefix-option" ? "true" : void 0,
|
|
510
|
+
children: value
|
|
511
|
+
}
|
|
438
512
|
);
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
513
|
+
if (!tooltipsEnabled) {
|
|
514
|
+
return content;
|
|
515
|
+
}
|
|
516
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: COMMAND_TOOLTIP_DELAY_MS, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
517
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: content }),
|
|
518
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: AgentGUIConversation_styles_default.interactiveOptionCommandTooltip, children: value })
|
|
519
|
+
] }) });
|
|
520
|
+
}
|
|
521
|
+
function promptToolDetailLabel(kind) {
|
|
522
|
+
switch (kind) {
|
|
523
|
+
case "command":
|
|
524
|
+
return translate("agentHost.agentTool.details.command");
|
|
525
|
+
case "mcp":
|
|
526
|
+
return translate("agentHost.agentTool.details.mcp");
|
|
527
|
+
case "path":
|
|
528
|
+
return translate("agentHost.agentTool.details.path");
|
|
529
|
+
case "query":
|
|
530
|
+
return translate("agentHost.agentTool.details.query");
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
function isApprovalFeedbackOption(option) {
|
|
534
|
+
return isDenyApprovalOptionToken(option.id) || isDenyApprovalOptionToken(option.kind);
|
|
535
|
+
}
|
|
536
|
+
function approvalFeedbackOptionId(options) {
|
|
537
|
+
const explicitFeedbackOption = options.find(
|
|
538
|
+
(option) => isExplicitFeedbackDenyApprovalOption(option)
|
|
539
|
+
);
|
|
540
|
+
if (explicitFeedbackOption) {
|
|
541
|
+
return explicitFeedbackOption.id;
|
|
542
|
+
}
|
|
543
|
+
return options.find(isApprovalFeedbackOption)?.id ?? null;
|
|
544
|
+
}
|
|
545
|
+
function isExplicitFeedbackDenyApprovalOption(option) {
|
|
546
|
+
for (const value of [option.id, option.kind]) {
|
|
547
|
+
switch (normalizeApprovalOptionToken(value ?? "")) {
|
|
548
|
+
case "abort":
|
|
549
|
+
case "cancel":
|
|
550
|
+
case "cancelled":
|
|
551
|
+
case "canceled":
|
|
552
|
+
case "denywithfeedback":
|
|
553
|
+
case "rejectwithfeedback":
|
|
554
|
+
return true;
|
|
555
|
+
default:
|
|
556
|
+
break;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
function isDenyApprovalOptionToken(value) {
|
|
562
|
+
switch (normalizeApprovalOptionToken(value ?? "")) {
|
|
563
|
+
case "abort":
|
|
564
|
+
case "cancel":
|
|
565
|
+
case "cancelled":
|
|
566
|
+
case "canceled":
|
|
567
|
+
case "deny":
|
|
568
|
+
case "denied":
|
|
569
|
+
case "reject":
|
|
570
|
+
case "rejected":
|
|
571
|
+
case "rejectonce":
|
|
572
|
+
case "disallow":
|
|
573
|
+
case "decline":
|
|
574
|
+
case "declined":
|
|
575
|
+
case "no":
|
|
576
|
+
return true;
|
|
577
|
+
default:
|
|
578
|
+
return false;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
function stripPromptTitlePunctuation(value) {
|
|
582
|
+
return value.trim().replace(/[.。]+$/u, "");
|
|
583
|
+
}
|
|
584
|
+
function interactiveOptionLabel(label, description) {
|
|
585
|
+
const trimmedDescription = description?.trim();
|
|
586
|
+
return trimmedDescription ? `${label} ${trimmedDescription}` : label;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// shared/agentConversation/components/AgentInteractiveDecisionPromptSurfaces.tsx
|
|
590
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
591
|
+
function ApprovalPromptSurface({
|
|
592
|
+
prompt,
|
|
593
|
+
embedded = false,
|
|
594
|
+
edgeGlow = false,
|
|
595
|
+
keyboardShortcuts = true,
|
|
596
|
+
previewMode = false,
|
|
597
|
+
isSubmitting,
|
|
598
|
+
onSubmit,
|
|
599
|
+
labels
|
|
600
|
+
}) {
|
|
601
|
+
"use memo";
|
|
602
|
+
const promptDetails = useMemo(
|
|
603
|
+
() => formatToolDetails(prompt.input ?? null),
|
|
604
|
+
[prompt.input]
|
|
605
|
+
);
|
|
606
|
+
const [submittingOptionId, setSubmittingOptionId] = useState(
|
|
607
|
+
null
|
|
608
|
+
);
|
|
609
|
+
const [pendingFeedbackOptionId, setPendingFeedbackOptionId] = useState(null);
|
|
610
|
+
const [feedback, setFeedback] = useState("");
|
|
611
|
+
const feedbackTextareaRef = useRef(null);
|
|
612
|
+
const agentHostApi = useOptionalAgentHostApi() ?? getOptionalAgentHostApi();
|
|
443
613
|
const isDarwin = isDarwinPlatform(agentHostApi?.meta?.platform);
|
|
444
614
|
const feedbackOptionId = useMemo(
|
|
445
615
|
() => approvalFeedbackOptionId(prompt.options),
|
|
@@ -506,21 +676,21 @@ function ApprovalPromptSurface({
|
|
|
506
676
|
submitOption,
|
|
507
677
|
submittingOptionId
|
|
508
678
|
]);
|
|
509
|
-
return /* @__PURE__ */
|
|
510
|
-
/* @__PURE__ */
|
|
511
|
-
promptDetails.length > 0 ? /* @__PURE__ */
|
|
679
|
+
return /* @__PURE__ */ jsx2("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs2("div", { className: interactivePromptCardClassName(edgeGlow), children: [
|
|
680
|
+
/* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.approvalLead) }),
|
|
681
|
+
promptDetails.length > 0 ? /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: promptDetails.map((detail) => /* @__PURE__ */ jsxs2(
|
|
512
682
|
"div",
|
|
513
683
|
{
|
|
514
684
|
className: AgentGUIConversation_styles_default.interactiveOptionDisplay,
|
|
515
685
|
children: [
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
-
/* @__PURE__ */
|
|
518
|
-
detail.meta ? /* @__PURE__ */
|
|
686
|
+
/* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: detail.label }),
|
|
687
|
+
/* @__PURE__ */ jsx2(PromptDetailValue, { detail, previewMode }),
|
|
688
|
+
detail.meta ? /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: detail.meta }) : null
|
|
519
689
|
]
|
|
520
690
|
},
|
|
521
691
|
`${detail.label}:${detail.value}`
|
|
522
692
|
)) }) : null,
|
|
523
|
-
/* @__PURE__ */
|
|
693
|
+
/* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: prompt.options.map((option, optionIndex) => {
|
|
524
694
|
const showSpinner = submittingOptionId === option.id;
|
|
525
695
|
const optionSupportsFeedback = feedbackOptionId === option.id;
|
|
526
696
|
const optionLabel = approvalOptionDisplayLabel(option, {
|
|
@@ -536,12 +706,12 @@ function ApprovalPromptSurface({
|
|
|
536
706
|
);
|
|
537
707
|
const showFeedbackComposer = pendingFeedbackOptionId === option.id;
|
|
538
708
|
if (showFeedbackComposer) {
|
|
539
|
-
return /* @__PURE__ */
|
|
709
|
+
return /* @__PURE__ */ jsxs2(
|
|
540
710
|
"div",
|
|
541
711
|
{
|
|
542
712
|
className: AgentGUIConversation_styles_default.interactiveFeedbackComposer,
|
|
543
713
|
children: [
|
|
544
|
-
/* @__PURE__ */
|
|
714
|
+
/* @__PURE__ */ jsx2(
|
|
545
715
|
"textarea",
|
|
546
716
|
{
|
|
547
717
|
ref: feedbackTextareaRef,
|
|
@@ -567,7 +737,7 @@ function ApprovalPromptSurface({
|
|
|
567
737
|
}
|
|
568
738
|
}
|
|
569
739
|
),
|
|
570
|
-
/* @__PURE__ */
|
|
740
|
+
/* @__PURE__ */ jsx2(
|
|
571
741
|
"button",
|
|
572
742
|
{
|
|
573
743
|
type: "button",
|
|
@@ -583,7 +753,7 @@ function ApprovalPromptSurface({
|
|
|
583
753
|
}
|
|
584
754
|
submitOption(option.id);
|
|
585
755
|
},
|
|
586
|
-
children: showSpinner ? /* @__PURE__ */
|
|
756
|
+
children: showSpinner ? /* @__PURE__ */ jsx2(InteractiveOptionSpinner, {}) : /* @__PURE__ */ jsx2(SendFilledIcon, {})
|
|
587
757
|
}
|
|
588
758
|
)
|
|
589
759
|
]
|
|
@@ -591,7 +761,7 @@ function ApprovalPromptSurface({
|
|
|
591
761
|
option.id
|
|
592
762
|
);
|
|
593
763
|
}
|
|
594
|
-
return /* @__PURE__ */
|
|
764
|
+
return /* @__PURE__ */ jsxs2(
|
|
595
765
|
"button",
|
|
596
766
|
{
|
|
597
767
|
type: "button",
|
|
@@ -603,8 +773,8 @@ function ApprovalPromptSurface({
|
|
|
603
773
|
disabled: isSubmitting || submittingOptionId !== null,
|
|
604
774
|
onClick: () => submitOption(option.id),
|
|
605
775
|
children: [
|
|
606
|
-
/* @__PURE__ */
|
|
607
|
-
optionPresentation.commandPrefix ? /* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: optionPresentation.label }),
|
|
777
|
+
optionPresentation.commandPrefix ? /* @__PURE__ */ jsx2(
|
|
608
778
|
CommandTextWithTooltip,
|
|
609
779
|
{
|
|
610
780
|
value: optionPresentation.commandPrefix,
|
|
@@ -612,8 +782,8 @@ function ApprovalPromptSurface({
|
|
|
612
782
|
tooltipsEnabled: !previewMode
|
|
613
783
|
}
|
|
614
784
|
) : null,
|
|
615
|
-
option.description ? /* @__PURE__ */
|
|
616
|
-
keyboardShortcuts && shortcutLabel && !showSpinner ? /* @__PURE__ */
|
|
785
|
+
option.description ? /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null,
|
|
786
|
+
keyboardShortcuts && shortcutLabel && !showSpinner ? /* @__PURE__ */ jsx2(
|
|
617
787
|
ShortcutBadge,
|
|
618
788
|
{
|
|
619
789
|
className: AgentGUIConversation_styles_default.interactiveOptionShortcut,
|
|
@@ -621,7 +791,7 @@ function ApprovalPromptSurface({
|
|
|
621
791
|
children: shortcutLabel
|
|
622
792
|
}
|
|
623
793
|
) : null,
|
|
624
|
-
showSpinner ? /* @__PURE__ */
|
|
794
|
+
showSpinner ? /* @__PURE__ */ jsx2(InteractiveOptionSpinner, {}) : null
|
|
625
795
|
]
|
|
626
796
|
},
|
|
627
797
|
option.id
|
|
@@ -657,11 +827,11 @@ function ExitPlanPromptSurface({
|
|
|
657
827
|
useEffect(() => {
|
|
658
828
|
setSubmittingOptionId(null);
|
|
659
829
|
}, [prompt.requestId]);
|
|
660
|
-
return /* @__PURE__ */
|
|
661
|
-
/* @__PURE__ */
|
|
662
|
-
/* @__PURE__ */
|
|
830
|
+
return /* @__PURE__ */ jsx2("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs2("div", { className: interactivePromptCardClassName(edgeGlow), children: [
|
|
831
|
+
/* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.planLead) }),
|
|
832
|
+
/* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: modes.map((mode) => {
|
|
663
833
|
const showSpinner = submittingOptionId === mode.id;
|
|
664
|
-
return /* @__PURE__ */
|
|
834
|
+
return /* @__PURE__ */ jsxs2(
|
|
665
835
|
"button",
|
|
666
836
|
{
|
|
667
837
|
type: "button",
|
|
@@ -680,16 +850,16 @@ function ExitPlanPromptSurface({
|
|
|
680
850
|
});
|
|
681
851
|
},
|
|
682
852
|
children: [
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
showSpinner ? /* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: mode.label }),
|
|
854
|
+
/* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: mode.description }),
|
|
855
|
+
showSpinner ? /* @__PURE__ */ jsx2(InteractiveOptionSpinner, {}) : null
|
|
686
856
|
]
|
|
687
857
|
},
|
|
688
858
|
mode.id
|
|
689
859
|
);
|
|
690
860
|
}) }),
|
|
691
|
-
showFeedbackFooter ? /* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
861
|
+
showFeedbackFooter ? /* @__PURE__ */ jsxs2("div", { className: AgentGUIConversation_styles_default.interactivePromptFooter, children: [
|
|
862
|
+
/* @__PURE__ */ jsx2(
|
|
693
863
|
"textarea",
|
|
694
864
|
{
|
|
695
865
|
value: feedback,
|
|
@@ -699,7 +869,7 @@ function ExitPlanPromptSurface({
|
|
|
699
869
|
onChange: (event) => setFeedback(event.currentTarget.value)
|
|
700
870
|
}
|
|
701
871
|
),
|
|
702
|
-
/* @__PURE__ */
|
|
872
|
+
/* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx2(
|
|
703
873
|
"button",
|
|
704
874
|
{
|
|
705
875
|
type: "button",
|
|
@@ -721,7 +891,7 @@ function ExitPlanPromptSurface({
|
|
|
721
891
|
// Compact (deck): no textarea, but keep declining reachable — the deck
|
|
722
892
|
// must still let the user keep planning (refining/feedback is deferred
|
|
723
893
|
// to the conversation via the card's "open conversation" jump).
|
|
724
|
-
/* @__PURE__ */
|
|
894
|
+
/* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx2(
|
|
725
895
|
"button",
|
|
726
896
|
{
|
|
727
897
|
type: "button",
|
|
@@ -751,9 +921,9 @@ function PlanImplementationSurface({
|
|
|
751
921
|
const trimmed = feedback.trim();
|
|
752
922
|
const continueLabel = trimmed === "" ? labels.planImplementationSkip : labels.planImplementationSend;
|
|
753
923
|
const showFeedbackFooter = variant !== "compact";
|
|
754
|
-
return /* @__PURE__ */
|
|
755
|
-
/* @__PURE__ */
|
|
756
|
-
/* @__PURE__ */
|
|
924
|
+
return /* @__PURE__ */ jsx2("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs2("div", { className: interactivePromptCardClassName(edgeGlow), children: [
|
|
925
|
+
/* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.planImplementationLead) }),
|
|
926
|
+
/* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: /* @__PURE__ */ jsx2(
|
|
757
927
|
"button",
|
|
758
928
|
{
|
|
759
929
|
type: "button",
|
|
@@ -764,11 +934,11 @@ function PlanImplementationSurface({
|
|
|
764
934
|
requestId: prompt.requestId,
|
|
765
935
|
action: PLAN_IMPLEMENTATION_ACTION_IMPLEMENT
|
|
766
936
|
}),
|
|
767
|
-
children: /* @__PURE__ */
|
|
937
|
+
children: /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: labels.planImplementationConfirm })
|
|
768
938
|
}
|
|
769
939
|
) }),
|
|
770
|
-
showFeedbackFooter ? /* @__PURE__ */
|
|
771
|
-
/* @__PURE__ */
|
|
940
|
+
showFeedbackFooter ? /* @__PURE__ */ jsxs2("div", { className: AgentGUIConversation_styles_default.interactivePromptFooter, children: [
|
|
941
|
+
/* @__PURE__ */ jsx2(
|
|
772
942
|
"textarea",
|
|
773
943
|
{
|
|
774
944
|
value: feedback,
|
|
@@ -779,7 +949,7 @@ function PlanImplementationSurface({
|
|
|
779
949
|
onChange: (event) => setFeedback(event.currentTarget.value)
|
|
780
950
|
}
|
|
781
951
|
),
|
|
782
|
-
/* @__PURE__ */
|
|
952
|
+
/* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx2(
|
|
783
953
|
"button",
|
|
784
954
|
{
|
|
785
955
|
type: "button",
|
|
@@ -796,6 +966,138 @@ function PlanImplementationSurface({
|
|
|
796
966
|
] }) : null
|
|
797
967
|
] }) });
|
|
798
968
|
}
|
|
969
|
+
|
|
970
|
+
// shared/agentConversation/components/AgentInteractivePromptSurface.tsx
|
|
971
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
972
|
+
function AgentInteractivePromptSurface({
|
|
973
|
+
prompt,
|
|
974
|
+
variant = "full",
|
|
975
|
+
edgeGlow = false,
|
|
976
|
+
embedded = false,
|
|
977
|
+
keyboardShortcuts = true,
|
|
978
|
+
previewMode = false,
|
|
979
|
+
isSubmitting,
|
|
980
|
+
onSubmit,
|
|
981
|
+
labels
|
|
982
|
+
}) {
|
|
983
|
+
"use memo";
|
|
984
|
+
if (prompt.kind === "approval") {
|
|
985
|
+
return /* @__PURE__ */ jsx3(
|
|
986
|
+
ApprovalPromptSurface,
|
|
987
|
+
{
|
|
988
|
+
prompt,
|
|
989
|
+
embedded,
|
|
990
|
+
edgeGlow,
|
|
991
|
+
keyboardShortcuts,
|
|
992
|
+
previewMode,
|
|
993
|
+
isSubmitting,
|
|
994
|
+
onSubmit,
|
|
995
|
+
labels
|
|
996
|
+
}
|
|
997
|
+
);
|
|
998
|
+
}
|
|
999
|
+
if (prompt.kind === "exit-plan") {
|
|
1000
|
+
return /* @__PURE__ */ jsx3(
|
|
1001
|
+
ExitPlanPromptSurface,
|
|
1002
|
+
{
|
|
1003
|
+
prompt,
|
|
1004
|
+
variant,
|
|
1005
|
+
embedded,
|
|
1006
|
+
edgeGlow,
|
|
1007
|
+
previewMode,
|
|
1008
|
+
isSubmitting,
|
|
1009
|
+
onSubmit,
|
|
1010
|
+
labels
|
|
1011
|
+
}
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
if (prompt.kind === "plan-implementation") {
|
|
1015
|
+
return /* @__PURE__ */ jsx3(
|
|
1016
|
+
PlanImplementationSurface,
|
|
1017
|
+
{
|
|
1018
|
+
prompt,
|
|
1019
|
+
variant,
|
|
1020
|
+
embedded,
|
|
1021
|
+
edgeGlow,
|
|
1022
|
+
previewMode,
|
|
1023
|
+
isSubmitting,
|
|
1024
|
+
onSubmit,
|
|
1025
|
+
labels
|
|
1026
|
+
}
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
return /* @__PURE__ */ jsx3(
|
|
1030
|
+
AskUserPromptSurface,
|
|
1031
|
+
{
|
|
1032
|
+
prompt,
|
|
1033
|
+
variant,
|
|
1034
|
+
embedded,
|
|
1035
|
+
edgeGlow,
|
|
1036
|
+
previewMode,
|
|
1037
|
+
isSubmitting,
|
|
1038
|
+
onSubmit,
|
|
1039
|
+
labels
|
|
1040
|
+
}
|
|
1041
|
+
);
|
|
1042
|
+
}
|
|
1043
|
+
function CompactAskUserPromptSurface({
|
|
1044
|
+
prompt,
|
|
1045
|
+
embedded = false,
|
|
1046
|
+
edgeGlow = false,
|
|
1047
|
+
isSubmitting,
|
|
1048
|
+
onSubmit
|
|
1049
|
+
}) {
|
|
1050
|
+
"use memo";
|
|
1051
|
+
const question = prompt.questions[0] ?? null;
|
|
1052
|
+
const oneClickable = prompt.questions.length === 1 && question !== null && !question.multiSelect && question.options.length > 0;
|
|
1053
|
+
return /* @__PURE__ */ jsx3("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsx3("div", { className: interactivePromptCardClassName(edgeGlow), children: question ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1054
|
+
/* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptHeader, children: /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(question.header) }) }),
|
|
1055
|
+
/* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptQuestion, children: question.question }),
|
|
1056
|
+
oneClickable ? /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => /* @__PURE__ */ jsxs3(
|
|
1057
|
+
"button",
|
|
1058
|
+
{
|
|
1059
|
+
type: "button",
|
|
1060
|
+
className: AgentGUIConversation_styles_default.interactiveOptionButton,
|
|
1061
|
+
"aria-label": interactiveOptionLabel(
|
|
1062
|
+
option.label,
|
|
1063
|
+
option.description
|
|
1064
|
+
),
|
|
1065
|
+
disabled: isSubmitting,
|
|
1066
|
+
onClick: () => onSubmit({
|
|
1067
|
+
requestId: prompt.requestId,
|
|
1068
|
+
action: "submit",
|
|
1069
|
+
payload: {
|
|
1070
|
+
...buildAskUserAnswerPayload({
|
|
1071
|
+
[question.id]: option.label
|
|
1072
|
+
})
|
|
1073
|
+
}
|
|
1074
|
+
}),
|
|
1075
|
+
children: [
|
|
1076
|
+
/* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
|
|
1077
|
+
option.description ? /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null
|
|
1078
|
+
]
|
|
1079
|
+
},
|
|
1080
|
+
option.label
|
|
1081
|
+
)) }) : question.options.length > 0 ? (
|
|
1082
|
+
// Multi-select / multi-question prompts can't be answered with a
|
|
1083
|
+
// single click here, so the options are shown as read-only
|
|
1084
|
+
// context instead of being silently omitted. Answering still
|
|
1085
|
+
// happens in the full conversation via the card's "open
|
|
1086
|
+
// conversation" jump.
|
|
1087
|
+
/* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => /* @__PURE__ */ jsxs3(
|
|
1088
|
+
"div",
|
|
1089
|
+
{
|
|
1090
|
+
className: AgentGUIConversation_styles_default.interactiveOptionDisplay,
|
|
1091
|
+
children: [
|
|
1092
|
+
/* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
|
|
1093
|
+
option.description ? /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null
|
|
1094
|
+
]
|
|
1095
|
+
},
|
|
1096
|
+
option.label
|
|
1097
|
+
)) })
|
|
1098
|
+
) : null
|
|
1099
|
+
] }) : null }) });
|
|
1100
|
+
}
|
|
799
1101
|
function AskUserPromptSurface({
|
|
800
1102
|
prompt,
|
|
801
1103
|
variant = "full",
|
|
@@ -807,7 +1109,7 @@ function AskUserPromptSurface({
|
|
|
807
1109
|
}) {
|
|
808
1110
|
"use memo";
|
|
809
1111
|
if (variant === "compact") {
|
|
810
|
-
return /* @__PURE__ */
|
|
1112
|
+
return /* @__PURE__ */ jsx3(
|
|
811
1113
|
CompactAskUserPromptSurface,
|
|
812
1114
|
{
|
|
813
1115
|
prompt,
|
|
@@ -819,7 +1121,7 @@ function AskUserPromptSurface({
|
|
|
819
1121
|
}
|
|
820
1122
|
);
|
|
821
1123
|
}
|
|
822
|
-
return /* @__PURE__ */
|
|
1124
|
+
return /* @__PURE__ */ jsx3(
|
|
823
1125
|
FullAskUserPromptSurface,
|
|
824
1126
|
{
|
|
825
1127
|
prompt,
|
|
@@ -840,15 +1142,15 @@ function FullAskUserPromptSurface({
|
|
|
840
1142
|
labels
|
|
841
1143
|
}) {
|
|
842
1144
|
"use memo";
|
|
843
|
-
const [index, setIndex] =
|
|
844
|
-
const [selectedByQuestionId, setSelectedByQuestionId] =
|
|
845
|
-
const [freeTextByQuestionId, setFreeTextByQuestionId] =
|
|
1145
|
+
const [index, setIndex] = useState2(0);
|
|
1146
|
+
const [selectedByQuestionId, setSelectedByQuestionId] = useState2({});
|
|
1147
|
+
const [freeTextByQuestionId, setFreeTextByQuestionId] = useState2({});
|
|
846
1148
|
const question = prompt.questions[index] ?? null;
|
|
847
1149
|
const selected = question ? selectedByQuestionId[question.id] ?? [] : [];
|
|
848
1150
|
const freeText = question ? freeTextByQuestionId[question.id] ?? "" : "";
|
|
849
1151
|
const canAdvance = question !== null && (selected.length > 0 || freeText.trim() !== "" || question.options.length === 0);
|
|
850
1152
|
const isLast = index >= prompt.questions.length - 1;
|
|
851
|
-
const payload =
|
|
1153
|
+
const payload = useMemo2(() => {
|
|
852
1154
|
const answersByQuestionId = {};
|
|
853
1155
|
for (const current of prompt.questions) {
|
|
854
1156
|
const chosen = selectedByQuestionId[current.id] ?? [];
|
|
@@ -868,12 +1170,12 @@ function FullAskUserPromptSurface({
|
|
|
868
1170
|
return buildAskUserAnswerPayload(answersByQuestionId);
|
|
869
1171
|
}, [freeTextByQuestionId, prompt.questions, selectedByQuestionId]);
|
|
870
1172
|
if (!question) {
|
|
871
|
-
return /* @__PURE__ */
|
|
1173
|
+
return /* @__PURE__ */ jsx3("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsx3("div", { className: interactivePromptCardClassName(edgeGlow), children: /* @__PURE__ */ jsxs3(
|
|
872
1174
|
"div",
|
|
873
1175
|
{
|
|
874
1176
|
className: `${AgentGUIConversation_styles_default.interactivePromptLead} inline-flex items-center gap-1.5`,
|
|
875
1177
|
children: [
|
|
876
|
-
/* @__PURE__ */
|
|
1178
|
+
/* @__PURE__ */ jsx3(
|
|
877
1179
|
MessageSquareMoreIcon,
|
|
878
1180
|
{
|
|
879
1181
|
size: 15,
|
|
@@ -887,19 +1189,19 @@ function FullAskUserPromptSurface({
|
|
|
887
1189
|
}
|
|
888
1190
|
) }) });
|
|
889
1191
|
}
|
|
890
|
-
return /* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
/* @__PURE__ */
|
|
1192
|
+
return /* @__PURE__ */ jsx3("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs3("div", { className: interactivePromptCardClassName(edgeGlow), children: [
|
|
1193
|
+
/* @__PURE__ */ jsxs3("div", { className: AgentGUIConversation_styles_default.interactivePromptHeader, children: [
|
|
1194
|
+
/* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(question.header) }),
|
|
1195
|
+
/* @__PURE__ */ jsxs3("span", { className: AgentGUIConversation_styles_default.interactivePromptMeta, children: [
|
|
894
1196
|
index + 1,
|
|
895
1197
|
"/",
|
|
896
1198
|
prompt.questions.length
|
|
897
1199
|
] })
|
|
898
1200
|
] }),
|
|
899
|
-
/* @__PURE__ */
|
|
900
|
-
question.options.length > 0 ? /* @__PURE__ */
|
|
1201
|
+
/* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptQuestion, children: question.question }),
|
|
1202
|
+
question.options.length > 0 ? /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => {
|
|
901
1203
|
const active = selected.includes(option.label);
|
|
902
|
-
return /* @__PURE__ */
|
|
1204
|
+
return /* @__PURE__ */ jsxs3(
|
|
903
1205
|
"button",
|
|
904
1206
|
{
|
|
905
1207
|
type: "button",
|
|
@@ -919,14 +1221,14 @@ function FullAskUserPromptSurface({
|
|
|
919
1221
|
});
|
|
920
1222
|
},
|
|
921
1223
|
children: [
|
|
922
|
-
/* @__PURE__ */
|
|
923
|
-
/* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
|
|
1225
|
+
/* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description })
|
|
924
1226
|
]
|
|
925
1227
|
},
|
|
926
1228
|
option.label
|
|
927
1229
|
);
|
|
928
1230
|
}) }) : null,
|
|
929
|
-
/* @__PURE__ */
|
|
1231
|
+
/* @__PURE__ */ jsx3(
|
|
930
1232
|
"textarea",
|
|
931
1233
|
{
|
|
932
1234
|
value: freeText,
|
|
@@ -942,8 +1244,8 @@ function FullAskUserPromptSurface({
|
|
|
942
1244
|
}
|
|
943
1245
|
}
|
|
944
1246
|
),
|
|
945
|
-
/* @__PURE__ */
|
|
946
|
-
prompt.questions.length > 1 ? /* @__PURE__ */
|
|
1247
|
+
/* @__PURE__ */ jsxs3("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: [
|
|
1248
|
+
prompt.questions.length > 1 ? /* @__PURE__ */ jsx3(
|
|
947
1249
|
Button,
|
|
948
1250
|
{
|
|
949
1251
|
type: "button",
|
|
@@ -954,7 +1256,7 @@ function FullAskUserPromptSurface({
|
|
|
954
1256
|
children: labels.previousQuestion
|
|
955
1257
|
}
|
|
956
1258
|
) : null,
|
|
957
|
-
isLast ? /* @__PURE__ */
|
|
1259
|
+
isLast ? /* @__PURE__ */ jsx3(
|
|
958
1260
|
Button,
|
|
959
1261
|
{
|
|
960
1262
|
type: "button",
|
|
@@ -968,7 +1270,7 @@ function FullAskUserPromptSurface({
|
|
|
968
1270
|
}),
|
|
969
1271
|
children: labels.submitAnswers
|
|
970
1272
|
}
|
|
971
|
-
) : /* @__PURE__ */
|
|
1273
|
+
) : /* @__PURE__ */ jsx3(
|
|
972
1274
|
Button,
|
|
973
1275
|
{
|
|
974
1276
|
type: "button",
|
|
@@ -984,192 +1286,20 @@ function FullAskUserPromptSurface({
|
|
|
984
1286
|
] })
|
|
985
1287
|
] }) });
|
|
986
1288
|
}
|
|
987
|
-
function isEnterLikeKey(event) {
|
|
988
|
-
return event.key === "Enter" || event.code === "Enter" || event.code === "NumpadEnter";
|
|
989
|
-
}
|
|
990
|
-
function isEditableKeyboardTarget(target) {
|
|
991
|
-
if (!(target instanceof HTMLElement)) {
|
|
992
|
-
return false;
|
|
993
|
-
}
|
|
994
|
-
const tagName = target.tagName.toLowerCase();
|
|
995
|
-
return tagName === "input" || tagName === "textarea" || tagName === "select" || target.isContentEditable;
|
|
996
|
-
}
|
|
997
|
-
function approvalOptionShortcutLabel(optionIndex, isDarwin) {
|
|
998
|
-
if (optionIndex === 0) {
|
|
999
|
-
return translate("agentHost.agentGui.shortcutEnter");
|
|
1000
|
-
}
|
|
1001
|
-
if (optionIndex === 1) {
|
|
1002
|
-
return isDarwin ? translate("agentHost.agentGui.shortcutCmdEnter") : translate("agentHost.agentGui.shortcutCtrEnter");
|
|
1003
|
-
}
|
|
1004
|
-
return null;
|
|
1005
|
-
}
|
|
1006
|
-
function isDarwinPlatform(platform) {
|
|
1007
|
-
if (platform) {
|
|
1008
|
-
return platform === "darwin";
|
|
1009
|
-
}
|
|
1010
|
-
if (typeof navigator === "undefined") {
|
|
1011
|
-
return false;
|
|
1012
|
-
}
|
|
1013
|
-
const userAgentPlatform = "userAgentData" in navigator ? navigator.userAgentData?.platform : void 0;
|
|
1014
|
-
const navigatorPlatform = userAgentPlatform ?? navigator.platform ?? "";
|
|
1015
|
-
return /mac/i.test(navigatorPlatform);
|
|
1016
|
-
}
|
|
1017
|
-
function InteractiveOptionSpinner() {
|
|
1018
|
-
"use memo";
|
|
1019
|
-
return /* @__PURE__ */ jsx(
|
|
1020
|
-
Spinner,
|
|
1021
|
-
{
|
|
1022
|
-
className: AgentGUIConversation_styles_default.interactiveOptionSpinner,
|
|
1023
|
-
testId: "agent-interactive-option-spinner"
|
|
1024
|
-
}
|
|
1025
|
-
);
|
|
1026
|
-
}
|
|
1027
|
-
function SendFilledIcon() {
|
|
1028
|
-
"use memo";
|
|
1029
|
-
return /* @__PURE__ */ jsx(
|
|
1030
|
-
"svg",
|
|
1031
|
-
{
|
|
1032
|
-
width: "24",
|
|
1033
|
-
height: "24",
|
|
1034
|
-
viewBox: "0 0 24 24",
|
|
1035
|
-
fill: "none",
|
|
1036
|
-
"aria-hidden": "true",
|
|
1037
|
-
children: /* @__PURE__ */ jsx(
|
|
1038
|
-
"path",
|
|
1039
|
-
{
|
|
1040
|
-
d: "M2.74311 8.80587C2.84592 8.40096 3.14571 8.08844 3.54551 7.97033L18.5197 3.51569C18.9336 3.39383 19.3809 3.5054 19.6881 3.81262C19.9951 4.11984 20.1076 4.56798 19.9857 4.9817L15.5311 19.9559C15.413 20.3557 15.1005 20.6555 14.6956 20.7583C14.2895 20.8597 13.869 20.7438 13.5721 20.4469L10.455 15.1823C10.8585 14.6483 12.1563 12.9094 14.3475 9.96528C14.6086 9.70419 14.6382 9.31168 14.4138 9.08692C14.1891 8.86221 13.796 8.8913 13.5348 9.15252L8.31088 13.0423L3.05316 9.92799C2.7562 9.63104 2.64049 9.21071 2.74311 8.80587Z",
|
|
1041
|
-
fill: "currentColor"
|
|
1042
|
-
}
|
|
1043
|
-
)
|
|
1044
|
-
}
|
|
1045
|
-
);
|
|
1046
|
-
}
|
|
1047
|
-
function interactivePromptClassName(embedded) {
|
|
1048
|
-
return embedded ? `${AgentGUIConversation_styles_default.interactivePrompt} agent-gui-conversation__interactive-prompt--embedded` : AgentGUIConversation_styles_default.interactivePrompt;
|
|
1049
|
-
}
|
|
1050
|
-
function interactivePromptCardClassName(edgeGlow) {
|
|
1051
|
-
return edgeGlow ? `${AgentGUIConversation_styles_default.interactivePromptCard} agent-gui-edge-glow` : AgentGUIConversation_styles_default.interactivePromptCard;
|
|
1052
|
-
}
|
|
1053
|
-
function formatToolDetails(input) {
|
|
1054
|
-
return getPromptToolDetails(input).map((detail) => ({
|
|
1055
|
-
kind: detail.kind,
|
|
1056
|
-
label: promptToolDetailLabel(detail.kind),
|
|
1057
|
-
value: detail.value,
|
|
1058
|
-
...detail.meta ? { meta: detail.meta } : {}
|
|
1059
|
-
}));
|
|
1060
|
-
}
|
|
1061
|
-
function PromptDetailValue({
|
|
1062
|
-
detail,
|
|
1063
|
-
previewMode
|
|
1064
|
-
}) {
|
|
1065
|
-
"use memo";
|
|
1066
|
-
if (detail.kind !== "command") {
|
|
1067
|
-
return /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: detail.value });
|
|
1068
|
-
}
|
|
1069
|
-
return /* @__PURE__ */ jsx(
|
|
1070
|
-
CommandTextWithTooltip,
|
|
1071
|
-
{
|
|
1072
|
-
value: detail.value,
|
|
1073
|
-
testId: "agent-interactive-command-detail",
|
|
1074
|
-
tooltipsEnabled: !previewMode
|
|
1075
|
-
}
|
|
1076
|
-
);
|
|
1077
|
-
}
|
|
1078
|
-
function CommandTextWithTooltip({
|
|
1079
|
-
value,
|
|
1080
|
-
testId,
|
|
1081
|
-
tooltipsEnabled = true
|
|
1082
|
-
}) {
|
|
1083
|
-
"use memo";
|
|
1084
|
-
const content = /* @__PURE__ */ jsx(
|
|
1085
|
-
"span",
|
|
1086
|
-
{
|
|
1087
|
-
className: `${AgentGUIConversation_styles_default.interactiveOptionDescription} ${AgentGUIConversation_styles_default.interactiveOptionCommandDescription}`,
|
|
1088
|
-
"data-agent-interactive-command-detail": testId === "agent-interactive-command-detail" ? "true" : void 0,
|
|
1089
|
-
"data-agent-interactive-command-prefix-option": testId === "agent-interactive-command-prefix-option" ? "true" : void 0,
|
|
1090
|
-
children: value
|
|
1091
|
-
}
|
|
1092
|
-
);
|
|
1093
|
-
if (!tooltipsEnabled) {
|
|
1094
|
-
return content;
|
|
1095
|
-
}
|
|
1096
|
-
return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: COMMAND_TOOLTIP_DELAY_MS, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
1097
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: content }),
|
|
1098
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: AgentGUIConversation_styles_default.interactiveOptionCommandTooltip, children: value })
|
|
1099
|
-
] }) });
|
|
1100
|
-
}
|
|
1101
|
-
function promptToolDetailLabel(kind) {
|
|
1102
|
-
switch (kind) {
|
|
1103
|
-
case "command":
|
|
1104
|
-
return translate("agentHost.agentTool.details.command");
|
|
1105
|
-
case "mcp":
|
|
1106
|
-
return translate("agentHost.agentTool.details.mcp");
|
|
1107
|
-
case "path":
|
|
1108
|
-
return translate("agentHost.agentTool.details.path");
|
|
1109
|
-
case "query":
|
|
1110
|
-
return translate("agentHost.agentTool.details.query");
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
function isApprovalFeedbackOption(option) {
|
|
1114
|
-
return isDenyApprovalOptionToken(option.id) || isDenyApprovalOptionToken(option.kind);
|
|
1115
|
-
}
|
|
1116
|
-
function approvalFeedbackOptionId(options) {
|
|
1117
|
-
const explicitFeedbackOption = options.find(
|
|
1118
|
-
(option) => isExplicitFeedbackDenyApprovalOption(option)
|
|
1119
|
-
);
|
|
1120
|
-
if (explicitFeedbackOption) {
|
|
1121
|
-
return explicitFeedbackOption.id;
|
|
1122
|
-
}
|
|
1123
|
-
return options.find(isApprovalFeedbackOption)?.id ?? null;
|
|
1124
|
-
}
|
|
1125
|
-
function isExplicitFeedbackDenyApprovalOption(option) {
|
|
1126
|
-
for (const value of [option.id, option.kind]) {
|
|
1127
|
-
switch (normalizeApprovalOptionToken(value ?? "")) {
|
|
1128
|
-
case "abort":
|
|
1129
|
-
case "cancel":
|
|
1130
|
-
case "cancelled":
|
|
1131
|
-
case "canceled":
|
|
1132
|
-
case "denywithfeedback":
|
|
1133
|
-
case "rejectwithfeedback":
|
|
1134
|
-
return true;
|
|
1135
|
-
default:
|
|
1136
|
-
break;
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
return false;
|
|
1140
|
-
}
|
|
1141
|
-
function isDenyApprovalOptionToken(value) {
|
|
1142
|
-
switch (normalizeApprovalOptionToken(value ?? "")) {
|
|
1143
|
-
case "abort":
|
|
1144
|
-
case "cancel":
|
|
1145
|
-
case "cancelled":
|
|
1146
|
-
case "canceled":
|
|
1147
|
-
case "deny":
|
|
1148
|
-
case "denied":
|
|
1149
|
-
case "reject":
|
|
1150
|
-
case "rejected":
|
|
1151
|
-
case "rejectonce":
|
|
1152
|
-
case "disallow":
|
|
1153
|
-
case "decline":
|
|
1154
|
-
case "declined":
|
|
1155
|
-
case "no":
|
|
1156
|
-
return true;
|
|
1157
|
-
default:
|
|
1158
|
-
return false;
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
function stripPromptTitlePunctuation(value) {
|
|
1162
|
-
return value.trim().replace(/[.。]+$/u, "");
|
|
1163
|
-
}
|
|
1164
|
-
function interactiveOptionLabel(label, description) {
|
|
1165
|
-
const trimmedDescription = description?.trim();
|
|
1166
|
-
return trimmedDescription ? `${label} ${trimmedDescription}` : label;
|
|
1167
|
-
}
|
|
1168
1289
|
|
|
1169
1290
|
export {
|
|
1291
|
+
useEngineSelector,
|
|
1292
|
+
PLAN_IMPLEMENTATION_PROMPT,
|
|
1293
|
+
PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
|
|
1294
|
+
PLAN_IMPLEMENTATION_ACTION_FEEDBACK,
|
|
1295
|
+
PLAN_IMPLEMENTATION_ACTION_SKIP,
|
|
1296
|
+
planImplementationPromptFromPlanTurn,
|
|
1297
|
+
latestPlanTurnId,
|
|
1298
|
+
selectAgentPlanPromptTurn,
|
|
1299
|
+
dispatchAgentPlanPromptAction,
|
|
1170
1300
|
approvalOptionDisplayLabel,
|
|
1171
1301
|
getPromptToolDetails,
|
|
1172
1302
|
isPromptRequestIdTitle,
|
|
1173
1303
|
AgentInteractivePromptSurface
|
|
1174
1304
|
};
|
|
1175
|
-
//# sourceMappingURL=chunk-
|
|
1305
|
+
//# sourceMappingURL=chunk-XMO45GKA.js.map
|