@nextop-os/workspace-issue-manager 0.0.18 → 0.0.20
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/{chunk-H2ZF6X6A.js → chunk-5Y5GVLKU.js} +21 -1
- package/dist/chunk-5Y5GVLKU.js.map +1 -0
- package/dist/chunk-LEL6VWU4.js +1 -0
- package/dist/{chunk-HKIH3OTZ.js → chunk-V75TAM27.js} +47 -100
- package/dist/chunk-V75TAM27.js.map +1 -0
- package/dist/chunk-XI6VLBSW.js +4391 -0
- package/dist/chunk-XI6VLBSW.js.map +1 -0
- package/dist/chunk-ZWDF5XA7.js +735 -0
- package/dist/chunk-ZWDF5XA7.js.map +1 -0
- package/dist/contracts/index.d.ts +35 -32
- package/dist/core/index.d.ts +44 -0
- package/dist/core/index.js +60 -0
- package/dist/core/index.js.map +1 -0
- package/dist/{feature-Qe1b5W0D.d.ts → feature-2zhsUF_g.d.ts} +5 -0
- package/dist/i18n/index.js +1 -1
- package/dist/index.d.ts +8 -43
- package/dist/index.js +37 -4
- package/dist/issueManagerControllerService.interface-B_Jr7Xw_.d.ts +101 -0
- package/dist/services/index.d.ts +11 -0
- package/dist/services/index.js +24 -0
- package/dist/services/index.js.map +1 -0
- package/dist/{react → ui}/index.d.ts +11 -6
- package/dist/ui/index.js +12 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/workbench/index.d.ts +15 -4
- package/dist/workbench/index.js +46 -9
- package/dist/workbench/index.js.map +1 -1
- package/package.json +21 -10
- package/dist/chunk-H2ZF6X6A.js.map +0 -1
- package/dist/chunk-HKIH3OTZ.js.map +0 -1
- package/dist/chunk-IYLTKFVO.js +0 -3685
- package/dist/chunk-IYLTKFVO.js.map +0 -1
- package/dist/react/index.js +0 -11
- /package/dist/{react/index.js.map → chunk-LEL6VWU4.js.map} +0 -0
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeIssueManagerContent,
|
|
3
|
+
normalizeIssueManagerNodeState
|
|
4
|
+
} from "./chunk-V75TAM27.js";
|
|
5
|
+
|
|
6
|
+
// src/services/internal/model.ts
|
|
7
|
+
import { formatNextopShortDateTime } from "@nextop-os/ui-system/date-format";
|
|
8
|
+
function createIssueManagerDate(value) {
|
|
9
|
+
if (!value || !Number.isFinite(value)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const normalized = value < 1e12 ? value * 1e3 : value;
|
|
13
|
+
const date = new Date(normalized);
|
|
14
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
15
|
+
}
|
|
16
|
+
function formatIssueManagerTimestamp(value) {
|
|
17
|
+
const date = createIssueManagerDate(value);
|
|
18
|
+
return date ? formatNextopShortDateTime(date) : null;
|
|
19
|
+
}
|
|
20
|
+
function formatIssueManagerDate(value) {
|
|
21
|
+
const date = createIssueManagerDate(value);
|
|
22
|
+
return date ? formatNextopShortDateTime(date) : "";
|
|
23
|
+
}
|
|
24
|
+
function resolveIssueManagerStatusLabel(copy, status) {
|
|
25
|
+
switch (status) {
|
|
26
|
+
case "not_started":
|
|
27
|
+
return copy.t("status.notStarted");
|
|
28
|
+
case "running":
|
|
29
|
+
return copy.t("status.running");
|
|
30
|
+
case "pending_acceptance":
|
|
31
|
+
return copy.t("status.pendingAcceptance");
|
|
32
|
+
case "completed":
|
|
33
|
+
return copy.t("status.completed");
|
|
34
|
+
case "failed":
|
|
35
|
+
return copy.t("status.failed");
|
|
36
|
+
case "canceled":
|
|
37
|
+
return copy.t("status.canceled");
|
|
38
|
+
default:
|
|
39
|
+
return copy.t("status.unknown");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function resolveIssueManagerPriorityLabel(copy, priority) {
|
|
43
|
+
switch (priority) {
|
|
44
|
+
case "high":
|
|
45
|
+
return copy.t("priority.high");
|
|
46
|
+
case "low":
|
|
47
|
+
return copy.t("priority.low");
|
|
48
|
+
default:
|
|
49
|
+
return copy.t("priority.medium");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function uniqueIssueManagerFileReferences(refs) {
|
|
53
|
+
const unique = /* @__PURE__ */ new Map();
|
|
54
|
+
for (const ref of refs) {
|
|
55
|
+
const normalizedPath = ref.path.trim();
|
|
56
|
+
if (!normalizedPath || unique.has(normalizedPath)) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
unique.set(normalizedPath, {
|
|
60
|
+
displayName: ref.displayName?.trim() || void 0,
|
|
61
|
+
kind: ref.kind === "folder" ? "folder" : "file",
|
|
62
|
+
path: normalizedPath
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return [...unique.values()];
|
|
66
|
+
}
|
|
67
|
+
function parentDirectoryPath(path) {
|
|
68
|
+
const trimmed = path.trim();
|
|
69
|
+
if (!trimmed || trimmed === "/") {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
const normalized = trimmed.endsWith("/") && trimmed.length > 1 ? trimmed.slice(0, -1) : trimmed;
|
|
73
|
+
const index = normalized.lastIndexOf("/");
|
|
74
|
+
if (index <= 0) {
|
|
75
|
+
return "/";
|
|
76
|
+
}
|
|
77
|
+
return normalized.slice(0, index) || "/";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/services/internal/controllerRuntime.ts
|
|
81
|
+
import { proxy } from "valtio/vanilla";
|
|
82
|
+
|
|
83
|
+
// src/services/internal/controllerUtils.ts
|
|
84
|
+
var defaultTaskPriority = "medium";
|
|
85
|
+
function resolveIssueManagerSelectedIssueId(currentSelectedIssueId, issues) {
|
|
86
|
+
if (currentSelectedIssueId && issues.some((issue) => issue.issueId === currentSelectedIssueId)) {
|
|
87
|
+
return currentSelectedIssueId;
|
|
88
|
+
}
|
|
89
|
+
return issues[0]?.issueId ?? null;
|
|
90
|
+
}
|
|
91
|
+
function resolveIssueManagerSelectedTaskId(currentSelectedTaskId, tasks) {
|
|
92
|
+
if (currentSelectedTaskId && tasks.some((task) => task.taskId === currentSelectedTaskId)) {
|
|
93
|
+
return currentSelectedTaskId;
|
|
94
|
+
}
|
|
95
|
+
return tasks[0]?.taskId ?? null;
|
|
96
|
+
}
|
|
97
|
+
function toContextRefInput(ref) {
|
|
98
|
+
return {
|
|
99
|
+
displayName: ref.displayName,
|
|
100
|
+
path: ref.path,
|
|
101
|
+
refType: ref.kind === "folder" ? "folder" : "file"
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function toIssueManagerWorkspaceFileLinkInput(ref) {
|
|
105
|
+
return {
|
|
106
|
+
kind: ref.kind === "folder" ? "folder" : "file",
|
|
107
|
+
name: ref.displayName,
|
|
108
|
+
path: ref.path
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function confirmIssueManagerMessage(message) {
|
|
112
|
+
try {
|
|
113
|
+
return globalThis.confirm?.(message) ?? true;
|
|
114
|
+
} catch {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function resolveIssueManagerErrorMessage(error, copy, fallbackKey) {
|
|
119
|
+
const raw = error instanceof Error ? error.message : typeof error === "string" ? error : String(error);
|
|
120
|
+
if (!copy) {
|
|
121
|
+
return raw;
|
|
122
|
+
}
|
|
123
|
+
if (raw === "issue_manager.upload_type_conflict") {
|
|
124
|
+
return copy.t("messages.uploadTypeConflict");
|
|
125
|
+
}
|
|
126
|
+
if (raw === "issue_manager.clipboard_unavailable") {
|
|
127
|
+
return copy.t("messages.clipboardUnavailable");
|
|
128
|
+
}
|
|
129
|
+
if (raw === "issue_manager.workspace_path_unavailable") {
|
|
130
|
+
return copy.t("messages.workspacePathUnavailable");
|
|
131
|
+
}
|
|
132
|
+
if (raw === "issue_manager.run_status_missing") {
|
|
133
|
+
return copy.t("messages.runStatusMissing");
|
|
134
|
+
}
|
|
135
|
+
if (raw === "issue_manager.run_timed_out") {
|
|
136
|
+
return copy.t("messages.runTimedOut");
|
|
137
|
+
}
|
|
138
|
+
if (raw.startsWith("issue_manager.run_exit_code:")) {
|
|
139
|
+
return copy.t("messages.runExitCode", {
|
|
140
|
+
code: raw.slice("issue_manager.run_exit_code:".length)
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return fallbackKey ? copy.t(fallbackKey) : raw;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/services/internal/controllerState.ts
|
|
147
|
+
function createIssueManagerIssueDraftFromNodeState(state) {
|
|
148
|
+
return {
|
|
149
|
+
content: state?.issueDraftContent ?? "",
|
|
150
|
+
title: state?.issueDraftTitle ?? ""
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function createIssueManagerTaskDraftFromNodeState(state, priority = defaultTaskPriority) {
|
|
154
|
+
return {
|
|
155
|
+
content: state?.taskDraftContent ?? "",
|
|
156
|
+
priority,
|
|
157
|
+
title: state?.taskDraftTitle ?? ""
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function applyIssueManagerIssueSelection(current, issueId) {
|
|
161
|
+
return {
|
|
162
|
+
...current,
|
|
163
|
+
selectedIssueId: issueId,
|
|
164
|
+
selectedTaskId: null
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function applyIssueManagerTaskSelection(current, taskId) {
|
|
168
|
+
return {
|
|
169
|
+
...current,
|
|
170
|
+
selectedTaskId: taskId
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function applyIssueManagerIssueDeleted(current) {
|
|
174
|
+
return {
|
|
175
|
+
...current,
|
|
176
|
+
selectedIssueId: null,
|
|
177
|
+
selectedTaskId: null
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function applyIssueManagerTaskDeleted(current) {
|
|
181
|
+
return {
|
|
182
|
+
...current,
|
|
183
|
+
selectedTaskId: null
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function applyIssueManagerSelectedAgentProvider(current, provider) {
|
|
187
|
+
return {
|
|
188
|
+
...current,
|
|
189
|
+
selectedAgentProvider: provider
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function applyIssueManagerIssueListResultToNodeState(current, result) {
|
|
193
|
+
return {
|
|
194
|
+
...current,
|
|
195
|
+
issueListNextPageToken: result.nextPageToken ?? null,
|
|
196
|
+
selectedIssueId: resolveIssueManagerSelectedIssueId(
|
|
197
|
+
current.selectedIssueId,
|
|
198
|
+
result.issues
|
|
199
|
+
)
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function applyIssueManagerIssueDetailResultToNodeState(current, detail) {
|
|
203
|
+
return {
|
|
204
|
+
...current,
|
|
205
|
+
selectedTaskId: resolveIssueManagerSelectedTaskId(
|
|
206
|
+
current.selectedTaskId,
|
|
207
|
+
detail.tasks
|
|
208
|
+
)
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function syncIssueManagerIssueDraftFromDetail(current, detail, editorMode) {
|
|
212
|
+
if (editorMode !== "read") {
|
|
213
|
+
return current;
|
|
214
|
+
}
|
|
215
|
+
return {
|
|
216
|
+
content: normalizeIssueManagerContent(detail?.issue.content ?? ""),
|
|
217
|
+
title: detail?.issue.title ?? ""
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function syncIssueManagerTaskDraftFromDetail(current, detail, editorMode) {
|
|
221
|
+
if (editorMode !== "read") {
|
|
222
|
+
return current;
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
content: normalizeIssueManagerContent(detail?.task.content ?? ""),
|
|
226
|
+
priority: detail?.task.priority ?? defaultTaskPriority,
|
|
227
|
+
title: detail?.task.title ?? ""
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function applyIssueManagerIssueEditorModeToNodeState(current, editorMode) {
|
|
231
|
+
if (editorMode === "create") {
|
|
232
|
+
return current;
|
|
233
|
+
}
|
|
234
|
+
return {
|
|
235
|
+
...current,
|
|
236
|
+
issueDraftContent: null,
|
|
237
|
+
issueDraftTitle: null
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function applyIssueManagerTaskEditorModeToNodeState(current, editorMode) {
|
|
241
|
+
if (editorMode === "create") {
|
|
242
|
+
return current;
|
|
243
|
+
}
|
|
244
|
+
return {
|
|
245
|
+
...current,
|
|
246
|
+
taskDraftContent: null,
|
|
247
|
+
taskDraftTitle: null
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function applyIssueManagerIssueSaved(current, issueId) {
|
|
251
|
+
return {
|
|
252
|
+
...current,
|
|
253
|
+
issueDraftContent: null,
|
|
254
|
+
issueDraftTitle: null,
|
|
255
|
+
selectedIssueId: issueId
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function applyIssueManagerTaskSaved(current, taskId) {
|
|
259
|
+
return {
|
|
260
|
+
...current,
|
|
261
|
+
selectedTaskId: taskId,
|
|
262
|
+
taskDraftContent: null,
|
|
263
|
+
taskDraftTitle: null
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
function persistIssueManagerIssueDraftContent(current, editorMode, content) {
|
|
267
|
+
if (editorMode !== "create") {
|
|
268
|
+
return current;
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
...current,
|
|
272
|
+
issueDraftContent: content
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function persistIssueManagerIssueDraftTitle(current, editorMode, title) {
|
|
276
|
+
if (editorMode !== "create") {
|
|
277
|
+
return current;
|
|
278
|
+
}
|
|
279
|
+
return {
|
|
280
|
+
...current,
|
|
281
|
+
issueDraftTitle: title
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function persistIssueManagerTaskDraftContent(current, editorMode, content) {
|
|
285
|
+
if (editorMode !== "create") {
|
|
286
|
+
return current;
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
...current,
|
|
290
|
+
taskDraftContent: content
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function persistIssueManagerTaskDraftTitle(current, editorMode, title) {
|
|
294
|
+
if (editorMode !== "create") {
|
|
295
|
+
return current;
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
...current,
|
|
299
|
+
taskDraftTitle: title
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// src/services/internal/controllerRuntime.ts
|
|
304
|
+
function createIssueManagerControllerRuntime(input) {
|
|
305
|
+
const normalizedNodeState = normalizeIssueManagerNodeState(input.state);
|
|
306
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
307
|
+
let deferredIssueSearch = normalizedNodeState.issueSearchQuery;
|
|
308
|
+
let issueDetailSequence = 0;
|
|
309
|
+
let issueListSequence = 0;
|
|
310
|
+
let onStateChange;
|
|
311
|
+
let refCount = 0;
|
|
312
|
+
let retained = false;
|
|
313
|
+
let taskDetailSequence = 0;
|
|
314
|
+
let snapshot = {
|
|
315
|
+
issueDetail: createAsyncCollectionState(
|
|
316
|
+
null
|
|
317
|
+
),
|
|
318
|
+
issueDraft: createIssueManagerIssueDraftFromNodeState(normalizedNodeState),
|
|
319
|
+
issueEditorMode: "read",
|
|
320
|
+
issues: createAsyncCollectionState([]),
|
|
321
|
+
isRunningTask: false,
|
|
322
|
+
nodeState: normalizedNodeState,
|
|
323
|
+
notification: null,
|
|
324
|
+
referenceTarget: null,
|
|
325
|
+
taskDetail: createAsyncCollectionState(null),
|
|
326
|
+
taskDraft: createIssueManagerTaskDraftFromNodeState(normalizedNodeState),
|
|
327
|
+
taskEditorMode: "read"
|
|
328
|
+
};
|
|
329
|
+
const store = proxy(snapshot);
|
|
330
|
+
const notify = () => {
|
|
331
|
+
for (const listener of listeners) {
|
|
332
|
+
listener();
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
const setSnapshot = (updater) => {
|
|
336
|
+
const next = typeof updater === "function" ? updater(snapshot) : {
|
|
337
|
+
...snapshot,
|
|
338
|
+
...updater
|
|
339
|
+
};
|
|
340
|
+
if (next === snapshot) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
snapshot = next;
|
|
344
|
+
Object.assign(store, next);
|
|
345
|
+
notify();
|
|
346
|
+
};
|
|
347
|
+
const syncIssueDraftFromCurrentDetail = () => {
|
|
348
|
+
const nextIssueDraft = syncIssueManagerIssueDraftFromDetail(
|
|
349
|
+
snapshot.issueDraft,
|
|
350
|
+
snapshot.issueDetail.value,
|
|
351
|
+
snapshot.issueEditorMode
|
|
352
|
+
);
|
|
353
|
+
if (nextIssueDraft === snapshot.issueDraft) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
setSnapshot((current) => ({
|
|
357
|
+
...current,
|
|
358
|
+
issueDraft: nextIssueDraft
|
|
359
|
+
}));
|
|
360
|
+
};
|
|
361
|
+
const syncTaskDraftFromCurrentDetail = () => {
|
|
362
|
+
const nextTaskDraft = syncIssueManagerTaskDraftFromDetail(
|
|
363
|
+
snapshot.taskDraft,
|
|
364
|
+
snapshot.taskDetail.value,
|
|
365
|
+
snapshot.taskEditorMode
|
|
366
|
+
);
|
|
367
|
+
if (nextTaskDraft === snapshot.taskDraft) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
setSnapshot((current) => ({
|
|
371
|
+
...current,
|
|
372
|
+
taskDraft: nextTaskDraft
|
|
373
|
+
}));
|
|
374
|
+
};
|
|
375
|
+
const applyNodeState = (updater) => {
|
|
376
|
+
const previous = snapshot.nodeState;
|
|
377
|
+
const next = typeof updater === "function" ? updater(previous) : {
|
|
378
|
+
...previous,
|
|
379
|
+
...updater
|
|
380
|
+
};
|
|
381
|
+
if (next === previous) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
setSnapshot((current) => ({
|
|
385
|
+
...current,
|
|
386
|
+
nodeState: next
|
|
387
|
+
}));
|
|
388
|
+
onStateChange?.(next);
|
|
389
|
+
handleNodeStateTransition(previous, next);
|
|
390
|
+
};
|
|
391
|
+
const loadIssues = async () => {
|
|
392
|
+
const sequence = ++issueListSequence;
|
|
393
|
+
setSnapshot((current) => ({
|
|
394
|
+
...current,
|
|
395
|
+
issues: {
|
|
396
|
+
...current.issues,
|
|
397
|
+
error: null,
|
|
398
|
+
isLoading: true
|
|
399
|
+
}
|
|
400
|
+
}));
|
|
401
|
+
try {
|
|
402
|
+
const result = await input.feature.backend.listIssues({
|
|
403
|
+
searchQuery: deferredIssueSearch || void 0,
|
|
404
|
+
statusFilter: snapshot.nodeState.issueStatusFilter,
|
|
405
|
+
workspaceId: input.workspaceId
|
|
406
|
+
});
|
|
407
|
+
if (!retained || sequence !== issueListSequence) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
setSnapshot((current) => ({
|
|
411
|
+
...current,
|
|
412
|
+
issues: {
|
|
413
|
+
error: null,
|
|
414
|
+
isLoading: false,
|
|
415
|
+
value: result.issues
|
|
416
|
+
}
|
|
417
|
+
}));
|
|
418
|
+
applyNodeState(
|
|
419
|
+
(current) => applyIssueManagerIssueListResultToNodeState(current, result)
|
|
420
|
+
);
|
|
421
|
+
} catch (error) {
|
|
422
|
+
if (!retained || sequence !== issueListSequence) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
setSnapshot((current) => ({
|
|
426
|
+
...current,
|
|
427
|
+
issues: {
|
|
428
|
+
error: resolveIssueManagerErrorMessage(error, input.feature.i18n),
|
|
429
|
+
isLoading: false,
|
|
430
|
+
value: []
|
|
431
|
+
}
|
|
432
|
+
}));
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
const clearIssueDetail = () => {
|
|
436
|
+
setSnapshot((current) => ({
|
|
437
|
+
...current,
|
|
438
|
+
issueDetail: createAsyncCollectionState(
|
|
439
|
+
null
|
|
440
|
+
)
|
|
441
|
+
}));
|
|
442
|
+
syncIssueDraftFromCurrentDetail();
|
|
443
|
+
};
|
|
444
|
+
const clearTaskDetail = () => {
|
|
445
|
+
setSnapshot((current) => ({
|
|
446
|
+
...current,
|
|
447
|
+
taskDetail: createAsyncCollectionState(
|
|
448
|
+
null
|
|
449
|
+
)
|
|
450
|
+
}));
|
|
451
|
+
syncTaskDraftFromCurrentDetail();
|
|
452
|
+
};
|
|
453
|
+
const loadIssueDetail = async () => {
|
|
454
|
+
const selectedIssueId = snapshot.nodeState.selectedIssueId;
|
|
455
|
+
issueDetailSequence += 1;
|
|
456
|
+
const sequence = issueDetailSequence;
|
|
457
|
+
if (!selectedIssueId) {
|
|
458
|
+
clearIssueDetail();
|
|
459
|
+
clearTaskDetail();
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
setSnapshot((current) => ({
|
|
463
|
+
...current,
|
|
464
|
+
issueDetail: {
|
|
465
|
+
...current.issueDetail,
|
|
466
|
+
error: null,
|
|
467
|
+
isLoading: true
|
|
468
|
+
}
|
|
469
|
+
}));
|
|
470
|
+
try {
|
|
471
|
+
const result = await input.feature.backend.getIssueDetail({
|
|
472
|
+
issueId: selectedIssueId,
|
|
473
|
+
workspaceId: input.workspaceId
|
|
474
|
+
});
|
|
475
|
+
if (!retained || sequence !== issueDetailSequence) {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
setSnapshot((current) => ({
|
|
479
|
+
...current,
|
|
480
|
+
issueDetail: {
|
|
481
|
+
error: null,
|
|
482
|
+
isLoading: false,
|
|
483
|
+
value: result
|
|
484
|
+
}
|
|
485
|
+
}));
|
|
486
|
+
syncIssueDraftFromCurrentDetail();
|
|
487
|
+
applyNodeState(
|
|
488
|
+
(current) => applyIssueManagerIssueDetailResultToNodeState(current, result)
|
|
489
|
+
);
|
|
490
|
+
} catch (error) {
|
|
491
|
+
if (!retained || sequence !== issueDetailSequence) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
setSnapshot((current) => ({
|
|
495
|
+
...current,
|
|
496
|
+
issueDetail: {
|
|
497
|
+
error: resolveIssueManagerErrorMessage(error, input.feature.i18n),
|
|
498
|
+
isLoading: false,
|
|
499
|
+
value: null
|
|
500
|
+
}
|
|
501
|
+
}));
|
|
502
|
+
syncIssueDraftFromCurrentDetail();
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
const loadTaskDetail = async () => {
|
|
506
|
+
const selectedIssueId = snapshot.nodeState.selectedIssueId;
|
|
507
|
+
const selectedTaskId = snapshot.nodeState.selectedTaskId;
|
|
508
|
+
taskDetailSequence += 1;
|
|
509
|
+
const sequence = taskDetailSequence;
|
|
510
|
+
if (!selectedIssueId || !selectedTaskId) {
|
|
511
|
+
clearTaskDetail();
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
setSnapshot((current) => ({
|
|
515
|
+
...current,
|
|
516
|
+
taskDetail: {
|
|
517
|
+
...current.taskDetail,
|
|
518
|
+
error: null,
|
|
519
|
+
isLoading: true
|
|
520
|
+
}
|
|
521
|
+
}));
|
|
522
|
+
try {
|
|
523
|
+
const result = await input.feature.backend.getTaskDetail({
|
|
524
|
+
issueId: selectedIssueId,
|
|
525
|
+
taskId: selectedTaskId,
|
|
526
|
+
workspaceId: input.workspaceId
|
|
527
|
+
});
|
|
528
|
+
if (!retained || sequence !== taskDetailSequence) {
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
setSnapshot((current) => ({
|
|
532
|
+
...current,
|
|
533
|
+
taskDetail: {
|
|
534
|
+
error: null,
|
|
535
|
+
isLoading: false,
|
|
536
|
+
value: result
|
|
537
|
+
}
|
|
538
|
+
}));
|
|
539
|
+
syncTaskDraftFromCurrentDetail();
|
|
540
|
+
} catch (error) {
|
|
541
|
+
if (!retained || sequence !== taskDetailSequence) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
setSnapshot((current) => ({
|
|
545
|
+
...current,
|
|
546
|
+
taskDetail: {
|
|
547
|
+
error: resolveIssueManagerErrorMessage(error, input.feature.i18n),
|
|
548
|
+
isLoading: false,
|
|
549
|
+
value: null
|
|
550
|
+
}
|
|
551
|
+
}));
|
|
552
|
+
syncTaskDraftFromCurrentDetail();
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
const handleNodeStateTransition = (previous, next) => {
|
|
556
|
+
if (!retained) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
if (previous.issueStatusFilter !== next.issueStatusFilter && deferredIssueSearch === snapshot.nodeState.issueSearchQuery) {
|
|
560
|
+
void loadIssues();
|
|
561
|
+
}
|
|
562
|
+
if (previous.selectedIssueId !== next.selectedIssueId) {
|
|
563
|
+
void loadIssueDetail();
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
if (previous.selectedTaskId !== next.selectedTaskId) {
|
|
567
|
+
void loadTaskDetail();
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
return {
|
|
571
|
+
getSnapshot() {
|
|
572
|
+
return snapshot;
|
|
573
|
+
},
|
|
574
|
+
refreshAll() {
|
|
575
|
+
if (!retained) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
void loadIssues();
|
|
579
|
+
void loadIssueDetail();
|
|
580
|
+
void loadTaskDetail();
|
|
581
|
+
},
|
|
582
|
+
refreshDetails() {
|
|
583
|
+
if (!retained) {
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
void loadIssueDetail();
|
|
587
|
+
void loadTaskDetail();
|
|
588
|
+
},
|
|
589
|
+
release() {
|
|
590
|
+
refCount = Math.max(0, refCount - 1);
|
|
591
|
+
if (refCount > 0) {
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
retained = false;
|
|
595
|
+
issueListSequence += 1;
|
|
596
|
+
issueDetailSequence += 1;
|
|
597
|
+
taskDetailSequence += 1;
|
|
598
|
+
},
|
|
599
|
+
retain() {
|
|
600
|
+
refCount += 1;
|
|
601
|
+
if (retained) {
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
retained = true;
|
|
605
|
+
void loadIssues();
|
|
606
|
+
void loadIssueDetail();
|
|
607
|
+
void loadTaskDetail();
|
|
608
|
+
},
|
|
609
|
+
setIsRunningTask(update) {
|
|
610
|
+
setSnapshot((current) => ({
|
|
611
|
+
...current,
|
|
612
|
+
isRunningTask: resolveSetStateAction(update, current.isRunningTask)
|
|
613
|
+
}));
|
|
614
|
+
},
|
|
615
|
+
setIssueDraftInternal(update) {
|
|
616
|
+
setSnapshot((current) => ({
|
|
617
|
+
...current,
|
|
618
|
+
issueDraft: resolveSetStateAction(update, current.issueDraft)
|
|
619
|
+
}));
|
|
620
|
+
},
|
|
621
|
+
setIssueEditorModeState(update) {
|
|
622
|
+
const nextMode = resolveSetStateAction(update, snapshot.issueEditorMode);
|
|
623
|
+
setSnapshot((current) => ({
|
|
624
|
+
...current,
|
|
625
|
+
issueEditorMode: nextMode
|
|
626
|
+
}));
|
|
627
|
+
syncIssueDraftFromCurrentDetail();
|
|
628
|
+
},
|
|
629
|
+
setReferenceTarget(update) {
|
|
630
|
+
setSnapshot((current) => ({
|
|
631
|
+
...current,
|
|
632
|
+
referenceTarget: resolveSetStateAction(update, current.referenceTarget)
|
|
633
|
+
}));
|
|
634
|
+
},
|
|
635
|
+
setNotification(update) {
|
|
636
|
+
setSnapshot((current) => ({
|
|
637
|
+
...current,
|
|
638
|
+
notification: resolveSetStateAction(update, current.notification)
|
|
639
|
+
}));
|
|
640
|
+
},
|
|
641
|
+
setTaskDraftInternal(update) {
|
|
642
|
+
setSnapshot((current) => ({
|
|
643
|
+
...current,
|
|
644
|
+
taskDraft: resolveSetStateAction(update, current.taskDraft)
|
|
645
|
+
}));
|
|
646
|
+
},
|
|
647
|
+
setTaskEditorModeState(update) {
|
|
648
|
+
const nextMode = resolveSetStateAction(update, snapshot.taskEditorMode);
|
|
649
|
+
setSnapshot((current) => ({
|
|
650
|
+
...current,
|
|
651
|
+
taskEditorMode: nextMode
|
|
652
|
+
}));
|
|
653
|
+
syncTaskDraftFromCurrentDetail();
|
|
654
|
+
},
|
|
655
|
+
subscribe(listener) {
|
|
656
|
+
listeners.add(listener);
|
|
657
|
+
return () => {
|
|
658
|
+
listeners.delete(listener);
|
|
659
|
+
};
|
|
660
|
+
},
|
|
661
|
+
syncInput(nextInput) {
|
|
662
|
+
onStateChange = nextInput.onStateChange;
|
|
663
|
+
if (deferredIssueSearch !== nextInput.deferredIssueSearch) {
|
|
664
|
+
deferredIssueSearch = nextInput.deferredIssueSearch;
|
|
665
|
+
if (retained) {
|
|
666
|
+
void loadIssues();
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if (snapshot.nodeState.taskListCollapsed === true !== nextInput.taskListCollapsed) {
|
|
670
|
+
applyNodeState((current) => ({
|
|
671
|
+
...current,
|
|
672
|
+
taskListCollapsed: nextInput.taskListCollapsed
|
|
673
|
+
}));
|
|
674
|
+
}
|
|
675
|
+
},
|
|
676
|
+
updateNodeState(updater) {
|
|
677
|
+
applyNodeState(updater);
|
|
678
|
+
},
|
|
679
|
+
store
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
function createAsyncCollectionState(value) {
|
|
683
|
+
return {
|
|
684
|
+
error: null,
|
|
685
|
+
isLoading: false,
|
|
686
|
+
value
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
function resolveSetStateAction(update, current) {
|
|
690
|
+
return typeof update === "function" ? update(current) : update;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// src/services/internal/issueManagerControllerService.ts
|
|
694
|
+
var DefaultIssueManagerControllerService = class {
|
|
695
|
+
createSession(input) {
|
|
696
|
+
return createIssueManagerControllerRuntime(input);
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
// src/services/createIssueManagerControllerService.ts
|
|
701
|
+
function createIssueManagerControllerService() {
|
|
702
|
+
return new DefaultIssueManagerControllerService();
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
export {
|
|
706
|
+
createIssueManagerDate,
|
|
707
|
+
formatIssueManagerTimestamp,
|
|
708
|
+
formatIssueManagerDate,
|
|
709
|
+
resolveIssueManagerStatusLabel,
|
|
710
|
+
resolveIssueManagerPriorityLabel,
|
|
711
|
+
uniqueIssueManagerFileReferences,
|
|
712
|
+
parentDirectoryPath,
|
|
713
|
+
defaultTaskPriority,
|
|
714
|
+
toContextRefInput,
|
|
715
|
+
toIssueManagerWorkspaceFileLinkInput,
|
|
716
|
+
confirmIssueManagerMessage,
|
|
717
|
+
resolveIssueManagerErrorMessage,
|
|
718
|
+
createIssueManagerIssueDraftFromNodeState,
|
|
719
|
+
createIssueManagerTaskDraftFromNodeState,
|
|
720
|
+
applyIssueManagerIssueSelection,
|
|
721
|
+
applyIssueManagerTaskSelection,
|
|
722
|
+
applyIssueManagerIssueDeleted,
|
|
723
|
+
applyIssueManagerTaskDeleted,
|
|
724
|
+
applyIssueManagerSelectedAgentProvider,
|
|
725
|
+
applyIssueManagerIssueEditorModeToNodeState,
|
|
726
|
+
applyIssueManagerTaskEditorModeToNodeState,
|
|
727
|
+
applyIssueManagerIssueSaved,
|
|
728
|
+
applyIssueManagerTaskSaved,
|
|
729
|
+
persistIssueManagerIssueDraftContent,
|
|
730
|
+
persistIssueManagerIssueDraftTitle,
|
|
731
|
+
persistIssueManagerTaskDraftContent,
|
|
732
|
+
persistIssueManagerTaskDraftTitle,
|
|
733
|
+
createIssueManagerControllerService
|
|
734
|
+
};
|
|
735
|
+
//# sourceMappingURL=chunk-ZWDF5XA7.js.map
|