@moxt-ai/cli 0.14.0 → 0.14.1
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/index.cjs +245 -69
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1220,6 +1220,25 @@ var init_version2 = __esm({
|
|
|
1220
1220
|
});
|
|
1221
1221
|
|
|
1222
1222
|
// src/machine-connector/runtime/local-codex-runtime/contracts.ts
|
|
1223
|
+
function localCodexAttemptHeader(state) {
|
|
1224
|
+
return {
|
|
1225
|
+
acknowledgedSequence: state.acknowledgedSequence,
|
|
1226
|
+
appliedControls: state.appliedControls,
|
|
1227
|
+
claim: state.claim,
|
|
1228
|
+
connectionId: state.connectionId,
|
|
1229
|
+
connectorInstanceId: state.connectorInstanceId,
|
|
1230
|
+
finalErrorCode: state.finalErrorCode,
|
|
1231
|
+
finalErrorMessage: state.finalErrorMessage,
|
|
1232
|
+
finalSequence: state.finalSequence,
|
|
1233
|
+
finalStatus: state.finalStatus,
|
|
1234
|
+
interactions: state.interactions,
|
|
1235
|
+
nativeThreadId: state.nativeThreadId,
|
|
1236
|
+
nativeTurnId: state.nativeTurnId,
|
|
1237
|
+
nextSequence: state.nextSequence,
|
|
1238
|
+
phase: state.phase,
|
|
1239
|
+
updatedAt: state.updatedAt
|
|
1240
|
+
};
|
|
1241
|
+
}
|
|
1223
1242
|
var localCodexRuntimeProtocolVersion, localCodexRuntimeEventSchemaVersion, localCodexRuntimeEventRedactionVersion, localFilesCapability;
|
|
1224
1243
|
var init_contracts2 = __esm({
|
|
1225
1244
|
"src/machine-connector/runtime/local-codex-runtime/contracts.ts"() {
|
|
@@ -5158,7 +5177,63 @@ var init_runtime_logger = __esm({
|
|
|
5158
5177
|
}
|
|
5159
5178
|
});
|
|
5160
5179
|
|
|
5180
|
+
// src/machine-connector/runtime/local-codex-runtime/event-log.ts
|
|
5181
|
+
function scanLocalCodexEventLog(content5) {
|
|
5182
|
+
const events = [];
|
|
5183
|
+
const lines = content5.split("\n");
|
|
5184
|
+
let intactCharacters = 0;
|
|
5185
|
+
let newlineMissing = false;
|
|
5186
|
+
for (const [index3, line] of lines.entries()) {
|
|
5187
|
+
if (line.length === 0) {
|
|
5188
|
+
intactCharacters += 1;
|
|
5189
|
+
continue;
|
|
5190
|
+
}
|
|
5191
|
+
try {
|
|
5192
|
+
events.push(JSON.parse(line));
|
|
5193
|
+
} catch {
|
|
5194
|
+
break;
|
|
5195
|
+
}
|
|
5196
|
+
newlineMissing = index3 === lines.length - 1;
|
|
5197
|
+
intactCharacters += line.length + (newlineMissing ? 0 : 1);
|
|
5198
|
+
}
|
|
5199
|
+
if (newlineMissing) {
|
|
5200
|
+
return {
|
|
5201
|
+
events,
|
|
5202
|
+
intactBytes: Buffer.byteLength(content5, "utf8"),
|
|
5203
|
+
repair: "append_newline" /* AppendNewline */
|
|
5204
|
+
};
|
|
5205
|
+
}
|
|
5206
|
+
const intactBytes = Buffer.byteLength(
|
|
5207
|
+
content5.slice(0, intactCharacters),
|
|
5208
|
+
"utf8"
|
|
5209
|
+
);
|
|
5210
|
+
return {
|
|
5211
|
+
events,
|
|
5212
|
+
intactBytes,
|
|
5213
|
+
repair: intactBytes < Buffer.byteLength(content5, "utf8") ? "truncate" /* Truncate */ : "none" /* None */
|
|
5214
|
+
};
|
|
5215
|
+
}
|
|
5216
|
+
function nextSequenceAfterSpool(headerNextSequence, events) {
|
|
5217
|
+
return events.reduce(
|
|
5218
|
+
(next, event2) => Math.max(next, event2.sequence + 1),
|
|
5219
|
+
headerNextSequence
|
|
5220
|
+
);
|
|
5221
|
+
}
|
|
5222
|
+
var init_event_log = __esm({
|
|
5223
|
+
"src/machine-connector/runtime/local-codex-runtime/event-log.ts"() {
|
|
5224
|
+
"use strict";
|
|
5225
|
+
init_cjs_shims();
|
|
5226
|
+
}
|
|
5227
|
+
});
|
|
5228
|
+
|
|
5161
5229
|
// src/machine-connector/runtime/store.ts
|
|
5230
|
+
function withSpooledSequence(header, events) {
|
|
5231
|
+
return {
|
|
5232
|
+
...header,
|
|
5233
|
+
events,
|
|
5234
|
+
nextSequence: nextSequenceAfterSpool(header.nextSequence, events)
|
|
5235
|
+
};
|
|
5236
|
+
}
|
|
5162
5237
|
function defaultRuntimeDirectory() {
|
|
5163
5238
|
const override = process.env.MOXT_MACHINE_HOME;
|
|
5164
5239
|
if (override) {
|
|
@@ -5195,6 +5270,8 @@ var init_store = __esm({
|
|
|
5195
5270
|
import_node_crypto5 = require("node:crypto");
|
|
5196
5271
|
import_node_os6 = require("node:os");
|
|
5197
5272
|
import_node_path7 = require("node:path");
|
|
5273
|
+
init_contracts2();
|
|
5274
|
+
init_event_log();
|
|
5198
5275
|
privateFileMode = 384;
|
|
5199
5276
|
privateDirectoryMode = 448;
|
|
5200
5277
|
maximumProcessGeneration = 2147483647;
|
|
@@ -5382,14 +5459,67 @@ var init_store = __esm({
|
|
|
5382
5459
|
await (0, import_promises9.rm)(this.detachedProcessPath(jobId), { force: true });
|
|
5383
5460
|
}
|
|
5384
5461
|
async readLocalCodexAttempt(attemptId) {
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5462
|
+
const stored = await this.readOptionalJson(this.localCodexAttemptPath(attemptId));
|
|
5463
|
+
if (stored.value === void 0) {
|
|
5464
|
+
return {};
|
|
5465
|
+
}
|
|
5466
|
+
const spooled = await this.readLocalCodexAttemptEvents(attemptId);
|
|
5467
|
+
if (spooled.value !== void 0) {
|
|
5468
|
+
return {
|
|
5469
|
+
value: withSpooledSequence(
|
|
5470
|
+
localCodexAttemptHeader(stored.value),
|
|
5471
|
+
spooled.value
|
|
5472
|
+
)
|
|
5473
|
+
};
|
|
5474
|
+
}
|
|
5475
|
+
const inlineEvents = stored.value.events ?? [];
|
|
5476
|
+
await this.replaceLocalCodexAttemptEvents(attemptId, inlineEvents);
|
|
5477
|
+
return {
|
|
5478
|
+
value: withSpooledSequence(
|
|
5479
|
+
localCodexAttemptHeader(stored.value),
|
|
5480
|
+
inlineEvents
|
|
5481
|
+
)
|
|
5482
|
+
};
|
|
5388
5483
|
}
|
|
5389
5484
|
async writeLocalCodexAttempt(attempt) {
|
|
5485
|
+
await this.writeLocalCodexAttemptHeader(attempt);
|
|
5486
|
+
await this.replaceLocalCodexAttemptEvents(
|
|
5487
|
+
attempt.claim.attemptId,
|
|
5488
|
+
attempt.events
|
|
5489
|
+
);
|
|
5490
|
+
}
|
|
5491
|
+
async writeLocalCodexAttemptHeader(header) {
|
|
5390
5492
|
await this.writePrivateJson(
|
|
5391
|
-
this.localCodexAttemptPath(
|
|
5392
|
-
|
|
5493
|
+
this.localCodexAttemptPath(header.claim.attemptId),
|
|
5494
|
+
localCodexAttemptHeader(header)
|
|
5495
|
+
);
|
|
5496
|
+
}
|
|
5497
|
+
/**
|
|
5498
|
+
* Appending keeps the per-event cost independent of spool depth. Rewriting
|
|
5499
|
+
* the whole spool per event starves the event upload loop, which stops
|
|
5500
|
+
* acknowledgements and lets the spool grow without bound.
|
|
5501
|
+
*/
|
|
5502
|
+
async appendLocalCodexAttemptEvents(attemptId, events) {
|
|
5503
|
+
if (events.length === 0) {
|
|
5504
|
+
return;
|
|
5505
|
+
}
|
|
5506
|
+
const path6 = this.localCodexAttemptEventsPath(attemptId);
|
|
5507
|
+
await (0, import_promises9.mkdir)((0, import_node_path7.dirname)(path6), {
|
|
5508
|
+
mode: privateDirectoryMode,
|
|
5509
|
+
recursive: true
|
|
5510
|
+
});
|
|
5511
|
+
await (0, import_promises9.appendFile)(
|
|
5512
|
+
path6,
|
|
5513
|
+
events.map((event2) => `${JSON.stringify(event2)}
|
|
5514
|
+
`).join(""),
|
|
5515
|
+
{ encoding: "utf8", mode: privateFileMode }
|
|
5516
|
+
);
|
|
5517
|
+
}
|
|
5518
|
+
async replaceLocalCodexAttemptEvents(attemptId, events) {
|
|
5519
|
+
await this.writePrivateText(
|
|
5520
|
+
this.localCodexAttemptEventsPath(attemptId),
|
|
5521
|
+
events.map((event2) => `${JSON.stringify(event2)}
|
|
5522
|
+
`).join("")
|
|
5393
5523
|
);
|
|
5394
5524
|
}
|
|
5395
5525
|
async listLocalCodexAttempts() {
|
|
@@ -5404,8 +5534,8 @@ var init_store = __esm({
|
|
|
5404
5534
|
}
|
|
5405
5535
|
const attempts = [];
|
|
5406
5536
|
for (const name of names.filter((entry) => entry.endsWith(".json"))) {
|
|
5407
|
-
const attempt = await this.
|
|
5408
|
-
(0,
|
|
5537
|
+
const attempt = await this.readLocalCodexAttempt(
|
|
5538
|
+
name.slice(0, -".json".length)
|
|
5409
5539
|
);
|
|
5410
5540
|
if (attempt.value !== void 0) {
|
|
5411
5541
|
attempts.push(attempt.value);
|
|
@@ -5415,6 +5545,31 @@ var init_store = __esm({
|
|
|
5415
5545
|
}
|
|
5416
5546
|
async deleteLocalCodexAttempt(attemptId) {
|
|
5417
5547
|
await (0, import_promises9.rm)(this.localCodexAttemptPath(attemptId), { force: true });
|
|
5548
|
+
await (0, import_promises9.rm)(this.localCodexAttemptEventsPath(attemptId), { force: true });
|
|
5549
|
+
}
|
|
5550
|
+
/**
|
|
5551
|
+
* A crash mid-append leaves the tail either torn or missing its newline.
|
|
5552
|
+
* Repairing the file to end exactly after the last parseable event keeps
|
|
5553
|
+
* later appends starting on a line boundary; splicing two events into one
|
|
5554
|
+
* line would make every subsequent scan throw and block all recovery. The
|
|
5555
|
+
* relay rejects the resulting sequence gap rather than accepting a hole.
|
|
5556
|
+
*/
|
|
5557
|
+
async readLocalCodexAttemptEvents(attemptId) {
|
|
5558
|
+
const path6 = this.localCodexAttemptEventsPath(attemptId);
|
|
5559
|
+
const content5 = await this.readOptionalText(path6);
|
|
5560
|
+
if (content5.value === void 0) {
|
|
5561
|
+
return {};
|
|
5562
|
+
}
|
|
5563
|
+
const scan = scanLocalCodexEventLog(content5.value);
|
|
5564
|
+
if (scan.repair === "append_newline" /* AppendNewline */) {
|
|
5565
|
+
await (0, import_promises9.appendFile)(path6, "\n", {
|
|
5566
|
+
encoding: "utf8",
|
|
5567
|
+
mode: privateFileMode
|
|
5568
|
+
});
|
|
5569
|
+
} else if (scan.repair === "truncate" /* Truncate */) {
|
|
5570
|
+
await (0, import_promises9.truncate)(path6, scan.intactBytes);
|
|
5571
|
+
}
|
|
5572
|
+
return { value: scan.events };
|
|
5418
5573
|
}
|
|
5419
5574
|
async allocateLocalCodexProcessGeneration(poolKey) {
|
|
5420
5575
|
if (!/^[a-f0-9]{64}$/.test(poolKey)) {
|
|
@@ -5538,6 +5693,9 @@ var init_store = __esm({
|
|
|
5538
5693
|
localCodexAttemptPath(attemptId) {
|
|
5539
5694
|
return (0, import_node_path7.join)(this.localCodexAttemptsDirectory(), `${attemptId}.json`);
|
|
5540
5695
|
}
|
|
5696
|
+
localCodexAttemptEventsPath(attemptId) {
|
|
5697
|
+
return (0, import_node_path7.join)(this.localCodexAttemptsDirectory(), `${attemptId}.events.jsonl`);
|
|
5698
|
+
}
|
|
5541
5699
|
localCodexProcessGenerationsDirectory() {
|
|
5542
5700
|
return (0, import_node_path7.join)(
|
|
5543
5701
|
this.baseDirectory,
|
|
@@ -65661,7 +65819,7 @@ async function replaceImageMarkers(text32, replace) {
|
|
|
65661
65819
|
function isRecord32(value) {
|
|
65662
65820
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
65663
65821
|
}
|
|
65664
|
-
function
|
|
65822
|
+
function truncate2(value, maximumLength) {
|
|
65665
65823
|
if (value.length <= maximumLength) {
|
|
65666
65824
|
return value;
|
|
65667
65825
|
}
|
|
@@ -65669,13 +65827,13 @@ function truncate(value, maximumLength) {
|
|
|
65669
65827
|
}
|
|
65670
65828
|
function formatUnknown(value) {
|
|
65671
65829
|
if (typeof value === "string") {
|
|
65672
|
-
return
|
|
65830
|
+
return truncate2(value, AGENT_ACTIVITY_DETAIL_LIMIT);
|
|
65673
65831
|
}
|
|
65674
65832
|
try {
|
|
65675
65833
|
const encoded = JSON.stringify(value, null, 2);
|
|
65676
|
-
return
|
|
65834
|
+
return truncate2(encoded ?? "", AGENT_ACTIVITY_DETAIL_LIMIT);
|
|
65677
65835
|
} catch {
|
|
65678
|
-
return
|
|
65836
|
+
return truncate2(String(value), AGENT_ACTIVITY_DETAIL_LIMIT);
|
|
65679
65837
|
}
|
|
65680
65838
|
}
|
|
65681
65839
|
function formatUnknownDetail(value) {
|
|
@@ -65703,16 +65861,16 @@ function readContentOutputDetail(content32) {
|
|
|
65703
65861
|
function summarizeDisplayContent(content32) {
|
|
65704
65862
|
return {
|
|
65705
65863
|
...content32,
|
|
65706
|
-
artifactId:
|
|
65707
|
-
data:
|
|
65708
|
-
mimeType:
|
|
65709
|
-
name:
|
|
65710
|
-
newText:
|
|
65711
|
-
oldText:
|
|
65712
|
-
path:
|
|
65713
|
-
terminalId:
|
|
65714
|
-
text:
|
|
65715
|
-
uri:
|
|
65864
|
+
artifactId: truncate2(content32.artifactId, 128),
|
|
65865
|
+
data: truncate2(content32.data, AGENT_ACTIVITY_DETAIL_LIMIT),
|
|
65866
|
+
mimeType: truncate2(content32.mimeType, 255),
|
|
65867
|
+
name: truncate2(content32.name, 500),
|
|
65868
|
+
newText: truncate2(content32.newText, AGENT_ACTIVITY_DETAIL_LIMIT),
|
|
65869
|
+
oldText: truncate2(content32.oldText, AGENT_ACTIVITY_DETAIL_LIMIT),
|
|
65870
|
+
path: truncate2(content32.path, 2048),
|
|
65871
|
+
terminalId: truncate2(content32.terminalId, 255),
|
|
65872
|
+
text: truncate2(content32.text, AGENT_ACTIVITY_DETAIL_LIMIT),
|
|
65873
|
+
uri: truncate2(content32.uri, 4096)
|
|
65716
65874
|
};
|
|
65717
65875
|
}
|
|
65718
65876
|
function contentFitsRecordingEnvelope(content32) {
|
|
@@ -65730,8 +65888,8 @@ function captureActivityDetail(content32, input22, output22) {
|
|
|
65730
65888
|
return {
|
|
65731
65889
|
capturedBytes: encodedByteLength({
|
|
65732
65890
|
content: content32.slice(0, 100).map(summarizeDisplayContent),
|
|
65733
|
-
input:
|
|
65734
|
-
output:
|
|
65891
|
+
input: truncate2(input22, AGENT_ACTIVITY_DETAIL_LIMIT),
|
|
65892
|
+
output: truncate2(output22, AGENT_ACTIVITY_DETAIL_LIMIT)
|
|
65735
65893
|
}),
|
|
65736
65894
|
kind: "truncated",
|
|
65737
65895
|
originalBytes
|
|
@@ -65879,7 +66037,7 @@ function normalizeLocations(locations) {
|
|
|
65879
66037
|
break;
|
|
65880
66038
|
}
|
|
65881
66039
|
const suffix = typeof location.line === "number" ? `:${location.line.toString()}` : "";
|
|
65882
|
-
const value =
|
|
66040
|
+
const value = truncate2(`${location.path}${suffix}`, AGENT_ACTIVITY_LOCATION_LENGTH_LIMIT);
|
|
65883
66041
|
if (value.length > 0 && !unique.has(value)) {
|
|
65884
66042
|
unique.add(value);
|
|
65885
66043
|
normalized.push(value);
|
|
@@ -65901,14 +66059,14 @@ function normalizeToolStatus(status, fallback) {
|
|
|
65901
66059
|
}
|
|
65902
66060
|
function normalizeTitle(title2, fallback) {
|
|
65903
66061
|
const normalized = title2.trim();
|
|
65904
|
-
return
|
|
66062
|
+
return truncate2(normalized.length === 0 ? fallback : normalized, 500);
|
|
65905
66063
|
}
|
|
65906
66064
|
function formatPlanEntries(entries) {
|
|
65907
66065
|
const lines = [];
|
|
65908
66066
|
for (const entry of entries) {
|
|
65909
66067
|
lines.push(`[${entry.status}] ${entry.content}`);
|
|
65910
66068
|
}
|
|
65911
|
-
return
|
|
66069
|
+
return truncate2(lines.join("\n"), AGENT_ACTIVITY_DETAIL_LIMIT);
|
|
65912
66070
|
}
|
|
65913
66071
|
function planStatus(entries) {
|
|
65914
66072
|
if (entries.length === 0) {
|
|
@@ -70347,7 +70505,7 @@ function isRecord42(value) {
|
|
|
70347
70505
|
function readString2(value, fallback = "") {
|
|
70348
70506
|
return typeof value === "string" ? value : fallback;
|
|
70349
70507
|
}
|
|
70350
|
-
function
|
|
70508
|
+
function truncate22(value, maximum) {
|
|
70351
70509
|
return value.length <= maximum ? value : value.slice(0, maximum);
|
|
70352
70510
|
}
|
|
70353
70511
|
function readBoolean(value, fallback = false) {
|
|
@@ -70359,11 +70517,11 @@ function normalizeConfigValue(option, groupId = "", groupName = "") {
|
|
|
70359
70517
|
return void 0;
|
|
70360
70518
|
}
|
|
70361
70519
|
return {
|
|
70362
|
-
description:
|
|
70363
|
-
groupId:
|
|
70364
|
-
groupName:
|
|
70365
|
-
name:
|
|
70366
|
-
value:
|
|
70520
|
+
description: truncate22(readString2(option["description"]), 500),
|
|
70521
|
+
groupId: truncate22(groupId, 128),
|
|
70522
|
+
groupName: truncate22(groupName, 255),
|
|
70523
|
+
name: truncate22(readString2(option["name"], value), 255),
|
|
70524
|
+
value: truncate22(value, 500)
|
|
70367
70525
|
};
|
|
70368
70526
|
}
|
|
70369
70527
|
function normalizeConfigValues(value) {
|
|
@@ -70403,9 +70561,9 @@ function normalizeConfigOptions(value, modes) {
|
|
|
70403
70561
|
if (!isRecord42(option)) {
|
|
70404
70562
|
continue;
|
|
70405
70563
|
}
|
|
70406
|
-
const id =
|
|
70407
|
-
const name =
|
|
70408
|
-
const category =
|
|
70564
|
+
const id = truncate22(readString2(option["id"]), 128);
|
|
70565
|
+
const name = truncate22(readString2(option["name"], id), 255);
|
|
70566
|
+
const category = truncate22(readString2(option["category"]), 128);
|
|
70409
70567
|
if (id.length === 0 || name.length === 0 || category === "_mobius_permission") {
|
|
70410
70568
|
continue;
|
|
70411
70569
|
}
|
|
@@ -70414,7 +70572,7 @@ function normalizeConfigOptions(value, modes) {
|
|
|
70414
70572
|
booleanValue: readBoolean(option["currentValue"]),
|
|
70415
70573
|
category,
|
|
70416
70574
|
currentValue: "",
|
|
70417
|
-
description:
|
|
70575
|
+
description: truncate22(readString2(option["description"]), 500),
|
|
70418
70576
|
id,
|
|
70419
70577
|
name,
|
|
70420
70578
|
type: "boolean",
|
|
@@ -70424,13 +70582,13 @@ function normalizeConfigOptions(value, modes) {
|
|
|
70424
70582
|
}
|
|
70425
70583
|
if (option["type"] === "select") {
|
|
70426
70584
|
const values = normalizeConfigValues(option["options"]);
|
|
70427
|
-
const currentValue =
|
|
70585
|
+
const currentValue = truncate22(readString2(option["currentValue"]), 500);
|
|
70428
70586
|
if (values.some((entry) => entry.value === currentValue)) {
|
|
70429
70587
|
normalized.push({
|
|
70430
70588
|
booleanValue: false,
|
|
70431
70589
|
category,
|
|
70432
70590
|
currentValue,
|
|
70433
|
-
description:
|
|
70591
|
+
description: truncate22(readString2(option["description"]), 500),
|
|
70434
70592
|
id,
|
|
70435
70593
|
name,
|
|
70436
70594
|
type: "select",
|
|
@@ -70448,20 +70606,20 @@ function normalizeConfigOptions(value, modes) {
|
|
|
70448
70606
|
if (!isRecord42(mode)) {
|
|
70449
70607
|
continue;
|
|
70450
70608
|
}
|
|
70451
|
-
const id =
|
|
70609
|
+
const id = truncate22(readString2(mode["id"]), 500);
|
|
70452
70610
|
if (id.length === 0) {
|
|
70453
70611
|
continue;
|
|
70454
70612
|
}
|
|
70455
70613
|
values.push({
|
|
70456
|
-
description:
|
|
70614
|
+
description: truncate22(readString2(mode["description"]), 500),
|
|
70457
70615
|
groupId: "",
|
|
70458
70616
|
groupName: "",
|
|
70459
|
-
name:
|
|
70617
|
+
name: truncate22(readString2(mode["name"], id), 255),
|
|
70460
70618
|
value: id
|
|
70461
70619
|
});
|
|
70462
70620
|
}
|
|
70463
70621
|
}
|
|
70464
|
-
const currentValue =
|
|
70622
|
+
const currentValue = truncate22(readString2(modes["currentModeId"]), 500);
|
|
70465
70623
|
if (currentValue.length > 0 && values.some((entry) => entry.value === currentValue) && !normalized.some((entry) => entry.category === "mode")) {
|
|
70466
70624
|
normalized.unshift({
|
|
70467
70625
|
booleanValue: false,
|
|
@@ -89989,7 +90147,7 @@ ${content32.join("\n")}
|
|
|
89989
90147
|
"",
|
|
89990
90148
|
[],
|
|
89991
90149
|
"",
|
|
89992
|
-
|
|
90150
|
+
truncate2(fullOutput, AGENT_ACTIVITY_DETAIL_LIMIT),
|
|
89993
90151
|
identity2.sequence,
|
|
89994
90152
|
"running",
|
|
89995
90153
|
activityType === "reasoning" ? "Reasoning" : "Progress update",
|
|
@@ -90022,7 +90180,7 @@ ${content32.join("\n")}
|
|
|
90022
90180
|
"",
|
|
90023
90181
|
[],
|
|
90024
90182
|
"",
|
|
90025
|
-
|
|
90183
|
+
truncate2(output22, AGENT_ACTIVITY_DETAIL_LIMIT),
|
|
90026
90184
|
identity2.sequence,
|
|
90027
90185
|
"running",
|
|
90028
90186
|
"Plan",
|
|
@@ -90072,7 +90230,7 @@ ${content32.join("\n")}
|
|
|
90072
90230
|
"tool",
|
|
90073
90231
|
update.rawInput === void 0 ? "" : formatUnknown(update.rawInput),
|
|
90074
90232
|
normalizeLocations(update.locations ?? []),
|
|
90075
|
-
|
|
90233
|
+
truncate2(update.name ?? "", 128),
|
|
90076
90234
|
output22,
|
|
90077
90235
|
identity2.sequence,
|
|
90078
90236
|
normalizeToolStatus(update.status ?? "pending", "pending"),
|
|
@@ -90102,7 +90260,7 @@ ${content32.join("\n")}
|
|
|
90102
90260
|
"tool",
|
|
90103
90261
|
update.rawInput === void 0 ? previous22?.input ?? "" : formatUnknown(update.rawInput),
|
|
90104
90262
|
update.locations === void 0 || update.locations === null ? previous22?.locations ?? [] : normalizeLocations(update.locations),
|
|
90105
|
-
update.name === void 0 || update.name === null ? previous22?.name ?? "" :
|
|
90263
|
+
update.name === void 0 || update.name === null ? previous22?.name ?? "" : truncate2(update.name, 128),
|
|
90106
90264
|
output22,
|
|
90107
90265
|
identity2.sequence,
|
|
90108
90266
|
update.status === void 0 || update.status === null ? previous22?.status ?? "pending" : normalizeToolStatus(update.status, previous22?.status ?? "pending"),
|
|
@@ -100436,6 +100594,15 @@ var init_discovery_worker = __esm({
|
|
|
100436
100594
|
});
|
|
100437
100595
|
|
|
100438
100596
|
// src/machine-connector/runtime/local-codex-runtime/durable-attempt.ts
|
|
100597
|
+
function spooledEventBytes(event2) {
|
|
100598
|
+
return Buffer.byteLength(JSON.stringify(event2), "utf8");
|
|
100599
|
+
}
|
|
100600
|
+
function spooledBytes(events) {
|
|
100601
|
+
return events.reduce(
|
|
100602
|
+
(total, event2) => total + spooledEventBytes(event2),
|
|
100603
|
+
0
|
|
100604
|
+
);
|
|
100605
|
+
}
|
|
100439
100606
|
function assertCompatibleClaim(persisted, connectionId2, claim3, allowRestartFenceRotation) {
|
|
100440
100607
|
if (persisted.connectionId !== connectionId2 || persisted.claim.attemptId !== claim3.attemptId || persisted.claim.attemptGeneration !== claim3.attemptGeneration || persisted.claim.conversationId !== claim3.conversationId || persisted.claim.turnId !== claim3.turnId || persisted.claim.expectedNativeStoreIdentity !== claim3.expectedNativeStoreIdentity) {
|
|
100441
100608
|
throw new Error(
|
|
@@ -100494,11 +100661,13 @@ var init_durable_attempt = __esm({
|
|
|
100494
100661
|
this.store = store;
|
|
100495
100662
|
this.state = state;
|
|
100496
100663
|
this.recoveryRequired = recoveryRequired;
|
|
100664
|
+
this.spoolBytes = spooledBytes(state.events);
|
|
100497
100665
|
}
|
|
100498
100666
|
store;
|
|
100499
100667
|
state;
|
|
100500
100668
|
recoveryRequired;
|
|
100501
100669
|
mutationQueue = Promise.resolve();
|
|
100670
|
+
spoolBytes;
|
|
100502
100671
|
static async create(store, connectionId2, connectorInstanceId, claim3) {
|
|
100503
100672
|
const persisted = (await store.readLocalCodexAttempt(claim3.attemptId)).value;
|
|
100504
100673
|
if (persisted !== void 0) {
|
|
@@ -100558,7 +100727,7 @@ var init_durable_attempt = __esm({
|
|
|
100558
100727
|
this.state.nativeThreadId = nativeThreadId;
|
|
100559
100728
|
this.state.nativeTurnId = nativeTurnId;
|
|
100560
100729
|
this.state.phase = "running" /* Running */;
|
|
100561
|
-
await this.
|
|
100730
|
+
await this.persistHeader();
|
|
100562
100731
|
});
|
|
100563
100732
|
}
|
|
100564
100733
|
async markThreadPrepared(nativeThreadId) {
|
|
@@ -100569,7 +100738,7 @@ var init_durable_attempt = __esm({
|
|
|
100569
100738
|
);
|
|
100570
100739
|
}
|
|
100571
100740
|
this.state.nativeThreadId = nativeThreadId;
|
|
100572
|
-
await this.
|
|
100741
|
+
await this.persistHeader();
|
|
100573
100742
|
});
|
|
100574
100743
|
}
|
|
100575
100744
|
async appendEvent(kind, payload, correlation = {}, occurredAt = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
@@ -100592,17 +100761,19 @@ var init_durable_attempt = __esm({
|
|
|
100592
100761
|
...correlation.nativeTurnId ? { nativeTurnId: correlation.nativeTurnId } : {},
|
|
100593
100762
|
...correlation.requestId ? { requestId: correlation.requestId } : {}
|
|
100594
100763
|
};
|
|
100595
|
-
const
|
|
100596
|
-
|
|
100597
|
-
"utf8"
|
|
100598
|
-
);
|
|
100599
|
-
if (pendingBytes > maximumSpoolBytes) {
|
|
100764
|
+
const eventBytes = spooledEventBytes(event2);
|
|
100765
|
+
if (this.spoolBytes + eventBytes > maximumSpoolBytes) {
|
|
100600
100766
|
throw new Error("Local Codex Runtime spool limit exceeded");
|
|
100601
100767
|
}
|
|
100602
100768
|
this.state.events.push(event2);
|
|
100603
100769
|
this.state.nextSequence += 1;
|
|
100770
|
+
this.spoolBytes += eventBytes;
|
|
100604
100771
|
holder.value = event2;
|
|
100605
|
-
await this.
|
|
100772
|
+
await this.store.appendLocalCodexAttemptEvents(
|
|
100773
|
+
this.state.claim.attemptId,
|
|
100774
|
+
[event2]
|
|
100775
|
+
);
|
|
100776
|
+
await this.persistHeader();
|
|
100606
100777
|
});
|
|
100607
100778
|
if (holder.value === void 0) {
|
|
100608
100779
|
throw new Error("Local Codex Runtime event was not persisted");
|
|
@@ -100628,7 +100799,12 @@ var init_durable_attempt = __esm({
|
|
|
100628
100799
|
this.state.events = this.state.events.filter(
|
|
100629
100800
|
(event2) => event2.sequence > sequence
|
|
100630
100801
|
);
|
|
100631
|
-
|
|
100802
|
+
this.spoolBytes = spooledBytes(this.state.events);
|
|
100803
|
+
await this.store.replaceLocalCodexAttemptEvents(
|
|
100804
|
+
this.state.claim.attemptId,
|
|
100805
|
+
this.state.events
|
|
100806
|
+
);
|
|
100807
|
+
await this.persistHeader();
|
|
100632
100808
|
});
|
|
100633
100809
|
}
|
|
100634
100810
|
async recordInteraction(interaction) {
|
|
@@ -100639,7 +100815,7 @@ var init_durable_attempt = __esm({
|
|
|
100639
100815
|
return;
|
|
100640
100816
|
}
|
|
100641
100817
|
this.state.interactions.push(interaction);
|
|
100642
|
-
await this.
|
|
100818
|
+
await this.persistHeader();
|
|
100643
100819
|
});
|
|
100644
100820
|
}
|
|
100645
100821
|
pendingInteraction(requestId) {
|
|
@@ -100657,7 +100833,7 @@ var init_durable_attempt = __esm({
|
|
|
100657
100833
|
throw new Error(`Unknown Local Codex interaction ${requestId}`);
|
|
100658
100834
|
}
|
|
100659
100835
|
interaction.resolvedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
100660
|
-
await this.
|
|
100836
|
+
await this.persistHeader();
|
|
100661
100837
|
});
|
|
100662
100838
|
}
|
|
100663
100839
|
async recordControl(controlId) {
|
|
@@ -100673,7 +100849,7 @@ var init_durable_attempt = __esm({
|
|
|
100673
100849
|
phase: "recorded" /* Recorded */,
|
|
100674
100850
|
recordedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
100675
100851
|
});
|
|
100676
|
-
await this.
|
|
100852
|
+
await this.persistHeader();
|
|
100677
100853
|
});
|
|
100678
100854
|
}
|
|
100679
100855
|
appliedControlOutcome(controlId) {
|
|
@@ -100692,7 +100868,7 @@ var init_durable_attempt = __esm({
|
|
|
100692
100868
|
}
|
|
100693
100869
|
control.outcome = outcome;
|
|
100694
100870
|
control.phase = "applied" /* Applied */;
|
|
100695
|
-
await this.
|
|
100871
|
+
await this.persistHeader();
|
|
100696
100872
|
});
|
|
100697
100873
|
}
|
|
100698
100874
|
async markTerminal(result) {
|
|
@@ -100702,13 +100878,13 @@ var init_durable_attempt = __esm({
|
|
|
100702
100878
|
this.state.finalErrorCode = result.errorCode;
|
|
100703
100879
|
this.state.finalErrorMessage = result.errorMessage;
|
|
100704
100880
|
this.state.phase = "terminal_pending_upload" /* TerminalPendingUpload */;
|
|
100705
|
-
await this.
|
|
100881
|
+
await this.persistHeader();
|
|
100706
100882
|
});
|
|
100707
100883
|
}
|
|
100708
100884
|
async markUploaded() {
|
|
100709
100885
|
await this.mutate(async () => {
|
|
100710
100886
|
this.state.phase = "uploaded" /* Uploaded */;
|
|
100711
|
-
await this.
|
|
100887
|
+
await this.persistHeader();
|
|
100712
100888
|
});
|
|
100713
100889
|
}
|
|
100714
100890
|
async mutate(action) {
|
|
@@ -100716,9 +100892,9 @@ var init_durable_attempt = __esm({
|
|
|
100716
100892
|
this.mutationQueue = operation.catch(() => void 0);
|
|
100717
100893
|
await operation;
|
|
100718
100894
|
}
|
|
100719
|
-
async
|
|
100895
|
+
async persistHeader() {
|
|
100720
100896
|
this.state.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
100721
|
-
await this.store.
|
|
100897
|
+
await this.store.writeLocalCodexAttemptHeader(this.state);
|
|
100722
100898
|
}
|
|
100723
100899
|
};
|
|
100724
100900
|
}
|
|
@@ -111805,7 +111981,7 @@ var init_file_selector = __esm({
|
|
|
111805
111981
|
|
|
111806
111982
|
// src/utils/http.ts
|
|
111807
111983
|
function getUserAgent() {
|
|
111808
|
-
return `moxt-cli/${"0.14.
|
|
111984
|
+
return `moxt-cli/${"0.14.1"} (${(0, import_os.platform)()}/${(0, import_os.arch)()}) node/${process.versions.node}`;
|
|
111809
111985
|
}
|
|
111810
111986
|
async function sendRequest(method, path6, init) {
|
|
111811
111987
|
return await fetch(`${getApiBaseUrl()}${path6}`, {
|
|
@@ -128066,7 +128242,7 @@ var FLUSH_TIMEOUT_MS = 3e3;
|
|
|
128066
128242
|
var MAX_BATCH_SIZE = 100;
|
|
128067
128243
|
function commonLabels() {
|
|
128068
128244
|
return {
|
|
128069
|
-
cli_version: "0.14.
|
|
128245
|
+
cli_version: "0.14.1",
|
|
128070
128246
|
node_version: process.versions.node,
|
|
128071
128247
|
os: (0, import_node_os.platform)(),
|
|
128072
128248
|
arch: (0, import_node_os.arch)(),
|
|
@@ -128112,7 +128288,7 @@ async function flush() {
|
|
|
128112
128288
|
}
|
|
128113
128289
|
const batch = buffer.splice(0, MAX_BATCH_SIZE);
|
|
128114
128290
|
const payload = {
|
|
128115
|
-
release_id: "0.14.
|
|
128291
|
+
release_id: "0.14.1",
|
|
128116
128292
|
client_type: "cli",
|
|
128117
128293
|
metric_data_list: batch.map((m) => ({
|
|
128118
128294
|
profile: "cli",
|
|
@@ -128511,9 +128687,9 @@ void runCli();
|
|
|
128511
128687
|
async function runCli() {
|
|
128512
128688
|
try {
|
|
128513
128689
|
const { createProgram: createProgram2 } = await Promise.resolve().then(() => (init_program(), program_exports));
|
|
128514
|
-
const program2 = createProgram2("0.14.
|
|
128515
|
-
installDaemonReconcileHook(program2, "0.14.
|
|
128516
|
-
installUpdateHook(program2, "0.14.
|
|
128690
|
+
const program2 = createProgram2("0.14.1");
|
|
128691
|
+
installDaemonReconcileHook(program2, "0.14.1");
|
|
128692
|
+
installUpdateHook(program2, "0.14.1", process.argv[1] ?? "");
|
|
128517
128693
|
instrumentProgram(program2);
|
|
128518
128694
|
installExitHandler();
|
|
128519
128695
|
await program2.parseAsync(process.argv);
|