@garuda-agent/garuda 0.16.0 → 0.17.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/CHANGELOG.md +188 -0
- package/README.md +56 -1074
- package/SECURITY.md +9 -2
- package/dist/{acpCommand-AJJBKAE5.js → acpCommand-7EY3NHPG.js} +18 -16
- package/dist/{anthropic-NQDBCHJU.js → anthropic-NQIZLD64.js} +12 -6
- package/dist/{chunk-WIJL72ZE.js → chunk-2DYMJMRQ.js} +1880 -982
- package/dist/{chunk-YQTGMCU6.js → chunk-3MRQJKUO.js} +29 -5
- package/dist/{chunk-WMOLXTBU.js → chunk-4LFJFDCF.js} +2 -1
- package/dist/{chunk-44QN5SWZ.js → chunk-55CFEEIN.js} +22 -2
- package/dist/{chunk-USCUXCAU.js → chunk-5B5HDTUR.js} +3 -3
- package/dist/{chunk-TUUEBHG2.js → chunk-6XHON3Q6.js} +2 -2
- package/dist/chunk-735BKABA.js +472 -0
- package/dist/{chunk-B6FA4I7Q.js → chunk-7TH3NHCQ.js} +2 -2
- package/dist/{chunk-OUCV3FCT.js → chunk-AOGFYUKG.js} +3 -3
- package/dist/{chunk-GXZACJUI.js → chunk-B4SJY7KT.js} +322 -39
- package/dist/{chunk-3EQU2GUX.js → chunk-BHZ6G65V.js} +5 -1
- package/dist/chunk-BSK5T2ZG.js +9 -0
- package/dist/chunk-J4346IDH.js +156 -0
- package/dist/{chunk-NP6RIC25.js → chunk-JRVWH27M.js} +7 -7
- package/dist/{chunk-HUIK3WXO.js → chunk-P6XWWIEK.js} +20 -3
- package/dist/{chunk-HE2K657U.js → chunk-TJIWD7R7.js} +47 -16
- package/dist/chunk-U65DQZDB.js +143 -0
- package/dist/chunk-UIRJOQQS.js +118 -0
- package/dist/{chunk-KKB5W47S.js → chunk-VTMD5IHD.js} +26 -2
- package/dist/{chunk-ENLDPN4S.js → chunk-Z66BWTMD.js} +81 -32
- package/dist/cli/index.js +99 -41
- package/dist/{create-VXIH2GUZ.js → create-W6BV75QX.js} +18 -12
- package/dist/{deadline-F5RJJ2QW.js → deadline-TP7ZGLT2.js} +4 -2
- package/dist/{evalCommand-OX2LQYEK.js → evalCommand-YVQAWUZE.js} +50 -29
- package/dist/{export-HN3CT7AV.js → export-SJ3DUP6W.js} +2 -2
- package/dist/{inkChat-YMMMGU7Y.js → inkChat-FNUBK43U.js} +14 -13
- package/dist/install-TKWN5AYH.js +19 -0
- package/dist/{job-3NYDMP2M.js → job-7JOI4YIQ.js} +6 -2
- package/dist/jobCommand-FE6XN3YD.js +33 -0
- package/dist/{launchd-SSX362VG.js → launchd-3A3ONEW5.js} +9 -8
- package/dist/{lspCommand-JRXKRSL7.js → lspCommand-ZZ6R4PA2.js} +7 -6
- package/dist/{manager-AWU4NHHK.js → manager-73MPYFTP.js} +7 -6
- package/dist/{nightCommand-65MUEV32.js → nightCommand-OODJNWDT.js} +26 -20
- package/dist/{openaiCompatible-CJWVJP5M.js → openaiCompatible-6TLDDW5U.js} +29 -15
- package/dist/{policy-EJPLEEXP.js → policy-ZJ7RMOFN.js} +10 -4
- package/dist/{remove-6GDSTAIO.js → remove-42WQNVPX.js} +8 -7
- package/dist/{server-KHHNHUYV.js → server-VEYIJHEU.js} +7 -3
- package/dist/{setupCommand-VA7D5MZK.js → setupCommand-GBQIVYJC.js} +45 -13
- package/dist/text-LS35WSRL.js +17 -0
- package/native/bin/garuda-reap +0 -0
- package/native/garuda-reap.c +113 -0
- package/package.json +39 -13
- package/dist/chunk-EIXUSVFX.js +0 -116
- package/dist/chunk-R7I2NBPX.js +0 -71
- package/dist/chunk-ULAJPMY7.js +0 -107
- package/dist/chunk-XOK5OZOC.js +0 -9
- package/dist/install-EWDSPFFZ.js +0 -18
- package/dist/jobCommand-ACSGSBQ4.js +0 -32
- package/dist/text-J2GD647J.js +0 -11
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
fuzzyFiles,
|
|
7
7
|
runChat,
|
|
8
8
|
statusOf
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Z66BWTMD.js";
|
|
10
10
|
import {
|
|
11
11
|
retryText,
|
|
12
12
|
serverToolOutput,
|
|
@@ -19,26 +19,27 @@ import {
|
|
|
19
19
|
colorPreview,
|
|
20
20
|
header
|
|
21
21
|
} from "./chunk-4JSUUDFQ.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-2DYMJMRQ.js";
|
|
23
23
|
import "./chunk-G2AX7MGS.js";
|
|
24
24
|
import "./chunk-A2QAIRQL.js";
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-735BKABA.js";
|
|
26
|
+
import "./chunk-U65DQZDB.js";
|
|
27
|
+
import "./chunk-J4346IDH.js";
|
|
28
28
|
import "./chunk-B25VL4RU.js";
|
|
29
29
|
import "./chunk-23FXBNBB.js";
|
|
30
30
|
import "./chunk-EU7PA45O.js";
|
|
31
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-BSK5T2ZG.js";
|
|
32
32
|
import "./chunk-5DEWP3YX.js";
|
|
33
33
|
import "./chunk-ZAE25JM2.js";
|
|
34
34
|
import "./chunk-ATW7BNIG.js";
|
|
35
35
|
import "./chunk-PZS3V6P3.js";
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-AOGFYUKG.js";
|
|
37
|
+
import "./chunk-B4SJY7KT.js";
|
|
38
|
+
import "./chunk-BHZ6G65V.js";
|
|
39
|
+
import "./chunk-P6XWWIEK.js";
|
|
40
|
+
import "./chunk-VTMD5IHD.js";
|
|
41
|
+
import "./chunk-UIRJOQQS.js";
|
|
42
|
+
import "./chunk-4LFJFDCF.js";
|
|
42
43
|
import "./chunk-3NJNVZTK.js";
|
|
43
44
|
|
|
44
45
|
// src/cli/chat/inkChat.ts
|
|
@@ -1193,4 +1194,4 @@ async function runInkChat(runtime, approver, setEventTarget, banner, sessionPath
|
|
|
1193
1194
|
export {
|
|
1194
1195
|
runInkChat
|
|
1195
1196
|
};
|
|
1196
|
-
//# sourceMappingURL=inkChat-
|
|
1197
|
+
//# sourceMappingURL=inkChat-FNUBK43U.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
INSTALL_TIMEOUT_MS,
|
|
4
|
+
installCommand,
|
|
5
|
+
installServer
|
|
6
|
+
} from "./chunk-7TH3NHCQ.js";
|
|
7
|
+
import "./chunk-EU7PA45O.js";
|
|
8
|
+
import "./chunk-B4SJY7KT.js";
|
|
9
|
+
import "./chunk-BHZ6G65V.js";
|
|
10
|
+
import "./chunk-P6XWWIEK.js";
|
|
11
|
+
import "./chunk-UIRJOQQS.js";
|
|
12
|
+
import "./chunk-4LFJFDCF.js";
|
|
13
|
+
import "./chunk-3NJNVZTK.js";
|
|
14
|
+
export {
|
|
15
|
+
INSTALL_TIMEOUT_MS,
|
|
16
|
+
installCommand,
|
|
17
|
+
installServer
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=install-TKWN5AYH.js.map
|
|
@@ -8,11 +8,14 @@ import {
|
|
|
8
8
|
listJobs,
|
|
9
9
|
loadJob,
|
|
10
10
|
newJobId,
|
|
11
|
+
parseJob,
|
|
11
12
|
planPermissions,
|
|
12
13
|
planTitle,
|
|
13
14
|
saveJob,
|
|
14
15
|
settleJob
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VTMD5IHD.js";
|
|
17
|
+
import "./chunk-UIRJOQQS.js";
|
|
18
|
+
import "./chunk-4LFJFDCF.js";
|
|
16
19
|
import "./chunk-3NJNVZTK.js";
|
|
17
20
|
export {
|
|
18
21
|
DEFAULT_JOB_MAX_STEPS,
|
|
@@ -23,9 +26,10 @@ export {
|
|
|
23
26
|
listJobs,
|
|
24
27
|
loadJob,
|
|
25
28
|
newJobId,
|
|
29
|
+
parseJob,
|
|
26
30
|
planPermissions,
|
|
27
31
|
planTitle,
|
|
28
32
|
saveJob,
|
|
29
33
|
settleJob
|
|
30
34
|
};
|
|
31
|
-
//# sourceMappingURL=job-
|
|
35
|
+
//# sourceMappingURL=job-7JOI4YIQ.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
JOB_TEST_TIMEOUT_MS,
|
|
4
|
+
finishJob,
|
|
5
|
+
msUntil,
|
|
6
|
+
prepareJob,
|
|
7
|
+
testsBefore
|
|
8
|
+
} from "./chunk-TJIWD7R7.js";
|
|
9
|
+
import "./chunk-N4I6YS3E.js";
|
|
10
|
+
import "./chunk-735BKABA.js";
|
|
11
|
+
import "./chunk-J4346IDH.js";
|
|
12
|
+
import "./chunk-5DEWP3YX.js";
|
|
13
|
+
import "./chunk-PZS3V6P3.js";
|
|
14
|
+
import "./chunk-55CFEEIN.js";
|
|
15
|
+
import "./chunk-5B5HDTUR.js";
|
|
16
|
+
import "./chunk-3MRQJKUO.js";
|
|
17
|
+
import "./chunk-AOGFYUKG.js";
|
|
18
|
+
import "./chunk-6XHON3Q6.js";
|
|
19
|
+
import "./chunk-B4SJY7KT.js";
|
|
20
|
+
import "./chunk-BHZ6G65V.js";
|
|
21
|
+
import "./chunk-P6XWWIEK.js";
|
|
22
|
+
import "./chunk-VTMD5IHD.js";
|
|
23
|
+
import "./chunk-UIRJOQQS.js";
|
|
24
|
+
import "./chunk-4LFJFDCF.js";
|
|
25
|
+
import "./chunk-3NJNVZTK.js";
|
|
26
|
+
export {
|
|
27
|
+
JOB_TEST_TIMEOUT_MS,
|
|
28
|
+
finishJob,
|
|
29
|
+
msUntil,
|
|
30
|
+
prepareJob,
|
|
31
|
+
testsBefore
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=jobCommand-FE6XN3YD.js.map
|
|
@@ -14,13 +14,14 @@ import {
|
|
|
14
14
|
removeSpec,
|
|
15
15
|
specPath,
|
|
16
16
|
specPlist
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-5B5HDTUR.js";
|
|
18
|
+
import "./chunk-6XHON3Q6.js";
|
|
19
|
+
import "./chunk-B4SJY7KT.js";
|
|
20
|
+
import "./chunk-BHZ6G65V.js";
|
|
21
|
+
import "./chunk-P6XWWIEK.js";
|
|
22
|
+
import "./chunk-VTMD5IHD.js";
|
|
23
|
+
import "./chunk-UIRJOQQS.js";
|
|
24
|
+
import "./chunk-4LFJFDCF.js";
|
|
24
25
|
import "./chunk-3NJNVZTK.js";
|
|
25
26
|
export {
|
|
26
27
|
agentLabel,
|
|
@@ -38,4 +39,4 @@ export {
|
|
|
38
39
|
specPath,
|
|
39
40
|
specPlist
|
|
40
41
|
};
|
|
41
|
-
//# sourceMappingURL=launchd-
|
|
42
|
+
//# sourceMappingURL=launchd-3A3ONEW5.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-36GQIVGT.js";
|
|
6
6
|
import {
|
|
7
7
|
installServer
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7TH3NHCQ.js";
|
|
9
9
|
import {
|
|
10
10
|
LSP_CONFIG_FILE,
|
|
11
11
|
loadLspConfig
|
|
@@ -18,10 +18,11 @@ import {
|
|
|
18
18
|
HostExecutor,
|
|
19
19
|
createExecutor,
|
|
20
20
|
loadSettings
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-B4SJY7KT.js";
|
|
22
|
+
import "./chunk-BHZ6G65V.js";
|
|
23
|
+
import "./chunk-P6XWWIEK.js";
|
|
24
|
+
import "./chunk-UIRJOQQS.js";
|
|
25
|
+
import "./chunk-4LFJFDCF.js";
|
|
25
26
|
import "./chunk-3NJNVZTK.js";
|
|
26
27
|
|
|
27
28
|
// src/cli/lspCommand.ts
|
|
@@ -97,4 +98,4 @@ export {
|
|
|
97
98
|
lspInstallCommand,
|
|
98
99
|
lspStatusCommand
|
|
99
100
|
};
|
|
100
|
-
//# sourceMappingURL=lspCommand-
|
|
101
|
+
//# sourceMappingURL=lspCommand-ZZ6R4PA2.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-4P26OKTP.js";
|
|
12
12
|
import {
|
|
13
13
|
VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-BSK5T2ZG.js";
|
|
15
15
|
import {
|
|
16
16
|
USER_SCOPE
|
|
17
17
|
} from "./chunk-5DEWP3YX.js";
|
|
@@ -34,10 +34,11 @@ import {
|
|
|
34
34
|
import {
|
|
35
35
|
DEFAULT_ENV_ALLOWLIST,
|
|
36
36
|
sandboxPaths
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-B4SJY7KT.js";
|
|
38
|
+
import "./chunk-BHZ6G65V.js";
|
|
39
|
+
import "./chunk-P6XWWIEK.js";
|
|
40
|
+
import "./chunk-UIRJOQQS.js";
|
|
41
|
+
import "./chunk-4LFJFDCF.js";
|
|
41
42
|
import "./chunk-3NJNVZTK.js";
|
|
42
43
|
|
|
43
44
|
// src/mcp/manager.ts
|
|
@@ -845,4 +846,4 @@ export {
|
|
|
845
846
|
changeLines,
|
|
846
847
|
warnings
|
|
847
848
|
};
|
|
848
|
-
//# sourceMappingURL=manager-
|
|
849
|
+
//# sourceMappingURL=manager-73MPYFTP.js.map
|
|
@@ -1,41 +1,46 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
msUntil
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TJIWD7R7.js";
|
|
5
5
|
import {
|
|
6
6
|
notificationBytes,
|
|
7
7
|
pickChannel
|
|
8
8
|
} from "./chunk-N4I6YS3E.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-735BKABA.js";
|
|
10
|
+
import "./chunk-J4346IDH.js";
|
|
11
11
|
import "./chunk-5DEWP3YX.js";
|
|
12
12
|
import "./chunk-PZS3V6P3.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-55CFEEIN.js";
|
|
14
14
|
import {
|
|
15
15
|
defaultAgentEnv,
|
|
16
16
|
nightSpec,
|
|
17
17
|
removeSpec
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import
|
|
18
|
+
} from "./chunk-5B5HDTUR.js";
|
|
19
|
+
import {
|
|
20
|
+
formatCost,
|
|
21
|
+
jobCost,
|
|
22
|
+
sumCosts
|
|
23
|
+
} from "./chunk-3MRQJKUO.js";
|
|
20
24
|
import {
|
|
21
25
|
testSummary
|
|
22
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-AOGFYUKG.js";
|
|
23
27
|
import {
|
|
24
28
|
hostCommand,
|
|
25
29
|
shellWord
|
|
26
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-6XHON3Q6.js";
|
|
27
31
|
import {
|
|
28
32
|
createExecutor
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-HUIK3WXO.js";
|
|
33
|
+
} from "./chunk-B4SJY7KT.js";
|
|
34
|
+
import "./chunk-BHZ6G65V.js";
|
|
35
|
+
import "./chunk-P6XWWIEK.js";
|
|
33
36
|
import {
|
|
34
37
|
JOBS_DIR,
|
|
35
38
|
listJobs,
|
|
36
39
|
loadJob,
|
|
37
40
|
settleJob
|
|
38
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-VTMD5IHD.js";
|
|
42
|
+
import "./chunk-UIRJOQQS.js";
|
|
43
|
+
import "./chunk-4LFJFDCF.js";
|
|
39
44
|
import "./chunk-3NJNVZTK.js";
|
|
40
45
|
|
|
41
46
|
// src/cli/nightCommand.ts
|
|
@@ -100,14 +105,15 @@ async function runQueue(jobs, run, parallel, report = {}) {
|
|
|
100
105
|
}
|
|
101
106
|
function nightDigest(jobs, started, ended) {
|
|
102
107
|
const ready = jobs.filter((j) => j.result?.proof?.verdict === "ready");
|
|
103
|
-
const cost =
|
|
104
|
-
|
|
105
|
-
|
|
108
|
+
const cost = sumCosts(
|
|
109
|
+
jobs.map(
|
|
110
|
+
(j) => j.result !== void 0 ? jobCost(j.result) : { usd: 0, incomplete: j.status !== "scheduled" }
|
|
111
|
+
)
|
|
106
112
|
);
|
|
107
113
|
const lines = [
|
|
108
114
|
`# Garuda night shift: ${local(started)}`,
|
|
109
115
|
"",
|
|
110
|
-
`${jobs.length} job(s): ${ready.length} ready to merge, ${jobs.length - ready.length} need a look. Time ${Math.round((ended.getTime() - started.getTime()) / 6e4)} min \xB7 cost
|
|
116
|
+
`${jobs.length} job(s): ${ready.length} ready to merge, ${jobs.length - ready.length} need a look. Time ${Math.round((ended.getTime() - started.getTime()) / 6e4)} min \xB7 cost ${formatCost(cost)}.`,
|
|
111
117
|
"",
|
|
112
118
|
"| Job | Verdict | Tests after | Files | Cost | Branch |",
|
|
113
119
|
"| --- | --- | --- | --- | --- | --- |"
|
|
@@ -115,9 +121,9 @@ function nightDigest(jobs, started, ended) {
|
|
|
115
121
|
for (const j of jobs) {
|
|
116
122
|
const r = j.result;
|
|
117
123
|
const verdict = r?.proof === void 0 ? j.status : r.proof.verdict === "ready" ? "ready to merge" : "needs a look";
|
|
118
|
-
const
|
|
124
|
+
const costText = r === void 0 ? "\u2013" : formatCost(jobCost(r));
|
|
119
125
|
lines.push(
|
|
120
|
-
`| ${j.id}: ${cell(j.title)} | ${verdict} | ${j.test === void 0 ? "no tests" : testSummary(r?.proof?.after)} | ${r?.files.length ?? 0} | ${
|
|
126
|
+
`| ${j.id}: ${cell(j.title)} | ${verdict} | ${j.test === void 0 ? "no tests" : testSummary(r?.proof?.after)} | ${r?.files.length ?? 0} | ${costText} | ${j.branch} |`
|
|
121
127
|
);
|
|
122
128
|
}
|
|
123
129
|
const looks = jobs.filter((j) => j.result?.proof?.verdict !== "ready");
|
|
@@ -246,4 +252,4 @@ Digest: ${file}`);
|
|
|
246
252
|
export {
|
|
247
253
|
nightCommand
|
|
248
254
|
};
|
|
249
|
-
//# sourceMappingURL=nightCommand-
|
|
255
|
+
//# sourceMappingURL=nightCommand-OODJNWDT.js.map
|
|
@@ -215,7 +215,11 @@ var OpenAICompatibleClient = class {
|
|
|
215
215
|
fetch;
|
|
216
216
|
delays;
|
|
217
217
|
async *stream(request, options) {
|
|
218
|
-
const http = await this.post(
|
|
218
|
+
const http = await this.post(
|
|
219
|
+
toWireBody(this.options.model, request),
|
|
220
|
+
options?.signal,
|
|
221
|
+
options?.meter
|
|
222
|
+
);
|
|
219
223
|
const mode = request.tools.length === 0 ? "off" : this.options.textToolCalls ?? "whole";
|
|
220
224
|
const state = newStreamState();
|
|
221
225
|
const hold = new StreamHold(mode);
|
|
@@ -241,7 +245,7 @@ var OpenAICompatibleClient = class {
|
|
|
241
245
|
}
|
|
242
246
|
yield { type: "response", response };
|
|
243
247
|
}
|
|
244
|
-
async post(body, signal) {
|
|
248
|
+
async post(body, signal, meter) {
|
|
245
249
|
const url = `${this.options.baseUrl.replace(/\/+$/, "")}/chat/completions`;
|
|
246
250
|
const headers = {
|
|
247
251
|
"content-type": "application/json",
|
|
@@ -262,6 +266,7 @@ var OpenAICompatibleClient = class {
|
|
|
262
266
|
const cause = causeCode(error);
|
|
263
267
|
if (attempt < this.delays.length && cause !== "ECONNREFUSED") {
|
|
264
268
|
await sleep(this.delays[attempt] ?? 1e3, signal);
|
|
269
|
+
meter?.retry();
|
|
265
270
|
continue;
|
|
266
271
|
}
|
|
267
272
|
throw new Error(
|
|
@@ -274,6 +279,7 @@ var OpenAICompatibleClient = class {
|
|
|
274
279
|
const retryAfter = Number(response.headers.get("retry-after")) * 1e3;
|
|
275
280
|
const wait = Number.isFinite(retryAfter) && retryAfter > 0 ? Math.min(retryAfter, MAX_RETRY_AFTER_MS) : this.delays[attempt] ?? 1e3;
|
|
276
281
|
await sleep(wait, signal);
|
|
282
|
+
meter?.retry();
|
|
277
283
|
continue;
|
|
278
284
|
}
|
|
279
285
|
throw new Error(
|
|
@@ -378,10 +384,12 @@ function finishResponse(state, request, mode = "whole") {
|
|
|
378
384
|
input: parseArguments(call.args)
|
|
379
385
|
});
|
|
380
386
|
}
|
|
387
|
+
const reported = providerUsage(state.usage);
|
|
381
388
|
return {
|
|
382
389
|
content,
|
|
383
390
|
stopReason: stopReason(state, content),
|
|
384
|
-
usage:
|
|
391
|
+
usage: reported ?? estimatedUsage(request, content),
|
|
392
|
+
...reported === void 0 ? { usageReported: false } : {}
|
|
385
393
|
};
|
|
386
394
|
}
|
|
387
395
|
function toolNames(request) {
|
|
@@ -403,17 +411,23 @@ function stopReason(state, content) {
|
|
|
403
411
|
return "end_turn";
|
|
404
412
|
return "other";
|
|
405
413
|
}
|
|
406
|
-
function
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
414
|
+
function providerUsage(u) {
|
|
415
|
+
const input = u?.prompt_tokens;
|
|
416
|
+
const output = u?.completion_tokens;
|
|
417
|
+
const cached = u?.prompt_tokens_details?.cached_tokens ?? 0;
|
|
418
|
+
if (!tokenCount(input) || !tokenCount(output) || !tokenCount(cached) || cached > input)
|
|
419
|
+
return void 0;
|
|
420
|
+
return {
|
|
421
|
+
inputTokens: input - cached,
|
|
422
|
+
outputTokens: output,
|
|
423
|
+
cacheReadTokens: cached,
|
|
424
|
+
cacheWriteTokens: 0
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
function tokenCount(value) {
|
|
428
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
429
|
+
}
|
|
430
|
+
function estimatedUsage(request, content) {
|
|
417
431
|
const chars = (value) => JSON.stringify(value).length;
|
|
418
432
|
return {
|
|
419
433
|
inputTokens: Math.ceil(
|
|
@@ -498,4 +512,4 @@ export {
|
|
|
498
512
|
toWireMessages,
|
|
499
513
|
toWireTools
|
|
500
514
|
};
|
|
501
|
-
//# sourceMappingURL=openaiCompatible-
|
|
515
|
+
//# sourceMappingURL=openaiCompatible-6TLDDW5U.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
POLICY_FILE,
|
|
4
|
+
PROFILES,
|
|
4
5
|
assertModelAllowedByPolicy,
|
|
5
6
|
ignoredProjectPolicy,
|
|
6
7
|
isCommandDisallowedByPolicy,
|
|
@@ -8,14 +9,17 @@ import {
|
|
|
8
9
|
isModelAllowedByPolicy,
|
|
9
10
|
isPathDeniedByPolicy,
|
|
10
11
|
isSandboxRequiredByPolicy,
|
|
12
|
+
isStrict,
|
|
11
13
|
loadTeamPolicy,
|
|
12
14
|
managedPolicyPath,
|
|
13
15
|
mergePolicies,
|
|
14
|
-
parsePolicy
|
|
15
|
-
|
|
16
|
+
parsePolicy,
|
|
17
|
+
withProfile
|
|
18
|
+
} from "./chunk-P6XWWIEK.js";
|
|
16
19
|
import "./chunk-3NJNVZTK.js";
|
|
17
20
|
export {
|
|
18
21
|
POLICY_FILE,
|
|
22
|
+
PROFILES,
|
|
19
23
|
assertModelAllowedByPolicy,
|
|
20
24
|
ignoredProjectPolicy,
|
|
21
25
|
isCommandDisallowedByPolicy,
|
|
@@ -23,9 +27,11 @@ export {
|
|
|
23
27
|
isModelAllowedByPolicy,
|
|
24
28
|
isPathDeniedByPolicy,
|
|
25
29
|
isSandboxRequiredByPolicy,
|
|
30
|
+
isStrict,
|
|
26
31
|
loadTeamPolicy,
|
|
27
32
|
managedPolicyPath,
|
|
28
33
|
mergePolicies,
|
|
29
|
-
parsePolicy
|
|
34
|
+
parsePolicy,
|
|
35
|
+
withProfile
|
|
30
36
|
};
|
|
31
|
-
//# sourceMappingURL=policy-
|
|
37
|
+
//# sourceMappingURL=policy-ZJ7RMOFN.js.map
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
git
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-HUIK3WXO.js";
|
|
4
|
+
} from "./chunk-6XHON3Q6.js";
|
|
5
|
+
import "./chunk-B4SJY7KT.js";
|
|
6
|
+
import "./chunk-BHZ6G65V.js";
|
|
7
|
+
import "./chunk-P6XWWIEK.js";
|
|
9
8
|
import {
|
|
10
9
|
JOBS_DIR,
|
|
11
10
|
jobPath
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-VTMD5IHD.js";
|
|
12
|
+
import "./chunk-UIRJOQQS.js";
|
|
13
|
+
import "./chunk-4LFJFDCF.js";
|
|
13
14
|
import "./chunk-3NJNVZTK.js";
|
|
14
15
|
|
|
15
16
|
// src/jobs/remove.ts
|
|
@@ -57,4 +58,4 @@ export {
|
|
|
57
58
|
jobLeftovers,
|
|
58
59
|
removeJob
|
|
59
60
|
};
|
|
60
|
-
//# sourceMappingURL=remove-
|
|
61
|
+
//# sourceMappingURL=remove-42WQNVPX.js.map
|
|
@@ -460,11 +460,14 @@ ${mark}`;
|
|
|
460
460
|
// src/acp/server.ts
|
|
461
461
|
var INTERNAL_ERROR = -32603;
|
|
462
462
|
var SETUP_METHOD_ID = "garuda-setup";
|
|
463
|
+
function canRunTerminalAuth(capabilities) {
|
|
464
|
+
return capabilities?.auth?.terminal === true || capabilities?._meta?.["terminal-auth"] === true;
|
|
465
|
+
}
|
|
463
466
|
function setupNeeded(message) {
|
|
464
467
|
return Object.assign(new Error(message), { authRequired: true });
|
|
465
468
|
}
|
|
466
469
|
var MODES = {
|
|
467
|
-
build: { name: "Build", description: "Edits
|
|
470
|
+
build: { name: "Build", description: "Edits ask first; commands run in the sandbox." },
|
|
468
471
|
plan: {
|
|
469
472
|
name: "Plan",
|
|
470
473
|
description: "Reads and plans. No edits; commands cannot write the project."
|
|
@@ -499,7 +502,7 @@ function acpServer(options) {
|
|
|
499
502
|
mcpCapabilities: { http: false, sse: false }
|
|
500
503
|
},
|
|
501
504
|
// Terminal Auth (0.16) only for an editor that can run it (the spec: never offer it else).
|
|
502
|
-
authMethods: options.terminalAuth !== void 0 && c.params.clientCapabilities
|
|
505
|
+
authMethods: options.terminalAuth !== void 0 && canRunTerminalAuth(c.params.clientCapabilities) ? [
|
|
503
506
|
{
|
|
504
507
|
type: "terminal",
|
|
505
508
|
id: SETUP_METHOD_ID,
|
|
@@ -689,6 +692,7 @@ function isFolder(path) {
|
|
|
689
692
|
export {
|
|
690
693
|
SETUP_METHOD_ID,
|
|
691
694
|
acpServer,
|
|
695
|
+
canRunTerminalAuth,
|
|
692
696
|
setupNeeded
|
|
693
697
|
};
|
|
694
|
-
//# sourceMappingURL=server-
|
|
698
|
+
//# sourceMappingURL=server-VEYIJHEU.js.map
|
|
@@ -11,13 +11,16 @@ import {
|
|
|
11
11
|
resolveModel,
|
|
12
12
|
setDefaultModel,
|
|
13
13
|
writeCredentials
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-EIXUSVFX.js";
|
|
14
|
+
} from "./chunk-JRVWH27M.js";
|
|
16
15
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
fetchCatalog,
|
|
17
|
+
loadCatalog,
|
|
18
|
+
mergedModels,
|
|
19
|
+
saveCatalog
|
|
20
|
+
} from "./chunk-U65DQZDB.js";
|
|
21
|
+
import "./chunk-J4346IDH.js";
|
|
19
22
|
import "./chunk-ATW7BNIG.js";
|
|
20
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-BHZ6G65V.js";
|
|
21
24
|
|
|
22
25
|
// src/cli/setupCommand.ts
|
|
23
26
|
import { homedir } from "os";
|
|
@@ -85,7 +88,9 @@ async function setup(io, config, home, env, fetcher) {
|
|
|
85
88
|
}))
|
|
86
89
|
);
|
|
87
90
|
const def = providers[provider];
|
|
88
|
-
const
|
|
91
|
+
const anthropicKey = def.type === "anthropic" ? def.apiKeyEnv ?? "ANTHROPIC_API_KEY" : void 0;
|
|
92
|
+
const knownKey = anthropicKey === void 0 ? void 0 : (env[anthropicKey] ?? "") !== "" ? env[anthropicKey] : stored.keys[anthropicKey];
|
|
93
|
+
const model = await pickModel(io, provider, def, fetcher, { home, env, key: knownKey });
|
|
89
94
|
const spec = provider === "anthropic" ? model : `${provider}/${model}`;
|
|
90
95
|
try {
|
|
91
96
|
resolveModel(spec, config);
|
|
@@ -111,7 +116,12 @@ async function setup(io, config, home, env, fetcher) {
|
|
|
111
116
|
const key = fromEnv !== "" ? fromEnv : newKey ?? old;
|
|
112
117
|
const result = await checkKey(provider, def, key, env, fetcher);
|
|
113
118
|
io.print(result.message);
|
|
114
|
-
if (result.ok)
|
|
119
|
+
if (result.ok) {
|
|
120
|
+
if (def.type === "anthropic" && knownKey === void 0) {
|
|
121
|
+
await refreshCatalog(io, { home, env, key }, fetcher);
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
115
125
|
const next = await io.select("What now?", [
|
|
116
126
|
...fromEnv === "" ? [{ name: "Enter the key again", value: "again" }] : [],
|
|
117
127
|
{ name: "Store it anyway", value: "store" },
|
|
@@ -146,15 +156,17 @@ async function setup(io, config, home, env, fetcher) {
|
|
|
146
156
|
io.print("Done. Start Garuda with: garuda");
|
|
147
157
|
return 0;
|
|
148
158
|
}
|
|
149
|
-
async function pickModel(io, provider, def, fetcher) {
|
|
159
|
+
async function pickModel(io, provider, def, fetcher, account) {
|
|
150
160
|
let listed = [];
|
|
151
161
|
const notes = /* @__PURE__ */ new Map();
|
|
152
162
|
if (def.type === "anthropic") {
|
|
153
|
-
|
|
163
|
+
let catalog = await loadCatalog(account.home);
|
|
164
|
+
if (account.key !== void 0) {
|
|
165
|
+
catalog = await refreshCatalog(io, account, fetcher) ?? catalog;
|
|
166
|
+
}
|
|
167
|
+
for (const { id, info, known } of mergedModels(catalog)) {
|
|
154
168
|
listed.push(id);
|
|
155
|
-
|
|
156
|
-
notes.set(id, `$${info.price.input} in, $${info.price.output} out per million tokens`);
|
|
157
|
-
}
|
|
169
|
+
notes.set(id, known && info.price !== void 0 ? priceNote(info.price) : UNKNOWN_PRICE);
|
|
158
170
|
}
|
|
159
171
|
} else if (def.local === true && def.baseUrl !== void 0) {
|
|
160
172
|
listed = await localModels(def.baseUrl, fetcher);
|
|
@@ -177,6 +189,26 @@ async function pickModel(io, provider, def, fetcher) {
|
|
|
177
189
|
io.print("Type a model name with no spaces.");
|
|
178
190
|
}
|
|
179
191
|
}
|
|
192
|
+
var UNKNOWN_PRICE = "price unknown to this Garuda version: costs show as unknown (set model.price, or update Garuda)";
|
|
193
|
+
function priceNote(price) {
|
|
194
|
+
const more = price.over === void 0 ? "" : ` (more for prompts over ${price.over.tokens / 1e3}k tokens)`;
|
|
195
|
+
return `$${price.input} in, $${price.output} out per million tokens${more}`;
|
|
196
|
+
}
|
|
197
|
+
async function refreshCatalog(io, account, fetcher) {
|
|
198
|
+
const base = account.env.ANTHROPIC_BASE_URL ?? "";
|
|
199
|
+
const result = await fetchCatalog({
|
|
200
|
+
key: account.key,
|
|
201
|
+
...base === "" ? {} : { baseUrl: base },
|
|
202
|
+
fetcher
|
|
203
|
+
});
|
|
204
|
+
if ("problem" in result) {
|
|
205
|
+
io.print(`The list shows Garuda's own table: ${result.problem}.`);
|
|
206
|
+
return void 0;
|
|
207
|
+
}
|
|
208
|
+
await saveCatalog(result.catalog, account.home);
|
|
209
|
+
io.print(`Models of your account: ${result.catalog.models.length}.`);
|
|
210
|
+
return result.catalog;
|
|
211
|
+
}
|
|
180
212
|
async function localModels(baseUrl, fetcher) {
|
|
181
213
|
try {
|
|
182
214
|
const response = await fetcher(`${baseUrl.replace(/\/+$/, "")}/models`, {
|
|
@@ -300,4 +332,4 @@ export {
|
|
|
300
332
|
setupCommand,
|
|
301
333
|
terminalIO
|
|
302
334
|
};
|
|
303
|
-
//# sourceMappingURL=setupCommand-
|
|
335
|
+
//# sourceMappingURL=setupCommand-GBQIVYJC.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
formatCost,
|
|
4
|
+
jobCost,
|
|
5
|
+
jobPrompt,
|
|
6
|
+
jobReport,
|
|
7
|
+
sumCosts
|
|
8
|
+
} from "./chunk-3MRQJKUO.js";
|
|
9
|
+
import "./chunk-AOGFYUKG.js";
|
|
10
|
+
export {
|
|
11
|
+
formatCost,
|
|
12
|
+
jobCost,
|
|
13
|
+
jobPrompt,
|
|
14
|
+
jobReport,
|
|
15
|
+
sumCosts
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=text-LS35WSRL.js.map
|
|
Binary file
|