glimmervoid 0.35.1 → 0.37.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 +86 -82
- package/dist/bin/glimmervoid.js +58 -114
- package/dist/chunks/{adapters-CADejSpq.js → adapters-BmfVPxlH.js} +29 -61
- package/dist/chunks/adapters-CqFFmM2R.js +1 -0
- package/dist/chunks/{agent-api-cli-CRj_FYbz.js → agent-api-cli-BTHEyJKS.js} +1 -1
- package/dist/chunks/{agent-api-cli-vGwstJ1j.js → agent-api-cli-CBgOKXoO.js} +41 -12
- package/dist/chunks/{agent-api-core-D1233u1U.js → agent-api-core-DzKhakCv.js} +94 -3
- package/dist/chunks/{agent-setup-cli-BTAFcckd.js → agent-setup-cli-C8DGxlA-.js} +1 -1
- package/dist/chunks/{config-rPbbL4nW.js → config-BYc2z1Oc.js} +60 -779
- package/dist/chunks/config-store-B7MpiYxG.js +4181 -0
- package/dist/chunks/config-store-CsUoy88Q.js +1 -0
- package/dist/chunks/{contracts-DjIgIuDk.js → contracts-C6ipN_zw.js} +100 -12
- package/dist/chunks/git-version-6QFnKbWa.js +139 -0
- package/dist/chunks/{grok-KKgdSe-7.js → grok-CZ6kP_vD.js} +7 -3
- package/dist/chunks/guardrails-deps-Cb-ki4EU.js +70 -0
- package/dist/chunks/{sandbox-proxy-core-hnQgKR0T.js → guardrails-proxy-core-BI3rdY-m.js} +4 -4
- package/dist/chunks/{hook-command-core-DclEoE9e.js → hook-command-core-qTNK-xMF.js} +4 -1
- package/dist/chunks/{hook-tools-UX2fmt81.js → hook-tools-BkxllUHE.js} +9 -16
- package/dist/chunks/{knowledge-graph-cli-Rj5nj87L.js → knowledge-graph-cli-DApeMzA8.js} +1 -1
- package/dist/chunks/{loopback-post-DepQfdcM.js → loopback-post-DJ6iYWuL.js} +9 -9
- package/dist/chunks/{main-C-T2Uk20.js → main-BUfjroXE.js} +16282 -12595
- package/dist/chunks/{pair-cli-Dcyzv3In.js → pair-cli-GZ9t1mIO.js} +2 -2
- package/dist/chunks/{remote-config-Dd1T-VJA.js → remote-config-D2Is89Kj.js} +1 -1
- package/dist/chunks/{rtk-hook-core-BmEz2aq9.js → rtk-hook-core-VrUafGAp.js} +15 -5
- package/dist/chunks/rtk-resolver-B8BPgN9L.js +1 -0
- package/dist/chunks/{rtk-resolver-B9pzjLsM.js → rtk-resolver-C_micGrL.js} +1 -1
- package/dist/chunks/session-BZbariv5.js +1032 -0
- package/dist/chunks/{session-routes-BYy3am9m.js → session-routes-C4t8O8yg.js} +9 -9
- package/dist/chunks/settings-cli-DQOjmjev.js +484 -0
- package/dist/chunks/{ssh-sign-cli-DPHpT22B.js → ssh-sign-cli-LIBP8ppO.js} +2 -2
- package/dist/client/assets/index-B_Qt7fbZ.css +1 -0
- package/dist/client/assets/index-D-upBor0.js +265 -0
- package/dist/client/index.html +5 -3
- package/dist/scripts/postinstall-path-check.js +4 -4
- package/dist/server/index.js +1 -1
- package/dist/session/command-hook-relay.js +1 -1
- package/dist/session/{sandbox-open-launcher.js → guardrails-open-launcher.js} +10 -10
- package/dist/session/hook-relay.js +1 -1
- package/dist/session/hook-tool-relay.js +3 -3
- package/dist/session/statusline-relay.js +1 -1
- package/package.json +6 -5
- package/dist/chunks/adapters-B37wqNti.js +0 -1
- package/dist/chunks/config-store-BeIxAZNn.js +0 -1
- package/dist/chunks/config-store-BtsYbNC3.js +0 -1713
- package/dist/chunks/git-version-CUcDtF5k.js +0 -58
- package/dist/chunks/rtk-resolver-SWU5VVM7.js +0 -1
- package/dist/chunks/sandbox-deps-CWiH1d1w.js +0 -70
- package/dist/chunks/session-D6xXN0UU.js +0 -232
- package/dist/client/assets/index-CUxRHbCS.js +0 -254
- package/dist/client/assets/index-DE2GUmqs.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { s as loadConfigFile } from "./config-store-B7MpiYxG.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { D as SessionDoc, Dt as hasRequiredActionHead, G as MyPrMergeWhenReadyResult, H as MyPrMergeResult, It as GithubPollingRefreshRequest, Lt as GithubPollingRefreshResult, N as TaskTitle, O as SessionSnapshot, P as LinkedPr, Pt as REPO_SLUG_RE, Q as SessionPrLinks, R as MyPrKeepMergeableRequest, Rt as githubPollingShape, V as MyPrMergeRequest, W as MyPrMergeWhenReadyRequest, Z as MyPrsStatus, _ as ConversationApprovalDecision, _t as TeamReviewActionResult, b as PendingWakeup, et as CommitSha, g as ConversationApproval, gt as TeamReviewActionRequest, h as ConversationAnswers, k as SessionState, w as SESSION_DOC_PATH_MAX_CHARS, xt as TeamReviewStatus, z as MyPrKeepMergeableResult } from "./session-BZbariv5.js";
|
|
2
|
+
import { J as CoherenceOrient, X as CoherenceRisk, Y as CoherenceReadiness, et as CoherenceWorkState, h as FactorySettings, n as BUILTIN_AGENT_IDS } from "./config-BYc2z1Oc.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region shared/contracts/factory.ts
|
|
5
5
|
var FactoryConsequences = z.looseObject({ records: z.array(z.looseObject({
|
|
@@ -15,6 +15,7 @@ var FactoryConsequences = z.looseObject({ records: z.array(z.looseObject({
|
|
|
15
15
|
session: z.string().optional(),
|
|
16
16
|
evidence: z.string().optional()
|
|
17
17
|
})) });
|
|
18
|
+
var confirmedFlakes = z.array(z.string().min(1)).max(256);
|
|
18
19
|
var FactoryProjectState = z.object({
|
|
19
20
|
projectId: z.string(),
|
|
20
21
|
projectName: z.string(),
|
|
@@ -34,6 +35,12 @@ var FactoryProjectState = z.object({
|
|
|
34
35
|
spentTodayUsd: z.number().finite().nonnegative().optional(),
|
|
35
36
|
dailyBudgetUsd: z.number().finite().nonnegative().nullable().optional(),
|
|
36
37
|
verifierIntentIds: z.array(z.string()).optional(),
|
|
38
|
+
confirmedFlakesByIntent: z.record(z.string().min(1), confirmedFlakes).optional(),
|
|
39
|
+
partialIntentIds: z.array(z.string()).optional(),
|
|
40
|
+
factoryProfile: FactorySettings.unwrap().unwrap().pick({ checks: true }).extend({
|
|
41
|
+
focusedTestCommand: z.string().trim().min(1).optional(),
|
|
42
|
+
widenableScopes: z.array(z.string().trim().min(1)).optional()
|
|
43
|
+
}).optional(),
|
|
37
44
|
error: z.string().nullable(),
|
|
38
45
|
heading: z.object({
|
|
39
46
|
action: CoherenceOrient.shape.action,
|
|
@@ -52,6 +59,9 @@ var FactoryProjectState = z.object({
|
|
|
52
59
|
dependsOn: z.array(z.string()),
|
|
53
60
|
writeScopes: z.array(z.string()),
|
|
54
61
|
owner: z.string().nullable(),
|
|
62
|
+
blockReason: z.string().nullable().optional(),
|
|
63
|
+
parked: z.boolean().optional(),
|
|
64
|
+
blockCount: z.number().int().nonnegative().optional(),
|
|
55
65
|
lastEvent: z.object({
|
|
56
66
|
event: z.string(),
|
|
57
67
|
at: z.string(),
|
|
@@ -79,7 +89,11 @@ var FactoryHarnessStateLine = z.object({
|
|
|
79
89
|
state: FactoryState
|
|
80
90
|
});
|
|
81
91
|
var FactoryHarnessVerdict = z.looseObject({
|
|
82
|
-
outcome: z.enum([
|
|
92
|
+
outcome: z.enum([
|
|
93
|
+
"pass",
|
|
94
|
+
"partial",
|
|
95
|
+
"fail"
|
|
96
|
+
]),
|
|
83
97
|
failureClass: z.string().nullable().optional()
|
|
84
98
|
});
|
|
85
99
|
var FACTORY_ERROR_MAX_CHARS = 16384;
|
|
@@ -141,12 +155,22 @@ var FactoryQueueIntentResult = z.object({
|
|
|
141
155
|
});
|
|
142
156
|
var FactoryControlRequest = z.object({
|
|
143
157
|
projectId,
|
|
144
|
-
action: z.enum([
|
|
158
|
+
action: z.enum([
|
|
159
|
+
"pause",
|
|
160
|
+
"resume",
|
|
161
|
+
"retry-parked",
|
|
162
|
+
"rerun-setup"
|
|
163
|
+
]),
|
|
164
|
+
intentId: z.string().trim().min(1).max(128).optional()
|
|
165
|
+
}).refine((request) => request.action !== "retry-parked" || request.intentId !== void 0, {
|
|
166
|
+
message: "Retry parked requires an intentId",
|
|
167
|
+
path: ["intentId"]
|
|
145
168
|
});
|
|
146
169
|
var FactoryControlResult = z.object({
|
|
147
170
|
projectId: z.string().max(128),
|
|
148
171
|
action: FactoryControlRequest.shape.action,
|
|
149
172
|
ok: z.boolean(),
|
|
173
|
+
reopenedWorkIds: z.array(z.string().min(1)).optional(),
|
|
150
174
|
error: z.string().max(FACTORY_ERROR_MAX_CHARS).optional()
|
|
151
175
|
});
|
|
152
176
|
var FactoryReviewVerdict = z.object({
|
|
@@ -181,6 +205,8 @@ var FactoryLaneState = z.object({
|
|
|
181
205
|
trustedIntentIds: z.array(z.string().min(1)).optional(),
|
|
182
206
|
intentWriteScopes: z.record(z.string().min(1), z.array(z.string().min(1))).optional(),
|
|
183
207
|
intentFloorAllowances: z.record(z.string().min(1), floorAllowances).optional(),
|
|
208
|
+
intentConfirmedFlakes: z.record(z.string().min(1), confirmedFlakes).optional(),
|
|
209
|
+
intentScopeNeeds: z.record(z.string().min(1), z.array(z.string().min(1)).max(256)).optional(),
|
|
184
210
|
ticketedIntentIds: z.array(z.string().min(1)).optional(),
|
|
185
211
|
pendingIntentTickets: z.record(z.string().min(1), z.object({
|
|
186
212
|
risk: CoherenceRisk,
|
|
@@ -191,7 +217,7 @@ var FactoryLaneState = z.object({
|
|
|
191
217
|
factoryLandedShas: z.array(z.string().regex(/^[a-f0-9]{40,64}$/)).optional(),
|
|
192
218
|
unlandedFactoryRecords: z.array(FactoryUnlandedRecord).optional(),
|
|
193
219
|
ticketBlockCounts: z.record(z.string().min(1), z.number().int().nonnegative()).optional(),
|
|
194
|
-
|
|
220
|
+
notifiedIntentOutcomes: z.array(z.string().min(1)).optional()
|
|
195
221
|
});
|
|
196
222
|
var FactoryWorkerEvent = z.object({
|
|
197
223
|
workId: z.string().min(1),
|
|
@@ -269,7 +295,7 @@ var decisionFields = {
|
|
|
269
295
|
attempt: z.number().int().positive().nullable(),
|
|
270
296
|
durationMs: z.number().int().nonnegative().nullable(),
|
|
271
297
|
failureClass: FactoryDecisionFailureClass.nullable(),
|
|
272
|
-
reason: z.string().max(
|
|
298
|
+
reason: z.string().max(3999).nullable()
|
|
273
299
|
};
|
|
274
300
|
var FactoryDecisionLogLine = z.discriminatedUnion("kind", [
|
|
275
301
|
z.strictObject({
|
|
@@ -1233,6 +1259,7 @@ var UpdateJournalSummary = UpdateJournal.pick({
|
|
|
1233
1259
|
//#region shared/contracts/control-messages.ts
|
|
1234
1260
|
var requestId = z.string().nullable().optional();
|
|
1235
1261
|
var sessionId = z.string();
|
|
1262
|
+
var PullRequestKey = SessionPrLinks.shape.unlinkedKeys.unwrap().element;
|
|
1236
1263
|
function loose(type, shape) {
|
|
1237
1264
|
return z.looseObject({
|
|
1238
1265
|
type: z.literal(type),
|
|
@@ -1275,8 +1302,10 @@ var SessionCardFields = z.object({
|
|
|
1275
1302
|
saneYolo: z.boolean(),
|
|
1276
1303
|
worktree: z.boolean(),
|
|
1277
1304
|
workspace: z.boolean().optional(),
|
|
1305
|
+
guarded: z.boolean().optional(),
|
|
1278
1306
|
resumeSessionId: nullableString,
|
|
1279
|
-
ephemeral: z.boolean().optional()
|
|
1307
|
+
ephemeral: z.boolean().optional(),
|
|
1308
|
+
linkedPrs: z.array(LinkedPr).optional()
|
|
1280
1309
|
});
|
|
1281
1310
|
var DIFF_ANNOTATION_NOTE_MAX_CHARS = 1e3;
|
|
1282
1311
|
var DIFF_ANNOTATION_PATH_RE = new RegExp(`^[^${String.fromCharCode(0)}-${String.fromCharCode(31)}${String.fromCharCode(127)}-${String.fromCharCode(159)}]+$`);
|
|
@@ -1383,6 +1412,14 @@ var clientVariants = [
|
|
|
1383
1412
|
id: sessionId,
|
|
1384
1413
|
title: TaskTitle
|
|
1385
1414
|
}),
|
|
1415
|
+
loose("link-session-pr", {
|
|
1416
|
+
id: sessionId,
|
|
1417
|
+
key: PullRequestKey
|
|
1418
|
+
}),
|
|
1419
|
+
loose("unlink-session-pr", {
|
|
1420
|
+
id: sessionId,
|
|
1421
|
+
key: PullRequestKey
|
|
1422
|
+
}),
|
|
1386
1423
|
loose("reorder-sessions", { order: z.array(sessionId) }),
|
|
1387
1424
|
loose("ping", { requestId }),
|
|
1388
1425
|
loose("get-settings", { requestId }),
|
|
@@ -1390,8 +1427,14 @@ var clientVariants = [
|
|
|
1390
1427
|
settings: z.record(z.string(), z.unknown()),
|
|
1391
1428
|
requestId
|
|
1392
1429
|
}),
|
|
1393
|
-
loose("scan-repo-roots", {
|
|
1394
|
-
|
|
1430
|
+
loose("scan-repo-roots", {
|
|
1431
|
+
requestId,
|
|
1432
|
+
includeSuggestions: z.boolean().optional()
|
|
1433
|
+
}),
|
|
1434
|
+
loose("list-agents", {
|
|
1435
|
+
requestId,
|
|
1436
|
+
rescan: z.boolean().optional()
|
|
1437
|
+
}),
|
|
1395
1438
|
loose("get-radar-report", {
|
|
1396
1439
|
issueId: z.union([z.string(), z.number()]),
|
|
1397
1440
|
requestId
|
|
@@ -1418,9 +1461,16 @@ var clientVariants = [
|
|
|
1418
1461
|
action: z.string(),
|
|
1419
1462
|
requestId
|
|
1420
1463
|
}),
|
|
1464
|
+
loose("open-team-review-session", {
|
|
1465
|
+
requestId,
|
|
1466
|
+
key: PullRequestKey
|
|
1467
|
+
}),
|
|
1421
1468
|
loose("team-review-action", {
|
|
1422
1469
|
...TeamReviewActionRequest.shape,
|
|
1423
1470
|
requestId
|
|
1471
|
+
}).refine(hasRequiredActionHead, {
|
|
1472
|
+
message: "only discard may omit head",
|
|
1473
|
+
path: ["head"]
|
|
1424
1474
|
}),
|
|
1425
1475
|
loose("factory-queue-intent", {
|
|
1426
1476
|
...FactoryQueueIntentRequest.shape,
|
|
@@ -1484,6 +1534,7 @@ var clientVariants = [
|
|
|
1484
1534
|
}),
|
|
1485
1535
|
loose("session-trace", {
|
|
1486
1536
|
id: sessionId,
|
|
1537
|
+
requestId,
|
|
1487
1538
|
after: z.number().int().nonnegative().default(0),
|
|
1488
1539
|
endingAt: z.union([z.number().int().nonnegative(), z.literal("tail")]).optional()
|
|
1489
1540
|
}),
|
|
@@ -1494,6 +1545,16 @@ var clientVariants = [
|
|
|
1494
1545
|
draft: z.boolean().optional()
|
|
1495
1546
|
}),
|
|
1496
1547
|
loose("plan-decision", PlanDecision.shape),
|
|
1548
|
+
loose("set-session-conversation-view", {
|
|
1549
|
+
id: sessionId,
|
|
1550
|
+
isOn: z.boolean()
|
|
1551
|
+
}),
|
|
1552
|
+
loose("conversation-approval", {
|
|
1553
|
+
id: sessionId,
|
|
1554
|
+
requestId: ConversationApproval.shape.requestId,
|
|
1555
|
+
decision: ConversationApprovalDecision,
|
|
1556
|
+
answers: ConversationAnswers.optional()
|
|
1557
|
+
}),
|
|
1497
1558
|
loose("session-doc-read", {
|
|
1498
1559
|
id: sessionId,
|
|
1499
1560
|
path: sessionDocPath,
|
|
@@ -1528,11 +1589,13 @@ Object.freeze([
|
|
|
1528
1589
|
"session-removed",
|
|
1529
1590
|
"session-renamed",
|
|
1530
1591
|
"session-title",
|
|
1592
|
+
"session-prs",
|
|
1531
1593
|
"session-modified",
|
|
1532
1594
|
"session-git",
|
|
1533
1595
|
"session-agents",
|
|
1534
1596
|
"session-wakeup",
|
|
1535
1597
|
"session-prompt",
|
|
1598
|
+
"session-conversation",
|
|
1536
1599
|
"session-sleep",
|
|
1537
1600
|
"session-wake",
|
|
1538
1601
|
"session-merge-status",
|
|
@@ -1577,6 +1640,7 @@ Object.freeze([
|
|
|
1577
1640
|
"radar-open-session-result",
|
|
1578
1641
|
"issue-detail-result",
|
|
1579
1642
|
"open-issue-session-result",
|
|
1643
|
+
"open-team-review-session-result",
|
|
1580
1644
|
"radar-issue-action-result",
|
|
1581
1645
|
"team-review-action-result",
|
|
1582
1646
|
"benchmark-action-result",
|
|
@@ -1668,8 +1732,7 @@ var serverVariants = [
|
|
|
1668
1732
|
event: z.string(),
|
|
1669
1733
|
timestamp,
|
|
1670
1734
|
skipPerms: z.boolean().optional(),
|
|
1671
|
-
saneYolo: z.boolean().optional()
|
|
1672
|
-
hasEndedTurn: z.boolean().optional()
|
|
1735
|
+
saneYolo: z.boolean().optional()
|
|
1673
1736
|
}),
|
|
1674
1737
|
loose("session-added", SessionCardFields.shape),
|
|
1675
1738
|
loose("session-modified", SessionCardFields.shape),
|
|
@@ -1687,6 +1750,10 @@ var serverVariants = [
|
|
|
1687
1750
|
taskTitle: TaskTitle.nullable(),
|
|
1688
1751
|
isCustom: z.boolean()
|
|
1689
1752
|
}),
|
|
1753
|
+
loose("session-prs", {
|
|
1754
|
+
id: sessionId,
|
|
1755
|
+
linkedPrs: z.array(LinkedPr)
|
|
1756
|
+
}),
|
|
1690
1757
|
loose("session-git", {
|
|
1691
1758
|
id: sessionId,
|
|
1692
1759
|
worktree: z.boolean()
|
|
@@ -1706,9 +1773,14 @@ var serverVariants = [
|
|
|
1706
1773
|
isCompacting: z.boolean().optional(),
|
|
1707
1774
|
id: sessionId,
|
|
1708
1775
|
pendingPromptKind: nullableString,
|
|
1709
|
-
pendingPromptDetail: PendingPromptDetail.nullable().optional(),
|
|
1710
1776
|
timestamp
|
|
1711
1777
|
}),
|
|
1778
|
+
loose("session-conversation", {
|
|
1779
|
+
id: sessionId,
|
|
1780
|
+
hasConversationBridge: z.boolean(),
|
|
1781
|
+
isConversationViewOn: z.boolean(),
|
|
1782
|
+
conversationApproval: ConversationApproval.nullable()
|
|
1783
|
+
}),
|
|
1712
1784
|
loose("session-sleep"),
|
|
1713
1785
|
loose("session-wake"),
|
|
1714
1786
|
loose("session-merge-status", {
|
|
@@ -1795,6 +1867,7 @@ var serverVariants = [
|
|
|
1795
1867
|
}),
|
|
1796
1868
|
loose("session-trace-response", {
|
|
1797
1869
|
id: sessionId,
|
|
1870
|
+
requestId,
|
|
1798
1871
|
records: z.array(TraceRecord),
|
|
1799
1872
|
start: z.number().int().nonnegative(),
|
|
1800
1873
|
next: z.number().int().nonnegative(),
|
|
@@ -1879,6 +1952,11 @@ var serverVariants = [
|
|
|
1879
1952
|
path: z.string()
|
|
1880
1953
|
}))
|
|
1881
1954
|
})),
|
|
1955
|
+
suggestions: z.array(openObject({
|
|
1956
|
+
path: z.string(),
|
|
1957
|
+
label: z.string(),
|
|
1958
|
+
gitRepoCount: z.number().int().nonnegative()
|
|
1959
|
+
})).optional(),
|
|
1882
1960
|
error: z.string().optional()
|
|
1883
1961
|
}),
|
|
1884
1962
|
loose("conversations", {
|
|
@@ -1958,6 +2036,16 @@ var serverVariants = [
|
|
|
1958
2036
|
pending: z.boolean().optional(),
|
|
1959
2037
|
existing: z.boolean().optional()
|
|
1960
2038
|
}),
|
|
2039
|
+
loose("open-team-review-session-result", {
|
|
2040
|
+
requestId,
|
|
2041
|
+
ok: z.boolean(),
|
|
2042
|
+
error: optionalError,
|
|
2043
|
+
key: PullRequestKey.optional(),
|
|
2044
|
+
sessionId: z.string().optional(),
|
|
2045
|
+
sessionName: z.string().optional(),
|
|
2046
|
+
pending: z.boolean().optional(),
|
|
2047
|
+
existing: z.boolean().optional()
|
|
2048
|
+
}),
|
|
1961
2049
|
loose("radar-issue-action-result", {
|
|
1962
2050
|
requestId,
|
|
1963
2051
|
ok: z.boolean(),
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { t as AGENT_API_VERBS } from "./session-BZbariv5.js";
|
|
2
|
+
import { r as execFileSync } from "./child-process-safe-CbQnyh7D.js";
|
|
3
|
+
//#region server/core/command-line-core.ts
|
|
4
|
+
var SUBCOMMANDS_HONORING_TRAILING_GLOBAL_OPTIONS = /* @__PURE__ */ new Set([
|
|
5
|
+
"doctor",
|
|
6
|
+
"pair",
|
|
7
|
+
"visions"
|
|
8
|
+
]);
|
|
9
|
+
var SUBCOMMANDS_HONORING_A_LEADING_HELP_OR_VERSION = /* @__PURE__ */ new Set([...AGENT_API_VERBS, "factory"]);
|
|
10
|
+
var OPTIONS_TAKING_A_VALUE = {
|
|
11
|
+
"--config": "configPath",
|
|
12
|
+
"--port": "port"
|
|
13
|
+
};
|
|
14
|
+
function scanGlobalOption(argv, index, state) {
|
|
15
|
+
const token = argv[index];
|
|
16
|
+
const valueKey = OPTIONS_TAKING_A_VALUE[token];
|
|
17
|
+
if (valueKey) {
|
|
18
|
+
const value = argv[index + 1];
|
|
19
|
+
if (value !== void 0) state[valueKey] = value;
|
|
20
|
+
return index + 2;
|
|
21
|
+
}
|
|
22
|
+
if (token === "--help" || token === "-h") state.wantsHelp = true;
|
|
23
|
+
if (token === "--version") state.wantsVersion = true;
|
|
24
|
+
if (token === "--doctor") state.wantsDoctor = true;
|
|
25
|
+
if (token === "--no-open") state.wantsNoOpen = true;
|
|
26
|
+
return index + 1;
|
|
27
|
+
}
|
|
28
|
+
function scanTrailingGlobalOptions(subcommandArgs, state) {
|
|
29
|
+
let index = 0;
|
|
30
|
+
while (index < subcommandArgs.length) {
|
|
31
|
+
if (!subcommandArgs[index].startsWith("-")) {
|
|
32
|
+
index += 1;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
index = scanGlobalOption(subcommandArgs, index, state);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function scanLeadingHelpOrVersion(subcommandArgs, state) {
|
|
39
|
+
const firstArgument = subcommandArgs[0];
|
|
40
|
+
if (firstArgument === "--help" || firstArgument === "-h") state.wantsHelp = true;
|
|
41
|
+
if (firstArgument === "--version") state.wantsVersion = true;
|
|
42
|
+
}
|
|
43
|
+
function parseCommandLine(argv) {
|
|
44
|
+
const state = {
|
|
45
|
+
configPath: null,
|
|
46
|
+
port: null,
|
|
47
|
+
wantsHelp: false,
|
|
48
|
+
wantsVersion: false,
|
|
49
|
+
wantsDoctor: false,
|
|
50
|
+
wantsNoOpen: false
|
|
51
|
+
};
|
|
52
|
+
let index = 0;
|
|
53
|
+
while (index < argv.length && argv[index].startsWith("-")) index = scanGlobalOption(argv, index, state);
|
|
54
|
+
const name = argv[index];
|
|
55
|
+
const subcommandArgs = argv.slice(index + 1);
|
|
56
|
+
if (name !== void 0 && SUBCOMMANDS_HONORING_TRAILING_GLOBAL_OPTIONS.has(name)) scanTrailingGlobalOptions(subcommandArgs, state);
|
|
57
|
+
if (name !== void 0 && SUBCOMMANDS_HONORING_A_LEADING_HELP_OR_VERSION.has(name)) scanLeadingHelpOrVersion(subcommandArgs, state);
|
|
58
|
+
if (state.wantsHelp) return { kind: "help" };
|
|
59
|
+
if (state.wantsVersion) return { kind: "version" };
|
|
60
|
+
const globalOptions = {
|
|
61
|
+
configPath: state.configPath,
|
|
62
|
+
port: state.port
|
|
63
|
+
};
|
|
64
|
+
if (state.wantsDoctor) return {
|
|
65
|
+
kind: "subcommand",
|
|
66
|
+
name: "doctor",
|
|
67
|
+
subcommandArgs: [],
|
|
68
|
+
globalOptions
|
|
69
|
+
};
|
|
70
|
+
if (name === void 0) return {
|
|
71
|
+
kind: "server",
|
|
72
|
+
globalOptions,
|
|
73
|
+
isBrowserOpenSkipped: state.wantsNoOpen
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
kind: "subcommand",
|
|
77
|
+
name,
|
|
78
|
+
subcommandArgs,
|
|
79
|
+
globalOptions
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region server/git/core/git-version-core.ts
|
|
84
|
+
var NEW_WORK_ISOLATION_FLOOR = Object.freeze({
|
|
85
|
+
major: 2,
|
|
86
|
+
minor: 48
|
|
87
|
+
});
|
|
88
|
+
var NEW_WORK_ISOLATION_FLOOR_LABEL = `${NEW_WORK_ISOLATION_FLOOR.major}.${NEW_WORK_ISOLATION_FLOOR.minor}`;
|
|
89
|
+
var WHOLE_RANGE_CONSEQUENCE = "a team re-review cannot single out the author's new work and reviews the whole pull request range";
|
|
90
|
+
var GIT_UPDATE_HINT = `Update git to ${NEW_WORK_ISOLATION_FLOOR_LABEL} or newer`;
|
|
91
|
+
var UNKNOWN_GIT_VERSION = Object.freeze({
|
|
92
|
+
version: null,
|
|
93
|
+
isTooOldToIsolateNewWork: false
|
|
94
|
+
});
|
|
95
|
+
function gitVersionReport(versionOutput) {
|
|
96
|
+
const match = /^git version (\d+)\.(\d+)(?:\.(\d+))?/.exec(versionOutput?.trim() ?? "");
|
|
97
|
+
if (!match) return UNKNOWN_GIT_VERSION;
|
|
98
|
+
const [, major = "", minor = "", patch] = match;
|
|
99
|
+
const isBelowFloorMajor = Number(major) < NEW_WORK_ISOLATION_FLOOR.major;
|
|
100
|
+
const isBelowFloorMinor = Number(major) === NEW_WORK_ISOLATION_FLOOR.major && Number(minor) < NEW_WORK_ISOLATION_FLOOR.minor;
|
|
101
|
+
return {
|
|
102
|
+
version: [
|
|
103
|
+
major,
|
|
104
|
+
minor,
|
|
105
|
+
patch
|
|
106
|
+
].filter((part) => part !== void 0).join("."),
|
|
107
|
+
isTooOldToIsolateNewWork: isBelowFloorMajor || isBelowFloorMinor
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function gitBootWarning(report) {
|
|
111
|
+
if (!report.isTooOldToIsolateNewWork) return null;
|
|
112
|
+
return `[git] git ${report.version} is older than ${NEW_WORK_ISOLATION_FLOOR_LABEL}, so ${WHOLE_RANGE_CONSEQUENCE}. ${GIT_UPDATE_HINT}.`;
|
|
113
|
+
}
|
|
114
|
+
function gitDoctorRows(report) {
|
|
115
|
+
const versionRow = ["git", report.version ?? "unknown"];
|
|
116
|
+
if (!report.isTooOldToIsolateNewWork) return [versionRow];
|
|
117
|
+
return [versionRow, ["hint", `${GIT_UPDATE_HINT}: on an older one ${WHOLE_RANGE_CONSEQUENCE}`]];
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region server/git/git-version.ts
|
|
121
|
+
function readGitVersionOutput() {
|
|
122
|
+
return execFileSync("git", ["--version"], {
|
|
123
|
+
encoding: "utf8",
|
|
124
|
+
timeout: 3e3
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function probeGitVersion({ readVersionOutput = readGitVersionOutput } = {}) {
|
|
128
|
+
try {
|
|
129
|
+
return gitVersionReport(readVersionOutput());
|
|
130
|
+
} catch {
|
|
131
|
+
return gitVersionReport(null);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function warnWhenGitIsTooOld({ probe = probeGitVersion, log = console } = {}) {
|
|
135
|
+
const warning = gitBootWarning(probe());
|
|
136
|
+
if (warning !== null) log.warn(warning);
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { parseCommandLine as i, warnWhenGitIsTooOld as n, gitDoctorRows as r, probeGitVersion as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as errorMessage } from "./text-DoirglWV.js";
|
|
2
2
|
import { o as relayPath } from "./runtime-paths-BkeftE60.js";
|
|
3
|
-
import {
|
|
3
|
+
import { T as SIGN_URL_ENV, n as AGENT_URL_ENV } from "./session-BZbariv5.js";
|
|
4
4
|
import { t as HOOK_URL_ENV } from "./hook-relay-core-DA_bz2KA.js";
|
|
5
5
|
import { n as isRecord } from "./coerce-NSst8oRP.js";
|
|
6
|
-
import {
|
|
7
|
-
import { t as buildHookCommand } from "./hook-command-core-
|
|
6
|
+
import { o as SANE_YOLO_PATH_ENV, r as RTK_PATH_ENV, s as saneYoloEnv } from "./rtk-hook-core-VrUafGAp.js";
|
|
7
|
+
import { t as buildHookCommand } from "./hook-command-core-qTNK-xMF.js";
|
|
8
8
|
import fs from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import os from "node:os";
|
|
@@ -271,6 +271,9 @@ function mayContributeHooks(configText) {
|
|
|
271
271
|
if (!isRecord(settings)) return false;
|
|
272
272
|
return Object.hasOwn(settings, "hooks");
|
|
273
273
|
}
|
|
274
|
+
function userConfigFolders() {
|
|
275
|
+
return [path.join(os.homedir(), ".claude")];
|
|
276
|
+
}
|
|
274
277
|
function mapHookToSignal(event, payload) {
|
|
275
278
|
const normalizedEvent = String(event || "").toLowerCase();
|
|
276
279
|
if (normalizedEvent === "subagentstart") return "subagent-start";
|
|
@@ -403,6 +406,7 @@ var grok = {
|
|
|
403
406
|
hookToolRelayPath: HOOK_TOOL_RELAY_PATH
|
|
404
407
|
}),
|
|
405
408
|
projectConfigCandidates: PROJECT_CONFIG_CANDIDATES,
|
|
409
|
+
userConfigFolders,
|
|
406
410
|
mayContributeHooks
|
|
407
411
|
}
|
|
408
412
|
},
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { i as execSync } from "./child-process-safe-CbQnyh7D.js";
|
|
2
|
+
import { r as resolvePathCommandMatches } from "./spawn-command-Cc40FiZI.js";
|
|
3
|
+
//#region server/guardrails/core/guardrails-deps-core.ts
|
|
4
|
+
var LINUX_GUARDRAILS_BINARIES = Object.freeze([
|
|
5
|
+
"bwrap",
|
|
6
|
+
"socat",
|
|
7
|
+
"rg"
|
|
8
|
+
]);
|
|
9
|
+
var NO_GUARDRAILS_BINARIES = Object.freeze([]);
|
|
10
|
+
var GUARDRAILS_INSTALL_HINT = "Install bubblewrap, socat and ripgrep, for example: sudo apt install bubblewrap socat ripgrep";
|
|
11
|
+
var GUARDED_WORK = "guarded sessions and factory checks";
|
|
12
|
+
function requiredGuardrailsBinaries(platform) {
|
|
13
|
+
return platform === "linux" ? LINUX_GUARDRAILS_BINARIES : NO_GUARDRAILS_BINARIES;
|
|
14
|
+
}
|
|
15
|
+
function guardrailsDependencyReport({ platform, binariesOnPath }) {
|
|
16
|
+
const requiredBinaries = requiredGuardrailsBinaries(platform);
|
|
17
|
+
const missingBinaries = requiredBinaries.filter((binary) => !binariesOnPath.has(binary));
|
|
18
|
+
return {
|
|
19
|
+
platform,
|
|
20
|
+
requiredBinaries,
|
|
21
|
+
missingBinaries,
|
|
22
|
+
installHint: missingBinaries.length > 0 ? GUARDRAILS_INSTALL_HINT : null
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function namesList(names) {
|
|
26
|
+
if (names.length <= 1) return names.join("");
|
|
27
|
+
return `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
|
|
28
|
+
}
|
|
29
|
+
function missingBinariesPhrase(report) {
|
|
30
|
+
return `${namesList(report.missingBinaries)} ${report.missingBinaries.length === 1 ? "is" : "are"} not on PATH`;
|
|
31
|
+
}
|
|
32
|
+
function guardrailsSpawnRefusal(report) {
|
|
33
|
+
if (report.missingBinaries.length === 0) return null;
|
|
34
|
+
return `not started: the guardrails need ${namesList(report.requiredBinaries)}, and ${missingBinariesPhrase(report)}. ${report.installHint}`;
|
|
35
|
+
}
|
|
36
|
+
function guardrailsBootWarning(report) {
|
|
37
|
+
if (report.missingBinaries.length === 0) return null;
|
|
38
|
+
return `[guardrails] ${missingBinariesPhrase(report)}, so ${GUARDED_WORK} will refuse to start. ${report.installHint}`;
|
|
39
|
+
}
|
|
40
|
+
function guardrailsDoctorRows(report) {
|
|
41
|
+
if (report.requiredBinaries.length === 0) return [["guardrails", `nothing to check on ${report.platform}`]];
|
|
42
|
+
const binaryRows = report.requiredBinaries.map((binary) => [binary, report.missingBinaries.includes(binary) ? "MISSING" : "found"]);
|
|
43
|
+
if (report.installHint === null) return binaryRows;
|
|
44
|
+
return [...binaryRows, ["hint", report.installHint]];
|
|
45
|
+
}
|
|
46
|
+
function guardrailsInstallNotice(report) {
|
|
47
|
+
if (report.installHint === null) return null;
|
|
48
|
+
return `glimmervoid: ${missingBinariesPhrase(report)}; ${GUARDED_WORK} need ${namesList(report.requiredBinaries)}. ${report.installHint}`;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region server/guardrails/guardrails-deps.ts
|
|
52
|
+
function probeGuardrailsDependencies({ platform = process.platform, exec = execSync } = {}) {
|
|
53
|
+
return guardrailsDependencyReport({
|
|
54
|
+
platform,
|
|
55
|
+
binariesOnPath: new Set(requiredGuardrailsBinaries(platform).filter((binary) => resolvePathCommandMatches(binary, {
|
|
56
|
+
platform,
|
|
57
|
+
exec
|
|
58
|
+
}).length > 0))
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function checkGuardrailsDependencies({ probe = probeGuardrailsDependencies, log = console } = {}) {
|
|
62
|
+
const report = probe();
|
|
63
|
+
const warning = guardrailsBootWarning(report);
|
|
64
|
+
if (warning !== null) log.warn(warning);
|
|
65
|
+
const refusal = guardrailsSpawnRefusal(report);
|
|
66
|
+
return () => refusal;
|
|
67
|
+
}
|
|
68
|
+
var allowGuardedSpawn = () => null;
|
|
69
|
+
//#endregion
|
|
70
|
+
export { guardrailsInstallNotice as a, guardrailsDoctorRows as i, checkGuardrailsDependencies as n, probeGuardrailsDependencies as r, allowGuardedSpawn as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as isLoopbackHostname } from "./hook-relay-core-DA_bz2KA.js";
|
|
2
|
-
//#region session/core/
|
|
3
|
-
var
|
|
2
|
+
//#region session/core/guardrails-proxy-core.ts
|
|
3
|
+
var HOOK_VIA_GUARDRAILS_PROXY_ENV = "GLIMMERVOID_HOOK_VIA_GUARDRAILS_PROXY";
|
|
4
4
|
function decodeProxyCredential(percentEncoded) {
|
|
5
5
|
try {
|
|
6
6
|
return decodeURIComponent(percentEncoded);
|
|
@@ -8,7 +8,7 @@ function decodeProxyCredential(percentEncoded) {
|
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function decideGuardrailsProxy(env) {
|
|
12
12
|
if (env.SANDBOX_RUNTIME !== "1") return null;
|
|
13
13
|
const rawProxyUrl = env.HTTP_PROXY || env.http_proxy || "";
|
|
14
14
|
if (!URL.canParse(rawProxyUrl)) return null;
|
|
@@ -24,4 +24,4 @@ function decideSandboxProxy(env) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
|
-
export {
|
|
27
|
+
export { decideGuardrailsProxy as n, HOOK_VIA_GUARDRAILS_PROXY_ENV as t };
|
|
@@ -10,5 +10,8 @@ function buildHookCommand(relayPath, event, argvTail = []) {
|
|
|
10
10
|
const forwardSlashedPath = rawPath.replace(/\\/g, "/");
|
|
11
11
|
return `node ${/\s/.test(forwardSlashedPath) ? `"${forwardSlashedPath}"` : forwardSlashedPath} ${rawEvent}${argvTail.length ? ` ${argvTail.join(" ")}` : ""}`;
|
|
12
12
|
}
|
|
13
|
+
function shellQuote(value) {
|
|
14
|
+
return `'${String(value).replace(/'/g, `'\\''`)}'`;
|
|
15
|
+
}
|
|
13
16
|
//#endregion
|
|
14
|
-
export { buildHookCommand as t };
|
|
17
|
+
export { shellQuote as n, buildHookCommand as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as resolvePathCommandMatches } from "./spawn-command-Cc40FiZI.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as buildHookCommand } from "./hook-command-core-
|
|
2
|
+
import { o as SANE_YOLO_PATH_ENV, r as RTK_PATH_ENV, s as saneYoloEnv, t as CLAUDE_RELAY_FLAVOR } from "./rtk-hook-core-VrUafGAp.js";
|
|
3
|
+
import { n as shellQuote, t as buildHookCommand } from "./hook-command-core-qTNK-xMF.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region session/core/hook-tools.ts
|
|
6
6
|
function firstExistingFile(candidates, fsApi) {
|
|
@@ -19,22 +19,9 @@ function resolveRtkPath({ glimmervoidHome, platform, exec, fsApi }) {
|
|
|
19
19
|
if (!firstMatch) return null;
|
|
20
20
|
return path.resolve(firstMatch);
|
|
21
21
|
}
|
|
22
|
-
function quoteCommandPath(commandPath) {
|
|
23
|
-
if (!/\s/.test(commandPath)) return commandPath;
|
|
24
|
-
return `"${commandPath}"`;
|
|
25
|
-
}
|
|
26
22
|
function toForwardSlashes(commandPath) {
|
|
27
23
|
return commandPath.replace(/\\/g, "/");
|
|
28
24
|
}
|
|
29
|
-
function buildRtkHookEntry(rtkPath) {
|
|
30
|
-
return {
|
|
31
|
-
matcher: "Bash",
|
|
32
|
-
hooks: [{
|
|
33
|
-
type: "command",
|
|
34
|
-
command: `${quoteCommandPath(toForwardSlashes(rtkPath))} hook claude`
|
|
35
|
-
}]
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
25
|
function codexGroup(command) {
|
|
39
26
|
if (!command) return null;
|
|
40
27
|
return `{matcher='Bash',hooks=[{type='command',command='${command}'}]}`;
|
|
@@ -44,7 +31,13 @@ var HOOK_TOOLS = {
|
|
|
44
31
|
capability: "rtk",
|
|
45
32
|
purpose: "rtk command rewriting",
|
|
46
33
|
env: (tool) => ({ [RTK_PATH_ENV]: tool.binPath }),
|
|
47
|
-
claudeEntry: (
|
|
34
|
+
claudeEntry: (_tool, relayPath) => ({
|
|
35
|
+
matcher: "Bash",
|
|
36
|
+
hooks: [{
|
|
37
|
+
type: "command",
|
|
38
|
+
command: `node ${shellQuote(toForwardSlashes(relayPath))} rtk ${CLAUDE_RELAY_FLAVOR}`
|
|
39
|
+
}]
|
|
40
|
+
}),
|
|
48
41
|
codexGroup: (_tool, relayPath) => codexGroup(buildHookCommand(relayPath, "rtk"))
|
|
49
42
|
},
|
|
50
43
|
saneYolo: {
|
|
@@ -2,7 +2,7 @@ import { r as errorMessage } from "./text-DoirglWV.js";
|
|
|
2
2
|
import { s as resolvePackageBin } from "./runtime-paths-BkeftE60.js";
|
|
3
3
|
import { r as execFileSync } from "./child-process-safe-CbQnyh7D.js";
|
|
4
4
|
import { n as glimmervoidHomeDir, t as decideConfigPath } from "./config-path-core-DFt-TemS.js";
|
|
5
|
-
import { r as BrowserConfig } from "./config-
|
|
5
|
+
import { r as BrowserConfig } from "./config-BYc2z1Oc.js";
|
|
6
6
|
import fs, { closeSync, constants, existsSync, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
7
7
|
import path, { dirname, join, posix, resolve, win32 } from "node:path";
|
|
8
8
|
import os from "node:os";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as isLoopbackHostname } from "./hook-relay-core-DA_bz2KA.js";
|
|
2
|
-
import { n as
|
|
2
|
+
import { n as decideGuardrailsProxy } from "./guardrails-proxy-core-BI3rdY-m.js";
|
|
3
3
|
import http from "node:http";
|
|
4
4
|
//#region session/loopback-post.ts
|
|
5
5
|
var POST_TIMEOUT_MS = 1500;
|
|
@@ -16,11 +16,11 @@ function directRoute(target) {
|
|
|
16
16
|
path: `${target.pathname}${target.search}`
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const proxyHeaders =
|
|
19
|
+
function guardrailsProxyRoute(guardrailsProxy, target) {
|
|
20
|
+
const proxyHeaders = guardrailsProxy.authorization ? { "proxy-authorization": guardrailsProxy.authorization } : {};
|
|
21
21
|
return {
|
|
22
|
-
hostname:
|
|
23
|
-
port:
|
|
22
|
+
hostname: guardrailsProxy.hostname,
|
|
23
|
+
port: guardrailsProxy.port,
|
|
24
24
|
path: target.href,
|
|
25
25
|
headers: {
|
|
26
26
|
...proxyHeaders,
|
|
@@ -81,10 +81,10 @@ async function postToLoopback(url, body, env = process.env) {
|
|
|
81
81
|
const target = new URL(url);
|
|
82
82
|
if (target.protocol !== "http:") return refusal("not-http");
|
|
83
83
|
if (!isLoopbackHostname(target.hostname)) return refusal("not-loopback");
|
|
84
|
-
if (env["
|
|
85
|
-
const
|
|
86
|
-
if (!
|
|
87
|
-
return sendPost(
|
|
84
|
+
if (env["GLIMMERVOID_HOOK_VIA_GUARDRAILS_PROXY"] !== "1") return sendPost(directRoute(target), body);
|
|
85
|
+
const guardrailsProxy = decideGuardrailsProxy(env);
|
|
86
|
+
if (!guardrailsProxy) return refusal("guardrails-proxy-missing");
|
|
87
|
+
return sendPost(guardrailsProxyRoute(guardrailsProxy, target), body);
|
|
88
88
|
}
|
|
89
89
|
async function postPayload(url, body) {
|
|
90
90
|
return (await postToLoopback(url, body)).responseBody;
|