@drisp/cli 0.7.1 → 0.7.2
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-BVWAIVBH.js → WorkflowInstallWizard-K3DWPLYZ.js} +2 -2
- package/dist/{chunk-TRNUPQQJ.js → chunk-2CJ6YKTL.js} +9 -5
- package/dist/{chunk-CPU4RLSW.js → chunk-DAQU2MPK.js} +47 -16
- package/dist/{chunk-LCT645C4.js → chunk-Q4I2HYJ5.js} +2 -2
- package/dist/cli.js +3 -3
- 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-2CJ6YKTL.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-K3DWPLYZ.js.map
|
|
@@ -22322,6 +22322,10 @@ import path10 from "path";
|
|
|
22322
22322
|
// src/core/workflows/continuationPolicy.ts
|
|
22323
22323
|
var DEFAULT_RESTART_TOKENS = 2e3;
|
|
22324
22324
|
var DEFAULT_WORKING_TOKENS = 8e3;
|
|
22325
|
+
function budgetTokens(memory) {
|
|
22326
|
+
if (memory.cumulativeTokens === null) return null;
|
|
22327
|
+
return Math.max(0, memory.cumulativeTokens - (memory.usage?.cacheRead ?? 0));
|
|
22328
|
+
}
|
|
22325
22329
|
function resourceInterruption(stop) {
|
|
22326
22330
|
const names2 = {
|
|
22327
22331
|
tokens: "token budget",
|
|
@@ -23302,7 +23306,7 @@ function admitResult(result, previous, cfg) {
|
|
|
23302
23306
|
const stop = admitContinuation({
|
|
23303
23307
|
loop: cfg.loop,
|
|
23304
23308
|
iteration: memory.iteration,
|
|
23305
|
-
tokens: memory
|
|
23309
|
+
tokens: budgetTokens(memory),
|
|
23306
23310
|
checkpointPath: memory.checkpoint?.path,
|
|
23307
23311
|
context: fresh ? context : void 0
|
|
23308
23312
|
});
|
|
@@ -23750,7 +23754,7 @@ function createWorkflowRunner(input2) {
|
|
|
23750
23754
|
cumulativeTokens: total,
|
|
23751
23755
|
stop: {
|
|
23752
23756
|
...event.stop,
|
|
23753
|
-
...event.stop.cause === "tokens" ? { used: total } : {}
|
|
23757
|
+
...event.stop.cause === "tokens" ? { used: budgetTokens(memory) ?? total } : {}
|
|
23754
23758
|
}
|
|
23755
23759
|
};
|
|
23756
23760
|
}
|
|
@@ -23785,7 +23789,7 @@ function createWorkflowRunner(input2) {
|
|
|
23785
23789
|
const limit = admitContinuation({
|
|
23786
23790
|
loop,
|
|
23787
23791
|
iteration: memory.iteration,
|
|
23788
|
-
tokens: memory
|
|
23792
|
+
tokens: budgetTokens(memory)
|
|
23789
23793
|
});
|
|
23790
23794
|
if (limit) {
|
|
23791
23795
|
stop(limit);
|
|
@@ -23802,7 +23806,7 @@ function createWorkflowRunner(input2) {
|
|
|
23802
23806
|
const decision = admitContinuation({
|
|
23803
23807
|
loop,
|
|
23804
23808
|
iteration: memory.iteration,
|
|
23805
|
-
tokens: memory
|
|
23809
|
+
tokens: budgetTokens(memory),
|
|
23806
23810
|
context: {
|
|
23807
23811
|
opening: usage.openingContextSize,
|
|
23808
23812
|
required: required2,
|
|
@@ -24247,4 +24251,4 @@ export {
|
|
|
24247
24251
|
compileWorkflowPlan,
|
|
24248
24252
|
collectMcpServersWithOptions
|
|
24249
24253
|
};
|
|
24250
|
-
//# sourceMappingURL=chunk-
|
|
24254
|
+
//# sourceMappingURL=chunk-2CJ6YKTL.js.map
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
verifyRendered,
|
|
56
56
|
wakesFreshAfterHandover,
|
|
57
57
|
workflowRegistryDir
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-2CJ6YKTL.js";
|
|
59
59
|
import {
|
|
60
60
|
__commonJS,
|
|
61
61
|
__toESM
|
|
@@ -3487,6 +3487,7 @@ function createTokenAccumulator() {
|
|
|
3487
3487
|
let openingContextSize = 0;
|
|
3488
3488
|
let contextWindowSize = null;
|
|
3489
3489
|
let hasMessageUsage = false;
|
|
3490
|
+
const countedById = /* @__PURE__ */ new Map();
|
|
3490
3491
|
function promptSize(usage) {
|
|
3491
3492
|
return (usage.input_tokens ?? 0) + (usage.cache_read_input_tokens ?? 0) + (usage.cache_creation_input_tokens ?? 0);
|
|
3492
3493
|
}
|
|
@@ -3544,10 +3545,13 @@ function createTokenAccumulator() {
|
|
|
3544
3545
|
}
|
|
3545
3546
|
} else {
|
|
3546
3547
|
hasMessageUsage = true;
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3548
|
+
const messageId = isAssistantEnvelope ? parsed.message["id"] : parsed["id"];
|
|
3549
|
+
const counted = typeof messageId === "string" ? countedById.get(messageId) : void 0;
|
|
3550
|
+
inputTokens += (usage.input_tokens ?? 0) - (counted?.input_tokens ?? 0);
|
|
3551
|
+
outputTokens += (usage.output_tokens ?? 0) - (counted?.output_tokens ?? 0);
|
|
3552
|
+
cacheRead += (usage.cache_read_input_tokens ?? 0) - (counted?.cache_read_input_tokens ?? 0);
|
|
3553
|
+
cacheWrite += (usage.cache_creation_input_tokens ?? 0) - (counted?.cache_creation_input_tokens ?? 0);
|
|
3554
|
+
if (typeof messageId === "string") countedById.set(messageId, usage);
|
|
3551
3555
|
if (!isSubagent) {
|
|
3552
3556
|
observeRootContext(promptSize(usage));
|
|
3553
3557
|
}
|
|
@@ -3601,6 +3605,7 @@ function createTokenAccumulator() {
|
|
|
3601
3605
|
reset() {
|
|
3602
3606
|
buffer = "";
|
|
3603
3607
|
hasMessageUsage = false;
|
|
3608
|
+
countedById.clear();
|
|
3604
3609
|
inputTokens = 0;
|
|
3605
3610
|
outputTokens = 0;
|
|
3606
3611
|
cacheRead = 0;
|
|
@@ -14868,7 +14873,7 @@ async function restoreCheckpoint(store, input) {
|
|
|
14868
14873
|
|
|
14869
14874
|
// ../../modules/runtime/src/software-version.ts
|
|
14870
14875
|
import "fs";
|
|
14871
|
-
var runnerSoftwareVersion = true ? "0.7.
|
|
14876
|
+
var runnerSoftwareVersion = true ? "0.7.2" : JSON.parse(readFileSync2(new URL("../../../apps/cli/package.json", import.meta.url), "utf8")).version;
|
|
14872
14877
|
|
|
14873
14878
|
// ../../modules/runtime/src/connection.ts
|
|
14874
14879
|
var RunnerDisconnectedError = class extends Error {
|
|
@@ -20125,7 +20130,7 @@ function sessionStore(store, runId, options = {}) {
|
|
|
20125
20130
|
|
|
20126
20131
|
// ../../modules/runtime/src/workflow-executor.ts
|
|
20127
20132
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
20128
|
-
import { statSync as
|
|
20133
|
+
import { statSync as statSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
20129
20134
|
import { join as join8 } from "path";
|
|
20130
20135
|
|
|
20131
20136
|
// src/core/build/workspace.ts
|
|
@@ -21148,20 +21153,22 @@ async function closeOrphanedRuns(store, {
|
|
|
21148
21153
|
|
|
21149
21154
|
// ../../modules/runtime/src/run-artifacts.ts
|
|
21150
21155
|
import { createHash as createHash3 } from "crypto";
|
|
21151
|
-
import { mkdirSync as mkdirSync2, readdirSync as readdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
21156
|
+
import { mkdirSync as mkdirSync2, readdirSync as readdirSync2, readFileSync as readFileSync4, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
21152
21157
|
import { tmpdir as tmpdir5 } from "os";
|
|
21153
21158
|
import { dirname as dirname4, join as join7 } from "path";
|
|
21154
21159
|
var ARTIFACT_MAX_BYTES = 64 * 1024;
|
|
21155
21160
|
var ARTIFACT_NAME = /^[a-z][a-z0-9_]{0,63}$/;
|
|
21156
21161
|
var NEVER_EMITTED = /* @__PURE__ */ new Set(["answer"]);
|
|
21157
21162
|
var EMITTED_STATE = ".emitted.json";
|
|
21163
|
+
var MID_TURN_MAX_BYTES = 1024 * 1024;
|
|
21164
|
+
var MID_TURN_MIN_GAP_MS = 5e3;
|
|
21158
21165
|
function runnerDataDirectory(databasePath) {
|
|
21159
21166
|
return databasePath && databasePath !== ":memory:" ? dirname4(databasePath) : join7(tmpdir5(), "drisp-runner");
|
|
21160
21167
|
}
|
|
21161
21168
|
function runArtifactsDirectory(dataDirectory, runId) {
|
|
21162
21169
|
return join7(dataDirectory, "artifacts", runId) + "/";
|
|
21163
21170
|
}
|
|
21164
|
-
function runArtifactEmitter(directory, record) {
|
|
21171
|
+
function runArtifactEmitter(directory, record, midTurnMinGapMs = MID_TURN_MIN_GAP_MS) {
|
|
21165
21172
|
mkdirSync2(directory, { recursive: true, mode: 448 });
|
|
21166
21173
|
const statePath = join7(directory, EMITTED_STATE);
|
|
21167
21174
|
let emitted = {};
|
|
@@ -21169,27 +21176,43 @@ function runArtifactEmitter(directory, record) {
|
|
|
21169
21176
|
emitted = JSON.parse(readFileSync4(statePath, "utf8"));
|
|
21170
21177
|
} catch {
|
|
21171
21178
|
}
|
|
21172
|
-
|
|
21179
|
+
const lastEmittedAt = {};
|
|
21180
|
+
return (midTurn = false) => {
|
|
21173
21181
|
let changed = false;
|
|
21182
|
+
const now = Date.now();
|
|
21174
21183
|
for (const entry of readdirSync2(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
21175
21184
|
if (!entry.isFile() || !entry.name.endsWith(".json")) continue;
|
|
21176
21185
|
const name = entry.name.slice(0, -".json".length);
|
|
21177
21186
|
if (!ARTIFACT_NAME.test(name) || NEVER_EMITTED.has(name)) continue;
|
|
21178
|
-
const
|
|
21187
|
+
const path23 = join7(directory, entry.name);
|
|
21188
|
+
let bytes;
|
|
21189
|
+
try {
|
|
21190
|
+
if (midTurn) {
|
|
21191
|
+
if (statSync2(path23).size > MID_TURN_MAX_BYTES) continue;
|
|
21192
|
+
if (now - (lastEmittedAt[name] ?? -Infinity) < midTurnMinGapMs) continue;
|
|
21193
|
+
}
|
|
21194
|
+
bytes = readFileSync4(path23);
|
|
21195
|
+
} catch {
|
|
21196
|
+
continue;
|
|
21197
|
+
}
|
|
21179
21198
|
const hash = createHash3("sha256").update(bytes).digest("hex");
|
|
21180
21199
|
if (emitted[name] === hash) continue;
|
|
21181
|
-
emitted[name] = hash;
|
|
21182
|
-
changed = true;
|
|
21183
21200
|
let json;
|
|
21184
21201
|
try {
|
|
21185
21202
|
json = JSON.parse(bytes.toString("utf8"));
|
|
21186
21203
|
} catch {
|
|
21204
|
+
if (midTurn) continue;
|
|
21187
21205
|
record("run.artifact_rejected", { name, bytes: bytes.length });
|
|
21206
|
+
emitted[name] = hash;
|
|
21207
|
+
changed = true;
|
|
21188
21208
|
continue;
|
|
21189
21209
|
}
|
|
21190
21210
|
const serialized = Buffer.byteLength(JSON.stringify(json));
|
|
21191
21211
|
if (serialized > ARTIFACT_MAX_BYTES) record("run.artifact_rejected", { name, bytes: serialized });
|
|
21192
21212
|
else record("run.artifact", { name, json });
|
|
21213
|
+
emitted[name] = hash;
|
|
21214
|
+
lastEmittedAt[name] = now;
|
|
21215
|
+
changed = true;
|
|
21193
21216
|
}
|
|
21194
21217
|
if (changed) writeFileSync3(statePath, JSON.stringify(emitted));
|
|
21195
21218
|
};
|
|
@@ -21225,7 +21248,7 @@ function delegationEnvironment(grant, hubUrl) {
|
|
|
21225
21248
|
function requireProjectDirectory(projectDir) {
|
|
21226
21249
|
let directory = false;
|
|
21227
21250
|
try {
|
|
21228
|
-
directory =
|
|
21251
|
+
directory = statSync3(projectDir).isDirectory();
|
|
21229
21252
|
} catch {
|
|
21230
21253
|
}
|
|
21231
21254
|
if (!directory)
|
|
@@ -21316,7 +21339,7 @@ function createWorkflowExecutor(dependencies = {}) {
|
|
|
21316
21339
|
dependencies.dataDirectory ?? runnerDataDirectory(store.sql.database.name),
|
|
21317
21340
|
grant.runId
|
|
21318
21341
|
);
|
|
21319
|
-
const emitArtifacts2 = runArtifactEmitter(artifacts, record);
|
|
21342
|
+
const emitArtifacts2 = runArtifactEmitter(artifacts, record, (dependencies.artifactIntervalMs ?? 2e3) * 2.5);
|
|
21320
21343
|
const loop = bootstrapped.workflow?.loop;
|
|
21321
21344
|
const childLoop = grant.parent && loop ? { ...loop, maxRunTokens: Math.min(loop.maxRunTokens ?? Infinity, grant.parent.tokenCap) } : loop;
|
|
21322
21345
|
const config2 = {
|
|
@@ -21403,6 +21426,13 @@ ${prompt2}`;
|
|
|
21403
21426
|
const { workingDirectory, config, view, adapterResumeSessionId, storedAnswer, prompt, displayText, emitArtifacts } = setup2;
|
|
21404
21427
|
const queue = createSteerQueue();
|
|
21405
21428
|
queues.set(grant.runId, queue);
|
|
21429
|
+
const sweep = setInterval(() => {
|
|
21430
|
+
try {
|
|
21431
|
+
emitArtifacts(true);
|
|
21432
|
+
} catch {
|
|
21433
|
+
}
|
|
21434
|
+
}, dependencies.artifactIntervalMs ?? 2e3);
|
|
21435
|
+
sweep.unref();
|
|
21406
21436
|
const result = await trackHarnessProcesses(store, grant.runId, () => (dependencies.execute ?? runExec)({
|
|
21407
21437
|
prompt,
|
|
21408
21438
|
promptPresentation: displayText === void 0 ? { origin: "workflow" } : { origin: "human", displayText },
|
|
@@ -21440,6 +21470,7 @@ ${prompt2}`;
|
|
|
21440
21470
|
json: false
|
|
21441
21471
|
})).finally(() => {
|
|
21442
21472
|
queues.delete(grant.runId);
|
|
21473
|
+
clearInterval(sweep);
|
|
21443
21474
|
emitArtifacts();
|
|
21444
21475
|
});
|
|
21445
21476
|
if (!result.workflowOutcome)
|
|
@@ -21887,4 +21918,4 @@ export {
|
|
|
21887
21918
|
runMachineRunners,
|
|
21888
21919
|
writeIdentityOnce
|
|
21889
21920
|
};
|
|
21890
|
-
//# sourceMappingURL=chunk-
|
|
21921
|
+
//# sourceMappingURL=chunk-DAQU2MPK.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runMachineRunners
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DAQU2MPK.js";
|
|
4
4
|
|
|
5
5
|
// src/app/entry/runnerDaemon.ts
|
|
6
6
|
if (process.argv.includes("--help")) {
|
|
@@ -13,4 +13,4 @@ if (process.argv.includes("--help")) {
|
|
|
13
13
|
process.exitCode = 1;
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-Q4I2HYJ5.js.map
|
package/dist/cli.js
CHANGED
|
@@ -138,7 +138,7 @@ import {
|
|
|
138
138
|
visualPositionToOffset,
|
|
139
139
|
wrapText,
|
|
140
140
|
writeIdentityOnce
|
|
141
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-DAQU2MPK.js";
|
|
142
142
|
import {
|
|
143
143
|
generateId as generateId2
|
|
144
144
|
} from "./chunk-PQIB66SG.js";
|
|
@@ -196,7 +196,7 @@ import {
|
|
|
196
196
|
workflowRegistryDir,
|
|
197
197
|
writeGlobalConfig,
|
|
198
198
|
writeProjectConfig
|
|
199
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-2CJ6YKTL.js";
|
|
200
200
|
import {
|
|
201
201
|
__toESM
|
|
202
202
|
} from "./chunk-G3PMV62Z.js";
|
|
@@ -15939,7 +15939,7 @@ Available commands: ${[...KNOWN_COMMANDS].join(", ")}`
|
|
|
15939
15939
|
await exitWith(1);
|
|
15940
15940
|
return;
|
|
15941
15941
|
}
|
|
15942
|
-
const { default: WorkflowInstallWizard } = await import("./WorkflowInstallWizard-
|
|
15942
|
+
const { default: WorkflowInstallWizard } = await import("./WorkflowInstallWizard-K3DWPLYZ.js");
|
|
15943
15943
|
const { waitUntilExit } = render(
|
|
15944
15944
|
/* @__PURE__ */ jsx24(
|
|
15945
15945
|
WorkflowInstallWizard,
|
package/dist/dashboard-daemon.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./chunk-
|
|
2
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-Q4I2HYJ5.js";
|
|
2
|
+
import "./chunk-DAQU2MPK.js";
|
|
3
3
|
import "./chunk-PQIB66SG.js";
|
|
4
|
-
import "./chunk-
|
|
4
|
+
import "./chunk-2CJ6YKTL.js";
|
|
5
5
|
import "./chunk-G3PMV62Z.js";
|
|
6
6
|
//# sourceMappingURL=dashboard-daemon.js.map
|
package/dist/runner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./chunk-
|
|
2
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-Q4I2HYJ5.js";
|
|
2
|
+
import "./chunk-DAQU2MPK.js";
|
|
3
3
|
import "./chunk-PQIB66SG.js";
|
|
4
|
-
import "./chunk-
|
|
4
|
+
import "./chunk-2CJ6YKTL.js";
|
|
5
5
|
import "./chunk-G3PMV62Z.js";
|
|
6
6
|
//# sourceMappingURL=runner.js.map
|