@drisp/cli 0.7.6 → 0.7.8
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-YANLNMTP.js → WorkflowInstallWizard-IOJD3YOA.js} +2 -2
- package/dist/{chunk-2N7IBKJF.js → chunk-HGMJ3YL2.js} +188 -34
- package/dist/{chunk-W57EQYCM.js → chunk-OYUBT6RS.js} +138 -18
- package/dist/{chunk-Y6XJPUR2.js → chunk-TBUUNMC6.js} +2 -2
- package/dist/cli.js +376 -64
- package/dist/dashboard-daemon.js +3 -3
- package/dist/runner.js +3 -3
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
installWorkflowPlugins,
|
|
9
9
|
resolveWorkflow,
|
|
10
10
|
writeGlobalConfig
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OYUBT6RS.js";
|
|
12
12
|
import "./chunk-G3PMV62Z.js";
|
|
13
13
|
|
|
14
14
|
// src/setup/steps/WorkflowInstallWizard.tsx
|
|
@@ -93,4 +93,4 @@ function WorkflowInstallWizard({ source, onDone }) {
|
|
|
93
93
|
export {
|
|
94
94
|
WorkflowInstallWizard as default
|
|
95
95
|
};
|
|
96
|
-
//# sourceMappingURL=WorkflowInstallWizard-
|
|
96
|
+
//# sourceMappingURL=WorkflowInstallWizard-IOJD3YOA.js.map
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
LAYOUT_MARKERS,
|
|
22
22
|
ORCHESTRATOR_LOOP,
|
|
23
23
|
WAITING_ON_CHILDREN_STOP_REASON,
|
|
24
|
+
budgetTokens,
|
|
24
25
|
compileWorkflowPlan,
|
|
25
26
|
createSteerQueue,
|
|
26
27
|
createWorkflowRunner,
|
|
@@ -54,7 +55,7 @@ import {
|
|
|
54
55
|
verifyRendered,
|
|
55
56
|
wakesFreshAfterHandover,
|
|
56
57
|
workflowRegistryDir
|
|
57
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-OYUBT6RS.js";
|
|
58
59
|
import {
|
|
59
60
|
__commonJS,
|
|
60
61
|
__toESM
|
|
@@ -12688,7 +12689,7 @@ var RUN_EXIT_CODE = {
|
|
|
12688
12689
|
import { existsSync as existsSync4 } from "fs";
|
|
12689
12690
|
import { link, mkdir as mkdir6, readdir as readdir3, readFile as readFile5, unlink as unlink3, writeFile as writeFile4 } from "fs/promises";
|
|
12690
12691
|
import { homedir as homedir5 } from "os";
|
|
12691
|
-
import { dirname as dirname5, join as
|
|
12692
|
+
import { dirname as dirname5, join as join11 } from "path";
|
|
12692
12693
|
|
|
12693
12694
|
// ../../modules/runtime/src/runner-service.ts
|
|
12694
12695
|
import { execFile } from "child_process";
|
|
@@ -12880,7 +12881,7 @@ WantedBy=default.target
|
|
|
12880
12881
|
// ../../modules/runtime/src/service.ts
|
|
12881
12882
|
import { mkdir as mkdir5, readFile as readFile4, unlink as unlink2 } from "fs/promises";
|
|
12882
12883
|
import { homedir as homedir4 } from "os";
|
|
12883
|
-
import { join as
|
|
12884
|
+
import { join as join10, resolve as resolve6 } from "path";
|
|
12884
12885
|
|
|
12885
12886
|
// ../../packages/protocol/src/domain.ts
|
|
12886
12887
|
var RunStatusSchema = external_exports.enum([
|
|
@@ -14892,7 +14893,7 @@ async function restoreCheckpoint(store, input) {
|
|
|
14892
14893
|
|
|
14893
14894
|
// ../../modules/runtime/src/software-version.ts
|
|
14894
14895
|
import "fs";
|
|
14895
|
-
var runnerSoftwareVersion = true ? "0.7.
|
|
14896
|
+
var runnerSoftwareVersion = true ? "0.7.8" : JSON.parse(readFileSync2(new URL("../../../apps/cli/package.json", import.meta.url), "utf8")).version;
|
|
14896
14897
|
|
|
14897
14898
|
// ../../modules/runtime/src/connection.ts
|
|
14898
14899
|
var RunnerDisconnectedError = class extends Error {
|
|
@@ -20149,8 +20150,8 @@ function sessionStore(store, runId, options = {}) {
|
|
|
20149
20150
|
|
|
20150
20151
|
// ../../modules/runtime/src/workflow-executor.ts
|
|
20151
20152
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
20152
|
-
import { statSync as statSync3, writeFileSync as
|
|
20153
|
-
import { join as
|
|
20153
|
+
import { statSync as statSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
20154
|
+
import { join as join9 } from "path";
|
|
20154
20155
|
|
|
20155
20156
|
// src/core/build/workspace.ts
|
|
20156
20157
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
@@ -20176,8 +20177,39 @@ var fillSchema = external_exports.strictObject({
|
|
|
20176
20177
|
areas: external_exports.array(external_exports.enum(AREAS)).min(1).refine((areas) => new Set(areas).size === areas.length, {
|
|
20177
20178
|
error: "areas must be unique"
|
|
20178
20179
|
}),
|
|
20179
|
-
qa: external_exports.enum(["none", "web", "macos"]),
|
|
20180
|
+
qa: external_exports.enum(["none", "web", "macos", "both"]),
|
|
20181
|
+
profile: external_exports.enum(["implementation", "documentation", "investigation"]).optional(),
|
|
20182
|
+
rationale: external_exports.string().min(1).max(2e3).refine((text) => !TEMPLATE_STRUCTURE.test(text), {
|
|
20183
|
+
error: INSTRUCTIONS_MESSAGE
|
|
20184
|
+
}).optional(),
|
|
20185
|
+
acceptanceEvidence: external_exports.array(
|
|
20186
|
+
external_exports.string().min(1).max(2e3).refine((text) => !TEMPLATE_STRUCTURE.test(text), {
|
|
20187
|
+
error: INSTRUCTIONS_MESSAGE
|
|
20188
|
+
})
|
|
20189
|
+
).min(1).optional(),
|
|
20190
|
+
testFirst: external_exports.strictObject({
|
|
20191
|
+
enabled: external_exports.boolean(),
|
|
20192
|
+
reason: external_exports.string().min(1).max(1e3).refine((text) => !TEMPLATE_STRUCTURE.test(text), {
|
|
20193
|
+
error: INSTRUCTIONS_MESSAGE
|
|
20194
|
+
})
|
|
20195
|
+
}).optional(),
|
|
20196
|
+
review: external_exports.strictObject({
|
|
20197
|
+
enabled: external_exports.boolean(),
|
|
20198
|
+
reason: external_exports.string().min(1).max(1e3).refine((text) => !TEMPLATE_STRUCTURE.test(text), {
|
|
20199
|
+
error: INSTRUCTIONS_MESSAGE
|
|
20200
|
+
})
|
|
20201
|
+
}).optional(),
|
|
20202
|
+
checks: external_exports.array(
|
|
20203
|
+
external_exports.string().min(1).max(500).regex(
|
|
20204
|
+
/^(?:npm (?:run|test|--prefix apps\/cli run)|npx vitest run|make (?:-C apps\/macos|check|typecheck)|git diff --check)(?: [a-zA-Z0-9_./:=@-]+)*$/
|
|
20205
|
+
)
|
|
20206
|
+
).min(1).optional(),
|
|
20180
20207
|
sizeClass: external_exports.enum(["S", "M", "L"]),
|
|
20208
|
+
/**
|
|
20209
|
+
* Who merges the pull request (root ADR-0009): `agent`, the default when absent, or `you`, which makes the Merge
|
|
20210
|
+
* step a Sign-off the member answers in the child's Thread. Filled from the member's words before Start.
|
|
20211
|
+
*/
|
|
20212
|
+
merge: external_exports.enum(["agent", "you"]).optional(),
|
|
20181
20213
|
instructions: external_exports.string().min(1).max(6e3).refine((text) => !TEMPLATE_STRUCTURE.test(text), {
|
|
20182
20214
|
error: INSTRUCTIONS_MESSAGE
|
|
20183
20215
|
}),
|
|
@@ -20211,6 +20243,9 @@ var planInputSchema = external_exports.strictObject({
|
|
|
20211
20243
|
// Names the issue's directory under `.athena/workflows/<slugId>/`, so only a Linear identifier.
|
|
20212
20244
|
identifier: external_exports.string().regex(/^[A-Z][A-Z0-9]*-[0-9]+$/),
|
|
20213
20245
|
title: external_exports.string(),
|
|
20246
|
+
description: external_exports.string().optional(),
|
|
20247
|
+
acceptanceCriteria: external_exports.string().optional(),
|
|
20248
|
+
external: external_exports.boolean().optional(),
|
|
20214
20249
|
url: external_exports.string().url(),
|
|
20215
20250
|
branchName: external_exports.string().nullable(),
|
|
20216
20251
|
state: external_exports.strictObject({
|
|
@@ -20240,7 +20275,12 @@ var SKIP_REASONS = [
|
|
|
20240
20275
|
"ready-for-human",
|
|
20241
20276
|
"merged",
|
|
20242
20277
|
"done-pr-open",
|
|
20243
|
-
"parent-only"
|
|
20278
|
+
"parent-only",
|
|
20279
|
+
"external",
|
|
20280
|
+
"needs-info",
|
|
20281
|
+
"needs-triage",
|
|
20282
|
+
"wontfix",
|
|
20283
|
+
"not-ready-for-agent"
|
|
20244
20284
|
];
|
|
20245
20285
|
var count = external_exports.number().int().nonnegative();
|
|
20246
20286
|
var issueEntrySchema = external_exports.strictObject({
|
|
@@ -20249,7 +20289,9 @@ var issueEntrySchema = external_exports.strictObject({
|
|
|
20249
20289
|
title: external_exports.string(),
|
|
20250
20290
|
blockedBy: external_exports.array(external_exports.string()),
|
|
20251
20291
|
areas: external_exports.array(external_exports.enum(AREAS)).min(1),
|
|
20252
|
-
qa: external_exports.enum(["none", "web", "macos"]),
|
|
20292
|
+
qa: external_exports.enum(["none", "web", "macos", "both"]),
|
|
20293
|
+
profile: external_exports.enum(["implementation", "documentation", "investigation"]).optional(),
|
|
20294
|
+
scopeFingerprint: external_exports.string().optional(),
|
|
20253
20295
|
sizeClass: external_exports.enum(["S", "M", "L"]),
|
|
20254
20296
|
tokenCap: external_exports.number().int().positive(),
|
|
20255
20297
|
model: external_exports.string(),
|
|
@@ -20257,6 +20299,8 @@ var issueEntrySchema = external_exports.strictObject({
|
|
|
20257
20299
|
mcpServers: external_exports.array(external_exports.string()),
|
|
20258
20300
|
instructionsSummary: external_exports.string(),
|
|
20259
20301
|
gates: external_exports.array(external_exports.string()),
|
|
20302
|
+
/** Who merges, from the fill; absent means agents merge (root ADR-0009). */
|
|
20303
|
+
merge: external_exports.enum(["agent", "you"]).optional(),
|
|
20260
20304
|
workflowName: external_exports.string().max(128)
|
|
20261
20305
|
});
|
|
20262
20306
|
var buildPlanSchema = external_exports.strictObject({
|
|
@@ -20441,7 +20485,34 @@ function mergeGuidance(earlier, guidance) {
|
|
|
20441
20485
|
return rounds.slice(-GUIDANCE_ROUNDS);
|
|
20442
20486
|
}
|
|
20443
20487
|
|
|
20488
|
+
// src/core/build/eligibility.ts
|
|
20489
|
+
import { createHash as createHash3 } from "crypto";
|
|
20490
|
+
function eligibilityReason(issue) {
|
|
20491
|
+
if (issue.external) return "external";
|
|
20492
|
+
for (const label of [
|
|
20493
|
+
"ready-for-human",
|
|
20494
|
+
"needs-info",
|
|
20495
|
+
"needs-triage",
|
|
20496
|
+
"wontfix"
|
|
20497
|
+
])
|
|
20498
|
+
if (issue.labels.includes(label)) return label;
|
|
20499
|
+
if (issue.state.type === "triage") return "needs-triage";
|
|
20500
|
+
if (!issue.labels.includes("ready-for-agent")) return "not-ready-for-agent";
|
|
20501
|
+
return void 0;
|
|
20502
|
+
}
|
|
20503
|
+
function scopeFingerprint(issue) {
|
|
20504
|
+
return createHash3("sha256").update(
|
|
20505
|
+
JSON.stringify([
|
|
20506
|
+
issue.title,
|
|
20507
|
+
issue.description ?? "",
|
|
20508
|
+
issue.acceptanceCriteria ?? "",
|
|
20509
|
+
issue.parentId
|
|
20510
|
+
])
|
|
20511
|
+
).digest("hex");
|
|
20512
|
+
}
|
|
20513
|
+
|
|
20444
20514
|
// src/core/build/planner.ts
|
|
20515
|
+
var MIXED_MERGE = "The fills disagree on merge. Write the same value in every fill: you when the member asked to merge themselves, else agent.";
|
|
20445
20516
|
function skipReason(issue, pullRequests) {
|
|
20446
20517
|
const prs = issue.branchName ? pullRequests[issue.branchName] : void 0;
|
|
20447
20518
|
if (issue.labels.includes("ready-for-human")) return "ready-for-human";
|
|
@@ -20449,6 +20520,8 @@ function skipReason(issue, pullRequests) {
|
|
|
20449
20520
|
if (issue.state.type === "completed") return "done";
|
|
20450
20521
|
if (issue.state.type === "canceled") return "canceled";
|
|
20451
20522
|
if (prs?.merged) return "merged";
|
|
20523
|
+
const eligibility = eligibilityReason(issue);
|
|
20524
|
+
if (eligibility) return eligibility;
|
|
20452
20525
|
return void 0;
|
|
20453
20526
|
}
|
|
20454
20527
|
var byIdentifier = (a, b) => a.localeCompare(b, "en", { numeric: true });
|
|
@@ -20492,13 +20565,15 @@ function shownFromFill(fill) {
|
|
|
20492
20565
|
return {
|
|
20493
20566
|
areas: fill.areas,
|
|
20494
20567
|
qa: fill.qa,
|
|
20568
|
+
...fill.profile ? { profile: fill.profile } : {},
|
|
20495
20569
|
sizeClass: fill.sizeClass,
|
|
20496
20570
|
tokenCap: limits.maxRunTokens,
|
|
20497
20571
|
model: limits.model,
|
|
20498
20572
|
skills: renderedSkills(fill),
|
|
20499
20573
|
mcpServers: renderedMcpServers(fill),
|
|
20500
20574
|
instructionsSummary: summarizeInstructions(fill.instructions),
|
|
20501
|
-
gates: gateTitles(fill)
|
|
20575
|
+
gates: gateTitles(fill),
|
|
20576
|
+
...fill.merge ? { merge: fill.merge } : {}
|
|
20502
20577
|
};
|
|
20503
20578
|
}
|
|
20504
20579
|
function blockingGraph(entries) {
|
|
@@ -20564,6 +20639,16 @@ function planBuild(context) {
|
|
|
20564
20639
|
});
|
|
20565
20640
|
}
|
|
20566
20641
|
if (missing.length > 0) return { status: "needs_fills", fills: missing };
|
|
20642
|
+
if (new Set([...fills.values()].map((fill) => fill.merge ?? "agent")).size > 1)
|
|
20643
|
+
return {
|
|
20644
|
+
status: "needs_fills",
|
|
20645
|
+
fills: entries.map(({ identifier, title, url }) => ({
|
|
20646
|
+
identifier,
|
|
20647
|
+
title,
|
|
20648
|
+
url
|
|
20649
|
+
})),
|
|
20650
|
+
reason: MIXED_MERGE
|
|
20651
|
+
};
|
|
20567
20652
|
const hasSubIssues = new Set(input.issues.map((issue) => issue.parentId));
|
|
20568
20653
|
const parentOnly = new Set(
|
|
20569
20654
|
entries.filter(
|
|
@@ -20590,11 +20675,21 @@ function planBuild(context) {
|
|
|
20590
20675
|
({ children, blockers } = blockingGraph(entries));
|
|
20591
20676
|
}
|
|
20592
20677
|
const held = new Set(
|
|
20593
|
-
skipped.filter(
|
|
20678
|
+
skipped.filter(
|
|
20679
|
+
(skip) => !["done", "merged", "done-pr-open", "parent-only"].includes(
|
|
20680
|
+
skip.reason
|
|
20681
|
+
)
|
|
20682
|
+
).map((skip) => skip.id)
|
|
20594
20683
|
);
|
|
20595
20684
|
const waitsFor = (issue) => [
|
|
20596
20685
|
.../* @__PURE__ */ new Set([
|
|
20597
|
-
...issue.blockedBy.filter(
|
|
20686
|
+
...issue.blockedBy.filter(
|
|
20687
|
+
(id2) => !input.issues.some(
|
|
20688
|
+
(each) => each.id === id2 && (each.state.type === "completed" || skipped.some(
|
|
20689
|
+
(skip) => skip.id === id2 && skip.reason === "merged"
|
|
20690
|
+
))
|
|
20691
|
+
)
|
|
20692
|
+
),
|
|
20598
20693
|
...children.get(issue.id) ?? [],
|
|
20599
20694
|
...input.issues.filter((each) => each.parentId === issue.id && held.has(each.id)).map((each) => each.id)
|
|
20600
20695
|
])
|
|
@@ -20624,6 +20719,7 @@ function planBuild(context) {
|
|
|
20624
20719
|
title: issue.title,
|
|
20625
20720
|
blockedBy: waitsFor(issue),
|
|
20626
20721
|
...shownFromFill(fill),
|
|
20722
|
+
scopeFingerprint: scopeFingerprint(issue),
|
|
20627
20723
|
workflowName: workflowName2
|
|
20628
20724
|
});
|
|
20629
20725
|
workflows.push({
|
|
@@ -20866,7 +20962,8 @@ function validateChildRun(grant, store, paths) {
|
|
|
20866
20962
|
if (!verified.ok) throw mismatch(`its ${verified.file} does not re-render from its fill`);
|
|
20867
20963
|
const shown = approval.plan.entries?.[name];
|
|
20868
20964
|
const derived = shownFromFill(fill.data);
|
|
20869
|
-
|
|
20965
|
+
const sameMerge = (shown?.merge ?? "agent") === (fill.data.merge ?? "agent");
|
|
20966
|
+
if (!shown || !sameMerge || !Object.entries(derived).every(([key, value]) => isDeepStrictEqual2(shown[key], value)))
|
|
20870
20967
|
throw mismatch("the plan the member approved showed something else for it");
|
|
20871
20968
|
return { permissions: renderedPermissions(fill.data) };
|
|
20872
20969
|
}
|
|
@@ -21195,7 +21292,7 @@ async function closeOrphanedRuns(store, {
|
|
|
21195
21292
|
}
|
|
21196
21293
|
|
|
21197
21294
|
// ../../modules/runtime/src/run-artifacts.ts
|
|
21198
|
-
import { createHash as
|
|
21295
|
+
import { createHash as createHash4 } from "crypto";
|
|
21199
21296
|
import { mkdirSync as mkdirSync2, readdirSync as readdirSync2, readFileSync as readFileSync4, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
21200
21297
|
import { tmpdir as tmpdir5 } from "os";
|
|
21201
21298
|
import { dirname as dirname4, join as join7 } from "path";
|
|
@@ -21238,7 +21335,7 @@ function runArtifactEmitter(directory, record, midTurnMinGapMs = MID_TURN_MIN_GA
|
|
|
21238
21335
|
} catch {
|
|
21239
21336
|
continue;
|
|
21240
21337
|
}
|
|
21241
|
-
const hash =
|
|
21338
|
+
const hash = createHash4("sha256").update(bytes).digest("hex");
|
|
21242
21339
|
if (emitted[name] === hash) continue;
|
|
21243
21340
|
let json;
|
|
21244
21341
|
try {
|
|
@@ -21261,6 +21358,50 @@ function runArtifactEmitter(directory, record, midTurnMinGapMs = MID_TURN_MIN_GA
|
|
|
21261
21358
|
};
|
|
21262
21359
|
}
|
|
21263
21360
|
|
|
21361
|
+
// ../../modules/runtime/src/run-usage.ts
|
|
21362
|
+
import { readFileSync as readFileSync5, renameSync, writeFileSync as writeFileSync4 } from "fs";
|
|
21363
|
+
import { join as join8 } from "path";
|
|
21364
|
+
var isMark = (value) => {
|
|
21365
|
+
const mark = value;
|
|
21366
|
+
return !!mark && Number.isInteger(mark.index) && typeof mark.title === "string" && typeof mark.tokens === "number" && Number.isFinite(mark.tokens) && mark.tokens >= 0;
|
|
21367
|
+
};
|
|
21368
|
+
var read2 = (path23) => {
|
|
21369
|
+
try {
|
|
21370
|
+
return JSON.parse(readFileSync5(path23, "utf8"));
|
|
21371
|
+
} catch {
|
|
21372
|
+
return void 0;
|
|
21373
|
+
}
|
|
21374
|
+
};
|
|
21375
|
+
function stepUsageRecorder(directory, counted) {
|
|
21376
|
+
const path23 = join8(directory, "usage.json");
|
|
21377
|
+
const stored = read2(path23);
|
|
21378
|
+
const marks = Array.isArray(stored) ? stored.filter(isMark) : [];
|
|
21379
|
+
return ({ closing = false } = {}) => {
|
|
21380
|
+
const step = read2(join8(directory, "step.json"));
|
|
21381
|
+
if (!step || !Number.isInteger(step.index) || typeof step.title !== "string") return;
|
|
21382
|
+
const figure = counted();
|
|
21383
|
+
if (figure === null) return;
|
|
21384
|
+
const last = marks.at(-1);
|
|
21385
|
+
const tokens = Math.max(figure, last?.tokens ?? 0);
|
|
21386
|
+
const sameStep = last?.index === step.index && last?.title === step.title;
|
|
21387
|
+
if (sameStep && !(closing && tokens > last.tokens)) return;
|
|
21388
|
+
marks.push({ index: step.index, title: step.title, tokens });
|
|
21389
|
+
let json = JSON.stringify(marks);
|
|
21390
|
+
if (Buffer.byteLength(json) > ARTIFACT_MAX_BYTES) {
|
|
21391
|
+
for (let i = marks.length - 2; i > 0; i--) {
|
|
21392
|
+
if (marks[i].index === marks[i - 1].index && marks[i].title === marks[i - 1].title) marks.splice(i, 1);
|
|
21393
|
+
}
|
|
21394
|
+
json = JSON.stringify(marks);
|
|
21395
|
+
if (Buffer.byteLength(json) > ARTIFACT_MAX_BYTES) {
|
|
21396
|
+
marks.pop();
|
|
21397
|
+
return;
|
|
21398
|
+
}
|
|
21399
|
+
}
|
|
21400
|
+
writeFileSync4(`${path23}.tmp`, json);
|
|
21401
|
+
renameSync(`${path23}.tmp`, path23);
|
|
21402
|
+
};
|
|
21403
|
+
}
|
|
21404
|
+
|
|
21264
21405
|
// ../../modules/runtime/src/workflow-executor.ts
|
|
21265
21406
|
var isBuildCloseReason = (code) => buildCloseReasonSchema.safeParse(code).success;
|
|
21266
21407
|
var continuationSchema = external_exports.discriminatedUnion("kind", [
|
|
@@ -21382,7 +21523,7 @@ function createWorkflowExecutor(dependencies = {}) {
|
|
|
21382
21523
|
dependencies.dataDirectory ?? runnerDataDirectory(store.sql.database.name),
|
|
21383
21524
|
grant.runId
|
|
21384
21525
|
);
|
|
21385
|
-
const
|
|
21526
|
+
const emitArtifacts = runArtifactEmitter(artifacts, record, (dependencies.artifactIntervalMs ?? 2e3) * 2.5);
|
|
21386
21527
|
const loop = bootstrapped.workflow?.loop;
|
|
21387
21528
|
const childLoop = grant.parent && loop ? { ...loop, maxRunTokens: Math.min(loop.maxRunTokens ?? Infinity, grant.parent.tokenCap) } : loop;
|
|
21388
21529
|
const config2 = {
|
|
@@ -21415,6 +21556,17 @@ function createWorkflowExecutor(dependencies = {}) {
|
|
|
21415
21556
|
}
|
|
21416
21557
|
} : {}
|
|
21417
21558
|
});
|
|
21559
|
+
const recordUsage = stepUsageRecorder(artifacts, () => {
|
|
21560
|
+
const memory = deserializeRunMemory(view2.getLatestRun()?.runMemoryJson);
|
|
21561
|
+
return memory ? budgetTokens(memory) : null;
|
|
21562
|
+
});
|
|
21563
|
+
const sweepArtifacts2 = (midTurn = false, closing = false) => {
|
|
21564
|
+
try {
|
|
21565
|
+
recordUsage({ closing });
|
|
21566
|
+
} catch {
|
|
21567
|
+
}
|
|
21568
|
+
emitArtifacts(midTurn);
|
|
21569
|
+
};
|
|
21418
21570
|
const previous = view2.getLatestRun();
|
|
21419
21571
|
const predecessor = grant.previousRun ? store.sessionValues(grant.sessionId, "workflow").find((snapshot) => snapshot.id === grant.previousRun.runId) : void 0;
|
|
21420
21572
|
const adapterResumeSessionId2 = grant.purpose === "resume" ? previous?.adapterSessionId : predecessor?.adapterSessionId;
|
|
@@ -21422,12 +21574,12 @@ function createWorkflowExecutor(dependencies = {}) {
|
|
|
21422
21574
|
if (continuation?.kind === "answer") {
|
|
21423
21575
|
const pending2 = pendingApproval(store, grant.runId);
|
|
21424
21576
|
if (pending2) {
|
|
21425
|
-
|
|
21577
|
+
writeFileSync5(join9(artifacts, "answer.json"), JSON.stringify(continuation.answer));
|
|
21426
21578
|
record(APPROVAL_ANSWERED, { answer: continuation.answer, plan: pending2.plan });
|
|
21427
21579
|
}
|
|
21428
21580
|
}
|
|
21429
21581
|
const guidedPlan = continuation?.kind === "resume" && continuation.guidance?.trim() && pendingApproval(store, grant.runId) ? continuation.guidance : void 0;
|
|
21430
|
-
if (guidedPlan !== void 0)
|
|
21582
|
+
if (guidedPlan !== void 0) writeFileSync5(join9(artifacts, "answer.json"), JSON.stringify(guidedPlan));
|
|
21431
21583
|
let storedAnswer2;
|
|
21432
21584
|
if (continuation?.kind === "answer") {
|
|
21433
21585
|
const answer = permissionAnswerSchema.safeParse(continuation.answer);
|
|
@@ -21458,7 +21610,7 @@ ${JSON.stringify(continuation.answer)}` : grant.spec.prompt;
|
|
|
21458
21610
|
Current human request:
|
|
21459
21611
|
${prompt2}`;
|
|
21460
21612
|
}
|
|
21461
|
-
return { workingDirectory: workingDirectory2, config: config2, view: view2, adapterResumeSessionId: adapterResumeSessionId2, storedAnswer: storedAnswer2, prompt: prompt2, displayText: displayText2,
|
|
21613
|
+
return { workingDirectory: workingDirectory2, config: config2, view: view2, adapterResumeSessionId: adapterResumeSessionId2, storedAnswer: storedAnswer2, prompt: prompt2, displayText: displayText2, sweepArtifacts: sweepArtifacts2 };
|
|
21462
21614
|
};
|
|
21463
21615
|
let setup2;
|
|
21464
21616
|
try {
|
|
@@ -21470,12 +21622,12 @@ ${prompt2}`;
|
|
|
21470
21622
|
if (error instanceof RunSetupError && isBuildCloseReason(error.code)) return { status: "failed", reason: error.code };
|
|
21471
21623
|
return { status: "failed" };
|
|
21472
21624
|
}
|
|
21473
|
-
const { workingDirectory, config, view, adapterResumeSessionId, storedAnswer, prompt, displayText,
|
|
21625
|
+
const { workingDirectory, config, view, adapterResumeSessionId, storedAnswer, prompt, displayText, sweepArtifacts } = setup2;
|
|
21474
21626
|
const queue = createSteerQueue();
|
|
21475
21627
|
queues.set(grant.runId, queue);
|
|
21476
21628
|
const sweep = setInterval(() => {
|
|
21477
21629
|
try {
|
|
21478
|
-
|
|
21630
|
+
sweepArtifacts(true);
|
|
21479
21631
|
} catch {
|
|
21480
21632
|
}
|
|
21481
21633
|
}, dependencies.artifactIntervalMs ?? 2e3);
|
|
@@ -21511,14 +21663,14 @@ ${prompt2}`;
|
|
|
21511
21663
|
}
|
|
21512
21664
|
});
|
|
21513
21665
|
},
|
|
21514
|
-
onTurnComplete:
|
|
21666
|
+
onTurnComplete: () => sweepArtifacts(false, true),
|
|
21515
21667
|
stdout: { write: () => true },
|
|
21516
21668
|
stderr: { write: (text) => process.stderr.write(text) },
|
|
21517
21669
|
json: false
|
|
21518
21670
|
})).finally(() => {
|
|
21519
21671
|
queues.delete(grant.runId);
|
|
21520
21672
|
clearInterval(sweep);
|
|
21521
|
-
|
|
21673
|
+
sweepArtifacts(false, true);
|
|
21522
21674
|
});
|
|
21523
21675
|
if (!result.workflowOutcome)
|
|
21524
21676
|
throw new Error(result.failure?.message ?? "Workflow returned no authoritative outcome");
|
|
@@ -21654,8 +21806,8 @@ var runnerConfigSchema = external_exports.object({
|
|
|
21654
21806
|
/** The Runner's name in the Team, as Connect recorded it (hostname by default). */
|
|
21655
21807
|
name: external_exports.string().optional()
|
|
21656
21808
|
});
|
|
21657
|
-
var defaultConfigPath = () => process.env.DRISP_RUNNER_CONFIG ??
|
|
21658
|
-
var expandHome = (value) => resolve6(value.startsWith("~/") ?
|
|
21809
|
+
var defaultConfigPath = () => process.env.DRISP_RUNNER_CONFIG ?? join10(homedir4(), ".config", "drisp", "runner-v2.json");
|
|
21810
|
+
var expandHome = (value) => resolve6(value.startsWith("~/") ? join10(homedir4(), value.slice(2)) : value);
|
|
21659
21811
|
async function readRunnerConfig(path23 = defaultConfigPath()) {
|
|
21660
21812
|
const config = runnerConfigSchema.parse(JSON.parse(await readFile4(expandHome(path23), "utf8")));
|
|
21661
21813
|
return { ...config, dataDirectory: expandHome(config.dataDirectory) };
|
|
@@ -21664,7 +21816,7 @@ async function startConfiguredRunner(path23 = defaultConfigPath()) {
|
|
|
21664
21816
|
const config = await readRunnerConfig(path23);
|
|
21665
21817
|
await mkdir5(config.dataDirectory, { recursive: true, mode: 448 });
|
|
21666
21818
|
const store = new ExecutionStore(
|
|
21667
|
-
|
|
21819
|
+
join10(config.dataDirectory, "execution.sqlite"),
|
|
21668
21820
|
{
|
|
21669
21821
|
orgId: config.orgId,
|
|
21670
21822
|
runnerId: config.runnerId,
|
|
@@ -21753,17 +21905,17 @@ async function runConfiguredRunners(paths, abort, { whenAllDisconnected } = {})
|
|
|
21753
21905
|
}
|
|
21754
21906
|
|
|
21755
21907
|
// ../../modules/runtime/src/identities.ts
|
|
21756
|
-
var runnerConfigDirectory = () =>
|
|
21757
|
-
var teamIdentityPath = (hub, orgId, directory = runnerConfigDirectory()) =>
|
|
21908
|
+
var runnerConfigDirectory = () => join11(homedir5(), ".config", "drisp");
|
|
21909
|
+
var teamIdentityPath = (hub, orgId, directory = runnerConfigDirectory()) => join11(directory, "runners", encodeURIComponent(hub.host), `${encodeURIComponent(orgId)}.json`);
|
|
21758
21910
|
function identityHubOrigin({ endpoint }) {
|
|
21759
21911
|
const url = new URL(endpoint);
|
|
21760
21912
|
url.protocol = url.protocol === "wss:" ? "https:" : "http:";
|
|
21761
21913
|
return url.origin;
|
|
21762
21914
|
}
|
|
21763
|
-
var legacyIdentityPath = (directory) =>
|
|
21915
|
+
var legacyIdentityPath = (directory) => join11(directory, "runner-v2.json");
|
|
21764
21916
|
var overriddenIdentityPath = () => process.env.DRISP_RUNNER_CONFIG;
|
|
21765
21917
|
async function machineInstallationId(directory = runnerConfigDirectory()) {
|
|
21766
|
-
const path23 =
|
|
21918
|
+
const path23 = join11(directory, "installation-id");
|
|
21767
21919
|
const existing = await readFile5(path23, "utf8").then((text) => text.trim(), () => "");
|
|
21768
21920
|
if (existing) return existing;
|
|
21769
21921
|
let installationId = crypto.randomUUID();
|
|
@@ -21783,13 +21935,13 @@ async function machineInstallationId(directory = runnerConfigDirectory()) {
|
|
|
21783
21935
|
}
|
|
21784
21936
|
async function runnerIdentities(directory = runnerConfigDirectory()) {
|
|
21785
21937
|
const override = overriddenIdentityPath();
|
|
21786
|
-
const runners =
|
|
21787
|
-
const identityFiles = async (folder) => (await readdir3(folder).catch(() => [])).filter((name) => name.endsWith(".json")).sort().map((name) =>
|
|
21938
|
+
const runners = join11(directory, "runners");
|
|
21939
|
+
const identityFiles = async (folder) => (await readdir3(folder).catch(() => [])).filter((name) => name.endsWith(".json")).sort().map((name) => join11(folder, name));
|
|
21788
21940
|
const hubs = (await readdir3(runners, { withFileTypes: true }).catch(() => [])).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
|
|
21789
21941
|
const paths = override ? [expandHome(override)] : [
|
|
21790
21942
|
legacyIdentityPath(directory),
|
|
21791
21943
|
...await identityFiles(runners),
|
|
21792
|
-
...(await Promise.all(hubs.map((hub) => identityFiles(
|
|
21944
|
+
...(await Promise.all(hubs.map((hub) => identityFiles(join11(runners, hub))))).flat()
|
|
21793
21945
|
];
|
|
21794
21946
|
const present = paths.filter((path23) => existsSync4(path23));
|
|
21795
21947
|
return Promise.all(present.map(async (path23) => ({ path: path23, config: await readRunnerConfig(path23) })));
|
|
@@ -21943,6 +22095,8 @@ export {
|
|
|
21943
22095
|
repoLayoutAt,
|
|
21944
22096
|
approvalAnswer,
|
|
21945
22097
|
mergeGuidance,
|
|
22098
|
+
eligibilityReason,
|
|
22099
|
+
scopeFingerprint,
|
|
21946
22100
|
planBuild,
|
|
21947
22101
|
finalizePlan,
|
|
21948
22102
|
fallbackBranch,
|
|
@@ -21967,4 +22121,4 @@ export {
|
|
|
21967
22121
|
runMachineRunners,
|
|
21968
22122
|
writeIdentityOnce
|
|
21969
22123
|
};
|
|
21970
|
-
//# sourceMappingURL=chunk-
|
|
22124
|
+
//# sourceMappingURL=chunk-HGMJ3YL2.js.map
|