@tutti-os/agent-gui 0.0.210 → 0.0.212
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 +3 -1
- package/dist/{AgentRichTextReadonly-DFWY2WYO.js → AgentRichTextReadonly-WWU4ZF7W.js} +5 -5
- package/dist/agent-conversation/index.d.ts +1 -1
- package/dist/agent-conversation/index.js +8 -8
- package/dist/agent-conversation/interactive-answer.d.ts +34 -0
- package/dist/agent-conversation/interactive-answer.js +11 -0
- package/dist/agent-conversation/interactive-answer.js.map +1 -0
- package/dist/agent-gui.d.ts +7 -4
- package/dist/agent-gui.js +16 -15
- package/dist/agent-message-center/index.js +8 -7
- package/dist/agent-message-center/index.js.map +1 -1
- package/dist/{agentFileMentionContracts-B0yQizXB.d.ts → agentFileMentionContracts-BeBex-Sf.d.ts} +5 -0
- package/dist/{agentGuiNodeTypes-DTeerTzS.d.ts → agentGuiNodeTypes-BMcpfKTn.d.ts} +5 -1
- package/dist/app/renderer/agentactivity.css +50 -0
- package/dist/app/renderer/assets/icons/agents/tutti-mode.png +0 -0
- package/dist/app/renderer/assets/icons/tutti-intensity-handle-balance.png +0 -0
- package/dist/app/renderer/assets/icons/tutti-intensity-handle-cost.png +0 -0
- package/dist/app/renderer/assets/icons/tutti-intensity-handle-powerful.png +0 -0
- package/dist/app/renderer/assets/icons/tutti-mode-lined.svg +3 -0
- package/dist/{chunk-6LXC5BME.js → chunk-4DAJ5SVX.js} +11 -5
- package/dist/chunk-4DAJ5SVX.js.map +1 -0
- package/dist/{chunk-Y6M27YYS.js → chunk-4IJYTGS2.js} +670 -619
- package/dist/chunk-4IJYTGS2.js.map +1 -0
- package/dist/{chunk-DKRX5IZS.js → chunk-5UOJCDLE.js} +8 -8
- package/dist/{chunk-M2VRYG7U.js → chunk-62LWOH3P.js} +13 -17
- package/dist/chunk-62LWOH3P.js.map +1 -0
- package/dist/{chunk-HXAOFFZJ.js → chunk-7LSLB7CN.js} +2 -2
- package/dist/{chunk-CKUR2VKA.js → chunk-BGNYUYLP.js} +2 -2
- package/dist/chunk-FMTWYOHM.js +25 -0
- package/dist/chunk-FMTWYOHM.js.map +1 -0
- package/dist/{chunk-JRYR2EA5.js → chunk-FRSV66P3.js} +171 -36
- package/dist/chunk-FRSV66P3.js.map +1 -0
- package/dist/{chunk-THRBLO2B.js → chunk-GXXPUEX6.js} +2 -2
- package/dist/{chunk-FWR5BZYR.js → chunk-JUL7J4VN.js} +2 -2
- package/dist/{chunk-RAO2PI3T.js → chunk-JVVLKTLR.js} +18 -32
- package/dist/chunk-JVVLKTLR.js.map +1 -0
- package/dist/{chunk-5RZVXSQQ.js → chunk-POU5WZNH.js} +7 -2
- package/dist/chunk-POU5WZNH.js.map +1 -0
- package/dist/{chunk-CCFYCSBK.js → chunk-RNBZBBI7.js} +13 -13
- package/dist/{chunk-VGPFDVSK.js → chunk-WSIGQG7C.js} +3 -3
- package/dist/{chunk-V2MU37VN.js → chunk-YJ27WHM3.js} +2 -2
- package/dist/context-mention-palette/index.d.ts +1 -1
- package/dist/context-mention-palette/index.js +8 -8
- package/dist/i18n/index.d.ts +12 -16
- package/dist/i18n/index.js +2 -2
- package/dist/index.d.ts +27 -21
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/mention-search.d.ts +2 -2
- package/dist/mention-search.js +6 -6
- package/dist/workbench/contribution.js +3 -3
- package/dist/workbench/index.js +6 -6
- package/dist/workbench/sessionTitle.js +2 -2
- package/package.json +21 -14
- package/dist/chunk-5RZVXSQQ.js.map +0 -1
- package/dist/chunk-6LXC5BME.js.map +0 -1
- package/dist/chunk-JRYR2EA5.js.map +0 -1
- package/dist/chunk-M2VRYG7U.js.map +0 -1
- package/dist/chunk-RAO2PI3T.js.map +0 -1
- package/dist/chunk-Y6M27YYS.js.map +0 -1
- /package/dist/{AgentRichTextReadonly-DFWY2WYO.js.map → AgentRichTextReadonly-WWU4ZF7W.js.map} +0 -0
- /package/dist/{chunk-DKRX5IZS.js.map → chunk-5UOJCDLE.js.map} +0 -0
- /package/dist/{chunk-HXAOFFZJ.js.map → chunk-7LSLB7CN.js.map} +0 -0
- /package/dist/{chunk-CKUR2VKA.js.map → chunk-BGNYUYLP.js.map} +0 -0
- /package/dist/{chunk-THRBLO2B.js.map → chunk-GXXPUEX6.js.map} +0 -0
- /package/dist/{chunk-FWR5BZYR.js.map → chunk-JUL7J4VN.js.map} +0 -0
- /package/dist/{chunk-CCFYCSBK.js.map → chunk-RNBZBBI7.js.map} +0 -0
- /package/dist/{chunk-VGPFDVSK.js.map → chunk-WSIGQG7C.js.map} +0 -0
- /package/dist/{chunk-V2MU37VN.js.map → chunk-YJ27WHM3.js.map} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// shared/agentConversation/interactiveAnswerPayload.ts
|
|
2
|
+
function readOwnAnswer(values, questionID, fallback) {
|
|
3
|
+
return Object.prototype.hasOwnProperty.call(values, questionID) ? values[questionID] : fallback;
|
|
4
|
+
}
|
|
5
|
+
function writeOwnAnswer(values, questionID, value) {
|
|
6
|
+
Object.defineProperty(values, questionID, {
|
|
7
|
+
configurable: true,
|
|
8
|
+
enumerable: true,
|
|
9
|
+
value,
|
|
10
|
+
writable: true
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function buildAskUserAnswerPayload(answersByQuestionId) {
|
|
14
|
+
const answers = Object.values(answersByQuestionId).map(
|
|
15
|
+
(value) => Array.isArray(value) ? value.join(", ") : value
|
|
16
|
+
);
|
|
17
|
+
return { answers, answersByQuestionId };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
readOwnAnswer,
|
|
22
|
+
writeOwnAnswer,
|
|
23
|
+
buildAskUserAnswerPayload
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=chunk-FMTWYOHM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../shared/agentConversation/interactiveAnswerPayload.ts"],"sourcesContent":["/**\n * Wire contract for the answer submitted back to an interactive `ask-user`\n * prompt. This payload crosses the renderer → daemon boundary (it rides\n * `submitInteractive({ action: \"submit\", payload })`), so its shape is a\n * cross-language contract, not an internal detail.\n *\n * Consumers that MUST stay in sync with this shape:\n * - daemon (Go) standard ACP adapter — forwards `answersByQuestionId` verbatim.\n * - daemon (Go) codex app-server adapter — `appServerUserInputAnswers` reshapes\n * `answersByQuestionId` into codex's `requestUserInput` response.\n *\n * Field semantics:\n * - `answersByQuestionId` is the canonical, machine-readable answer: question id\n * → the chosen option label(s) / free text. This is what providers consume.\n * - `answers` is a flat, human-readable display list (one entry per answered\n * question, multi-select joined). Never the source of truth for routing.\n *\n * Always build this with {@link buildAskUserAnswerPayload} so producers can't\n * drift on field names or which field is authoritative.\n */\nexport interface InteractiveAnswerPayload {\n answers: string[];\n answersByQuestionId: Record<string, string | string[]>;\n}\n\nexport function readOwnAnswer<T>(\n values: Record<string, T>,\n questionID: string,\n fallback: T\n): T {\n return Object.prototype.hasOwnProperty.call(values, questionID)\n ? values[questionID]!\n : fallback;\n}\n\nexport function writeOwnAnswer<T>(\n values: Record<string, T>,\n questionID: string,\n value: T\n): void {\n Object.defineProperty(values, questionID, {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n}\n\n/**\n * Builds the canonical interactive answer payload from the per-question answers.\n * `answers` is derived from `answersByQuestionId` (multi-select values joined)\n * so the two fields can never disagree.\n */\nexport function buildAskUserAnswerPayload(\n answersByQuestionId: Record<string, string | string[]>\n): InteractiveAnswerPayload {\n const answers = Object.values(answersByQuestionId).map((value) =>\n Array.isArray(value) ? value.join(\", \") : value\n );\n return { answers, answersByQuestionId };\n}\n"],"mappings":";AAyBO,SAAS,cACd,QACA,YACA,UACG;AACH,SAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,UAAU,IAC1D,OAAO,UAAU,IACjB;AACN;AAEO,SAAS,eACd,QACA,YACA,OACM;AACN,SAAO,eAAe,QAAQ,YAAY;AAAA,IACxC,cAAc;AAAA,IACd,YAAY;AAAA,IACZ;AAAA,IACA,UAAU;AAAA,EACZ,CAAC;AACH;AAOO,SAAS,0BACd,qBAC0B;AAC1B,QAAM,UAAU,OAAO,OAAO,mBAAmB,EAAE;AAAA,IAAI,CAAC,UACtD,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK,IAAI,IAAI;AAAA,EAC5C;AACA,SAAO,EAAE,SAAS,oBAAoB;AACxC;","names":[]}
|
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
isWorkspaceAgentSyntheticControlMessage
|
|
7
7
|
} from "./chunk-XJ34OIEQ.js";
|
|
8
8
|
import {
|
|
9
|
-
normalizeAgentSessionMentionTitle
|
|
10
|
-
|
|
9
|
+
normalizeAgentSessionMentionTitle,
|
|
10
|
+
resolveAgentSessionMentionIconUrl
|
|
11
|
+
} from "./chunk-POU5WZNH.js";
|
|
11
12
|
import {
|
|
12
13
|
resolveAgentMentionFileThumbnailUrl
|
|
13
14
|
} from "./chunk-3V5OCA2M.js";
|
|
@@ -20,11 +21,11 @@ import {
|
|
|
20
21
|
import {
|
|
21
22
|
getOptionalAgentHostApi,
|
|
22
23
|
workspaceAgentProviderLabel
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-JUL7J4VN.js";
|
|
24
25
|
import {
|
|
25
26
|
translate,
|
|
26
27
|
translateInUiLanguage
|
|
27
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-GXXPUEX6.js";
|
|
28
29
|
import {
|
|
29
30
|
normalizeAgentTitleText
|
|
30
31
|
} from "./chunk-MIJXEELH.js";
|
|
@@ -634,6 +635,7 @@ function agentGeneratedMentionItemKey(item) {
|
|
|
634
635
|
}
|
|
635
636
|
|
|
636
637
|
// agent-gui/agentGuiNode/AgentMentionSearchModel.ts
|
|
638
|
+
import { resolveReferenceProvenanceAgentLabelParts } from "@tutti-os/workspace-file-reference/core";
|
|
637
639
|
function buildAgentMentionGroups(input) {
|
|
638
640
|
if (input.currentFilter === "issue" && input.issueTopicGroups !== null) {
|
|
639
641
|
return input.issueTopicGroups.map((group) => ({
|
|
@@ -717,26 +719,35 @@ function buildAgentProvenanceGroups(input) {
|
|
|
717
719
|
}
|
|
718
720
|
const selectedAgentTargetIds = input.provenanceFilter?.agentTargetIds ?? null;
|
|
719
721
|
const selectedAgentTargetIdSet = selectedAgentTargetIds === null ? null : new Set(selectedAgentTargetIds);
|
|
720
|
-
const
|
|
722
|
+
const memberOptionsById = new Map(
|
|
723
|
+
input.provenanceCatalog.memberOptions.map((member) => [member.id, member])
|
|
724
|
+
);
|
|
725
|
+
const agentOptionsById = new Map(
|
|
726
|
+
input.provenanceCatalog.agentOptions.map((agent) => [agent.id, agent])
|
|
727
|
+
);
|
|
728
|
+
const sourceItems = agentProvenanceItemsForFilter(input).map(
|
|
729
|
+
(item) => projectAgentProvenanceMemberPresentation(
|
|
730
|
+
item,
|
|
731
|
+
memberOptionsById,
|
|
732
|
+
agentOptionsById
|
|
733
|
+
)
|
|
734
|
+
).filter((item) => {
|
|
721
735
|
if (selectedAgentTargetIdSet === null) {
|
|
722
736
|
return true;
|
|
723
737
|
}
|
|
724
738
|
const agentTargetId = agentTargetIdForMentionItem(item);
|
|
725
739
|
return agentTargetId !== null && selectedAgentTargetIdSet.has(agentTargetId);
|
|
726
740
|
});
|
|
727
|
-
const
|
|
728
|
-
input.provenanceCatalog.agentOptions.map((option) => option.id)
|
|
729
|
-
);
|
|
741
|
+
const cataloguedItemIds = /* @__PURE__ */ new Set();
|
|
730
742
|
const catalogGroups = agentProvenanceGroupSpecs(
|
|
743
|
+
input.currentFilter,
|
|
731
744
|
input.provenanceCatalog
|
|
732
745
|
).flatMap((group) => {
|
|
733
|
-
const items = sourceItems.filter(
|
|
734
|
-
const agentTargetId = agentTargetIdForMentionItem(item);
|
|
735
|
-
return agentTargetId !== null && group.agentTargetIds.has(agentTargetId);
|
|
736
|
-
});
|
|
746
|
+
const items = sourceItems.filter(group.matches);
|
|
737
747
|
if (items.length === 0) {
|
|
738
748
|
return [];
|
|
739
749
|
}
|
|
750
|
+
items.forEach((item) => cataloguedItemIds.add(item.targetId));
|
|
740
751
|
return [
|
|
741
752
|
buildAgentProvenanceGroup({
|
|
742
753
|
currentFilter: input.currentFilter,
|
|
@@ -752,8 +763,7 @@ function buildAgentProvenanceGroups(input) {
|
|
|
752
763
|
}
|
|
753
764
|
const unmatchedGroups = /* @__PURE__ */ new Map();
|
|
754
765
|
for (const item of sourceItems) {
|
|
755
|
-
|
|
756
|
-
if (agentTargetId && catalogAgentTargetIds.has(agentTargetId)) {
|
|
766
|
+
if (cataloguedItemIds.has(item.targetId)) {
|
|
757
767
|
continue;
|
|
758
768
|
}
|
|
759
769
|
const identity = unmatchedAgentProvenanceIdentity(item);
|
|
@@ -780,7 +790,14 @@ function buildAgentProvenanceGroups(input) {
|
|
|
780
790
|
)
|
|
781
791
|
];
|
|
782
792
|
}
|
|
783
|
-
function agentProvenanceGroupSpecs(catalog) {
|
|
793
|
+
function agentProvenanceGroupSpecs(currentFilter, catalog) {
|
|
794
|
+
if (currentFilter === "session") {
|
|
795
|
+
return catalog.memberOptions.map((member) => ({
|
|
796
|
+
id: memberProvenanceMentionGroupId(member.id),
|
|
797
|
+
label: member.label,
|
|
798
|
+
matches: (item) => item.kind === "session" && item.initiatorUserId?.trim() === member.id
|
|
799
|
+
}));
|
|
800
|
+
}
|
|
784
801
|
const groupedAgentTargetIds = /* @__PURE__ */ new Set();
|
|
785
802
|
const memberGroups = catalog.memberOptions.flatMap((member) => {
|
|
786
803
|
const agentTargetIds = catalog.agentOptions.flatMap(
|
|
@@ -796,7 +813,10 @@ function agentProvenanceGroupSpecs(catalog) {
|
|
|
796
813
|
{
|
|
797
814
|
id: memberProvenanceMentionGroupId(member.id),
|
|
798
815
|
label: member.label,
|
|
799
|
-
|
|
816
|
+
matches: (item) => {
|
|
817
|
+
const agentTargetId = agentTargetIdForMentionItem(item);
|
|
818
|
+
return agentTargetId !== null && agentTargetIds.includes(agentTargetId);
|
|
819
|
+
}
|
|
800
820
|
}
|
|
801
821
|
];
|
|
802
822
|
});
|
|
@@ -805,7 +825,7 @@ function agentProvenanceGroupSpecs(catalog) {
|
|
|
805
825
|
{
|
|
806
826
|
id: agentProvenanceMentionGroupId(option.id),
|
|
807
827
|
label: option.label,
|
|
808
|
-
|
|
828
|
+
matches: (item) => agentTargetIdForMentionItem(item) === option.id
|
|
809
829
|
}
|
|
810
830
|
]
|
|
811
831
|
);
|
|
@@ -826,15 +846,41 @@ function agentTargetIdForMentionItem(item) {
|
|
|
826
846
|
}
|
|
827
847
|
return null;
|
|
828
848
|
}
|
|
849
|
+
function projectAgentProvenanceMemberPresentation(item, memberOptionsById, agentOptionsById) {
|
|
850
|
+
if (item.kind !== "session") {
|
|
851
|
+
return item;
|
|
852
|
+
}
|
|
853
|
+
const initiatorUserId = item.initiatorUserId?.trim();
|
|
854
|
+
const member = initiatorUserId ? memberOptionsById.get(initiatorUserId) : void 0;
|
|
855
|
+
if (!member) {
|
|
856
|
+
return item;
|
|
857
|
+
}
|
|
858
|
+
const initiatorAvatarUrl = member.iconUrl?.trim() || item.initiatorAvatarUrl?.trim();
|
|
859
|
+
const agentTargetId = item.agentTargetId?.trim();
|
|
860
|
+
const agentOption = agentTargetId ? agentOptionsById.get(agentTargetId) : void 0;
|
|
861
|
+
const agentLabelParts = agentOption && agentOption.label === item.agentName ? resolveReferenceProvenanceAgentLabelParts(
|
|
862
|
+
agentOption,
|
|
863
|
+
memberOptionsById
|
|
864
|
+
) : null;
|
|
865
|
+
return {
|
|
866
|
+
...item,
|
|
867
|
+
initiatorName: member.label,
|
|
868
|
+
...initiatorAvatarUrl ? { initiatorAvatarUrl } : {},
|
|
869
|
+
...agentLabelParts ? {
|
|
870
|
+
agentLabel: agentLabelParts.agentLabel,
|
|
871
|
+
agentOwnerLabel: agentLabelParts.ownerLabel
|
|
872
|
+
} : {}
|
|
873
|
+
};
|
|
874
|
+
}
|
|
829
875
|
function unmatchedAgentProvenanceIdentity(item) {
|
|
830
876
|
if (item.kind === "session") {
|
|
831
|
-
return item.
|
|
877
|
+
return item.initiatorUserId?.trim() || item.targetId;
|
|
832
878
|
}
|
|
833
879
|
return item.targetId;
|
|
834
880
|
}
|
|
835
881
|
function unmatchedAgentProvenanceLabel(item) {
|
|
836
882
|
if (item.kind === "session") {
|
|
837
|
-
return item.
|
|
883
|
+
return item.initiatorName.trim() || item.initiatorUserId?.trim() || item.agentName.trim() || item.title;
|
|
838
884
|
}
|
|
839
885
|
return item.name;
|
|
840
886
|
}
|
|
@@ -1091,9 +1137,14 @@ function providerItemToAgentMentionItem(input) {
|
|
|
1091
1137
|
rawScope: scope.scope,
|
|
1092
1138
|
userId: scope.userId
|
|
1093
1139
|
}),
|
|
1140
|
+
...scope.userId ? { initiatorUserId: scope.userId } : {},
|
|
1094
1141
|
initiatorName: "",
|
|
1095
1142
|
agentName,
|
|
1096
|
-
agentIconUrl:
|
|
1143
|
+
agentIconUrl: resolveAgentSessionMentionIconUrl({
|
|
1144
|
+
agentIconUrl: presentation.agentIconUrl?.trim() || presentation.iconUrl?.trim() || void 0,
|
|
1145
|
+
agentProviderId: presentation.agentProviderId,
|
|
1146
|
+
agentTargetId: scope.agentTargetId
|
|
1147
|
+
}),
|
|
1097
1148
|
...scope.agentTargetId ? { agentTargetId: scope.agentTargetId } : {},
|
|
1098
1149
|
status: presentation.status?.trim() || void 0,
|
|
1099
1150
|
inputPreview: description || void 0,
|
|
@@ -1673,15 +1724,42 @@ async function queryAgentMentionProviderItems(input) {
|
|
|
1673
1724
|
}
|
|
1674
1725
|
}
|
|
1675
1726
|
};
|
|
1676
|
-
const items =
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
}
|
|
1727
|
+
const items = await input.provider.query(queryInput);
|
|
1728
|
+
if (input.abortSignal.aborted) {
|
|
1729
|
+
return [];
|
|
1730
|
+
}
|
|
1731
|
+
return mapProviderItemsToAgentMentionItems({
|
|
1732
|
+
...input,
|
|
1733
|
+
items
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
async function queryAgentMentionProviderDirectoryItems(input) {
|
|
1737
|
+
const provider = input.provider;
|
|
1738
|
+
if (!provider?.queryDirectory) {
|
|
1739
|
+
throw new Error("Mention provider does not support directory browsing.");
|
|
1740
|
+
}
|
|
1741
|
+
const items = await provider.queryDirectory({
|
|
1742
|
+
keyword: "",
|
|
1743
|
+
abortSignal: input.abortSignal,
|
|
1744
|
+
trigger: "@",
|
|
1745
|
+
directoryPath: input.directoryPath,
|
|
1746
|
+
context: {
|
|
1747
|
+
metadata: {
|
|
1748
|
+
currentUserId: input.currentUserId,
|
|
1749
|
+
sectionKey: input.sectionKey || void 0,
|
|
1750
|
+
sessionCwd: input.sessionCwd || void 0,
|
|
1751
|
+
target: "agent-gui",
|
|
1752
|
+
workspaceId: input.workspaceId,
|
|
1753
|
+
referenceProvenanceFilter: input.provenanceFilter ?? void 0
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
});
|
|
1680
1757
|
if (input.abortSignal.aborted) {
|
|
1681
1758
|
return [];
|
|
1682
1759
|
}
|
|
1683
1760
|
return mapProviderItemsToAgentMentionItems({
|
|
1684
1761
|
...input,
|
|
1762
|
+
provider,
|
|
1685
1763
|
items
|
|
1686
1764
|
});
|
|
1687
1765
|
}
|
|
@@ -2172,7 +2250,6 @@ var AgentMentionSearchControllerBase = class {
|
|
|
2172
2250
|
provider,
|
|
2173
2251
|
workspaceId: input.workspaceId,
|
|
2174
2252
|
currentUserId: input.currentUserId,
|
|
2175
|
-
directoryPath: input.directoryPath,
|
|
2176
2253
|
query: input.query,
|
|
2177
2254
|
limit: input.limit,
|
|
2178
2255
|
sectionKey: input.sectionKey ?? this.currentSectionKey,
|
|
@@ -2370,6 +2447,38 @@ var AgentMentionSearchControllerBase = class {
|
|
|
2370
2447
|
}
|
|
2371
2448
|
};
|
|
2372
2449
|
|
|
2450
|
+
// agent-gui/agentGuiNode/AgentMentionDirectoryRequestLifecycle.ts
|
|
2451
|
+
var AgentMentionDirectoryRequestLifecycle = class {
|
|
2452
|
+
requestId = 0;
|
|
2453
|
+
abortController = null;
|
|
2454
|
+
start() {
|
|
2455
|
+
this.abortActiveRequest();
|
|
2456
|
+
const abortController = new AbortController();
|
|
2457
|
+
const requestId = ++this.requestId;
|
|
2458
|
+
this.abortController = abortController;
|
|
2459
|
+
return {
|
|
2460
|
+
requestId,
|
|
2461
|
+
abortSignal: abortController.signal
|
|
2462
|
+
};
|
|
2463
|
+
}
|
|
2464
|
+
cancel() {
|
|
2465
|
+
this.abortActiveRequest();
|
|
2466
|
+
this.requestId += 1;
|
|
2467
|
+
}
|
|
2468
|
+
canApply(scope) {
|
|
2469
|
+
return !scope.disposed && scope.requestId === this.requestId && this.abortController?.signal.aborted === false && scope.workspaceId === scope.activeWorkspaceId && scope.filter === "file" && scope.query === "" && scope.activeDirectoryPath === scope.directoryPath;
|
|
2470
|
+
}
|
|
2471
|
+
finish(requestId) {
|
|
2472
|
+
if (requestId === this.requestId) {
|
|
2473
|
+
this.abortController = null;
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
abortActiveRequest() {
|
|
2477
|
+
this.abortController?.abort();
|
|
2478
|
+
this.abortController = null;
|
|
2479
|
+
}
|
|
2480
|
+
};
|
|
2481
|
+
|
|
2373
2482
|
// agent-gui/agentGuiNode/AgentMentionSearchController.ts
|
|
2374
2483
|
import { referenceProvenanceFilterCacheKey as referenceProvenanceFilterCacheKey2 } from "@tutti-os/workspace-file-reference/core";
|
|
2375
2484
|
|
|
@@ -2400,6 +2509,7 @@ function parentWorkspaceFileDirectoryPath(path) {
|
|
|
2400
2509
|
// agent-gui/agentGuiNode/AgentMentionSearchController.ts
|
|
2401
2510
|
var AgentMentionSearchController = class extends AgentMentionSearchControllerBase {
|
|
2402
2511
|
issueLoadMoreRequests = /* @__PURE__ */ new Map();
|
|
2512
|
+
directoryRequestLifecycle = new AgentMentionDirectoryRequestLifecycle();
|
|
2403
2513
|
setProvenanceCatalog(catalog) {
|
|
2404
2514
|
if (this.currentProvenanceCatalog === catalog) return;
|
|
2405
2515
|
this.currentProvenanceCatalog = catalog;
|
|
@@ -2443,6 +2553,7 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
|
|
|
2443
2553
|
this.currentQuery = normalizeQuery(input.query);
|
|
2444
2554
|
this.clearTimer();
|
|
2445
2555
|
this.abortActiveRequest();
|
|
2556
|
+
this.directoryRequestLifecycle.cancel();
|
|
2446
2557
|
this.cancelIssueLoadMoreRequests();
|
|
2447
2558
|
const requestId = ++this.requestId;
|
|
2448
2559
|
this.resetAgentGeneratedBrowsePath();
|
|
@@ -2497,6 +2608,7 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
|
|
|
2497
2608
|
this.currentFilter = filter;
|
|
2498
2609
|
this.clearTimer();
|
|
2499
2610
|
this.abortActiveRequest();
|
|
2611
|
+
this.directoryRequestLifecycle.cancel();
|
|
2500
2612
|
this.cancelIssueLoadMoreRequests();
|
|
2501
2613
|
const requestId = ++this.requestId;
|
|
2502
2614
|
this.resetAgentGeneratedBrowsePath();
|
|
@@ -2716,6 +2828,7 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
|
|
|
2716
2828
|
this.loadWorkspaceFileDirectory(parentPath);
|
|
2717
2829
|
return true;
|
|
2718
2830
|
}
|
|
2831
|
+
this.directoryRequestLifecycle.cancel();
|
|
2719
2832
|
this.startBrowseModeFetch("file");
|
|
2720
2833
|
return true;
|
|
2721
2834
|
}
|
|
@@ -2723,8 +2836,10 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
|
|
|
2723
2836
|
this.clearTimer();
|
|
2724
2837
|
this.abortActiveRequest();
|
|
2725
2838
|
this.cancelIssueLoadMoreRequests();
|
|
2726
|
-
|
|
2839
|
+
this.requestId += 1;
|
|
2727
2840
|
const workspaceId = this.activeWorkspaceId;
|
|
2841
|
+
const provider = this.contextMentionProviders.get(FILE_PROVIDER_ID);
|
|
2842
|
+
const directoryRequest = this.directoryRequestLifecycle.start();
|
|
2728
2843
|
this.setState({
|
|
2729
2844
|
status: "loading",
|
|
2730
2845
|
query: "",
|
|
@@ -2734,21 +2849,29 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
|
|
|
2734
2849
|
groups: this.groupsFromRawGroups(),
|
|
2735
2850
|
error: null
|
|
2736
2851
|
});
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
abortSignal,
|
|
2741
|
-
diagnostics,
|
|
2852
|
+
void queryAgentMentionProviderDirectoryItems({
|
|
2853
|
+
abortSignal: directoryRequest.abortSignal,
|
|
2854
|
+
provider,
|
|
2742
2855
|
directoryPath,
|
|
2743
|
-
providerId: FILE_PROVIDER_ID,
|
|
2744
2856
|
workspaceId,
|
|
2745
2857
|
currentUserId: this.currentUserId,
|
|
2746
|
-
|
|
2858
|
+
sectionKey: this.currentSectionKey,
|
|
2859
|
+
sessionCwd: this.currentSessionCwd,
|
|
2747
2860
|
provenanceFilter: this.currentProvenanceFilter
|
|
2748
2861
|
}).then((items) => {
|
|
2749
|
-
if (!this.canApply(
|
|
2862
|
+
if (!this.directoryRequestLifecycle.canApply({
|
|
2863
|
+
activeDirectoryPath: this.workspaceFileBrowsePaths.at(-1),
|
|
2864
|
+
activeWorkspaceId: this.activeWorkspaceId,
|
|
2865
|
+
directoryPath,
|
|
2866
|
+
disposed: this.disposed,
|
|
2867
|
+
filter: this.currentFilter,
|
|
2868
|
+
query: this.currentQuery,
|
|
2869
|
+
requestId: directoryRequest.requestId,
|
|
2870
|
+
workspaceId
|
|
2871
|
+
})) {
|
|
2750
2872
|
return;
|
|
2751
2873
|
}
|
|
2874
|
+
this.directoryRequestLifecycle.finish(directoryRequest.requestId);
|
|
2752
2875
|
this.rawGroups.opened_files = presentWorkspaceFileDirectoryMentionItems(
|
|
2753
2876
|
{
|
|
2754
2877
|
browsePath: directoryPath,
|
|
@@ -2766,9 +2889,19 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
|
|
|
2766
2889
|
error: null
|
|
2767
2890
|
});
|
|
2768
2891
|
}).catch((error) => {
|
|
2769
|
-
if (!this.canApply(
|
|
2892
|
+
if (!this.directoryRequestLifecycle.canApply({
|
|
2893
|
+
activeDirectoryPath: this.workspaceFileBrowsePaths.at(-1),
|
|
2894
|
+
activeWorkspaceId: this.activeWorkspaceId,
|
|
2895
|
+
directoryPath,
|
|
2896
|
+
disposed: this.disposed,
|
|
2897
|
+
filter: this.currentFilter,
|
|
2898
|
+
query: this.currentQuery,
|
|
2899
|
+
requestId: directoryRequest.requestId,
|
|
2900
|
+
workspaceId
|
|
2901
|
+
})) {
|
|
2770
2902
|
return;
|
|
2771
2903
|
}
|
|
2904
|
+
this.directoryRequestLifecycle.finish(directoryRequest.requestId);
|
|
2772
2905
|
this.setState({
|
|
2773
2906
|
status: "error",
|
|
2774
2907
|
query: "",
|
|
@@ -2848,6 +2981,7 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
|
|
|
2848
2981
|
close() {
|
|
2849
2982
|
this.clearTimer();
|
|
2850
2983
|
this.abortActiveRequest();
|
|
2984
|
+
this.directoryRequestLifecycle.cancel();
|
|
2851
2985
|
this.cancelIssueLoadMoreRequests();
|
|
2852
2986
|
this.requestId += 1;
|
|
2853
2987
|
this.currentFilter = DEFAULT_AGENT_MENTION_FILTER;
|
|
@@ -2871,6 +3005,7 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
|
|
|
2871
3005
|
this.disposed = true;
|
|
2872
3006
|
this.clearTimer();
|
|
2873
3007
|
this.abortActiveRequest();
|
|
3008
|
+
this.directoryRequestLifecycle.cancel();
|
|
2874
3009
|
this.cancelIssueLoadMoreRequests();
|
|
2875
3010
|
this.cancelPendingPreload();
|
|
2876
3011
|
this.listeners.clear();
|
|
@@ -3049,4 +3184,4 @@ export {
|
|
|
3049
3184
|
AgentMentionSearchController,
|
|
3050
3185
|
preloadAgentMentionBrowse
|
|
3051
3186
|
};
|
|
3052
|
-
//# sourceMappingURL=chunk-
|
|
3187
|
+
//# sourceMappingURL=chunk-FRSV66P3.js.map
|