@dmrlzz/davecode 0.6.0 → 0.7.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/dist/{ChatApp-RQZ2IZFQ.js → ChatApp-C23NVTME.js} +6 -6
- package/dist/{account-FY6THFLW.js → account-GG7UFSNY.js} +3 -3
- package/dist/{accounts-ZV3KMLC5.js → accounts-IPOGUMHF.js} +5 -5
- package/dist/{budget-OUOEMMOM.js → budget-7QJGPYPF.js} +4 -4
- package/dist/{chat-OHVP4BS3.js → chat-3K2KXS3E.js} +8 -8
- package/dist/{chunk-FFB2QA5I.js → chunk-3BTE76UD.js} +2 -2
- package/dist/{chunk-L7NEDOA3.js → chunk-4FE2YV5U.js} +2 -2
- package/dist/{chunk-TP3ORSHY.js → chunk-FKGZERYB.js} +157 -9
- package/dist/chunk-FKGZERYB.js.map +1 -0
- package/dist/{chunk-2MM5WT5J.js → chunk-JBX6J74G.js} +3 -3
- package/dist/{chunk-2P5DJWIJ.js → chunk-KEURMO75.js} +4 -4
- package/dist/{chunk-NKRI6SYR.js → chunk-LK2K73DC.js} +2 -2
- package/dist/{chunk-2XGDILCW.js → chunk-NBQIMB43.js} +2422 -1599
- package/dist/chunk-NBQIMB43.js.map +1 -0
- package/dist/{chunk-HL4RIXPM.js → chunk-PGZPSJS7.js} +3 -3
- package/dist/{chunk-U5CI774J.js → chunk-U42YONUN.js} +3 -3
- package/dist/{config-ZLO3YOUX.js → config-BFEQFGAR.js} +3 -3
- package/dist/dashboard/assets/Accounts-CUMFzGls.js +1 -0
- package/dist/dashboard/assets/{Callout-CqdcH6dC.js → Callout-DDtTG_BA.js} +1 -1
- package/dist/dashboard/assets/Goals-CBGiTkcP.js +1 -0
- package/dist/dashboard/assets/{Library-DnCIb76j.js → Library-CKWa3h0E.js} +1 -1
- package/dist/dashboard/assets/{Panes-DBqKYuaE.js → Panes-ziAz-CZa.js} +4 -4
- package/dist/dashboard/assets/RoutesPage-D2iW-KhM.js +4 -0
- package/dist/dashboard/assets/Runner-4e79FB1J.js +1 -0
- package/dist/dashboard/assets/Settings-CSae84S0.js +1 -0
- package/dist/dashboard/assets/Tasks-CnbZ5PvX.js +2 -0
- package/dist/dashboard/assets/Traffic-B12xKOUm.js +1 -0
- package/dist/dashboard/assets/Workspace-CMPHlw4f.js +1 -0
- package/dist/dashboard/assets/chevron-down-DT349Fth.js +1 -0
- package/dist/dashboard/assets/external-link-DCIUScea.js +1 -0
- package/dist/dashboard/assets/format-C7Q-B9fI.js +112 -0
- package/dist/dashboard/assets/index-4RIBvhr9.css +2 -0
- package/dist/dashboard/assets/index-z8TlFwRe.js +50 -0
- package/dist/dashboard/assets/{task-errors-DK4-900l.js → task-errors-3F3vbQ7k.js} +1 -1
- package/dist/dashboard/assets/x-UBQsC1rW.js +1 -0
- package/dist/dashboard/index.html +4 -3
- package/dist/{dist-56V3DLJ4.js → dist-VTC5E7Z5.js} +34 -2
- package/dist/{doctor-DUOKUSJL.js → doctor-JLFYQ3EP.js} +3 -3
- package/dist/{goal-WG37XHUY.js → goal-JM7QYTL2.js} +4 -4
- package/dist/index.js +32 -32
- package/dist/{init-WW4XPFMM.js → init-6K4EGMTV.js} +3 -3
- package/dist/{orchestrate-7YQDBS3E.js → orchestrate-QC5P6IUZ.js} +4 -4
- package/dist/{run-QB4SGPEC.js → run-ABQNQ722.js} +3 -3
- package/dist/runtime.js +2 -2
- package/dist/{start-U4RL377T.js → start-MSO7TGBX.js} +3 -3
- package/dist/{status-GHVMGZI5.js → status-U6C4LUCM.js} +4 -4
- package/dist/{tasks-VTBJ4B2G.js → tasks-HEVT67YM.js} +4 -4
- package/package.json +4 -4
- package/dist/chunk-2XGDILCW.js.map +0 -1
- package/dist/chunk-TP3ORSHY.js.map +0 -1
- package/dist/dashboard/assets/Accounts-CIhOt9FH.js +0 -1
- package/dist/dashboard/assets/Goals-CITP2GqG.js +0 -1
- package/dist/dashboard/assets/RoutesPage-BNVmKhyU.js +0 -4
- package/dist/dashboard/assets/Runner-KR35ZWUE.js +0 -1
- package/dist/dashboard/assets/Settings-B5qE-a5O.js +0 -1
- package/dist/dashboard/assets/Tasks-bJLfNJmS.js +0 -2
- package/dist/dashboard/assets/Traffic-CGfilrRx.js +0 -1
- package/dist/dashboard/assets/Workspace-Dc3cvct_.js +0 -1
- package/dist/dashboard/assets/format-328qIBHX.js +0 -111
- package/dist/dashboard/assets/index-C-bwzlsl.js +0 -50
- package/dist/dashboard/assets/index-D9FCfPmM.css +0 -2
- /package/dist/{ChatApp-RQZ2IZFQ.js.map → ChatApp-C23NVTME.js.map} +0 -0
- /package/dist/{account-FY6THFLW.js.map → account-GG7UFSNY.js.map} +0 -0
- /package/dist/{accounts-ZV3KMLC5.js.map → accounts-IPOGUMHF.js.map} +0 -0
- /package/dist/{budget-OUOEMMOM.js.map → budget-7QJGPYPF.js.map} +0 -0
- /package/dist/{chat-OHVP4BS3.js.map → chat-3K2KXS3E.js.map} +0 -0
- /package/dist/{chunk-FFB2QA5I.js.map → chunk-3BTE76UD.js.map} +0 -0
- /package/dist/{chunk-L7NEDOA3.js.map → chunk-4FE2YV5U.js.map} +0 -0
- /package/dist/{chunk-2MM5WT5J.js.map → chunk-JBX6J74G.js.map} +0 -0
- /package/dist/{chunk-2P5DJWIJ.js.map → chunk-KEURMO75.js.map} +0 -0
- /package/dist/{chunk-NKRI6SYR.js.map → chunk-LK2K73DC.js.map} +0 -0
- /package/dist/{chunk-HL4RIXPM.js.map → chunk-PGZPSJS7.js.map} +0 -0
- /package/dist/{chunk-U5CI774J.js.map → chunk-U42YONUN.js.map} +0 -0
- /package/dist/{config-ZLO3YOUX.js.map → config-BFEQFGAR.js.map} +0 -0
- /package/dist/{dist-56V3DLJ4.js.map → dist-VTC5E7Z5.js.map} +0 -0
- /package/dist/{doctor-DUOKUSJL.js.map → doctor-JLFYQ3EP.js.map} +0 -0
- /package/dist/{goal-WG37XHUY.js.map → goal-JM7QYTL2.js.map} +0 -0
- /package/dist/{init-WW4XPFMM.js.map → init-6K4EGMTV.js.map} +0 -0
- /package/dist/{orchestrate-7YQDBS3E.js.map → orchestrate-QC5P6IUZ.js.map} +0 -0
- /package/dist/{run-QB4SGPEC.js.map → run-ABQNQ722.js.map} +0 -0
- /package/dist/{start-U4RL377T.js.map → start-MSO7TGBX.js.map} +0 -0
- /package/dist/{status-GHVMGZI5.js.map → status-U6C4LUCM.js.map} +0 -0
- /package/dist/{tasks-VTBJ4B2G.js.map → tasks-HEVT67YM.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatTaskTree,
|
|
3
3
|
summaryLine
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LK2K73DC.js";
|
|
5
5
|
import {
|
|
6
6
|
brandBanner
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3BTE76UD.js";
|
|
8
8
|
import {
|
|
9
9
|
Spinner
|
|
10
10
|
} from "./chunk-5LKOJBUL.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
emptyUsage,
|
|
17
17
|
renderAccounts
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-U42YONUN.js";
|
|
19
19
|
import {
|
|
20
20
|
bar,
|
|
21
21
|
formatTokens,
|
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
visibleWidth
|
|
26
26
|
} from "./chunk-SF5ZEAP4.js";
|
|
27
27
|
import "./chunk-QA3O6RA2.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-FKGZERYB.js";
|
|
29
29
|
import "./chunk-7XVXEO7U.js";
|
|
30
30
|
import "./chunk-732GIHRQ.js";
|
|
31
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-NBQIMB43.js";
|
|
32
32
|
import "./chunk-MC7RIPL7.js";
|
|
33
33
|
|
|
34
34
|
// src/tui/ChatApp.tsx
|
|
@@ -1043,4 +1043,4 @@ function ChatApp(props) {
|
|
|
1043
1043
|
export {
|
|
1044
1044
|
ChatApp
|
|
1045
1045
|
};
|
|
1046
|
-
//# sourceMappingURL=ChatApp-
|
|
1046
|
+
//# sourceMappingURL=ChatApp-C23NVTME.js.map
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
loginCommand,
|
|
8
8
|
logoutCommand,
|
|
9
9
|
signIn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4FE2YV5U.js";
|
|
11
11
|
import "./chunk-7XVXEO7U.js";
|
|
12
12
|
import "./chunk-732GIHRQ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-NBQIMB43.js";
|
|
14
14
|
export {
|
|
15
15
|
accountCommand,
|
|
16
16
|
accountsEnabled,
|
|
@@ -21,4 +21,4 @@ export {
|
|
|
21
21
|
logoutCommand,
|
|
22
22
|
signIn
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=account-
|
|
24
|
+
//# sourceMappingURL=account-GG7UFSNY.js.map
|
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
loginArgs,
|
|
12
12
|
renderAccountList,
|
|
13
13
|
subscriptionFromFlags
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-KEURMO75.js";
|
|
15
|
+
import "./chunk-JBX6J74G.js";
|
|
16
16
|
import "./chunk-IC3TDONV.js";
|
|
17
17
|
import "./chunk-SF5ZEAP4.js";
|
|
18
18
|
import "./chunk-QA3O6RA2.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-FKGZERYB.js";
|
|
20
20
|
import "./chunk-7XVXEO7U.js";
|
|
21
21
|
import "./chunk-732GIHRQ.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-NBQIMB43.js";
|
|
23
23
|
import "./chunk-MC7RIPL7.js";
|
|
24
24
|
export {
|
|
25
25
|
accountsAdd,
|
|
@@ -35,4 +35,4 @@ export {
|
|
|
35
35
|
renderAccountList,
|
|
36
36
|
subscriptionFromFlags
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=accounts-
|
|
38
|
+
//# sourceMappingURL=accounts-IPOGUMHF.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openAccounts
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JBX6J74G.js";
|
|
4
4
|
import {
|
|
5
5
|
bar,
|
|
6
6
|
levelStyle,
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
} from "./chunk-QA3O6RA2.js";
|
|
14
14
|
import {
|
|
15
15
|
detectProjectRoot
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FKGZERYB.js";
|
|
17
17
|
import {
|
|
18
18
|
EXIT
|
|
19
19
|
} from "./chunk-7XVXEO7U.js";
|
|
20
20
|
import "./chunk-732GIHRQ.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-NBQIMB43.js";
|
|
22
22
|
import "./chunk-MC7RIPL7.js";
|
|
23
23
|
|
|
24
24
|
// src/commands/budget.ts
|
|
@@ -113,4 +113,4 @@ export {
|
|
|
113
113
|
budgetCommand,
|
|
114
114
|
renderBudget
|
|
115
115
|
};
|
|
116
|
-
//# sourceMappingURL=budget-
|
|
116
|
+
//# sourceMappingURL=budget-7QJGPYPF.js.map
|
|
@@ -4,19 +4,19 @@ import {
|
|
|
4
4
|
currentAccount,
|
|
5
5
|
describeUser,
|
|
6
6
|
signIn
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4FE2YV5U.js";
|
|
8
8
|
import {
|
|
9
9
|
accountsLogin
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KEURMO75.js";
|
|
11
11
|
import {
|
|
12
12
|
openAccounts
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JBX6J74G.js";
|
|
14
14
|
import {
|
|
15
15
|
PromptCancelledError
|
|
16
16
|
} from "./chunk-IC3TDONV.js";
|
|
17
17
|
import {
|
|
18
18
|
brandBanner
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3BTE76UD.js";
|
|
20
20
|
import "./chunk-SF5ZEAP4.js";
|
|
21
21
|
import {
|
|
22
22
|
readPreferences,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
findGateway,
|
|
29
29
|
startRuntime,
|
|
30
30
|
which
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-FKGZERYB.js";
|
|
32
32
|
import {
|
|
33
33
|
CliError,
|
|
34
34
|
EXIT
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
VERSION,
|
|
40
40
|
loadConfig,
|
|
41
41
|
writeGlobalRouting
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-NBQIMB43.js";
|
|
43
43
|
import {
|
|
44
44
|
createTheme
|
|
45
45
|
} from "./chunk-MC7RIPL7.js";
|
|
@@ -329,7 +329,7 @@ async function runChat(ctx, opts, projectRoot) {
|
|
|
329
329
|
const [{ render }, { createElement }, { ChatApp }] = await Promise.all([
|
|
330
330
|
import("ink"),
|
|
331
331
|
import("react"),
|
|
332
|
-
import("./ChatApp-
|
|
332
|
+
import("./ChatApp-C23NVTME.js")
|
|
333
333
|
]);
|
|
334
334
|
const instance = render(
|
|
335
335
|
createElement(ChatApp, {
|
|
@@ -357,4 +357,4 @@ async function runChat(ctx, opts, projectRoot) {
|
|
|
357
357
|
export {
|
|
358
358
|
chatCommand
|
|
359
359
|
};
|
|
360
|
-
//# sourceMappingURL=chat-
|
|
360
|
+
//# sourceMappingURL=chat-3K2KXS3E.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
brandLogo
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NBQIMB43.js";
|
|
4
4
|
|
|
5
5
|
// src/ui/banner.ts
|
|
6
6
|
function brandBanner(theme, text, columns = 80, minColumns = 56) {
|
|
@@ -17,4 +17,4 @@ function brandBanner(theme, text, columns = 80, minColumns = 56) {
|
|
|
17
17
|
export {
|
|
18
18
|
brandBanner
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-3BTE76UD.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
AccountStore,
|
|
11
11
|
accountService,
|
|
12
12
|
startAccountLogin
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NBQIMB43.js";
|
|
14
14
|
|
|
15
15
|
// src/commands/account.ts
|
|
16
16
|
function serviceFor(ctx, deps) {
|
|
@@ -125,4 +125,4 @@ export {
|
|
|
125
125
|
accountCommand,
|
|
126
126
|
chatAccountActions
|
|
127
127
|
};
|
|
128
|
-
//# sourceMappingURL=chunk-
|
|
128
|
+
//# sourceMappingURL=chunk-4FE2YV5U.js.map
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
openBrowser
|
|
3
3
|
} from "./chunk-732GIHRQ.js";
|
|
4
4
|
import {
|
|
5
|
+
ChangesError,
|
|
5
6
|
ConfigError,
|
|
6
7
|
OrchestratorError,
|
|
7
8
|
PROVIDER_KINDS,
|
|
@@ -16,21 +17,28 @@ import {
|
|
|
16
17
|
apiConfigIssues,
|
|
17
18
|
connectionMethod,
|
|
18
19
|
createAccountControl,
|
|
20
|
+
createChangesService,
|
|
19
21
|
createCliAgentRunner,
|
|
20
22
|
createEngine,
|
|
21
23
|
createGitWorkspace,
|
|
22
24
|
createGoalService,
|
|
23
25
|
createOrchestratorService,
|
|
24
26
|
createRunner,
|
|
27
|
+
createWorkspaceSchema,
|
|
25
28
|
endpointRebindIssue,
|
|
26
29
|
loginCommandFor,
|
|
27
30
|
loginFromEnv,
|
|
28
31
|
mergeApiConfig,
|
|
32
|
+
mergeSchema,
|
|
29
33
|
newId2,
|
|
34
|
+
removeSchema,
|
|
30
35
|
routeSchema,
|
|
36
|
+
shipSchema,
|
|
31
37
|
startRunSchema,
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
suggestSchema,
|
|
39
|
+
taskIdSchema,
|
|
40
|
+
workspaceIdSchema
|
|
41
|
+
} from "./chunk-NBQIMB43.js";
|
|
34
42
|
|
|
35
43
|
// src/runtime.ts
|
|
36
44
|
import { createHash } from "crypto";
|
|
@@ -54,8 +62,9 @@ import { z as z3 } from "zod";
|
|
|
54
62
|
import { z as z4 } from "zod";
|
|
55
63
|
import { z as z6 } from "zod";
|
|
56
64
|
import { z as z7 } from "zod";
|
|
57
|
-
import { Readable } from "stream";
|
|
58
65
|
import { z as z8 } from "zod";
|
|
66
|
+
import { Readable } from "stream";
|
|
67
|
+
import { z as z9 } from "zod";
|
|
59
68
|
function sendApiError(reply, status, code, message, extra = {}) {
|
|
60
69
|
return reply.code(status).send({ error: { message, code, ...extra } });
|
|
61
70
|
}
|
|
@@ -803,6 +812,131 @@ function registerAuthRoutes(app, login) {
|
|
|
803
812
|
});
|
|
804
813
|
}
|
|
805
814
|
}
|
|
815
|
+
var STATUS = {
|
|
816
|
+
not_found: 404,
|
|
817
|
+
not_a_repository: 409,
|
|
818
|
+
invalid: 400,
|
|
819
|
+
limit: 409,
|
|
820
|
+
nothing_to_commit: 409,
|
|
821
|
+
dirty: 409,
|
|
822
|
+
conflict: 409,
|
|
823
|
+
unavailable: 409
|
|
824
|
+
};
|
|
825
|
+
function changesError(error) {
|
|
826
|
+
if (error instanceof ChangesError) return error;
|
|
827
|
+
if (!(error instanceof Error) || error.name !== "ChangesError") return void 0;
|
|
828
|
+
const { code } = error;
|
|
829
|
+
return typeof code === "string" && Object.hasOwn(STATUS, code) ? error : void 0;
|
|
830
|
+
}
|
|
831
|
+
function registerChangesRoutes(app, engine, changes) {
|
|
832
|
+
if (!changes) return;
|
|
833
|
+
const { audit } = engine;
|
|
834
|
+
const guarded = async (reply, work) => {
|
|
835
|
+
try {
|
|
836
|
+
return { ok: true, value: await work() };
|
|
837
|
+
} catch (error) {
|
|
838
|
+
const known = changesError(error);
|
|
839
|
+
if (!known) throw error;
|
|
840
|
+
return {
|
|
841
|
+
ok: false,
|
|
842
|
+
reply: sendApiError(reply, STATUS[known.code], known.code, known.message)
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
const body = (schema, raw, reply) => {
|
|
847
|
+
const parsed = schema.safeParse(raw ?? {});
|
|
848
|
+
if (parsed.success) return parsed.data;
|
|
849
|
+
sendApiError(reply, 400, "invalid_body", z7.prettifyError(parsed.error));
|
|
850
|
+
return void 0;
|
|
851
|
+
};
|
|
852
|
+
const workspaceId = (id, reply) => {
|
|
853
|
+
if (workspaceIdSchema.safeParse(id).success) return id;
|
|
854
|
+
sendApiError(reply, 404, "not_found", `unknown workspace "${id.slice(0, 40)}"`);
|
|
855
|
+
return void 0;
|
|
856
|
+
};
|
|
857
|
+
app.get("/api/changes/workspaces", async (_request, reply) => {
|
|
858
|
+
reply.header("Cache-Control", "no-store");
|
|
859
|
+
const result = await guarded(reply, () => changes.list());
|
|
860
|
+
return result.ok ? { workspaces: result.value } : result.reply;
|
|
861
|
+
});
|
|
862
|
+
app.post("/api/changes/workspaces", async (request, reply) => {
|
|
863
|
+
const input = body(createWorkspaceSchema, request.body, reply);
|
|
864
|
+
if (!input) return reply;
|
|
865
|
+
const result = await guarded(reply, () => changes.create(input));
|
|
866
|
+
if (!result.ok) return result.reply;
|
|
867
|
+
audit.record({ actor: "api", action: "changes.create", target: result.value.id });
|
|
868
|
+
return reply.code(201).send(result.value);
|
|
869
|
+
});
|
|
870
|
+
app.get("/api/changes/workspaces/:id", async (request, reply) => {
|
|
871
|
+
reply.header("Cache-Control", "no-store");
|
|
872
|
+
const id = workspaceId(request.params.id, reply);
|
|
873
|
+
if (!id) return reply;
|
|
874
|
+
const result = await guarded(reply, () => changes.get(id));
|
|
875
|
+
return result.ok ? result.value : result.reply;
|
|
876
|
+
});
|
|
877
|
+
app.get(
|
|
878
|
+
"/api/changes/workspaces/:id/diff",
|
|
879
|
+
async (request, reply) => {
|
|
880
|
+
reply.header("Cache-Control", "no-store");
|
|
881
|
+
const id = workspaceId(request.params.id, reply);
|
|
882
|
+
if (!id) return reply;
|
|
883
|
+
const file = request.query.path;
|
|
884
|
+
if (file !== void 0 && (typeof file !== "string" || file.length === 0 || file.length > 4096)) {
|
|
885
|
+
return sendApiError(reply, 400, "invalid_query", "`path` must be a file path");
|
|
886
|
+
}
|
|
887
|
+
const result = await guarded(reply, () => changes.diff(id, file));
|
|
888
|
+
return result.ok ? result.value : result.reply;
|
|
889
|
+
}
|
|
890
|
+
);
|
|
891
|
+
app.post("/api/changes/workspaces/:id/suggest", async (request, reply) => {
|
|
892
|
+
const id = workspaceId(request.params.id, reply);
|
|
893
|
+
if (!id) return reply;
|
|
894
|
+
const input = body(suggestSchema, request.body, reply);
|
|
895
|
+
if (!input) return reply;
|
|
896
|
+
const result = await guarded(reply, () => changes.suggest(id, input));
|
|
897
|
+
return result.ok ? result.value : result.reply;
|
|
898
|
+
});
|
|
899
|
+
app.post("/api/changes/workspaces/:id/ship", async (request, reply) => {
|
|
900
|
+
const id = workspaceId(request.params.id, reply);
|
|
901
|
+
if (!id) return reply;
|
|
902
|
+
const input = body(shipSchema, request.body, reply);
|
|
903
|
+
if (!input) return reply;
|
|
904
|
+
const result = await guarded(reply, () => changes.ship(id, input));
|
|
905
|
+
if (!result.ok) return result.reply;
|
|
906
|
+
audit.record({
|
|
907
|
+
actor: "api",
|
|
908
|
+
action: "changes.ship",
|
|
909
|
+
target: id,
|
|
910
|
+
details: {
|
|
911
|
+
ok: result.value.ok,
|
|
912
|
+
steps: result.value.steps.map((s) => `${s.phase}:${s.ok ? "ok" : "failed"}`)
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
return result.value;
|
|
916
|
+
});
|
|
917
|
+
app.post("/api/changes/workspaces/:id/merge", async (request, reply) => {
|
|
918
|
+
const id = workspaceId(request.params.id, reply);
|
|
919
|
+
if (!id) return reply;
|
|
920
|
+
const input = body(mergeSchema, request.body, reply);
|
|
921
|
+
if (!input) return reply;
|
|
922
|
+
const result = await guarded(reply, () => changes.merge(id, input));
|
|
923
|
+
if (!result.ok) return result.reply;
|
|
924
|
+
audit.record({ actor: "api", action: "changes.merge", target: id });
|
|
925
|
+
return result.value;
|
|
926
|
+
});
|
|
927
|
+
app.delete(
|
|
928
|
+
"/api/changes/workspaces/:id",
|
|
929
|
+
async (request, reply) => {
|
|
930
|
+
const id = workspaceId(request.params.id, reply);
|
|
931
|
+
if (!id) return reply;
|
|
932
|
+
const input = removeSchema.parse({ deleteBranch: request.query.deleteBranch === "true" });
|
|
933
|
+
const result = await guarded(reply, () => changes.remove(id, input));
|
|
934
|
+
if (!result.ok) return result.reply;
|
|
935
|
+
audit.record({ actor: "api", action: "changes.remove", target: id, details: input });
|
|
936
|
+
return reply.code(204).send();
|
|
937
|
+
}
|
|
938
|
+
);
|
|
939
|
+
}
|
|
806
940
|
function frame(event, seq) {
|
|
807
941
|
return `id: ${seq}
|
|
808
942
|
event: ${event.type}
|
|
@@ -857,7 +991,7 @@ function registerEventRoutes(app, engine, heartbeatMs) {
|
|
|
857
991
|
res.on("error", cleanup);
|
|
858
992
|
});
|
|
859
993
|
}
|
|
860
|
-
var
|
|
994
|
+
var STATUS2 = {
|
|
861
995
|
not_found: 404,
|
|
862
996
|
no_agents: 409,
|
|
863
997
|
not_a_repository: 409,
|
|
@@ -868,7 +1002,7 @@ function orchestratorError(error) {
|
|
|
868
1002
|
if (error instanceof OrchestratorError) return error;
|
|
869
1003
|
if (!(error instanceof Error) || error.name !== "OrchestratorError") return void 0;
|
|
870
1004
|
const { code } = error;
|
|
871
|
-
return typeof code === "string" && Object.hasOwn(
|
|
1005
|
+
return typeof code === "string" && Object.hasOwn(STATUS2, code) ? error : void 0;
|
|
872
1006
|
}
|
|
873
1007
|
function registerOrchestratorRoutes(app, engine, orchestrator) {
|
|
874
1008
|
if (!orchestrator) return;
|
|
@@ -881,7 +1015,7 @@ function registerOrchestratorRoutes(app, engine, orchestrator) {
|
|
|
881
1015
|
if (!known) throw error;
|
|
882
1016
|
return {
|
|
883
1017
|
ok: false,
|
|
884
|
-
reply: sendApiError(reply,
|
|
1018
|
+
reply: sendApiError(reply, STATUS2[known.code], known.code, known.message)
|
|
885
1019
|
};
|
|
886
1020
|
}
|
|
887
1021
|
};
|
|
@@ -897,7 +1031,7 @@ function registerOrchestratorRoutes(app, engine, orchestrator) {
|
|
|
897
1031
|
app.post("/api/orchestrator/runs", async (request, reply) => {
|
|
898
1032
|
const parsed = startRunSchema.safeParse(request.body);
|
|
899
1033
|
if (!parsed.success) {
|
|
900
|
-
return sendApiError(reply, 400, "invalid_body",
|
|
1034
|
+
return sendApiError(reply, 400, "invalid_body", z8.prettifyError(parsed.error));
|
|
901
1035
|
}
|
|
902
1036
|
const result = await guarded(reply, () => orchestrator.start(parsed.data));
|
|
903
1037
|
if (!result.ok) return result.reply;
|
|
@@ -968,7 +1102,7 @@ function registerV1Routes(app, engine) {
|
|
|
968
1102
|
const parsed = chatRequestSchema.safeParse(request.body);
|
|
969
1103
|
if (!parsed.success) {
|
|
970
1104
|
return sendOpenAIError(reply, 400, {
|
|
971
|
-
message:
|
|
1105
|
+
message: z9.prettifyError(parsed.error),
|
|
972
1106
|
type: "invalid_request_error",
|
|
973
1107
|
code: "invalid_body"
|
|
974
1108
|
});
|
|
@@ -1217,6 +1351,7 @@ async function buildGateway(engine, options = {}) {
|
|
|
1217
1351
|
registerAuthRoutes(app, login);
|
|
1218
1352
|
registerAccountRoutes(app, options.account);
|
|
1219
1353
|
registerOrchestratorRoutes(app, engine, options.orchestrator);
|
|
1354
|
+
registerChangesRoutes(app, engine, options.changes);
|
|
1220
1355
|
registerApiRoutes(app, engine, options);
|
|
1221
1356
|
registerEventRoutes(app, engine, options.heartbeatMs ?? 15e3);
|
|
1222
1357
|
return app;
|
|
@@ -1774,6 +1909,7 @@ async function startRuntime(options) {
|
|
|
1774
1909
|
});
|
|
1775
1910
|
let account;
|
|
1776
1911
|
let orchestrator;
|
|
1912
|
+
let changes;
|
|
1777
1913
|
try {
|
|
1778
1914
|
const project = projectRoot ? wireProject(engine, projectRoot, { env: options.env }) : void 0;
|
|
1779
1915
|
const wantDashboard = options.dashboard !== false && engine.config.server.dashboard;
|
|
@@ -1805,10 +1941,21 @@ async function startRuntime(options) {
|
|
|
1805
1941
|
options.onWarning?.(message);
|
|
1806
1942
|
}
|
|
1807
1943
|
}
|
|
1944
|
+
if (options.changes !== void 0) {
|
|
1945
|
+
changes = options.changes || void 0;
|
|
1946
|
+
} else if (projectRoot && LOOPBACK_HOSTS.has(bindHost)) {
|
|
1947
|
+
changes = createChangesService({
|
|
1948
|
+
projectDir: projectRoot,
|
|
1949
|
+
home: options.home,
|
|
1950
|
+
env: options.env,
|
|
1951
|
+
writer: createCliAgentRunner({ env: options.env })
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1808
1954
|
const app = await startGateway(engine, {
|
|
1809
1955
|
logger: options.logger ?? false,
|
|
1810
1956
|
...account ? { account } : {},
|
|
1811
1957
|
...orchestrator ? { orchestrator } : {},
|
|
1958
|
+
...changes ? { changes } : {},
|
|
1812
1959
|
...options.loginLauncher ?? loginLauncher ? { loginLauncher: options.loginLauncher ?? loginLauncher } : {},
|
|
1813
1960
|
...dashboardDir ? { dashboardDir } : {},
|
|
1814
1961
|
...project ? { brain: project.source, runner: project.runner, goals: project.goals } : {},
|
|
@@ -1828,6 +1975,7 @@ async function startRuntime(options) {
|
|
|
1828
1975
|
runner,
|
|
1829
1976
|
goals,
|
|
1830
1977
|
orchestrator,
|
|
1978
|
+
changes,
|
|
1831
1979
|
url: `http://${connectHost(host)}:${port}`,
|
|
1832
1980
|
host,
|
|
1833
1981
|
port,
|
|
@@ -1874,4 +2022,4 @@ export {
|
|
|
1874
2022
|
resolveProjectRoot,
|
|
1875
2023
|
startRuntime
|
|
1876
2024
|
};
|
|
1877
|
-
//# sourceMappingURL=chunk-
|
|
2025
|
+
//# sourceMappingURL=chunk-FKGZERYB.js.map
|