@spencerboucher/switchyard 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/policies/worker.js +4 -0
- package/dist/switchyard.mjs +107 -13
- package/package.json +1 -1
- package/web-dist/assets/AutomationView-D8xBiO8V.js +2 -0
- package/web-dist/assets/{AutomationView-CMDz-eFh.js.map → AutomationView-D8xBiO8V.js.map} +1 -1
- package/web-dist/assets/InteractionCard-DebpdBi7.js +4 -0
- package/web-dist/assets/{InteractionCard-Bhur-sU9.js.map → InteractionCard-DebpdBi7.js.map} +1 -1
- package/web-dist/assets/{Overlay-zQBNtPf6.js → Overlay-Dlhi9c84.js} +2 -2
- package/web-dist/assets/{Overlay-zQBNtPf6.js.map → Overlay-Dlhi9c84.js.map} +1 -1
- package/web-dist/assets/{Priority-CgO3ns6b.js → Priority-C5Glky7C.js} +2 -2
- package/web-dist/assets/{Priority-CgO3ns6b.js.map → Priority-C5Glky7C.js.map} +1 -1
- package/web-dist/assets/Select-aZSSgs66.js +2 -0
- package/web-dist/assets/{Select-CpWLZnId.js.map → Select-aZSSgs66.js.map} +1 -1
- package/web-dist/assets/{Tabs-DZ2T9VBY.js → Tabs-BtcfgH4N.js} +5 -5
- package/web-dist/assets/{Tabs-DZ2T9VBY.js.map → Tabs-BtcfgH4N.js.map} +1 -1
- package/web-dist/assets/{UINodeRenderer-JQy6g7ZB.js → UINodeRenderer-C6UI3QVH.js} +2 -2
- package/web-dist/assets/{UINodeRenderer-JQy6g7ZB.js.map → UINodeRenderer-C6UI3QVH.js.map} +1 -1
- package/web-dist/assets/ViewSelect-z38PW0fi.js +2 -0
- package/web-dist/assets/ViewSelect-z38PW0fi.js.map +1 -0
- package/web-dist/assets/attention-D6MFVno_.js +2 -0
- package/web-dist/assets/{attention-DrHtkJHs.js.map → attention-D6MFVno_.js.map} +1 -1
- package/web-dist/assets/auth-Dp9eZwp6.js +2 -0
- package/web-dist/assets/auth-Dp9eZwp6.js.map +1 -0
- package/web-dist/assets/automations-D7SN92MH.js +2 -0
- package/web-dist/assets/{automations-TOhPm8sF.js.map → automations-D7SN92MH.js.map} +1 -1
- package/web-dist/assets/board-dkcdNQmy.js +10 -0
- package/web-dist/assets/board-dkcdNQmy.js.map +1 -0
- package/web-dist/assets/code-CFjMSo7b.js +25 -0
- package/web-dist/assets/code-CFjMSo7b.js.map +1 -0
- package/web-dist/assets/{describe-CtmmeUfI.js → describe-DzuCgJir.js} +2 -2
- package/web-dist/assets/{describe-CtmmeUfI.js.map → describe-DzuCgJir.js.map} +1 -1
- package/web-dist/assets/enroll-BTCRpn9h.js +2 -0
- package/web-dist/assets/{enroll-C4m0rxHw.js.map → enroll-BTCRpn9h.js.map} +1 -1
- package/web-dist/assets/index-B1pFvZNV.css +2 -0
- package/web-dist/assets/index-BWi8eZxK.js +23 -0
- package/web-dist/assets/index-BWi8eZxK.js.map +1 -0
- package/web-dist/assets/more-KjCC48BM.js +2 -0
- package/web-dist/assets/{more-BonXabXm.js.map → more-KjCC48BM.js.map} +1 -1
- package/web-dist/assets/{policyLogic-nqL3E08V.js → policyLogic-nylxViIk.js} +2 -2
- package/web-dist/assets/{policyLogic-nqL3E08V.js.map → policyLogic-nylxViIk.js.map} +1 -1
- package/web-dist/assets/{queue-p_rnOc-9.js → queue-BE-I-CIR.js} +2 -2
- package/web-dist/assets/{queue-p_rnOc-9.js.map → queue-BE-I-CIR.js.map} +1 -1
- package/web-dist/assets/{repo-3GZtN4L8.js → repo-DvbQh_v5.js} +2 -2
- package/web-dist/assets/{repo-3GZtN4L8.js.map → repo-DvbQh_v5.js.map} +1 -1
- package/web-dist/assets/selection-DKEV1Jcg.js +2 -0
- package/web-dist/assets/selection-DKEV1Jcg.js.map +1 -0
- package/web-dist/assets/settings-CfHCWzlJ.js +12 -0
- package/web-dist/assets/settings-CfHCWzlJ.js.map +1 -0
- package/web-dist/assets/{states-BXOts8eT.js → states-DOYtBI1P.js} +2 -2
- package/web-dist/assets/{states-BXOts8eT.js.map → states-DOYtBI1P.js.map} +1 -1
- package/web-dist/assets/terminal-login-BFVSosBA.js +2 -0
- package/web-dist/assets/{terminal-login-j20zSRZp.js.map → terminal-login-BFVSosBA.js.map} +1 -1
- package/web-dist/assets/useNow-kkVAYV7Y.js +2 -0
- package/web-dist/assets/useNow-kkVAYV7Y.js.map +1 -0
- package/web-dist/assets/{useResource-DhvWL_9X.js → useResource-CiJX4Lk_.js} +2 -2
- package/web-dist/assets/{useResource-DhvWL_9X.js.map → useResource-CiJX4Lk_.js.map} +1 -1
- package/web-dist/index.html +5 -10
- package/web-dist/sw.js +1 -1
- package/web-dist/sw.js.map +1 -1
- package/web-dist/assets/AutomationView-CMDz-eFh.js +0 -2
- package/web-dist/assets/InteractionCard-Bhur-sU9.js +0 -4
- package/web-dist/assets/Menu-dT22Gwzm.js +0 -2
- package/web-dist/assets/Menu-dT22Gwzm.js.map +0 -1
- package/web-dist/assets/Select-CpWLZnId.js +0 -2
- package/web-dist/assets/TextArea-BQPdfjO_.js +0 -2
- package/web-dist/assets/TextArea-BQPdfjO_.js.map +0 -1
- package/web-dist/assets/attention-DrHtkJHs.js +0 -2
- package/web-dist/assets/automations-TOhPm8sF.js +0 -2
- package/web-dist/assets/board-BZWPMk0Z.js +0 -10
- package/web-dist/assets/board-BZWPMk0Z.js.map +0 -1
- package/web-dist/assets/code-DVA5CKfS.js +0 -25
- package/web-dist/assets/code-DVA5CKfS.js.map +0 -1
- package/web-dist/assets/drafts-BP2GMlHS.js +0 -13
- package/web-dist/assets/drafts-BP2GMlHS.js.map +0 -1
- package/web-dist/assets/enroll-C4m0rxHw.js +0 -2
- package/web-dist/assets/index-LsagdEq-.js +0 -11
- package/web-dist/assets/index-LsagdEq-.js.map +0 -1
- package/web-dist/assets/index-f4tQ91xN.css +0 -2
- package/web-dist/assets/key-round-DIA3lje5.js +0 -2
- package/web-dist/assets/key-round-DIA3lje5.js.map +0 -1
- package/web-dist/assets/more-BonXabXm.js +0 -2
- package/web-dist/assets/pencil-BtK08_f_.js +0 -2
- package/web-dist/assets/pencil-BtK08_f_.js.map +0 -1
- package/web-dist/assets/preload-helper-DOFsWE7_.js +0 -3
- package/web-dist/assets/preload-helper-DOFsWE7_.js.map +0 -1
- package/web-dist/assets/presence-BnGwJNSq.js +0 -2
- package/web-dist/assets/presence-BnGwJNSq.js.map +0 -1
- package/web-dist/assets/registry-D8Ph1G2W.js +0 -2
- package/web-dist/assets/registry-D8Ph1G2W.js.map +0 -1
- package/web-dist/assets/settings-jyGW1LsI.js +0 -9
- package/web-dist/assets/settings-jyGW1LsI.js.map +0 -1
- package/web-dist/assets/terminal-login-j20zSRZp.js +0 -2
- package/web-dist/assets/useNow-DfER3XvS.js +0 -2
- package/web-dist/assets/useNow-DfER3XvS.js.map +0 -1
package/README.md
CHANGED
|
@@ -118,7 +118,7 @@ switchyard up
|
|
|
118
118
|
```sh
|
|
119
119
|
docker run -d --name switchyard -p 127.0.0.1:7400:7400 -v switchyard-data:/data \
|
|
120
120
|
-e SWITCHYARD_PUBLIC_URL=https://switchyard.example.com \
|
|
121
|
-
ghcr.io/justmytwospence/switchyard:0.
|
|
121
|
+
ghcr.io/justmytwospence/switchyard:0.16.0
|
|
122
122
|
# Single sign-on is required off localhost: see docs/auth.md
|
|
123
123
|
```
|
|
124
124
|
|
package/dist/policies/worker.js
CHANGED
|
@@ -927,6 +927,8 @@ var Tracker = z6.object({
|
|
|
927
927
|
hostId: Id4,
|
|
928
928
|
owner: GitHubLogin,
|
|
929
929
|
repositories: z6.array(GitHubRepository).min(1).max(50).nullable(),
|
|
930
|
+
/** Repositories outside `owner` that belong to this tracker too (never limited by `repositories`). */
|
|
931
|
+
extraRepositories: z6.array(GitHubRepository).max(20).optional(),
|
|
930
932
|
board: TrackerBoard.nullable(),
|
|
931
933
|
writeBack: z6.boolean(),
|
|
932
934
|
moveShared: z6.boolean(),
|
|
@@ -943,6 +945,7 @@ var TrackerInput = z6.object({
|
|
|
943
945
|
hostId: Id4,
|
|
944
946
|
owner: GitHubLogin,
|
|
945
947
|
repositories: Tracker.shape.repositories.default(null),
|
|
948
|
+
extraRepositories: z6.array(GitHubRepository).max(20).default([]),
|
|
946
949
|
board: TrackerBoard.nullable().default(null),
|
|
947
950
|
writeBack: z6.boolean().default(false),
|
|
948
951
|
moveShared: z6.boolean().default(true),
|
|
@@ -953,6 +956,7 @@ var TrackerPatch = z6.object({
|
|
|
953
956
|
hostId: Id4.optional(),
|
|
954
957
|
owner: GitHubLogin.optional(),
|
|
955
958
|
repositories: Tracker.shape.repositories.optional(),
|
|
959
|
+
extraRepositories: z6.array(GitHubRepository).max(20).optional(),
|
|
956
960
|
board: TrackerBoard.nullable().optional(),
|
|
957
961
|
writeBack: z6.boolean().optional(),
|
|
958
962
|
moveShared: z6.boolean().optional(),
|
package/dist/switchyard.mjs
CHANGED
|
@@ -997,6 +997,8 @@ var Tracker = z6.object({
|
|
|
997
997
|
hostId: Id4,
|
|
998
998
|
owner: GitHubLogin,
|
|
999
999
|
repositories: z6.array(GitHubRepository).min(1).max(50).nullable(),
|
|
1000
|
+
/** Repositories outside `owner` that belong to this tracker too (never limited by `repositories`). */
|
|
1001
|
+
extraRepositories: z6.array(GitHubRepository).max(20).optional(),
|
|
1000
1002
|
board: TrackerBoard.nullable(),
|
|
1001
1003
|
writeBack: z6.boolean(),
|
|
1002
1004
|
moveShared: z6.boolean(),
|
|
@@ -1013,6 +1015,7 @@ var TrackerInput = z6.object({
|
|
|
1013
1015
|
hostId: Id4,
|
|
1014
1016
|
owner: GitHubLogin,
|
|
1015
1017
|
repositories: Tracker.shape.repositories.default(null),
|
|
1018
|
+
extraRepositories: z6.array(GitHubRepository).max(20).default([]),
|
|
1016
1019
|
board: TrackerBoard.nullable().default(null),
|
|
1017
1020
|
writeBack: z6.boolean().default(false),
|
|
1018
1021
|
moveShared: z6.boolean().default(true),
|
|
@@ -1023,6 +1026,7 @@ var TrackerPatch = z6.object({
|
|
|
1023
1026
|
hostId: Id4.optional(),
|
|
1024
1027
|
owner: GitHubLogin.optional(),
|
|
1025
1028
|
repositories: Tracker.shape.repositories.optional(),
|
|
1029
|
+
extraRepositories: z6.array(GitHubRepository).max(20).optional(),
|
|
1026
1030
|
board: TrackerBoard.nullable().optional(),
|
|
1027
1031
|
writeBack: z6.boolean().optional(),
|
|
1028
1032
|
moveShared: z6.boolean().optional(),
|
|
@@ -6817,6 +6821,22 @@ function recordCreatedWorkspace(ctx, project, checkout, info) {
|
|
|
6817
6821
|
return ctx.store.putWorkspace(ws);
|
|
6818
6822
|
});
|
|
6819
6823
|
}
|
|
6824
|
+
function rehomeSessions(ctx, checkout, active) {
|
|
6825
|
+
const under = (s) => active.filter((w) => s.cwd === w.path || s.cwd.startsWith(`${w.path}/`)).sort((a, b) => b.path.length - a.path.length)[0];
|
|
6826
|
+
for (const s of ctx.store.sessions.list("host_id = ? AND archived_at IS NULL", [
|
|
6827
|
+
checkout.hostId
|
|
6828
|
+
])) {
|
|
6829
|
+
if (s.provenance !== "imported" || s.runId || s.taskId || !s.cwd)
|
|
6830
|
+
continue;
|
|
6831
|
+
const local = under(s);
|
|
6832
|
+
if (!local || local.id === s.workspaceId)
|
|
6833
|
+
continue;
|
|
6834
|
+
const ws = ctx.store.workspaceContaining(checkout.hostId, s.cwd);
|
|
6835
|
+
if (!ws || ws.id === s.workspaceId)
|
|
6836
|
+
continue;
|
|
6837
|
+
ctx.store.putSession({ ...s, workspaceId: ws.id, projectId: ws.projectId });
|
|
6838
|
+
}
|
|
6839
|
+
}
|
|
6820
6840
|
async function refreshCheckoutWorkspaces(ctx, checkout) {
|
|
6821
6841
|
const raw = await ctx.hostHub.request(checkout.hostId, {
|
|
6822
6842
|
type: "workspace.discover",
|
|
@@ -6857,6 +6877,7 @@ async function refreshCheckoutWorkspaces(ctx, checkout) {
|
|
|
6857
6877
|
if (!seen.has(ws.path))
|
|
6858
6878
|
ctx.store.putWorkspace({ ...ws, archivedAt: now, updatedAt: now });
|
|
6859
6879
|
}
|
|
6880
|
+
rehomeSessions(ctx, checkout, out);
|
|
6860
6881
|
return out;
|
|
6861
6882
|
});
|
|
6862
6883
|
}
|
|
@@ -12241,12 +12262,32 @@ function projectForRepository(projects, repository) {
|
|
|
12241
12262
|
}
|
|
12242
12263
|
function inScope(tracker, project) {
|
|
12243
12264
|
const identity2 = project.repoIdentity.toLowerCase();
|
|
12265
|
+
if ((tracker.extraRepositories ?? []).some((r) => identity2 === `${GITHUB}${r}`.toLowerCase())) {
|
|
12266
|
+
return true;
|
|
12267
|
+
}
|
|
12244
12268
|
if (!identity2.startsWith(`${GITHUB}${tracker.owner.toLowerCase()}/`))
|
|
12245
12269
|
return false;
|
|
12246
12270
|
if (!tracker.repositories)
|
|
12247
12271
|
return true;
|
|
12248
12272
|
return tracker.repositories.some((r) => identity2 === `${GITHUB}${r}`.toLowerCase());
|
|
12249
12273
|
}
|
|
12274
|
+
function mergeSyncResults(parts) {
|
|
12275
|
+
const seen = /* @__PURE__ */ new Set();
|
|
12276
|
+
const items = [];
|
|
12277
|
+
for (const p of parts) {
|
|
12278
|
+
for (const i of p.items) {
|
|
12279
|
+
if (seen.has(i.itemId))
|
|
12280
|
+
continue;
|
|
12281
|
+
seen.add(i.itemId);
|
|
12282
|
+
items.push(i);
|
|
12283
|
+
}
|
|
12284
|
+
}
|
|
12285
|
+
return {
|
|
12286
|
+
login: parts[0]?.login ?? "",
|
|
12287
|
+
items: items.slice(0, 200),
|
|
12288
|
+
truncated: parts.some((p) => p.truncated) || items.length > 200
|
|
12289
|
+
};
|
|
12290
|
+
}
|
|
12250
12291
|
function issueBranch(number, title) {
|
|
12251
12292
|
const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40).replace(/-+$/g, "");
|
|
12252
12293
|
return slug ? `${number}-${slug}` : String(number);
|
|
@@ -12318,15 +12359,17 @@ var TrackerService = class {
|
|
|
12318
12359
|
lastError: `Host ${this.hostName(tracker.hostId)} is offline`
|
|
12319
12360
|
});
|
|
12320
12361
|
}
|
|
12362
|
+
const board = tracker.board ? { projectNumber: tracker.board.projectNumber, statusField: tracker.board.statusField } : null;
|
|
12363
|
+
const extra = tracker.extraRepositories ?? [];
|
|
12364
|
+
const scopes = [tracker.repositories, ...extra.length ? [extra] : []];
|
|
12321
12365
|
let result2;
|
|
12322
12366
|
try {
|
|
12323
|
-
const
|
|
12324
|
-
|
|
12325
|
-
owner: tracker.owner,
|
|
12326
|
-
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
result2 = TrackerSyncResult.parse(raw);
|
|
12367
|
+
const parts = [];
|
|
12368
|
+
for (const repositories of scopes) {
|
|
12369
|
+
const raw = await hostHub.request(tracker.hostId, { type: "tracker.sync", owner: tracker.owner, repositories, board }, { timeoutMs: SYNC_TIMEOUT_MS });
|
|
12370
|
+
parts.push(TrackerSyncResult.parse(raw));
|
|
12371
|
+
}
|
|
12372
|
+
result2 = mergeSyncResults(parts);
|
|
12330
12373
|
} catch (err) {
|
|
12331
12374
|
return this.save(trackerId, { lastError: this.hostError(tracker, err) });
|
|
12332
12375
|
}
|
|
@@ -12378,9 +12421,10 @@ var TrackerService = class {
|
|
|
12378
12421
|
this.syncView(store.trackers.require(trackerId), projects);
|
|
12379
12422
|
});
|
|
12380
12423
|
const current = { ...tracker, login: result2.login };
|
|
12424
|
+
const refreshed = /* @__PURE__ */ new Set();
|
|
12381
12425
|
for (const m of matched) {
|
|
12382
12426
|
try {
|
|
12383
|
-
await this.linkWorkspace(current, m.item, m.project, m.taskId);
|
|
12427
|
+
await this.linkWorkspace(current, m.item, m.project, m.taskId, refreshed);
|
|
12384
12428
|
} catch (err) {
|
|
12385
12429
|
errors.push(err instanceof Error ? err.message : String(err));
|
|
12386
12430
|
}
|
|
@@ -12428,7 +12472,7 @@ var TrackerService = class {
|
|
|
12428
12472
|
store.putView({ ...view, trackerId: tracker.id, projectIds, updatedAt: now });
|
|
12429
12473
|
}
|
|
12430
12474
|
/** Create (once) and link the worktree for an issue's branch. */
|
|
12431
|
-
async linkWorkspace(tracker, item, project, taskId) {
|
|
12475
|
+
async linkWorkspace(tracker, item, project, taskId, refreshed) {
|
|
12432
12476
|
const { store, hostHub } = this.ctx;
|
|
12433
12477
|
const branch = item.branches[0];
|
|
12434
12478
|
if (!branch || item.pullRequest?.state === "MERGED")
|
|
@@ -12438,10 +12482,21 @@ var TrackerService = class {
|
|
|
12438
12482
|
return;
|
|
12439
12483
|
const find = () => store.workspaces.list("checkout_id = ? AND archived_at IS NULL", [checkout.id]).find((w) => w.branch !== null && item.branches.includes(w.branch));
|
|
12440
12484
|
let ws = find();
|
|
12485
|
+
const key = `trackerBranchTried:${taskId}:${branch}`;
|
|
12441
12486
|
if (!ws) {
|
|
12442
|
-
const key = `trackerBranchTried:${taskId}:${branch}`;
|
|
12443
12487
|
if (store.getSetting(key, null) !== null)
|
|
12444
12488
|
return;
|
|
12489
|
+
if (!refreshed.has(checkout.id)) {
|
|
12490
|
+
refreshed.add(checkout.id);
|
|
12491
|
+
try {
|
|
12492
|
+
await refreshCheckoutWorkspaces(this.ctx, checkout);
|
|
12493
|
+
} catch (err) {
|
|
12494
|
+
this.ctx.log.debug({ err, checkoutId: checkout.id }, "tracker: workspace discovery failed");
|
|
12495
|
+
}
|
|
12496
|
+
ws = find();
|
|
12497
|
+
}
|
|
12498
|
+
}
|
|
12499
|
+
if (!ws) {
|
|
12445
12500
|
store.setSetting(key, store.nowIso());
|
|
12446
12501
|
await hostHub.request(tracker.hostId, { type: "tracker.prepareBranch", checkoutPath: checkout.path, branch }, { timeoutMs: 6e4 });
|
|
12447
12502
|
ws = await createWorkspace(this.ctx, project, checkout, branch, null);
|
|
@@ -12576,21 +12631,54 @@ var WorkspaceLifecycleService = class {
|
|
|
12576
12631
|
opts;
|
|
12577
12632
|
timer = null;
|
|
12578
12633
|
running = false;
|
|
12634
|
+
/** `${sessionId}\n${cwd}` already checked for an unknown worktree (per process). */
|
|
12635
|
+
checked = /* @__PURE__ */ new Set();
|
|
12636
|
+
/** Checkouts with a rescan in flight. */
|
|
12637
|
+
rescanning = /* @__PURE__ */ new Set();
|
|
12638
|
+
onEvent = (ev) => {
|
|
12639
|
+
if (ev.type === "session.updated")
|
|
12640
|
+
this.noteSession(ev.data);
|
|
12641
|
+
};
|
|
12579
12642
|
constructor(ctx, opts) {
|
|
12580
12643
|
this.ctx = ctx;
|
|
12581
12644
|
this.opts = opts;
|
|
12582
12645
|
}
|
|
12583
12646
|
start() {
|
|
12647
|
+
this.ctx.hub.on("event", this.onEvent);
|
|
12584
12648
|
if (this.opts.tickMs <= 0)
|
|
12585
12649
|
return;
|
|
12586
12650
|
this.timer = setInterval(() => void this.tick(), this.opts.tickMs);
|
|
12587
12651
|
this.timer.unref();
|
|
12588
12652
|
}
|
|
12589
12653
|
stop() {
|
|
12654
|
+
this.ctx.hub.off("event", this.onEvent);
|
|
12590
12655
|
if (this.timer)
|
|
12591
12656
|
clearInterval(this.timer);
|
|
12592
12657
|
this.timer = null;
|
|
12593
12658
|
}
|
|
12659
|
+
/** A hand-started session below the main checkout, in a folder that is no known worktree: rescan once. */
|
|
12660
|
+
noteSession(s) {
|
|
12661
|
+
const { store, hostHub } = this.ctx;
|
|
12662
|
+
if (s?.archivedAt !== null || s.provenance !== "imported" || !s.cwd || !s.workspaceId)
|
|
12663
|
+
return;
|
|
12664
|
+
const ws = store.workspaces.get(s.workspaceId);
|
|
12665
|
+
if (!ws || ws.archivedAt || ws.provenance !== "main" || s.cwd === ws.path)
|
|
12666
|
+
return;
|
|
12667
|
+
const key = `${s.id}
|
|
12668
|
+
${s.cwd}`;
|
|
12669
|
+
if (this.checked.has(key))
|
|
12670
|
+
return;
|
|
12671
|
+
const checkout = store.checkouts.get(ws.checkoutId);
|
|
12672
|
+
if (!checkout || !hostHub.isConnected(checkout.hostId) || this.rescanning.has(checkout.id)) {
|
|
12673
|
+
return;
|
|
12674
|
+
}
|
|
12675
|
+
this.checked.add(key);
|
|
12676
|
+
this.rescanning.add(checkout.id);
|
|
12677
|
+
void refreshCheckoutWorkspaces(this.ctx, checkout).catch((err) => {
|
|
12678
|
+
this.checked.delete(key);
|
|
12679
|
+
this.ctx.log.warn({ err, checkoutId: checkout.id }, "workspace discovery failed");
|
|
12680
|
+
}).finally(() => this.rescanning.delete(checkout.id));
|
|
12681
|
+
}
|
|
12594
12682
|
async tick(now = this.ctx.store.now().getTime()) {
|
|
12595
12683
|
if (this.running)
|
|
12596
12684
|
return;
|
|
@@ -35684,7 +35772,7 @@ async function trackersList(ctx, flags) {
|
|
|
35684
35772
|
t.name,
|
|
35685
35773
|
hosts.find((h) => h.id === t.hostId)?.name ?? t.hostId,
|
|
35686
35774
|
t.owner,
|
|
35687
|
-
t.repositories ? t.repositories.join(", ") : "any",
|
|
35775
|
+
(t.repositories ? t.repositories.join(", ") : "any") + (t.extraRepositories?.length ? ` + ${t.extraRepositories.join(", ")}` : ""),
|
|
35688
35776
|
t.board ? `#${t.board.projectNumber}` : "-",
|
|
35689
35777
|
t.writeBack ? "on" : "off",
|
|
35690
35778
|
t.lastSyncedAt ?? "never",
|
|
@@ -35706,6 +35794,7 @@ async function trackersCreate(ctx, name, flags) {
|
|
|
35706
35794
|
hostId: host.id,
|
|
35707
35795
|
owner: flags.owner,
|
|
35708
35796
|
...flags.repo?.length ? { repositories: flags.repo } : {},
|
|
35797
|
+
...flags.also?.length ? { extraRepositories: flags.also } : {},
|
|
35709
35798
|
...flags.board ? { board: { projectNumber: boardNumber(flags.board), ...fields } } : {},
|
|
35710
35799
|
...flags.writeBack ? { writeBack: true } : {},
|
|
35711
35800
|
...flags.moveShared === false ? { moveShared: false } : {}
|
|
@@ -35720,6 +35809,8 @@ async function trackersEdit(ctx, ref, flags) {
|
|
|
35720
35809
|
throw new CliError("--all-repos cannot be combined with --repo");
|
|
35721
35810
|
if (flags.enable && flags.disable)
|
|
35722
35811
|
throw new CliError("--enable and --disable conflict");
|
|
35812
|
+
if (flags.noAlso && flags.also?.length)
|
|
35813
|
+
throw new CliError("--no-also cannot be combined with --also");
|
|
35723
35814
|
const { api } = connect(ctx, flags);
|
|
35724
35815
|
const t = await resolveTracker(api, ref);
|
|
35725
35816
|
let board;
|
|
@@ -35739,6 +35830,7 @@ async function trackersEdit(ctx, ref, flags) {
|
|
|
35739
35830
|
...flags.host ? { hostId: (await resolveHost(api, flags.host)).id } : {},
|
|
35740
35831
|
...flags.owner ? { owner: flags.owner } : {},
|
|
35741
35832
|
...flags.allRepos ? { repositories: null } : flags.repo?.length ? { repositories: flags.repo } : {},
|
|
35833
|
+
...flags.noAlso ? { extraRepositories: [] } : flags.also?.length ? { extraRepositories: flags.also } : {},
|
|
35742
35834
|
...board !== void 0 ? { board } : {},
|
|
35743
35835
|
...flags.writeBack !== void 0 ? { writeBack: flags.writeBack } : {},
|
|
35744
35836
|
...flags.moveShared !== void 0 ? { moveShared: flags.moveShared } : {},
|
|
@@ -36201,6 +36293,8 @@ function buildProgram(ctx = defaultCtx()) {
|
|
|
36201
36293
|
owner: o.owner,
|
|
36202
36294
|
repo: o.repo,
|
|
36203
36295
|
allRepos: o.allRepos,
|
|
36296
|
+
also: Array.isArray(o.also) ? o.also : void 0,
|
|
36297
|
+
noAlso: o.also === false,
|
|
36204
36298
|
board: typeof o.board === "string" ? o.board : void 0,
|
|
36205
36299
|
noBoard: o.board === false,
|
|
36206
36300
|
statusField: o.statusField,
|
|
@@ -36212,8 +36306,8 @@ function buildProgram(ctx = defaultCtx()) {
|
|
|
36212
36306
|
disable: o.disable
|
|
36213
36307
|
});
|
|
36214
36308
|
connectionOptions(trackers.command("list").description("List trackers")).option("--json", "JSON output").action((o) => trackersList(ctx, { ...connFlags(o), json: o.json }));
|
|
36215
|
-
connectionOptions(trackers.command("create <name>").description("Create a tracker")).option("--host <host>", "host whose gh login is used (required)").option("--owner <login>", "GitHub organization or user (required)").option("--repo <owner/name>", "limit to a repository (repeatable)", collect).option("--board <number>", "GitHub Projects board number in the owner").option("--status-field <name>", "board status field (default Status)").option("--on-start <column>", "column once the worktree exists (write-back)").option("--on-review <column>", "column once a pull request is open (write-back)").option("--write-back", "let Switchyard move board cards").option("--no-move-shared", "never move cards assigned to someone else too").action((name, o) => trackersCreate(ctx, name, trackerFlags(o)));
|
|
36216
|
-
connectionOptions(trackers.command("edit <tracker>").description("Change a tracker")).option("--name <name>", "new name").option("--host <host>", "host whose gh login is used").option("--owner <login>", "GitHub organization or user").option("--repo <owner/name>", "limit to a repository (repeatable)", collect).option("--all-repos", "remove the repository limit").option("--board <number>", "GitHub Projects board number").option("--no-board", "stop using a board").option("--status-field <name>", "board status field").option("--on-start <column>", "column once the worktree exists").option("--on-review <column>", "column once a pull request is open").option("--write-back", "let Switchyard move board cards").option("--no-write-back", "never move board cards").option("--move-shared", "also move cards assigned to someone else too").option("--no-move-shared", "never move cards assigned to someone else too").option("--enable", "sync this tracker").option("--disable", "stop syncing this tracker").action((ref, o) => trackersEdit(ctx, ref, trackerFlags(o)));
|
|
36309
|
+
connectionOptions(trackers.command("create <name>").description("Create a tracker")).option("--host <host>", "host whose gh login is used (required)").option("--owner <login>", "GitHub organization or user (required)").option("--repo <owner/name>", "limit to a repository (repeatable)", collect).option("--also <owner/name>", "also include a repository of another owner (repeatable)", collect).option("--board <number>", "GitHub Projects board number in the owner").option("--status-field <name>", "board status field (default Status)").option("--on-start <column>", "column once the worktree exists (write-back)").option("--on-review <column>", "column once a pull request is open (write-back)").option("--write-back", "let Switchyard move board cards").option("--no-move-shared", "never move cards assigned to someone else too").action((name, o) => trackersCreate(ctx, name, trackerFlags(o)));
|
|
36310
|
+
connectionOptions(trackers.command("edit <tracker>").description("Change a tracker")).option("--name <name>", "new name").option("--host <host>", "host whose gh login is used").option("--owner <login>", "GitHub organization or user").option("--repo <owner/name>", "limit to a repository (repeatable)", collect).option("--all-repos", "remove the repository limit").option("--also <owner/name>", "also include a repository of another owner (repeatable)", collect).option("--no-also", "remove the repositories of other owners").option("--board <number>", "GitHub Projects board number").option("--no-board", "stop using a board").option("--status-field <name>", "board status field").option("--on-start <column>", "column once the worktree exists").option("--on-review <column>", "column once a pull request is open").option("--write-back", "let Switchyard move board cards").option("--no-write-back", "never move board cards").option("--move-shared", "also move cards assigned to someone else too").option("--no-move-shared", "never move cards assigned to someone else too").option("--enable", "sync this tracker").option("--disable", "stop syncing this tracker").action((ref, o) => trackersEdit(ctx, ref, trackerFlags(o)));
|
|
36217
36311
|
connectionOptions(trackers.command("delete <tracker>").description("Delete a tracker")).action((ref, o) => trackersDelete(ctx, ref, connFlags(o)));
|
|
36218
36312
|
connectionOptions(trackers.command("sync <tracker>").description("Sync a tracker now")).action((ref, o) => trackersSync(ctx, ref, connFlags(o)));
|
|
36219
36313
|
const tasks = program.command("tasks").description("Tasks");
|
package/package.json
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{S as e,_ as t,a as n,h as r,i,l as a,o,t as s,v as c,y as l}from"./Button-BKQW9doW.js";import{A as u,T as d,h as f,j as ee,k as p,l as m,t as te,w as h}from"./Overlay-Dlhi9c84.js";import{At as ne,Ft as g,It as _,L as v,M as re,Mt as ie,Nt as y,O as ae,at as b,c as x,f as S,i as oe,jt as C,m as w,n as T,r as E,s as se,t as D,tt as O,u as k}from"./states-DOYtBI1P.js";import{t as A}from"./calendar-clock-CwOgyN2z.js";import{n as ce,r as j}from"./Copy-D6U5ewFc.js";import{n as le,r as ue,t as de}from"./Priority-C5Glky7C.js";import{a as fe,c as pe,i as me,p as M,s as N,t as he}from"./useBreakpoint-kT0J1Dnk.js";import{t as ge}from"./play-j138GLHB.js";import{t as _e}from"./plus-D935l0Os.js";import{n as ve,t as ye}from"./DangerZone-Ch2KNmob.js";import{c as be,s as P,t as xe,u as Se}from"./policyLogic-nylxViIk.js";import{Kt as F,Yt as Ce,qt as I,tn as L}from"./index-BWi8eZxK.js";import{t as R}from"./TextLink-CCc3WEdm.js";import{t as z}from"./SegmentedControl-D2kj3j7u.js";import{t as B}from"./Card-WONLvqGM.js";import{t as V}from"./Select-aZSSgs66.js";import{t as H}from"./Switch-DHX-YYPr.js";import{E as U,O as we,S as Te,T as W,a as G,b as Ee,d as De,f as K,g as q,h as Oe,i as ke,l as Ae,m as je,n as Me,o as Ne,p as J,r as Pe,s as Fe,t as Ie,u as Le,v as Re,w as Y,x as ze,y as Be}from"./describe-DzuCgJir.js";var Ve={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};Ve.node;var He=o(Ve),X=e(l(),1),Z=i(),Ue=e=>`/tasks/${encodeURIComponent(e)}`;function Q(e){return _(e)&&(e.status===404||e.status===405||e.status===501)}function We({summary:e,errorCount:t}){return(0,Z.jsxs)(B,{stack:!0,title:`Summary`,testId:`automation-summary`,children:[(0,Z.jsx)(`p`,{className:`text-sm break-words`,children:e}),t>0&&(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm text-danger`,children:[(0,Z.jsx)(w,{"aria-hidden":!0,className:`size-4 shrink-0`}),t===1?`1 field needs attention`:`${t} fields need attention`]})]})}async function Ge(e,t,n){return e&&!n?C(Y(e,`/preview`)):y(`/api/automations/preview`,t)}function Ke({automationId:e,dirty:t,getInput:n,currentKey:r}){let[i,a]=(0,X.useState)({status:`idle`}),o=async()=>{let r=n();if(!r)N.error(`Fix the highlighted fields to preview the task`);else{a({status:`loading`});try{let n=await Ge(e,r,t);a({status:`done`,preview:n,key:JSON.stringify(r)})}catch(e){a(Q(e)?{status:`unsupported`}:{status:`error`,error:e})}}};return(0,Z.jsxs)(B,{stack:!0,title:`Preview`,description:`See the task an occurrence would create, and when it would run next.`,testId:`automation-preview`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{icon:(0,Z.jsx)(d,{className:`size-4`}),busy:i.status===`loading`,onClick:()=>void o(),children:`Preview resulting task`})}),i.status===`unsupported`&&(0,Z.jsx)(k,{capability:`Task preview`,reason:`This coordinator does not offer automation previews.`,fallback:`Read the summary above, or save and use Run now to see a real task.`}),i.status===`error`&&(0,Z.jsx)(T,{compact:!0,title:`Could not preview`,error:i.error,onRetry:()=>void o()}),i.status===`done`&&(0,Z.jsx)(qe,{preview:i.preview,stale:i.key!==r})]})}function qe({preview:e,stale:t}){let{task:n}=e;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-warning`,role:`status`,children:[(0,Z.jsx)(w,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),`The form changed since this preview. Preview again to refresh it.`]}),(0,Z.jsx)(`p`,{className:`text-sm break-words text-muted`,children:e.summary}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 rounded-md border border-border bg-surface-2 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`min-w-0 font-medium break-words`,children:n.title}),(0,Z.jsx)(le,{priority:n.priority,muted:!0,className:`shrink-0 text-xs`})]}),n.objective?(0,Z.jsx)(`p`,{className:`text-sm break-words whitespace-pre-wrap`,children:n.objective}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No objective.`}),n.acceptanceCriteria.length>0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h4`,{className:`flex items-center gap-1 text-xs font-medium text-muted`,children:[(0,Z.jsx)(h,{"aria-hidden":!0,className:`size-3.5`}),`Acceptance criteria`]}),(0,Z.jsx)(`ul`,{className:`mt-1 list-disc pl-5 text-sm`,children:n.acceptanceCriteria.map((e,t)=>(0,Z.jsx)(`li`,{className:`break-words`,children:e},t))})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Next occurrences`}),e.next.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No scheduled times: this trigger fires on demand, on a webhook, or when a task is done.`}):(0,Z.jsx)(`ol`,{className:`mt-1 flex flex-col gap-0.5 text-sm`,children:e.next.slice(0,5).map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap gap-x-2`,children:[(0,Z.jsx)(`time`,{dateTime:e,children:J(e)}),(0,Z.jsx)(`span`,{className:`text-muted`,children:S(e)})]},e))})]})]})}function Je({label:e,value:t,mono:n=!0}){return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 rounded border border-border bg-surface px-2 py-1.5 text-xs break-all select-all ${n?`font-mono`:``}`,children:t}),(0,Z.jsx)(s,{size:`sm`,icon:(0,Z.jsx)(j,{className:`size-3.5`}),onClick:()=>void ce(t,`${e} copied`),"aria-label":`Copy ${e.toLowerCase()}`,children:`Copy`})]})]})}function Ye({automation:e}){let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(null),[c,l]=(0,X.useState)(!1),d=e.webhookTokenSet||a!==null,f=async()=>{i(!1),n(!0);try{let t=await y(Y(e.id,`/webhook-token`)),n=O.safeParse(t);if(!n.success)throw Error(`The coordinator returned an unexpected token response`);let r=new URL(n.data.url,window.location.origin).toString();o({token:n.data.token,url:r}),N.success(d?`Webhook token rotated`:`Webhook token created`)}catch(e){Q(e)?l(!0):N.error(`Could not issue a webhook token: ${g(e)}`)}finally{n(!1)}};return(0,Z.jsxs)(B,{stack:!0,title:`Webhook`,description:`POST JSON to the URL with the token as a Bearer header. Filters decide which payloads fire.`,testId:`webhook-token`,children:[(0,Z.jsx)(`p`,{className:`flex items-center gap-1.5 text-sm`,children:d?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(M,{"aria-hidden":!0,className:`size-4 shrink-0 text-success`}),`A token is set`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`}),`No token yet: webhook calls are rejected until you create one`]})}),c?(0,Z.jsx)(k,{capability:`Webhook tokens`,reason:`This coordinator does not issue webhook tokens.`}):(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{icon:(0,Z.jsx)(L,{className:`size-4`}),busy:t,onClick:()=>d?i(!0):void f(),children:d?`Rotate token`:`Create token`})}),a&&(0,Z.jsxs)(`div`,{role:`alert`,className:`flex min-w-0 flex-col gap-3 rounded-md border border-warning bg-warning-soft p-3`,children:[(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,Z.jsx)(w,{"aria-hidden":!0,className:`size-4 shrink-0 text-warning`}),`This token is shown once. Copy it now.`]}),(0,Z.jsx)(Je,{label:`Token`,value:a.token}),(0,Z.jsx)(Je,{label:`URL`,value:a.url}),(0,Z.jsx)(Je,{label:`Example`,value:Ne(a.token,a.url)}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{size:`sm`,onClick:()=>o(null),children:`I have copied it`})})]}),(0,Z.jsx)(te,{open:r,onClose:()=>i(!1),title:`Rotate webhook token?`,description:`The current token stops working immediately. Update every sender with the new token.`,confirmLabel:`Rotate token`,busy:t,onConfirm:()=>void f()})]})}var Xe=[];function Ze({automationId:e,refreshKey:t,onRun:n}){let r=v(t=>t.occurrences[e]??Xe),i=v(e=>e.tasks),[a,o]=(0,X.useState)({status:`loading`}),s=(0,X.useCallback)(async t=>{o(e=>e.status===`done`?e:{status:`loading`});try{let n=await C(Y(e,`/history`),{},t);o({status:`done`,items:Re(n)})}catch(e){if(t?.aborted)return;o(Q(e)?{status:`unsupported`}:{status:`error`,error:e})}},[e]);(0,X.useEffect)(()=>{let e=new AbortController;return s(e.signal),()=>e.abort()},[s,t]);let c=q(a.status===`done`?a.items:[],r);return(0,Z.jsxs)(B,{stack:!0,title:`History`,description:`Occurrences of this automation. Routine successes are hidden from the board and appear only here.`,testId:`automation-history`,children:[a.status===`unsupported`&&(0,Z.jsx)(k,{capability:`Automation history`,reason:`This coordinator does not serve stored history; only occurrences seen live in this session are shown.`}),a.status===`error`&&(0,Z.jsx)(T,{compact:!0,title:`Could not load history`,error:a.error,onRetry:()=>void s()}),a.status===`loading`&&c.length===0?(0,Z.jsx)(x,{label:`Loading history…`,className:`py-4`}):c.length===0&&a.status!==`error`?(0,Z.jsx)(D,{className:`py-4`,icon:(0,Z.jsx)(He,{className:`size-6`}),title:`No occurrences yet`,description:`Occurrences appear here when the trigger fires or you run it.`,action:{label:`Run now`,onClick:n,icon:(0,Z.jsx)(ge,{className:`size-4`})}}):(0,Z.jsx)(`ol`,{className:`flex flex-col divide-y divide-border`,children:c.map(e=>{let t=Be(e),n=e.taskId?i[e.taskId]:void 0,r=[e.reason,e.outcome].filter(Boolean).join(` · `);return(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1 py-2 first:pt-0 last:pb-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(f,{kind:`occurrence`,value:e.state,size:`sm`}),(0,Z.jsx)(`time`,{dateTime:t,className:`text-sm`,children:J(t)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted`,children:S(t)})]}),r&&(0,Z.jsx)(`p`,{className:`text-sm break-words text-muted`,children:r}),e.taskId&&(0,Z.jsxs)(R,{to:Ue(e.taskId),variant:`action`,size:`sm`,className:`self-start`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:n?`Task: ${n.title}`:`Open task`}),n?.hiddenFromBoard&&(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted`,children:`(hidden from board)`})]})]},e.id)})})]})}var Qe=`/automations`,$e=e=>`/automations/${encodeURIComponent(e)}`,et=`sy:automation-draft`;function tt(){let{automationId:e=`new`}=c();return(0,Z.jsx)(nt,{automationId:e},e)}function nt({automationId:e}){let t=e===`new`,n=v(e=>e.hydrated),r=U(t?void 0:e),[i,a]=(0,X.useState)({status:`idle`}),o=(0,X.useCallback)(async()=>{a({status:`loading`});try{let t=await C(Y(e)),n=b.safeParse(t);if(!n.success){a({status:`fatal`,error:Error(`The coordinator returned this automation in an unexpected format.`)});return}W.getState().put(n.data),a({status:`idle`})}catch(e){_(e)&&e.status===404?a({status:`notfound`}):a({status:`error`,error:e})}},[e]),s=!t&&!r;return(0,X.useEffect)(()=>{s&&i.status===`idle`&&o()},[s,i.status,o]),t?(0,Z.jsx)(ot,{automation:null}):r?(0,Z.jsx)(ot,{automation:r}):i.status===`notfound`?(0,Z.jsx)(D,{icon:(0,Z.jsx)(Ce,{className:`size-8`}),title:`Automation not found`,description:`It may have been deleted, or the link is wrong.`,action:{label:`Back to automations`,to:Qe}}):i.status===`error`?(0,Z.jsx)(T,{title:`Could not load this automation`,error:i.error,onRetry:()=>void o()}):i.status===`fatal`?(0,Z.jsx)(E,{error:i.error}):(0,Z.jsx)(x,{label:n?`Loading automation…`:`Loading…`})}function rt(e){let t=De({projectId:e,timezone:Oe()});try{let e=sessionStorage.getItem(et);if(!e)return t;let n=JSON.parse(e);return!n||typeof n!=`object`?t:{...t,...n,filters:Array.isArray(n.filters)?n.filters:[]}}catch{return t}}function it(e){try{e?sessionStorage.setItem(et,JSON.stringify(e)):sessionStorage.removeItem(et)}catch{}}var $=e=>JSON.stringify(Le(e));function at(e){if(!_(e))return{};let t=e.details,n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.issues)?t.issues:[],r={};for(let e of n){if(!e||typeof e!=`object`)continue;let{path:t,message:n}=e;if(!Array.isArray(t)||typeof n!=`string`)continue;let i=K(t);i!==`form`&&!r[i]&&(r[i]=n)}return r}function ot({automation:e}){let i=t(),o=r(),c=fe(Qe),l=he(),u=l===`desktop`,d=re(),f=ae(),m=v(e=>e.hosts),h=v(e=>e.profiles),_=v(e=>e.tasks),b=v(e=>e.projects),x=e===null,S=(0,X.useId)(),C=(0,X.useRef)(null),[T,E]=(0,X.useState)(()=>e?Ae(e):rt(d[0]?.id)),[D,O]=(0,X.useState)(()=>$(T)),[k,A]=(0,X.useState)(!1),[ce,j]=(0,X.useState)({}),[le,ue]=(0,X.useState)(!1),[de,M]=(0,X.useState)(!1),[_e,P]=(0,X.useState)(!1),[xe,F]=(0,X.useState)(!1),[Ce,I]=(0,X.useState)(0),L=(0,X.useRef)(e?.updatedAt),R=$(T),z=R!==D;(0,X.useEffect)(()=>{if(!e||e.updatedAt===L.current)return;L.current=e.updatedAt;let t=Ae(e),n=$(t);R===D?(E(t),F(!1)):n!==R&&F(!0),O(n)},[e,R,D]),(0,X.useEffect)(()=>{x&&it(T)},[x,T]),(0,X.useEffect)(()=>{x&&!T.projectId&&d[0]&&E(e=>e.projectId?e:{...e,projectId:d[0].id})},[x,T.projectId,d]);let B=(0,X.useCallback)((e,t)=>{E(n=>({...n,[e]:t})),j(e=>Object.keys(e).length?{}:e)},[]),V=(0,X.useMemo)(()=>Te(T),[T]),H={...ce,...k?V.errors:{}},U=e=>H[e],G=b[T.projectId],K=T.hostId||G?.defaultHostId||null,q=K?m[K]:void 0,ke=T.profileId||G?.defaultProfileId||null,je=(0,X.useCallback)(e=>_[e]?.title,[_]),Me=(0,X.useMemo)(()=>Ee(Le(T),{projectName:G?.name,hostName:T.hostId?m[T.hostId]?.name??null:null,profileName:T.profileId?h[T.profileId]?.name??null:null,taskTitle:je}),[T,G?.name,m,h,je]),Ne=()=>{requestAnimationFrame(()=>{C.current?.querySelector(`[aria-invalid="true"]`)?.focus()})},J=()=>(A(!0),V.input||Ne(),V.input),Pe=async()=>{let t=J();if(!t)N.error(`Fix the highlighted fields before saving`);else{ue(!0);try{if(x){let e=await y(`/api/automations`,t);if(!e||typeof e!=`object`||!e.id)throw Error(`The coordinator did not return the new automation`);W.getState().put(e),it(null),N.success(`Created ${e.name}`),i($e(e.id),{replace:!0,state:o.state});return}let n=await ie(Y(e.id),t);if(n&&typeof n==`object`&&n.id){W.getState().put(n),L.current=n.updatedAt;let e=Ae(n);E(e),O($(e))}else O(R);F(!1),A(!1),N.success(`Saved ${t.name}`)}catch(e){let t=at(e);j(t),Object.keys(t).length&&Ne(),N.error(`Could not save: ${g(e)}. Your changes are kept.`)}finally{ue(!1)}}},Fe=async()=>{if(e){M(!0);try{await ne(Y(e.id)),P(!1),N.success(`Deleted ${e.name}`),c(),W.getState().remove(e.id)}catch(e){N.error(`Could not delete: ${g(e)}`)}finally{M(!1)}}},{busy:Ie,run:Re}=we(()=>I(e=>e+1)),ze=e?!!Ie[e.id]:!1,Be=()=>e&&void Re(e),Ve=()=>{let e=De({projectId:d[0]?.id,timezone:Oe()});E(e),A(!1),it(null)},He=x?`New automation`:e.name,Ue=(0,Z.jsxs)(Z.Fragment,{children:[!x&&(0,Z.jsx)(s,{icon:(0,Z.jsx)(ge,{className:`size-4`}),busy:ze,onClick:Be,title:z?`Runs the saved version`:void 0,children:`Run now`}),x&&z&&(0,Z.jsx)(s,{variant:`ghost`,icon:(0,Z.jsx)(pe,{className:`size-4`}),onClick:Ve,children:`Discard draft`})]}),Q=e=>(0,Z.jsx)(s,{type:`submit`,form:S,variant:`primary`,busy:le,block:e,icon:(0,Z.jsx)(ve,{className:`size-4`}),children:x?`Create automation`:`Save`}),Ge=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(We,{summary:Me,errorCount:k?Object.keys(V.errors).length:0}),(0,Z.jsx)(Ke,{automationId:e?.id??null,dirty:z,getInput:J,currentKey:JSON.stringify(V.input)}),e&&e.trigger.kind===`webhook`&&(0,Z.jsx)(Ye,{automation:e}),e&&(0,Z.jsx)(Ze,{automationId:e.id,refreshKey:Ce,onRun:Be})]});return(0,Z.jsxs)(`div`,{"data-testid":`automation-editor`,className:`flex w-full min-w-0 flex-col gap-4 px-4 pt-4 md:px-6`,children:[(0,Z.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)(a,{to:Qe,onClick:me(c),className:`tap inline-flex items-center gap-1 self-start rounded text-sm text-muted hover:text-text`,children:[(0,Z.jsx)(ee,{"aria-hidden":!0,className:`size-4`}),`Automations`]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`min-w-0 text-lg font-semibold break-words`,children:He}),z&&(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted`,children:[(0,Z.jsx)(p,{"aria-hidden":!0,className:`size-3.5`}),`Unsaved changes`]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Ue,u&&Q()]})]})]}),(0,Z.jsx)(se,{subject:`automations`,consequence:`Changes are sent once the coordinator is reachable again.`}),q&&q.connectivity!==`connected`&&(0,Z.jsx)(oe,{compact:!0,hostName:q.name,connectivity:q.connectivity,lastSeenAt:q.lastSeenAt,detail:`Occurrences are still recorded; their tasks wait until the host is reachable.`}),xe&&(0,Z.jsxs)(`p`,{role:`status`,className:`flex items-start gap-1.5 rounded-md border border-border bg-warning-soft px-3 py-2 text-sm`,children:[(0,Z.jsx)(w,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-warning`}),`This automation changed elsewhere. Saving overwrites those changes with yours.`]}),(0,Z.jsxs)(`div`,{className:n(`grid min-w-0 gap-4`,u?`grid-cols-[minmax(0,1fr)_minmax(320px,400px)] items-start`:`grid-cols-1`),children:[(0,Z.jsxs)(`form`,{id:S,ref:C,noValidate:!0,"aria-label":He,onSubmit:e=>{e.preventDefault(),Pe()},className:`flex min-w-0 flex-col gap-4`,children:[(0,Z.jsx)(st,{draft:T,update:B,err:U,projects:d}),(0,Z.jsx)(ut,{draft:T,update:B,err:U,tasks:_,projectsById:b,savedAutomation:e,segmented:l!==`mobile`}),(0,Z.jsx)(dt,{draft:T,setDraft:E,err:U}),(0,Z.jsx)(ft,{draft:T,update:B,err:U}),(0,Z.jsx)(mt,{draft:T,update:B,err:U,hosts:f,profiles:Object.values(h).sort((e,t)=>e.name.localeCompare(t.name)),defaultHostName:G?.defaultHostId?m[G.defaultHostId]?.name:void 0,defaultProfileName:G?.defaultProfileId?h[G.defaultProfileId]?.name:void 0,selectedProfileMissing:!!ke&&!h[ke]}),(0,Z.jsx)(ht,{draft:T,update:B}),(0,Z.jsx)(gt,{draft:T,update:B,err:U}),(0,Z.jsx)(_t,{draft:T,update:B,err:U,projectChecks:G?.checks}),H.form&&(0,Z.jsx)(be,{children:H.form})]}),(0,Z.jsx)(`aside`,{"aria-label":`Summary, preview and history`,className:`flex min-w-0 flex-col gap-4`,children:Ge})]}),!x&&e&&(0,Z.jsx)(ye,{description:`Future occurrences stop. Tasks it already created stay on the board; its history is removed.`,children:(0,Z.jsx)(s,{variant:`danger`,icon:(0,Z.jsx)(Se,{className:`size-4`}),onClick:()=>P(!0),children:`Delete automation`})}),u?(0,Z.jsx)(`div`,{className:`h-4`}):(0,Z.jsxs)(`div`,{className:`sticky bottom-0 z-10 -mx-4 flex items-center gap-3 border-t border-border bg-surface px-4 py-2 md:-mx-6 md:px-6`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-muted`,children:z?`Unsaved changes`:x?`Not saved yet`:`All changes saved`}),Q()]}),(0,Z.jsx)(te,{open:_e,onClose:()=>P(!1),title:`Delete ${e?.name??`automation`}?`,description:`Future occurrences stop. Tasks it already created stay on the board; its history is removed.`,confirmLabel:`Delete automation`,confirmIcon:(0,Z.jsx)(Se,{className:`size-4`}),busy:de,onConfirm:()=>void Fe()})]})}function st({draft:e,update:t,err:n,projects:r}){return(0,Z.jsxs)(B,{stack:!0,title:`Basics`,children:[(0,Z.jsx)(P,{label:`Name`,error:n(`name`),children:n=>(0,Z.jsx)(I,{...n,value:e.name,onChange:e=>t(`name`,e.target.value),placeholder:`Daily dependency check`,autoComplete:`off`})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(P,{label:`Project`,error:n(`projectId`),hint:r.length===0?(0,Z.jsxs)(Z.Fragment,{children:[`No projects yet.`,` `,(0,Z.jsx)(R,{to:`/settings/projects`,children:`Add a project in Settings`}),`.`]}):void 0,children:n=>(0,Z.jsxs)(V,{...n,value:e.projectId,onChange:e=>t(`projectId`,e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`Choose a project`}),r.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,Z.jsx)(P,{label:`Status`,hint:`Disabled automations keep their history and can still run manually.`,children:n=>(0,Z.jsx)(H,{...n,checked:e.enabled,onChange:e=>t(`enabled`,e),label:`Enabled`,onText:`Enabled`,offText:`Disabled`,className:`self-start`})})]})]})}var ct=[`manual`,`once`,`cron`,`webhook`,`dependency`],lt={manual:`Runs only when you press Run now (or from the CLI).`,once:`Runs a single time at the chosen moment.`,cron:`Runs on a timezone-aware cron schedule.`,webhook:`Runs when an authenticated JSON POST arrives at this automation's webhook URL.`,dependency:`Runs when the chosen task is done.`};function ut({draft:e,update:t,err:n,tasks:r,projectsById:i,savedAutomation:a,segmented:o}){let s=v(e=>e.hydrated),c=e.triggerKind===`cron`?ze(e.cronExpr):null,l=e.triggerKind===`cron`&&!c?Fe(e.cronExpr,e.cronTimezone.trim()||void 0)??`Valid expression (no plain-language description available)`:null,u=(0,X.useMemo)(()=>{try{return Intl.supportedValuesOf?.(`timeZone`)}catch{return}},[]),d=(0,X.useId)(),f=Oe(),ee=(0,X.useMemo)(()=>Object.values(r).filter(t=>t.state!==`canceled`||t.id===e.dependencyTaskId).sort((e,t)=>e.title.localeCompare(t.title)),[r,e.dependencyTaskId]),p=e.triggerKind===`once`?je(e.onceAt):``;return(0,Z.jsxs)(B,{stack:!0,title:`Trigger`,description:lt[e.triggerKind],children:[o?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`text-sm font-medium`,children:`Trigger kind`}),(0,Z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Z.jsx)(z,{label:`Trigger kind`,value:e.triggerKind,onChange:e=>t(`triggerKind`,e),options:ct.map(e=>({value:e,label:G[e]}))})})]}):(0,Z.jsx)(P,{label:`Trigger kind`,children:n=>(0,Z.jsx)(V,{...n,value:e.triggerKind,onChange:e=>t(`triggerKind`,e.target.value),children:ct.map(e=>(0,Z.jsx)(`option`,{value:e,children:G[e]},e))})}),e.triggerKind===`once`&&(0,Z.jsx)(P,{label:`Run at`,error:n(`onceAt`),hint:`Local time (${f})${p?`; saved as ${p}`:``}.`,children:n=>(0,Z.jsx)(I,{...n,type:`datetime-local`,value:e.onceAt,onChange:e=>t(`onceAt`,e.target.value)})}),e.triggerKind===`cron`&&(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(P,{label:`Cron expression`,error:n(`cronExpr`)??c??void 0,hint:`minute hour day-of-month month day-of-week, e.g. 0 9 * * 1-5`,children:n=>(0,Z.jsx)(I,{...n,"aria-invalid":c?!0:n[`aria-invalid`],value:e.cronExpr,onChange:e=>t(`cronExpr`,e.target.value),className:`font-mono`,autoComplete:`off`,spellCheck:!1,autoCapitalize:`off`})}),(0,Z.jsx)(P,{label:`Timezone`,error:n(`cronTimezone`),hint:e.cronTimezone.trim()===f?`IANA timezone name; daylight saving is handled.`:(0,Z.jsxs)(R,{onClick:()=>t(`cronTimezone`,f),children:[`Use this device's timezone (`,f,`)`]}),children:n=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(I,{...n,list:u?d:void 0,value:e.cronTimezone,onChange:e=>t(`cronTimezone`,e.target.value),autoComplete:`off`,spellCheck:!1,autoCapitalize:`off`}),u&&(0,Z.jsx)(`datalist`,{id:d,children:u.map(e=>(0,Z.jsx)(`option`,{value:e},e))})]})}),l&&(0,Z.jsxs)(`p`,{className:`flex items-start gap-1.5 text-sm sm:col-span-2`,"aria-live":`polite`,"data-testid":`cron-description`,children:[(0,Z.jsx)(A,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,Z.jsx)(`span`,{className:`min-w-0 break-words`,children:l})]})]}),e.triggerKind===`webhook`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm text-muted`,children:[(0,Z.jsxs)(`p`,{children:[`Senders POST a JSON body (up to 256 KB) with`,` `,(0,Z.jsx)(`code`,{children:`Authorization: Bearer <token>`}),`. Use the filters below to fire only for matching payloads, and `,(0,Z.jsx)(`code`,{children:`{{payload.<path>}}`}),` to copy payload values into the task.`]}),a?a.trigger.kind===`webhook`?(0,Z.jsxs)(`p`,{children:[`Token:`,` `,a.webhookTokenSet?`set (see Webhook below to rotate)`:`not created yet`]}):(0,Z.jsx)(`p`,{children:`Save to switch this automation to a webhook trigger, then create a token.`}):(0,Z.jsx)(`p`,{children:`Save the automation to create its webhook token and URL.`})]}),e.triggerKind===`dependency`&&(0,Z.jsx)(P,{label:`When this task is done`,error:n(`dependencyTaskId`),hint:`Fires once each time the task enters Done.`,children:n=>(0,Z.jsxs)(V,{...n,value:e.dependencyTaskId,onChange:e=>t(`dependencyTaskId`,e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`Choose a task`}),e.dependencyTaskId&&!r[e.dependencyTaskId]&&(0,Z.jsx)(`option`,{value:e.dependencyTaskId,children:s?`Deleted task`:`Loading task…`}),ee.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[e.title,i[e.projectId]?` (${i[e.projectId].name})`:``,e.state===`done`?` - done`:``]},e.id))]})})]})}function dt({draft:e,setDraft:t,err:n}){let r=(e,n)=>t(t=>({...t,filters:t.filters.map((t,r)=>r===e?{...t,...n}:t)})),i=e.triggerKind===`webhook`;return(0,Z.jsxs)(B,{stack:!0,title:`Filters`,description:`Filters apply to webhook payloads. Each row compares a dot path (for example pull_request.base.ref) with an exact value; all rows must match. Payloads that do not match are recorded as Filtered out.`,children:[!i&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Filters are ignored unless the trigger is Webhook.`}),e.filters.length===0&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No filters: every payload fires.`}),e.filters.map((e,i)=>(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-end gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,Z.jsx)(P,{label:`Path ${i+1}`,error:n(`filters.${i}.path`),children:t=>(0,Z.jsx)(I,{...t,value:e.path,onChange:e=>r(i,{path:e.target.value}),placeholder:`action`,className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})}),(0,Z.jsx)(P,{label:`Equals ${i+1}`,error:n(`filters.${i}.equals`),className:`col-start-1 row-start-2 sm:col-start-auto sm:row-start-auto`,children:t=>(0,Z.jsx)(I,{...t,value:e.equals,onChange:e=>r(i,{equals:e.target.value}),placeholder:`opened`})}),(0,Z.jsx)(m,{label:`Remove filter ${i+1}`,icon:(0,Z.jsx)(pe,{className:`size-4`}),onClick:()=>t(e=>({...e,filters:e.filters.filter((e,t)=>t!==i)}))})]},i)),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{size:`sm`,icon:(0,Z.jsx)(_e,{className:`size-3.5`}),onClick:()=>t(e=>({...e,filters:[...e.filters,{path:``,equals:``}]})),children:`Add filter`})})]})}function ft({draft:e,update:t,err:n}){return(0,Z.jsxs)(B,{stack:!0,title:`Task template`,description:`Use ${ke.join(`, `)} in the title, objective, criteria and grouping key.`,children:[(0,Z.jsx)(P,{label:`Task title`,error:n(`title`),children:n=>(0,Z.jsx)(I,{...n,value:e.title,onChange:e=>t(`title`,e.target.value),placeholder:`Triage new issues for {{date}}`})}),(0,Z.jsx)(P,{label:`Objective`,error:n(`objective`),children:n=>(0,Z.jsx)(F,{...n,minRows:4,value:e.objective,onChange:e=>t(`objective`,e.target.value)})}),(0,Z.jsx)(P,{label:`Acceptance criteria`,error:n(`criteria`),hint:`One criterion per line.`,optional:!0,children:n=>(0,Z.jsx)(F,{...n,minRows:3,value:e.criteria,onChange:e=>t(`criteria`,e.target.value)})}),(0,Z.jsx)(P,{label:`Priority`,error:n(`priority`),children:n=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(de,{priority:e.priority}),(0,Z.jsx)(ue,{...n,value:e.priority,onChange:e=>t(`priority`,e),className:`sm:max-w-48`})]})})]})}function pt({legend:e,value:t,options:r,onChange:i,hint:a}){let o=(0,X.useId)();return(0,Z.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsx)(`legend`,{className:`mb-1 text-sm font-medium`,children:e}),(0,Z.jsx)(`div`,{className:`grid min-w-0 gap-2 sm:grid-cols-3`,children:r.map(e=>(0,Z.jsxs)(`label`,{className:n(`tap flex min-w-0 cursor-pointer items-start gap-2 rounded-md border p-2.5 text-sm`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-1`,t===e.value?`border-accent bg-accent-soft`:`border-border hover:bg-surface-2`),children:[(0,Z.jsx)(`input`,{type:`radio`,name:o,value:e.value,checked:t===e.value,onChange:()=>i(e.value),className:`mt-0.5 size-4 shrink-0 accent-[var(--color-accent)]`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`block text-xs text-muted`,children:e.explanation})]})]},e.value))}),a&&(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:a})]})}function mt({draft:e,update:t,err:n,hosts:r,profiles:i,defaultHostName:a,defaultProfileName:o,selectedProfileMissing:s}){return(0,Z.jsxs)(B,{stack:!0,title:`Where and how it runs`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(P,{label:`Host`,error:n(`hostId`),children:n=>(0,Z.jsxs)(V,{...n,value:e.hostId,onChange:e=>t(`hostId`,e.target.value),children:[(0,Z.jsxs)(`option`,{value:``,children:[`Project default`,a?` (${a})`:``]}),e.hostId&&!r.some(t=>t.id===e.hostId)&&(0,Z.jsx)(`option`,{value:e.hostId,children:`Unknown host`}),r.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[e.name,e.connectivity===`connected`?``:` (${e.connectivity})`]},e.id))]})}),(0,Z.jsx)(P,{label:`Profile`,error:n(`profileId`),hint:s?`The selected profile is no longer available.`:void 0,children:n=>(0,Z.jsxs)(V,{...n,value:e.profileId,onChange:e=>t(`profileId`,e.target.value),children:[(0,Z.jsxs)(`option`,{value:``,children:[`Project default`,o?` (${o})`:``]}),e.profileId&&!i.some(t=>t.id===e.profileId)&&(0,Z.jsx)(`option`,{value:e.profileId,children:`Unknown profile`}),i.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})]}),(0,Z.jsx)(pt,{legend:`Mode`,value:e.mode,options:Me,onChange:e=>t(`mode`,e)}),(0,Z.jsx)(P,{label:`Grouping key`,optional:e.mode!==`continue`,error:n(`groupingKey`),hint:`Occurrences with the same rendered key are the same work: Continue reuses that task and overlap checks compare it. Supports template variables, e.g. pr-{{payload.number}}.`,children:n=>(0,Z.jsx)(I,{...n,value:e.groupingKey,onChange:e=>t(`groupingKey`,e.target.value),className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})})]})}function ht({draft:e,update:t}){let n=e.triggerKind===`cron`||e.triggerKind===`once`;return(0,Z.jsxs)(B,{stack:!0,title:`Overlap and missed runs`,children:[(0,Z.jsx)(pt,{legend:`When previous work is still open`,value:e.overlap,options:Pe,onChange:e=>t(`overlap`,e)}),(0,Z.jsx)(pt,{legend:`Missed runs`,value:e.missed,options:Ie,onChange:e=>t(`missed`,e),hint:n?`A run is missed when the coordinator was down at its scheduled time.`:`Only applies to Schedule and Once triggers.`})]})}function gt({draft:e,update:t,err:n}){return(0,Z.jsxs)(B,{stack:!0,title:`Limits`,description:`Continuation prompts the agent to keep going after a turn ends without finishing. It is off by default.`,children:[(0,Z.jsx)(P,{label:`Automatic continuation`,children:n=>(0,Z.jsx)(H,{...n,checked:e.continuationEnabled,onChange:e=>t(`continuationEnabled`,e),label:`Automatic continuation`,className:`self-start`})}),e.continuationEnabled&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(P,{label:`Continuation objective`,error:n(`continuationObjective`),hint:`What the agent must achieve before it reports done.`,children:n=>(0,Z.jsx)(F,{...n,minRows:2,value:e.continuationObjective,onChange:e=>t(`continuationObjective`,e.target.value)})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(P,{label:`Max continuations`,error:n(`maxContinuations`),hint:`1–50`,children:n=>(0,Z.jsx)(I,{...n,type:`number`,inputMode:`numeric`,min:1,max:50,step:1,value:e.maxContinuations,onChange:e=>t(`maxContinuations`,e.target.value)})}),(0,Z.jsx)(P,{label:`Max elapsed minutes`,error:n(`maxElapsedMinutes`),hint:`1–1440`,children:n=>(0,Z.jsx)(I,{...n,type:`number`,inputMode:`numeric`,min:1,max:1440,step:1,value:e.maxElapsedMinutes,onChange:e=>t(`maxElapsedMinutes`,e.target.value)})}),(0,Z.jsx)(P,{label:`Continuation budget: tokens`,optional:!0,error:n(`maxTokens`),children:n=>(0,Z.jsx)(I,{...n,type:`number`,inputMode:`numeric`,min:1,step:1,value:e.maxTokens,onChange:e=>t(`maxTokens`,e.target.value)})}),(0,Z.jsx)(P,{label:`Continuation budget: cost (USD)`,optional:!0,error:n(`maxCostUsd`),children:n=>(0,Z.jsx)(I,{...n,type:`number`,inputMode:`decimal`,min:.01,step:.01,value:e.maxCostUsd,onChange:e=>t(`maxCostUsd`,e.target.value)})})]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:xe})]})]})}function _t({draft:e,update:t,err:n,projectChecks:r}){let i=r&&r.length>0?`the project's checks (${r.join(`, `)})`:`the project's checks`;return(0,Z.jsxs)(B,{stack:!0,title:`Review`,children:[(0,Z.jsx)(P,{label:`Checks`,optional:!0,error:n(`checks`),hint:`One command per line. Leave empty to use ${i}.`,children:n=>(0,Z.jsx)(F,{...n,minRows:2,value:e.checks,onChange:e=>t(`checks`,e.target.value),className:`font-mono`,spellCheck:!1,autoCapitalize:`off`})}),(0,Z.jsx)(P,{label:`Human review`,hint:`When on, finished work waits in Review for you instead of completing on passing checks.`,children:n=>(0,Z.jsx)(H,{...n,checked:e.requireHumanReview,onChange:e=>t(`requireHumanReview`,e),label:`Require human review`,onText:`Required`,offText:`Not required`,className:`self-start`})})]})}export{tt as default};
|
|
2
|
+
//# sourceMappingURL=AutomationView-D8xBiO8V.js.map
|