@useorgx/openclaw-plugin 0.7.8 → 0.7.11
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/dashboard/dist/assets/{CnitK1MX.js → AqVoI3SF.js} +1 -1
- package/dashboard/dist/assets/AqVoI3SF.js.br +0 -0
- package/dashboard/dist/assets/AqVoI3SF.js.gz +0 -0
- package/dashboard/dist/assets/BC4WvnHJ.js +1 -0
- package/dashboard/dist/assets/BC4WvnHJ.js.br +0 -0
- package/dashboard/dist/assets/BC4WvnHJ.js.gz +0 -0
- package/dashboard/dist/assets/{DOFL9l8s.js → BG5mwTkg.js} +1 -1
- package/dashboard/dist/assets/BG5mwTkg.js.br +0 -0
- package/dashboard/dist/assets/BG5mwTkg.js.gz +0 -0
- package/dashboard/dist/assets/BNh-XYPV.js +1 -0
- package/dashboard/dist/assets/BNh-XYPV.js.br +0 -0
- package/dashboard/dist/assets/BNh-XYPV.js.gz +0 -0
- package/dashboard/dist/assets/{CFwPph5U.js → BepW_590.js} +1 -1
- package/dashboard/dist/assets/BepW_590.js.br +0 -0
- package/dashboard/dist/assets/BepW_590.js.gz +0 -0
- package/dashboard/dist/assets/BerAfzjq.js +1 -0
- package/dashboard/dist/assets/BerAfzjq.js.br +0 -0
- package/dashboard/dist/assets/BerAfzjq.js.gz +0 -0
- package/dashboard/dist/assets/Bp3N-QL5.js +212 -0
- package/dashboard/dist/assets/Bp3N-QL5.js.br +0 -0
- package/dashboard/dist/assets/Bp3N-QL5.js.gz +0 -0
- package/dashboard/dist/assets/C3dZRz9P.css +1 -0
- package/dashboard/dist/assets/C3dZRz9P.css.br +0 -0
- package/dashboard/dist/assets/C3dZRz9P.css.gz +0 -0
- package/dashboard/dist/assets/CD-q5mdP.js +1 -0
- package/dashboard/dist/assets/CD-q5mdP.js.br +0 -0
- package/dashboard/dist/assets/CD-q5mdP.js.gz +0 -0
- package/dashboard/dist/assets/{BgcAY5rE.js → CdvjC9G9.js} +1 -1
- package/dashboard/dist/assets/CdvjC9G9.js.br +0 -0
- package/dashboard/dist/assets/CdvjC9G9.js.gz +0 -0
- package/dashboard/dist/assets/Ck2agw-s.js +1 -0
- package/dashboard/dist/assets/Ck2agw-s.js.br +0 -0
- package/dashboard/dist/assets/Ck2agw-s.js.gz +0 -0
- package/dashboard/dist/assets/{D7DHFX0D.js → D2CH1H6k.js} +1 -1
- package/dashboard/dist/assets/D2CH1H6k.js.br +0 -0
- package/dashboard/dist/assets/D2CH1H6k.js.gz +0 -0
- package/dashboard/dist/assets/D9esz7jd.js +1 -0
- package/dashboard/dist/assets/D9esz7jd.js.br +0 -0
- package/dashboard/dist/assets/D9esz7jd.js.gz +0 -0
- package/dashboard/dist/assets/{77gGFBt6.js → DCP-C7fn.js} +1 -1
- package/dashboard/dist/assets/DCP-C7fn.js.br +0 -0
- package/dashboard/dist/assets/DCP-C7fn.js.gz +0 -0
- package/dashboard/dist/assets/{CSr2ZnTV.js → DJASCd69.js} +1 -1
- package/dashboard/dist/assets/DJASCd69.js.br +0 -0
- package/dashboard/dist/assets/DJASCd69.js.gz +0 -0
- package/dashboard/dist/assets/Dm9AybAp.js +1 -0
- package/dashboard/dist/assets/Dm9AybAp.js.br +0 -0
- package/dashboard/dist/assets/Dm9AybAp.js.gz +0 -0
- package/dashboard/dist/assets/{DxKG5zy8.js → Du1wfrXa.js} +1 -1
- package/dashboard/dist/assets/Du1wfrXa.js.br +0 -0
- package/dashboard/dist/assets/Du1wfrXa.js.gz +0 -0
- package/dashboard/dist/assets/{DpuQm1oF.js → beHYBbh6.js} +1 -1
- package/dashboard/dist/assets/beHYBbh6.js.br +0 -0
- package/dashboard/dist/assets/beHYBbh6.js.gz +0 -0
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/index.html.br +0 -0
- package/dashboard/dist/index.html.gz +0 -0
- package/dist/http/helpers/auto-continue-engine.d.ts +36 -0
- package/dist/http/helpers/auto-continue-engine.js +83 -17
- package/dist/http/helpers/autopilot-runtime.d.ts +1 -0
- package/dist/http/helpers/autopilot-runtime.js +31 -3
- package/dist/http/helpers/autopilot-slice-utils.d.ts +10 -0
- package/dist/http/helpers/autopilot-slice-utils.js +58 -0
- package/dist/http/helpers/humanize-slice-failure.d.ts +35 -0
- package/dist/http/helpers/humanize-slice-failure.js +137 -0
- package/dist/http/helpers/mission-control.d.ts +1 -0
- package/dist/http/helpers/mission-control.js +68 -5
- package/dist/http/index.js +65 -3
- package/dist/http/routes/live-misc.js +9 -2
- package/dist/http/routes/live-snapshot.js +10 -4
- package/dist/http/routes/mission-control-actions.js +5 -0
- package/dist/http/routes/mission-control-read.d.ts +1 -0
- package/dist/http/routes/mission-control-read.js +65 -4
- package/dist/index.d.ts +8 -1
- package/dist/index.js +21 -1
- package/dist/tools/core-tools.d.ts +27 -0
- package/dist/tools/core-tools.js +89 -0
- package/package.json +1 -1
- package/dashboard/dist/assets/77gGFBt6.js.br +0 -0
- package/dashboard/dist/assets/77gGFBt6.js.gz +0 -0
- package/dashboard/dist/assets/BBpTN_SR.js +0 -1
- package/dashboard/dist/assets/BBpTN_SR.js.br +0 -0
- package/dashboard/dist/assets/BBpTN_SR.js.gz +0 -0
- package/dashboard/dist/assets/BVShoyjA.js +0 -1
- package/dashboard/dist/assets/BVShoyjA.js.br +0 -0
- package/dashboard/dist/assets/BVShoyjA.js.gz +0 -0
- package/dashboard/dist/assets/BgcAY5rE.js.br +0 -0
- package/dashboard/dist/assets/BgcAY5rE.js.gz +0 -0
- package/dashboard/dist/assets/C-PAoJF-.js +0 -1
- package/dashboard/dist/assets/C-PAoJF-.js.br +0 -0
- package/dashboard/dist/assets/C-PAoJF-.js.gz +0 -0
- package/dashboard/dist/assets/C0nA-iUG.js +0 -1
- package/dashboard/dist/assets/C0nA-iUG.js.br +0 -0
- package/dashboard/dist/assets/C0nA-iUG.js.gz +0 -0
- package/dashboard/dist/assets/C6GO-FKy.js +0 -1
- package/dashboard/dist/assets/C6GO-FKy.js.br +0 -0
- package/dashboard/dist/assets/C6GO-FKy.js.gz +0 -0
- package/dashboard/dist/assets/CFwPph5U.js.br +0 -0
- package/dashboard/dist/assets/CFwPph5U.js.gz +0 -0
- package/dashboard/dist/assets/CPjsbbgZ.js +0 -212
- package/dashboard/dist/assets/CPjsbbgZ.js.br +0 -0
- package/dashboard/dist/assets/CPjsbbgZ.js.gz +0 -0
- package/dashboard/dist/assets/CSr2ZnTV.js.br +0 -0
- package/dashboard/dist/assets/CSr2ZnTV.js.gz +0 -0
- package/dashboard/dist/assets/CgQDT6yL.js +0 -1
- package/dashboard/dist/assets/CgQDT6yL.js.br +0 -0
- package/dashboard/dist/assets/CgQDT6yL.js.gz +0 -0
- package/dashboard/dist/assets/CnitK1MX.js.br +0 -0
- package/dashboard/dist/assets/CnitK1MX.js.gz +0 -0
- package/dashboard/dist/assets/D7DHFX0D.js.br +0 -0
- package/dashboard/dist/assets/D7DHFX0D.js.gz +0 -0
- package/dashboard/dist/assets/DEip7uko.js +0 -1
- package/dashboard/dist/assets/DEip7uko.js.br +0 -0
- package/dashboard/dist/assets/DEip7uko.js.gz +0 -0
- package/dashboard/dist/assets/DHUSLc01.css +0 -1
- package/dashboard/dist/assets/DHUSLc01.css.br +0 -0
- package/dashboard/dist/assets/DHUSLc01.css.gz +0 -0
- package/dashboard/dist/assets/DOFL9l8s.js.br +0 -0
- package/dashboard/dist/assets/DOFL9l8s.js.gz +0 -0
- package/dashboard/dist/assets/DpuQm1oF.js.br +0 -0
- package/dashboard/dist/assets/DpuQm1oF.js.gz +0 -0
- package/dashboard/dist/assets/DxKG5zy8.js.br +0 -0
- package/dashboard/dist/assets/DxKG5zy8.js.gz +0 -0
package/dist/http/index.js
CHANGED
|
@@ -106,8 +106,64 @@ async function resolveSkillPackOverrides(input) {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
function safeErrorMessage(err) {
|
|
109
|
-
const raw = err instanceof Error
|
|
110
|
-
|
|
109
|
+
const raw = err instanceof Error
|
|
110
|
+
? err.message
|
|
111
|
+
: typeof err === "string"
|
|
112
|
+
? err
|
|
113
|
+
: err && typeof err === "object" && "message" in err && typeof err.message === "string"
|
|
114
|
+
? (err.message ?? "")
|
|
115
|
+
: "";
|
|
116
|
+
const parseStructuredMessage = (value) => {
|
|
117
|
+
const trimmed = value.trim();
|
|
118
|
+
if (!trimmed)
|
|
119
|
+
return null;
|
|
120
|
+
const parseObjectMessage = (parsed) => {
|
|
121
|
+
if (!parsed || typeof parsed !== "object")
|
|
122
|
+
return null;
|
|
123
|
+
const root = parsed;
|
|
124
|
+
const nested = root.error && typeof root.error === "object" ? root.error : null;
|
|
125
|
+
const envelope = nested ?? root;
|
|
126
|
+
return ((typeof envelope.message === "string" && envelope.message.trim()) ||
|
|
127
|
+
(typeof envelope.detail === "string" && envelope.detail.trim()) ||
|
|
128
|
+
(!nested && typeof root.error === "string" && root.error.trim()) ||
|
|
129
|
+
null);
|
|
130
|
+
};
|
|
131
|
+
try {
|
|
132
|
+
const parsed = JSON.parse(trimmed);
|
|
133
|
+
const direct = parseObjectMessage(parsed);
|
|
134
|
+
if (direct)
|
|
135
|
+
return direct;
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// Continue and try extracting embedded JSON payloads.
|
|
139
|
+
}
|
|
140
|
+
const firstBrace = trimmed.indexOf("{");
|
|
141
|
+
const lastBrace = trimmed.lastIndexOf("}");
|
|
142
|
+
if (firstBrace >= 0 && lastBrace > firstBrace) {
|
|
143
|
+
const candidate = trimmed.slice(firstBrace, lastBrace + 1);
|
|
144
|
+
try {
|
|
145
|
+
const parsed = JSON.parse(candidate);
|
|
146
|
+
return parseObjectMessage(parsed);
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return null;
|
|
153
|
+
};
|
|
154
|
+
const stripStructuredNoise = (value) => value
|
|
155
|
+
.replace(/"requestId"\s*:\s*"[^"]*"/gi, "")
|
|
156
|
+
.replace(/"timestamp"\s*:\s*"[^"]*"/gi, "")
|
|
157
|
+
.replace(/"docsUrl"\s*:\s*"[^"]*"/gi, "")
|
|
158
|
+
.replace(/\brequest[_\s-]?id[:=]\s*[\w-]+/gi, "")
|
|
159
|
+
.replace(/\btimestamp[:=]\s*\S+/gi, "")
|
|
160
|
+
.replace(/\bdocsUrl[:=]\s*\S+/gi, "")
|
|
161
|
+
.replace(/[{}]/g, " ")
|
|
162
|
+
.replace(/\s{2,}/g, " ")
|
|
163
|
+
.trim();
|
|
164
|
+
const normalizedMessage = parseStructuredMessage(raw) ?? raw;
|
|
165
|
+
const sanitized = stripStructuredNoise(normalizedMessage);
|
|
166
|
+
const normalized = sanitized.toLowerCase();
|
|
111
167
|
if (normalized.length > 0) {
|
|
112
168
|
if (normalized.includes("signal is aborted") ||
|
|
113
169
|
normalized.includes("aborterror") ||
|
|
@@ -121,7 +177,13 @@ function safeErrorMessage(err) {
|
|
|
121
177
|
if (normalized.includes("failed to fetch") || normalized.includes("network")) {
|
|
122
178
|
return "network request failed";
|
|
123
179
|
}
|
|
124
|
-
|
|
180
|
+
if (normalized.includes("internal_error") || normalized.includes("internal server error")) {
|
|
181
|
+
return "temporary server issue";
|
|
182
|
+
}
|
|
183
|
+
if (normalized.includes("failed to list decision") || normalized.includes("failed to load decision")) {
|
|
184
|
+
return "decision data temporarily unavailable";
|
|
185
|
+
}
|
|
186
|
+
return sanitized;
|
|
125
187
|
}
|
|
126
188
|
return "Unexpected error";
|
|
127
189
|
}
|
|
@@ -31,8 +31,15 @@ export function registerLiveMiscRoutes(router, deps) {
|
|
|
31
31
|
const projectId = projectIdRaw?.trim() ?? "";
|
|
32
32
|
if (!projectId)
|
|
33
33
|
return null;
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
try {
|
|
35
|
+
const ids = await deps.listInitiativeIdsForProject({ projectId });
|
|
36
|
+
return new Set(ids);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// Scope discovery is best-effort. Continue with unscoped fallback data
|
|
40
|
+
// instead of hard-failing live surfaces.
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
36
43
|
}
|
|
37
44
|
router.add("POST", "live/activity/headline", async ({ req, res }) => {
|
|
38
45
|
try {
|
|
@@ -13,7 +13,7 @@ const LIVE_SNAPSHOT_UPSTREAM_TIMEOUT_MS = (() => {
|
|
|
13
13
|
const LIVE_SNAPSHOT_NEXT_UP_TIMEOUT_MS = (() => {
|
|
14
14
|
const raw = Number(process.env.ORGX_LIVE_SNAPSHOT_NEXT_UP_TIMEOUT_MS ?? "");
|
|
15
15
|
if (!Number.isFinite(raw))
|
|
16
|
-
return
|
|
16
|
+
return 350;
|
|
17
17
|
return Math.max(250, Math.min(15_000, Math.floor(raw)));
|
|
18
18
|
})();
|
|
19
19
|
async function withSoftTimeout(work, timeoutMs, label) {
|
|
@@ -280,9 +280,15 @@ export function registerLiveSnapshotRoutes(router, deps) {
|
|
|
280
280
|
const agentContexts = contextStore.agents;
|
|
281
281
|
const runContexts = contextStore.runs ?? {};
|
|
282
282
|
const scopedAgentIds = deps.getScopedAgentIds(agentContexts);
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
let scopedProjectInitiativeIds = null;
|
|
284
|
+
if (projectId && projectId.trim().length > 0) {
|
|
285
|
+
try {
|
|
286
|
+
scopedProjectInitiativeIds = new Set(await deps.listInitiativeIdsForProject({ projectId: projectId.trim() }));
|
|
287
|
+
}
|
|
288
|
+
catch (err) {
|
|
289
|
+
degraded.push(`workspace initiative scope unavailable (${deps.safeErrorMessage(err)})`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
286
292
|
let outboxStatus;
|
|
287
293
|
try {
|
|
288
294
|
const diagnosticsOutbox = await deps.readDiagnosticsOutboxStatus();
|
|
@@ -456,6 +456,7 @@ export function registerMissionControlActionsRoutes(router, deps) {
|
|
|
456
456
|
ignoreSpawnGuardRateLimit: ignoreSpawnGuardRateLimit === true,
|
|
457
457
|
scope,
|
|
458
458
|
});
|
|
459
|
+
deps.clearNextUpQueueCache(initiativeId);
|
|
459
460
|
const dispatchId = randomUUID();
|
|
460
461
|
const playDispatchEnvelope = (dispatchMode) => buildDispatchGatewayEnvelope({
|
|
461
462
|
dispatchId,
|
|
@@ -1593,6 +1594,7 @@ export function registerMissionControlActionsRoutes(router, deps) {
|
|
|
1593
1594
|
ignoreSpawnGuardRateLimit: ignoreSpawnGuardRateLimit === true,
|
|
1594
1595
|
scope: startScope,
|
|
1595
1596
|
});
|
|
1597
|
+
deps.clearNextUpQueueCache(initiativeId);
|
|
1596
1598
|
const dispatchEnvelope = buildDispatchGatewayEnvelope({
|
|
1597
1599
|
dispatchMode: "server",
|
|
1598
1600
|
route: "mission-control.auto-continue.start",
|
|
@@ -1643,6 +1645,7 @@ export function registerMissionControlActionsRoutes(router, deps) {
|
|
|
1643
1645
|
// best effort
|
|
1644
1646
|
}
|
|
1645
1647
|
}
|
|
1648
|
+
deps.clearNextUpQueueCache(initiativeId);
|
|
1646
1649
|
deps.sendJson(res, 200, { ok: true, run });
|
|
1647
1650
|
}
|
|
1648
1651
|
catch (err) {
|
|
@@ -1664,10 +1667,12 @@ export function registerMissionControlActionsRoutes(router, deps) {
|
|
|
1664
1667
|
return;
|
|
1665
1668
|
}
|
|
1666
1669
|
await deps.tickAutoContinueRun(run);
|
|
1670
|
+
deps.clearNextUpQueueCache(initiativeId);
|
|
1667
1671
|
deps.sendJson(res, 200, { ok: true, initiativeId, run });
|
|
1668
1672
|
return;
|
|
1669
1673
|
}
|
|
1670
1674
|
await deps.tickAllAutoContinue();
|
|
1675
|
+
deps.clearNextUpQueueCache(null);
|
|
1671
1676
|
deps.sendJson(res, 200, { ok: true });
|
|
1672
1677
|
}
|
|
1673
1678
|
catch (err) {
|
|
@@ -838,11 +838,72 @@ export function registerMissionControlReadRoutes(router, deps) {
|
|
|
838
838
|
const sendRouteException = (res, location, err) => {
|
|
839
839
|
sendRouteError(res, 500, location, deps.safeErrorMessage(err));
|
|
840
840
|
};
|
|
841
|
-
async function renderAutoContinueStatus(query, res) {
|
|
841
|
+
async function renderAutoContinueStatus(query, res, headerScope) {
|
|
842
|
+
const workspaceScope = resolveWorkspaceScope(query, headerScope, {
|
|
843
|
+
allowProjectScope: false,
|
|
844
|
+
});
|
|
845
|
+
if (workspaceScope.error) {
|
|
846
|
+
sendRouteError(res, 400, "mission-control.read.auto-continue.status.validation", workspaceScope.error);
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
const scopedProjectId = workspaceScope.workspaceId;
|
|
842
850
|
const initiativeId = query.get("initiative_id") ?? query.get("initiativeId") ?? "";
|
|
843
851
|
const id = initiativeId.trim();
|
|
852
|
+
let scopedInitiatives = null;
|
|
853
|
+
if (scopedProjectId) {
|
|
854
|
+
try {
|
|
855
|
+
const ids = await deps.listInitiativeIdsForProject({ projectId: scopedProjectId });
|
|
856
|
+
scopedInitiatives = new Set(ids);
|
|
857
|
+
}
|
|
858
|
+
catch {
|
|
859
|
+
// best effort: if scope lookup is unavailable, fall back to unscoped run resolution.
|
|
860
|
+
scopedInitiatives = null;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
const statusRank = (value) => {
|
|
864
|
+
const normalized = (value ?? "").trim().toLowerCase();
|
|
865
|
+
if (normalized === "running")
|
|
866
|
+
return 0;
|
|
867
|
+
if (normalized === "stopping")
|
|
868
|
+
return 1;
|
|
869
|
+
if (normalized === "blocked")
|
|
870
|
+
return 2;
|
|
871
|
+
if (normalized === "stopped")
|
|
872
|
+
return 3;
|
|
873
|
+
return 4;
|
|
874
|
+
};
|
|
875
|
+
const updatedEpoch = (value) => {
|
|
876
|
+
const parsed = Date.parse(value ?? "");
|
|
877
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
878
|
+
};
|
|
844
879
|
if (!id) {
|
|
845
|
-
|
|
880
|
+
const scopedRuns = Array.from(deps.autoContinueRuns.values()).filter((run) => {
|
|
881
|
+
const runInitiativeId = (run.initiativeId ?? "").trim();
|
|
882
|
+
if (!runInitiativeId)
|
|
883
|
+
return false;
|
|
884
|
+
if (scopedInitiatives && !scopedInitiatives.has(runInitiativeId))
|
|
885
|
+
return false;
|
|
886
|
+
return true;
|
|
887
|
+
});
|
|
888
|
+
scopedRuns.sort((left, right) => {
|
|
889
|
+
const statusDelta = statusRank(left.status) - statusRank(right.status);
|
|
890
|
+
if (statusDelta !== 0)
|
|
891
|
+
return statusDelta;
|
|
892
|
+
return updatedEpoch(right.updatedAt) - updatedEpoch(left.updatedAt);
|
|
893
|
+
});
|
|
894
|
+
const run = scopedRuns[0] ?? null;
|
|
895
|
+
deps.sendJson(res, 200, {
|
|
896
|
+
ok: true,
|
|
897
|
+
initiativeId: run?.initiativeId ?? null,
|
|
898
|
+
run,
|
|
899
|
+
defaults: {
|
|
900
|
+
tokenBudget: deps.defaultAutoContinueTokenBudget(),
|
|
901
|
+
maxParallelSlices: typeof deps.defaultAutoContinueMaxParallelSlices === "function"
|
|
902
|
+
? deps.defaultAutoContinueMaxParallelSlices()
|
|
903
|
+
: 1,
|
|
904
|
+
tickMs: deps.autoContinueTickMs,
|
|
905
|
+
},
|
|
906
|
+
});
|
|
846
907
|
return;
|
|
847
908
|
}
|
|
848
909
|
const run = deps.autoContinueRuns.get(id) ?? null;
|
|
@@ -1743,8 +1804,8 @@ export function registerMissionControlReadRoutes(router, deps) {
|
|
|
1743
1804
|
items,
|
|
1744
1805
|
});
|
|
1745
1806
|
}
|
|
1746
|
-
router.add("GET", "mission-control/auto-continue/status", async ({ query, res }) => renderAutoContinueStatus(query, res), "Get auto-continue status for an initiative");
|
|
1747
|
-
router.add("HEAD", "mission-control/auto-continue/status", async ({ query, res }) => renderAutoContinueStatus(query, res), "Get auto-continue status for an initiative (HEAD)");
|
|
1807
|
+
router.add("GET", "mission-control/auto-continue/status", async ({ query, res, req }) => renderAutoContinueStatus(query, res, workspaceScopeFromHeaders(req?.headers)), "Get auto-continue status for an initiative");
|
|
1808
|
+
router.add("HEAD", "mission-control/auto-continue/status", async ({ query, res, req }) => renderAutoContinueStatus(query, res, workspaceScopeFromHeaders(req?.headers)), "Get auto-continue status for an initiative (HEAD)");
|
|
1748
1809
|
router.add("GET", "mission-control/graph", async ({ query, res }) => renderMissionControlGraph(query, res), "Get mission-control dependency graph");
|
|
1749
1810
|
router.add("HEAD", "mission-control/graph", async ({ query, res }) => renderMissionControlGraph(query, res), "Get mission-control dependency graph (HEAD)");
|
|
1750
1811
|
router.add("GET", "mission-control/next-up", async ({ query, res, req }) => renderNextUpQueue(query, res, workspaceScopeFromHeaders(req?.headers)), "Get next-up queue");
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,14 @@ export interface PluginAPI {
|
|
|
48
48
|
}) => void, options?: {
|
|
49
49
|
commands?: string[];
|
|
50
50
|
}) => void;
|
|
51
|
-
|
|
51
|
+
registerHttpRoute?: (route: {
|
|
52
|
+
path: string;
|
|
53
|
+
auth: "gateway" | "plugin";
|
|
54
|
+
match?: "exact" | "prefix";
|
|
55
|
+
handler: unknown;
|
|
56
|
+
replaceExisting?: boolean;
|
|
57
|
+
}) => void;
|
|
58
|
+
registerHttpHandler?: (handler: unknown) => void;
|
|
52
59
|
}
|
|
53
60
|
export interface ToolResult {
|
|
54
61
|
content: Array<{
|
package/dist/index.js
CHANGED
|
@@ -1430,7 +1430,27 @@ export default function register(api) {
|
|
|
1430
1430
|
return true;
|
|
1431
1431
|
return await httpHandler(req, res);
|
|
1432
1432
|
};
|
|
1433
|
-
api.
|
|
1433
|
+
if (typeof api.registerHttpRoute === "function") {
|
|
1434
|
+
api.registerHttpRoute({
|
|
1435
|
+
path: "/orgx",
|
|
1436
|
+
auth: "plugin",
|
|
1437
|
+
match: "prefix",
|
|
1438
|
+
handler: compositeHttpHandler,
|
|
1439
|
+
});
|
|
1440
|
+
api.registerHttpRoute({
|
|
1441
|
+
path: "/workspace-hub",
|
|
1442
|
+
auth: "plugin",
|
|
1443
|
+
match: "prefix",
|
|
1444
|
+
handler: compositeHttpHandler,
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
else if (typeof api.registerHttpHandler === "function") {
|
|
1448
|
+
// Backward compatibility for OpenClaw builds before route-based plugin HTTP registration.
|
|
1449
|
+
api.registerHttpHandler(compositeHttpHandler);
|
|
1450
|
+
}
|
|
1451
|
+
else {
|
|
1452
|
+
throw new Error("OpenClaw plugin API does not expose an HTTP registration method.");
|
|
1453
|
+
}
|
|
1434
1454
|
api.log?.info?.("[orgx] Plugin registered", {
|
|
1435
1455
|
baseUrl: config.baseUrl,
|
|
1436
1456
|
hasApiKey: !!config.apiKey,
|
|
@@ -68,5 +68,32 @@ export interface RegisterCoreToolsDeps {
|
|
|
68
68
|
auditId?: string;
|
|
69
69
|
}) => import("../skill-pack-state.js").SkillPackState;
|
|
70
70
|
randomUUID?: () => string;
|
|
71
|
+
sessionStore?: {
|
|
72
|
+
workstreamSessionStore: Map<string, {
|
|
73
|
+
sessionId: string;
|
|
74
|
+
workstreamId: string;
|
|
75
|
+
initiativeId: string;
|
|
76
|
+
sourceClient: string;
|
|
77
|
+
capturedAt: string;
|
|
78
|
+
fromRunId: string;
|
|
79
|
+
}>;
|
|
80
|
+
getWorkstreamSession: (workstreamId: string) => {
|
|
81
|
+
sessionId: string;
|
|
82
|
+
workstreamId: string;
|
|
83
|
+
initiativeId: string;
|
|
84
|
+
sourceClient: string;
|
|
85
|
+
capturedAt: string;
|
|
86
|
+
fromRunId: string;
|
|
87
|
+
} | null;
|
|
88
|
+
setWorkstreamSession: (workstreamId: string, entry: {
|
|
89
|
+
sessionId: string;
|
|
90
|
+
workstreamId: string;
|
|
91
|
+
initiativeId: string;
|
|
92
|
+
sourceClient: string;
|
|
93
|
+
capturedAt: string;
|
|
94
|
+
fromRunId: string;
|
|
95
|
+
}) => void;
|
|
96
|
+
clearWorkstreamSession: (initiativeId: string) => void;
|
|
97
|
+
};
|
|
71
98
|
}
|
|
72
99
|
export declare function registerCoreTools(deps: RegisterCoreToolsDeps): Map<string, RegisteredTool>;
|
package/dist/tools/core-tools.js
CHANGED
|
@@ -2266,5 +2266,94 @@ export function registerCoreTools(deps) {
|
|
|
2266
2266
|
}
|
|
2267
2267
|
},
|
|
2268
2268
|
}, { optional: true });
|
|
2269
|
+
// --- orgx_agent_sessions ---
|
|
2270
|
+
registerMcpTool({
|
|
2271
|
+
name: "orgx_agent_sessions",
|
|
2272
|
+
description: "List active CLI session IDs stored for workstreams. Used for session resume support.",
|
|
2273
|
+
parameters: {
|
|
2274
|
+
type: "object",
|
|
2275
|
+
properties: {
|
|
2276
|
+
initiativeId: {
|
|
2277
|
+
type: "string",
|
|
2278
|
+
description: "Optional initiative ID filter.",
|
|
2279
|
+
},
|
|
2280
|
+
},
|
|
2281
|
+
additionalProperties: false,
|
|
2282
|
+
},
|
|
2283
|
+
async execute(_callId, params = {}) {
|
|
2284
|
+
const store = deps.sessionStore;
|
|
2285
|
+
if (!store) {
|
|
2286
|
+
return text("Session store not available.");
|
|
2287
|
+
}
|
|
2288
|
+
const entries = [];
|
|
2289
|
+
for (const [, entry] of store.workstreamSessionStore.entries()) {
|
|
2290
|
+
if (params.initiativeId && entry.initiativeId !== params.initiativeId)
|
|
2291
|
+
continue;
|
|
2292
|
+
entries.push({ ...entry });
|
|
2293
|
+
}
|
|
2294
|
+
return json("Agent sessions:", {
|
|
2295
|
+
count: entries.length,
|
|
2296
|
+
sessions: entries,
|
|
2297
|
+
});
|
|
2298
|
+
},
|
|
2299
|
+
}, { optional: true });
|
|
2300
|
+
// --- orgx_resume_agent_session ---
|
|
2301
|
+
registerMcpTool({
|
|
2302
|
+
name: "orgx_resume_agent_session",
|
|
2303
|
+
description: "Store or update a CLI session ID for a workstream so the next slice resumes it.",
|
|
2304
|
+
parameters: {
|
|
2305
|
+
type: "object",
|
|
2306
|
+
properties: {
|
|
2307
|
+
workstreamId: { type: "string", description: "Workstream UUID" },
|
|
2308
|
+
sessionId: { type: "string", description: "CLI session UUID to resume" },
|
|
2309
|
+
initiativeId: { type: "string", description: "Initiative UUID" },
|
|
2310
|
+
sourceClient: { type: "string", description: "Source client (codex, claude-code)" },
|
|
2311
|
+
},
|
|
2312
|
+
required: ["workstreamId", "sessionId", "initiativeId"],
|
|
2313
|
+
additionalProperties: false,
|
|
2314
|
+
},
|
|
2315
|
+
async execute(_callId, params = { workstreamId: "", sessionId: "", initiativeId: "" }) {
|
|
2316
|
+
const store = deps.sessionStore;
|
|
2317
|
+
if (!store) {
|
|
2318
|
+
return text("Session store not available.");
|
|
2319
|
+
}
|
|
2320
|
+
if (!params.workstreamId || !params.sessionId || !params.initiativeId) {
|
|
2321
|
+
return text("Missing required parameters: workstreamId, sessionId, initiativeId.");
|
|
2322
|
+
}
|
|
2323
|
+
store.setWorkstreamSession(params.workstreamId, {
|
|
2324
|
+
sessionId: params.sessionId,
|
|
2325
|
+
workstreamId: params.workstreamId,
|
|
2326
|
+
initiativeId: params.initiativeId,
|
|
2327
|
+
sourceClient: params.sourceClient ?? "unknown",
|
|
2328
|
+
capturedAt: new Date().toISOString(),
|
|
2329
|
+
fromRunId: "manual",
|
|
2330
|
+
});
|
|
2331
|
+
return text(`Session ${params.sessionId} stored for workstream ${params.workstreamId}.`);
|
|
2332
|
+
},
|
|
2333
|
+
}, { optional: true });
|
|
2334
|
+
// --- orgx_clear_agent_session ---
|
|
2335
|
+
registerMcpTool({
|
|
2336
|
+
name: "orgx_clear_agent_session",
|
|
2337
|
+
description: "Clear stored CLI session IDs for an initiative (forces fresh sessions on next dispatch).",
|
|
2338
|
+
parameters: {
|
|
2339
|
+
type: "object",
|
|
2340
|
+
properties: {
|
|
2341
|
+
initiativeId: { type: "string", description: "Initiative UUID" },
|
|
2342
|
+
},
|
|
2343
|
+
required: ["initiativeId"],
|
|
2344
|
+
additionalProperties: false,
|
|
2345
|
+
},
|
|
2346
|
+
async execute(_callId, params = { initiativeId: "" }) {
|
|
2347
|
+
const store = deps.sessionStore;
|
|
2348
|
+
if (!store) {
|
|
2349
|
+
return text("Session store not available.");
|
|
2350
|
+
}
|
|
2351
|
+
if (!params.initiativeId) {
|
|
2352
|
+
return text("Missing required parameter: initiativeId.");
|
|
2353
|
+
}
|
|
2354
|
+
store.clearWorkstreamSession(params.initiativeId);
|
|
2355
|
+
return text(`Sessions cleared for initiative ${params.initiativeId}.`);
|
|
2356
|
+
},
|
|
2357
|
+
}, { optional: true });
|
|
2269
2358
|
return mcpToolRegistry;
|
|
2270
2359
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,a as c}from"./cNrhgGc1.js";import{b as g}from"./CPjsbbgZ.js";function f({authToken:s=null,embedMode:o=!1,enabled:n=!0}={}){var a;const i=l.useMemo(()=>["usage-control-plane",{authToken:s,embedMode:o}],[s,o]),e=c({queryKey:i,enabled:n,queryFn:async()=>{const t=await fetch("/orgx/api/usage/control-plane/summary",{headers:g({authToken:s,embedMode:o})}),r=await t.json().catch(()=>null);if(!t.ok){const u=(r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"?r.error:null)??(r&&typeof r=="object"&&"message"in r&&typeof r.message=="string"?r.message:null)??`Failed to load usage summary (${t.status})`;throw new Error(u)}if(!r||typeof r!="object"||!("generatedAt"in r))throw new Error("Usage summary response is missing required fields.");return r},refetchInterval:6e4});return{summary:e.data??null,isLoading:e.isLoading,isFetching:e.isFetching,error:((a=e.error)==null?void 0:a.message)??null,refetch:e.refetch}}export{f as u};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as Jt,r as d,a as Zt,b as Ve,j as e}from"./cNrhgGc1.js";import{i as Xt,q as He,b as Ee,Q as ht,D as Yt,u as Ot,G as k,P as en,y as ne,F as ft,R as tn,z as P,o as kt,A as jt,E as $e,d as bt,h as Ye,B as gt,C as nn,U as sn}from"./CPjsbbgZ.js";import{S as G}from"./77gGFBt6.js";import{A as qe,m as V,u as Nt,R as rn,b as an,a as on}from"./CxQ08qFN.js";function ln({initiativeId:n=null,authToken:s=null,embedMode:l=!1,enabled:i=!0}){var se,Y,re;const b=Jt(),g=Xt(),C=d.useMemo(()=>He.autoContinueStatus({initiativeId:n??"__global__",authToken:s,embedMode:l}),[n,s,l]),y=Zt({queryKey:C,enabled:i&&(!!n||n===null),queryFn:async()=>{if(g)return{ok:!0,initiativeId:n,run:null,defaults:{tokenBudget:null,tickMs:0}};const p=new URLSearchParams;n&&p.set("initiative_id",n);const m=await fetch(`/orgx/api/mission-control/auto-continue/status?${p.toString()}`,{headers:Ee({authToken:s,embedMode:l})}),c=await m.json().catch(()=>null);if(!m.ok){const u=typeof(c==null?void 0:c.error)=="string"&&c.error||typeof(c==null?void 0:c.message)=="string"&&c.message||`Failed to load auto-continue status (${m.status})`;return{ok:!1,initiativeId:n,run:null,defaults:{tokenBudget:null,tickMs:0},error:u}}return c},refetchInterval:p=>{var x,j;const m=p.state.data;if((m==null?void 0:m.ok)===!1)return!1;const c=((x=m==null?void 0:m.error)==null?void 0:x.toLowerCase())??"";if(c.includes("404")||c.includes("400")||c.includes("not found")||c.includes("bad request"))return!1;const f=((j=m==null?void 0:m.run)==null?void 0:j.status)??null;return f==="running"||f==="stopping"?2500:12e3}}),F=async()=>{await b.invalidateQueries({queryKey:C}),await b.invalidateQueries({queryKey:He.missionControlGraph({initiativeId:n,authToken:s,embedMode:l})}),await b.invalidateQueries({queryKey:He.liveData({authToken:s,embedMode:l})})},_=Ve({mutationFn:async p=>{if(g){const f=y.data??null;return{ok:!0,initiativeId:n,run:(f==null?void 0:f.run)??null,defaults:(f==null?void 0:f.defaults)??{tokenBudget:null,tickMs:0}}}const m={};n&&(m.initiativeId=n),m.ignoreSpawnGuardRateLimit=!0,p&&typeof p=="object"&&(typeof p.tokenBudgetTokens=="number"&&(m.tokenBudgetTokens=p.tokenBudgetTokens),typeof p.agentId=="string"&&p.agentId.trim().length>0&&(m.agentId=p.agentId.trim()),typeof p.maxParallelSlices=="number"&&Number.isFinite(p.maxParallelSlices)&&(m.maxParallelSlices=p.maxParallelSlices),p.parallelMode==="iwmt"&&(m.parallelMode=p.parallelMode));const c=await fetch("/orgx/api/mission-control/auto-continue/start",{method:"POST",headers:Ee({authToken:s,embedMode:l,contentTypeJson:!0}),body:JSON.stringify(m)}),u=await c.json().catch(()=>null);if(!c.ok){const f=ht(u);if(f)throw f;const x=typeof(u==null?void 0:u.error)=="string"&&u.error||typeof(u==null?void 0:u.message)=="string"&&u.message||`Failed to start auto-continue (${c.status})`;throw new Error(x)}if(u&&typeof u=="object"&&"run"in u){const f=y.data??null;return{ok:!0,initiativeId:n,run:u.run??null,defaults:(f==null?void 0:f.defaults)??{tokenBudget:null,tickMs:0}}}return u},onSuccess:()=>{F()}}),H=Ve({mutationFn:async()=>{if(g){const u=y.data??null;return{ok:!0,initiativeId:n,run:null,defaults:(u==null?void 0:u.defaults)??{tokenBudget:null,tickMs:0}}}const p={};n&&(p.initiativeId=n);const m=await fetch("/orgx/api/mission-control/auto-continue/stop",{method:"POST",headers:Ee({authToken:s,embedMode:l,contentTypeJson:!0}),body:JSON.stringify(p)}),c=await m.json().catch(()=>null);if(!m.ok){const u=typeof(c==null?void 0:c.error)=="string"&&c.error||typeof(c==null?void 0:c.message)=="string"&&c.message||`Failed to stop auto-continue (${m.status})`;throw new Error(u)}if(c&&typeof c=="object"&&"run"in c){const u=y.data??null;return{ok:!0,initiativeId:n,run:c.run??null,defaults:(u==null?void 0:u.defaults)??{tokenBudget:null,tickMs:0}}}return c},onSuccess:()=>{F()}}),T=Ve({mutationFn:async p=>{var f;if(g)return{ok:!0,dispatched:((f=p.workstreamIds)==null?void 0:f.length)??1};const m={initiativeId:p.initiativeId};p.workstreamIds&&p.workstreamIds.length>0&&(m.workstreamIds=p.workstreamIds),p.agentId&&(m.agentId=p.agentId),p.scope&&(m.scope=p.scope),m.ignoreSpawnGuardRateLimit=!0;const c=await fetch("/orgx/api/mission-control/next-up/launch",{method:"POST",headers:Ee({authToken:s,embedMode:l,contentTypeJson:!0}),body:JSON.stringify(m)}),u=await c.json().catch(()=>null);if(!c.ok){const x=ht(u);if(x)throw x;const j=typeof(u==null?void 0:u.error)=="string"&&u.error||typeof(u==null?void 0:u.message)=="string"&&u.message||`Failed to launch (${c.status})`;throw new Error(j)}return u??{ok:!0,dispatched:0}},onSuccess:()=>{F()}}),M=((se=y.data)==null?void 0:se.run)??null,L=(M==null?void 0:M.status)??null,z=L==="running"||L==="stopping",U=L==="stopping"||H.isPending;return{status:y.data??null,run:M,isRunning:z,isGracefullyStopping:U,isLoading:y.isLoading,error:((Y=y.data)==null?void 0:Y.error)??((re=y.error)==null?void 0:re.message)??null,start:_.mutateAsync,stop:H.mutateAsync,launchSingle:T.mutateAsync,isStarting:_.isPending,isStopping:H.isPending,isLaunching:T.isPending,refetch:y.refetch}}async function St(n,s){var g;const i=await(await fetch(n,s)).json().catch(()=>null),b=((g=i==null?void 0:i.data)==null?void 0:g.url)??(i==null?void 0:i.url)??null;if(typeof b=="string"&&b.trim())return b.trim();throw new Error((i==null?void 0:i.error)??"Billing link unavailable")}async function cn(n){var b;const s=((b=n==null?void 0:n.actions)==null?void 0:b.checkout)??"/orgx/api/billing/checkout",l=((n==null?void 0:n.requiredPlan)??"starter").trim().toLowerCase()||"starter",i=await St(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({planId:l})});window.open(i,"_blank","noopener,noreferrer")}async function un(n){var i;const s=((i=n==null?void 0:n.actions)==null?void 0:i.portal)??"/orgx/api/billing/portal",l=await St(s,{method:"POST"});window.open(l,"_blank","noopener,noreferrer")}function dn(n){return n==="success"?"border-emerald-400/30 bg-[#0A1210]/95 text-emerald-100":n==="warning"?"border-amber-300/30 bg-[#12100A]/95 text-amber-100":n==="error"?"border-red-400/32 bg-[#120A0A]/95 text-red-100":n==="info"?"border-cyan-300/28 bg-[#0A1012]/95 text-cyan-100":"border-strong bg-[#0B0F16]/95 text-primary"}function mn({open:n,tone:s="neutral",title:l,message:i=null,className:b,primaryAction:g=null,secondaryAction:C=null,onDismiss:y=null,autoDismissMs:F=null}){return d.useEffect(()=>{if(!n||!y||!F)return;const _=window.setTimeout(()=>y(),F);return()=>window.clearTimeout(_)},[F,y,n,l,i]),e.jsx(qe,{initial:!1,children:n?e.jsx(V.div,{initial:{opacity:0,y:-8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.985},transition:{duration:.2,ease:[.22,1,.36,1]},className:`pointer-events-none ${b??""}`,children:e.jsxs("div",{className:`pointer-events-none min-w-[220px] max-w-[420px] rounded-xl border px-3 py-2 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur ${dn(s)}`,children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-caption font-semibold",children:l}),i?e.jsx("p",{className:"mt-0.5 text-caption opacity-85",children:i}):null]}),y?e.jsx("button",{type:"button",onClick:y,className:"pointer-events-auto inline-flex h-6 w-6 items-center justify-center rounded-md text-current/70 transition-colors hover:bg-white/[0.08] hover:text-current","aria-label":"Dismiss toast",title:"Dismiss",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}):null]}),g||C?e.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[C?e.jsx("button",{type:"button",onClick:C.onClick,className:"pointer-events-auto h-7 rounded-md border border-strong bg-white/[0.06] px-2.5 text-micro font-semibold text-current transition-colors hover:bg-white/[0.12]",children:C.label}):null,g?e.jsx("button",{type:"button",onClick:g.onClick,className:"pointer-events-auto h-7 rounded-md border border-white/25 bg-white/[0.14] px-2.5 text-micro font-semibold text-current transition-colors hover:bg-white/[0.2]",children:g.label}):null]}):null]})}):null})}function Ct({className:n=""}){return e.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:n,children:e.jsx("path",{d:"M7 5.4v9.2c0 .7.75 1.15 1.38.83l7.6-4.6a.95.95 0 0 0 0-1.62l-7.6-4.64A.95.95 0 0 0 7 5.4Z",fill:"currentColor"})})}function xn({className:n=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:n,children:[e.jsx("path",{d:"M6.2 9.4V6.7c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M8.4 8.9V5.8c0-.7.5-1.3 1.1-1.3s1.1.6 1.1 1.3v3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M10.6 8.9V6.2c0-.7.5-1.3 1.1-1.3s1.1.6 1.1 1.3v3.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M12.8 9.6V7.2c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v4.2c0 2.7-1.9 4.6-4.6 4.6H9.2c-2.1 0-3.7-1-4.6-2.8l-.9-1.7c-.3-.6 0-1.4.6-1.7.6-.3 1.3 0 1.6.6l.7 1.4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function pn({className:n=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:n,children:[e.jsx("path",{d:"M6.4 9.2V7.4c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v1.3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M8.6 8.9V7c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M10.8 9.2V7.3c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2.6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M13 9.8V8.2c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v3.6c0 2.4-1.7 4-4.1 4H9.7c-2 0-3.4-.9-4.2-2.5l-.8-1.4c-.3-.6 0-1.3.5-1.6.6-.3 1.2-.1 1.6.5l.6 1",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function yt(n){return n==="running"?"border-teal-300/35 bg-teal-400/[0.12] text-teal-100":n==="blocked"?"border-amber-300/35 bg-amber-400/[0.12] text-amber-100":n==="idle"?"border-strong bg-white/[0.05] text-secondary":"border-[#BFFF00]/30 bg-[#BFFF00]/12 text-[#E1FFB2]"}function wt(n){return n==="running"?"Running":n==="blocked"?"Needs input":n==="idle"?"Idle":"Queued"}function Ae(n){return n==="queued"||n==="idle"?0:n==="blocked"?1:n==="running"?2:n==="completed"?3:4}function hn(n){return n.some(s=>s.queueState==="running")?"running":n.some(s=>s.queueState==="blocked")?"blocked":n.some(s=>s.queueState==="queued")?"queued":n.some(s=>s.queueState==="idle")?"idle":"completed"}function It(n){return n==="running"?"from-teal-300/0 via-teal-300/60 to-teal-300/0":n==="blocked"?"from-amber-300/0 via-amber-300/55 to-amber-300/0":n==="idle"?"from-white/0 via-white/35 to-white/0":"from-[#BFFF00]/0 via-[#BFFF00]/70 to-[#BFFF00]/0"}function Je(n){return n==="running"?"Current":n==="blocked"?"Blocked on":"Next"}function Ze(n){const s=typeof n.sliceTaskCount=="number"&&Number.isFinite(n.sliceTaskCount)?Math.max(0,Math.floor(n.sliceTaskCount)):null,l=n.sliceScope==="task"?"task":n.sliceScope==="milestone"?"milestone slice":"workstream slice",i=s&&s>0?`${s} ${s===1?"task":"tasks"}`:null;return n.queueState==="running"?i?`Executing ${i} in ${l}.`:"Execution in progress. Task detail will appear as the scheduler advances.":n.queueState==="blocked"?n.blockReason?"Blocked while waiting for dependency resolution.":"Blocked. Waiting for dependency or review.":n.queueState==="queued"?i?`Queued with ${i} in ${l}.`:"Queued at workstream scope. Task detail will populate after dispatch.":n.queueState==="completed"?"Completed. No queued tasks remain.":"Idle. Ready to dispatch when started."}function qt(n){const s=typeof n.initiativePriority=="string"?n.initiativePriority.trim().toLowerCase():"",l=typeof n.initiativePriorityNum=="number"&&Number.isFinite(n.initiativePriorityNum)?Math.max(1,Math.min(100,Math.round(n.initiativePriorityNum))):null,i=s==="urgent"||s==="high"||s==="medium"||s==="low"?s:l!==null?l<=12?"urgent":l<=30?"high":l<=60?"medium":"low":null;if(!i)return null;const b=i==="urgent"?"P1":i==="high"?"P2":i==="medium"?"P3":"P4",g=i==="urgent"?"Urgent":i==="high"?"High":i==="medium"?"Medium":"Low",C=i==="urgent"?"border-red-300/35 bg-red-500/[0.14] text-red-100":i==="high"?"border-amber-300/35 bg-amber-500/[0.14] text-amber-100":i==="medium"?"border-[#BFFF00]/35 bg-[#BFFF00]/14 text-[#E1FFB2]":"border-white/[0.2] bg-white/[0.08] text-white/70";return{shortLabel:`${b} ${g}`,longLabel:`Initiative priority ${g} (${b})`,toneClass:C}}function fn(n){const s=n.trim().toLowerCase();if(s.includes("timed out")||s.includes("timeout")||s.includes("request cancelled")||s.includes("signal is aborted"))return"Next Up is still syncing. Keep this panel open and it will repopulate automatically.";if(s.includes("unauthorized")||s.includes("forbidden")||s.includes("api key")||s.includes("auth"))return"Next Up is unavailable until OrgX authentication is reconnected in Settings.";if(s.includes("unknown api endpoint")||s.includes("route is unavailable"))return"This runtime is missing queue routes. Restart and update the plugin build.";const l=n.split("|").map(i=>i.trim()).filter(Boolean).map(i=>i.replace(/^[^:]+:\s*/,"").trim()).filter(Boolean).slice(0,2).join(" ");return Ye(l||n)||"Next Up is temporarily unavailable."}function bn(n){const s=n.trim().toLowerCase();return s.includes("timed out")||s.includes("timeout")||s.includes("request cancelled")||s.includes("signal is aborted")?"Signal is delayed right now. Queue data will appear as soon as sync catches up.":s.includes("fallback")?"Showing fallback queue data while full signal refreshes.":s.includes("unknown api endpoint")||s.includes("route is unavailable")?"Some queue controls are unavailable in this plugin build. Update and restart to restore full controls.":Ye(n.trim())}function Fe(n,s,l){const i=typeof n=="string"?n.trim():"";if(i&&!gt(i))return P(i);const b=typeof s=="string"?s.trim():"";return b?gt(b)?`${l} ${nn(b)}`:P(b):l}function $t(n){const s=typeof n.runnerAgentName=="string"?n.runnerAgentName.trim():"";if(!s)return"Unassigned";const l=s.toLowerCase();return l==="undefined"||l==="null"||l==="main"&&(n.runnerAgentId==="unassigned"||n.runnerSource==="fallback")?"Unassigned":s}function Ft(n){return n.runnerSource==="inferred"?"inferred":null}function Mt(n,s){const l=n.runnerSource==="assigned"?"assigned":n.runnerSource==="inferred"?"inferred":"fallback";return s==="Unassigned"?`Runner ${l}`:`${s} · ${l}`}function ge(n,s){return!n||n.trim().length===0?s:Ye(n.trim())||s}function vt(n){return!n||typeof n!="object"||Array.isArray(n)?null:n}function Xe(n,s){const l=P(n.workstreamTitle),i=vt(s),b=i&&typeof i.dispatchMode=="string"?i.dispatchMode:null,g=vt(i==null?void 0:i.run);return(g&&typeof g.stopReason=="string"?g.stopReason:g&&typeof g.stop_reason=="string"?g.stop_reason:null)==="budget_exhausted"?`Dispatch acknowledged for ${l}, but autopilot stopped: budget exhausted.`:b==="pending"?`Dispatching ${l}; waiting for slice start…`:b==="fallback"?`Dispatched ${l} using fallback runner.`:`Dispatched ${l}.`}function Tt({className:n=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:n,children:[e.jsx("circle",{cx:"4.5",cy:"10",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"10",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"15.5",cy:"10",r:"1.4",fill:"currentColor"})]})}function gn({compact:n}){const s=n?3:6;return e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1 pt-1 text-micro uppercase tracking-[0.12em] text-muted",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[#BFFF00]/70 status-breathe"}),e.jsx("span",{children:"Calibrating queue"})]}),Array.from({length:s}).map((l,i)=>e.jsxs("div",{className:"nextup-skeleton-card rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2.5",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[e.jsx(G,{className:"h-8 w-8 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(G,{className:"h-3 w-40 rounded-md"}),e.jsx(G,{className:"mt-2 h-4 w-56 rounded-md"})]})]}),e.jsx(G,{className:"h-5 w-16 rounded-full"})]}),e.jsxs("div",{className:"mt-3 rounded-lg border border-white/[0.07] bg-black/[0.18] px-2.5 py-2",children:[e.jsx(G,{className:"h-3 w-14 rounded"}),e.jsx(G,{className:"mt-2 h-3 w-full rounded"}),e.jsx(G,{className:"mt-2 h-3 w-3/5 rounded"})]}),e.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[e.jsx(G,{className:"h-8 w-24 rounded-full"}),e.jsx(G,{className:"h-8 w-20 rounded-full"}),e.jsx(G,{className:"h-8 w-24 rounded-full"})]})]},`nextup-skeleton-${i}`))]})}function yn({initiativeId:n=null,projectId:s=null,authToken:l=null,embedMode:i=!1,title:b="Next Up",showHeader:g=!0,compact:C=!1,className:y,disableEnterAnimation:F=!1,allowCompactToggle:_=!1,onToggleCompact:H,onOpenInitiative:T,onOpenSettings:M,onUpgradeGate:L,onOpenSliceDetail:z,selectionEnabled:U=!0,panelStyle:se="card",showQueueSettings:Y=!0,queueModel:re,queueActions:p,snapshotVersion:m=null,excludeRunning:c=!1}){var pt;const[u,f]=d.useState(C);d.useEffect(()=>f(C),[C]);const x=_&&!H?u:C,j=t=>{H?H(t):f(t)},[J,N]=d.useState(null),[I,ye]=d.useState("workstream"),[de,we]=d.useState(null),ve="bottom",[B,ie]=d.useState(null),[K,w]=d.useState(null),[me,ae]=d.useState(null),[O,xe]=d.useState(new Set),[Me,pe]=d.useState(null),[ke,je]=d.useState(!1),[Bt,Te]=d.useState(!1),Z=Nt(),Oe=d.useRef(null),Rt=Yt({initiativeId:n,projectId:s,authToken:l,embedMode:i,enabled:!re,snapshotVersion:m,zoomLevel:I}),Lt=re??Rt,{items:he,degraded:oe,isLoading:Q,isFetching:et,error:Be,refetch:Pt,playWorkstream:_e,startWorkstreamAutoContinue:tt,initiativeGroups:ze,milestoneGroups:Qe}=Lt;ln({initiativeId:n,authToken:l,embedMode:i});const Et=Ot({authToken:l,embedMode:i}),X=p??Et,D=t=>`${t.initiativeId}:${t.workstreamId}`,ee=I==="workstream",Ne=d.useMemo(()=>he.filter(t=>t.queueState==="running").length,[he]),Ue=d.useMemo(()=>Z?{duration:.01}:k.surfaceSwitch,[Z]),W=d.useMemo(()=>{if(c)return he.filter(a=>a.queueState!=="running");const t=he.filter(a=>a.queueState!=="running");return t.length>0?t:he},[c,he]),nt=d.useMemo(()=>W.length===0?"empty":W.some(t=>t.queueState!=="running"&&t.queueState!=="blocked")?"queued":W.some(t=>t.queueState==="blocked")?"blocked":W.some(t=>t.queueState==="running")?"running":"queued",[W]),st=d.useMemo(()=>c?ze.map(t=>({...t,items:t.items.filter(a=>a.queueState!=="running")})).filter(t=>t.items.length>0).map(t=>({...t,queueState:hn(t.items)})):ze,[c,ze]),Se=d.useMemo(()=>[...st].sort((t,a)=>{const o=Ae(t.queueState)-Ae(a.queueState);return o!==0?o:t.initiativeTitle.localeCompare(a.initiativeTitle)}),[st]),rt=d.useMemo(()=>c?Qe.filter(t=>t.item.queueState!=="running"):Qe,[c,Qe]),Ce=d.useMemo(()=>[...rt].sort((t,a)=>{const o=Ae(t.queueState)-Ae(a.queueState);if(o!==0)return o;const r=t.initiativeTitle.localeCompare(a.initiativeTitle);if(r!==0)return r;const h=t.workstreamTitle.localeCompare(a.workstreamTitle);return h!==0?h:t.milestoneTitle.localeCompare(a.milestoneTitle)}),[rt]),Ke=d.useMemo(()=>x?Se.slice(0,5):Se,[x,Se]),De=d.useMemo(()=>x?Ce.slice(0,5):Ce,[x,Ce]),it=d.useMemo(()=>I==="initiative"?Se.length:I==="milestone"?Ce.length:W.length,[W.length,Se.length,Ce.length,I]),At=[{value:"initiative",label:"Initiative"},{value:"workstream",label:"Workstream"},{value:"milestone",label:"Milestone"}],R=d.useMemo(()=>ee?x?W.slice(0,5):W:[],[x,ee,W]),_t=d.useMemo(()=>R.filter(t=>O.has(D(t))),[O,R]),[fe,at]=d.useState([]),We=d.useRef([]),ot=d.useMemo(()=>{const t=new Map;for(const a of R)t.set(D(a),a);return t},[R]),E=d.useMemo(()=>R.map(D),[R]),zt=d.useMemo(()=>E.join("|"),[E]);d.useEffect(()=>{at(t=>{if(x)return[];const a=[],o=new Set(E);for(const r of t)o.has(r)&&a.push(r);for(const r of E)a.includes(r)||a.push(r);return a})},[x,zt]),d.useEffect(()=>{We.current=fe},[fe]),d.useEffect(()=>{Me&&(E.includes(Me)||pe(null))},[Me,E]),d.useEffect(()=>{xe(t=>{if(t.size===0)return t;const a=new Set(R.map(D)),o=new Set;for(const r of t)a.has(r)&&o.add(r);return o.size===t.size?t:o})},[R]),d.useEffect(()=>{if(!me)return;R.some(a=>D(a)===me)||ae(null)},[me,R]),d.useEffect(()=>{if(oe.length===0){Te(!1);return}Te(!1)},[oe]),d.useEffect(()=>{U&&!x&&O.size>0&&je(!1)},[x,O.size,U]),d.useEffect(()=>{if(!ke)return;const t=o=>{var h;const r=o.target;r&&((h=Oe.current)!=null&&h.contains(r)||je(!1))},a=o=>{o.key==="Escape"&&je(!1)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t),document.removeEventListener("keydown",a)}},[ke]);const lt=async t=>{const a=D(t),o=P(t.workstreamTitle);try{await X.remove({initiativeId:t.initiativeId,workstreamId:t.workstreamId}),xe(r=>{if(!r.has(a))return r;const h=new Set(r);return h.delete(a),h}),pe(r=>r===a?null:r),N(`Removed ${o} from queue.`)}catch(r){const h=r instanceof Error?r.message:"";N(ge(h,"Failed to remove from queue"))}},Qt=(t,a,o)=>{const r=x?E:fe.length>0?fe:E;xe(h=>{const v=new Set(h),A=Me;if(o&&A&&r.includes(A)){const S=r.indexOf(t),te=r.indexOf(A);if(S>=0&&te>=0){const[Le,Pe]=S<te?[S,te]:[te,S];for(const Ie of r.slice(Le,Pe+1))a?v.add(Ie):v.delete(Ie)}else a?v.add(t):v.delete(t)}else a?v.add(t):v.delete(t);return v}),pe(t)},Ut=()=>{xe(new Set(E)),pe(E.length>0?E[E.length-1]:null)},Kt=()=>{xe(new Set),pe(null)},Ge=async t=>{if(O.size===0){N("Select one or more queue items first.");return}const a=R.map(o=>({key:D(o),item:o})).filter(o=>O.has(o.key));if(a.length===0){N("Selected queue items are no longer visible.");return}w(`bulk:${t}`),N(null);try{const o=a.map(({item:S})=>({initiativeId:S.initiativeId,workstreamId:S.workstreamId})),r=await X.bulk({action:t,items:o}),h=typeof(r==null?void 0:r.updated)=="number"?r.updated??0:0,v=typeof(r==null?void 0:r.failed)=="number"?r.failed??0:0,A=Array.isArray(r==null?void 0:r.errors)?r.errors.filter(S=>typeof S=="string").map(S=>S.trim()).filter(Boolean):[],q=t==="remove"?"removed":t==="move_top"?"moved to top":"moved to bottom";h===0&&v>0&&A.length>0?N(ge(A[0],`${v} queue action${v===1?"":"s"} failed.`)):N(v>0?`${h} item${h===1?"":"s"} ${q}; ${v} failed.`:`${h} item${h===1?"":"s"} ${q}.`),xe(new Set),pe(null)}catch(o){const r=o instanceof Error?o.message:"";N(ge(r,"Bulk queue action failed"))}finally{w(null)}},Dt=async()=>{const t=We.current.map(a=>ot.get(a)).filter(Boolean).map(a=>({initiativeId:a.initiativeId,workstreamId:a.workstreamId}));t.length!==0&&await X.reorder({order:t})},le=async(t,a,o)=>{N(null),ie(null),L==null||L(null),w(t);try{const r=await a();N(typeof o=="function"?o(r):o)}catch(r){if(r instanceof sn)ie(r),L==null||L(r);else{const h=r instanceof Error?r.message:"";N(ge(h,"Action failed"))}}finally{w(null)}},ct=async t=>await _e({initiativeId:t.initiativeId,workstreamId:t.workstreamId,agentId:t.runnerAgentId}),Re=B?"upgrade":Be?"error":J?"notice":null,ut=Be?fn(Be):null,dt=oe.length>0?bn(oe[0]):null,Wt=Re!==null,Gt=oe.length>0&&!Bt&&me===null&&!ke,ce=_t.length,Vt=d.useMemo(()=>I==="initiative"?Ke.length>0:I==="milestone"?De.length>0:R.length>0,[Ke.length,R.length,De.length,I]),mt=U&&ee&&!x&&ce>0,Ht=I==="initiative"?"No initiatives in the queue right now.":I==="milestone"?"No milestone slices in the queue right now.":Ne>0?`No queued workstreams yet. ${Ne} running item${Ne===1?"":"s"} still in-flight.`:oe.length>0?"Queue signal is delayed right now.":"No queued workstreams right now.",xt=e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:Ut,className:"control-pill h-8 px-2.5 text-caption font-semibold",children:"Select all"}),e.jsx("button",{type:"button",onClick:Kt,disabled:O.size===0,className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Clear"}),e.jsx("button",{type:"button",disabled:ce===0||K==="bulk:move_top",onClick:()=>void Ge("move_top"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Move top"}),e.jsx("button",{type:"button",disabled:ce===0||K==="bulk:move_bottom",onClick:()=>void Ge("move_bottom"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Move bottom"}),e.jsx("button",{type:"button",disabled:ce===0||K==="bulk:remove",onClick:()=>void Ge("remove"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Remove"})]});return e.jsxs(en,{surface:se==="card",className:`flex h-full min-h-0 flex-col overflow-hidden ${F?"":"card-enter"} ${se==="flat"?"!rounded-none !border-none !bg-transparent !shadow-none":""} ${y??""}`,children:[g?e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-subtle px-4 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("h2",{className:"truncate text-heading font-semibold text-white",children:b}),e.jsx("span",{className:"chip inline-flex min-w-[52px] justify-center text-micro tabular-nums",children:Q?e.jsx("span",{"aria-hidden":!0,className:"h-2.5 w-5 rounded bg-white/15 animate-pulse"}):it}),e.jsx("span",{className:ne("chip inline-flex min-w-[148px] justify-center text-micro tabular-nums transition-opacity",!Q&&Ne>0&&ee?"text-secondary opacity-100":"pointer-events-none opacity-0"),children:`${Ne} active elsewhere`}),e.jsx("span",{className:ne("inline-flex min-w-[92px] justify-end text-micro text-muted transition-opacity",et&&!Q?"opacity-100":"opacity-0"),"aria-live":"polite",children:"refreshing…"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"inline-flex items-center rounded-xl border border-white/[0.1] bg-white/[0.03] p-1",role:"tablist","aria-label":"Next Up scope",children:At.map(t=>{const a=I===t.value;return e.jsxs(V.button,{type:"button",role:"tab","aria-selected":a,onClick:()=>ye(t.value),...k.segmentedTap,className:ne("relative h-7 rounded-lg px-2.5 text-caption font-semibold transition-colors",a?"text-[#E8FFD0]":"text-secondary hover:text-white"),title:`Show ${t.label.toLowerCase()} queue`,children:[a?e.jsx(V.span,{layoutId:"next-up-scope-indicator",transition:Z?{duration:.01}:k.railMorphSpring,className:"pointer-events-none absolute inset-0 rounded-lg border border-[#BFFF00]/35 bg-[#BFFF00]/16","aria-hidden":!0}):null,e.jsx("span",{className:"relative z-[1]",children:t.label})]},t.value)})}),_?e.jsx("button",{type:"button",onClick:()=>j(!x),className:"control-pill h-8 flex-shrink-0 whitespace-nowrap px-3 text-caption font-semibold",title:x?"Switch to expanded cards":"Switch to compact list","aria-label":x?"Expand Next Up queue":"Compact Next Up queue",children:x?"Expand":"Compact"}):null]})]}):null,Wt&&e.jsx("div",{className:"px-3 pt-2",children:e.jsx(qe,{initial:!1,mode:"wait",children:Re==="upgrade"&&B?e.jsx(V.div,{initial:{opacity:0,y:-4,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:Ue,className:"rounded-xl border border-amber-200/25 bg-amber-200/10 px-3 py-2 text-caption text-amber-100",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-amber-200/25 bg-amber-200/10 px-2 py-0.5 text-micro font-semibold uppercase tracking-[0.08em] text-amber-100/90",children:"Upgrade required"}),e.jsxs("span",{className:"truncate text-micro text-secondary",children:[ft(B.currentPlan)," →"," ",ft(B.requiredPlan)]})]}),e.jsx("div",{className:"mt-1 line-clamp-2 text-caption leading-snug text-amber-50/90",title:B.message,children:B.message}),J?e.jsx("div",{className:"mt-1 text-micro text-rose-50/85",children:J}):null]}),e.jsxs("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>void cn({actions:B.actions,requiredPlan:B.requiredPlan}).catch(t=>N(ge(t instanceof Error?t.message:"","Checkout failed"))),className:"h-7 rounded-full border border-amber-200/25 bg-amber-200/15 px-3 text-micro font-semibold text-amber-50 transition-colors hover:bg-amber-200/20",children:"Upgrade"}),e.jsx("button",{type:"button",onClick:()=>void un({actions:B.actions}).catch(t=>N(ge(t instanceof Error?t.message:"","Portal failed"))),className:"h-7 rounded-full border border-strong bg-white/[0.04] px-3 text-micro font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:"Billing"}),M&&e.jsx("button",{type:"button",onClick:M,className:"h-7 rounded-full border border-strong bg-white/[0.04] px-2.5 text-micro font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:"Settings"})]}),(pt=B.actions)!=null&&pt.pricing?e.jsx("a",{href:B.actions.pricing,target:"_blank",rel:"noopener noreferrer",className:"text-micro text-secondary underline decoration-white/20 hover:text-primary",children:"View pricing"}):null]})]})},"upgrade"):Re==="error"&&ut?e.jsx(V.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:Ue,className:"rounded-xl border border-red-400/25 bg-red-500/[0.08] px-3 py-2 text-caption text-red-100",children:ut},"error"):Re==="notice"&&J?e.jsx(V.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:Ue,className:"rounded-xl border border-white/[0.1] bg-white/[0.03] px-3 py-2 text-caption text-primary",children:J},"notice"):null})}),e.jsxs("div",{className:`flex-1 space-y-2.5 overflow-y-auto overscroll-y-contain px-3 pb-3 ${g?"pt-1":"pt-2.5"}`,children:[!Q&&it>0?e.jsxs("div",{className:"flex flex-col gap-2.5 px-0.5 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-micro uppercase tracking-[0.08em] text-muted",children:I==="initiative"?"Initiatives":I==="milestone"?"Milestone slices":nt==="blocked"?"Needs attention":nt==="running"?"Running now":"Queue"}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[ce>0?e.jsxs("span",{className:"chip text-micro",children:[ce," selected"]}):null,e.jsx("span",{className:ne("inline-flex min-w-[92px] text-micro text-muted transition-opacity",et&&!Q?"opacity-100":"opacity-0"),"aria-live":"polite",children:"refreshing…"}),U&&ee&&!x&&ce===0?e.jsx("span",{className:"text-micro text-muted",children:"Shift+select to pick ranges."}):null]})]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 sm:justify-end",children:[_?e.jsx("button",{type:"button",onClick:()=>j(!x),className:"control-pill h-8 px-2.5 text-caption font-semibold",title:x?"Switch to expanded cards":"Switch to compact list","aria-label":x?"Expand Next Up queue":"Compact Next Up queue",children:x?"Expand":"Compact"}):null,mt?e.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:xt}):null,!mt&&Y&&ee?e.jsxs("div",{ref:Oe,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>je(t=>!t),className:"control-pill h-8 px-2.5 text-caption font-semibold","aria-haspopup":"menu","aria-expanded":ke,title:"Queue settings",children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"opacity-85","aria-hidden":!0,children:[e.jsx("path",{d:"M4 6h16"}),e.jsx("path",{d:"M7 12h10"}),e.jsx("path",{d:"M10 18h4"})]}),e.jsx("span",{children:"Queue"})]}),ke?e.jsx("div",{className:"surface-tier-2 absolute right-0 top-[calc(100%+8px)] z-[280] w-[320px] max-w-[86vw] rounded-xl p-3 shadow-[0_18px_42px_rgba(0,0,0,0.46)] backdrop-blur-xl",children:e.jsxs("div",{className:"space-y-2.5",children:[U&&!x?e.jsxs("div",{children:[e.jsx("p",{className:"section-kicker",children:"Bulk actions"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:xt})]}):null,M?e.jsx("button",{type:"button",onClick:()=>{je(!1),M()},className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open settings"}):null]})}):null]}):null]})]}):null,Q?e.jsx(gn,{compact:x}):null,!Q&&!Vt&&!Be&&e.jsx(tn,{icon:"queue",headline:Ht,description:dt??"Create an initiative or add workstreams to populate the queue.",primaryAction:oe.length>0?{label:"Retry now",onClick:()=>{Te(!1),Pt()}}:void 0}),!Q&&I==="initiative"?e.jsx(qe,{initial:!1,children:Ke.map((t,a)=>{const o=t.items.find(q=>q.queueState!=="running"&&q.queueState!=="completed")??t.items[0]??null,r=Fe(t.initiativeTitle,t.initiativeId,"Initiative"),h=wt(t.queueState),v=yt(t.queueState),A=t.items.reduce((q,S)=>q+(S.sliceTaskCount??0),0);return e.jsxs(V.article,{layout:!0,initial:{opacity:0,y:8,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:Z?.01:k.surfaceSwitch.duration,delay:Z?0:Math.min(a,k.listStaggerMaxItems)*k.listStaggerStep,ease:k.surfaceSwitch.ease},className:"rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-micro uppercase tracking-[0.08em] text-muted",children:"Initiative"}),e.jsx("p",{className:"mt-0.5 truncate text-body font-semibold text-white",title:r,children:r})]}),e.jsx("span",{className:ne("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em]",v),children:h})]}),e.jsxs("p",{className:"mt-1 text-micro text-secondary",children:[t.workstreamCount," workstreams · ",A," tasks"]}),e.jsx("div",{className:"mt-2 space-y-1",children:t.items.slice(0,3).map((q,S)=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-white/[0.06] bg-black/[0.18] px-2.5 py-1.5 text-caption",children:[e.jsx("span",{className:"truncate text-white/84",children:P(q.workstreamTitle)}),e.jsxs("span",{className:"text-micro text-secondary",children:[q.sliceTaskCount??0," tasks"]})]},`${q.workstreamId}:${S}`))}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>T==null?void 0:T(t.initiativeId,t.initiativeTitle),className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open"}),e.jsx("button",{type:"button",disabled:!o||K===`initiative:${t.initiativeId}`,onClick:()=>{o&&le(`initiative:${t.initiativeId}`,()=>ct(o),`Dispatched ${P(o.workstreamTitle)}.`)},className:"control-pill h-7 px-2.5 text-micro font-semibold disabled:opacity-45",children:"Dispatch"})]})]},`initiative-group:${t.initiativeId}`)})}):null,!Q&&I==="milestone"?e.jsx(qe,{initial:!1,children:De.map((t,a)=>{const o=t.item,r=`milestone:${t.workstreamId}:${t.milestoneId??"none"}`;return e.jsxs(V.article,{layout:!0,initial:{opacity:0,y:8,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:Z?.01:k.surfaceSwitch.duration,delay:Z?0:Math.min(a,k.listStaggerMaxItems)*k.listStaggerStep,ease:k.surfaceSwitch.ease},className:"rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-micro uppercase tracking-[0.08em] text-muted",children:[P(t.initiativeTitle)," · ",P(t.workstreamTitle)]}),e.jsx("p",{className:"mt-0.5 truncate text-body font-semibold text-white",title:t.milestoneTitle,children:P(t.milestoneTitle)})]}),e.jsx("span",{className:ne("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em]",yt(t.queueState)),children:wt(t.queueState)})]}),e.jsxs("p",{className:"mt-1 text-micro text-secondary",children:[t.taskCount," tasks in slice"]}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>T==null?void 0:T(t.initiativeId,t.initiativeTitle),className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open"}),e.jsx("button",{type:"button",disabled:K===r||t.queueState==="running",onClick:()=>void le(r,()=>ct(o),h=>Xe(o,h)),className:"control-pill h-7 px-2.5 text-micro font-semibold disabled:opacity-45",children:t.queueState==="running"?"Running":"Start"})]})]},`${t.initiativeId}:${t.workstreamId}:${t.milestoneId??"none"}`)})}):null,!Q&&ee&&x?e.jsx(qe,{initial:!1,children:R.map((t,a)=>{const o=D(t),r=K===o,h=t.queueState==="running",v=t.nextTaskDueAt?kt(t.nextTaskDueAt):null,A=Fe(t.initiativeTitle,t.initiativeId,"Initiative"),q=Fe(t.workstreamTitle,t.workstreamId,"Workstream"),S=qt(t),te=t.nextTaskTitle?P(t.nextTaskTitle):null,Le=t.blockReason?P(t.blockReason):null,Pe=$t(t),Ie=Ft(t);return e.jsxs(V.article,{layout:!0,initial:{opacity:0,y:6,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:Z?.01:k.surfaceSwitch.duration,delay:Z?0:Math.min(a,k.listStaggerMaxItems)*k.listStaggerStep,ease:k.surfaceSwitch.ease},className:"group relative overflow-visible rounded-2xl border border-white/[0.08] bg-white/[0.02] px-2.5 py-2 cursor-pointer transition-colors hover:border-white/[0.14]",onClick:()=>z==null?void 0:z(t),role:"button",tabIndex:0,onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),z==null||z(t))},children:[e.jsx("div",{className:`pointer-events-none absolute inset-x-2.5 top-0 h-px bg-gradient-to-r ${It(t.queueState)}`,"aria-hidden":!0}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx(jt,{name:Pe,hint:Mt(t,Pe),size:"xs"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx($e,{type:"initiative",size:11,className:"flex-shrink-0 opacity-85"}),e.jsx("button",{type:"button",onClick:()=>T==null?void 0:T(t.initiativeId,t.initiativeTitle),className:"block min-w-0 flex-1 truncate text-left text-micro uppercase tracking-[0.08em] text-muted transition-colors hover:text-white/72",title:A,children:A}),S?e.jsx("span",{className:ne("inline-flex flex-shrink-0 items-center rounded-full border px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.08em]",S.toneClass),title:S.longLabel,children:S.shortLabel}):null]}),e.jsxs("p",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 text-caption font-semibold leading-snug text-white",title:q,children:[e.jsx($e,{type:"workstream",size:12,className:"flex-shrink-0 opacity-95"}),e.jsx("span",{className:"line-clamp-2",children:q})]}),te?e.jsxs("p",{className:"mt-0.5 line-clamp-2 text-micro leading-snug text-secondary",title:`${Je(t.queueState)}: ${te}${v?` · ${v}`:""}`,children:[Je(t.queueState),": ",te,v?` · ${v}`:""]}):e.jsx("p",{className:"mt-0.5 line-clamp-2 text-micro leading-snug text-secondary",title:Ze(t),children:Ze(t)}),Ie?e.jsxs("p",{className:"mt-0.5 text-micro text-muted",children:["Runner ",Ie]}):null,e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[(()=>{const $=t.objectiveScore??t.compositeScore??null;if($==null)return null;const be=$>=80?"S":$>=60?"A":"B",ue=be==="S"?"border-[#BFFF00]/30 bg-[#BFFF00]/[0.12] text-[#d8ffa1]":be==="A"?"border-[#14B8A6]/30 bg-[#14B8A6]/[0.12] text-[#87FFE9]":"border-white/[0.12] bg-white/[0.05] text-white/60";return e.jsxs("span",{className:`chip text-[9px] font-semibold ${ue}`,children:[be,"-tier"]})})(),(()=>{const $=t.expectedValueUsd,be=t.sliceTaskCount??0,ue=[];return be>0&&ue.push(`${be} tasks`),typeof $=="number"&&$>0&&ue.push(`$${$.toFixed(2)}`),v&&ue.push(v),ue.length===0?null:e.jsx("span",{className:"text-micro text-muted",children:ue.join(" · ")})})()]})]})]}),(t.sliceTaskCount??0)>0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-[2px] rounded-b-2xl overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.max(t.queueState==="completed"?100:t.queueState==="running"?50:15,4)}%`,background:`linear-gradient(90deg, ${bt.lime}, ${bt.teal})`,opacity:.6}})}),Le&&e.jsxs("div",{className:"mt-1.5 rounded-lg border border-red-400/24 bg-red-500/[0.08] px-2.5 py-1 text-micro text-red-100/85",children:["Blocked: ",Le]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",onClick:$=>$.stopPropagation(),children:[e.jsx("button",{type:"button",disabled:r||h,onClick:()=>void le(o,()=>_e({initiativeId:t.initiativeId,workstreamId:t.workstreamId,agentId:t.runnerAgentId}),$=>Xe(t,$)),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:h?"Already running":"Start now",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Ct,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:h?"Running":"Start"})]})}),e.jsxs("div",{className:"relative ml-auto",children:[e.jsx("button",{type:"button",disabled:r,onClick:()=>ae($=>$===o?null:o),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:"Queue actions",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Tt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:"More"})]})}),me===o&&e.jsxs("div",{className:"absolute right-0 top-[calc(100%+6px)] z-[320] min-w-[178px] rounded-xl border border-white/[0.1] bg-[#080d14]/95 p-1.5 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur",children:[e.jsx("button",{type:"button",onClick:()=>{ae(null),le(`${o}:top`,()=>X.move({initiativeId:t.initiativeId,workstreamId:t.workstreamId,placement:"top"}),`Moved ${q} to top of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to top"}),e.jsx("button",{type:"button",onClick:()=>{ae(null),le(`${o}:bottom`,()=>X.move({initiativeId:t.initiativeId,workstreamId:t.workstreamId,placement:"bottom"}),`Moved ${q} to bottom of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to bottom"}),e.jsx("button",{type:"button",onClick:()=>{ae(null),le(`${o}:auto`,async()=>(await X.move({initiativeId:t.initiativeId,workstreamId:t.workstreamId,placement:"top"}),tt({initiativeId:t.initiativeId,workstreamId:t.workstreamId,agentId:t.runnerAgentId,scope:"initiative"})),`Start+Auto enabled for ${A}.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Start with auto"}),e.jsx("button",{type:"button",disabled:X.isRemoving,onClick:()=>{ae(null),lt(t)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-red-100 transition-colors hover:bg-red-500/[0.12] disabled:opacity-45",children:"Remove from queue"})]})]})]})]},o)})}):!Q&&ee?e.jsx(rn,{axis:"y",values:fe,onReorder:t=>{We.current=t,at(t)},className:"space-y-2.5",children:fe.map(t=>ot.get(t)).filter(Boolean).map((t,a)=>e.jsx(wn,{item:t,index:a,actionKey:K,setNotice:N,setUpgradeGate:ie,onUpgradeGate:L,onOpenInitiative:T,onOpenSliceDetail:z,selected:O.has(D(t)),selectionEnabled:U,onToggleSelection:Qt,menuKey:me,setMenuKey:ae,playWorkstream:_e,startWorkstreamAutoContinue:tt,triagePlacement:ve,onPauseWorkstream:(o,r)=>X.stopTriage({initiativeId:o.initiativeId,workstreamId:o.workstreamId,placement:r,resetToTodo:!1}),onMoveWorkstream:(o,r)=>X.move({initiativeId:o.initiativeId,workstreamId:o.workstreamId,placement:r}),onCommitReorder:()=>void Dt().catch(()=>null),onDismiss:lt,runAction:le},D(t)))}):null]}),e.jsx("div",{className:"pointer-events-none absolute bottom-3 right-3 z-[250]",children:e.jsx(mn,{open:Gt,tone:"warning",title:"Limited signal",message:dt,autoDismissMs:6e3,onDismiss:()=>Te(!0)})})]})}function wn({item:n,index:s,actionKey:l,setNotice:i,setUpgradeGate:b,onUpgradeGate:g,onOpenInitiative:C,onOpenSliceDetail:y,selected:F,selectionEnabled:_,onToggleSelection:H,menuKey:T,setMenuKey:M,playWorkstream:L,startWorkstreamAutoContinue:z,triagePlacement:U,onPauseWorkstream:se,onMoveWorkstream:Y,onCommitReorder:re,onDismiss:p,runAction:m}){const c=an(),u=Nt(),[f,x]=d.useState(!1),j=`${n.initiativeId}:${n.workstreamId}`,J=l===j,N=n.queueState==="running",I=n.nextTaskDueAt?kt(n.nextTaskDueAt):null,ye=Fe(n.initiativeTitle,n.initiativeId,"Initiative"),de=Fe(n.workstreamTitle,n.workstreamId,"Workstream"),we=qt(n),ve=n.nextTaskTitle?P(n.nextTaskTitle):null,B=n.blockReason?P(n.blockReason):null,ie=$t(n),K=Ft(n);return e.jsx(on,{value:j,id:j,dragListener:!1,dragControls:c,onDragStart:()=>x(!0),onDragEnd:()=>{x(!1),re()},whileDrag:{scale:1.02,boxShadow:"0 20px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(191,255,0,0.15)",zIndex:50,cursor:"grabbing"},className:"relative",children:e.jsxs(V.article,{layout:!0,initial:{opacity:0,y:12,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.98},transition:{duration:u?.01:k.surfaceSwitch.duration,ease:k.surfaceSwitch.ease,delay:u?0:Math.min(s,k.listStaggerMaxItems)*k.listStaggerStep,opacity:{duration:u?.01:k.surfaceSwitch.duration,ease:k.surfaceSwitch.ease}},className:"group relative overflow-visible rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3 cursor-pointer transition-colors hover:border-white/[0.14]",onClick:()=>y==null?void 0:y(n),role:"button",tabIndex:0,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),y==null||y(n))},children:[e.jsx("div",{className:`pointer-events-none absolute inset-x-3 top-0 h-px bg-gradient-to-r ${It(n.queueState)}`,"aria-hidden":!0}),e.jsx("div",{className:"flex items-start justify-between gap-2.5",children:e.jsxs("div",{className:"min-w-0 flex flex-1 items-start gap-2.5",children:[e.jsxs("div",{className:"relative h-8 w-8 flex-shrink-0",children:[e.jsx("div",{className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out ${_?F?"opacity-0 scale-90":"opacity-100 scale-100 group-hover:opacity-0 group-hover:scale-90 group-focus-within:opacity-0 group-focus-within:scale-90":"opacity-100 scale-100"}`,children:e.jsx(jt,{name:ie,hint:Mt(n,ie),size:"sm"})}),_?e.jsx("button",{type:"button",role:"checkbox","aria-checked":F,"aria-label":"Select queue row",title:F?"Selected (Shift+click for range)":"Select (Shift+click for range)",onClick:w=>{w.stopPropagation(),H(j,!F,w.shiftKey)},onMouseDown:w=>w.stopPropagation(),onKeyDown:w=>w.stopPropagation(),className:`absolute inset-0 flex items-center justify-center rounded-full border transition-[opacity,transform,background-color,border-color,color] duration-200 ease-out ${F?"opacity-100 scale-100 border-[#BFFF00]/40 bg-[#BFFF00]/18 text-[#E1FFB2]":"opacity-0 scale-90 border-white/[0.24] bg-black/55 text-white/78 group-hover:opacity-100 group-hover:scale-100 group-focus-within:opacity-100 group-focus-within:scale-100 hover:bg-black/62"}`,children:e.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full border border-current/45 bg-black/30",children:F?e.jsx("svg",{viewBox:"0 0 16 16",className:"h-2.5 w-2.5",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M3.2 8.3 6.2 11l6.6-6.1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx($e,{type:"initiative",size:11,className:"flex-shrink-0 opacity-85"}),e.jsx("button",{type:"button",onClick:()=>C==null?void 0:C(n.initiativeId,n.initiativeTitle),className:"block min-w-0 flex-1 truncate text-left text-micro uppercase tracking-[0.08em] text-muted transition-colors hover:text-white/72",title:ye,children:ye}),we?e.jsx("span",{className:ne("inline-flex flex-shrink-0 items-center rounded-full border px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.08em]",we.toneClass),title:we.longLabel,children:we.shortLabel}):null]}),e.jsxs("div",{className:"mt-0.5 flex min-w-0 items-start gap-1.5",children:[e.jsx($e,{type:"workstream",size:12,className:"mt-[3px] flex-shrink-0 opacity-95"}),e.jsx("p",{className:"min-w-0 line-clamp-2 text-body font-semibold leading-snug text-white",title:de,children:de})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-micro text-secondary",children:[e.jsx("span",{className:"rounded-full border border-strong bg-white/[0.03] px-2 py-0.5 text-micro uppercase tracking-[0.08em] text-secondary",children:"Runner"}),e.jsxs("span",{className:"truncate text-white/68",children:[ie,K?` · ${K}`:""]})]})]})]})}),e.jsx("div",{className:"mt-2 rounded-lg border border-white/[0.07] bg-black/[0.18] px-2.5 py-2 text-caption text-white/68",children:ve?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-micro uppercase tracking-[0.08em] text-white/44",children:[e.jsx($e,{type:"task",size:10,className:"flex-shrink-0 opacity-80"}),e.jsx("span",{children:Je(n.queueState)}),I?e.jsxs("span",{className:"truncate text-micro normal-case tracking-normal text-muted",children:["· ",I]}):null]}),e.jsx("p",{className:"line-clamp-2 break-words text-caption leading-snug text-white/84",title:ve,children:ve})]}):e.jsx("span",{className:"text-secondary",children:Ze(n)})}),B&&e.jsxs("div",{className:"mt-1.5 rounded-lg border border-red-400/24 bg-red-500/[0.08] px-2.5 py-1 text-micro text-red-100/85",children:["Blocked: ",B]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5",onClick:w=>w.stopPropagation(),children:[e.jsx("button",{type:"button",disabled:J||N,onClick:()=>void m(j,()=>L({initiativeId:n.initiativeId,workstreamId:n.workstreamId,agentId:n.runnerAgentId}),w=>Xe(n,w)),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:N?"Already running":"Start this workstream now",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Ct,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:N?"Running":"Start"})]})}),e.jsxs("button",{type:"button",onPointerDown:w=>c.start(w),"aria-label":"Drag to reorder",title:f?"Reordering":"Drag to reorder",className:`control-pill flex h-7 items-center justify-center gap-1 px-2 text-micro font-semibold transition-colors ${f?"border-[#BFFF00]/35 bg-[#BFFF00]/14 text-[#E1FFB2] cursor-grabbing":"cursor-grab hover:bg-white/[0.08] hover:text-bright"}`,children:[f?e.jsx(pn,{className:"h-3.5 w-3.5 opacity-90"}):e.jsx(xn,{className:"h-3.5 w-3.5 opacity-90"}),e.jsx("span",{children:f?"Reordering":"Drag"})]}),e.jsxs("div",{className:"relative ml-auto",children:[e.jsx("button",{type:"button",disabled:J,onClick:()=>M(w=>w===j?null:j),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:"Queue actions",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Tt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:"More"})]})}),T===j&&e.jsxs("div",{className:"absolute right-0 top-[calc(100%+6px)] z-[320] min-w-[198px] rounded-xl border border-white/[0.1] bg-[#080d14]/95 p-1.5 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur",children:[e.jsx("button",{type:"button",onClick:()=>{M(null),m(`${j}:top`,()=>Y(n,"top"),`Moved ${de} to top of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to top"}),e.jsx("button",{type:"button",onClick:()=>{M(null),m(`${j}:bottom`,()=>Y(n,"bottom"),`Moved ${de} to bottom of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to bottom"}),e.jsx("button",{type:"button",onClick:()=>{M(null),m(`${j}:auto`,async()=>(await Y(n,"top"),z({initiativeId:n.initiativeId,workstreamId:n.workstreamId,agentId:n.runnerAgentId,scope:"initiative"})),`Start+Auto enabled for ${ye}.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Start with auto"}),N?e.jsx("button",{type:"button",onClick:()=>{M(null),m(`${j}:pause`,()=>se(n,U),`Paused ${de}.`)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Pause run"}):null,e.jsx("button",{type:"button",disabled:J||N,onClick:()=>{M(null),p(n)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-red-100 transition-colors hover:bg-red-500/[0.12] disabled:opacity-45",children:"Remove from queue"})]})]})]})]})})}const Sn=Object.freeze(Object.defineProperty({__proto__:null,NextUpPanel:yn},Symbol.toStringTag,{value:"Module"}));export{mn as I,yn as N,Sn as a,cn as o,ln as u};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|