@moxt-ai/mobius 0.0.471 → 0.0.472
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/{chunk-HPFAJPEN.js → chunk-6WVQ6SPI.js} +2 -2
- package/dist/{chunk-HPFAJPEN.js.map → chunk-6WVQ6SPI.js.map} +1 -1
- package/dist/{chunk-7XY5VCQJ.js → chunk-W5AYDFKU.js} +139 -12
- package/dist/{chunk-7XY5VCQJ.js.map → chunk-W5AYDFKU.js.map} +4 -4
- package/dist/{cli-6OLHX3IS.js → cli-VHW4NONP.js} +3 -3
- package/dist/cli.js +2 -2
- package/dist/engine/acp/adapter/claude/adapter.d.ts.map +1 -1
- package/dist/engine/acp/adapter/claude/adapter.js +3 -2
- package/dist/engine/acp/adapter/claude/adapter.js.map +1 -1
- package/dist/engine/acp/adapter/codex/adapter.d.ts.map +1 -1
- package/dist/engine/acp/adapter/codex/adapter.js +3 -2
- package/dist/engine/acp/adapter/codex/adapter.js.map +1 -1
- package/dist/engine/acp/adapter/lifecycle-output.d.ts +4 -1
- package/dist/engine/acp/adapter/lifecycle-output.d.ts.map +1 -1
- package/dist/engine/acp/adapter/lifecycle-output.js +5 -0
- package/dist/engine/acp/adapter/lifecycle-output.js.map +1 -1
- package/dist/engine/acp/harness/claude/turn-tokens.d.ts +8 -0
- package/dist/engine/acp/harness/claude/turn-tokens.d.ts.map +1 -0
- package/dist/engine/acp/harness/claude/turn-tokens.js +57 -0
- package/dist/engine/acp/harness/claude/turn-tokens.js.map +1 -0
- package/dist/engine/acp/harness/codex/app-server-protocol.d.ts +18 -0
- package/dist/engine/acp/harness/codex/app-server-protocol.d.ts.map +1 -1
- package/dist/engine/acp/harness/codex/app-server-protocol.js +18 -0
- package/dist/engine/acp/harness/codex/app-server-protocol.js.map +1 -1
- package/dist/engine/acp/harness/codex/owned-agent.d.ts.map +1 -1
- package/dist/engine/acp/harness/codex/owned-agent.js +41 -4
- package/dist/engine/acp/harness/codex/owned-agent.js.map +1 -1
- package/dist/engine/acp/harness/codex/turn-tokens.d.ts +8 -0
- package/dist/engine/acp/harness/codex/turn-tokens.d.ts.map +1 -0
- package/dist/engine/acp/harness/codex/turn-tokens.js +20 -0
- package/dist/engine/acp/harness/codex/turn-tokens.js.map +1 -0
- package/dist/engine/acp/native-history/preview-contract.d.ts +3 -1
- package/dist/engine/acp/native-history/preview-contract.d.ts.map +1 -1
- package/dist/engine/session/live/agent-session.d.ts.map +1 -1
- package/dist/engine/session/live/agent-session.js +8 -2
- package/dist/engine/session/live/agent-session.js.map +1 -1
- package/dist/engine.js +2 -2
- package/package.json +1 -1
- /package/dist/{cli-6OLHX3IS.js.map → cli-VHW4NONP.js.map} +0 -0
|
@@ -80,7 +80,7 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
80
80
|
// package.json
|
|
81
81
|
var package_default = {
|
|
82
82
|
name: "@moxt-ai/mobius",
|
|
83
|
-
version: "0.0.
|
|
83
|
+
version: "0.0.472",
|
|
84
84
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
85
85
|
type: "module",
|
|
86
86
|
bin: {
|
|
@@ -171,4 +171,4 @@ export {
|
|
|
171
171
|
__callDispose,
|
|
172
172
|
package_default
|
|
173
173
|
};
|
|
174
|
-
//# sourceMappingURL=chunk-
|
|
174
|
+
//# sourceMappingURL=chunk-6WVQ6SPI.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../package.json"],
|
|
4
|
-
"sourcesContent": ["{\n \"name\": \"@moxt-ai/mobius\",\n \"version\": \"0.0.
|
|
4
|
+
"sourcesContent": ["{\n \"name\": \"@moxt-ai/mobius\",\n \"version\": \"0.0.472\",\n \"description\": \"Mobius CLI for pairing and running local AI agent services.\",\n \"type\": \"module\",\n \"bin\": {\n \"mobius\": \"dist/cli.js\"\n },\n \"exports\": {\n \"./engine\": {\n \"mobius-source\": \"./src/exports/engine.ts\",\n \"types\": \"./dist/exports/engine.d.ts\",\n \"default\": \"./dist/engine.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.txt\"\n ],\n \"engines\": {\n \"node\": \">=22.19.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"exports\": {\n \"./engine\": {\n \"types\": \"./dist/exports/engine.d.ts\",\n \"import\": \"./dist/engine.js\",\n \"default\": \"./dist/engine.js\"\n }\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/moxt-ai/mobius.git\",\n \"directory\": \"packages/cli\"\n },\n \"scripts\": {\n \"prebuild\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"build\": \"node scripts/build.ts && tsc --project tsconfig.build.json\",\n \"dev\": \"node --watch src/cli/entrypoint.ts\",\n \"pretypecheck\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"prepack\": \"pnpm build\",\n \"start\": \"node dist/cli.js\",\n \"typecheck\": \"tsc --project tsconfig.json && tsc --project tests/tsconfig.json\",\n \"pretest:controlled\": \"pnpm build\",\n \"test:controlled\": \"vitest run tests/sessions tests/runtime\",\n \"pretest:manual\": \"pnpm pretest:controlled\",\n \"test:manual\": \"vitest run tests/manual\",\n \"pretest:agents\": \"pnpm build\",\n \"test:agents\": \"vitest run tests/agents --maxWorkers=2\"\n },\n \"dependencies\": {\n \"undici\": \"8.12.2\"\n },\n \"devDependencies\": {\n \"@moxt-ai/mobius-sdk-before-prompt-suggestions\": \"npm:@moxt-ai/mobius-sdk@0.0.181\",\n \"@agentclientprotocol/sdk\": \"^1.4.0\",\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.257\",\n \"@anthropic-ai/sdk\": \"0.122.0\",\n \"@moxt-ai/mobius-sdk\": \"workspace:*\",\n \"@moxt-ai/mobius-test\": \"workspace:*\",\n \"@types/node\": \"^24.13.5\",\n \"@types/semver\": \"^7.8.0\",\n \"@types/ws\": \"^8.18.1\",\n \"commander\": \"15.0.0\",\n \"drizzle-kit\": \"1.0.0-rc.4\",\n \"drizzle-orm\": \"1.0.0-rc.4\",\n \"esbuild\": \"0.28.2\",\n \"ignore\": \"7.0.9\",\n \"semver\": \"^7.8.5\",\n \"valibot\": \"1.5.0\",\n \"ws\": \"^8.21.3\",\n \"zod\": \"^4.6.7\"\n },\n \"keywords\": [],\n \"author\": \"Moxt\",\n \"license\": \"Apache-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/moxt-ai/mobius/issues\"\n },\n \"homepage\": \"https://github.com/moxt-ai/mobius#readme\"\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACI,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,KAAO;AAAA,IACH,QAAU;AAAA,EACd;AAAA,EACA,SAAW;AAAA,IACP,YAAY;AAAA,MACR,iBAAiB;AAAA,MACjB,OAAS;AAAA,MACT,SAAW;AAAA,IACf;AAAA,EACJ;AAAA,EACA,OAAS;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,SAAW;AAAA,IACP,MAAQ;AAAA,EACZ;AAAA,EACA,eAAiB;AAAA,IACb,QAAU;AAAA,IACV,SAAW;AAAA,MACP,YAAY;AAAA,QACR,OAAS;AAAA,QACT,QAAU;AAAA,QACV,SAAW;AAAA,MACf;AAAA,IACJ;AAAA,EACJ;AAAA,EACA,YAAc;AAAA,IACV,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACjB;AAAA,EACA,SAAW;AAAA,IACP,UAAY;AAAA,IACZ,OAAS;AAAA,IACT,KAAO;AAAA,IACP,cAAgB;AAAA,IAChB,SAAW;AAAA,IACX,OAAS;AAAA,IACT,WAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,eAAe;AAAA,IACf,kBAAkB;AAAA,IAClB,eAAe;AAAA,EACnB;AAAA,EACA,cAAgB;AAAA,IACZ,QAAU;AAAA,EACd;AAAA,EACA,iBAAmB;AAAA,IACf,iDAAiD;AAAA,IACjD,4BAA4B;AAAA,IAC5B,kCAAkC;AAAA,IAClC,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,IACvB,wBAAwB;AAAA,IACxB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,WAAa;AAAA,IACb,eAAe;AAAA,IACf,eAAe;AAAA,IACf,SAAW;AAAA,IACX,QAAU;AAAA,IACV,QAAU;AAAA,IACV,SAAW;AAAA,IACX,IAAM;AAAA,IACN,KAAO;AAAA,EACX;AAAA,EACA,UAAY,CAAC;AAAA,EACb,QAAU;AAAA,EACV,SAAW;AAAA,EACX,MAAQ;AAAA,IACJ,KAAO;AAAA,EACX;AAAA,EACA,UAAY;AAChB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__toESM,
|
|
6
6
|
__using,
|
|
7
7
|
package_default
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6WVQ6SPI.js";
|
|
9
9
|
|
|
10
10
|
// ../../node_modules/.pnpm/ignore@7.0.9/node_modules/ignore/index.js
|
|
11
11
|
var require_ignore = __commonJS({
|
|
@@ -21476,6 +21476,7 @@ var turnTokenUsageSchema = external_exports.object({
|
|
|
21476
21476
|
}).readonly().refine(
|
|
21477
21477
|
(usage) => usage.cachedInputTokens + usage.cacheWriteTokens <= usage.inputTokens && (usage.reasoningTokens ?? 0) <= usage.outputTokens
|
|
21478
21478
|
);
|
|
21479
|
+
var isTurnTokenUsage = (value) => turnTokenUsageSchema.safeParse(value).success;
|
|
21479
21480
|
var agentPromptResponseSchema = external_exports.object({
|
|
21480
21481
|
_meta: promptMetadataSchema.nullish(),
|
|
21481
21482
|
stopReason: external_exports.enum(["end_turn", "max_tokens", "max_turn_requests", "refusal", "cancelled"]),
|
|
@@ -77842,6 +77843,20 @@ var turnNotificationSchema = external_exports.object({
|
|
|
77842
77843
|
threadId: boundedText(256),
|
|
77843
77844
|
turn: turnSchema
|
|
77844
77845
|
});
|
|
77846
|
+
var tokenCount = external_exports.number().int().nonnegative().safe();
|
|
77847
|
+
var tokenUsageNotificationSchema = external_exports.object({
|
|
77848
|
+
threadId: boundedText(256),
|
|
77849
|
+
turnId: boundedText(256),
|
|
77850
|
+
tokenUsage: external_exports.object({
|
|
77851
|
+
last: external_exports.object({
|
|
77852
|
+
inputTokens: tokenCount,
|
|
77853
|
+
cachedInputTokens: tokenCount,
|
|
77854
|
+
cacheWriteInputTokens: tokenCount.optional(),
|
|
77855
|
+
outputTokens: tokenCount,
|
|
77856
|
+
reasoningOutputTokens: tokenCount
|
|
77857
|
+
})
|
|
77858
|
+
})
|
|
77859
|
+
});
|
|
77845
77860
|
var commandApprovalParamsSchema = external_exports.object({
|
|
77846
77861
|
command: external_exports.string().nullish(),
|
|
77847
77862
|
commandActions: external_exports.array(external_exports.unknown()).max(1e3).nullish(),
|
|
@@ -78526,6 +78541,7 @@ var THREAD_NOTIFICATIONS = /* @__PURE__ */ new Set([
|
|
|
78526
78541
|
"thread/compacted",
|
|
78527
78542
|
"thread/name/updated",
|
|
78528
78543
|
"thread/settings/updated",
|
|
78544
|
+
"thread/tokenUsage/updated",
|
|
78529
78545
|
"turn/completed",
|
|
78530
78546
|
"turn/plan/updated",
|
|
78531
78547
|
"turn/started"
|
|
@@ -78608,6 +78624,29 @@ function steeringPrompt(prompt) {
|
|
|
78608
78624
|
}
|
|
78609
78625
|
return blocks;
|
|
78610
78626
|
}
|
|
78627
|
+
function addResponseTokens(total, response) {
|
|
78628
|
+
return {
|
|
78629
|
+
inputTokens: (total?.inputTokens ?? 0) + response.inputTokens,
|
|
78630
|
+
cachedInputTokens: (total?.cachedInputTokens ?? 0) + response.cachedInputTokens,
|
|
78631
|
+
cacheWriteInputTokens: (total?.cacheWriteInputTokens ?? 0) + (response.cacheWriteInputTokens ?? 0),
|
|
78632
|
+
outputTokens: (total?.outputTokens ?? 0) + response.outputTokens,
|
|
78633
|
+
reasoningOutputTokens: (total?.reasoningOutputTokens ?? 0) + response.reasoningOutputTokens
|
|
78634
|
+
};
|
|
78635
|
+
}
|
|
78636
|
+
function turnQuota(tokens) {
|
|
78637
|
+
if (tokens === null) {
|
|
78638
|
+
return {};
|
|
78639
|
+
}
|
|
78640
|
+
const tokenCount2 = {
|
|
78641
|
+
totalTokens: tokens.inputTokens + tokens.outputTokens,
|
|
78642
|
+
inputTokens: tokens.inputTokens,
|
|
78643
|
+
cachedInputTokens: tokens.cachedInputTokens,
|
|
78644
|
+
cachedWriteTokens: tokens.cacheWriteInputTokens ?? 0,
|
|
78645
|
+
outputTokens: tokens.outputTokens,
|
|
78646
|
+
reasoningOutputTokens: tokens.reasoningOutputTokens
|
|
78647
|
+
};
|
|
78648
|
+
return { _meta: { quota: { token_count: tokenCount2, model_usage: [] } } };
|
|
78649
|
+
}
|
|
78611
78650
|
function agentMessageUpdate(messageId, text2, questions = []) {
|
|
78612
78651
|
return {
|
|
78613
78652
|
content: { text: text2, type: "text" },
|
|
@@ -78753,7 +78792,8 @@ var CodexOwnedAcpAgent = class {
|
|
|
78753
78792
|
steeringContent: /* @__PURE__ */ new Map(),
|
|
78754
78793
|
clientId: randomUUID8(),
|
|
78755
78794
|
input: { kind: "awaiting" },
|
|
78756
|
-
turn: { id: "" }
|
|
78795
|
+
turn: { id: "" },
|
|
78796
|
+
tokens: null
|
|
78757
78797
|
};
|
|
78758
78798
|
this.#turn = turn;
|
|
78759
78799
|
try {
|
|
@@ -78819,6 +78859,14 @@ var CodexOwnedAcpAgent = class {
|
|
|
78819
78859
|
if (!thread.success || thread.data.threadId !== this.#context.threadId()) {
|
|
78820
78860
|
return;
|
|
78821
78861
|
}
|
|
78862
|
+
if (method === "thread/tokenUsage/updated") {
|
|
78863
|
+
const decoded = tokenUsageNotificationSchema.safeParse(params);
|
|
78864
|
+
const active = this.#turn;
|
|
78865
|
+
if (decoded.success && active !== null && active.turn.id === decoded.data.turnId) {
|
|
78866
|
+
active.tokens = addResponseTokens(active.tokens, decoded.data.tokenUsage.last);
|
|
78867
|
+
}
|
|
78868
|
+
return;
|
|
78869
|
+
}
|
|
78822
78870
|
if (method === "turn/started") {
|
|
78823
78871
|
const decoded = turnNotificationSchema.safeParse(params);
|
|
78824
78872
|
if (decoded.success && this.#turn !== null && (this.#turn.turn.id === "" || this.#turn.turn.id === decoded.data.turn.id)) {
|
|
@@ -79167,7 +79215,8 @@ var CodexOwnedAcpAgent = class {
|
|
|
79167
79215
|
steeringContent: /* @__PURE__ */ new Map(),
|
|
79168
79216
|
clientId: randomUUID8(),
|
|
79169
79217
|
input: { kind: "awaiting" },
|
|
79170
|
-
turn: { id: "" }
|
|
79218
|
+
turn: { id: "" },
|
|
79219
|
+
tokens: null
|
|
79171
79220
|
};
|
|
79172
79221
|
this.#agentMessages.clear();
|
|
79173
79222
|
this.#streamedReasoningSources.clear();
|
|
@@ -79279,7 +79328,7 @@ var CodexOwnedAcpAgent = class {
|
|
|
79279
79328
|
}
|
|
79280
79329
|
}
|
|
79281
79330
|
this.#turnSettledCompaction = this.#settleCompaction("cancelled") !== null;
|
|
79282
|
-
turn.completion.resolve({ stopReason: "cancelled" });
|
|
79331
|
+
turn.completion.resolve({ stopReason: "cancelled", ...turnQuota(turn.tokens) });
|
|
79283
79332
|
};
|
|
79284
79333
|
#cancelSampling = () => {
|
|
79285
79334
|
this.#sampling?.abort();
|
|
@@ -79412,10 +79461,10 @@ var CodexOwnedAcpAgent = class {
|
|
|
79412
79461
|
}
|
|
79413
79462
|
if (turn.status === "interrupted") {
|
|
79414
79463
|
this.#turnSettledCompaction = this.#settleCompaction("cancelled") !== null;
|
|
79415
|
-
active.completion.resolve({ stopReason: "cancelled" });
|
|
79464
|
+
active.completion.resolve({ stopReason: "cancelled", ...turnQuota(active.tokens) });
|
|
79416
79465
|
return;
|
|
79417
79466
|
}
|
|
79418
|
-
active.completion.resolve({ stopReason: "end_turn" });
|
|
79467
|
+
active.completion.resolve({ stopReason: "end_turn", ...turnQuota(active.tokens) });
|
|
79419
79468
|
};
|
|
79420
79469
|
};
|
|
79421
79470
|
|
|
@@ -87973,6 +88022,10 @@ async function normalizeOpenedSession(session, nativeSessionId, response, signal
|
|
|
87973
88022
|
...session.connection.commitLifecycle(response)
|
|
87974
88023
|
};
|
|
87975
88024
|
}
|
|
88025
|
+
function withTurnTokens(result, convert) {
|
|
88026
|
+
const tokens = convert(result);
|
|
88027
|
+
return tokens === void 0 ? result : { ...result, tokens };
|
|
88028
|
+
}
|
|
87976
88029
|
|
|
87977
88030
|
// src/engine/session/process/retained-agent-processes.ts
|
|
87978
88031
|
var RetainedAgentProcesses = class {
|
|
@@ -88461,6 +88514,58 @@ var AntigravityAdapter = class {
|
|
|
88461
88514
|
);
|
|
88462
88515
|
};
|
|
88463
88516
|
|
|
88517
|
+
// src/engine/acp/harness/claude/turn-tokens.ts
|
|
88518
|
+
function reportedTokens(result) {
|
|
88519
|
+
const quota = result._meta?.quota;
|
|
88520
|
+
if (quota !== void 0 && quota.model_usage.length > 0) {
|
|
88521
|
+
return quota.model_usage.map(({ token_count: count }) => ({
|
|
88522
|
+
input: count.inputTokens,
|
|
88523
|
+
cacheRead: count.cachedInputTokens ?? 0,
|
|
88524
|
+
cacheWrite: count.cachedWriteTokens ?? 0,
|
|
88525
|
+
output: count.outputTokens
|
|
88526
|
+
}));
|
|
88527
|
+
}
|
|
88528
|
+
if (quota?.token_count != null) {
|
|
88529
|
+
const count = quota.token_count;
|
|
88530
|
+
return [
|
|
88531
|
+
{
|
|
88532
|
+
input: count.inputTokens,
|
|
88533
|
+
cacheRead: count.cachedInputTokens ?? 0,
|
|
88534
|
+
cacheWrite: count.cachedWriteTokens ?? 0,
|
|
88535
|
+
output: count.outputTokens
|
|
88536
|
+
}
|
|
88537
|
+
];
|
|
88538
|
+
}
|
|
88539
|
+
const usage = result.usage;
|
|
88540
|
+
if (usage == null) {
|
|
88541
|
+
return [];
|
|
88542
|
+
}
|
|
88543
|
+
return [
|
|
88544
|
+
{
|
|
88545
|
+
input: usage.inputTokens,
|
|
88546
|
+
cacheRead: usage.cachedReadTokens ?? 0,
|
|
88547
|
+
cacheWrite: usage.cachedWriteTokens ?? 0,
|
|
88548
|
+
output: usage.outputTokens
|
|
88549
|
+
}
|
|
88550
|
+
];
|
|
88551
|
+
}
|
|
88552
|
+
function claudeTurnTokens(result) {
|
|
88553
|
+
const reported = reportedTokens(result);
|
|
88554
|
+
if (reported.length === 0) {
|
|
88555
|
+
return void 0;
|
|
88556
|
+
}
|
|
88557
|
+
const sum = (count) => reported.reduce((total, tokens) => total + count(tokens), 0);
|
|
88558
|
+
const cachedInputTokens = sum((tokens) => tokens.cacheRead);
|
|
88559
|
+
const cacheWriteTokens = sum((tokens) => tokens.cacheWrite);
|
|
88560
|
+
const usage = {
|
|
88561
|
+
inputTokens: sum((tokens) => tokens.input) + cachedInputTokens + cacheWriteTokens,
|
|
88562
|
+
cachedInputTokens,
|
|
88563
|
+
cacheWriteTokens,
|
|
88564
|
+
outputTokens: sum((tokens) => tokens.output)
|
|
88565
|
+
};
|
|
88566
|
+
return isTurnTokenUsage(usage) ? usage : void 0;
|
|
88567
|
+
}
|
|
88568
|
+
|
|
88464
88569
|
// src/engine/acp/adapter/claude/adapter.ts
|
|
88465
88570
|
function openingRequest(params, execution) {
|
|
88466
88571
|
return {
|
|
@@ -88534,7 +88639,7 @@ var ClaudeAdapter = class {
|
|
|
88534
88639
|
closeSession = (...args) => this.#executionConnections.closeSession(...args);
|
|
88535
88640
|
releaseSession = (params) => this.#executionConnections.releaseSession(params);
|
|
88536
88641
|
readNativeHistoryRevision = (params) => this.#executionConnections.readNativeHistoryRevision(params);
|
|
88537
|
-
prompt = (...args) => this.#executionConnections.prompt(...args);
|
|
88642
|
+
prompt = async (...args) => withTurnTokens(await this.#executionConnections.prompt(...args), claudeTurnTokens);
|
|
88538
88643
|
steer = (...args) => this.#executionConnections.steer(...args);
|
|
88539
88644
|
renameSession = (...args) => this.#executionConnections.renameSession(...args);
|
|
88540
88645
|
configureSession = (...args) => this.#executionConnections.configureSession(...args);
|
|
@@ -88551,6 +88656,22 @@ var ClaudeAdapter = class {
|
|
|
88551
88656
|
);
|
|
88552
88657
|
};
|
|
88553
88658
|
|
|
88659
|
+
// src/engine/acp/harness/codex/turn-tokens.ts
|
|
88660
|
+
function codexTurnTokens(result) {
|
|
88661
|
+
const count = result._meta?.quota?.token_count;
|
|
88662
|
+
if (count == null) {
|
|
88663
|
+
return void 0;
|
|
88664
|
+
}
|
|
88665
|
+
const usage = {
|
|
88666
|
+
inputTokens: count.inputTokens,
|
|
88667
|
+
cachedInputTokens: count.cachedInputTokens ?? 0,
|
|
88668
|
+
cacheWriteTokens: count.cachedWriteTokens ?? 0,
|
|
88669
|
+
outputTokens: count.outputTokens,
|
|
88670
|
+
...count.reasoningOutputTokens === void 0 ? {} : { reasoningTokens: count.reasoningOutputTokens }
|
|
88671
|
+
};
|
|
88672
|
+
return isTurnTokenUsage(usage) ? usage : void 0;
|
|
88673
|
+
}
|
|
88674
|
+
|
|
88554
88675
|
// src/engine/acp/adapter/codex/tool-event.ts
|
|
88555
88676
|
var toolEventSchema = external_exports.looseObject({
|
|
88556
88677
|
sessionUpdate: external_exports.enum(["tool_call", "tool_call_update"]),
|
|
@@ -88722,7 +88843,7 @@ var CodexAdapter = class {
|
|
|
88722
88843
|
signal.throwIfAborted();
|
|
88723
88844
|
return { kind: "untracked" };
|
|
88724
88845
|
};
|
|
88725
|
-
prompt = (...args) => this.#executionConnections.prompt(...args);
|
|
88846
|
+
prompt = async (...args) => withTurnTokens(await this.#executionConnections.prompt(...args), codexTurnTokens);
|
|
88726
88847
|
steer = (...args) => this.#executionConnections.steer(...args);
|
|
88727
88848
|
renameSession = (...args) => this.#executionConnections.renameSession(...args);
|
|
88728
88849
|
configureSession = (...args) => this.#executionConnections.configureSession(...args);
|
|
@@ -97675,7 +97796,11 @@ var AgentSession = class _AgentSession {
|
|
|
97675
97796
|
this.writeStoredSession((/* @__PURE__ */ new Date()).toISOString());
|
|
97676
97797
|
if (lifecycle !== void 0) {
|
|
97677
97798
|
const messageId = result._meta?.messageId;
|
|
97678
|
-
const completion = {
|
|
97799
|
+
const completion = {
|
|
97800
|
+
...messageId === void 0 ? {} : { messageId },
|
|
97801
|
+
stopReason: result.stopReason,
|
|
97802
|
+
...result.tokens === void 0 ? {} : { usage: result.tokens }
|
|
97803
|
+
};
|
|
97679
97804
|
if (result.stopReason !== "cancelled" && this.#recordedBackground.length > 0) {
|
|
97680
97805
|
this.#hold(
|
|
97681
97806
|
options.commandId,
|
|
@@ -98018,14 +98143,16 @@ var AgentSession = class _AgentSession {
|
|
|
98018
98143
|
if (this.#agentTurn?.held === true) {
|
|
98019
98144
|
this.#agentTurn = null;
|
|
98020
98145
|
}
|
|
98146
|
+
const usage = held.completion.usage === void 0 ? {} : { usage: held.completion.usage };
|
|
98021
98147
|
await this.recordLifecycleEvent({
|
|
98022
98148
|
payload: failure2 !== void 0 ? {
|
|
98023
98149
|
attemptId: held.attemptId,
|
|
98024
98150
|
code: failure2.code,
|
|
98025
98151
|
commandId: held.commandId,
|
|
98026
98152
|
kind: "prompt.failed",
|
|
98027
|
-
message: truncate(failure2.message, 500)
|
|
98028
|
-
|
|
98153
|
+
message: truncate(failure2.message, 500),
|
|
98154
|
+
...usage
|
|
98155
|
+
} : held.cancelled ? { commandId: held.commandId, kind: "prompt.completed", stopReason: "cancelled", ...usage } : { commandId: held.commandId, kind: "prompt.completed", ...held.completion },
|
|
98029
98156
|
type: "lifecycle-metadata"
|
|
98030
98157
|
});
|
|
98031
98158
|
this.#getObserver().onAgentTurn?.(this.#mobiusSessionId, this.#agentTurn?.commandId ?? null);
|
|
@@ -106302,4 +106429,4 @@ export {
|
|
|
106302
106429
|
* MIT Licensed
|
|
106303
106430
|
*)
|
|
106304
106431
|
*/
|
|
106305
|
-
//# sourceMappingURL=chunk-
|
|
106432
|
+
//# sourceMappingURL=chunk-W5AYDFKU.js.map
|