wildcrane-runner 0.6.99 → 0.6.101
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/akb/dist/kanban.mjs +409 -102
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/codex-proxy.mjs +1 -1
- package/dist/codex-retained.mjs +1 -1
- package/dist/flow-worker-main.mjs +1247 -781
- package/dist/launcher.mjs +111 -22
- package/dist/plugin.mjs +111 -22
- package/dist/runner.mjs +1316 -842
- package/dist/settings.mjs +111 -22
- package/package.json +1 -1
package/dist/launcher.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.101 — built by runner/scripts/build.mjs. Do not edit.
|
|
2
2
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
3
3
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
4
4
|
var __create = Object.create;
|
|
@@ -41142,8 +41142,8 @@ function saveAlphaUpdates(value) {
|
|
|
41142
41142
|
}
|
|
41143
41143
|
|
|
41144
41144
|
// src/protocol.ts
|
|
41145
|
-
var VERSION = true ? "0.6.
|
|
41146
|
-
var AKB_VERSION = true ? "0.11.
|
|
41145
|
+
var VERSION = true ? "0.6.101" : "0.0.0";
|
|
41146
|
+
var AKB_VERSION = true ? "0.11.81" : "0.0.0";
|
|
41147
41147
|
var EXIT_REFUSED = 10;
|
|
41148
41148
|
var EXIT_OUTDATED = 11;
|
|
41149
41149
|
var EXIT_UPDATE = 12;
|
|
@@ -63350,6 +63350,7 @@ function antigravityPrices(at) {
|
|
|
63350
63350
|
return {
|
|
63351
63351
|
"gemini-4-carbon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
|
|
63352
63352
|
"gemini-4-argon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
|
|
63353
|
+
"gemini-4-neon": { input: 3, cachedInput: 0.15, output: 15 },
|
|
63353
63354
|
"gemini-4-hydrogen": { input: 1.5, cachedInput: 0.075, output: 7.5 },
|
|
63354
63355
|
"gemini-3.8-flash": { input: flash, cachedInput: flash / 10, output: flash * 5 }
|
|
63355
63356
|
};
|
|
@@ -63622,9 +63623,37 @@ function bytesField(data, field) {
|
|
|
63622
63623
|
if (number4 === field && value instanceof Uint8Array) return value;
|
|
63623
63624
|
}
|
|
63624
63625
|
}
|
|
63626
|
+
function varintField(data, field) {
|
|
63627
|
+
if (!(data instanceof Uint8Array)) return;
|
|
63628
|
+
for (const [number4, value] of fields(data)) {
|
|
63629
|
+
if (number4 === field && typeof value === "number") return value;
|
|
63630
|
+
}
|
|
63631
|
+
}
|
|
63632
|
+
function stepIndices(data) {
|
|
63633
|
+
const out = [];
|
|
63634
|
+
for (const [field, value] of fields(data)) {
|
|
63635
|
+
if (field !== 2) continue;
|
|
63636
|
+
if (typeof value === "number") out.push(value);
|
|
63637
|
+
else {
|
|
63638
|
+
const offset = { value: 0 };
|
|
63639
|
+
while (offset.value < value.length) out.push(varint(value, offset));
|
|
63640
|
+
}
|
|
63641
|
+
}
|
|
63642
|
+
return out;
|
|
63643
|
+
}
|
|
63644
|
+
function recordedContextLimit(data) {
|
|
63645
|
+
const limit = varintField(bytesField(bytesField(bytesField(data, 1), 9), 10), 4);
|
|
63646
|
+
return limit !== void 0 && Number.isSafeInteger(limit) && limit > 0 ? limit : void 0;
|
|
63647
|
+
}
|
|
63625
63648
|
var utf8 = (bytes2) => bytes2 && Buffer.from(bytes2).toString("utf8");
|
|
63649
|
+
function stepUuid(stepRow, index) {
|
|
63650
|
+
if (!Number.isSafeInteger(index) || index < 0) return;
|
|
63651
|
+
const id2 = bytesField(stepRow.get(index)?.metadata, 12);
|
|
63652
|
+
return id2?.length === 36 ? id2 : void 0;
|
|
63653
|
+
}
|
|
63626
63654
|
function antigravityRecordedModels(session, steps) {
|
|
63627
63655
|
const found = /* @__PURE__ */ new Map();
|
|
63656
|
+
if (!steps.size) return found;
|
|
63628
63657
|
const file3 = antigravityConversationFile(session);
|
|
63629
63658
|
if (!file3 || !existsSync(file3)) return found;
|
|
63630
63659
|
try {
|
|
@@ -63632,26 +63661,31 @@ function antigravityRecordedModels(session, steps) {
|
|
|
63632
63661
|
if (!sqlite) return found;
|
|
63633
63662
|
const db = new sqlite.DatabaseSync(file3, { readOnly: true });
|
|
63634
63663
|
try {
|
|
63635
|
-
const
|
|
63664
|
+
const stepRow = db.prepare("SELECT metadata FROM steps WHERE idx = ?");
|
|
63665
|
+
const promptIds = /* @__PURE__ */ new Map();
|
|
63666
|
+
const promptUuid = (prompt) => {
|
|
63667
|
+
if (!promptIds.has(prompt)) promptIds.set(prompt, stepUuid(stepRow, prompt));
|
|
63668
|
+
return promptIds.get(prompt);
|
|
63669
|
+
};
|
|
63670
|
+
const groups = /* @__PURE__ */ new Map();
|
|
63671
|
+
for (const [index, { prompt }] of steps) {
|
|
63672
|
+
if (!Number.isSafeInteger(index) || index < 0) continue;
|
|
63673
|
+
const id2 = stepUuid(stepRow, index) ?? promptUuid(prompt);
|
|
63674
|
+
if (!id2) continue;
|
|
63675
|
+
const uuid3 = utf8(id2);
|
|
63676
|
+
let group = groups.get(uuid3);
|
|
63677
|
+
if (!group) groups.set(uuid3, group = { id: id2, steps: /* @__PURE__ */ new Set() });
|
|
63678
|
+
group.steps.add(index);
|
|
63679
|
+
}
|
|
63636
63680
|
const generations = db.prepare("SELECT data FROM gen_metadata WHERE instr(data, ?) > 0");
|
|
63637
|
-
for (const
|
|
63638
|
-
const id2 = bytesField(prompt.get(index)?.metadata, 12);
|
|
63639
|
-
if (id2?.length !== 36) continue;
|
|
63681
|
+
for (const [uuid3, { id: id2, steps: groupSteps }] of groups) {
|
|
63640
63682
|
const key = Buffer.concat([Buffer.from([34, 36]), id2]);
|
|
63641
63683
|
for (const { data } of generations.iterate(key)) {
|
|
63642
|
-
if (!(data instanceof Uint8Array) || utf8(bytesField(data, 4)) !==
|
|
63684
|
+
if (!(data instanceof Uint8Array) || utf8(bytesField(data, 4)) !== uuid3) continue;
|
|
63643
63685
|
const model = utf8(bytesField(bytesField(data, 1), 19)) || void 0;
|
|
63644
|
-
const
|
|
63645
|
-
if (
|
|
63686
|
+
for (const step of stepIndices(data)) {
|
|
63687
|
+
if (!groupSteps.has(step)) continue;
|
|
63646
63688
|
found.set(step, found.has(step) && found.get(step) !== model ? void 0 : model);
|
|
63647
|
-
};
|
|
63648
|
-
for (const [field, value] of fields(data)) {
|
|
63649
|
-
if (field !== 2) continue;
|
|
63650
|
-
if (typeof value === "number") record2(value);
|
|
63651
|
-
else {
|
|
63652
|
-
const offset = { value: 0 };
|
|
63653
|
-
while (offset.value < value.length) record2(varint(value, offset));
|
|
63654
|
-
}
|
|
63655
63689
|
}
|
|
63656
63690
|
}
|
|
63657
63691
|
}
|
|
@@ -63663,8 +63697,41 @@ function antigravityRecordedModels(session, steps) {
|
|
|
63663
63697
|
return /* @__PURE__ */ new Map();
|
|
63664
63698
|
}
|
|
63665
63699
|
}
|
|
63700
|
+
function antigravityRecordedContextLimit(session, step, prompt) {
|
|
63701
|
+
if (!Number.isSafeInteger(step) || step < 0) return;
|
|
63702
|
+
const file3 = antigravityConversationFile(session);
|
|
63703
|
+
if (!file3 || !existsSync(file3)) return;
|
|
63704
|
+
try {
|
|
63705
|
+
const sqlite = process.getBuiltinModule?.("node:sqlite");
|
|
63706
|
+
if (!sqlite) return;
|
|
63707
|
+
const db = new sqlite.DatabaseSync(file3, { readOnly: true });
|
|
63708
|
+
try {
|
|
63709
|
+
const stepRow = db.prepare("SELECT metadata FROM steps WHERE idx = ?");
|
|
63710
|
+
const id2 = stepUuid(stepRow, step) ?? stepUuid(stepRow, prompt);
|
|
63711
|
+
if (!id2) return;
|
|
63712
|
+
const key = Buffer.concat([Buffer.from([34, 36]), id2]);
|
|
63713
|
+
const generations = db.prepare("SELECT data FROM gen_metadata WHERE instr(data, ?) > 0");
|
|
63714
|
+
let found;
|
|
63715
|
+
let matched = false;
|
|
63716
|
+
for (const { data } of generations.iterate(key)) {
|
|
63717
|
+
if (!(data instanceof Uint8Array) || utf8(bytesField(data, 4)) !== utf8(id2)) continue;
|
|
63718
|
+
if (!stepIndices(data).includes(step)) continue;
|
|
63719
|
+
const limit = recordedContextLimit(data);
|
|
63720
|
+
if (matched && found !== limit) return;
|
|
63721
|
+
found = limit;
|
|
63722
|
+
matched = true;
|
|
63723
|
+
}
|
|
63724
|
+
return found;
|
|
63725
|
+
} finally {
|
|
63726
|
+
db.close();
|
|
63727
|
+
}
|
|
63728
|
+
} catch {
|
|
63729
|
+
return;
|
|
63730
|
+
}
|
|
63731
|
+
}
|
|
63666
63732
|
|
|
63667
63733
|
// ../cli/src/lib/agent/wire/antigravity.ts
|
|
63734
|
+
var CONTEXT_LOOK_EVERY_MS = 250;
|
|
63668
63735
|
var KINDS = {
|
|
63669
63736
|
run_command: "execute",
|
|
63670
63737
|
command_status: "execute",
|
|
@@ -63711,6 +63778,20 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
63711
63778
|
let stderr = "";
|
|
63712
63779
|
let context;
|
|
63713
63780
|
let contextStep = -1;
|
|
63781
|
+
let contextPrompt = -1;
|
|
63782
|
+
let contextLimitStep = -1;
|
|
63783
|
+
let contextLimitLookedAt = 0;
|
|
63784
|
+
const resolveContextLimit = (now) => {
|
|
63785
|
+
if (!context || !session || contextStep < 0 || contextLimitStep === contextStep) return;
|
|
63786
|
+
const at = Date.now();
|
|
63787
|
+
if (!now && at - contextLimitLookedAt < CONTEXT_LOOK_EVERY_MS) return;
|
|
63788
|
+
contextLimitLookedAt = at;
|
|
63789
|
+
const limit = antigravityRecordedContextLimit(session, contextStep, contextPrompt);
|
|
63790
|
+
if (limit !== void 0) {
|
|
63791
|
+
context = { used: context.used, limit };
|
|
63792
|
+
contextLimitStep = contextStep;
|
|
63793
|
+
}
|
|
63794
|
+
};
|
|
63714
63795
|
const started = Date.now();
|
|
63715
63796
|
let cost;
|
|
63716
63797
|
let incomplete = false;
|
|
@@ -63776,10 +63857,13 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
63776
63857
|
const index = num2(step.step_index);
|
|
63777
63858
|
if (step.state === "DONE" && Number.isSafeInteger(index) && step.step_index === index && index > contextStep) {
|
|
63778
63859
|
contextStep = index;
|
|
63860
|
+
contextPrompt = prompt;
|
|
63861
|
+
contextLimitStep = -1;
|
|
63862
|
+
contextLimitLookedAt = 0;
|
|
63779
63863
|
const u = obj2(step.usage);
|
|
63780
63864
|
const counts = [u.input_tokens, u.cache_read_tokens];
|
|
63781
|
-
const
|
|
63782
|
-
context =
|
|
63865
|
+
const promptTokens = counts.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0) ? num2(u.input_tokens) + num2(u.cache_read_tokens) : 0;
|
|
63866
|
+
context = promptTokens > 0 && Number.isFinite(promptTokens) ? { used: promptTokens } : void 0;
|
|
63783
63867
|
}
|
|
63784
63868
|
if (step.state === "DONE" && step.usage && !counted.has(index)) {
|
|
63785
63869
|
counted.add(index);
|
|
@@ -63832,6 +63916,7 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
63832
63916
|
return "";
|
|
63833
63917
|
}
|
|
63834
63918
|
session ||= str2(result.conversation_id) || void 0;
|
|
63919
|
+
resolveContextLimit(true);
|
|
63835
63920
|
terminal = true;
|
|
63836
63921
|
final = typeof result.response === "string" ? result.response : void 0;
|
|
63837
63922
|
const total = usageOf(result.usage);
|
|
@@ -63863,6 +63948,7 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
63863
63948
|
},
|
|
63864
63949
|
flush() {
|
|
63865
63950
|
const text2 = reader.flush();
|
|
63951
|
+
resolveContextLimit(true);
|
|
63866
63952
|
if (pendingCosts.size) {
|
|
63867
63953
|
const models = session ? antigravityRecordedModels(session, pendingCosts) : void 0;
|
|
63868
63954
|
for (const [index, { usage }] of pendingCosts) estimate(models?.get(index), usage);
|
|
@@ -63885,7 +63971,10 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
63885
63971
|
usage: () => used,
|
|
63886
63972
|
costUsd: () => cost,
|
|
63887
63973
|
costIncomplete: () => incomplete || void 0,
|
|
63888
|
-
context: () =>
|
|
63974
|
+
context: () => {
|
|
63975
|
+
resolveContextLimit(false);
|
|
63976
|
+
return context;
|
|
63977
|
+
},
|
|
63889
63978
|
failure: () => failure3 || imageFailure,
|
|
63890
63979
|
terminalFailure: () => terminal && !!classified,
|
|
63891
63980
|
executionFailure: () => classified ?? (imageFailure ? { code: "image_read_failed", level: 3, reason: imageFailure } : void 0),
|
|
@@ -65233,7 +65322,7 @@ function createTail(log) {
|
|
|
65233
65322
|
// ../cli/package.json
|
|
65234
65323
|
var package_default = {
|
|
65235
65324
|
name: "wildcrane",
|
|
65236
|
-
version: "0.11.
|
|
65325
|
+
version: "0.11.81",
|
|
65237
65326
|
akbContract: 27,
|
|
65238
65327
|
description: "WildCrane's `akb` command \u2014 scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
|
|
65239
65328
|
keywords: [
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.101 — built by runner/scripts/build.mjs. Do not edit.
|
|
2
2
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
3
3
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
4
4
|
var __create = Object.create;
|
|
@@ -107920,8 +107920,8 @@ function machineId() {
|
|
|
107920
107920
|
var machineName = () => os3.hostname().replace(/\.local$/, "");
|
|
107921
107921
|
|
|
107922
107922
|
// src/protocol.ts
|
|
107923
|
-
var VERSION = true ? "0.6.
|
|
107924
|
-
var AKB_VERSION = true ? "0.11.
|
|
107923
|
+
var VERSION = true ? "0.6.101" : "0.0.0";
|
|
107924
|
+
var AKB_VERSION = true ? "0.11.81" : "0.0.0";
|
|
107925
107925
|
var EXIT_REFUSED = 10;
|
|
107926
107926
|
var EXIT_OUTDATED = 11;
|
|
107927
107927
|
var EXIT_UPDATE = 12;
|
|
@@ -109962,6 +109962,7 @@ function antigravityPrices(at) {
|
|
|
109962
109962
|
return {
|
|
109963
109963
|
"gemini-4-carbon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
|
|
109964
109964
|
"gemini-4-argon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
|
|
109965
|
+
"gemini-4-neon": { input: 3, cachedInput: 0.15, output: 15 },
|
|
109965
109966
|
"gemini-4-hydrogen": { input: 1.5, cachedInput: 0.075, output: 7.5 },
|
|
109966
109967
|
"gemini-3.8-flash": { input: flash, cachedInput: flash / 10, output: flash * 5 }
|
|
109967
109968
|
};
|
|
@@ -110234,9 +110235,37 @@ function bytesField(data, field) {
|
|
|
110234
110235
|
if (number6 === field && value instanceof Uint8Array) return value;
|
|
110235
110236
|
}
|
|
110236
110237
|
}
|
|
110238
|
+
function varintField(data, field) {
|
|
110239
|
+
if (!(data instanceof Uint8Array)) return;
|
|
110240
|
+
for (const [number6, value] of fields(data)) {
|
|
110241
|
+
if (number6 === field && typeof value === "number") return value;
|
|
110242
|
+
}
|
|
110243
|
+
}
|
|
110244
|
+
function stepIndices(data) {
|
|
110245
|
+
const out = [];
|
|
110246
|
+
for (const [field, value] of fields(data)) {
|
|
110247
|
+
if (field !== 2) continue;
|
|
110248
|
+
if (typeof value === "number") out.push(value);
|
|
110249
|
+
else {
|
|
110250
|
+
const offset = { value: 0 };
|
|
110251
|
+
while (offset.value < value.length) out.push(varint(value, offset));
|
|
110252
|
+
}
|
|
110253
|
+
}
|
|
110254
|
+
return out;
|
|
110255
|
+
}
|
|
110256
|
+
function recordedContextLimit(data) {
|
|
110257
|
+
const limit = varintField(bytesField(bytesField(bytesField(data, 1), 9), 10), 4);
|
|
110258
|
+
return limit !== void 0 && Number.isSafeInteger(limit) && limit > 0 ? limit : void 0;
|
|
110259
|
+
}
|
|
110237
110260
|
var utf8 = (bytes2) => bytes2 && Buffer.from(bytes2).toString("utf8");
|
|
110261
|
+
function stepUuid(stepRow, index) {
|
|
110262
|
+
if (!Number.isSafeInteger(index) || index < 0) return;
|
|
110263
|
+
const id2 = bytesField(stepRow.get(index)?.metadata, 12);
|
|
110264
|
+
return id2?.length === 36 ? id2 : void 0;
|
|
110265
|
+
}
|
|
110238
110266
|
function antigravityRecordedModels(session, steps) {
|
|
110239
110267
|
const found = /* @__PURE__ */ new Map();
|
|
110268
|
+
if (!steps.size) return found;
|
|
110240
110269
|
const file3 = antigravityConversationFile(session);
|
|
110241
110270
|
if (!file3 || !existsSync(file3)) return found;
|
|
110242
110271
|
try {
|
|
@@ -110244,26 +110273,31 @@ function antigravityRecordedModels(session, steps) {
|
|
|
110244
110273
|
if (!sqlite) return found;
|
|
110245
110274
|
const db = new sqlite.DatabaseSync(file3, { readOnly: true });
|
|
110246
110275
|
try {
|
|
110247
|
-
const
|
|
110276
|
+
const stepRow = db.prepare("SELECT metadata FROM steps WHERE idx = ?");
|
|
110277
|
+
const promptIds = /* @__PURE__ */ new Map();
|
|
110278
|
+
const promptUuid = (prompt) => {
|
|
110279
|
+
if (!promptIds.has(prompt)) promptIds.set(prompt, stepUuid(stepRow, prompt));
|
|
110280
|
+
return promptIds.get(prompt);
|
|
110281
|
+
};
|
|
110282
|
+
const groups = /* @__PURE__ */ new Map();
|
|
110283
|
+
for (const [index, { prompt }] of steps) {
|
|
110284
|
+
if (!Number.isSafeInteger(index) || index < 0) continue;
|
|
110285
|
+
const id2 = stepUuid(stepRow, index) ?? promptUuid(prompt);
|
|
110286
|
+
if (!id2) continue;
|
|
110287
|
+
const uuid5 = utf8(id2);
|
|
110288
|
+
let group = groups.get(uuid5);
|
|
110289
|
+
if (!group) groups.set(uuid5, group = { id: id2, steps: /* @__PURE__ */ new Set() });
|
|
110290
|
+
group.steps.add(index);
|
|
110291
|
+
}
|
|
110248
110292
|
const generations = db.prepare("SELECT data FROM gen_metadata WHERE instr(data, ?) > 0");
|
|
110249
|
-
for (const
|
|
110250
|
-
const id2 = bytesField(prompt.get(index)?.metadata, 12);
|
|
110251
|
-
if (id2?.length !== 36) continue;
|
|
110293
|
+
for (const [uuid5, { id: id2, steps: groupSteps }] of groups) {
|
|
110252
110294
|
const key = Buffer.concat([Buffer.from([34, 36]), id2]);
|
|
110253
110295
|
for (const { data } of generations.iterate(key)) {
|
|
110254
|
-
if (!(data instanceof Uint8Array) || utf8(bytesField(data, 4)) !==
|
|
110296
|
+
if (!(data instanceof Uint8Array) || utf8(bytesField(data, 4)) !== uuid5) continue;
|
|
110255
110297
|
const model = utf8(bytesField(bytesField(data, 1), 19)) || void 0;
|
|
110256
|
-
const
|
|
110257
|
-
if (
|
|
110298
|
+
for (const step of stepIndices(data)) {
|
|
110299
|
+
if (!groupSteps.has(step)) continue;
|
|
110258
110300
|
found.set(step, found.has(step) && found.get(step) !== model ? void 0 : model);
|
|
110259
|
-
};
|
|
110260
|
-
for (const [field, value] of fields(data)) {
|
|
110261
|
-
if (field !== 2) continue;
|
|
110262
|
-
if (typeof value === "number") record3(value);
|
|
110263
|
-
else {
|
|
110264
|
-
const offset = { value: 0 };
|
|
110265
|
-
while (offset.value < value.length) record3(varint(value, offset));
|
|
110266
|
-
}
|
|
110267
110301
|
}
|
|
110268
110302
|
}
|
|
110269
110303
|
}
|
|
@@ -110275,8 +110309,41 @@ function antigravityRecordedModels(session, steps) {
|
|
|
110275
110309
|
return /* @__PURE__ */ new Map();
|
|
110276
110310
|
}
|
|
110277
110311
|
}
|
|
110312
|
+
function antigravityRecordedContextLimit(session, step, prompt) {
|
|
110313
|
+
if (!Number.isSafeInteger(step) || step < 0) return;
|
|
110314
|
+
const file3 = antigravityConversationFile(session);
|
|
110315
|
+
if (!file3 || !existsSync(file3)) return;
|
|
110316
|
+
try {
|
|
110317
|
+
const sqlite = process.getBuiltinModule?.("node:sqlite");
|
|
110318
|
+
if (!sqlite) return;
|
|
110319
|
+
const db = new sqlite.DatabaseSync(file3, { readOnly: true });
|
|
110320
|
+
try {
|
|
110321
|
+
const stepRow = db.prepare("SELECT metadata FROM steps WHERE idx = ?");
|
|
110322
|
+
const id2 = stepUuid(stepRow, step) ?? stepUuid(stepRow, prompt);
|
|
110323
|
+
if (!id2) return;
|
|
110324
|
+
const key = Buffer.concat([Buffer.from([34, 36]), id2]);
|
|
110325
|
+
const generations = db.prepare("SELECT data FROM gen_metadata WHERE instr(data, ?) > 0");
|
|
110326
|
+
let found;
|
|
110327
|
+
let matched = false;
|
|
110328
|
+
for (const { data } of generations.iterate(key)) {
|
|
110329
|
+
if (!(data instanceof Uint8Array) || utf8(bytesField(data, 4)) !== utf8(id2)) continue;
|
|
110330
|
+
if (!stepIndices(data).includes(step)) continue;
|
|
110331
|
+
const limit = recordedContextLimit(data);
|
|
110332
|
+
if (matched && found !== limit) return;
|
|
110333
|
+
found = limit;
|
|
110334
|
+
matched = true;
|
|
110335
|
+
}
|
|
110336
|
+
return found;
|
|
110337
|
+
} finally {
|
|
110338
|
+
db.close();
|
|
110339
|
+
}
|
|
110340
|
+
} catch {
|
|
110341
|
+
return;
|
|
110342
|
+
}
|
|
110343
|
+
}
|
|
110278
110344
|
|
|
110279
110345
|
// ../cli/src/lib/agent/wire/antigravity.ts
|
|
110346
|
+
var CONTEXT_LOOK_EVERY_MS = 250;
|
|
110280
110347
|
var KINDS = {
|
|
110281
110348
|
run_command: "execute",
|
|
110282
110349
|
command_status: "execute",
|
|
@@ -110323,6 +110390,20 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
110323
110390
|
let stderr = "";
|
|
110324
110391
|
let context;
|
|
110325
110392
|
let contextStep = -1;
|
|
110393
|
+
let contextPrompt = -1;
|
|
110394
|
+
let contextLimitStep = -1;
|
|
110395
|
+
let contextLimitLookedAt = 0;
|
|
110396
|
+
const resolveContextLimit = (now) => {
|
|
110397
|
+
if (!context || !session || contextStep < 0 || contextLimitStep === contextStep) return;
|
|
110398
|
+
const at = Date.now();
|
|
110399
|
+
if (!now && at - contextLimitLookedAt < CONTEXT_LOOK_EVERY_MS) return;
|
|
110400
|
+
contextLimitLookedAt = at;
|
|
110401
|
+
const limit = antigravityRecordedContextLimit(session, contextStep, contextPrompt);
|
|
110402
|
+
if (limit !== void 0) {
|
|
110403
|
+
context = { used: context.used, limit };
|
|
110404
|
+
contextLimitStep = contextStep;
|
|
110405
|
+
}
|
|
110406
|
+
};
|
|
110326
110407
|
const started = Date.now();
|
|
110327
110408
|
let cost;
|
|
110328
110409
|
let incomplete = false;
|
|
@@ -110388,10 +110469,13 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
110388
110469
|
const index = num2(step.step_index);
|
|
110389
110470
|
if (step.state === "DONE" && Number.isSafeInteger(index) && step.step_index === index && index > contextStep) {
|
|
110390
110471
|
contextStep = index;
|
|
110472
|
+
contextPrompt = prompt;
|
|
110473
|
+
contextLimitStep = -1;
|
|
110474
|
+
contextLimitLookedAt = 0;
|
|
110391
110475
|
const u = obj2(step.usage);
|
|
110392
110476
|
const counts = [u.input_tokens, u.cache_read_tokens];
|
|
110393
|
-
const
|
|
110394
|
-
context =
|
|
110477
|
+
const promptTokens = counts.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0) ? num2(u.input_tokens) + num2(u.cache_read_tokens) : 0;
|
|
110478
|
+
context = promptTokens > 0 && Number.isFinite(promptTokens) ? { used: promptTokens } : void 0;
|
|
110395
110479
|
}
|
|
110396
110480
|
if (step.state === "DONE" && step.usage && !counted.has(index)) {
|
|
110397
110481
|
counted.add(index);
|
|
@@ -110444,6 +110528,7 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
110444
110528
|
return "";
|
|
110445
110529
|
}
|
|
110446
110530
|
session ||= str2(result.conversation_id) || void 0;
|
|
110531
|
+
resolveContextLimit(true);
|
|
110447
110532
|
terminal = true;
|
|
110448
110533
|
final = typeof result.response === "string" ? result.response : void 0;
|
|
110449
110534
|
const total = usageOf(result.usage);
|
|
@@ -110475,6 +110560,7 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
110475
110560
|
},
|
|
110476
110561
|
flush() {
|
|
110477
110562
|
const text3 = reader.flush();
|
|
110563
|
+
resolveContextLimit(true);
|
|
110478
110564
|
if (pendingCosts.size) {
|
|
110479
110565
|
const models = session ? antigravityRecordedModels(session, pendingCosts) : void 0;
|
|
110480
110566
|
for (const [index, { usage }] of pendingCosts) estimate(models?.get(index), usage);
|
|
@@ -110497,7 +110583,10 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
110497
110583
|
usage: () => used,
|
|
110498
110584
|
costUsd: () => cost,
|
|
110499
110585
|
costIncomplete: () => incomplete || void 0,
|
|
110500
|
-
context: () =>
|
|
110586
|
+
context: () => {
|
|
110587
|
+
resolveContextLimit(false);
|
|
110588
|
+
return context;
|
|
110589
|
+
},
|
|
110501
110590
|
failure: () => failure5 || imageFailure,
|
|
110502
110591
|
terminalFailure: () => terminal && !!classified,
|
|
110503
110592
|
executionFailure: () => classified ?? (imageFailure ? { code: "image_read_failed", level: 3, reason: imageFailure } : void 0),
|
|
@@ -111845,7 +111934,7 @@ function createTail(log) {
|
|
|
111845
111934
|
// ../cli/package.json
|
|
111846
111935
|
var package_default = {
|
|
111847
111936
|
name: "wildcrane",
|
|
111848
|
-
version: "0.11.
|
|
111937
|
+
version: "0.11.81",
|
|
111849
111938
|
akbContract: 27,
|
|
111850
111939
|
description: "WildCrane's `akb` command \u2014 scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
|
|
111851
111940
|
keywords: [
|