glimmervoid 0.43.2 → 0.43.4
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/bin/glimmervoid.js +14 -14
- package/dist/chunks/{adapters-Ce0I__TH.js → adapters-C7wGqlhU.js} +1 -1
- package/dist/chunks/{adapters-CjtgWEdg.js → adapters-Du4HJLMG.js} +16 -10
- package/dist/chunks/{agent-api-cli-DYwXyAmN.js → agent-api-cli-BC2i4XNI.js} +1 -1
- package/dist/chunks/{agent-api-cli-B0fpc41n.js → agent-api-cli-DRTVOR2W.js} +2 -2
- package/dist/chunks/agent-api-core-9mdbvlfc.js +782 -0
- package/dist/chunks/{agent-setup-cli-NfJQxNdp.js → agent-setup-cli-DAPHGpRA.js} +1 -1
- package/dist/chunks/{control-messages-CD99vE0V.js → config-D0YwCXFd.js} +557 -2
- package/dist/chunks/{config-store-2noiIsTg.js → config-store-BpsH_oWP.js} +59 -5
- package/dist/chunks/config-store-DcJKvInM.js +1 -0
- package/dist/chunks/contracts-Dxc9Gp0Y.js +295 -0
- package/dist/chunks/{grok-DPmX1ozS.js → grok-2z-LqPHN.js} +2 -2
- package/dist/chunks/{main-BGJ7PAA2.js → main-Bzy6xXUF.js} +248 -468
- package/dist/chunks/{pair-cli-CPv7mDTg.js → pair-cli-DSZFFEkT.js} +2 -2
- package/dist/chunks/{remote-config-DZWZ5fVJ.js → remote-config-Cd_FC7bd.js} +1 -1
- package/dist/chunks/runtime-paths-Cc0_ZR6V.js +1 -0
- package/dist/chunks/{runtime-paths-BkeftE60.js → runtime-paths-ghcH9CeW.js} +1 -1
- package/dist/chunks/{session-routes-DdeSkLqC.js → session-routes-BQPy81dm.js} +6 -3
- package/dist/chunks/{settings-cli-4fX1olS3.js → settings-cli-DOpMn6-A.js} +5 -5
- package/dist/chunks/{settings-readout-core-NoTHBGL6.js → settings-readout-core-D1ZP4UIs.js} +1 -1
- package/dist/chunks/{ssh-sign-cli-CvqtQNQe.js → ssh-sign-cli-ynkhYkLs.js} +1 -1
- package/dist/chunks/{visions-cli-CVRB9IWA.js → visions-cli-COYRIdXy.js} +1 -1
- package/dist/chunks/{visions-setup-DB2P8JUL.js → visions-setup-VMMyqOpl.js} +2 -2
- package/dist/client/assets/{index-DEbBUagP.css → index-583DiM8X.css} +1 -1
- package/dist/client/assets/index-CsyFNXR2.js +177 -0
- package/dist/client/index.html +2 -2
- package/dist/server/index.js +2 -2
- package/dist/session/remote-setup/SKILL.md +120 -0
- package/dist/session/remote-setup/glimmervoid.service +20 -0
- package/dist/session/statusline-relay.js +1 -1
- package/dist/session/visions-relay.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/agent-api-core-BeSecYrA.js +0 -336
- package/dist/chunks/config-store-DW0ONWV5.js +0 -1
- package/dist/chunks/contracts-CFm0dprb.js +0 -835
- package/dist/chunks/runtime-paths-DSmormp7.js +0 -1
- package/dist/client/assets/index-CNDdyYn0.js +0 -177
|
@@ -1,835 +0,0 @@
|
|
|
1
|
-
import { R as TaskTitle, Wt as repoParts, ot as SessionPrLinks } from "./session-BUcx9uJa.js";
|
|
2
|
-
import { $ as TASK_TITLE_TIMEOUT_RANGE, A as BRANCH_GC_STALE_DAYS_RANGE, B as POSTHOG_ESCALATION_RANGE, D as WorkflowsSettingsUpdate, E as WorkflowsSettings, F as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, G as POSTHOG_MIN_USERS_RANGE, H as POSTHOG_INTERVAL_RANGE, I as MEMORY_RESERVE_MB_RANGE, J as POSTHOG_TRAFFIC_COOLDOWN_RANGE, K as POSTHOG_RECURRENCE_WINDOW_RANGE, Q as REPLAY_BUFFER_KB_RANGE, R as PORT_RANGE, U as POSTHOG_INVESTIGATION_TIMEOUT_RANGE, V as POSTHOG_FIX_TIMEOUT_RANGE, W as POSTHOG_MAX_CONCURRENT_RANGE, X as POSTHOG_TRAFFIC_MULTIPLIER_RANGE, Y as POSTHOG_TRAFFIC_MIN_USERS_RANGE, Z as POSTHOG_TRANSIENT_RECURRENCE_RANGE, a as OPERATOR_ACTIONS_BY_SURFACE, at as VISIONS_COOLDOWN_MS_RANGE, ct as VISIONS_MAX_PER_HOUR_RANGE, it as VISIONS_ACTIVITY_MAX_PER_HOUR_RANGE, k as BRANCH_GC_INTERVAL_MS_RANGE, lt as VISIONS_QUIET_MS_RANGE, o as OPERATOR_SURFACES, ot as VISIONS_DISPATCH_TIMEOUT_RANGE, q as POSTHOG_TRAFFIC_BASELINE_RANGE, r as DASHBOARD_VIEWS, st as VISIONS_INTENT_THREAD_TTL_MS_RANGE, tt as USAGE_INTEGER_RANGES, z as POSITIVE_NUMBER_RANGE } from "./control-messages-CD99vE0V.js";
|
|
3
|
-
import { n as isRecord } from "./coerce-NSst8oRP.js";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
//#region shared/contracts/config-numbers-core.ts
|
|
7
|
-
var POSTHOG_WHOLE_NUMBER_ROUNDING = {
|
|
8
|
-
maxConcurrentInvestigations: Math.ceil,
|
|
9
|
-
minUsersToInvestigate: Math.ceil,
|
|
10
|
-
userEscalationThreshold: Math.ceil,
|
|
11
|
-
trafficSpikeMinUsers: Math.ceil,
|
|
12
|
-
trafficSpikeBaselineDays: Math.floor
|
|
13
|
-
};
|
|
14
|
-
var LEGACY_INTEGER_FIELDS = [
|
|
15
|
-
{
|
|
16
|
-
path: [
|
|
17
|
-
"visions",
|
|
18
|
-
"dispatch",
|
|
19
|
-
"quietMs"
|
|
20
|
-
],
|
|
21
|
-
min: 1,
|
|
22
|
-
round: Math.floor
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
path: [
|
|
26
|
-
"visions",
|
|
27
|
-
"dispatch",
|
|
28
|
-
"cooldownMs"
|
|
29
|
-
],
|
|
30
|
-
min: 1,
|
|
31
|
-
round: Math.floor
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
path: [
|
|
35
|
-
"visions",
|
|
36
|
-
"dispatch",
|
|
37
|
-
"maxPerHour"
|
|
38
|
-
],
|
|
39
|
-
min: 1,
|
|
40
|
-
round: Math.floor
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
path: [
|
|
44
|
-
"visions",
|
|
45
|
-
"dispatch",
|
|
46
|
-
"activityMaxPerHour"
|
|
47
|
-
],
|
|
48
|
-
min: 0,
|
|
49
|
-
round: Math.floor
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
path: [
|
|
53
|
-
"visions",
|
|
54
|
-
"dispatch",
|
|
55
|
-
"dispatchTimeoutSeconds"
|
|
56
|
-
],
|
|
57
|
-
min: 1,
|
|
58
|
-
round: Math.floor
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
path: [
|
|
62
|
-
"visions",
|
|
63
|
-
"intent",
|
|
64
|
-
"threadTtlMs"
|
|
65
|
-
],
|
|
66
|
-
min: 1,
|
|
67
|
-
round: Math.floor
|
|
68
|
-
},
|
|
69
|
-
...Object.entries(POSTHOG_WHOLE_NUMBER_ROUNDING).map(([key, round]) => ({
|
|
70
|
-
path: ["posthog", key],
|
|
71
|
-
min: 1,
|
|
72
|
-
round
|
|
73
|
-
}))
|
|
74
|
-
];
|
|
75
|
-
function normalizeIntegerField(config, path, min, round) {
|
|
76
|
-
let target = config;
|
|
77
|
-
for (const segment of path.slice(0, -1)) {
|
|
78
|
-
const block = target[segment];
|
|
79
|
-
if (!isRecord(block)) return;
|
|
80
|
-
target[segment] = { ...block };
|
|
81
|
-
target = target[segment];
|
|
82
|
-
}
|
|
83
|
-
const key = path.at(-1);
|
|
84
|
-
const value = target[key];
|
|
85
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) return;
|
|
86
|
-
if (Number.isInteger(value)) return;
|
|
87
|
-
target[key] = Math.min(Number.MAX_SAFE_INTEGER, Math.max(min, round(value)));
|
|
88
|
-
}
|
|
89
|
-
function normalizeLegacyConfigNumbers(candidate) {
|
|
90
|
-
const normalized = { ...candidate };
|
|
91
|
-
const replayBufferKB = candidate.replayBufferKB;
|
|
92
|
-
if (typeof replayBufferKB === "number" && Number.isFinite(replayBufferKB) && replayBufferKB >= 0 && replayBufferKB <= REPLAY_BUFFER_KB_RANGE.max) normalized.replayBufferKB = Math.max(REPLAY_BUFFER_KB_RANGE.min, Math.floor(replayBufferKB));
|
|
93
|
-
for (const { path, min, round } of LEGACY_INTEGER_FIELDS) normalizeIntegerField(normalized, path, min, round);
|
|
94
|
-
return normalized;
|
|
95
|
-
}
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region shared/usage-config.ts
|
|
98
|
-
var USAGE_COST_MODES = Object.freeze([
|
|
99
|
-
"auto",
|
|
100
|
-
"calculate",
|
|
101
|
-
"display"
|
|
102
|
-
]);
|
|
103
|
-
var USAGE_VENDOR_KEYS = Object.freeze(["codex", "grok"]);
|
|
104
|
-
var USAGE_BUDGET_KEYS = Object.freeze(["dailyUsd", "monthlyUsd"]);
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region shared/contracts/browser-config.ts
|
|
107
|
-
var optionalBoolean = (field) => z.boolean({ error: `${field} must be a boolean` }).optional();
|
|
108
|
-
var optionalString = (field, trim = false) => {
|
|
109
|
-
const schema = z.string({ error: `${field} must be a string` });
|
|
110
|
-
return (trim ? schema.transform((value) => value.trim()) : schema).optional();
|
|
111
|
-
};
|
|
112
|
-
var numberRangeLabel = (range) => {
|
|
113
|
-
if (range.label) return range.label;
|
|
114
|
-
if (range.max != null) return `between ${range.min} and ${range.max}`;
|
|
115
|
-
if (range.exclusiveMin) return `greater than ${range.min}`;
|
|
116
|
-
return `at least ${range.min}`;
|
|
117
|
-
};
|
|
118
|
-
var optionalNumber = (field, range = POSITIVE_NUMBER_RANGE) => z.number({ error: `${field} must be ${numberRangeLabel(range)}` }).finite().refine((value) => !range.exclusiveMin || value > range.min, { message: `${field} must be ${numberRangeLabel(range)}` }).refine((value) => range.exclusiveMin || value >= range.min, { message: `${field} must be ${numberRangeLabel(range)}` }).refine((value) => range.max == null || value <= range.max, { message: `${field} must be ${numberRangeLabel(range)}` }).optional();
|
|
119
|
-
var optionalWholeNumber = (field, range) => optionalNumber(field, range).unwrap().int({ error: `${field} must be a whole number ${numberRangeLabel(range)}` }).optional();
|
|
120
|
-
var optionalInteger = (field, range) => z.number({ error: `${field} must be an integer between ${range.min} and ${range.max}` }).int({ error: `${field} must be an integer between ${range.min} and ${range.max}` }).min(range.min, { error: `${field} must be an integer between ${range.min} and ${range.max}` }).max(range.max, { error: `${field} must be an integer between ${range.min} and ${range.max}` }).optional();
|
|
121
|
-
var optionalObject = (field, shape) => z.object(shape, { error: `${field} must be an object` }).nullable().optional();
|
|
122
|
-
var optionalLooseObject = (field) => z.object({}, { error: `${field} must be an object` }).passthrough().nullable().optional();
|
|
123
|
-
var UPDATE_CHANNELS = Object.freeze(["release", "main"]);
|
|
124
|
-
var POST_TURN_CHECK_MODES = Object.freeze(["report", "fix"]);
|
|
125
|
-
var TaskTitleSettings = z.object({ refiner: z.object({
|
|
126
|
-
enabled: optionalBoolean("taskTitle.refiner.enabled"),
|
|
127
|
-
model: optionalString("taskTitle.refiner.model", true),
|
|
128
|
-
minIntervalSeconds: optionalNumber("taskTitle.refiner.minIntervalSeconds", { min: 0 }),
|
|
129
|
-
timeoutSeconds: optionalNumber("taskTitle.refiner.timeoutSeconds", TASK_TITLE_TIMEOUT_RANGE)
|
|
130
|
-
}, { error: "taskTitle.refiner must be an object" }).nullable().optional() }, { error: "taskTitle must be an object" }).nullable().optional();
|
|
131
|
-
var BRANCH_GC_SETTINGS_SHAPE = {
|
|
132
|
-
enabled: optionalBoolean("branchGc.enabled"),
|
|
133
|
-
worktrees: optionalBoolean("branchGc.worktrees"),
|
|
134
|
-
prefixes: z.array(z.string({ error: "branchGc.prefixes must be an array of strings" }).min(1, { error: "branchGc.prefixes entries must be non-empty strings" }), { error: "branchGc.prefixes must be an array of strings" }).optional(),
|
|
135
|
-
dryRun: optionalBoolean("branchGc.dryRun"),
|
|
136
|
-
staleDays: optionalNumber("branchGc.staleDays", BRANCH_GC_STALE_DAYS_RANGE),
|
|
137
|
-
deleteUnmerged: optionalBoolean("branchGc.deleteUnmerged"),
|
|
138
|
-
intervalMs: optionalNumber("branchGc.intervalMs", BRANCH_GC_INTERVAL_MS_RANGE)
|
|
139
|
-
};
|
|
140
|
-
var BranchGcFileSettings = z.object(BRANCH_GC_SETTINGS_SHAPE, { error: "branchGc must be an object" });
|
|
141
|
-
var BranchGcSettings = optionalObject("branchGc", BRANCH_GC_SETTINGS_SHAPE);
|
|
142
|
-
var BranchGcControlSettings = BranchGcFileSettings.omit({
|
|
143
|
-
prefixes: true,
|
|
144
|
-
dryRun: true,
|
|
145
|
-
worktrees: true
|
|
146
|
-
}).nullable().optional();
|
|
147
|
-
Object.freeze(["enabled", "deleteUnmerged"]);
|
|
148
|
-
Object.freeze(["staleDays", "intervalMs"]);
|
|
149
|
-
var PostTurnChecksSettings = optionalObject("postTurnChecks", { mode: z.enum(POST_TURN_CHECK_MODES, { error: "postTurnChecks.mode must be one of report, fix" }).optional() });
|
|
150
|
-
var VisionsSettings = optionalObject("visions", {
|
|
151
|
-
enabled: optionalBoolean("visions.enabled"),
|
|
152
|
-
autoFix: optionalBoolean("visions.autoFix"),
|
|
153
|
-
projects: z.array(z.string({ error: "visions.projects must be an array of strings" }), { error: "visions.projects must be an array of strings" }).optional(),
|
|
154
|
-
dispatch: optionalObject("visions.dispatch", {
|
|
155
|
-
enabled: optionalBoolean("visions.dispatch.enabled"),
|
|
156
|
-
model: optionalString("visions.dispatch.model", true),
|
|
157
|
-
quietMs: optionalWholeNumber("visions.dispatch.quietMs", VISIONS_QUIET_MS_RANGE),
|
|
158
|
-
cooldownMs: optionalWholeNumber("visions.dispatch.cooldownMs", VISIONS_COOLDOWN_MS_RANGE),
|
|
159
|
-
maxPerHour: optionalWholeNumber("visions.dispatch.maxPerHour", VISIONS_MAX_PER_HOUR_RANGE),
|
|
160
|
-
activityMaxPerHour: optionalWholeNumber("visions.dispatch.activityMaxPerHour", VISIONS_ACTIVITY_MAX_PER_HOUR_RANGE),
|
|
161
|
-
dispatchTimeoutSeconds: optionalWholeNumber("visions.dispatch.dispatchTimeoutSeconds", VISIONS_DISPATCH_TIMEOUT_RANGE)
|
|
162
|
-
}),
|
|
163
|
-
intent: optionalObject("visions.intent", { threadTtlMs: optionalWholeNumber("visions.intent.threadTtlMs", VISIONS_INTENT_THREAD_TTL_MS_RANGE) })
|
|
164
|
-
});
|
|
165
|
-
var GithubSettings = z.object({ teams: z.array(z.string({ error: "github.teams must be an array of org/slug strings" }).refine((team) => repoParts(team) !== null, { message: "github.teams entries must be org/slug with valid GitHub segments" }), { error: "github.teams must be an array of org/slug strings" }).optional() }, { error: "github must be an object" }).nullable().optional();
|
|
166
|
-
var TeamReviewSettings = optionalObject("teamReview", {
|
|
167
|
-
enabled: optionalBoolean("teamReview.enabled"),
|
|
168
|
-
autoRebaseMyPrs: optionalBoolean("teamReview.autoRebaseMyPrs"),
|
|
169
|
-
keepMergeableEnabled: optionalBoolean("teamReview.keepMergeableEnabled"),
|
|
170
|
-
mergeQueueEnabled: optionalBoolean("teamReview.mergeQueueEnabled"),
|
|
171
|
-
keepMergeableTimeoutMinutes: optionalInteger("teamReview.keepMergeableTimeoutMinutes", KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE),
|
|
172
|
-
org: optionalString("teamReview.org", true),
|
|
173
|
-
team: optionalString("teamReview.team", true),
|
|
174
|
-
skill: optionalString("teamReview.skill", true),
|
|
175
|
-
reReviewAfterHours: optionalNumber("teamReview.reReviewAfterHours"),
|
|
176
|
-
skipIdleAfterDays: optionalNumber("teamReview.skipIdleAfterDays")
|
|
177
|
-
});
|
|
178
|
-
var BenchmarksSettings = optionalObject("benchmarks", { enabled: optionalBoolean("benchmarks.enabled") });
|
|
179
|
-
var CoherenceSettings = optionalObject("coherence", { enabled: optionalBoolean("coherence.enabled") });
|
|
180
|
-
var posthogNumberRanges = {
|
|
181
|
-
intervalMinutes: POSTHOG_INTERVAL_RANGE,
|
|
182
|
-
maxConcurrentInvestigations: POSTHOG_MAX_CONCURRENT_RANGE,
|
|
183
|
-
investigationTimeoutSeconds: POSTHOG_INVESTIGATION_TIMEOUT_RANGE,
|
|
184
|
-
fixTimeoutSeconds: POSTHOG_FIX_TIMEOUT_RANGE,
|
|
185
|
-
minUsersToInvestigate: POSTHOG_MIN_USERS_RANGE,
|
|
186
|
-
userEscalationThreshold: POSTHOG_ESCALATION_RANGE,
|
|
187
|
-
recurrenceWindowDays: POSTHOG_RECURRENCE_WINDOW_RANGE,
|
|
188
|
-
transientRecurrenceLimit: POSTHOG_TRANSIENT_RECURRENCE_RANGE,
|
|
189
|
-
trafficSpikeMultiplier: POSTHOG_TRAFFIC_MULTIPLIER_RANGE,
|
|
190
|
-
trafficSpikeMinUsers: POSTHOG_TRAFFIC_MIN_USERS_RANGE,
|
|
191
|
-
trafficSpikeCooldownMinutes: POSTHOG_TRAFFIC_COOLDOWN_RANGE,
|
|
192
|
-
trafficSpikeBaselineDays: POSTHOG_TRAFFIC_BASELINE_RANGE
|
|
193
|
-
};
|
|
194
|
-
var PosthogSettings = optionalObject("posthog", {
|
|
195
|
-
enabled: optionalBoolean("posthog.enabled"),
|
|
196
|
-
recurrenceDedupe: optionalBoolean("posthog.recurrenceDedupe"),
|
|
197
|
-
trafficSpikeEnabled: optionalBoolean("posthog.trafficSpikeEnabled"),
|
|
198
|
-
autoFix: optionalBoolean("posthog.autoFix"),
|
|
199
|
-
host: optionalString("posthog.host", true).refine((value) => value == null || !value || /^https?:\/\//i.test(value), { message: "posthog.host must be an http(s) URL" }),
|
|
200
|
-
apiKey: optionalString("posthog.apiKey", true),
|
|
201
|
-
repoPath: optionalString("posthog.repoPath", true),
|
|
202
|
-
projects: z.union([z.literal("all"), z.array(z.number({ error: "posthog.projects must be \"all\" or an array of positive integer project ids" }).int({ error: "posthog.projects must be \"all\" or an array of positive integer project ids" }).positive({ error: "posthog.projects must be \"all\" or an array of positive integer project ids" }), { error: "posthog.projects must be \"all\" or an array of positive integer project ids" })], { error: "posthog.projects must be \"all\" or an array of positive integer project ids" }).optional(),
|
|
203
|
-
projectMap: z.record(z.string(), z.unknown(), { error: "posthog.projectMap must be an object" }).optional(),
|
|
204
|
-
...Object.fromEntries(Object.entries(posthogNumberRanges).map(([key, range]) => [key, Object.hasOwn(POSTHOG_WHOLE_NUMBER_ROUNDING, key) ? optionalWholeNumber(`posthog.${key}`, range) : optionalNumber(`posthog.${key}`, range)]))
|
|
205
|
-
});
|
|
206
|
-
var usageCostModeMessage = `usage.costMode must be one of ${USAGE_COST_MODES.join(", ")}`;
|
|
207
|
-
var usageVendorShape = Object.fromEntries(USAGE_VENDOR_KEYS.map((key) => [key, optionalBoolean(`usage.vendors.${key}`)]));
|
|
208
|
-
var usageBudgetShape = Object.fromEntries(USAGE_BUDGET_KEYS.map((key) => [key, z.number({ error: `usage.budget.${key} must be a positive number or null` }).positive({ error: `usage.budget.${key} must be a positive number or null` }).nullable().optional()]));
|
|
209
|
-
var createUsageSettings = (isAbsolutePath) => optionalObject("usage", {
|
|
210
|
-
enabled: optionalBoolean("usage.enabled"),
|
|
211
|
-
fetchPricing: optionalBoolean("usage.fetchPricing"),
|
|
212
|
-
planLimits: optionalBoolean("usage.planLimits"),
|
|
213
|
-
rtkSavings: optionalBoolean("usage.rtkSavings"),
|
|
214
|
-
scanIntervalMinutes: optionalInteger("usage.scanIntervalMinutes", USAGE_INTEGER_RANGES.scanIntervalMinutes),
|
|
215
|
-
retainDays: optionalInteger("usage.retainDays", USAGE_INTEGER_RANGES.retainDays),
|
|
216
|
-
warehouseRetainDays: optionalInteger("usage.warehouseRetainDays", USAGE_INTEGER_RANGES.warehouseRetainDays),
|
|
217
|
-
sessionBlockHours: optionalInteger("usage.sessionBlockHours", USAGE_INTEGER_RANGES.sessionBlockHours),
|
|
218
|
-
costMode: z.enum(USAGE_COST_MODES, { error: usageCostModeMessage }).optional(),
|
|
219
|
-
vendors: optionalObject("usage.vendors", usageVendorShape),
|
|
220
|
-
budget: optionalObject("usage.budget", usageBudgetShape),
|
|
221
|
-
extraProjectsDirs: z.array(z.string({ error: "usage.extraProjectsDirs must be an array of absolute paths" }), { error: "usage.extraProjectsDirs must be an array of absolute paths" }).transform((directories) => directories.map((directory) => directory.trim())).refine((directories) => directories.every((directory) => directory && isAbsolutePath(directory)), { message: "usage.extraProjectsDirs entries must be absolute paths" }).optional()
|
|
222
|
-
});
|
|
223
|
-
var TelegramSettings = optionalObject("telegram", {
|
|
224
|
-
botToken: optionalString("telegram.botToken", true),
|
|
225
|
-
chatId: optionalString("telegram.chatId", true)
|
|
226
|
-
});
|
|
227
|
-
var IngestSettings = z.object({ enabled: optionalBoolean("ingest.enabled") }, { error: "ingest must be an object" }).passthrough().optional();
|
|
228
|
-
var TraceSettings = z.object({ enabled: optionalBoolean("trace.enabled") }, { error: "trace must be an object" }).optional();
|
|
229
|
-
var PlanReviewSettings = z.object({ enabled: optionalBoolean("planReview.enabled") }, { error: "planReview must be an object" }).optional();
|
|
230
|
-
var optionalPathList = (field) => z.array(z.string({ error: `${field} must be an array of paths` }).trim().min(1, { error: `${field} must be an array of paths` }), { error: `${field} must be an array of paths` }).optional();
|
|
231
|
-
var guardrailsShape = {
|
|
232
|
-
unguardedRepos: optionalPathList("guardrails.unguardedRepos"),
|
|
233
|
-
blockedPaths: optionalPathList("guardrails.blockedPaths"),
|
|
234
|
-
unreadablePaths: optionalPathList("guardrails.unreadablePaths")
|
|
235
|
-
};
|
|
236
|
-
var isHomeRelativePath = (entry) => entry === "~" || entry.startsWith("~/") || entry.startsWith("~\\");
|
|
237
|
-
var createGuardrailsSettings = (isAbsolutePath) => z.object({
|
|
238
|
-
...guardrailsShape,
|
|
239
|
-
blockedPaths: z.array(z.string({ error: "guardrails.blockedPaths must be an array of paths" }).trim().min(1, { error: "guardrails.blockedPaths must be an array of paths" }).refine((entry) => isHomeRelativePath(entry) || isAbsolutePath(entry), { message: "guardrails.blockedPaths entries must be absolute paths or start with ~/" }), { error: "guardrails.blockedPaths must be an array of paths" }).optional()
|
|
240
|
-
}, { error: "guardrails must be an object" }).strict().optional();
|
|
241
|
-
var GuardrailsFileSettings = z.object(guardrailsShape, { error: "guardrails must be an object" }).passthrough().optional();
|
|
242
|
-
var telemetryShape = { enabled: optionalBoolean("telemetry.enabled") };
|
|
243
|
-
var TelemetrySettings = z.object(telemetryShape, { error: "telemetry must be an object" }).strict().optional();
|
|
244
|
-
var TelemetryFileSettings = z.object(telemetryShape, { error: "telemetry must be an object" }).passthrough().optional();
|
|
245
|
-
var createBrowserConfigShape = (isAbsolutePath) => ({
|
|
246
|
-
port: z.number().int().min(PORT_RANGE.min).max(PORT_RANGE.max).optional(),
|
|
247
|
-
notifyDebounceMs: z.number().finite().nonnegative().optional(),
|
|
248
|
-
phoneEscalationMs: z.number().finite().nonnegative().optional(),
|
|
249
|
-
replayBufferKB: optionalWholeNumber("replayBufferKB", REPLAY_BUFFER_KB_RANGE),
|
|
250
|
-
sessionMemoryReserveMB: optionalWholeNumber("sessionMemoryReserveMB", MEMORY_RESERVE_MB_RANGE),
|
|
251
|
-
cursorBlink: optionalBoolean("cursorBlink"),
|
|
252
|
-
debugMode: optionalBoolean("debugMode"),
|
|
253
|
-
conversationView: optionalBoolean("conversationView"),
|
|
254
|
-
streamerMode: optionalBoolean("streamerMode"),
|
|
255
|
-
zenView: optionalBoolean("zenView"),
|
|
256
|
-
remoteSessions: optionalBoolean("remoteSessions"),
|
|
257
|
-
detectBackgroundAgents: optionalBoolean("detectBackgroundAgents"),
|
|
258
|
-
recordSignals: optionalBoolean("recordSignals"),
|
|
259
|
-
rtk: optionalBoolean("rtk"),
|
|
260
|
-
saneYolo: optionalBoolean("saneYolo"),
|
|
261
|
-
skipPermissionsByDefault: optionalBoolean("skipPermissionsByDefault"),
|
|
262
|
-
checkForUpdates: optionalBoolean("checkForUpdates"),
|
|
263
|
-
updateChannel: z.enum(UPDATE_CHANNELS, { error: "updateChannel must be one of release, main" }).optional(),
|
|
264
|
-
autoResume: optionalBoolean("autoResume"),
|
|
265
|
-
telegramNotifications: optionalBoolean("telegramNotifications"),
|
|
266
|
-
integrationBranch: optionalString("integrationBranch").nullable(),
|
|
267
|
-
worktreeRoot: optionalString("worktreeRoot"),
|
|
268
|
-
worktreeShare: z.array(z.string()).optional(),
|
|
269
|
-
repoRoots: z.array(z.string()).optional(),
|
|
270
|
-
taskTitle: TaskTitleSettings,
|
|
271
|
-
branchGc: BranchGcSettings,
|
|
272
|
-
postTurnChecks: PostTurnChecksSettings,
|
|
273
|
-
visions: VisionsSettings,
|
|
274
|
-
github: GithubSettings,
|
|
275
|
-
teamReview: TeamReviewSettings,
|
|
276
|
-
benchmarks: BenchmarksSettings,
|
|
277
|
-
coherence: CoherenceSettings,
|
|
278
|
-
posthog: PosthogSettings,
|
|
279
|
-
usage: createUsageSettings(isAbsolutePath),
|
|
280
|
-
telegram: TelegramSettings,
|
|
281
|
-
ingest: IngestSettings,
|
|
282
|
-
guardrails: createGuardrailsSettings(isAbsolutePath),
|
|
283
|
-
telemetry: TelemetrySettings,
|
|
284
|
-
workflows: WorkflowsSettings.nullable().optional()
|
|
285
|
-
});
|
|
286
|
-
var createBrowserConfig = (isAbsolutePath) => z.object(createBrowserConfigShape(isAbsolutePath));
|
|
287
|
-
//#endregion
|
|
288
|
-
//#region shared/contracts/config.ts
|
|
289
|
-
var BrowserConfig = createBrowserConfig(path.isAbsolute);
|
|
290
|
-
var BROWSER_CONFIG_SHAPE = BrowserConfig.shape;
|
|
291
|
-
var ConfigUpdate = z.object({
|
|
292
|
-
...BROWSER_CONFIG_SHAPE,
|
|
293
|
-
notifyDebounceMs: z.number({ error: "notifyDebounceMs must be a positive number" }).finite().positive({ error: "notifyDebounceMs must be a positive number" }).optional(),
|
|
294
|
-
phoneEscalationMs: z.number({ error: "phoneEscalationMs must be a positive number" }).finite().positive({ error: "phoneEscalationMs must be a positive number" }).optional(),
|
|
295
|
-
branchGc: BranchGcControlSettings,
|
|
296
|
-
worktreeAutoRebase: optionalBoolean("worktreeAutoRebase"),
|
|
297
|
-
worktreeSyncOnStart: optionalBoolean("worktreeSyncOnStart"),
|
|
298
|
-
worktreeRerere: optionalBoolean("worktreeRerere"),
|
|
299
|
-
workflows: WorkflowsSettingsUpdate.optional()
|
|
300
|
-
}).omit({
|
|
301
|
-
port: true,
|
|
302
|
-
worktreeShare: true
|
|
303
|
-
}).strict();
|
|
304
|
-
var AGENT_ID_RE = /^[a-z][a-z0-9-]{1,31}$/;
|
|
305
|
-
var BUILTIN_AGENT_IDS = Object.freeze([
|
|
306
|
-
"claude-code",
|
|
307
|
-
"codex",
|
|
308
|
-
"grok"
|
|
309
|
-
]);
|
|
310
|
-
var AGENT_ID_SHAPE_MESSAGE = "an agent id of 2 to 32 characters of lowercase letters, digits and dashes, starting with a letter";
|
|
311
|
-
var AGENT_COMMAND_BASENAME_RE = /^[A-Za-z0-9._+-]+$/;
|
|
312
|
-
var AGENT_COMMAND_ABSOLUTE_RE = /^(?:\/|[A-Za-z]:[\\/])[A-Za-z0-9._+\-\\/]*[A-Za-z0-9._+-]$/;
|
|
313
|
-
var AGENT_COMMAND_SHAPE_MESSAGE = "a bare command name or an absolute path, built only from letters, digits, dot, underscore, plus, dash and path separators";
|
|
314
|
-
function isSpawnableCommand(command) {
|
|
315
|
-
if (AGENT_COMMAND_BASENAME_RE.test(command)) return true;
|
|
316
|
-
return AGENT_COMMAND_ABSOLUTE_RE.test(command);
|
|
317
|
-
}
|
|
318
|
-
var GIT_BRANCH_FORBIDDEN_PUNCTUATION_RE = /[~^:?*[\\]/;
|
|
319
|
-
var GIT_BRANCH_FORBIDDEN_SEQUENCES = [
|
|
320
|
-
"..",
|
|
321
|
-
"@{",
|
|
322
|
-
"//"
|
|
323
|
-
];
|
|
324
|
-
function isControlOrSpaceCharacter(character) {
|
|
325
|
-
const codePoint = character.charCodeAt(0);
|
|
326
|
-
return codePoint <= 32 || codePoint === 127;
|
|
327
|
-
}
|
|
328
|
-
function isGitBranchName(name) {
|
|
329
|
-
if (name === "" || name === "@" || name === "HEAD") return false;
|
|
330
|
-
if (name.startsWith("-") || name.startsWith("/") || name.endsWith("/") || name.endsWith(".")) return false;
|
|
331
|
-
if (GIT_BRANCH_FORBIDDEN_SEQUENCES.some((sequence) => name.includes(sequence))) return false;
|
|
332
|
-
if (GIT_BRANCH_FORBIDDEN_PUNCTUATION_RE.test(name) || [...name].some(isControlOrSpaceCharacter)) return false;
|
|
333
|
-
return name.split("/").every((component) => !component.startsWith(".") && !component.endsWith(".lock"));
|
|
334
|
-
}
|
|
335
|
-
var CODER_WORKSPACE_NAME_RE = /^gv-[0-9a-f]{12}$/;
|
|
336
|
-
var CODER_ENVIRONMENT_NAME_RE = /^[a-z][a-z0-9-]{0,31}$/;
|
|
337
|
-
var CODER_STOP_AFTER_RE = /^[1-9][0-9]*[hm]$/;
|
|
338
|
-
var absolutePosixPath = (field) => z.string({ error: `${field} must be a string` }).refine((value) => path.posix.isAbsolute(value), { error: `${field} must be an absolute path` });
|
|
339
|
-
var positiveInteger = (field) => z.number({ error: `${field} must be a number` }).int({ error: `${field} must be a whole number` }).positive({ error: `${field} must be positive` });
|
|
340
|
-
var PARAMETERS_MESSAGE = "coder.environments[].parameters must map names to strings";
|
|
341
|
-
var CoderEnvironment = z.object({
|
|
342
|
-
name: z.string({ error: "coder.environments[].name must be a string" }).regex(CODER_ENVIRONMENT_NAME_RE, { error: "coder.environments[].name must be 1 to 32 lowercase letters, digits and dashes, starting with a letter" }),
|
|
343
|
-
template: z.string({ error: "coder.environments[].template must be a string" }).min(1, { error: "coder.environments[].template must not be empty" }).refine((value) => !value.startsWith("-"), { error: "coder.environments[].template must not start with a dash" }),
|
|
344
|
-
parameters: z.record(z.string(), z.string({ error: PARAMETERS_MESSAGE }), { error: PARAMETERS_MESSAGE }).optional(),
|
|
345
|
-
nodePath: absolutePosixPath("coder.environments[].nodePath"),
|
|
346
|
-
checkoutRoot: absolutePosixPath("coder.environments[].checkoutRoot"),
|
|
347
|
-
readyUrl: z.url({
|
|
348
|
-
protocol: /^https?$/,
|
|
349
|
-
error: "coder.environments[].readyUrl must be an http or https URL"
|
|
350
|
-
}).optional(),
|
|
351
|
-
idleStopMinutes: positiveInteger("coder.environments[].idleStopMinutes").optional(),
|
|
352
|
-
stopAfter: z.string().regex(CODER_STOP_AFTER_RE, { error: "coder.environments[].stopAfter must be a duration like 4h or 90m" }).optional(),
|
|
353
|
-
maxLive: positiveInteger("coder.environments[].maxLive").optional(),
|
|
354
|
-
deleteAfterStoppedDays: positiveInteger("coder.environments[].deleteAfterStoppedDays").optional(),
|
|
355
|
-
hourlyCostUsd: z.number({ error: "coder.environments[].hourlyCostUsd must be a number" }).nonnegative({ error: "coder.environments[].hourlyCostUsd must not be negative" }).optional()
|
|
356
|
-
}).strict();
|
|
357
|
-
var CoderSettings = z.object({
|
|
358
|
-
appSlug: z.string().optional(),
|
|
359
|
-
environments: z.array(CoderEnvironment).optional().refine((environments) => {
|
|
360
|
-
const names = (environments ?? []).map((environment) => environment.name);
|
|
361
|
-
return new Set(names).size === names.length;
|
|
362
|
-
}, { error: "coder.environments[].name must be unique" })
|
|
363
|
-
}).loose().optional();
|
|
364
|
-
var PORT_MESSAGE = "projects[].environment.remotePort must be a port from 1 to 65535";
|
|
365
|
-
var ProjectEnvironment = z.object({
|
|
366
|
-
name: z.string().regex(CODER_ENVIRONMENT_NAME_RE, { error: "projects[].environment.name must name a coder environment" }),
|
|
367
|
-
workspace: z.string().regex(CODER_WORKSPACE_NAME_RE, { error: "projects[].environment.workspace must be gv- and 12 hex digits" }),
|
|
368
|
-
remotePort: z.number({ error: PORT_MESSAGE }).int({ error: PORT_MESSAGE }).min(1, { error: PORT_MESSAGE }).max(65535, { error: PORT_MESSAGE }),
|
|
369
|
-
branch: z.string().refine(isGitBranchName, { error: "projects[].environment.branch must be a git branch name" })
|
|
370
|
-
}).strict();
|
|
371
|
-
var CustomAgentDeclaration = z.object({
|
|
372
|
-
id: z.string({ error: "customAgents[].id must be a string" }).regex(AGENT_ID_RE, { error: `customAgents[].id must be ${AGENT_ID_SHAPE_MESSAGE}` }),
|
|
373
|
-
label: z.string({ error: "customAgents[].label must be a string" }).min(1, { error: "customAgents[].label must not be empty" }).max(60, { error: "customAgents[].label must be at most 60 characters" }),
|
|
374
|
-
command: z.string({ error: "customAgents[].command must be a string" }).min(1, { error: "customAgents[].command must not be empty" }).refine((command) => command.trim().length > 0, { error: "customAgents[].command must not be blank" }).refine(isSpawnableCommand, { error: `customAgents[].command must be ${AGENT_COMMAND_SHAPE_MESSAGE}` }),
|
|
375
|
-
args: z.array(z.string({ error: "customAgents[].args must be an array of strings" }), { error: "customAgents[].args must be an array of strings" }).default([]),
|
|
376
|
-
idleTitle: z.string({ error: "customAgents[].idleTitle must be a string" }).optional(),
|
|
377
|
-
busyTitle: z.string({ error: "customAgents[].busyTitle must be a string" }).optional()
|
|
378
|
-
}).strict();
|
|
379
|
-
var CustomAgentDeclarations = z.array(CustomAgentDeclaration, { error: "customAgents must be an array" }).superRefine((declarations, ctx) => {
|
|
380
|
-
const claimedIds = new Set(BUILTIN_AGENT_IDS);
|
|
381
|
-
for (const [index, declaration] of declarations.entries()) {
|
|
382
|
-
if (!claimedIds.has(declaration.id)) {
|
|
383
|
-
claimedIds.add(declaration.id);
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
const message = BUILTIN_AGENT_IDS.some((builtinAgentId) => builtinAgentId === declaration.id) ? `customAgents[${index}].id "${declaration.id}" collides with the builtin agent of the same id` : `customAgents[${index}].id "${declaration.id}" is declared more than once`;
|
|
387
|
-
ctx.addIssue({
|
|
388
|
-
code: "custom",
|
|
389
|
-
path: [index, "id"],
|
|
390
|
-
message
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
var TaskTitleSources = z.object({
|
|
395
|
-
customTitle: TaskTitle.nullable().optional(),
|
|
396
|
-
pendingPromptTitle: TaskTitle.nullable().optional(),
|
|
397
|
-
refinedTitle: TaskTitle.nullable().optional(),
|
|
398
|
-
aiTitle: TaskTitle.nullable().optional(),
|
|
399
|
-
oscTitle: TaskTitle.nullable().optional(),
|
|
400
|
-
promptTitle: TaskTitle.nullable().optional()
|
|
401
|
-
}).strict();
|
|
402
|
-
var TASK_TITLE_SOURCE_PRIORITY = [
|
|
403
|
-
"customTitle",
|
|
404
|
-
"pendingPromptTitle",
|
|
405
|
-
"refinedTitle",
|
|
406
|
-
"aiTitle",
|
|
407
|
-
"oscTitle",
|
|
408
|
-
"promptTitle"
|
|
409
|
-
];
|
|
410
|
-
var PersistedTaskTitle = z.object({
|
|
411
|
-
taskTitle: TaskTitle.min(1),
|
|
412
|
-
isCustom: z.boolean(),
|
|
413
|
-
sources: TaskTitleSources
|
|
414
|
-
}).strict().refine(({ taskTitle, isCustom, sources }) => {
|
|
415
|
-
const source = TASK_TITLE_SOURCE_PRIORITY.find((candidate) => sources[candidate]?.trim());
|
|
416
|
-
if (!source) return false;
|
|
417
|
-
return sources[source]?.replace(/\s+/g, " ").trim() === taskTitle && isCustom === (source === "customTitle");
|
|
418
|
-
});
|
|
419
|
-
var ProjectConfig = z.object({
|
|
420
|
-
id: z.string().optional(),
|
|
421
|
-
name: z.string().optional(),
|
|
422
|
-
customTitle: TaskTitle.optional(),
|
|
423
|
-
taskTitleState: PersistedTaskTitle.optional().catch(void 0),
|
|
424
|
-
prLinks: SessionPrLinks.optional().catch(void 0),
|
|
425
|
-
path: z.string(),
|
|
426
|
-
repos: z.array(z.string()).min(2).optional(),
|
|
427
|
-
baseBranch: z.string().refine(isGitBranchName, { error: "projects[].baseBranch must be a git branch name" }).optional(),
|
|
428
|
-
agent: z.string({ error: "projects[].agent must be a string" }).regex(AGENT_ID_RE, { error: `projects[].agent must be ${AGENT_ID_SHAPE_MESSAGE}` }).optional(),
|
|
429
|
-
codexBypassHookTrust: z.boolean().optional(),
|
|
430
|
-
conversationView: z.boolean({ error: "projects[].conversationView must be a boolean" }).optional(),
|
|
431
|
-
dangerouslySkipPermissions: z.boolean({ error: "projects[].dangerouslySkipPermissions must be a boolean" }).optional(),
|
|
432
|
-
unguarded: z.boolean({ error: "projects[].unguarded must be a boolean" }).optional(),
|
|
433
|
-
environment: ProjectEnvironment.optional()
|
|
434
|
-
}).passthrough();
|
|
435
|
-
var FILE_CONFIG_SHAPE = {
|
|
436
|
-
...BROWSER_CONFIG_SHAPE,
|
|
437
|
-
branchGc: optionalLooseObject("branchGc"),
|
|
438
|
-
coder: CoderSettings,
|
|
439
|
-
visions: optionalLooseObject("visions"),
|
|
440
|
-
github: GithubSettings,
|
|
441
|
-
teamReview: optionalLooseObject("teamReview"),
|
|
442
|
-
benchmarks: optionalLooseObject("benchmarks"),
|
|
443
|
-
coherence: optionalLooseObject("coherence"),
|
|
444
|
-
posthog: optionalLooseObject("posthog"),
|
|
445
|
-
usage: optionalLooseObject("usage"),
|
|
446
|
-
telegram: optionalLooseObject("telegram"),
|
|
447
|
-
ingest: optionalLooseObject("ingest"),
|
|
448
|
-
workflows: optionalLooseObject("workflows"),
|
|
449
|
-
guardrails: GuardrailsFileSettings,
|
|
450
|
-
telemetry: TelemetryFileSettings,
|
|
451
|
-
trace: TraceSettings,
|
|
452
|
-
planReview: PlanReviewSettings,
|
|
453
|
-
customAgents: CustomAgentDeclarations.optional()
|
|
454
|
-
};
|
|
455
|
-
var Config = z.object({
|
|
456
|
-
...FILE_CONFIG_SHAPE,
|
|
457
|
-
detectScheduledWakeups: optionalBoolean("detectScheduledWakeups"),
|
|
458
|
-
worktreeAutoRebase: optionalBoolean("worktreeAutoRebase"),
|
|
459
|
-
worktreeSyncOnStart: optionalBoolean("worktreeSyncOnStart"),
|
|
460
|
-
worktreeRerere: optionalBoolean("worktreeRerere"),
|
|
461
|
-
postTurnChecks: z.record(z.string(), z.unknown()).optional(),
|
|
462
|
-
hooks: z.unknown().optional(),
|
|
463
|
-
remote: z.object({
|
|
464
|
-
enabled: z.boolean().optional(),
|
|
465
|
-
port: z.number().int().min(1).max(65535).nullable().optional(),
|
|
466
|
-
publicHost: z.string().optional(),
|
|
467
|
-
allowedOrigins: z.array(z.string()).optional(),
|
|
468
|
-
ownerLogin: z.string().optional()
|
|
469
|
-
}).passthrough().optional(),
|
|
470
|
-
projects: z.array(ProjectConfig)
|
|
471
|
-
}).passthrough().superRefine((config, ctx) => {
|
|
472
|
-
if (!Array.isArray(config.projects)) return;
|
|
473
|
-
const declaredAgentIds = new Set(BUILTIN_AGENT_IDS);
|
|
474
|
-
for (const declaration of config.customAgents ?? []) declaredAgentIds.add(declaration.id);
|
|
475
|
-
for (const [index, project] of config.projects.entries()) {
|
|
476
|
-
const agent = project?.agent;
|
|
477
|
-
if (typeof agent !== "string" || !AGENT_ID_RE.test(agent)) continue;
|
|
478
|
-
if (declaredAgentIds.has(agent)) continue;
|
|
479
|
-
ctx.addIssue({
|
|
480
|
-
code: "custom",
|
|
481
|
-
path: [
|
|
482
|
-
"projects",
|
|
483
|
-
index,
|
|
484
|
-
"agent"
|
|
485
|
-
],
|
|
486
|
-
message: `projects[${index}].agent "${agent}" names no known agent; declare it under customAgents or use one of ${[...declaredAgentIds].join(", ")}`
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
const declaredEnvironmentNames = new Set((config.coder?.environments ?? []).map((environment) => environment.name));
|
|
490
|
-
for (const [index, project] of config.projects.entries()) {
|
|
491
|
-
const environmentName = project?.environment?.name;
|
|
492
|
-
if (environmentName === void 0 || declaredEnvironmentNames.has(environmentName)) continue;
|
|
493
|
-
ctx.addIssue({
|
|
494
|
-
code: "custom",
|
|
495
|
-
path: [
|
|
496
|
-
"projects",
|
|
497
|
-
index,
|
|
498
|
-
"environment",
|
|
499
|
-
"name"
|
|
500
|
-
],
|
|
501
|
-
message: `projects[${index}].environment "${environmentName}" must be declared under coder.environments`
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
var CONFIG_BLOCK_KEYS = Object.freeze([
|
|
506
|
-
"taskTitle",
|
|
507
|
-
"branchGc",
|
|
508
|
-
"postTurnChecks",
|
|
509
|
-
"visions",
|
|
510
|
-
"github",
|
|
511
|
-
"teamReview",
|
|
512
|
-
"benchmarks",
|
|
513
|
-
"coherence",
|
|
514
|
-
"posthog",
|
|
515
|
-
"usage",
|
|
516
|
-
"telegram",
|
|
517
|
-
"ingest",
|
|
518
|
-
"guardrails",
|
|
519
|
-
"telemetry",
|
|
520
|
-
"workflows",
|
|
521
|
-
"coder"
|
|
522
|
-
]);
|
|
523
|
-
var CONFIG_SCALAR_KEYS = Object.freeze(Object.keys(BROWSER_CONFIG_SHAPE).filter((key) => {
|
|
524
|
-
if (CONFIG_BLOCK_KEYS.includes(key)) return false;
|
|
525
|
-
return key !== "port" && key !== "repoRoots" && key !== "worktreeShare";
|
|
526
|
-
}));
|
|
527
|
-
var RUNTIME_CONFIG_SCALAR_KEYS = Object.freeze([
|
|
528
|
-
...CONFIG_SCALAR_KEYS,
|
|
529
|
-
"worktreeAutoRebase",
|
|
530
|
-
"worktreeSyncOnStart",
|
|
531
|
-
"worktreeRerere"
|
|
532
|
-
]);
|
|
533
|
-
Object.freeze([
|
|
534
|
-
"detectScheduledWakeups",
|
|
535
|
-
"worktreeAutoRebase",
|
|
536
|
-
"worktreeSyncOnStart",
|
|
537
|
-
"worktreeRerere",
|
|
538
|
-
"hooks",
|
|
539
|
-
"remote",
|
|
540
|
-
"projects"
|
|
541
|
-
]);
|
|
542
|
-
function configIssueMessage(error) {
|
|
543
|
-
return error.issues[0]?.message || "settings are invalid";
|
|
544
|
-
}
|
|
545
|
-
//#endregion
|
|
546
|
-
//#region shared/contracts/telemetry.ts
|
|
547
|
-
var TELEMETRY_ADAPTERS = Object.freeze([...BUILTIN_AGENT_IDS, "custom"]);
|
|
548
|
-
var SESSION_EXIT_KINDS = Object.freeze([
|
|
549
|
-
"clean",
|
|
550
|
-
"error",
|
|
551
|
-
"signal",
|
|
552
|
-
"no_output"
|
|
553
|
-
]);
|
|
554
|
-
var TEAM_REVIEW_SETTLED_OUTCOMES = Object.freeze([
|
|
555
|
-
"approve",
|
|
556
|
-
"comment",
|
|
557
|
-
"approve-only",
|
|
558
|
-
"discarded"
|
|
559
|
-
]);
|
|
560
|
-
var TEAM_REVIEW_POST_REFUSAL_REASONS = Object.freeze([
|
|
561
|
-
"unknown-action",
|
|
562
|
-
"not-postable",
|
|
563
|
-
"comments-already-posted",
|
|
564
|
-
"empty-comment",
|
|
565
|
-
"rate-limited",
|
|
566
|
-
"head-unreadable",
|
|
567
|
-
"head-moved",
|
|
568
|
-
"diff-unreadable",
|
|
569
|
-
"misplaced-comments",
|
|
570
|
-
"github-refused"
|
|
571
|
-
]);
|
|
572
|
-
var RADAR_VERDICTS = Object.freeze([
|
|
573
|
-
"ROOT_CAUSE",
|
|
574
|
-
"FIXED",
|
|
575
|
-
"NEEDS_HUMAN",
|
|
576
|
-
"TRANSIENT",
|
|
577
|
-
"ERROR"
|
|
578
|
-
]);
|
|
579
|
-
var RADAR_JOB_MODES = Object.freeze(["investigate", "fix"]);
|
|
580
|
-
var RADAR_ERROR_REASONS = Object.freeze([
|
|
581
|
-
"agent-reported",
|
|
582
|
-
"no-result",
|
|
583
|
-
"invalid-result",
|
|
584
|
-
"timed-out",
|
|
585
|
-
"no-verdict",
|
|
586
|
-
"crashed",
|
|
587
|
-
"aborted",
|
|
588
|
-
"empty-fix",
|
|
589
|
-
"handoff-failed"
|
|
590
|
-
]);
|
|
591
|
-
var RADAR_HANDOFF_STEPS = Object.freeze([
|
|
592
|
-
"read-diff",
|
|
593
|
-
"count-commits",
|
|
594
|
-
"push-branch",
|
|
595
|
-
"resolve-repo",
|
|
596
|
-
"open-pr"
|
|
597
|
-
]);
|
|
598
|
-
var OPERATOR_ACTIONS = Object.freeze([...new Set(Object.values(OPERATOR_ACTIONS_BY_SURFACE).flat())]);
|
|
599
|
-
var nonNegativeInteger = z.number().int().nonnegative();
|
|
600
|
-
var boundedText = z.string().max(512);
|
|
601
|
-
var AppStartedProperties = z.object({}).strict();
|
|
602
|
-
var AppActiveProperties = z.object({ active_session_count: nonNegativeInteger }).strict();
|
|
603
|
-
var SessionStartedProperties = z.object({ adapter: z.enum(TELEMETRY_ADAPTERS) }).strict();
|
|
604
|
-
var SessionEndedProperties = z.object({
|
|
605
|
-
adapter: z.enum(TELEMETRY_ADAPTERS),
|
|
606
|
-
exit_kind: z.enum(SESSION_EXIT_KINDS),
|
|
607
|
-
duration_seconds: nonNegativeInteger
|
|
608
|
-
}).strict();
|
|
609
|
-
var ViewShownProperties = z.object({ view: z.enum(DASHBOARD_VIEWS) }).strict();
|
|
610
|
-
function isActionOfSurface({ surface, action }) {
|
|
611
|
-
return OPERATOR_ACTIONS_BY_SURFACE[surface].includes(action);
|
|
612
|
-
}
|
|
613
|
-
var OperatorActionProperties = z.object({
|
|
614
|
-
surface: z.enum(OPERATOR_SURFACES),
|
|
615
|
-
action: z.enum(OPERATOR_ACTIONS)
|
|
616
|
-
}).strict().refine(isActionOfSurface, { message: "action does not belong to its surface" });
|
|
617
|
-
var TeamReviewDraftedProperties = z.object({ inline_comment_count: nonNegativeInteger }).strict();
|
|
618
|
-
var TeamReviewSettledProperties = z.object({
|
|
619
|
-
duration_ms: nonNegativeInteger,
|
|
620
|
-
outcome: z.enum(TEAM_REVIEW_SETTLED_OUTCOMES),
|
|
621
|
-
drafted_comment_count: nonNegativeInteger,
|
|
622
|
-
posted_comment_count: nonNegativeInteger
|
|
623
|
-
}).strict();
|
|
624
|
-
var TeamReviewPostRefusedProperties = z.object({
|
|
625
|
-
duration_ms: nonNegativeInteger,
|
|
626
|
-
reason: z.enum(TEAM_REVIEW_POST_REFUSAL_REASONS)
|
|
627
|
-
}).strict();
|
|
628
|
-
var RadarInvestigationFinishedProperties = z.object({
|
|
629
|
-
verdict: z.enum(RADAR_VERDICTS),
|
|
630
|
-
mode: z.enum(RADAR_JOB_MODES),
|
|
631
|
-
error_reason: z.enum(RADAR_ERROR_REASONS).optional()
|
|
632
|
-
}).strict();
|
|
633
|
-
var RadarFixHandoffFailedProperties = z.object({ step: z.enum(RADAR_HANDOFF_STEPS) }).strict();
|
|
634
|
-
var DashboardTelemetryReport = z.discriminatedUnion("event", [z.object({
|
|
635
|
-
event: z.literal("view_shown"),
|
|
636
|
-
properties: ViewShownProperties
|
|
637
|
-
}), z.object({
|
|
638
|
-
event: z.literal("operator_action"),
|
|
639
|
-
properties: OperatorActionProperties
|
|
640
|
-
})]);
|
|
641
|
-
var ExceptionFrame = z.object({
|
|
642
|
-
platform: z.enum(["node:javascript", "web:javascript"]),
|
|
643
|
-
function: boundedText,
|
|
644
|
-
filename: boundedText,
|
|
645
|
-
lineno: nonNegativeInteger,
|
|
646
|
-
colno: nonNegativeInteger,
|
|
647
|
-
in_app: z.boolean()
|
|
648
|
-
}).strict();
|
|
649
|
-
var ExceptionProperties = z.object({
|
|
650
|
-
$exception_list: z.array(z.object({
|
|
651
|
-
type: boundedText,
|
|
652
|
-
value: boundedText,
|
|
653
|
-
mechanism: z.object({
|
|
654
|
-
handled: z.boolean(),
|
|
655
|
-
synthetic: z.boolean(),
|
|
656
|
-
type: z.literal("generic")
|
|
657
|
-
}).strict(),
|
|
658
|
-
stacktrace: z.object({
|
|
659
|
-
type: z.literal("raw"),
|
|
660
|
-
frames: z.array(ExceptionFrame).max(64)
|
|
661
|
-
}).strict()
|
|
662
|
-
}).strict()).length(1),
|
|
663
|
-
$exception_level: z.enum(["error", "fatal"])
|
|
664
|
-
}).strict();
|
|
665
|
-
var AiGenerationProperties = z.object({
|
|
666
|
-
$ai_trace_id: z.string().regex(/^[0-9a-f]{64}$/),
|
|
667
|
-
$ai_provider: z.string().max(64),
|
|
668
|
-
$ai_model: z.string().max(128),
|
|
669
|
-
$ai_input_tokens: nonNegativeInteger,
|
|
670
|
-
$ai_output_tokens: nonNegativeInteger,
|
|
671
|
-
$ai_cache_read_input_tokens: nonNegativeInteger.optional(),
|
|
672
|
-
$ai_cache_creation_input_tokens: nonNegativeInteger.optional(),
|
|
673
|
-
$ai_total_cost_usd: z.number().finite().nonnegative().optional(),
|
|
674
|
-
agent_adapter: z.enum(TELEMETRY_ADAPTERS)
|
|
675
|
-
}).strict();
|
|
676
|
-
var TELEMETRY_EVENT_SCHEMAS = Object.freeze({
|
|
677
|
-
app_started: AppStartedProperties,
|
|
678
|
-
app_active: AppActiveProperties,
|
|
679
|
-
session_started: SessionStartedProperties,
|
|
680
|
-
session_ended: SessionEndedProperties,
|
|
681
|
-
$exception: ExceptionProperties,
|
|
682
|
-
$ai_generation: AiGenerationProperties,
|
|
683
|
-
view_shown: ViewShownProperties,
|
|
684
|
-
operator_action: OperatorActionProperties,
|
|
685
|
-
team_review_drafted: TeamReviewDraftedProperties,
|
|
686
|
-
team_review_settled: TeamReviewSettledProperties,
|
|
687
|
-
team_review_post_refused: TeamReviewPostRefusedProperties,
|
|
688
|
-
radar_investigation_finished: RadarInvestigationFinishedProperties,
|
|
689
|
-
radar_fix_handoff_failed: RadarFixHandoffFailedProperties
|
|
690
|
-
});
|
|
691
|
-
Object.freeze([
|
|
692
|
-
{
|
|
693
|
-
name: "app_started",
|
|
694
|
-
description: "The server started listening."
|
|
695
|
-
},
|
|
696
|
-
{
|
|
697
|
-
name: "app_active",
|
|
698
|
-
description: "Once a day while the server runs, with how many sessions are live."
|
|
699
|
-
},
|
|
700
|
-
{
|
|
701
|
-
name: "session_started",
|
|
702
|
-
description: "A session spawned, with which kind of agent (any custom agent counts as `custom`)."
|
|
703
|
-
},
|
|
704
|
-
{
|
|
705
|
-
name: "session_ended",
|
|
706
|
-
description: "A session exited: how it exited and how long it ran, in whole seconds."
|
|
707
|
-
},
|
|
708
|
-
{
|
|
709
|
-
name: "$exception",
|
|
710
|
-
description: "An error in the server or the dashboard: its type, an error code when it has one, and stack frames with file paths cut to the package or URL path. Never the error message. Each distinct error is sent once per run, and a crash is sent on the next start."
|
|
711
|
-
},
|
|
712
|
-
{
|
|
713
|
-
name: "$ai_generation",
|
|
714
|
-
description: "Per agent session and model, after each usage scan, for usage recorded in the last 24 hours: token counts, the model name and estimated cost, under a one-way hash of the session. A model name outside the shipped pricing table is sent as unknown. No prompts or output."
|
|
715
|
-
},
|
|
716
|
-
{
|
|
717
|
-
name: "view_shown",
|
|
718
|
-
description: "A dashboard tab opened, on desktop or phone, with which tab. Sent on every open."
|
|
719
|
-
},
|
|
720
|
-
{
|
|
721
|
-
name: "operator_action",
|
|
722
|
-
description: "An action taken in the Usage, Issues, Radar or Reviews tab: which tab and which action, from a fixed list. Never which repository, pull request, issue or session it was taken on."
|
|
723
|
-
},
|
|
724
|
-
{
|
|
725
|
-
name: "team_review_drafted",
|
|
726
|
-
description: "A team review draft became ready, with how many inline comments it drafted."
|
|
727
|
-
},
|
|
728
|
-
{
|
|
729
|
-
name: "team_review_settled",
|
|
730
|
-
description: "A team review draft was posted (approve, comment or approve-only) or discarded, with how many inline comments were drafted and how many were posted, plus the total action duration in milliseconds."
|
|
731
|
-
},
|
|
732
|
-
{
|
|
733
|
-
name: "team_review_post_refused",
|
|
734
|
-
description: "Posting a team review was refused, with a reason from a fixed list and the total action duration in milliseconds. Never the error text."
|
|
735
|
-
},
|
|
736
|
-
{
|
|
737
|
-
name: "radar_investigation_finished",
|
|
738
|
-
description: "A Radar investigation or fix run finished, with its verdict and mode, plus a reason from a fixed list when it ended in ERROR. Never the summary text."
|
|
739
|
-
},
|
|
740
|
-
{
|
|
741
|
-
name: "radar_fix_handoff_failed",
|
|
742
|
-
description: "Handing a Radar fix over as a pull request failed, with which step failed. Never the branch or the error text."
|
|
743
|
-
}
|
|
744
|
-
]);
|
|
745
|
-
Object.freeze([
|
|
746
|
-
"app_version",
|
|
747
|
-
"os_platform",
|
|
748
|
-
"node_major",
|
|
749
|
-
"install_flavor",
|
|
750
|
-
"is_bundled",
|
|
751
|
-
"is_dev_install"
|
|
752
|
-
]);
|
|
753
|
-
Object.freeze(["$release_id"]);
|
|
754
|
-
var TELEMETRY_KILL_SWITCH_FLAG = "telemetry-enabled";
|
|
755
|
-
var FeatureFlagsResponse = z.object({
|
|
756
|
-
flags: z.object({ [TELEMETRY_KILL_SWITCH_FLAG]: z.object({ enabled: z.boolean() }).passthrough().optional() }).passthrough(),
|
|
757
|
-
errorsWhileComputingFlags: z.boolean().optional()
|
|
758
|
-
}).passthrough();
|
|
759
|
-
var PendingCrashReport = z.object({
|
|
760
|
-
timestamp: z.string(),
|
|
761
|
-
properties: ExceptionProperties
|
|
762
|
-
}).strict();
|
|
763
|
-
var TelemetryState = z.object({
|
|
764
|
-
installId: z.uuid(),
|
|
765
|
-
noticeShownAt: z.string().nullable().optional(),
|
|
766
|
-
remoteDisabled: z.boolean().optional()
|
|
767
|
-
});
|
|
768
|
-
var viewerCols = z.number().int().min(1).max(500);
|
|
769
|
-
var viewerRows = z.number().int().min(1).max(200);
|
|
770
|
-
var DataClientMessage = z.discriminatedUnion("type", [
|
|
771
|
-
z.object({
|
|
772
|
-
type: z.literal("input"),
|
|
773
|
-
data: z.string()
|
|
774
|
-
}),
|
|
775
|
-
z.object({
|
|
776
|
-
type: z.literal("claim"),
|
|
777
|
-
cols: viewerCols,
|
|
778
|
-
rows: viewerRows
|
|
779
|
-
}),
|
|
780
|
-
z.object({ type: z.literal("unview") })
|
|
781
|
-
]);
|
|
782
|
-
z.object({
|
|
783
|
-
type: z.literal("pty-size"),
|
|
784
|
-
cols: viewerCols,
|
|
785
|
-
rows: viewerRows,
|
|
786
|
-
seq: z.number().int().nonnegative()
|
|
787
|
-
});
|
|
788
|
-
var DATA_ATTACH_HISTORY_PARAM = "history";
|
|
789
|
-
var DEEP_HISTORY_SCROLLBACK_LINES = 5e3;
|
|
790
|
-
var DataAttachHistory = z.enum(["screen", "deep"]);
|
|
791
|
-
function decodeJson(raw) {
|
|
792
|
-
try {
|
|
793
|
-
return JSON.parse(raw);
|
|
794
|
-
} catch {
|
|
795
|
-
return null;
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
function parseDataClientMessage(raw) {
|
|
799
|
-
const parsed = DataClientMessage.safeParse(decodeJson(raw));
|
|
800
|
-
if (!parsed.success) return null;
|
|
801
|
-
return parsed.data;
|
|
802
|
-
}
|
|
803
|
-
function parseDataAttachHistory(rawUrl) {
|
|
804
|
-
if (typeof rawUrl !== "string") return "screen";
|
|
805
|
-
const queryAt = rawUrl.indexOf("?");
|
|
806
|
-
if (queryAt === -1) return "screen";
|
|
807
|
-
const query = new URLSearchParams(rawUrl.slice(queryAt + 1).split("#")[0]);
|
|
808
|
-
const parsed = DataAttachHistory.safeParse(query.get(DATA_ATTACH_HISTORY_PARAM));
|
|
809
|
-
if (!parsed.success) return "screen";
|
|
810
|
-
return parsed.data;
|
|
811
|
-
}
|
|
812
|
-
//#endregion
|
|
813
|
-
//#region shared/contracts/hooks.ts
|
|
814
|
-
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
815
|
-
var HookPayload = z.record(z.string(), z.unknown());
|
|
816
|
-
var HookEnvelope = z.object({
|
|
817
|
-
glimmervoidId: z.string().min(1),
|
|
818
|
-
event: z.string().min(1),
|
|
819
|
-
token: z.string().nullable().optional(),
|
|
820
|
-
payload: HookPayload
|
|
821
|
-
});
|
|
822
|
-
z.object({
|
|
823
|
-
id: z.string().min(1),
|
|
824
|
-
name: z.string().min(1),
|
|
825
|
-
event: z.string().min(1),
|
|
826
|
-
matcher: z.string().optional(),
|
|
827
|
-
type: z.enum(["command", "http"]),
|
|
828
|
-
command: z.string().optional(),
|
|
829
|
-
url: z.string().optional(),
|
|
830
|
-
timeout: z.number().int().positive().optional(),
|
|
831
|
-
enabled: z.boolean(),
|
|
832
|
-
projects: z.array(z.string()).optional()
|
|
833
|
-
}).passthrough();
|
|
834
|
-
//#endregion
|
|
835
|
-
export { UPDATE_CHANNELS as C, normalizeLegacyConfigNumbers as E, POST_TURN_CHECK_MODES as S, USAGE_VENDOR_KEYS as T, PersistedTaskTitle as _, parseDataClientMessage as a, configIssueMessage as b, PendingCrashReport as c, TelemetryState as d, AGENT_ID_SHAPE_MESSAGE as f, ConfigUpdate as g, Config as h, parseDataAttachHistory as i, TELEMETRY_EVENT_SCHEMAS as l, BrowserConfig as m, HookEnvelope as n, DashboardTelemetryReport as o, BUILTIN_AGENT_IDS as p, DEEP_HISTORY_SCROLLBACK_LINES as r, FeatureFlagsResponse as s, HTTP_URL_RE as t, TELEMETRY_KILL_SWITCH_FLAG as u, RUNTIME_CONFIG_SCALAR_KEYS as v, USAGE_COST_MODES as w, BranchGcFileSettings as x, TASK_TITLE_SOURCE_PRIORITY as y };
|