@tutti-os/agent-gui 0.0.34 → 0.0.35
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/{AgentMessageMarkdown-CU6gRvTm.d.ts → AgentMessageMarkdown-0sV8Biv3.d.ts} +0 -3
- package/dist/agent-conversation/index.d.ts +1 -1
- package/dist/agent-conversation/index.js +4 -4
- package/dist/agent-message-center/index.js +4 -4
- package/dist/app/renderer/agentactivity.css +1 -52
- package/dist/{chunk-RUO6SDNC.js → chunk-3LEUGNCT.js} +2 -2
- package/dist/{chunk-XPVYQUFK.js → chunk-CMXRLF64.js} +12 -6
- package/dist/chunk-CMXRLF64.js.map +1 -0
- package/dist/{chunk-TCKH7GZ6.js → chunk-JYH2ITNL.js} +4 -4
- package/dist/{chunk-TQFYX7KY.js → chunk-KFMD33UD.js} +1 -7
- package/dist/chunk-KFMD33UD.js.map +1 -0
- package/dist/{chunk-ZR2LZVN6.js → chunk-O56P2KSZ.js} +12 -9
- package/dist/chunk-O56P2KSZ.js.map +1 -0
- package/dist/{chunk-I5GHWK6X.js → chunk-U3D7YI47.js} +4 -4
- package/dist/{chunk-SV4UKLJO.js → chunk-UN4XGHLQ.js} +2 -2
- package/dist/{chunk-PVEFWBH6.js → chunk-VPC55T7P.js} +2 -2
- package/dist/context-mention-palette/index.js +5 -5
- package/dist/i18n/index.d.ts +0 -6
- package/dist/i18n/index.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +128 -287
- package/dist/index.js.map +1 -1
- package/dist/workspace-agent-generated-files.js +2 -2
- package/package.json +12 -12
- package/dist/chunk-TQFYX7KY.js.map +0 -1
- package/dist/chunk-XPVYQUFK.js.map +0 -1
- package/dist/chunk-ZR2LZVN6.js.map +0 -1
- /package/dist/{chunk-RUO6SDNC.js.map → chunk-3LEUGNCT.js.map} +0 -0
- /package/dist/{chunk-TCKH7GZ6.js.map → chunk-JYH2ITNL.js.map} +0 -0
- /package/dist/{chunk-I5GHWK6X.js.map → chunk-U3D7YI47.js.map} +0 -0
- /package/dist/{chunk-SV4UKLJO.js.map → chunk-UN4XGHLQ.js.map} +0 -0
- /package/dist/{chunk-PVEFWBH6.js.map → chunk-VPC55T7P.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
AgentInteractivePromptSurface,
|
|
15
15
|
approvalOptionDisplayLabel
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JYH2ITNL.js";
|
|
17
17
|
import {
|
|
18
18
|
PLAN_IMPLEMENTATION_ACTION_FEEDBACK,
|
|
19
19
|
PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
|
|
@@ -37,13 +37,13 @@ import {
|
|
|
37
37
|
skillDescriptionForDisplay,
|
|
38
38
|
skillTriggerForPrefix,
|
|
39
39
|
useProjectedAgentConversation
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-O56P2KSZ.js";
|
|
41
41
|
import {
|
|
42
42
|
AgentMessageMarkdown,
|
|
43
43
|
ZoomableImage,
|
|
44
44
|
cn,
|
|
45
45
|
resolveWorkspaceLinkAction
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-CMXRLF64.js";
|
|
47
47
|
import {
|
|
48
48
|
AGENT_MENTION_FILTER_TAB_ORDER,
|
|
49
49
|
AgentFileMentionPalette,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
DEFAULT_AGENT_MENTION_FILTER,
|
|
52
52
|
agentMentionItemKey,
|
|
53
53
|
preloadAgentMentionBrowse
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-U3D7YI47.js";
|
|
55
55
|
import {
|
|
56
56
|
WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN,
|
|
57
57
|
buildWorkspaceAgentActivityListViewModel,
|
|
@@ -62,13 +62,13 @@ import {
|
|
|
62
62
|
mergeWorkspaceAgentActivityDurableAndOverlayMessages,
|
|
63
63
|
normalizeOptionalWorkspaceAgentStatus,
|
|
64
64
|
selectWorkspaceAgentActivityOverlayMessages
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-UN4XGHLQ.js";
|
|
66
66
|
import {
|
|
67
67
|
MANAGED_AGENT_ICON_FALLBACK_URL,
|
|
68
68
|
MANAGED_AGENT_ICON_URLS,
|
|
69
69
|
Spinner,
|
|
70
70
|
normalizeManagedAgentProvider
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-3LEUGNCT.js";
|
|
72
72
|
import "./chunk-MTFSQWZ6.js";
|
|
73
73
|
import {
|
|
74
74
|
resolveWorkspaceAgentSessionSortTimeUnixMs
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
mentionItemToAttrs,
|
|
80
80
|
normalizeAgentSessionMentionTitle,
|
|
81
81
|
parseMentionItemFromHref
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-VPC55T7P.js";
|
|
83
83
|
import "./chunk-Y35GDLP2.js";
|
|
84
84
|
import {
|
|
85
85
|
AgentActivityHostProvider,
|
|
@@ -108,7 +108,7 @@ import {
|
|
|
108
108
|
getActiveUiLanguage,
|
|
109
109
|
translate,
|
|
110
110
|
useTranslation
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-KFMD33UD.js";
|
|
112
112
|
import "./chunk-LUGELG5V.js";
|
|
113
113
|
import "./chunk-PJP5BUU6.js";
|
|
114
114
|
|
|
@@ -6454,37 +6454,6 @@ function nodeDataFromComposerSettings(current, settings) {
|
|
|
6454
6454
|
};
|
|
6455
6455
|
}
|
|
6456
6456
|
|
|
6457
|
-
// agent-gui/agentGuiNode/model/agentUsageThresholds.ts
|
|
6458
|
-
var USAGE_WARN_PERCENT = 80;
|
|
6459
|
-
var USAGE_CRITICAL_PERCENT = 95;
|
|
6460
|
-
|
|
6461
|
-
// agent-gui/agentGuiNode/model/agentUsageAlerts.ts
|
|
6462
|
-
var INITIAL_USAGE_ALERT_STATE = {
|
|
6463
|
-
warned: false,
|
|
6464
|
-
criticaled: false
|
|
6465
|
-
};
|
|
6466
|
-
function nextUsageAlert(percentUsed, state) {
|
|
6467
|
-
if (percentUsed === null) {
|
|
6468
|
-
return { fire: null, state };
|
|
6469
|
-
}
|
|
6470
|
-
if (percentUsed >= USAGE_CRITICAL_PERCENT) {
|
|
6471
|
-
if (state.criticaled) {
|
|
6472
|
-
return { fire: null, state };
|
|
6473
|
-
}
|
|
6474
|
-
return { fire: "critical", state: { warned: true, criticaled: true } };
|
|
6475
|
-
}
|
|
6476
|
-
if (percentUsed >= USAGE_WARN_PERCENT) {
|
|
6477
|
-
if (state.warned) {
|
|
6478
|
-
return { fire: null, state };
|
|
6479
|
-
}
|
|
6480
|
-
return { fire: "warn", state: { ...state, warned: true } };
|
|
6481
|
-
}
|
|
6482
|
-
if (state.warned || state.criticaled) {
|
|
6483
|
-
return { fire: null, state: INITIAL_USAGE_ALERT_STATE };
|
|
6484
|
-
}
|
|
6485
|
-
return { fire: null, state };
|
|
6486
|
-
}
|
|
6487
|
-
|
|
6488
6457
|
// agent-gui/agentGuiNode/controller/useAgentGUINodeController.ts
|
|
6489
6458
|
var EMPTY_AGENT_GUI_MESSAGES = [];
|
|
6490
6459
|
var EMPTY_AGENT_GUI_AVAILABLE_COMMANDS = [];
|
|
@@ -7679,6 +7648,23 @@ function removeQueuedPromptById(queue, queuedPromptId) {
|
|
|
7679
7648
|
}
|
|
7680
7649
|
var NODE_DEFAULT_DRAFT_KEY = "__agent_gui_node_defaults__";
|
|
7681
7650
|
var EMPTY_AGENT_COMPOSER_DRAFT = emptyAgentComposerDraft();
|
|
7651
|
+
function areAgentComposerDraftsEqual(left, right) {
|
|
7652
|
+
const leftFiles = left.files ?? [];
|
|
7653
|
+
const rightFiles = right.files ?? [];
|
|
7654
|
+
return left.prompt === right.prompt && left.images.length === right.images.length && left.images.every((image, index) => {
|
|
7655
|
+
const other = right.images[index];
|
|
7656
|
+
if (!other) {
|
|
7657
|
+
return false;
|
|
7658
|
+
}
|
|
7659
|
+
return image.id === other.id && image.name === other.name && image.mimeType === other.mimeType && image.data === other.data && image.path === other.path && image.previewUrl === other.previewUrl && image.uploading === other.uploading && image.uploadError === other.uploadError;
|
|
7660
|
+
}) && leftFiles.length === rightFiles.length && leftFiles.every((file, index) => {
|
|
7661
|
+
const other = rightFiles[index];
|
|
7662
|
+
if (!other) {
|
|
7663
|
+
return false;
|
|
7664
|
+
}
|
|
7665
|
+
return file.id === other.id && file.name === other.name && file.mimeType === other.mimeType && file.path === other.path && file.hostPath === other.hostPath && file.assetId === other.assetId && file.sizeBytes === other.sizeBytes && file.uploading === other.uploading && file.uploadError === other.uploadError;
|
|
7666
|
+
});
|
|
7667
|
+
}
|
|
7682
7668
|
function nodeDefaultDraftKey(agentProvider) {
|
|
7683
7669
|
return `${NODE_DEFAULT_DRAFT_KEY}:${agentProvider}`;
|
|
7684
7670
|
}
|
|
@@ -8027,6 +8013,7 @@ function useAgentGUINodeController({
|
|
|
8027
8013
|
data.lastActiveAgentSessionId === null
|
|
8028
8014
|
);
|
|
8029
8015
|
const [draftBySessionId, setDraftBySessionId] = useState4({});
|
|
8016
|
+
const draftBySessionIdRef = useRef4(draftBySessionId);
|
|
8030
8017
|
const [draftSettingsBySessionId, setDraftSettingsBySessionId] = useState4({});
|
|
8031
8018
|
const [queuedPromptsBySessionId, setQueuedPromptsBySessionId] = useState4({});
|
|
8032
8019
|
const hasLoadedConversations = conversationListState?.initialized ?? false;
|
|
@@ -8123,53 +8110,8 @@ function useAgentGUINodeController({
|
|
|
8123
8110
|
}),
|
|
8124
8111
|
[activeSessionRuntimeContext]
|
|
8125
8112
|
);
|
|
8126
|
-
const usageAlertStateBySessionIdRef = useRef4(
|
|
8127
|
-
{}
|
|
8128
|
-
);
|
|
8129
|
-
const [usageAlertBySessionId, setUsageAlertBySessionId] = useState4({});
|
|
8130
8113
|
const [dismissedPlanTurnIdBySessionId, setDismissedPlanTurnIdBySessionId] = useState4({});
|
|
8131
8114
|
const planImplementationTurnIdRef = useRef4(null);
|
|
8132
|
-
const usagePercentUsed = usage?.percentUsed ?? null;
|
|
8133
|
-
useEffect4(() => {
|
|
8134
|
-
const agentSessionId = activeConversationId;
|
|
8135
|
-
if (!agentSessionId) {
|
|
8136
|
-
return;
|
|
8137
|
-
}
|
|
8138
|
-
const previousState = usageAlertStateBySessionIdRef.current[agentSessionId] ?? INITIAL_USAGE_ALERT_STATE;
|
|
8139
|
-
const { fire, state } = nextUsageAlert(usagePercentUsed, previousState);
|
|
8140
|
-
usageAlertStateBySessionIdRef.current[agentSessionId] = state;
|
|
8141
|
-
if (fire) {
|
|
8142
|
-
setUsageAlertBySessionId(
|
|
8143
|
-
(current) => current[agentSessionId] === fire ? current : { ...current, [agentSessionId]: fire }
|
|
8144
|
-
);
|
|
8145
|
-
return;
|
|
8146
|
-
}
|
|
8147
|
-
if (!state.warned && !state.criticaled) {
|
|
8148
|
-
setUsageAlertBySessionId((current) => {
|
|
8149
|
-
if (!(agentSessionId in current)) {
|
|
8150
|
-
return current;
|
|
8151
|
-
}
|
|
8152
|
-
const next = { ...current };
|
|
8153
|
-
delete next[agentSessionId];
|
|
8154
|
-
return next;
|
|
8155
|
-
});
|
|
8156
|
-
}
|
|
8157
|
-
}, [activeConversationId, usagePercentUsed]);
|
|
8158
|
-
const usageAlert = activeConversationId ? usageAlertBySessionId[activeConversationId] ?? null : null;
|
|
8159
|
-
const dismissUsageAlert = useCallback4(() => {
|
|
8160
|
-
const agentSessionId = activeConversationId;
|
|
8161
|
-
if (!agentSessionId) {
|
|
8162
|
-
return;
|
|
8163
|
-
}
|
|
8164
|
-
setUsageAlertBySessionId((current) => {
|
|
8165
|
-
if (!(agentSessionId in current)) {
|
|
8166
|
-
return current;
|
|
8167
|
-
}
|
|
8168
|
-
const next = { ...current };
|
|
8169
|
-
delete next[agentSessionId];
|
|
8170
|
-
return next;
|
|
8171
|
-
});
|
|
8172
|
-
}, [activeConversationId]);
|
|
8173
8115
|
const dismissPlanImplementation = useCallback4(() => {
|
|
8174
8116
|
const agentSessionId = activeConversationIdRef.current;
|
|
8175
8117
|
const planTurnId = planImplementationTurnIdRef.current;
|
|
@@ -8610,6 +8552,9 @@ function useAgentGUINodeController({
|
|
|
8610
8552
|
useEffect4(() => {
|
|
8611
8553
|
onShowMessageRef.current = onShowMessage;
|
|
8612
8554
|
}, [onShowMessage]);
|
|
8555
|
+
useEffect4(() => {
|
|
8556
|
+
draftBySessionIdRef.current = draftBySessionId;
|
|
8557
|
+
}, [draftBySessionId]);
|
|
8613
8558
|
useEffect4(() => {
|
|
8614
8559
|
draftSettingsBySessionIdRef.current = draftSettingsBySessionId;
|
|
8615
8560
|
}, [draftSettingsBySessionId]);
|
|
@@ -10195,10 +10140,13 @@ function useAgentGUINodeController({
|
|
|
10195
10140
|
const initialDisplayPrompt = displayPrompt && displayPrompt.trim() ? displayPrompt : void 0;
|
|
10196
10141
|
const normalizedInitialPrompt = initialDisplayPrompt ?? agentPromptContentDisplayText(normalizedInitialContent);
|
|
10197
10142
|
const initialConversationTitle = normalizedInitialPrompt || AGENT_PROVIDER_LABEL[data.provider];
|
|
10143
|
+
const submittedHomeDraftKey = nodeDefaultDraftContentKey(data.provider);
|
|
10144
|
+
const submittedHomeDraft = draftBySessionIdRef.current[submittedHomeDraftKey] ?? EMPTY_AGENT_COMPOSER_DRAFT;
|
|
10198
10145
|
isCreatingConversationRef.current = true;
|
|
10199
10146
|
setLocalIsCreatingConversation(true);
|
|
10200
10147
|
setDetailError(null);
|
|
10201
10148
|
let pendingCreateAgentSessionId = null;
|
|
10149
|
+
let pendingOptimisticConversation = null;
|
|
10202
10150
|
void (async () => {
|
|
10203
10151
|
const provider = data.provider;
|
|
10204
10152
|
const currentData = dataRef.current.provider === provider ? dataRef.current : data;
|
|
@@ -10269,48 +10217,7 @@ function useAgentGUINodeController({
|
|
|
10269
10217
|
sortTimeUnixMs: createdAtUnixMs,
|
|
10270
10218
|
updatedAtUnixMs: createdAtUnixMs
|
|
10271
10219
|
};
|
|
10272
|
-
|
|
10273
|
-
isComposerHomeRef.current = false;
|
|
10274
|
-
setIsComposerHome(false);
|
|
10275
|
-
activeConversationIdRef.current = agentSessionId;
|
|
10276
|
-
setActiveConversationId(agentSessionId);
|
|
10277
|
-
setIntent({ tag: "active", id: agentSessionId });
|
|
10278
|
-
persistActiveConversation(agentSessionId);
|
|
10279
|
-
setAgentSessionViewMessagesLoading(
|
|
10280
|
-
sessionViewRef(agentSessionId),
|
|
10281
|
-
true
|
|
10282
|
-
);
|
|
10283
|
-
reportAgentSubmitTraceDiagnostic({
|
|
10284
|
-
event: "optimistic_state_applied",
|
|
10285
|
-
runtime: agentActivityRuntime,
|
|
10286
|
-
trace: submitTrace,
|
|
10287
|
-
workspaceId,
|
|
10288
|
-
fields: { mode: "new" }
|
|
10289
|
-
});
|
|
10290
|
-
recordLocalMessages(agentSessionId, [
|
|
10291
|
-
createOptimisticPromptMessage({
|
|
10292
|
-
workspaceId,
|
|
10293
|
-
agentSessionId,
|
|
10294
|
-
turnId: createPendingOptimisticTurnId(submitTrace.clientSubmitId),
|
|
10295
|
-
clientSubmitId: submitTrace.clientSubmitId,
|
|
10296
|
-
userId: currentUserId?.trim() || "user",
|
|
10297
|
-
prompt: normalizedInitialPrompt,
|
|
10298
|
-
content: [...normalizedInitialContent],
|
|
10299
|
-
occurredAtUnixMs: createdAtUnixMs
|
|
10300
|
-
})
|
|
10301
|
-
]);
|
|
10302
|
-
reportAgentSubmitTraceDiagnostic({
|
|
10303
|
-
event: "optimistic_user_message_recorded",
|
|
10304
|
-
runtime: agentActivityRuntime,
|
|
10305
|
-
trace: submitTrace,
|
|
10306
|
-
workspaceId,
|
|
10307
|
-
fields: { mode: "new" }
|
|
10308
|
-
});
|
|
10309
|
-
scheduleAgentSubmitTracePaint({
|
|
10310
|
-
runtime: agentActivityRuntime,
|
|
10311
|
-
trace: submitTrace,
|
|
10312
|
-
workspaceId
|
|
10313
|
-
});
|
|
10220
|
+
pendingOptimisticConversation = optimisticConversation;
|
|
10314
10221
|
if (conversationListQuery) {
|
|
10315
10222
|
markAgentGUIConversationCreatePending({
|
|
10316
10223
|
query: conversationListQuery,
|
|
@@ -10327,12 +10234,6 @@ function useAgentGUINodeController({
|
|
|
10327
10234
|
...current,
|
|
10328
10235
|
[agentSessionId]: effectiveInitialSettings
|
|
10329
10236
|
}));
|
|
10330
|
-
setDraftBySessionId((current) => ({
|
|
10331
|
-
...current,
|
|
10332
|
-
[nodeDefaultDraftContentKey(dataRef.current.provider)]: emptyAgentComposerDraft(),
|
|
10333
|
-
[agentSessionId]: emptyAgentComposerDraft()
|
|
10334
|
-
}));
|
|
10335
|
-
setIsLoadingMessages(true);
|
|
10336
10237
|
reportAgentSubmitTraceDiagnostic({
|
|
10337
10238
|
event: "activation.requested",
|
|
10338
10239
|
runtime: agentActivityRuntime,
|
|
@@ -10377,6 +10278,7 @@ function useAgentGUINodeController({
|
|
|
10377
10278
|
}
|
|
10378
10279
|
});
|
|
10379
10280
|
}
|
|
10281
|
+
const activationFailed = result.activation.status === "failed" || result.session.status === "failed";
|
|
10380
10282
|
if (conversationListQuery) {
|
|
10381
10283
|
clearAgentGUIConversationCreatePending({
|
|
10382
10284
|
query: conversationListQuery,
|
|
@@ -10384,6 +10286,23 @@ function useAgentGUINodeController({
|
|
|
10384
10286
|
conversationId: agentSessionId
|
|
10385
10287
|
});
|
|
10386
10288
|
}
|
|
10289
|
+
if (activationFailed) {
|
|
10290
|
+
failedNewConversationIdsRef.current.add(agentSessionId);
|
|
10291
|
+
if (startingConversationIdRef.current === agentSessionId) {
|
|
10292
|
+
startingConversationIdRef.current = null;
|
|
10293
|
+
}
|
|
10294
|
+
if (isMountedRef.current && activeConversationIdRef.current === null && isComposerHomeRef.current) {
|
|
10295
|
+
setIsLoadingMessages(false);
|
|
10296
|
+
setAgentSessionViewMessagesLoading(
|
|
10297
|
+
sessionViewRef(agentSessionId),
|
|
10298
|
+
false
|
|
10299
|
+
);
|
|
10300
|
+
setDetailError(
|
|
10301
|
+
result.error?.message?.trim() || "Session activation failed."
|
|
10302
|
+
);
|
|
10303
|
+
}
|
|
10304
|
+
return;
|
|
10305
|
+
}
|
|
10387
10306
|
const projectedConversation = conversationSummaryFromAgentSession(
|
|
10388
10307
|
result.session,
|
|
10389
10308
|
{
|
|
@@ -10391,36 +10310,33 @@ function useAgentGUINodeController({
|
|
|
10391
10310
|
userProjects: userProjectsRef.current
|
|
10392
10311
|
}
|
|
10393
10312
|
);
|
|
10394
|
-
const optimisticSortTimeUnixMs = transientConversationRef.current?.id === agentSessionId ? transientConversationRef.current.sortTimeUnixMs : void 0;
|
|
10395
10313
|
const conversation2 = {
|
|
10396
10314
|
...projectedConversation,
|
|
10397
10315
|
sortTimeUnixMs: Math.max(
|
|
10398
10316
|
projectedConversation.sortTimeUnixMs ?? 0,
|
|
10399
|
-
|
|
10317
|
+
pendingOptimisticConversation?.sortTimeUnixMs ?? 0
|
|
10400
10318
|
)
|
|
10401
10319
|
};
|
|
10402
10320
|
failedNewConversationIdsRef.current.delete(conversation2.id);
|
|
10403
|
-
|
|
10404
|
-
startingConversationIdRef.current = null;
|
|
10405
|
-
}
|
|
10321
|
+
const isPendingCreatedConversation = startingConversationIdRef.current === agentSessionId;
|
|
10406
10322
|
if (!isMountedRef.current) {
|
|
10407
10323
|
void activation.unactivate(conversation2.id);
|
|
10408
|
-
if (
|
|
10409
|
-
|
|
10324
|
+
if (isPendingCreatedConversation) {
|
|
10325
|
+
startingConversationIdRef.current = null;
|
|
10410
10326
|
}
|
|
10411
10327
|
return;
|
|
10412
10328
|
}
|
|
10413
|
-
const shouldAttachCreatedConversation = activeConversationIdRef.current === null && isComposerHomeRef.current;
|
|
10329
|
+
const shouldAttachCreatedConversation = activeConversationIdRef.current === null && isComposerHomeRef.current && isPendingCreatedConversation;
|
|
10414
10330
|
if (!shouldAttachCreatedConversation && unactivateIfStale(conversation2.id)) {
|
|
10415
|
-
if (
|
|
10416
|
-
|
|
10331
|
+
if (isPendingCreatedConversation) {
|
|
10332
|
+
startingConversationIdRef.current = null;
|
|
10417
10333
|
}
|
|
10418
10334
|
return;
|
|
10419
10335
|
}
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
activatedConversationIdsRef.current.add(conversation2.id);
|
|
10336
|
+
if (isPendingCreatedConversation) {
|
|
10337
|
+
startingConversationIdRef.current = null;
|
|
10423
10338
|
}
|
|
10339
|
+
activatedConversationIdsRef.current.add(conversation2.id);
|
|
10424
10340
|
setTransientConversation(conversation2);
|
|
10425
10341
|
if (conversationListQuery) {
|
|
10426
10342
|
upsertLocalCreatedAgentGUIConversation({
|
|
@@ -10432,23 +10348,64 @@ function useAgentGUINodeController({
|
|
|
10432
10348
|
"local-create"
|
|
10433
10349
|
);
|
|
10434
10350
|
}
|
|
10351
|
+
setAgentSessionViewMessagesLoading(
|
|
10352
|
+
sessionViewRef(conversation2.id),
|
|
10353
|
+
true
|
|
10354
|
+
);
|
|
10355
|
+
if (submitTrace) {
|
|
10356
|
+
reportAgentSubmitTraceDiagnostic({
|
|
10357
|
+
event: "optimistic_state_applied",
|
|
10358
|
+
runtime: agentActivityRuntime,
|
|
10359
|
+
trace: submitTrace,
|
|
10360
|
+
workspaceId,
|
|
10361
|
+
fields: { mode: "new" }
|
|
10362
|
+
});
|
|
10363
|
+
recordLocalMessages(conversation2.id, [
|
|
10364
|
+
createOptimisticPromptMessage({
|
|
10365
|
+
workspaceId,
|
|
10366
|
+
agentSessionId: conversation2.id,
|
|
10367
|
+
turnId: createPendingOptimisticTurnId(
|
|
10368
|
+
submitTrace.clientSubmitId
|
|
10369
|
+
),
|
|
10370
|
+
clientSubmitId: submitTrace.clientSubmitId,
|
|
10371
|
+
userId: currentUserId?.trim() || "user",
|
|
10372
|
+
prompt: normalizedInitialPrompt,
|
|
10373
|
+
content: [...normalizedInitialContent],
|
|
10374
|
+
occurredAtUnixMs: pendingOptimisticConversation?.sortTimeUnixMs ?? Date.now()
|
|
10375
|
+
})
|
|
10376
|
+
]);
|
|
10377
|
+
reportAgentSubmitTraceDiagnostic({
|
|
10378
|
+
event: "optimistic_user_message_recorded",
|
|
10379
|
+
runtime: agentActivityRuntime,
|
|
10380
|
+
trace: submitTrace,
|
|
10381
|
+
workspaceId,
|
|
10382
|
+
fields: { mode: "new" }
|
|
10383
|
+
});
|
|
10384
|
+
scheduleAgentSubmitTracePaint({
|
|
10385
|
+
runtime: agentActivityRuntime,
|
|
10386
|
+
trace: submitTrace,
|
|
10387
|
+
workspaceId
|
|
10388
|
+
});
|
|
10389
|
+
}
|
|
10435
10390
|
isComposerHomeRef.current = false;
|
|
10436
10391
|
setIsComposerHome(false);
|
|
10437
10392
|
activeConversationIdRef.current = conversation2.id;
|
|
10438
10393
|
setActiveConversationId(conversation2.id);
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
[
|
|
10442
|
-
|
|
10443
|
-
|
|
10394
|
+
setIntent({ tag: "active", id: conversation2.id });
|
|
10395
|
+
setDraftBySessionId((current) => {
|
|
10396
|
+
const currentHomeDraft = current[submittedHomeDraftKey] ?? EMPTY_AGENT_COMPOSER_DRAFT;
|
|
10397
|
+
const shouldClearHomeDraft = areAgentComposerDraftsEqual(
|
|
10398
|
+
currentHomeDraft,
|
|
10399
|
+
submittedHomeDraft
|
|
10400
|
+
);
|
|
10401
|
+
return {
|
|
10402
|
+
...current,
|
|
10403
|
+
...shouldClearHomeDraft ? { [submittedHomeDraftKey]: emptyAgentComposerDraft() } : {},
|
|
10404
|
+
[conversation2.id]: emptyAgentComposerDraft()
|
|
10405
|
+
};
|
|
10406
|
+
});
|
|
10444
10407
|
persistActiveConversation(conversation2.id);
|
|
10445
|
-
|
|
10446
|
-
failedNewConversationIdsRef.current.add(conversation2.id);
|
|
10447
|
-
setIsLoadingMessages(false);
|
|
10448
|
-
void refreshMessagesFromSnapshot(conversation2.id);
|
|
10449
|
-
void syncConversationListProjection(conversation2.id);
|
|
10450
|
-
return;
|
|
10451
|
-
}
|
|
10408
|
+
setIsLoadingMessages(true);
|
|
10452
10409
|
void refreshMessagesFromSnapshot(conversation2.id);
|
|
10453
10410
|
void loadSessionState(conversation2.id);
|
|
10454
10411
|
void syncConversationListProjection(conversation2.id);
|
|
@@ -10461,7 +10418,7 @@ function useAgentGUINodeController({
|
|
|
10461
10418
|
conversationId: pendingCreateAgentSessionId ?? agentSessionId
|
|
10462
10419
|
});
|
|
10463
10420
|
}
|
|
10464
|
-
const
|
|
10421
|
+
const shouldShowErrorOnHome = startingConversationIdRef.current === agentSessionId || activeConversationIdRef.current === null && isComposerHomeRef.current;
|
|
10465
10422
|
const submitTrace = submitTraceBySessionIdRef.current[agentSessionId];
|
|
10466
10423
|
if (submitTrace) {
|
|
10467
10424
|
const nextTraces = { ...submitTraceBySessionIdRef.current };
|
|
@@ -10478,7 +10435,7 @@ function useAgentGUINodeController({
|
|
|
10478
10435
|
}
|
|
10479
10436
|
});
|
|
10480
10437
|
}
|
|
10481
|
-
if (!
|
|
10438
|
+
if (!shouldShowErrorOnHome && !isCurrentConversation(agentSessionId)) {
|
|
10482
10439
|
setAgentSessionViewMessagesLoading(
|
|
10483
10440
|
sessionViewRef(agentSessionId),
|
|
10484
10441
|
false
|
|
@@ -10500,36 +10457,13 @@ function useAgentGUINodeController({
|
|
|
10500
10457
|
runtime: agentActivityRuntime,
|
|
10501
10458
|
workspaceId
|
|
10502
10459
|
});
|
|
10503
|
-
const failedAtUnixMs = Date.now();
|
|
10504
|
-
const failedConversation = {
|
|
10505
|
-
id: agentSessionId,
|
|
10506
|
-
provider: dataRef.current.provider,
|
|
10507
|
-
title: initialConversationTitle,
|
|
10508
|
-
titleFallback: null,
|
|
10509
|
-
cwd: selectedProjectPathRef.current ?? "",
|
|
10510
|
-
project: resolveAgentGUIConversationProject(
|
|
10511
|
-
selectedProjectPathRef.current,
|
|
10512
|
-
userProjectsRef.current,
|
|
10513
|
-
{ isNoProjectPath: isNoProjectPathRef.current }
|
|
10514
|
-
),
|
|
10515
|
-
status: "failed",
|
|
10516
|
-
sortTimeUnixMs: failedAtUnixMs,
|
|
10517
|
-
updatedAtUnixMs: failedAtUnixMs
|
|
10518
|
-
};
|
|
10519
10460
|
failedNewConversationIdsRef.current.add(agentSessionId);
|
|
10520
|
-
setTransientConversation(failedConversation);
|
|
10521
10461
|
if (startingConversationIdRef.current === agentSessionId) {
|
|
10522
10462
|
startingConversationIdRef.current = null;
|
|
10523
10463
|
}
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
setActiveConversationId(agentSessionId);
|
|
10528
|
-
setDraftBySessionId((current) => ({
|
|
10529
|
-
...current,
|
|
10530
|
-
[nodeDefaultDraftContentKey(dataRef.current.provider)]: emptyAgentComposerDraft(),
|
|
10531
|
-
[agentSessionId]: emptyAgentComposerDraft()
|
|
10532
|
-
}));
|
|
10464
|
+
if (transientConversationRef.current?.id === agentSessionId) {
|
|
10465
|
+
setTransientConversation(null);
|
|
10466
|
+
}
|
|
10533
10467
|
setIsLoadingMessages(false);
|
|
10534
10468
|
setAgentSessionViewMessagesLoading(
|
|
10535
10469
|
sessionViewRef(agentSessionId),
|
|
@@ -11170,9 +11104,6 @@ function useAgentGUINodeController({
|
|
|
11170
11104
|
startConversation
|
|
11171
11105
|
]
|
|
11172
11106
|
);
|
|
11173
|
-
const submitCompact = useCallback4(() => {
|
|
11174
|
-
submitPrompt(textPromptContent("/compact"));
|
|
11175
|
-
}, [submitPrompt]);
|
|
11176
11107
|
useEffect4(() => {
|
|
11177
11108
|
if (previewMode) {
|
|
11178
11109
|
return;
|
|
@@ -11417,6 +11348,10 @@ function useAgentGUINodeController({
|
|
|
11417
11348
|
const updateDraftContent = useCallback4((draftContent2) => {
|
|
11418
11349
|
const agentSessionId = activeConversationIdRef.current;
|
|
11419
11350
|
const draftKey = agentSessionId ?? nodeDefaultDraftContentKey(dataRef.current.provider);
|
|
11351
|
+
draftBySessionIdRef.current = {
|
|
11352
|
+
...draftBySessionIdRef.current,
|
|
11353
|
+
[draftKey]: draftContent2
|
|
11354
|
+
};
|
|
11420
11355
|
setDraftBySessionId((current) => ({
|
|
11421
11356
|
...current,
|
|
11422
11357
|
[draftKey]: draftContent2
|
|
@@ -12953,8 +12888,6 @@ function useAgentGUINodeController({
|
|
|
12953
12888
|
const stableRetryOpenclawGateway = useStableControllerEventCallback(
|
|
12954
12889
|
ensureOpenclawGateway
|
|
12955
12890
|
);
|
|
12956
|
-
const stableSubmitCompact = useStableControllerEventCallback(submitCompact);
|
|
12957
|
-
const stableDismissUsageAlert = useStableControllerEventCallback(dismissUsageAlert);
|
|
12958
12891
|
const stableLoadOlderConversationMessages = useStableControllerEventCallback(
|
|
12959
12892
|
loadOlderConversationMessages
|
|
12960
12893
|
);
|
|
@@ -12963,8 +12896,6 @@ function useAgentGUINodeController({
|
|
|
12963
12896
|
createConversation: stableCreateConversation,
|
|
12964
12897
|
selectConversation: stableSelectConversation,
|
|
12965
12898
|
submitPrompt: stableSubmitPrompt,
|
|
12966
|
-
submitCompact: stableSubmitCompact,
|
|
12967
|
-
dismissUsageAlert: stableDismissUsageAlert,
|
|
12968
12899
|
loadOlderConversationMessages: stableLoadOlderConversationMessages,
|
|
12969
12900
|
showPromptImagesUnsupported: stableShowPromptImagesUnsupported,
|
|
12970
12901
|
submitApprovalOption: stableSubmitApprovalOption,
|
|
@@ -12995,7 +12926,6 @@ function useAgentGUINodeController({
|
|
|
12995
12926
|
stableConfirmDeleteProjectConversations,
|
|
12996
12927
|
stableContinueInNewConversation,
|
|
12997
12928
|
stableCreateConversation,
|
|
12998
|
-
stableDismissUsageAlert,
|
|
12999
12929
|
stableEditQueuedPrompt,
|
|
13000
12930
|
stableInterruptCurrentTurn,
|
|
13001
12931
|
stableLoadOlderConversationMessages,
|
|
@@ -13009,7 +12939,6 @@ function useAgentGUINodeController({
|
|
|
13009
12939
|
stableSendQueuedPromptNext,
|
|
13010
12940
|
stableShowPromptImagesUnsupported,
|
|
13011
12941
|
stableSubmitApprovalOption,
|
|
13012
|
-
stableSubmitCompact,
|
|
13013
12942
|
stableSubmitInteractivePrompt,
|
|
13014
12943
|
stableSubmitPrompt,
|
|
13015
12944
|
stableToggleConversationPinned,
|
|
@@ -13045,7 +12974,6 @@ function useAgentGUINodeController({
|
|
|
13045
12974
|
promptImagesSupported,
|
|
13046
12975
|
compactSupported,
|
|
13047
12976
|
usage,
|
|
13048
|
-
usageAlert,
|
|
13049
12977
|
listError,
|
|
13050
12978
|
isDeletingConversation,
|
|
13051
12979
|
isDeletingProjectConversations,
|
|
@@ -13098,8 +13026,6 @@ function useAgentGUINodeController({
|
|
|
13098
13026
|
promptImagesSupported,
|
|
13099
13027
|
compactSupported,
|
|
13100
13028
|
usage,
|
|
13101
|
-
usageAlert,
|
|
13102
|
-
dismissUsageAlert,
|
|
13103
13029
|
isInterrupting,
|
|
13104
13030
|
isCancelPending,
|
|
13105
13031
|
isLoadingConversations,
|
|
@@ -13298,7 +13224,7 @@ import {
|
|
|
13298
13224
|
} from "react";
|
|
13299
13225
|
import { useSnapshot } from "valtio";
|
|
13300
13226
|
import { proxy as proxy2 } from "valtio/vanilla";
|
|
13301
|
-
import { ChevronRight as ChevronRight2, ExternalLink, Info, Wrench
|
|
13227
|
+
import { ChevronRight as ChevronRight2, ExternalLink, Info, Wrench } from "lucide-react";
|
|
13302
13228
|
import {
|
|
13303
13229
|
ReferenceSourcePicker,
|
|
13304
13230
|
WorkspaceFileReferencePicker
|
|
@@ -15217,10 +15143,6 @@ var styles3 = {
|
|
|
15217
15143
|
conversationUnreadLamp: "agent-gui-node__conversation-unread-lamp",
|
|
15218
15144
|
detailHeader: "agent-gui-node__detail-header",
|
|
15219
15145
|
detailHeaderPathInfo: "agent-gui-node__detail-header-path-info",
|
|
15220
|
-
usageAlertBanner: "agent-gui-node__usage-alert-banner",
|
|
15221
|
-
usageAlertMessage: "agent-gui-node__usage-alert-message",
|
|
15222
|
-
usageAlertActions: "agent-gui-node__usage-alert-actions",
|
|
15223
|
-
usageAlertDismiss: "agent-gui-node__usage-alert-dismiss",
|
|
15224
15146
|
providerSetupNotice: "agent-gui-node__provider-setup-notice",
|
|
15225
15147
|
providerSetupNoticeIcon: "agent-gui-node__provider-setup-notice-icon",
|
|
15226
15148
|
providerSetupNoticeText: "agent-gui-node__provider-setup-notice-text",
|
|
@@ -17924,6 +17846,10 @@ var ComposerFloatingMenuSurface = forwardRef4(function ComposerFloatingMenuSurfa
|
|
|
17924
17846
|
);
|
|
17925
17847
|
});
|
|
17926
17848
|
|
|
17849
|
+
// agent-gui/agentGuiNode/model/agentUsageThresholds.ts
|
|
17850
|
+
var USAGE_WARN_PERCENT = 80;
|
|
17851
|
+
var USAGE_CRITICAL_PERCENT = 95;
|
|
17852
|
+
|
|
17927
17853
|
// agent-gui/agentGuiNode/AgentComposer.tsx
|
|
17928
17854
|
import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
17929
17855
|
function agentUsageChipLevel(percentUsed) {
|
|
@@ -21645,10 +21571,6 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
|
|
|
21645
21571
|
const handleInterruptCurrentTurn = useCallback10(() => {
|
|
21646
21572
|
actions.interruptCurrentTurn(labels.noRunningResponse);
|
|
21647
21573
|
}, [actions.interruptCurrentTurn, labels.noRunningResponse]);
|
|
21648
|
-
const handleUsageAlertCompact = useCallback10(() => {
|
|
21649
|
-
actions.submitCompact();
|
|
21650
|
-
actions.dismissUsageAlert();
|
|
21651
|
-
}, [actions]);
|
|
21652
21574
|
const submitApprovalOption = useStableEventCallback2(
|
|
21653
21575
|
actions.submitApprovalOption
|
|
21654
21576
|
);
|
|
@@ -22071,12 +21993,6 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
|
|
|
22071
21993
|
bottomDockRef,
|
|
22072
21994
|
bottomDockLiftedPrompt,
|
|
22073
21995
|
bottomDockReplacementPrompt,
|
|
22074
|
-
usageAlert: viewModel.usageAlert,
|
|
22075
|
-
usagePercent: viewModel.usage?.percentUsed ?? null,
|
|
22076
|
-
usageAlertShowCompactAction: viewModel.compactSupported !== false,
|
|
22077
|
-
usageAlertLabels: labels,
|
|
22078
|
-
onUsageAlertCompact: handleUsageAlertCompact,
|
|
22079
|
-
onUsageAlertDismiss: actions.dismissUsageAlert,
|
|
22080
21996
|
store: bottomDockStore,
|
|
22081
21997
|
storeRevision: bottomDockStoreRevision,
|
|
22082
21998
|
keyboardShortcutsEnabled: isActive,
|
|
@@ -22242,57 +22158,6 @@ function EmptyHeroTitle({
|
|
|
22242
22158
|
label.slice(providerEnd)
|
|
22243
22159
|
] });
|
|
22244
22160
|
}
|
|
22245
|
-
function AgentUsageAlertBanner({
|
|
22246
|
-
tier,
|
|
22247
|
-
percent,
|
|
22248
|
-
showCompactAction,
|
|
22249
|
-
labels,
|
|
22250
|
-
onCompact,
|
|
22251
|
-
onDismiss
|
|
22252
|
-
}) {
|
|
22253
|
-
"use memo";
|
|
22254
|
-
const resolvedPercent = percent ?? (tier === "critical" ? USAGE_CRITICAL_PERCENT : USAGE_WARN_PERCENT);
|
|
22255
|
-
const message = tier === "critical" ? labels.usageAlertCriticalMessage({ percent: resolvedPercent }) : labels.usageAlertWarnMessage({ percent: resolvedPercent });
|
|
22256
|
-
return /* @__PURE__ */ jsxs15(
|
|
22257
|
-
"div",
|
|
22258
|
-
{
|
|
22259
|
-
className: AgentGUINode_styles_default.usageAlertBanner,
|
|
22260
|
-
"data-testid": "agent-gui-usage-alert",
|
|
22261
|
-
"data-usage-alert-tier": tier,
|
|
22262
|
-
role: tier === "critical" ? "alert" : "status",
|
|
22263
|
-
children: [
|
|
22264
|
-
/* @__PURE__ */ jsx29("span", { className: AgentGUINode_styles_default.usageAlertMessage, children: message }),
|
|
22265
|
-
/* @__PURE__ */ jsxs15("span", { className: AgentGUINode_styles_default.usageAlertActions, children: [
|
|
22266
|
-
tier === "critical" && showCompactAction ? /* @__PURE__ */ jsx29(
|
|
22267
|
-
Button,
|
|
22268
|
-
{
|
|
22269
|
-
type: "button",
|
|
22270
|
-
variant: "ghost",
|
|
22271
|
-
size: "sm",
|
|
22272
|
-
"data-testid": "agent-gui-usage-alert-compact",
|
|
22273
|
-
onClick: onCompact,
|
|
22274
|
-
children: labels.usageCompactAction
|
|
22275
|
-
}
|
|
22276
|
-
) : null,
|
|
22277
|
-
/* @__PURE__ */ jsx29(
|
|
22278
|
-
Button,
|
|
22279
|
-
{
|
|
22280
|
-
type: "button",
|
|
22281
|
-
variant: "ghost",
|
|
22282
|
-
size: "icon-xs",
|
|
22283
|
-
className: AgentGUINode_styles_default.usageAlertDismiss,
|
|
22284
|
-
"data-testid": "agent-gui-usage-alert-dismiss",
|
|
22285
|
-
"aria-label": labels.usageAlertDismiss,
|
|
22286
|
-
title: labels.usageAlertDismiss,
|
|
22287
|
-
onClick: onDismiss,
|
|
22288
|
-
children: /* @__PURE__ */ jsx29(X2, { size: 14, strokeWidth: 2, "aria-hidden": "true" })
|
|
22289
|
-
}
|
|
22290
|
-
)
|
|
22291
|
-
] })
|
|
22292
|
-
]
|
|
22293
|
-
}
|
|
22294
|
-
);
|
|
22295
|
-
}
|
|
22296
22161
|
var AgentGUIBottomDockPane = memo(function AgentGUIBottomDockPane2({
|
|
22297
22162
|
bottomDockRef,
|
|
22298
22163
|
bottomDockLiftedPrompt,
|
|
@@ -22300,12 +22165,6 @@ var AgentGUIBottomDockPane = memo(function AgentGUIBottomDockPane2({
|
|
|
22300
22165
|
store,
|
|
22301
22166
|
storeRevision: _storeRevision,
|
|
22302
22167
|
keyboardShortcutsEnabled,
|
|
22303
|
-
usageAlert,
|
|
22304
|
-
usagePercent,
|
|
22305
|
-
usageAlertShowCompactAction,
|
|
22306
|
-
usageAlertLabels,
|
|
22307
|
-
onUsageAlertCompact,
|
|
22308
|
-
onUsageAlertDismiss,
|
|
22309
22168
|
chromeLabels,
|
|
22310
22169
|
goalBannerLabels,
|
|
22311
22170
|
promptLabels,
|
|
@@ -22357,17 +22216,6 @@ var AgentGUIBottomDockPane = memo(function AgentGUIBottomDockPane2({
|
|
|
22357
22216
|
)
|
|
22358
22217
|
}
|
|
22359
22218
|
) : null,
|
|
22360
|
-
usageAlert ? /* @__PURE__ */ jsx29(
|
|
22361
|
-
AgentUsageAlertBanner,
|
|
22362
|
-
{
|
|
22363
|
-
tier: usageAlert,
|
|
22364
|
-
percent: usagePercent,
|
|
22365
|
-
showCompactAction: usageAlertShowCompactAction,
|
|
22366
|
-
labels: usageAlertLabels,
|
|
22367
|
-
onCompact: onUsageAlertCompact,
|
|
22368
|
-
onDismiss: onUsageAlertDismiss
|
|
22369
|
-
}
|
|
22370
|
-
) : null,
|
|
22371
22219
|
inlineNoticeChrome ? /* @__PURE__ */ jsx29(
|
|
22372
22220
|
AgentSessionChrome,
|
|
22373
22221
|
{
|
|
@@ -24385,13 +24233,6 @@ var AgentGUINode = memo2(function AgentGUINode2({
|
|
|
24385
24233
|
usageTokensLabel: t("agentHost.agentGui.usageTokensLabel"),
|
|
24386
24234
|
usageLimitsLabel: t("agentHost.agentGui.usageLimitsLabel"),
|
|
24387
24235
|
usageCompactAction: t("agentHost.agentGui.usageCompactAction"),
|
|
24388
|
-
usageAlertWarnMessage: (input) => t("agentHost.agentGui.usageAlertWarnMessage", {
|
|
24389
|
-
percent: input.percent
|
|
24390
|
-
}),
|
|
24391
|
-
usageAlertCriticalMessage: (input) => t("agentHost.agentGui.usageAlertCriticalMessage", {
|
|
24392
|
-
percent: input.percent
|
|
24393
|
-
}),
|
|
24394
|
-
usageAlertDismiss: t("agentHost.agentGui.usageAlertDismiss"),
|
|
24395
24236
|
planImplementationLead: t("agentHost.agentGui.planImplementationLead"),
|
|
24396
24237
|
planImplementationConfirm: t(
|
|
24397
24238
|
"agentHost.agentGui.planImplementationConfirm"
|