glimmervoid 0.36.0 → 0.38.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 -84
- package/dist/bin/glimmervoid.js +54 -115
- package/dist/chunks/{adapters-BdnLyJjf.js → adapters-B-IkWl-r.js} +37 -15
- package/dist/chunks/adapters-Dt3vwxwY.js +1 -0
- package/dist/chunks/{agent-api-cli-DIqRLvu3.js → agent-api-cli-3hryuewm.js} +1 -1
- package/dist/chunks/{agent-api-cli-d-Bgsshx.js → agent-api-cli-BcZ9DLCF.js} +41 -12
- package/dist/chunks/{agent-api-core-BUC9WND7.js → agent-api-core--8WtU1xU.js} +88 -6
- package/dist/chunks/{agent-setup-cli-CH7EHsAX.js → agent-setup-cli-BixDoCkF.js} +2 -2
- package/dist/chunks/{config-CuZ16F9W.js → config-BHBZsCBc.js} +22 -16
- package/dist/chunks/config-store-DYj3wYgw.js +1 -0
- package/dist/chunks/{config-store-LqQ7MuyV.js → config-store-DbfMbz4j.js} +46 -69
- package/dist/chunks/{contracts-BLZAOP57.js → contracts-u40eJhaf.js} +66 -21
- package/dist/chunks/git-version-BpnTd8sU.js +139 -0
- package/dist/chunks/{grok-Ch4-35_r.js → grok-xFs6zIu4.js} +5 -1
- 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/{json-file-BaxGcB2R.js → json-file-CIJf0Cel.js} +190 -9
- package/dist/chunks/{knowledge-graph-cli-DD7QvcFd.js → knowledge-graph-cli-DcspNqhz.js} +1 -1
- package/dist/chunks/{loopback-post-DepQfdcM.js → loopback-post-DZK7YibD.js} +10 -10
- package/dist/chunks/{main-Rmo83Ow-.js → main-w01-P1oZ.js} +15186 -13134
- package/dist/chunks/{pair-cli-DzFeAmq5.js → pair-cli-BdoyrDCr.js} +2 -2
- package/dist/chunks/{remote-config-CPdSF2Xi.js → remote-config-61zJ0hME.js} +2 -2
- package/dist/chunks/{session-B8RhqQJe.js → session-8Pv0y1vz.js} +55 -9
- package/dist/chunks/{session-routes-DB5aDKsx.js → session-routes-D-GZC-Sy.js} +9 -9
- package/dist/chunks/{settings-cli-C2TY6hl-.js → settings-cli-DKJsm3AP.js} +3 -3
- package/dist/chunks/{ssh-sign-cli-C2nUwJC-.js → ssh-sign-cli-Dc2gOCwE.js} +2 -2
- package/dist/client/assets/index-BfqmOGgc.js +275 -0
- package/dist/client/assets/index-DxABp5yJ.css +1 -0
- package/dist/client/index.html +10 -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/statusline-relay.js +1 -1
- package/dist/session/visions-relay.js +7 -7
- package/package.json +4 -3
- package/scripts/recover-handoff.mjs +1 -1
- package/dist/chunks/adapters-BVozg-Lg.js +0 -1
- package/dist/chunks/config-store-tVmt_nfm.js +0 -1
- package/dist/chunks/git-version-CUcDtF5k.js +0 -58
- package/dist/chunks/sandbox-deps-CWiH1d1w.js +0 -70
- package/dist/client/assets/index-BIaSyXwH.css +0 -1
- package/dist/client/assets/index-Ddu7M4Ad.js +0 -259
|
@@ -3,10 +3,10 @@ import { r as execFileSync } from "./child-process-safe-CbQnyh7D.js";
|
|
|
3
3
|
import { n as resolveAgentCommand, t as buildAgentSpawnCommand } from "./spawn-command-Cc40FiZI.js";
|
|
4
4
|
import { s as rawTextOr } from "./coerce-NSst8oRP.js";
|
|
5
5
|
import { r as nextBackoffMs } from "./backoff-DjVpfHk7.js";
|
|
6
|
-
import { l as supervisionLine } from "./session-routes-
|
|
7
|
-
import { c as buildAgentEnv, i as isSpinnerChar, n as classifyAgentTitle, r as isBrailleChar, t as grok } from "./grok-
|
|
6
|
+
import { l as supervisionLine } from "./session-routes-D-GZC-Sy.js";
|
|
7
|
+
import { c as buildAgentEnv, i as isSpinnerChar, n as classifyAgentTitle, r as isBrailleChar, t as grok } from "./grok-xFs6zIu4.js";
|
|
8
8
|
import { t as buildHookCommand } from "./hook-command-core-qTNK-xMF.js";
|
|
9
|
-
import "./contracts-
|
|
9
|
+
import "./contracts-u40eJhaf.js";
|
|
10
10
|
import { n as mergeCodexPreToolUse, t as HOOK_TOOLS } from "./hook-tools-BkxllUHE.js";
|
|
11
11
|
import fs from "node:fs";
|
|
12
12
|
import path from "node:path";
|
|
@@ -152,10 +152,10 @@ var APPENDED_SYSTEM_PROMPT_FLAGS = Object.freeze([APPEND_SYSTEM_PROMPT_FLAG, "--
|
|
|
152
152
|
function isAppendedSystemPromptArgument(launchArgument) {
|
|
153
153
|
return APPENDED_SYSTEM_PROMPT_FLAGS.some((flag) => launchArgument === flag || launchArgument.startsWith(`${flag}=`));
|
|
154
154
|
}
|
|
155
|
-
function buildArgs$1({ dangerouslySkipPermissions = false, resumeSessionId = null, extraArgs = [], initialPrompt = null,
|
|
155
|
+
function buildArgs$1({ dangerouslySkipPermissions = false, resumeSessionId = null, extraArgs = [], initialPrompt = null, hasOuterGuardrails = false, canRunHelpCommand = true } = {}) {
|
|
156
156
|
const args = dangerouslySkipPermissions ? ["--dangerously-skip-permissions"] : [];
|
|
157
157
|
if (resumeSessionId) args.push("--resume", resumeSessionId);
|
|
158
|
-
if (canRunHelpCommand && !extraArgs.some(isAppendedSystemPromptArgument)) args.push(APPEND_SYSTEM_PROMPT_FLAG, supervisionLine({
|
|
158
|
+
if (canRunHelpCommand && !extraArgs.some(isAppendedSystemPromptArgument)) args.push(APPEND_SYSTEM_PROMPT_FLAG, supervisionLine({ isGuarded: hasOuterGuardrails }));
|
|
159
159
|
for (let index = 0; index < extraArgs.length; index += 1) {
|
|
160
160
|
const argument = extraArgs[index];
|
|
161
161
|
if (resumeSessionId && argument === "--session-id") {
|
|
@@ -211,6 +211,21 @@ function laneSpendStatus({ isTrackingEnabled, scan }) {
|
|
|
211
211
|
if (!scan.isHistoryCaughtUp || scan.lastOutcome === null) return "catching-up";
|
|
212
212
|
return "known";
|
|
213
213
|
}
|
|
214
|
+
function scopedClaudeRoots(scopeDirs, claudeDirs) {
|
|
215
|
+
if (!scopeDirs || scopeDirs.length === 0) return null;
|
|
216
|
+
const isInside = (candidate, parent) => candidate.startsWith(`${parent}${path.sep}`);
|
|
217
|
+
const roots = [];
|
|
218
|
+
for (const scopeDir of [...new Set(scopeDirs.map((dir) => path.resolve(dir)))].sort((left, right) => left.length - right.length)) {
|
|
219
|
+
if (!claudeDirs.some((claudeDir) => isInside(scopeDir, claudeDir))) return null;
|
|
220
|
+
if (roots.some((root) => isInside(scopeDir, root))) continue;
|
|
221
|
+
roots.push(scopeDir);
|
|
222
|
+
}
|
|
223
|
+
return roots.map((dir) => ({
|
|
224
|
+
vendor: "claude",
|
|
225
|
+
dir,
|
|
226
|
+
kind: "active"
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
214
229
|
function decideFileRead(prior, stat) {
|
|
215
230
|
if (!prior) return {
|
|
216
231
|
action: "restart",
|
|
@@ -455,6 +470,9 @@ function mayContributeHooks(configText) {
|
|
|
455
470
|
if (typeof configText !== "string") return false;
|
|
456
471
|
return HOOKS_DECLARATION_RE.test(configText);
|
|
457
472
|
}
|
|
473
|
+
function userConfigFolders(env) {
|
|
474
|
+
return codexHomes(env, null);
|
|
475
|
+
}
|
|
458
476
|
function buildHookArgs({ relayPath = RELAY_PATH, events = HOOK_EVENTS, bypassHookTrust = false, hookTools = [], hookToolRelayPath = HOOK_TOOL_RELAY_PATH } = {}) {
|
|
459
477
|
const args = bypassHookTrust ? [TRUST_BYPASS_FLAG] : [];
|
|
460
478
|
const preToolUseGroups = [];
|
|
@@ -484,6 +502,7 @@ var hooks = {
|
|
|
484
502
|
events: HOOK_EVENTS,
|
|
485
503
|
buildHookArgs,
|
|
486
504
|
projectConfigCandidates: PROJECT_CONFIG_CANDIDATES,
|
|
505
|
+
userConfigFolders,
|
|
487
506
|
mayContributeHooks
|
|
488
507
|
}
|
|
489
508
|
};
|
|
@@ -513,15 +532,15 @@ var SKIP_PERMISSIONS_ARGS = [
|
|
|
513
532
|
"-s",
|
|
514
533
|
"workspace-write"
|
|
515
534
|
];
|
|
516
|
-
var
|
|
517
|
-
var
|
|
535
|
+
var OUTER_GUARDRAILS_ARGS = ["-s", "danger-full-access"];
|
|
536
|
+
var OUTER_GUARDRAILS_SKIP_PERMISSIONS_ARGS = [
|
|
518
537
|
"-a",
|
|
519
538
|
"never",
|
|
520
|
-
...
|
|
539
|
+
...OUTER_GUARDRAILS_ARGS
|
|
521
540
|
];
|
|
522
|
-
function permissionArgs(dangerouslySkipPermissions,
|
|
523
|
-
if (
|
|
524
|
-
if (
|
|
541
|
+
function permissionArgs(dangerouslySkipPermissions, hasOuterGuardrails) {
|
|
542
|
+
if (hasOuterGuardrails && dangerouslySkipPermissions) return OUTER_GUARDRAILS_SKIP_PERMISSIONS_ARGS;
|
|
543
|
+
if (hasOuterGuardrails) return OUTER_GUARDRAILS_ARGS;
|
|
525
544
|
if (dangerouslySkipPermissions) return SKIP_PERMISSIONS_ARGS;
|
|
526
545
|
return [];
|
|
527
546
|
}
|
|
@@ -539,11 +558,11 @@ function setsOperatorInstructions(operatorConfigText) {
|
|
|
539
558
|
function isDeveloperInstructionsOverride(launchArgument) {
|
|
540
559
|
return launchArgument.startsWith(`${DEVELOPER_INSTRUCTIONS_KEY}=`);
|
|
541
560
|
}
|
|
542
|
-
function buildArgs({ dangerouslySkipPermissions = false, resumeSessionId = null, extraArgs = [], initialPrompt = null,
|
|
561
|
+
function buildArgs({ dangerouslySkipPermissions = false, resumeSessionId = null, extraArgs = [], initialPrompt = null, hasOuterGuardrails = false, hasOperatorInstructions = false, canRunHelpCommand = true } = {}) {
|
|
543
562
|
const args = [...UPDATE_CHECK_ARGS];
|
|
544
|
-
if (canRunHelpCommand && !hasOperatorInstructions && !extraArgs.some(isDeveloperInstructionsOverride)) args.push("-c", `${DEVELOPER_INSTRUCTIONS_KEY}='''${supervisionLine({
|
|
563
|
+
if (canRunHelpCommand && !hasOperatorInstructions && !extraArgs.some(isDeveloperInstructionsOverride)) args.push("-c", `${DEVELOPER_INSTRUCTIONS_KEY}='''${supervisionLine({ isGuarded: hasOuterGuardrails })}'''`);
|
|
545
564
|
if (resumeSessionId) args.push("resume", resumeSessionId);
|
|
546
|
-
args.push(...permissionArgs(dangerouslySkipPermissions,
|
|
565
|
+
args.push(...permissionArgs(dangerouslySkipPermissions, hasOuterGuardrails));
|
|
547
566
|
if (extraArgs.length > 0) args.push(...extraArgs);
|
|
548
567
|
if (initialPrompt != null) args.push(initialPrompt);
|
|
549
568
|
return args;
|
|
@@ -767,5 +786,8 @@ function cachedAgentResolvability(agentId) {
|
|
|
767
786
|
resolvable: !!cached.path
|
|
768
787
|
};
|
|
769
788
|
}
|
|
789
|
+
function resetCommandCache() {
|
|
790
|
+
resolvedCommands.clear();
|
|
791
|
+
}
|
|
770
792
|
//#endregion
|
|
771
|
-
export {
|
|
793
|
+
export { shouldPersistWarehouse as A, isUsageFile as C, resolveProjectsDirs as D, projectDirCandidates as E, claudeCode as M, scopedClaudeRoots as O, grokRootCandidates as S, passOutcome as T, continuationDelayMs as _, describeAgentResolvability as a, expandTilde as b, isKnownAgentId as c, resolveAdapter as d, setCustomAgents as f, codexSessionIdFromPath as g, codexRootCandidates as h, customAgentFingerprint as i, splitLines as j, shouldEvaluateDespiteIoFailures as k, listAgentIds as l, codexHomes as m, cachedAgentResolvability as n, getAdapter as o, codexFallbackRoots as p, commandFor as r, hookProfileOf as s, DEFAULT_AGENT_ID as t, resetCommandCache as u, decideFileRead as v, laneSpendStatus as w, grokHomes as x, dedupeCodexFiles as y };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-B-IkWl-r.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as runAgentApiCli, r as sessionLimitsHelpLines } from "./agent-api-cli-
|
|
1
|
+
export { n as runAgentApiCli, r as sessionLimitsHelpLines } from "./agent-api-cli-BcZ9DLCF.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as errorCode } from "./text-DoirglWV.js";
|
|
2
|
-
import { a as AgentDispatchRequest,
|
|
2
|
+
import { a as AgentDispatchRequest, c as AgentFactoryStatusRequest, d as AgentTicketRequest, l as AgentLimitsReply, n as AGENT_URL_ENV, s as AgentFactoryRetryRequest } from "./session-8Pv0y1vz.js";
|
|
3
3
|
import { i as resolveHookTarget } from "./hook-relay-core-DA_bz2KA.js";
|
|
4
|
-
import { n as
|
|
4
|
+
import { n as decideGuardrailsProxy } from "./guardrails-proxy-core-BI3rdY-m.js";
|
|
5
5
|
import { t as parseJsonOrNull } from "./json-core-dfa_7Fak.js";
|
|
6
|
-
import { a as formatSessionLimits } from "./session-routes-
|
|
7
|
-
import {
|
|
6
|
+
import { a as formatSessionLimits } from "./session-routes-D-GZC-Sy.js";
|
|
7
|
+
import { m as isOrchestratorAgentVerb, p as isAgentApiVerb } from "./agent-api-core--8WtU1xU.js";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import http from "node:http";
|
|
10
10
|
//#region server/agent-api-cli.ts
|
|
@@ -36,7 +36,18 @@ var BODY_BUILDERS = {
|
|
|
36
36
|
return parsed.success ? parsed.data : null;
|
|
37
37
|
},
|
|
38
38
|
reopen: (rest) => ticketBody(rest),
|
|
39
|
-
cancel: (rest) => ticketBody(rest)
|
|
39
|
+
cancel: (rest) => ticketBody(rest),
|
|
40
|
+
"factory-status": (rest) => {
|
|
41
|
+
if (rest.length === 0) return {};
|
|
42
|
+
if (rest.length !== 2 || rest[0] !== "--project") return null;
|
|
43
|
+
const parsed = AgentFactoryStatusRequest.safeParse({ projectId: rest[1] });
|
|
44
|
+
return parsed.success ? parsed.data : null;
|
|
45
|
+
},
|
|
46
|
+
"factory-retry": (rest) => {
|
|
47
|
+
if (rest.length !== 1) return null;
|
|
48
|
+
const parsed = AgentFactoryRetryRequest.safeParse({ intentId: rest[0] });
|
|
49
|
+
return parsed.success ? parsed.data : null;
|
|
50
|
+
}
|
|
40
51
|
};
|
|
41
52
|
function bodySaysOk(text) {
|
|
42
53
|
try {
|
|
@@ -52,6 +63,13 @@ function limitsLines(replyText) {
|
|
|
52
63
|
return formatSessionLimits(limits.data);
|
|
53
64
|
}
|
|
54
65
|
function printableReply(verb, replyText) {
|
|
66
|
+
if (verb === "factory-status" || verb === "factory-retry") {
|
|
67
|
+
const reply = parseJsonOrNull(replyText);
|
|
68
|
+
if (typeof reply !== "object" || reply === null) return replyText;
|
|
69
|
+
if ("text" in reply && typeof reply.text === "string") return reply.text;
|
|
70
|
+
if ("error" in reply && typeof reply.error === "string") return reply.error;
|
|
71
|
+
return replyText;
|
|
72
|
+
}
|
|
55
73
|
if (verb !== "limits") return replyText;
|
|
56
74
|
return limitsLines(replyText)?.join("\n") ?? replyText;
|
|
57
75
|
}
|
|
@@ -79,12 +97,12 @@ async function postDirectly({ endpoint, headers, bodyText, deadline }) {
|
|
|
79
97
|
text: await response.text()
|
|
80
98
|
};
|
|
81
99
|
}
|
|
82
|
-
function
|
|
83
|
-
const proxyHeaders =
|
|
100
|
+
function postThroughGuardrailsProxy(guardrailsProxy, { endpoint, headers, bodyText, deadline }) {
|
|
101
|
+
const proxyHeaders = guardrailsProxy.authorization ? { "proxy-authorization": guardrailsProxy.authorization } : {};
|
|
84
102
|
return new Promise((resolve, reject) => {
|
|
85
103
|
const request = http.request({
|
|
86
|
-
host:
|
|
87
|
-
port:
|
|
104
|
+
host: guardrailsProxy.hostname,
|
|
105
|
+
port: guardrailsProxy.port,
|
|
88
106
|
method: "POST",
|
|
89
107
|
path: endpoint.href,
|
|
90
108
|
headers: {
|
|
@@ -129,9 +147,9 @@ async function postToAgentIngress({ endpoint, token, body, deadline = null }) {
|
|
|
129
147
|
return await postDirectly(post);
|
|
130
148
|
} catch (error) {
|
|
131
149
|
if (!wasConnectionRefused(error)) throw error;
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
134
|
-
return
|
|
150
|
+
const guardrailsProxy = decideGuardrailsProxy(process.env);
|
|
151
|
+
if (!guardrailsProxy) throw error;
|
|
152
|
+
return postThroughGuardrailsProxy(guardrailsProxy, post);
|
|
135
153
|
}
|
|
136
154
|
}
|
|
137
155
|
async function sessionLimitsHelpLines({ timeoutMs = HELP_LIMITS_TIMEOUT_MS } = {}) {
|
|
@@ -151,6 +169,13 @@ async function sessionLimitsHelpLines({ timeoutMs = HELP_LIMITS_TIMEOUT_MS } = {
|
|
|
151
169
|
}
|
|
152
170
|
}
|
|
153
171
|
async function runAgentApiCli(args) {
|
|
172
|
+
if (args[0] === "factory") {
|
|
173
|
+
if (args[1] !== "status" && args[1] !== "retry") {
|
|
174
|
+
console.error("glimmervoid factory: expected status [--project <projectId>] or retry <intentId>");
|
|
175
|
+
return 1;
|
|
176
|
+
}
|
|
177
|
+
return runAgentApiCli([`factory-${args[1]}`, ...args.slice(2)]);
|
|
178
|
+
}
|
|
154
179
|
const verb = args[0];
|
|
155
180
|
if (!verb || !isAgentApiVerb(verb)) {
|
|
156
181
|
console.error(`glimmervoid: ${verb || "that"} is not an agent command`);
|
|
@@ -158,6 +183,10 @@ async function runAgentApiCli(args) {
|
|
|
158
183
|
}
|
|
159
184
|
const body = BODY_BUILDERS[verb](args.slice(1));
|
|
160
185
|
if (!body) {
|
|
186
|
+
if (verb === "factory-status" || verb === "factory-retry") {
|
|
187
|
+
console.error(`glimmervoid factory: expected ${verb === "factory-status" ? "status [--project <projectId>]" : "retry <intentId>"}`);
|
|
188
|
+
return 1;
|
|
189
|
+
}
|
|
161
190
|
if (isOrchestratorAgentVerb(verb)) {
|
|
162
191
|
console.error(`glimmervoid ${verb}: expected a work id matching wrk-[0-9a-f]{16}`);
|
|
163
192
|
return 1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as spawnRoute, i as editRoute, n as attentionRoute, s as pushRoute, t as NO_OWN_WORKTREE_REASON } from "./session-routes-
|
|
1
|
+
import { c as AgentFactoryStatusRequest, i as AgentAttentionRequest, o as AgentEditRequest, s as AgentFactoryRetryRequest, t as AGENT_API_VERBS, u as AgentSpawnRequest, y as ORCHESTRATOR_AGENT_VERBS } from "./session-8Pv0y1vz.js";
|
|
2
|
+
import { c as spawnRoute, i as editRoute, n as attentionRoute, s as pushRoute, t as NO_OWN_WORKTREE_REASON } from "./session-routes-D-GZC-Sy.js";
|
|
3
3
|
import crypto from "node:crypto";
|
|
4
4
|
var MAX_SPAWNS_IN_FLIGHT = 1;
|
|
5
5
|
var SPAWNABLE_DEPTH = 0;
|
|
@@ -77,6 +77,16 @@ function decideAttentionAllowance(caller) {
|
|
|
77
77
|
function decideEditAllowance(caller) {
|
|
78
78
|
return refuseByRole(editRoute(caller));
|
|
79
79
|
}
|
|
80
|
+
function factoryControlRoute({ factoryRole, isEphemeral, isSpawnedChild }) {
|
|
81
|
+
if (!(factoryRole !== null || isEphemeral && !isSpawnedChild)) return { answers: true };
|
|
82
|
+
return {
|
|
83
|
+
answers: false,
|
|
84
|
+
reason: "only an operator session or a session it spawned may read factory status or retry parked work, so factory and lane sessions stay on their own task"
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function decideFactoryControlAllowance(caller) {
|
|
88
|
+
return refuseByRole(factoryControlRoute(caller));
|
|
89
|
+
}
|
|
80
90
|
function describePushRouteRefusal(caller) {
|
|
81
91
|
const route = pushRoute(caller);
|
|
82
92
|
if (route.answers) return null;
|
|
@@ -137,8 +147,17 @@ function parseAgentVerb(verb, payload) {
|
|
|
137
147
|
status: 404,
|
|
138
148
|
error: REFUSAL_REASON
|
|
139
149
|
};
|
|
140
|
-
if (verb === "
|
|
141
|
-
const parsed =
|
|
150
|
+
if (verb === "factory-status") {
|
|
151
|
+
const parsed = AgentFactoryStatusRequest.safeParse(payload);
|
|
152
|
+
if (!parsed.success) return refuseInvalidBody(parsed.error.issues);
|
|
153
|
+
return {
|
|
154
|
+
ok: true,
|
|
155
|
+
verb,
|
|
156
|
+
request: parsed.data
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (verb === "factory-retry") {
|
|
160
|
+
const parsed = AgentFactoryRetryRequest.safeParse(payload);
|
|
142
161
|
if (!parsed.success) return refuseInvalidBody(parsed.error.issues);
|
|
143
162
|
return {
|
|
144
163
|
ok: true,
|
|
@@ -146,7 +165,7 @@ function parseAgentVerb(verb, payload) {
|
|
|
146
165
|
request: parsed.data
|
|
147
166
|
};
|
|
148
167
|
}
|
|
149
|
-
if (verb
|
|
168
|
+
if (isOrchestratorAgentVerb(verb)) return {
|
|
150
169
|
ok: false,
|
|
151
170
|
status: 403,
|
|
152
171
|
error: `${verb} requires a live factory orchestrator`
|
|
@@ -223,5 +242,68 @@ function deriveChildSessionName(parentName, existingNames) {
|
|
|
223
242
|
}
|
|
224
243
|
return candidate;
|
|
225
244
|
}
|
|
245
|
+
function factoryTicketNextAction(ticket, intentId) {
|
|
246
|
+
if (ticket.state === "completed" || ticket.state === "cancelled") return "none";
|
|
247
|
+
if (ticket.parked) return `glimmervoid factory retry ${intentId}`;
|
|
248
|
+
if (ticket.state === "blocked") return "orchestrator reopens";
|
|
249
|
+
return "in progress";
|
|
250
|
+
}
|
|
251
|
+
function describeFactoryProjectUnavailability(project) {
|
|
252
|
+
if (project.error !== null) return project.error;
|
|
253
|
+
if (project.heading.action === "refuse") return `orientation refused: ${project.heading.reasons.join("; ") || "no reason given"}`;
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
function describeUnavailableFactoryState(projects) {
|
|
257
|
+
for (const project of projects) {
|
|
258
|
+
const unavailability = describeFactoryProjectUnavailability(project);
|
|
259
|
+
if (unavailability !== null) return `Factory state for ${project.projectId} is unavailable: ${unavailability}`;
|
|
260
|
+
}
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
function describeSpentToday(spentTodayUsd) {
|
|
264
|
+
if (spentTodayUsd === void 0) return "unknown";
|
|
265
|
+
return `$${spentTodayUsd.toFixed(2)}`;
|
|
266
|
+
}
|
|
267
|
+
function describeDailyBudget(dailyBudgetUsd) {
|
|
268
|
+
if (dailyBudgetUsd === null) return "unlimited";
|
|
269
|
+
if (dailyBudgetUsd === void 0) return "unknown";
|
|
270
|
+
return `$${dailyBudgetUsd.toFixed(2)}`;
|
|
271
|
+
}
|
|
272
|
+
function formatFactoryStatus(projects, buildDigest) {
|
|
273
|
+
const lines = [];
|
|
274
|
+
for (const project of projects) {
|
|
275
|
+
lines.push(`Project ${project.projectId}: ${project.projectName}`);
|
|
276
|
+
lines.push(`Project spend today: ${describeSpentToday(project.spentTodayUsd)} of ${describeDailyBudget(project.dailyBudgetUsd)} budget`);
|
|
277
|
+
const unavailability = describeFactoryProjectUnavailability(project);
|
|
278
|
+
if (unavailability !== null) lines.push(`Factory exception: ${unavailability}`);
|
|
279
|
+
const ticketsByIntentId = /* @__PURE__ */ new Map();
|
|
280
|
+
const partialIntentIds = new Set(project.partialIntentIds ?? []);
|
|
281
|
+
for (const order of project.orders) {
|
|
282
|
+
if (order.parent === null) continue;
|
|
283
|
+
const tickets = ticketsByIntentId.get(order.parent) ?? [];
|
|
284
|
+
tickets.push(order);
|
|
285
|
+
ticketsByIntentId.set(order.parent, tickets);
|
|
286
|
+
}
|
|
287
|
+
let intentCount = 0;
|
|
288
|
+
for (const intent of project.orders) {
|
|
289
|
+
if (intent.parent !== null || intent.state === "cancelled") continue;
|
|
290
|
+
intentCount += 1;
|
|
291
|
+
const tickets = ticketsByIntentId.get(intent.id) ?? [];
|
|
292
|
+
const digest = buildDigest({
|
|
293
|
+
...project,
|
|
294
|
+
orders: [intent, ...tickets],
|
|
295
|
+
partialIntentIds: partialIntentIds.has(intent.id) ? [intent.id] : []
|
|
296
|
+
}, intent.id);
|
|
297
|
+
const outcome = intent.state === "completed" ? "completed" : digest.isPartial ? "partial" : "in progress";
|
|
298
|
+
lines.push(`Intent ${intent.id}: ${intent.objective}`, `Outcome: ${outcome}; merged: ${digest.merged.length}; parked: ${digest.parked.length}`);
|
|
299
|
+
for (const ticket of tickets) lines.push(` ${ticket.id} | state: ${ticket.parked ? "parked" : ticket.state} | blocks: ${ticket.blockCount ?? 0} | last reason: ${ticket.blockReason ?? "none"} | next action: ${factoryTicketNextAction(ticket, intent.id)}`);
|
|
300
|
+
lines.push("Confirmed flakes:");
|
|
301
|
+
for (const flake of digest.confirmedFlakes) lines.push(` ${flake}`);
|
|
302
|
+
if (digest.confirmedFlakes.length === 0) lines.push(" none");
|
|
303
|
+
}
|
|
304
|
+
if (intentCount === 0 && unavailability === null) lines.push("No intents.");
|
|
305
|
+
}
|
|
306
|
+
return lines.join("\n") || "No factory projects.";
|
|
307
|
+
}
|
|
226
308
|
//#endregion
|
|
227
|
-
export {
|
|
309
|
+
export { decideFactoryControlAllowance as a, deriveChildSessionName as c, describeUnavailableFactoryState as d, formatFactoryStatus as f, parseAgentVerb as h, decideEditAllowance as i, describePushLanding as l, isOrchestratorAgentVerb as m, decideAgentRequest as n, decideSpawnAllowance as o, isAgentApiVerb as p, decideAttentionAllowance as r, decideTicketAction as s, REFUSAL_REASON as t, describePushRouteRefusal as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as isMissingFileError, r as errorMessage } from "./text-DoirglWV.js";
|
|
2
|
-
import { a as classifyGrokHooksFile, o as renderGrokHooksFile, t as grok } from "./grok-
|
|
3
|
-
import { p as writeTextAtomicSync } from "./json-file-
|
|
2
|
+
import { a as classifyGrokHooksFile, o as renderGrokHooksFile, t as grok } from "./grok-xFs6zIu4.js";
|
|
3
|
+
import { p as writeTextAtomicSync } from "./json-file-CIJf0Cel.js";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
//#region server/agent-setup-cli.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as repositoryName, Ft as repoParts, K as MyPrSearchNode, Mt as GH_SEGMENT, N as TaskTitle, Q as SessionPrLinks, et as CommitSha } from "./session-8Pv0y1vz.js";
|
|
2
2
|
import { n as isRecord } from "./coerce-NSst8oRP.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -99,7 +99,8 @@ var CoherenceWorkInspect = z.looseObject({
|
|
|
99
99
|
last: z.looseObject({
|
|
100
100
|
event: z.string(),
|
|
101
101
|
at: z.string(),
|
|
102
|
-
session: z.string()
|
|
102
|
+
session: z.string(),
|
|
103
|
+
reason: z.string().optional()
|
|
103
104
|
}).nullable(),
|
|
104
105
|
opened: z.looseObject({
|
|
105
106
|
at: z.iso.datetime(),
|
|
@@ -177,6 +178,10 @@ var REPLAY_BUFFER_KB_RANGE = Object.freeze({
|
|
|
177
178
|
min: 64,
|
|
178
179
|
max: 16384
|
|
179
180
|
});
|
|
181
|
+
var MEMORY_RESERVE_MB_RANGE = Object.freeze({
|
|
182
|
+
min: 0,
|
|
183
|
+
max: 65536
|
|
184
|
+
});
|
|
180
185
|
var PORT_RANGE = Object.freeze({
|
|
181
186
|
min: 0,
|
|
182
187
|
max: 65535
|
|
@@ -279,6 +284,7 @@ Object.freeze({
|
|
|
279
284
|
POSTHOG_TRAFFIC_MIN_USERS_RANGE,
|
|
280
285
|
POSTHOG_TRAFFIC_MULTIPLIER_RANGE,
|
|
281
286
|
REPLAY_BUFFER_KB_RANGE,
|
|
287
|
+
MEMORY_RESERVE_MB_RANGE,
|
|
282
288
|
TASK_TITLE_TIMEOUT_RANGE,
|
|
283
289
|
USAGE_BUDGET_RANGE,
|
|
284
290
|
USAGE_RETAIN_DAYS_RANGE,
|
|
@@ -696,28 +702,27 @@ var IngestSettings = z.object({ enabled: optionalBoolean("ingest.enabled") }, {
|
|
|
696
702
|
var TraceSettings = z.object({ enabled: optionalBoolean("trace.enabled") }, { error: "trace must be an object" }).optional();
|
|
697
703
|
var PlanReviewSettings = z.object({ enabled: optionalBoolean("planReview.enabled") }, { error: "planReview must be an object" }).optional();
|
|
698
704
|
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();
|
|
699
|
-
var
|
|
705
|
+
var guardrailsShape = {
|
|
700
706
|
unguardedRepos: optionalPathList("guardrails.unguardedRepos"),
|
|
701
707
|
blockedPaths: optionalPathList("guardrails.blockedPaths"),
|
|
702
708
|
unreadablePaths: optionalPathList("guardrails.unreadablePaths")
|
|
703
709
|
};
|
|
704
710
|
var isHomeRelativePath = (entry) => entry === "~" || entry.startsWith("~/") || entry.startsWith("~\\");
|
|
705
|
-
var
|
|
706
|
-
...
|
|
711
|
+
var createGuardrailsSettings = (isAbsolutePath) => z.object({
|
|
712
|
+
...guardrailsShape,
|
|
707
713
|
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()
|
|
708
714
|
}, { error: "guardrails must be an object" }).strict().optional();
|
|
709
|
-
var
|
|
715
|
+
var GuardrailsFileSettings = z.object(guardrailsShape, { error: "guardrails must be an object" }).passthrough().optional();
|
|
710
716
|
var telemetryShape = { enabled: optionalBoolean("telemetry.enabled") };
|
|
711
717
|
var TelemetrySettings = z.object(telemetryShape, { error: "telemetry must be an object" }).strict().optional();
|
|
712
718
|
var TelemetryFileSettings = z.object(telemetryShape, { error: "telemetry must be an object" }).passthrough().optional();
|
|
713
719
|
var createBrowserConfigShape = (isAbsolutePath) => ({
|
|
714
720
|
port: z.number().int().min(PORT_RANGE.min).max(PORT_RANGE.max).optional(),
|
|
715
|
-
autoRecoverSeconds: z.number().finite().nonnegative().optional(),
|
|
716
|
-
inputGraceSeconds: z.number().finite().nonnegative().optional(),
|
|
717
|
-
promptDetectionMs: z.number().finite().nonnegative().optional(),
|
|
718
721
|
notifyDebounceMs: z.number().finite().nonnegative().optional(),
|
|
719
722
|
phoneEscalationMs: z.number().finite().nonnegative().optional(),
|
|
720
723
|
replayBufferKB: optionalWholeNumber("replayBufferKB", REPLAY_BUFFER_KB_RANGE),
|
|
724
|
+
sessionMemoryReserveMB: optionalWholeNumber("sessionMemoryReserveMB", MEMORY_RESERVE_MB_RANGE),
|
|
725
|
+
checkMemoryReserveMB: optionalWholeNumber("checkMemoryReserveMB", MEMORY_RESERVE_MB_RANGE),
|
|
721
726
|
cursorBlink: optionalBoolean("cursorBlink"),
|
|
722
727
|
debugMode: optionalBoolean("debugMode"),
|
|
723
728
|
conversationView: optionalBoolean("conversationView"),
|
|
@@ -749,7 +754,7 @@ var createBrowserConfigShape = (isAbsolutePath) => ({
|
|
|
749
754
|
usage: createUsageSettings(isAbsolutePath),
|
|
750
755
|
telegram: TelegramSettings,
|
|
751
756
|
ingest: IngestSettings,
|
|
752
|
-
guardrails:
|
|
757
|
+
guardrails: createGuardrailsSettings(isAbsolutePath),
|
|
753
758
|
telemetry: TelemetrySettings,
|
|
754
759
|
workflows: WorkflowsSettings.nullable().optional()
|
|
755
760
|
});
|
|
@@ -760,9 +765,6 @@ var BrowserConfig = createBrowserConfig(path.isAbsolute);
|
|
|
760
765
|
var BROWSER_CONFIG_SHAPE = BrowserConfig.shape;
|
|
761
766
|
var ConfigUpdate = z.object({
|
|
762
767
|
...BROWSER_CONFIG_SHAPE,
|
|
763
|
-
autoRecoverSeconds: z.number({ error: "autoRecoverSeconds must be a positive number" }).finite().positive({ error: "autoRecoverSeconds must be a positive number" }).optional(),
|
|
764
|
-
inputGraceSeconds: z.number({ error: "inputGraceSeconds must be a positive number" }).finite().positive({ error: "inputGraceSeconds must be a positive number" }).optional(),
|
|
765
|
-
promptDetectionMs: z.number({ error: "promptDetectionMs must be a positive number" }).finite().positive({ error: "promptDetectionMs must be a positive number" }).optional(),
|
|
766
768
|
notifyDebounceMs: z.number({ error: "notifyDebounceMs must be a positive number" }).finite().positive({ error: "notifyDebounceMs must be a positive number" }).optional(),
|
|
767
769
|
phoneEscalationMs: z.number({ error: "phoneEscalationMs must be a positive number" }).finite().positive({ error: "phoneEscalationMs must be a positive number" }).optional(),
|
|
768
770
|
branchGc: BranchGcControlSettings,
|
|
@@ -866,7 +868,11 @@ var ProjectConfig = z.object({
|
|
|
866
868
|
codexBypassHookTrust: z.boolean().optional(),
|
|
867
869
|
conversationView: z.boolean({ error: "projects[].conversationView must be a boolean" }).optional(),
|
|
868
870
|
dangerouslySkipPermissions: z.boolean({ error: "projects[].dangerouslySkipPermissions must be a boolean" }).optional(),
|
|
869
|
-
unguarded: z.boolean({ error: "projects[].unguarded must be a boolean" }).optional()
|
|
871
|
+
unguarded: z.boolean({ error: "projects[].unguarded must be a boolean" }).optional(),
|
|
872
|
+
factoryProfile: FactorySettings.unwrap().unwrap().extend({
|
|
873
|
+
focusedTestCommand: z.string().trim().min(1).optional(),
|
|
874
|
+
widenableScopes: z.array(z.string().trim().min(1)).optional()
|
|
875
|
+
}).optional()
|
|
870
876
|
}).passthrough();
|
|
871
877
|
var FILE_CONFIG_SHAPE = {
|
|
872
878
|
...BROWSER_CONFIG_SHAPE,
|
|
@@ -884,7 +890,7 @@ var FILE_CONFIG_SHAPE = {
|
|
|
884
890
|
telegram: optionalLooseObject("telegram"),
|
|
885
891
|
ingest: optionalLooseObject("ingest"),
|
|
886
892
|
workflows: optionalLooseObject("workflows"),
|
|
887
|
-
guardrails:
|
|
893
|
+
guardrails: GuardrailsFileSettings,
|
|
888
894
|
telemetry: TelemetryFileSettings,
|
|
889
895
|
trace: TraceSettings,
|
|
890
896
|
planReview: PlanReviewSettings,
|
|
@@ -968,4 +974,4 @@ function configIssueMessage(error) {
|
|
|
968
974
|
return error.issues[0]?.message || "settings are invalid";
|
|
969
975
|
}
|
|
970
976
|
//#endregion
|
|
971
|
-
export {
|
|
977
|
+
export { CoherenceWorkCreated as $, FLYING_ANIMALS_GAP_RANGE as A, POSTHOG_TRAFFIC_MULTIPLIER_RANGE as B, USAGE_COST_MODES as C, FACTORY_MAX_LIVE_WORKERS_RANGE as D, CHANGE_MAP_NARRATOR_TIMEOUT_RANGE as E, PORT_RANGE as F, USAGE_RETAIN_DAYS_RANGE as G, TASK_TITLE_TIMEOUT_RANGE as H, POSITIVE_NUMBER_RANGE as I, WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE as J, USAGE_SCAN_INTERVAL_RANGE as K, POSTHOG_FIX_TIMEOUT_RANGE as L, KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE as M, MEMORY_RESERVE_MB_RANGE as N, FLYING_ANIMALS_DEFAULTS as O, NON_NEGATIVE_NUMBER_RANGE as P, CoherenceTicketCreated as Q, POSTHOG_TRAFFIC_BASELINE_RANGE as R, WorkflowsState as S, normalizeLegacyConfigNumbers as T, USAGE_BUDGET_RANGE as U, REPLAY_BUFFER_KB_RANGE as V, USAGE_INTEGER_RANGES as W, CoherenceReadiness as X, CoherenceOrient as Y, CoherenceRisk as Z, UPDATE_CHANNELS as _, ConfigUpdate as a, WorkflowSearchNode as b, RUNTIME_CONFIG_SCALAR_KEYS as c, BranchGcFileSettings as d, CoherenceWorkInspect as et, CHANGE_MAP_NARRATOR_ENGINES as f, POST_TURN_CHECK_MODES as g, FactorySettings as h, Config as i, FLYING_ANIMALS_SCALE_RANGE as j, FLYING_ANIMALS_DURATION_RANGE as k, TASK_TITLE_SOURCE_PRIORITY as l, DEFAULT_FACTORY_PROTECTED_PATHS as m, BUILTIN_AGENT_IDS as n, PersistedTaskTitle as o, DEFAULT_FACTORY_CHECKS as p, WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE as q, BrowserConfig as r, ProjectConfig as s, AGENT_ID_SHAPE_MESSAGE as t, CoherenceWorkState as tt, configIssueMessage as u, WorkflowCommentBody as v, USAGE_VENDOR_KEYS as w, WorkflowsSettings as x, WorkflowLabelName as y, POSTHOG_TRAFFIC_MIN_USERS_RANGE as z };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { s as loadConfigFile } from "./config-store-DbfMbz4j.js";
|