@hearsay-tools/squawk 0.19.0-dev.8721 → 0.19.0-dev.8731
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/index.js +32 -2
- package/dist/contract/repo-requests.d.ts +9 -1
- package/dist/contract/repo.d.ts +39 -2
- package/dist/delegation/routes.d.ts +65 -65
- package/dist/git-worktree.d.ts +9 -0
- package/dist/git-worktree.js +118 -3
- package/dist/git-worktree.js.map +1 -1
- package/dist/runners/codex/codex-app-server-runner.js +2 -42
- package/dist/runners/codex/codex-app-server-runner.js.map +1 -1
- package/dist/runners/codex/codex-questions.d.ts +5 -0
- package/dist/runners/codex/codex-questions.js +55 -0
- package/dist/runners/codex/codex-questions.js.map +1 -0
- package/dist/runners/opencode/opencode-questions.js +9 -1
- package/dist/runners/opencode/opencode-questions.js.map +1 -1
- package/dist/runs/retention.d.ts +6 -0
- package/dist/runs/retention.js +7 -3
- package/dist/runs/retention.js.map +1 -1
- package/dist/server/automations-routes.d.ts +150 -150
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/repo-routes.d.ts +40 -14
- package/dist/server/repo-routes.js +30 -15
- package/dist/server/repo-routes.js.map +1 -1
- package/dist/server/run-checkout.d.ts +1 -1
- package/dist/server/run-checkout.js +20 -7
- package/dist/server/run-checkout.js.map +1 -1
- package/dist/server/runners-routes.d.ts +10 -10
- package/dist/server/server.d.ts +120 -68
- package/dist/server/worktree-size-cache.d.ts +11 -0
- package/dist/server/worktree-size-cache.js +3 -1
- package/dist/server/worktree-size-cache.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-DVJon113.js +1 -0
- package/web/dist/assets/{activity-motion-C8V7jGPP.js → activity-motion-D_Mig_D4.js} +1 -1
- package/web/dist/assets/{activity-route-CCOvPI4k.js → activity-route-BvYIEdOs.js} +1 -1
- package/web/dist/assets/{agent-config-section-DkJsuQeu.js → agent-config-section-BImy20b0.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-BqGJuaw_.js → agent-defaults-section-D30dOTKu.js} +1 -1
- package/web/dist/assets/{appearance-BnvyVZZH.js → appearance-CHsrT2VO.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-D7-FuLiL.js → archive-on-merge-field-BT4e_k9f.js} +1 -1
- package/web/dist/assets/attention-CGsbqL2t.js +1 -0
- package/web/dist/assets/{automations-route-C9Gcx3ov.js → automations-route-BEhmjeVF.js} +2 -2
- package/web/dist/assets/{commit-list-DNiFNJqd.js → commit-list-02HM16KN.js} +1 -1
- package/web/dist/assets/{diff-B60FGSvK.js → diff-BmDcJsHL.js} +2 -2
- package/web/dist/assets/{diff-controls-D6LIYMhn.js → diff-controls-HmgYRhy7.js} +1 -1
- package/web/dist/assets/{diff-view-Blyp1vQ3.js → diff-view-CRx2ZNOd.js} +1 -1
- package/web/dist/assets/{file-preview-C0EtwJYH.js → file-preview-B361k1Oo.js} +1 -1
- package/web/dist/assets/{folder-browser-6stmlyVQ.js → folder-browser-BJ3aXo9k.js} +1 -1
- package/web/dist/assets/{git-toolbar-CRj5dZa2.js → git-toolbar-DsNQUL5f.js} +1 -1
- package/web/dist/assets/github-DP2REdU5.js +1 -0
- package/web/dist/assets/{global-activity-route-Db2_yTAR.js → global-activity-route-Iv0uN7Wy.js} +1 -1
- package/web/dist/assets/index-CVz-Ls8s.css +1 -0
- package/web/dist/assets/{index-BX94wp6m.js → index-mCjln54E.js} +6 -6
- package/web/dist/assets/{label-BKUl84DF.js → label-CH-a6Jyv.js} +1 -1
- package/web/dist/assets/{markdown-DK1FZN4x.js → markdown-DiMerfHU.js} +1 -1
- package/web/dist/assets/{notifications-section-dI7sOt8i.js → notifications-section-DGH8tp1N.js} +1 -1
- package/web/dist/assets/{open-in-menu-N8rXgYSG.js → open-in-menu-CML2QKil.js} +1 -1
- package/web/dist/assets/{popover-BPgUYFyu.js → popover-CZV6tz9i.js} +1 -1
- package/web/dist/assets/preview-pane-connected-Cl_6DHNm.js +3 -0
- package/web/dist/assets/{project-location-CcmuGA5W.js → project-location-CZNz3wYW.js} +1 -1
- package/web/dist/assets/{project-router-CT6gVIcC.js → project-router-BvBqllk2.js} +1 -1
- package/web/dist/assets/{projects-section-B-eMkZf3.js → projects-section-D3h_nr6-.js} +1 -1
- package/web/dist/assets/prompt-templates-section-DelsVm7I.js +1 -0
- package/web/dist/assets/{queries-ClkIgWFx.js → queries-CYWRnyM5.js} +1 -1
- package/web/dist/assets/{reference-chip-B8bfD56G.js → reference-chip-BdikRjql.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-BxFlEKfC.js → remote-settings-notice-D2x0qeKt.js} +1 -1
- package/web/dist/assets/repo-git-DKkOxBOJ.js +1 -0
- package/web/dist/assets/{report-reader-DT6V1PE1.js → report-reader-D2b9baRm.js} +1 -1
- package/web/dist/assets/{report-selection-D9xJZoKb.js → report-selection-D2RvkiGX.js} +1 -1
- package/web/dist/assets/{reports-pCaOIoVC.js → reports-CBP54u9k.js} +1 -1
- package/web/dist/assets/{resources-section-Dr0YbhlY.js → resources-section-D86nQvrk.js} +1 -1
- package/web/dist/assets/review-panel-BcuyfiuF.js +11 -0
- package/web/dist/assets/{run-detail-refresh-Bo51TspT.js → run-detail-refresh-BNI7eMgG.js} +1 -1
- package/web/dist/assets/run-header-B2AfxeyZ.js +2 -0
- package/web/dist/assets/{select-DzxGxxTm.js → select-KMLdkF0Y.js} +1 -1
- package/web/dist/assets/{session-context-section-BxrtJ6og.js → session-context-section-Do5bNw8y.js} +2 -2
- package/web/dist/assets/{settings-agent-picker-CDt7Ns8e.js → settings-agent-picker-Dtqb26Hz.js} +1 -1
- package/web/dist/assets/{settings-shell-B9ladcQ_.js → settings-shell-CWPwhUDh.js} +1 -1
- package/web/dist/assets/{sidebar-section-CRUJRrAR.js → sidebar-section-pLjtUKHT.js} +1 -1
- package/web/dist/assets/{skills-Co7HupH_.js → skills-CaXsJiUU.js} +1 -1
- package/web/dist/assets/{tab-link-BMblA2WK.js → tab-link-B0pNjKxZ.js} +1 -1
- package/web/dist/assets/task-changes-oogngDub.js +1 -0
- package/web/dist/assets/{task-commits-ISUoukSa.js → task-commits-_Aa8bkJq.js} +1 -1
- package/web/dist/assets/task-file-scope-DY0ozMDn.js +1 -0
- package/web/dist/assets/task-files-DxFFK3zI.js +1 -0
- package/web/dist/assets/{task-github-item-Cg8gVOKX.js → task-github-item-LSzJuoiu.js} +1 -1
- package/web/dist/assets/{task-groups-aquji1Kv.js → task-groups-lh9gz7TP.js} +1 -1
- package/web/dist/assets/task-thread-BlThx_dR.js +2 -0
- package/web/dist/assets/task-thread-PDeU-fL6.css +1 -0
- package/web/dist/assets/{tasks-table-BkjZYg2J.js → tasks-table-k18AuMR5.js} +1 -1
- package/web/dist/assets/thread-state-DA2aAkKF.js +4 -0
- package/web/dist/assets/{toaster-C-xqAWVX.js → toaster-B0kvcFif.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-ibAi0h18.js → use-hand-to-agent-state-dgiJEULj.js} +1 -1
- package/web/dist/assets/workflows-DNs9e08u.js +7 -0
- package/web/dist/assets/{workspace-tools-HU7VkLIs.js → workspace-tools-DHek4GFd.js} +1 -1
- package/web/dist/assets/{worktrees-section-uDWkAqqs.js → worktrees-section-fLfqff8U.js} +1 -1
- package/web/dist/index.html +15 -15
- package/web/dist/assets/accounts-section-BObx1Wc5.js +0 -1
- package/web/dist/assets/attention--Y0CyzCN.js +0 -1
- package/web/dist/assets/github-DjD-J1Cb.js +0 -1
- package/web/dist/assets/index-BtmQDC_G.css +0 -1
- package/web/dist/assets/preview-pane-connected-B37RWFUW.js +0 -3
- package/web/dist/assets/prompt-templates-section-BNbYFE3y.js +0 -1
- package/web/dist/assets/repo-git-CEYHupW1.js +0 -1
- package/web/dist/assets/review-panel-wprTeofI.js +0 -8
- package/web/dist/assets/run-header-GiajAH1E.js +0 -2
- package/web/dist/assets/task-changes-Dwcer1B-.js +0 -1
- package/web/dist/assets/task-files-Bek9A4TF.js +0 -1
- package/web/dist/assets/task-thread-DbBtpcw3.js +0 -2
- package/web/dist/assets/task-thread-DzADOhZd.css +0 -1
- package/web/dist/assets/thread-state-CEVwXFWy.js +0 -4
- package/web/dist/assets/workflows-Dy_qXVKT.js +0 -7
package/dist/contract/index.js
CHANGED
|
@@ -3106,6 +3106,22 @@ var worktreeEntrySchema = z24.discriminatedUnion("type", [
|
|
|
3106
3106
|
content: z24.string().optional()
|
|
3107
3107
|
})
|
|
3108
3108
|
]);
|
|
3109
|
+
var worktreeReclaimBlockerSchema = z24.discriminatedUnion("kind", [
|
|
3110
|
+
z24.object({
|
|
3111
|
+
kind: z24.literal("dirty"),
|
|
3112
|
+
uncommittedFiles: z24.number().int().min(1),
|
|
3113
|
+
detachedHead: z24.boolean()
|
|
3114
|
+
}),
|
|
3115
|
+
z24.object({
|
|
3116
|
+
kind: z24.literal("detached-head")
|
|
3117
|
+
}),
|
|
3118
|
+
z24.object({
|
|
3119
|
+
kind: z24.literal("submodules")
|
|
3120
|
+
}),
|
|
3121
|
+
z24.object({
|
|
3122
|
+
kind: z24.literal("invalid")
|
|
3123
|
+
})
|
|
3124
|
+
]);
|
|
3109
3125
|
var worktreeInfoSchema = z24.object({
|
|
3110
3126
|
runId: z24.string(),
|
|
3111
3127
|
title: z24.string(),
|
|
@@ -3114,7 +3130,8 @@ var worktreeInfoSchema = z24.object({
|
|
|
3114
3130
|
sizeBytes: z24.number().nullable(),
|
|
3115
3131
|
finishedAt: z24.string().nullable(),
|
|
3116
3132
|
reclaimable: z24.boolean(),
|
|
3117
|
-
pastKeep: z24.boolean()
|
|
3133
|
+
pastKeep: z24.boolean(),
|
|
3134
|
+
reclaimBlocker: worktreeReclaimBlockerSchema.nullable()
|
|
3118
3135
|
});
|
|
3119
3136
|
var worktreesResponseSchema = z24.object({
|
|
3120
3137
|
worktrees: z24.array(worktreeInfoSchema),
|
|
@@ -6186,7 +6203,18 @@ import { z as z52 } from "zod";
|
|
|
6186
6203
|
var gitCommitSchema = z52.object({
|
|
6187
6204
|
message: z52.string().trim().min(1, "must not be empty").max(5e3)
|
|
6188
6205
|
});
|
|
6189
|
-
var
|
|
6206
|
+
var reclaimWorktreeBodySchema = z52.object({
|
|
6207
|
+
discardWork: z52.boolean().optional()
|
|
6208
|
+
});
|
|
6209
|
+
var reclaimBodySchema = z52.union([
|
|
6210
|
+
z52.object({
|
|
6211
|
+
discardWork: z52.literal(true),
|
|
6212
|
+
runIds: z52.array(z52.string().min(1)).min(1)
|
|
6213
|
+
}),
|
|
6214
|
+
z52.object({
|
|
6215
|
+
discardWork: z52.literal(false).optional()
|
|
6216
|
+
})
|
|
6217
|
+
]);
|
|
6190
6218
|
var repoBranchSchema = z52.object({
|
|
6191
6219
|
name: z52.string().trim().min(1).max(200),
|
|
6192
6220
|
from: z52.string().trim().min(1).max(200).optional()
|
|
@@ -6877,6 +6905,7 @@ export {
|
|
|
6877
6905
|
queuedMessageSchema,
|
|
6878
6906
|
reclaimBodySchema,
|
|
6879
6907
|
reclaimRunParamsSchema,
|
|
6908
|
+
reclaimWorktreeBodySchema,
|
|
6880
6909
|
reclaimWorktreeResponseSchema,
|
|
6881
6910
|
reclaimWorktreesResponseSchema,
|
|
6882
6911
|
refNumberFromUrl,
|
|
@@ -7144,6 +7173,7 @@ export {
|
|
|
7144
7173
|
worktreeEntrySchema,
|
|
7145
7174
|
worktreeFilesQuerySchema,
|
|
7146
7175
|
worktreeInfoSchema,
|
|
7176
|
+
worktreeReclaimBlockerSchema,
|
|
7147
7177
|
worktreeSetupConfigSchema,
|
|
7148
7178
|
worktreesResponseSchema,
|
|
7149
7179
|
writableAutomationTask,
|
|
@@ -2,7 +2,15 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const gitCommitSchema: z.ZodObject<{
|
|
3
3
|
message: z.ZodString;
|
|
4
4
|
}, z.core.$strip>;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const reclaimWorktreeBodySchema: z.ZodObject<{
|
|
6
|
+
discardWork: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const reclaimBodySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
9
|
+
discardWork: z.ZodLiteral<true>;
|
|
10
|
+
runIds: z.ZodArray<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
12
|
+
discardWork: z.ZodOptional<z.ZodLiteral<false>>;
|
|
13
|
+
}, z.core.$strip>]>;
|
|
6
14
|
export declare const repoBranchSchema: z.ZodObject<{
|
|
7
15
|
name: z.ZodString;
|
|
8
16
|
from: z.ZodOptional<z.ZodString>;
|
package/dist/contract/repo.d.ts
CHANGED
|
@@ -453,10 +453,25 @@ export declare const worktreeEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
453
453
|
content: z.ZodOptional<z.ZodString>;
|
|
454
454
|
}, z.core.$strip>], "type">;
|
|
455
455
|
export type WorktreeEntry = z.infer<typeof worktreeEntrySchema>;
|
|
456
|
+
/** Why a finished worktree cannot be reclaimed cleanly without discarding work. */
|
|
457
|
+
export declare const worktreeReclaimBlockerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
458
|
+
kind: z.ZodLiteral<"dirty">;
|
|
459
|
+
uncommittedFiles: z.ZodNumber;
|
|
460
|
+
detachedHead: z.ZodBoolean;
|
|
461
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
462
|
+
kind: z.ZodLiteral<"detached-head">;
|
|
463
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
464
|
+
kind: z.ZodLiteral<"submodules">;
|
|
465
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
466
|
+
kind: z.ZodLiteral<"invalid">;
|
|
467
|
+
}, z.core.$strip>], "kind">;
|
|
468
|
+
export type WorktreeReclaimBlocker = z.infer<typeof worktreeReclaimBlockerSchema>;
|
|
456
469
|
/** One materialized task worktree in the management panel (#483). `sizeBytes` is null when `du`
|
|
457
470
|
* is unavailable (Windows / missing). `reclaimable` = finished, has a directory, not yet
|
|
458
|
-
* reclaimed (retention's rule). `pastKeep` = reclaimable AND outside the newest `keep
|
|
459
|
-
*
|
|
471
|
+
* reclaimed (retention's rule). `pastKeep` = reclaimable AND outside the newest `keep`.
|
|
472
|
+
* `reclaimBlocker` is non-null when a clean reclaim would refuse the checkout (uncommitted files,
|
|
473
|
+
* detached HEAD with no keeping ref, or an unregistered/broken directory); explicit discard can
|
|
474
|
+
* still reclaim its directory while keeping the branch. */
|
|
460
475
|
export declare const worktreeInfoSchema: z.ZodObject<{
|
|
461
476
|
runId: z.ZodString;
|
|
462
477
|
title: z.ZodString;
|
|
@@ -474,6 +489,17 @@ export declare const worktreeInfoSchema: z.ZodObject<{
|
|
|
474
489
|
finishedAt: z.ZodNullable<z.ZodString>;
|
|
475
490
|
reclaimable: z.ZodBoolean;
|
|
476
491
|
pastKeep: z.ZodBoolean;
|
|
492
|
+
reclaimBlocker: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
493
|
+
kind: z.ZodLiteral<"dirty">;
|
|
494
|
+
uncommittedFiles: z.ZodNumber;
|
|
495
|
+
detachedHead: z.ZodBoolean;
|
|
496
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
497
|
+
kind: z.ZodLiteral<"detached-head">;
|
|
498
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
499
|
+
kind: z.ZodLiteral<"submodules">;
|
|
500
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
501
|
+
kind: z.ZodLiteral<"invalid">;
|
|
502
|
+
}, z.core.$strip>], "kind">>;
|
|
477
503
|
}, z.core.$strip>;
|
|
478
504
|
export type WorktreeInfo = z.infer<typeof worktreeInfoSchema>;
|
|
479
505
|
/** `GET /api/v1/worktrees` (#483): the worktrees on disk, their total size (null when any
|
|
@@ -496,6 +522,17 @@ export declare const worktreesResponseSchema: z.ZodObject<{
|
|
|
496
522
|
finishedAt: z.ZodNullable<z.ZodString>;
|
|
497
523
|
reclaimable: z.ZodBoolean;
|
|
498
524
|
pastKeep: z.ZodBoolean;
|
|
525
|
+
reclaimBlocker: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
526
|
+
kind: z.ZodLiteral<"dirty">;
|
|
527
|
+
uncommittedFiles: z.ZodNumber;
|
|
528
|
+
detachedHead: z.ZodBoolean;
|
|
529
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
530
|
+
kind: z.ZodLiteral<"detached-head">;
|
|
531
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
532
|
+
kind: z.ZodLiteral<"submodules">;
|
|
533
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
534
|
+
kind: z.ZodLiteral<"invalid">;
|
|
535
|
+
}, z.core.$strip>], "kind">>;
|
|
499
536
|
}, z.core.$strip>>;
|
|
500
537
|
totalBytes: z.ZodNullable<z.ZodNumber>;
|
|
501
538
|
keep: z.ZodNumber;
|
|
@@ -27,18 +27,6 @@ export declare function delegationFailure(error: unknown): {
|
|
|
27
27
|
export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
|
|
28
28
|
"/list": {
|
|
29
29
|
$get: {
|
|
30
|
-
output: {
|
|
31
|
-
error: string;
|
|
32
|
-
code?: "invalid_input" | undefined;
|
|
33
|
-
};
|
|
34
|
-
outputFormat: "json";
|
|
35
|
-
status: 400;
|
|
36
|
-
input: {
|
|
37
|
-
query: {
|
|
38
|
-
offset?: string | undefined;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
} | {
|
|
42
30
|
output: {
|
|
43
31
|
workers: {
|
|
44
32
|
workerId: string;
|
|
@@ -91,6 +79,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
91
79
|
offset?: string | undefined;
|
|
92
80
|
};
|
|
93
81
|
};
|
|
82
|
+
} | {
|
|
83
|
+
output: {
|
|
84
|
+
error: string;
|
|
85
|
+
code?: "invalid_input" | undefined;
|
|
86
|
+
};
|
|
87
|
+
outputFormat: "json";
|
|
88
|
+
status: 400;
|
|
89
|
+
input: {
|
|
90
|
+
query: {
|
|
91
|
+
offset?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
} & {
|
|
@@ -677,18 +677,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
677
677
|
} & {
|
|
678
678
|
"/:workerId": {
|
|
679
679
|
$get: {
|
|
680
|
-
output: {
|
|
681
|
-
error: string;
|
|
682
|
-
code?: "invalid_input" | undefined;
|
|
683
|
-
};
|
|
684
|
-
outputFormat: "json";
|
|
685
|
-
status: 400;
|
|
686
|
-
input: {
|
|
687
|
-
param: {
|
|
688
|
-
workerId: string;
|
|
689
|
-
};
|
|
690
|
-
};
|
|
691
|
-
} | {
|
|
692
680
|
output: {
|
|
693
681
|
workerId: string;
|
|
694
682
|
settled: boolean;
|
|
@@ -813,11 +801,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
813
801
|
workerId: string;
|
|
814
802
|
};
|
|
815
803
|
};
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
} & {
|
|
819
|
-
"/:workerId/collect": {
|
|
820
|
-
$post: {
|
|
804
|
+
} | {
|
|
821
805
|
output: {
|
|
822
806
|
error: string;
|
|
823
807
|
code?: "invalid_input" | undefined;
|
|
@@ -828,10 +812,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
828
812
|
param: {
|
|
829
813
|
workerId: string;
|
|
830
814
|
};
|
|
831
|
-
} & {
|
|
832
|
-
json: Record<string, never>;
|
|
833
815
|
};
|
|
834
|
-
}
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
} & {
|
|
819
|
+
"/:workerId/collect": {
|
|
820
|
+
$post: {
|
|
835
821
|
output: {
|
|
836
822
|
workerId: string;
|
|
837
823
|
parentRunId: string;
|
|
@@ -954,11 +940,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
954
940
|
} & {
|
|
955
941
|
json: Record<string, never>;
|
|
956
942
|
};
|
|
957
|
-
}
|
|
958
|
-
};
|
|
959
|
-
} & {
|
|
960
|
-
"/:workerId/steer": {
|
|
961
|
-
$post: {
|
|
943
|
+
} | {
|
|
962
944
|
output: {
|
|
963
945
|
error: string;
|
|
964
946
|
code?: "invalid_input" | undefined;
|
|
@@ -970,11 +952,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
970
952
|
workerId: string;
|
|
971
953
|
};
|
|
972
954
|
} & {
|
|
973
|
-
json:
|
|
974
|
-
text: string;
|
|
975
|
-
};
|
|
955
|
+
json: Record<string, never>;
|
|
976
956
|
};
|
|
977
|
-
}
|
|
957
|
+
};
|
|
958
|
+
};
|
|
959
|
+
} & {
|
|
960
|
+
"/:workerId/steer": {
|
|
961
|
+
$post: {
|
|
978
962
|
output: {
|
|
979
963
|
workerId: string;
|
|
980
964
|
state: "delivered" | "queued";
|
|
@@ -990,11 +974,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
990
974
|
text: string;
|
|
991
975
|
};
|
|
992
976
|
};
|
|
993
|
-
}
|
|
994
|
-
};
|
|
995
|
-
} & {
|
|
996
|
-
"/:workerId/stop": {
|
|
997
|
-
$post: {
|
|
977
|
+
} | {
|
|
998
978
|
output: {
|
|
999
979
|
error: string;
|
|
1000
980
|
code?: "invalid_input" | undefined;
|
|
@@ -1006,9 +986,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1006
986
|
workerId: string;
|
|
1007
987
|
};
|
|
1008
988
|
} & {
|
|
1009
|
-
json:
|
|
989
|
+
json: {
|
|
990
|
+
text: string;
|
|
991
|
+
};
|
|
1010
992
|
};
|
|
1011
|
-
}
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
} & {
|
|
996
|
+
"/:workerId/stop": {
|
|
997
|
+
$post: {
|
|
1012
998
|
output: {
|
|
1013
999
|
workerId: string;
|
|
1014
1000
|
state: "stopping" | "terminated";
|
|
@@ -1022,11 +1008,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1022
1008
|
} & {
|
|
1023
1009
|
json: Record<string, never>;
|
|
1024
1010
|
};
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
} & {
|
|
1028
|
-
"/:workerId/destroy": {
|
|
1029
|
-
$post: {
|
|
1011
|
+
} | {
|
|
1030
1012
|
output: {
|
|
1031
1013
|
error: string;
|
|
1032
1014
|
code?: "invalid_input" | undefined;
|
|
@@ -1038,11 +1020,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1038
1020
|
workerId: string;
|
|
1039
1021
|
};
|
|
1040
1022
|
} & {
|
|
1041
|
-
json:
|
|
1042
|
-
discardWork?: true | undefined;
|
|
1043
|
-
};
|
|
1023
|
+
json: Record<string, never>;
|
|
1044
1024
|
};
|
|
1045
|
-
}
|
|
1025
|
+
};
|
|
1026
|
+
};
|
|
1027
|
+
} & {
|
|
1028
|
+
"/:workerId/destroy": {
|
|
1029
|
+
$post: {
|
|
1046
1030
|
output: {
|
|
1047
1031
|
workerId: string;
|
|
1048
1032
|
state: "complete" | "incomplete";
|
|
@@ -1071,6 +1055,22 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1071
1055
|
discardWork?: true | undefined;
|
|
1072
1056
|
};
|
|
1073
1057
|
};
|
|
1058
|
+
} | {
|
|
1059
|
+
output: {
|
|
1060
|
+
error: string;
|
|
1061
|
+
code?: "invalid_input" | undefined;
|
|
1062
|
+
};
|
|
1063
|
+
outputFormat: "json";
|
|
1064
|
+
status: 400;
|
|
1065
|
+
input: {
|
|
1066
|
+
param: {
|
|
1067
|
+
workerId: string;
|
|
1068
|
+
};
|
|
1069
|
+
} & {
|
|
1070
|
+
json: {
|
|
1071
|
+
discardWork?: true | undefined;
|
|
1072
|
+
};
|
|
1073
|
+
};
|
|
1074
1074
|
} | {
|
|
1075
1075
|
output: {
|
|
1076
1076
|
workerId: string;
|
|
@@ -1106,11 +1106,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1106
1106
|
"/:workerId/diff": {
|
|
1107
1107
|
$get: {
|
|
1108
1108
|
output: {
|
|
1109
|
-
|
|
1110
|
-
|
|
1109
|
+
workerId: string;
|
|
1110
|
+
baselineSha: string;
|
|
1111
|
+
diff: string;
|
|
1112
|
+
truncated: boolean;
|
|
1111
1113
|
};
|
|
1112
1114
|
outputFormat: "json";
|
|
1113
|
-
status:
|
|
1115
|
+
status: 200;
|
|
1114
1116
|
input: {
|
|
1115
1117
|
param: {
|
|
1116
1118
|
workerId: string;
|
|
@@ -1118,13 +1120,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1118
1120
|
};
|
|
1119
1121
|
} | {
|
|
1120
1122
|
output: {
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
diff: string;
|
|
1124
|
-
truncated: boolean;
|
|
1123
|
+
error: string;
|
|
1124
|
+
code?: "invalid_input" | undefined;
|
|
1125
1125
|
};
|
|
1126
1126
|
outputFormat: "json";
|
|
1127
|
-
status:
|
|
1127
|
+
status: 400;
|
|
1128
1128
|
input: {
|
|
1129
1129
|
param: {
|
|
1130
1130
|
workerId: string;
|
package/dist/git-worktree.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WorktreeReclaimBlocker } from './contract/index.js';
|
|
1
2
|
import { type LiveIndexCheck, type DiffRefusal } from './git-private-index.ts';
|
|
2
3
|
import { type WorktreeGitResult } from './git-worktree-lock.ts';
|
|
3
4
|
/** One worktree per task (spec 006). Only createWorktree throws; its caller reports failure. */
|
|
@@ -55,6 +56,14 @@ export type RemoveWorktreeOptions = {
|
|
|
55
56
|
assertCurrent?: () => void;
|
|
56
57
|
};
|
|
57
58
|
export declare function removeWorktree(repoRoot: string, worktreePath: string, branch?: string, opts?: RemoveWorktreeOptions): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Inspect whether a finished worktree directory would be refused by a clean reclaim
|
|
61
|
+
* (`removeCleanWorktree`): uncommitted files, a detached HEAD with no branch/remote ref holding
|
|
62
|
+
* its commit, initialized submodules, or an unregistered/broken directory (missing `.git`).
|
|
63
|
+
* Returns `null` when clean and ref-backed (or when the directory no longer exists).
|
|
64
|
+
* Best-effort: never throws.
|
|
65
|
+
*/
|
|
66
|
+
export declare function inspectWorktreeReclaimBlocker(repoRoot: string, worktreePath: string): Promise<WorktreeReclaimBlocker | null>;
|
|
58
67
|
/**
|
|
59
68
|
* Whole-branch committed, uncommitted and untracked diff against the merge-base. Preserve this
|
|
60
69
|
* anchor for the protected text endpoint and conservative settlement checks.
|
package/dist/git-worktree.js
CHANGED
|
@@ -3,7 +3,7 @@ import { projectPaths, isFallbackProjectPath } from './project-paths.js';
|
|
|
3
3
|
import { git } from './git-command.js';
|
|
4
4
|
import { ownedWorkspaceSchema } from './contract/index.js';
|
|
5
5
|
import { existsSync, realpathSync } from 'node:fs';
|
|
6
|
-
import { lstat, mkdir, readdir, readFile, rm, rmdir } from 'node:fs/promises';
|
|
6
|
+
import { chmod, lstat, mkdir, readdir, readFile, rm, rmdir } from 'node:fs/promises';
|
|
7
7
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
8
8
|
import { resolveTaskDiffBase } from './git-diff-base.js';
|
|
9
9
|
import { withPrivateIndex } from './git-private-index.js';
|
|
@@ -406,7 +406,122 @@ async function runBeforeWorktreeRemove(opts) {
|
|
|
406
406
|
await opts?.beforeRemove?.().catch(() => undefined);
|
|
407
407
|
opts?.assertCurrent?.();
|
|
408
408
|
}
|
|
409
|
+
/** Count entries in `git status --porcelain=v1 -z` output, skipping rename/copy source paths. */
|
|
410
|
+
function countPorcelainEntries(stdout) {
|
|
411
|
+
const fields = stdout.split('\0');
|
|
412
|
+
let files = 0;
|
|
413
|
+
for (let i = 0; i < fields.length; i++) {
|
|
414
|
+
const entry = fields[i];
|
|
415
|
+
if (entry.length < 4)
|
|
416
|
+
continue;
|
|
417
|
+
files++;
|
|
418
|
+
if (/[RC]/.test(entry.slice(0, 2)))
|
|
419
|
+
i++;
|
|
420
|
+
}
|
|
421
|
+
return files;
|
|
422
|
+
}
|
|
423
|
+
/** True only when `worktreePath` is its own Git worktree root (not walking up to `repoRoot`). */
|
|
424
|
+
async function isWorktreeRoot(worktreePath, runGitFn) {
|
|
425
|
+
const top = await runGitFn(worktreePath, ['rev-parse', '--show-toplevel']);
|
|
426
|
+
return top.ok && canonicalPath(top.stdout.trim()) === canonicalPath(worktreePath);
|
|
427
|
+
}
|
|
428
|
+
/** True when Git's unforced `worktree remove` would refuse this worktree for submodules:
|
|
429
|
+
* either the worktree's admin `modules` directory exists (even after `git submodule deinit`,
|
|
430
|
+
* matching Git's `validate_no_submodules`) or a tracked gitlink (`160000`) directory is non-empty. */
|
|
431
|
+
async function hasWorktreeSubmodules(worktreePath) {
|
|
432
|
+
const modules = await git(worktreePath, ['rev-parse', '--path-format=absolute', '--git-path', 'modules']);
|
|
433
|
+
if (modules.ok && modules.stdout.trim()) {
|
|
434
|
+
const info = await lstat(modules.stdout.trim()).catch(() => undefined);
|
|
435
|
+
if (info?.isDirectory())
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
const listed = await git(worktreePath, ['--no-optional-locks', 'ls-files', '-s', '-z']);
|
|
439
|
+
if (!listed.ok)
|
|
440
|
+
return false;
|
|
441
|
+
for (const entry of listed.stdout.split('\0')) {
|
|
442
|
+
if (!entry.startsWith('160000 '))
|
|
443
|
+
continue;
|
|
444
|
+
const tab = entry.indexOf('\t');
|
|
445
|
+
if (tab < 0)
|
|
446
|
+
continue;
|
|
447
|
+
const contents = await readdir(join(worktreePath, entry.slice(tab + 1))).catch(() => []);
|
|
448
|
+
if (contents.length > 0)
|
|
449
|
+
return true;
|
|
450
|
+
}
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Inspect whether a finished worktree directory would be refused by a clean reclaim
|
|
455
|
+
* (`removeCleanWorktree`): uncommitted files, a detached HEAD with no branch/remote ref holding
|
|
456
|
+
* its commit, initialized submodules, or an unregistered/broken directory (missing `.git`).
|
|
457
|
+
* Returns `null` when clean and ref-backed (or when the directory no longer exists).
|
|
458
|
+
* Best-effort: never throws.
|
|
459
|
+
*/
|
|
460
|
+
export async function inspectWorktreeReclaimBlocker(repoRoot, worktreePath) {
|
|
461
|
+
if (!existsSync(worktreePath))
|
|
462
|
+
return null;
|
|
463
|
+
if (!(await isWorktreeRoot(worktreePath, git)))
|
|
464
|
+
return { kind: 'invalid' };
|
|
465
|
+
const target = canonicalPath(worktreePath);
|
|
466
|
+
const registered = await registeredWorktrees(repoRoot);
|
|
467
|
+
if (target === canonicalPath(repoRoot) || !registered.some((item) => canonicalPath(item.path) === target)) {
|
|
468
|
+
return { kind: 'invalid' };
|
|
469
|
+
}
|
|
470
|
+
const head = await git(worktreePath, ['rev-parse', '--verify', '--quiet', 'HEAD^{commit}']);
|
|
471
|
+
const sha = head.stdout.trim();
|
|
472
|
+
if (!head.ok || !sha)
|
|
473
|
+
return { kind: 'invalid' };
|
|
474
|
+
const status = await git(worktreePath, ['--no-optional-locks', 'status', '--porcelain=v1', '-z', '--untracked-files=normal']);
|
|
475
|
+
if (!status.ok)
|
|
476
|
+
return { kind: 'invalid' };
|
|
477
|
+
const uncommittedFiles = countPorcelainEntries(status.stdout);
|
|
478
|
+
const sym = await git(worktreePath, ['symbolic-ref', '-q', 'HEAD']);
|
|
479
|
+
let detachedHead = false;
|
|
480
|
+
if (!sym.ok || !sym.stdout.trim().startsWith('refs/heads/')) {
|
|
481
|
+
const kept = await git(repoRoot, ['for-each-ref', '--contains', sha, '--count=1', '--format=%(refname)', 'refs/heads', 'refs/remotes']);
|
|
482
|
+
if (!kept.ok)
|
|
483
|
+
return { kind: 'invalid' };
|
|
484
|
+
detachedHead = kept.stdout.trim() === '';
|
|
485
|
+
}
|
|
486
|
+
if (uncommittedFiles > 0)
|
|
487
|
+
return { kind: 'dirty', uncommittedFiles, detachedHead };
|
|
488
|
+
if (detachedHead)
|
|
489
|
+
return { kind: 'detached-head' };
|
|
490
|
+
if (await hasWorktreeSubmodules(worktreePath))
|
|
491
|
+
return { kind: 'submodules' };
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
/** Make directories writable so POSIX unlink can remove entries inside read-only fixtures.
|
|
495
|
+
* Never chmod regular files: hard-linked files (such as pnpm node_modules) share their inode
|
|
496
|
+
* mode with paths outside this worktree. */
|
|
497
|
+
async function makeTreeWritable(dir) {
|
|
498
|
+
await chmod(dir, 0o700).catch(() => undefined);
|
|
499
|
+
const entries = await readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
500
|
+
for (const entry of entries) {
|
|
501
|
+
if (entry.isSymbolicLink())
|
|
502
|
+
continue;
|
|
503
|
+
if (entry.isDirectory())
|
|
504
|
+
await makeTreeWritable(join(dir, entry.name));
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
async function removeTreeAllowingReadOnly(worktreePath) {
|
|
508
|
+
try {
|
|
509
|
+
await rm(worktreePath, { recursive: true, force: true });
|
|
510
|
+
}
|
|
511
|
+
catch (err) {
|
|
512
|
+
const code = err?.code;
|
|
513
|
+
if (code !== 'EACCES' && code !== 'EPERM')
|
|
514
|
+
return;
|
|
515
|
+
const info = await lstat(worktreePath).catch(() => undefined);
|
|
516
|
+
if (!info || info.isSymbolicLink() || !info.isDirectory())
|
|
517
|
+
return;
|
|
518
|
+
await makeTreeWritable(worktreePath);
|
|
519
|
+
await rm(worktreePath, { recursive: true, force: true }).catch(() => undefined);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
409
522
|
async function removeCleanWorktree(repoRoot, worktreePath, protection, git, beforeRemove) {
|
|
523
|
+
if (!(await isWorktreeRoot(worktreePath, git)))
|
|
524
|
+
return;
|
|
410
525
|
const head = await git(worktreePath, ['rev-parse', '--verify', '--quiet', 'HEAD^{commit}']);
|
|
411
526
|
const sha = head.stdout.trim();
|
|
412
527
|
if (!head.ok || !sha)
|
|
@@ -430,14 +545,14 @@ async function removeCleanWorktree(repoRoot, worktreePath, protection, git, befo
|
|
|
430
545
|
}
|
|
431
546
|
async function forceRemoveWorktree(repoRoot, worktreePath, branch, reclaimOwnedDirectory, protection, git, beforeRemove) {
|
|
432
547
|
await beforeRemove();
|
|
433
|
-
await git(repoRoot, ['worktree', 'remove', '--force', worktreePath]);
|
|
548
|
+
await git(repoRoot, ['worktree', 'remove', '--force', '--force', worktreePath]);
|
|
434
549
|
// Owned-path reclaim must not `rm` a receipt path that is no longer a git
|
|
435
550
|
// worktree — the directory may have been replaced with unrelated files.
|
|
436
551
|
// For owned resources Git already removed the exact checkout. Never recursively delete a
|
|
437
552
|
// path recreated after that operation (possibly by another execution/controller).
|
|
438
553
|
if (reclaimOwnedDirectory && protection.paths.has(worktreePath))
|
|
439
554
|
return;
|
|
440
|
-
await
|
|
555
|
+
await removeTreeAllowingReadOnly(worktreePath);
|
|
441
556
|
if (protection.paths.size === 0)
|
|
442
557
|
await git(repoRoot, ['worktree', 'prune']);
|
|
443
558
|
if (branch)
|