@drisp/cli 0.5.1 → 0.5.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/{WorkflowInstallWizard-X754ND4V.js → WorkflowInstallWizard-7Y5PWAKW.js} +2 -2
- package/dist/athena-gateway.js +4113 -4
- package/dist/{chunk-A54HGVML.js → chunk-7E54JMXH.js} +126 -114
- package/dist/{chunk-PEBITVZQ.js → chunk-QVXHUJPH.js} +1944 -1117
- package/dist/cli.js +21 -380
- package/dist/dashboard-daemon.js +103 -8
- package/package.json +1 -1
- package/dist/chunk-2OJ3GGIP.js +0 -104
- package/dist/chunk-OB4HZXR5.js +0 -4124
- package/dist/chunk-ZVOGOZNT.js +0 -395
- package/dist/supervisor.js +0 -692
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "./chunk-HXBCZAP7.js";
|
|
3
|
+
import {
|
|
4
|
+
rotateGatewayToken
|
|
5
|
+
} from "./chunk-MRAM6EYI.js";
|
|
3
6
|
import {
|
|
4
7
|
CREDENTIAL_SOURCES_TRIED,
|
|
5
8
|
EXEC_EXIT_CODE,
|
|
@@ -12,8 +15,8 @@ import {
|
|
|
12
15
|
classifyFailure,
|
|
13
16
|
connect,
|
|
14
17
|
createDashboardDecisionInbox,
|
|
15
|
-
createDashboardFeedPublisher,
|
|
16
18
|
createFeedMapper,
|
|
19
|
+
createPairedFeedPublisher,
|
|
17
20
|
createRelayPermissionCallback,
|
|
18
21
|
createRelayQuestionCallback,
|
|
19
22
|
createRuntime,
|
|
@@ -45,13 +48,15 @@ import {
|
|
|
45
48
|
lookupCredential,
|
|
46
49
|
makeSkippedProbe,
|
|
47
50
|
messageGlyphs,
|
|
48
|
-
normalizeHarnessOverride,
|
|
49
51
|
probeSkipReason,
|
|
50
52
|
processRegistry,
|
|
51
53
|
progressGlyphs,
|
|
54
|
+
readAttachmentMirror,
|
|
52
55
|
readGatewayClientConfig,
|
|
56
|
+
readPidLock,
|
|
53
57
|
register,
|
|
54
58
|
registerCleanupOnExit,
|
|
59
|
+
removeAttachmentMirror,
|
|
55
60
|
resolveClaudeBinary,
|
|
56
61
|
resolveClaudeSettingsSurfacePaths,
|
|
57
62
|
resolveHarnessAdapter,
|
|
@@ -66,21 +71,13 @@ import {
|
|
|
66
71
|
startSessionBridge,
|
|
67
72
|
supportsSessionApproval,
|
|
68
73
|
todoGlyphSet,
|
|
74
|
+
writeAttachmentMirror,
|
|
69
75
|
writeGatewayClientConfig,
|
|
70
76
|
wsClientOptionsForEndpoint
|
|
71
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-QVXHUJPH.js";
|
|
72
78
|
import {
|
|
73
79
|
generateId as generateId2
|
|
74
80
|
} from "./chunk-BTKQ67RE.js";
|
|
75
|
-
import {
|
|
76
|
-
rotateGatewayToken
|
|
77
|
-
} from "./chunk-MRAM6EYI.js";
|
|
78
|
-
import {
|
|
79
|
-
readAttachmentMirror,
|
|
80
|
-
readPidLock,
|
|
81
|
-
removeAttachmentMirror,
|
|
82
|
-
writeAttachmentMirror
|
|
83
|
-
} from "./chunk-ZVOGOZNT.js";
|
|
84
81
|
import {
|
|
85
82
|
dashboardClientConfigPath,
|
|
86
83
|
disableTelemetry,
|
|
@@ -136,7 +133,7 @@ import {
|
|
|
136
133
|
useWorkflowSessionController,
|
|
137
134
|
writeGlobalConfig,
|
|
138
135
|
writeProjectConfig
|
|
139
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-7E54JMXH.js";
|
|
140
137
|
|
|
141
138
|
// src/app/entry/cli.tsx
|
|
142
139
|
import { render } from "ink";
|
|
@@ -1747,7 +1744,7 @@ function useFeed(runtime, messages = [], initialAllowedTools, sessionStore, opti
|
|
|
1747
1744
|
const feedEventsRef = useRef([]);
|
|
1748
1745
|
const notifiedRuntimeErrorRef = useRef(null);
|
|
1749
1746
|
const dashboardFeedPublisher = useMemo3(
|
|
1750
|
-
() => options?.dashboardFeedPublisher ??
|
|
1747
|
+
() => options?.dashboardFeedPublisher ?? createPairedFeedPublisher(),
|
|
1751
1748
|
[options?.dashboardFeedPublisher]
|
|
1752
1749
|
);
|
|
1753
1750
|
const dashboardDecisionInboxRef = useRef(
|
|
@@ -11056,352 +11053,6 @@ function executeCommand(command, args, ctx) {
|
|
|
11056
11053
|
}
|
|
11057
11054
|
}
|
|
11058
11055
|
|
|
11059
|
-
// src/app/runner/assignmentHandler.ts
|
|
11060
|
-
function parseRunSpec(value) {
|
|
11061
|
-
if (typeof value !== "object" || value === null) return null;
|
|
11062
|
-
const obj = value;
|
|
11063
|
-
const prompt = obj["prompt"];
|
|
11064
|
-
if (typeof prompt !== "string" || prompt.trim().length === 0) return null;
|
|
11065
|
-
const env2 = obj["env"];
|
|
11066
|
-
const workflow = obj["workflow"];
|
|
11067
|
-
return {
|
|
11068
|
-
prompt,
|
|
11069
|
-
sessionId: typeof obj["sessionId"] === "string" && obj["sessionId"].length > 0 ? obj["sessionId"] : void 0,
|
|
11070
|
-
projectDir: typeof obj["projectDir"] === "string" && obj["projectDir"].length > 0 ? obj["projectDir"] : void 0,
|
|
11071
|
-
workflow: typeof workflow === "object" && workflow !== null && typeof workflow["ref"] === "string" ? { ref: workflow["ref"] } : void 0,
|
|
11072
|
-
harness: normalizeHarnessOverride(obj["harness"]),
|
|
11073
|
-
env: typeof env2 === "object" && env2 !== null ? Object.fromEntries(
|
|
11074
|
-
Object.entries(env2).filter(
|
|
11075
|
-
(entry) => typeof entry[1] === "string"
|
|
11076
|
-
)
|
|
11077
|
-
) : void 0,
|
|
11078
|
-
timeoutSec: typeof obj["timeoutSec"] === "number" && Number.isFinite(obj["timeoutSec"]) ? obj["timeoutSec"] : void 0
|
|
11079
|
-
};
|
|
11080
|
-
}
|
|
11081
|
-
function workflowNameFromRef(ref) {
|
|
11082
|
-
if (!ref) return void 0;
|
|
11083
|
-
const [name] = ref.split("@", 1);
|
|
11084
|
-
return name && name.length > 0 ? name : void 0;
|
|
11085
|
-
}
|
|
11086
|
-
function eventKindOf(event) {
|
|
11087
|
-
if (event.type === "exec.completed") {
|
|
11088
|
-
const data = event.data;
|
|
11089
|
-
return data?.success === false ? "error" : "completion";
|
|
11090
|
-
}
|
|
11091
|
-
return typeof event.type === "string" && event.type.length > 0 ? event.type : "progress";
|
|
11092
|
-
}
|
|
11093
|
-
function eventPayloadOf(event) {
|
|
11094
|
-
if (event.type === "exec.completed") {
|
|
11095
|
-
const data = event.data;
|
|
11096
|
-
if (data?.success === false) {
|
|
11097
|
-
return {
|
|
11098
|
-
...typeof event.data === "object" && event.data !== null ? event.data : {},
|
|
11099
|
-
message: typeof data.failure === "object" && data.failure !== null && typeof data.failure.message === "string" ? data.failure.message : "remote execution failed"
|
|
11100
|
-
};
|
|
11101
|
-
}
|
|
11102
|
-
}
|
|
11103
|
-
return event.data ?? null;
|
|
11104
|
-
}
|
|
11105
|
-
function withEnv(env2, fn) {
|
|
11106
|
-
if (!env2 || Object.keys(env2).length === 0) return fn();
|
|
11107
|
-
const previous = /* @__PURE__ */ new Map();
|
|
11108
|
-
for (const [key, value] of Object.entries(env2)) {
|
|
11109
|
-
previous.set(key, process.env[key]);
|
|
11110
|
-
process.env[key] = value;
|
|
11111
|
-
}
|
|
11112
|
-
return fn().finally(() => {
|
|
11113
|
-
for (const [key, value] of previous) {
|
|
11114
|
-
if (value === void 0) {
|
|
11115
|
-
delete process.env[key];
|
|
11116
|
-
} else {
|
|
11117
|
-
process.env[key] = value;
|
|
11118
|
-
}
|
|
11119
|
-
}
|
|
11120
|
-
});
|
|
11121
|
-
}
|
|
11122
|
-
async function executeAssignment(input) {
|
|
11123
|
-
const {
|
|
11124
|
-
envelope,
|
|
11125
|
-
bridge,
|
|
11126
|
-
dispatchId,
|
|
11127
|
-
location,
|
|
11128
|
-
projectDir: fallbackProjectDir = process.cwd(),
|
|
11129
|
-
runExecFn = runExec,
|
|
11130
|
-
bootstrapRuntimeConfigFn = bootstrapRuntimeConfig,
|
|
11131
|
-
now = Date.now,
|
|
11132
|
-
abortSignal
|
|
11133
|
-
} = input;
|
|
11134
|
-
const runId = envelope.runId;
|
|
11135
|
-
let seq = 0;
|
|
11136
|
-
let terminalSent = false;
|
|
11137
|
-
let deferredFailedCompletion = null;
|
|
11138
|
-
let lastTerminalFailureMessage = null;
|
|
11139
|
-
const nextSeq = () => {
|
|
11140
|
-
seq += 1;
|
|
11141
|
-
return seq;
|
|
11142
|
-
};
|
|
11143
|
-
const sendProgress = async (kind, payload, ts = now()) => {
|
|
11144
|
-
await bridge.sendRunEvent({
|
|
11145
|
-
location,
|
|
11146
|
-
runId,
|
|
11147
|
-
seq: nextSeq(),
|
|
11148
|
-
ts,
|
|
11149
|
-
kind,
|
|
11150
|
-
payload
|
|
11151
|
-
});
|
|
11152
|
-
};
|
|
11153
|
-
const sendTerminal = async (eventKind, payload, ts = now()) => {
|
|
11154
|
-
if (terminalSent) return;
|
|
11155
|
-
terminalSent = true;
|
|
11156
|
-
const envelopeText = JSON.stringify({
|
|
11157
|
-
kind: "run_event",
|
|
11158
|
-
runId,
|
|
11159
|
-
seq: nextSeq(),
|
|
11160
|
-
ts,
|
|
11161
|
-
eventKind,
|
|
11162
|
-
payload
|
|
11163
|
-
});
|
|
11164
|
-
await bridge.completeTurn({
|
|
11165
|
-
dispatchId,
|
|
11166
|
-
location,
|
|
11167
|
-
text: envelopeText,
|
|
11168
|
-
idempotencyKey: `run_event:${runId}:terminal`
|
|
11169
|
-
});
|
|
11170
|
-
};
|
|
11171
|
-
await sendProgress("progress", { message: "assignment received" });
|
|
11172
|
-
const spec = parseRunSpec(envelope.runSpec);
|
|
11173
|
-
if (!spec) {
|
|
11174
|
-
await sendTerminal("error", { message: "remote assignment missing prompt" });
|
|
11175
|
-
return;
|
|
11176
|
-
}
|
|
11177
|
-
const projectDir = spec.projectDir ?? fallbackProjectDir;
|
|
11178
|
-
let runtimeConfig;
|
|
11179
|
-
try {
|
|
11180
|
-
runtimeConfig = bootstrapRuntimeConfigFn({
|
|
11181
|
-
projectDir,
|
|
11182
|
-
showSetup: false,
|
|
11183
|
-
isolationPreset: "minimal",
|
|
11184
|
-
harnessOverride: spec.harness,
|
|
11185
|
-
workflowOverride: workflowNameFromRef(spec.workflow?.ref)
|
|
11186
|
-
});
|
|
11187
|
-
} catch (err) {
|
|
11188
|
-
await sendTerminal("error", {
|
|
11189
|
-
message: err instanceof Error ? err.message : String(err)
|
|
11190
|
-
});
|
|
11191
|
-
return;
|
|
11192
|
-
}
|
|
11193
|
-
for (const warning of runtimeConfig.warnings) {
|
|
11194
|
-
await sendProgress("warning", { message: warning });
|
|
11195
|
-
}
|
|
11196
|
-
let buffered = "";
|
|
11197
|
-
const pendingProgress = [];
|
|
11198
|
-
const stdout = {
|
|
11199
|
-
write(chunk) {
|
|
11200
|
-
buffered += chunk;
|
|
11201
|
-
let newline = buffered.indexOf("\n");
|
|
11202
|
-
while (newline >= 0) {
|
|
11203
|
-
const line = buffered.slice(0, newline).trim();
|
|
11204
|
-
buffered = buffered.slice(newline + 1);
|
|
11205
|
-
if (line.length > 0) {
|
|
11206
|
-
try {
|
|
11207
|
-
const event = JSON.parse(line);
|
|
11208
|
-
const data = event.data;
|
|
11209
|
-
if (event.type === "exec.completed" && data?.success === false) {
|
|
11210
|
-
deferredFailedCompletion = event;
|
|
11211
|
-
} else if (event.type === "exec.completed") {
|
|
11212
|
-
deferredFailedCompletion = event;
|
|
11213
|
-
} else {
|
|
11214
|
-
pendingProgress.push(
|
|
11215
|
-
sendProgress(eventKindOf(event), eventPayloadOf(event), now())
|
|
11216
|
-
);
|
|
11217
|
-
}
|
|
11218
|
-
} catch {
|
|
11219
|
-
pendingProgress.push(sendProgress("progress", { line }));
|
|
11220
|
-
}
|
|
11221
|
-
}
|
|
11222
|
-
newline = buffered.indexOf("\n");
|
|
11223
|
-
}
|
|
11224
|
-
return true;
|
|
11225
|
-
}
|
|
11226
|
-
};
|
|
11227
|
-
const stderr = {
|
|
11228
|
-
write(chunk) {
|
|
11229
|
-
const text = chunk.trim();
|
|
11230
|
-
if (text.length > 0) pendingProgress.push(sendProgress("stderr", { text }));
|
|
11231
|
-
return true;
|
|
11232
|
-
}
|
|
11233
|
-
};
|
|
11234
|
-
try {
|
|
11235
|
-
await withEnv(spec.env, async () => {
|
|
11236
|
-
const result = await runExecFn({
|
|
11237
|
-
prompt: spec.prompt,
|
|
11238
|
-
projectDir,
|
|
11239
|
-
harness: runtimeConfig.harness,
|
|
11240
|
-
athenaSessionId: spec.sessionId ?? `athena-${runId}`,
|
|
11241
|
-
isolationConfig: runtimeConfig.isolationConfig,
|
|
11242
|
-
pluginMcpConfig: runtimeConfig.pluginMcpConfig,
|
|
11243
|
-
workflow: runtimeConfig.workflow,
|
|
11244
|
-
workflowPlan: runtimeConfig.workflowPlan,
|
|
11245
|
-
json: true,
|
|
11246
|
-
verbose: false,
|
|
11247
|
-
ephemeral: false,
|
|
11248
|
-
timeoutMs: spec.timeoutSec ? spec.timeoutSec * 1e3 : void 0,
|
|
11249
|
-
signal: abortSignal,
|
|
11250
|
-
stdout,
|
|
11251
|
-
stderr
|
|
11252
|
-
});
|
|
11253
|
-
await Promise.all(pendingProgress);
|
|
11254
|
-
if (deferredFailedCompletion) {
|
|
11255
|
-
const data = typeof deferredFailedCompletion.data === "object" && deferredFailedCompletion.data !== null ? deferredFailedCompletion.data : {};
|
|
11256
|
-
const ts = typeof deferredFailedCompletion.ts === "number" ? deferredFailedCompletion.ts : now();
|
|
11257
|
-
const success = data.success !== false;
|
|
11258
|
-
const eventKind = success ? "completion" : "error";
|
|
11259
|
-
const message = !success ? result.failure?.message ?? eventPayloadOf(deferredFailedCompletion).message ?? "remote execution failed" : void 0;
|
|
11260
|
-
if (message) lastTerminalFailureMessage = message;
|
|
11261
|
-
await sendTerminal(
|
|
11262
|
-
eventKind,
|
|
11263
|
-
success ? {
|
|
11264
|
-
...data,
|
|
11265
|
-
exitCode: result.exitCode,
|
|
11266
|
-
athenaSessionId: result.athenaSessionId,
|
|
11267
|
-
adapterSessionId: result.adapterSessionId,
|
|
11268
|
-
finalMessage: result.finalMessage,
|
|
11269
|
-
tokens: result.tokens,
|
|
11270
|
-
durationMs: result.durationMs,
|
|
11271
|
-
success: true
|
|
11272
|
-
} : {
|
|
11273
|
-
...data,
|
|
11274
|
-
success: result.success,
|
|
11275
|
-
exitCode: result.exitCode,
|
|
11276
|
-
athenaSessionId: result.athenaSessionId,
|
|
11277
|
-
adapterSessionId: result.adapterSessionId,
|
|
11278
|
-
finalMessage: result.finalMessage,
|
|
11279
|
-
tokens: result.tokens,
|
|
11280
|
-
durationMs: result.durationMs,
|
|
11281
|
-
message
|
|
11282
|
-
},
|
|
11283
|
-
ts
|
|
11284
|
-
);
|
|
11285
|
-
return;
|
|
11286
|
-
}
|
|
11287
|
-
if (result.failure && result.failure.message !== lastTerminalFailureMessage) {
|
|
11288
|
-
await sendTerminal("error", {
|
|
11289
|
-
success: result.success,
|
|
11290
|
-
exitCode: result.exitCode,
|
|
11291
|
-
athenaSessionId: result.athenaSessionId,
|
|
11292
|
-
adapterSessionId: result.adapterSessionId,
|
|
11293
|
-
finalMessage: result.finalMessage,
|
|
11294
|
-
tokens: result.tokens,
|
|
11295
|
-
durationMs: result.durationMs,
|
|
11296
|
-
message: result.failure.message
|
|
11297
|
-
});
|
|
11298
|
-
return;
|
|
11299
|
-
}
|
|
11300
|
-
await sendTerminal("completion", {
|
|
11301
|
-
success: result.success,
|
|
11302
|
-
exitCode: result.exitCode,
|
|
11303
|
-
athenaSessionId: result.athenaSessionId,
|
|
11304
|
-
adapterSessionId: result.adapterSessionId,
|
|
11305
|
-
finalMessage: result.finalMessage,
|
|
11306
|
-
tokens: result.tokens,
|
|
11307
|
-
durationMs: result.durationMs
|
|
11308
|
-
});
|
|
11309
|
-
});
|
|
11310
|
-
} catch (err) {
|
|
11311
|
-
await Promise.all(pendingProgress);
|
|
11312
|
-
await sendTerminal("error", {
|
|
11313
|
-
message: err instanceof Error ? err.message : String(err)
|
|
11314
|
-
});
|
|
11315
|
-
}
|
|
11316
|
-
}
|
|
11317
|
-
|
|
11318
|
-
// src/app/runner/envelope.ts
|
|
11319
|
-
function parseRunnerEnvelope(text) {
|
|
11320
|
-
let value;
|
|
11321
|
-
try {
|
|
11322
|
-
value = JSON.parse(text);
|
|
11323
|
-
} catch {
|
|
11324
|
-
return null;
|
|
11325
|
-
}
|
|
11326
|
-
if (typeof value !== "object" || value === null) return null;
|
|
11327
|
-
const obj = value;
|
|
11328
|
-
const runId = obj["runId"];
|
|
11329
|
-
if (typeof runId !== "string" || runId.length === 0) return null;
|
|
11330
|
-
const kind = obj["kind"];
|
|
11331
|
-
if (kind === "job_assignment") {
|
|
11332
|
-
return { kind, runId, runSpec: obj["runSpec"] };
|
|
11333
|
-
}
|
|
11334
|
-
if (kind === "cancel") {
|
|
11335
|
-
return { kind, runId };
|
|
11336
|
-
}
|
|
11337
|
-
return null;
|
|
11338
|
-
}
|
|
11339
|
-
|
|
11340
|
-
// src/app/runner/runnerSession.ts
|
|
11341
|
-
function createRunnerSession(opts) {
|
|
11342
|
-
const {
|
|
11343
|
-
bridge,
|
|
11344
|
-
projectDir,
|
|
11345
|
-
runExecFn = runExec,
|
|
11346
|
-
bootstrapRuntimeConfigFn = bootstrapRuntimeConfig,
|
|
11347
|
-
now = Date.now
|
|
11348
|
-
} = opts;
|
|
11349
|
-
const inflight = /* @__PURE__ */ new Map();
|
|
11350
|
-
function startAssignment(envelope, dispatchId, location) {
|
|
11351
|
-
const controller = new AbortController();
|
|
11352
|
-
inflight.set(envelope.runId, controller);
|
|
11353
|
-
return executeAssignment({
|
|
11354
|
-
envelope,
|
|
11355
|
-
bridge,
|
|
11356
|
-
dispatchId,
|
|
11357
|
-
location,
|
|
11358
|
-
projectDir,
|
|
11359
|
-
runExecFn,
|
|
11360
|
-
bootstrapRuntimeConfigFn,
|
|
11361
|
-
now,
|
|
11362
|
-
abortSignal: controller.signal
|
|
11363
|
-
}).finally(() => {
|
|
11364
|
-
if (inflight.get(envelope.runId) === controller) {
|
|
11365
|
-
inflight.delete(envelope.runId);
|
|
11366
|
-
}
|
|
11367
|
-
});
|
|
11368
|
-
}
|
|
11369
|
-
return {
|
|
11370
|
-
handleDispatch(input) {
|
|
11371
|
-
const envelope = parseRunnerEnvelope(input.text);
|
|
11372
|
-
if (!envelope) {
|
|
11373
|
-
return { recognised: false, completed: Promise.resolve() };
|
|
11374
|
-
}
|
|
11375
|
-
if (envelope.kind === "job_assignment") {
|
|
11376
|
-
const completed = startAssignment(
|
|
11377
|
-
envelope,
|
|
11378
|
-
input.dispatchId,
|
|
11379
|
-
input.location
|
|
11380
|
-
);
|
|
11381
|
-
return { recognised: true, completed };
|
|
11382
|
-
}
|
|
11383
|
-
const controller = inflight.get(envelope.runId);
|
|
11384
|
-
if (controller) controller.abort();
|
|
11385
|
-
return { recognised: true, completed: Promise.resolve() };
|
|
11386
|
-
}
|
|
11387
|
-
};
|
|
11388
|
-
}
|
|
11389
|
-
|
|
11390
|
-
// src/app/runner/dispatchRouter.ts
|
|
11391
|
-
function makeDispatchRouter(opts) {
|
|
11392
|
-
return (payload) => {
|
|
11393
|
-
if (opts.runnerSession) {
|
|
11394
|
-
const result = opts.runnerSession.handleDispatch({
|
|
11395
|
-
text: payload.inbound.text,
|
|
11396
|
-
dispatchId: payload.dispatchId,
|
|
11397
|
-
location: payload.inbound.location
|
|
11398
|
-
});
|
|
11399
|
-
if (result.recognised) return;
|
|
11400
|
-
}
|
|
11401
|
-
opts.fallback(payload);
|
|
11402
|
-
};
|
|
11403
|
-
}
|
|
11404
|
-
|
|
11405
11056
|
// src/ui/components/SessionPicker.tsx
|
|
11406
11057
|
import { useState as useState11 } from "react";
|
|
11407
11058
|
import { Box as Box11, Text as Text17, useInput as useInput12, useStdout as useStdout5 } from "ink";
|
|
@@ -13776,25 +13427,17 @@ function AppContent({
|
|
|
13776
13427
|
[addMessage, currentSessionId, feedEvents.length, spawnHarness]
|
|
13777
13428
|
);
|
|
13778
13429
|
submitDispatchAsTurnRef.current = submitDispatchAsTurn;
|
|
13779
|
-
const runnerSession = useMemo17(
|
|
13780
|
-
() => sessionBridge ? createRunnerSession({ bridge: sessionBridge, projectDir }) : null,
|
|
13781
|
-
[sessionBridge, projectDir]
|
|
13782
|
-
);
|
|
13783
13430
|
useEffect14(() => {
|
|
13784
13431
|
if (!sessionBridge) return;
|
|
13785
|
-
const
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
queuedDispatchRef.current = payload;
|
|
13790
|
-
return;
|
|
13791
|
-
}
|
|
13792
|
-
submitDispatchAsTurnRef.current?.(payload);
|
|
13432
|
+
const off = sessionBridge.onTurnDispatch((payload) => {
|
|
13433
|
+
if (isHarnessRunningRef.current || pendingDispatchRef.current) {
|
|
13434
|
+
queuedDispatchRef.current = payload;
|
|
13435
|
+
return;
|
|
13793
13436
|
}
|
|
13437
|
+
submitDispatchAsTurnRef.current?.(payload);
|
|
13794
13438
|
});
|
|
13795
|
-
const off = sessionBridge.onTurnDispatch(router);
|
|
13796
13439
|
return off;
|
|
13797
|
-
}, [sessionBridge
|
|
13440
|
+
}, [sessionBridge]);
|
|
13798
13441
|
useEffect14(() => {
|
|
13799
13442
|
if (isHarnessRunning) return;
|
|
13800
13443
|
if (pendingDispatchRef.current) return;
|
|
@@ -16052,7 +15695,7 @@ var cachedVersion = null;
|
|
|
16052
15695
|
function readPackageVersion() {
|
|
16053
15696
|
if (cachedVersion !== null) return cachedVersion;
|
|
16054
15697
|
try {
|
|
16055
|
-
const injected = "0.5.
|
|
15698
|
+
const injected = "0.5.4";
|
|
16056
15699
|
if (typeof injected === "string" && injected.length > 0) {
|
|
16057
15700
|
cachedVersion = injected;
|
|
16058
15701
|
return cachedVersion;
|
|
@@ -16526,6 +16169,8 @@ async function runDashboardCommand(input, deps = {}) {
|
|
|
16526
16169
|
refreshAccessToken: async () => performRefreshImpl("connect"),
|
|
16527
16170
|
makeInstanceSocketClient: deps.makeInstanceSocketClient,
|
|
16528
16171
|
executeRemoteAssignment: deps.executeRemoteAssignment,
|
|
16172
|
+
fetchAttachments: deps.fetchAttachments,
|
|
16173
|
+
writeMirror,
|
|
16529
16174
|
retryInitialConnect: false,
|
|
16530
16175
|
log: (level, message) => {
|
|
16531
16176
|
if (level === "error" || level === "warn") {
|
|
@@ -18748,9 +18393,6 @@ var cli = meow(
|
|
|
18748
18393
|
},
|
|
18749
18394
|
apiKey: {
|
|
18750
18395
|
type: "string"
|
|
18751
|
-
},
|
|
18752
|
-
attachmentId: {
|
|
18753
|
-
type: "string"
|
|
18754
18396
|
}
|
|
18755
18397
|
}
|
|
18756
18398
|
}
|
|
@@ -18800,7 +18442,7 @@ Available commands: ${[...KNOWN_COMMANDS].join(", ")}`
|
|
|
18800
18442
|
await exitWith(1);
|
|
18801
18443
|
return;
|
|
18802
18444
|
}
|
|
18803
|
-
const { default: WorkflowInstallWizard } = await import("./WorkflowInstallWizard-
|
|
18445
|
+
const { default: WorkflowInstallWizard } = await import("./WorkflowInstallWizard-7Y5PWAKW.js");
|
|
18804
18446
|
const { waitUntilExit } = render(
|
|
18805
18447
|
/* @__PURE__ */ jsx25(
|
|
18806
18448
|
WorkflowInstallWizard,
|
|
@@ -19063,7 +18705,6 @@ Available commands: ${[...KNOWN_COMMANDS].join(", ")}`
|
|
|
19063
18705
|
isolationPreset,
|
|
19064
18706
|
ascii: cli.flags.ascii,
|
|
19065
18707
|
showSetup,
|
|
19066
|
-
...cli.flags.attachmentId !== void 0 ? { attachmentId: cli.flags.attachmentId } : {},
|
|
19067
18708
|
initialTelemetryDiagnosticsConsent: globalConfig.telemetryDiagnostics
|
|
19068
18709
|
}
|
|
19069
18710
|
),
|
package/dist/dashboard-daemon.js
CHANGED
|
@@ -1,20 +1,115 @@
|
|
|
1
1
|
import {
|
|
2
|
+
acquirePidLock,
|
|
2
3
|
ensureDaemonStateDir,
|
|
3
4
|
runDashboardRuntimeDaemon,
|
|
4
5
|
startUdsServer
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QVXHUJPH.js";
|
|
6
7
|
import "./chunk-BTKQ67RE.js";
|
|
7
|
-
import {
|
|
8
|
-
openDaemonLog
|
|
9
|
-
} from "./chunk-2OJ3GGIP.js";
|
|
10
|
-
import {
|
|
11
|
-
acquirePidLock
|
|
12
|
-
} from "./chunk-ZVOGOZNT.js";
|
|
13
8
|
import {
|
|
14
9
|
readDashboardClientConfig,
|
|
15
10
|
refreshDashboardAccessToken
|
|
16
11
|
} from "./chunk-BTY7MYYT.js";
|
|
17
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-7E54JMXH.js";
|
|
13
|
+
|
|
14
|
+
// src/infra/daemon/logFile.ts
|
|
15
|
+
import fs from "fs";
|
|
16
|
+
import path from "path";
|
|
17
|
+
var DEFAULT_MAX_BYTES = 5 * 1024 * 1024;
|
|
18
|
+
var DEFAULT_MAX_FILES = 5;
|
|
19
|
+
function openDaemonLog(logPath, options = {}) {
|
|
20
|
+
const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
21
|
+
const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
|
|
22
|
+
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
23
|
+
fs.mkdirSync(path.dirname(logPath), { recursive: true, mode: 448 });
|
|
24
|
+
let fd = fs.openSync(logPath, "a", 384);
|
|
25
|
+
if (process.platform !== "win32") {
|
|
26
|
+
try {
|
|
27
|
+
fs.chmodSync(logPath, 384);
|
|
28
|
+
} catch {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function rotate() {
|
|
32
|
+
try {
|
|
33
|
+
fs.closeSync(fd);
|
|
34
|
+
} catch {
|
|
35
|
+
}
|
|
36
|
+
for (let i = maxFiles - 1; i >= 1; i -= 1) {
|
|
37
|
+
const src = `${logPath}.${i}`;
|
|
38
|
+
const dst = `${logPath}.${i + 1}`;
|
|
39
|
+
try {
|
|
40
|
+
fs.renameSync(src, dst);
|
|
41
|
+
} catch (err) {
|
|
42
|
+
if (err.code !== "ENOENT") {
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
fs.renameSync(logPath, `${logPath}.1`);
|
|
48
|
+
} catch (err) {
|
|
49
|
+
if (err.code !== "ENOENT") {
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
fd = fs.openSync(logPath, "a", 384);
|
|
53
|
+
if (process.platform !== "win32") {
|
|
54
|
+
try {
|
|
55
|
+
fs.chmodSync(logPath, 384);
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function write(level, message) {
|
|
61
|
+
const line = `${now().toISOString()} ${level.toUpperCase()} ${redactSecrets(message)}
|
|
62
|
+
`;
|
|
63
|
+
const buf = Buffer.from(line, "utf-8");
|
|
64
|
+
let stat = null;
|
|
65
|
+
try {
|
|
66
|
+
stat = fs.fstatSync(fd);
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
if (stat && stat.size + buf.length > maxBytes) {
|
|
70
|
+
rotate();
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
fs.writeSync(fd, buf);
|
|
74
|
+
} catch {
|
|
75
|
+
try {
|
|
76
|
+
fs.closeSync(fd);
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
fd = fs.openSync(logPath, "a", 384);
|
|
81
|
+
fs.writeSync(fd, buf);
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function close() {
|
|
87
|
+
try {
|
|
88
|
+
fs.closeSync(fd);
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return { write, close, path: logPath };
|
|
93
|
+
}
|
|
94
|
+
var SECRET_PATTERNS = [
|
|
95
|
+
[/Bearer\s+[A-Za-z0-9._\-+/=]+/g, "Bearer ***"],
|
|
96
|
+
[
|
|
97
|
+
/(["']?(?:access|refresh)_?token["']?\s*[:=]\s*)["']?[A-Za-z0-9._\-+/=]+/gi,
|
|
98
|
+
'$1"***"'
|
|
99
|
+
],
|
|
100
|
+
[/(Sec-WebSocket-Protocol:\s*)\S+/gi, "$1***"],
|
|
101
|
+
[
|
|
102
|
+
/eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{4,}/g,
|
|
103
|
+
"***.***.***"
|
|
104
|
+
]
|
|
105
|
+
];
|
|
106
|
+
function redactSecrets(message) {
|
|
107
|
+
let out = message;
|
|
108
|
+
for (const [pattern, replacement] of SECRET_PATTERNS) {
|
|
109
|
+
out = out.replace(pattern, replacement);
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
18
113
|
|
|
19
114
|
// src/app/entry/dashboardDaemon.ts
|
|
20
115
|
async function runDashboardDaemonEntry() {
|