@moxt-ai/mobius 0.0.470 → 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-6IXW5QQ2.js → chunk-6WVQ6SPI.js} +2 -2
- package/dist/{chunk-6IXW5QQ2.js.map → chunk-6WVQ6SPI.js.map} +1 -1
- package/dist/{chunk-IGRR6CBP.js → chunk-W5AYDFKU.js} +228 -84
- package/dist/{chunk-IGRR6CBP.js.map → chunk-W5AYDFKU.js.map} +4 -4
- package/dist/{cli-3G4ZQNCX.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 +2 -2
- /package/dist/{cli-3G4ZQNCX.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({
|
|
@@ -21407,6 +21407,91 @@ var encodeSessionPermissionRespondCommand = (message) => encodeZodMessage(messag
|
|
|
21407
21407
|
var decodeSessionElicitationRespondCommand = (encoded) => decodeZodMessage(encoded, sessionElicitationRespondCommandSchema);
|
|
21408
21408
|
var encodeSessionElicitationRespondCommand = (message) => encodeZodMessage(message, sessionElicitationRespondCommandSchema);
|
|
21409
21409
|
|
|
21410
|
+
// ../mobius-sdk/src/protocol/session/prompt/usage.ts
|
|
21411
|
+
var TOKEN_COUNT = external_exports.number().int().nonnegative();
|
|
21412
|
+
function normalizeQuotaTokenCount(value) {
|
|
21413
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
21414
|
+
return value;
|
|
21415
|
+
}
|
|
21416
|
+
if (Reflect.has(value, "inputTokens") || Reflect.has(value, "outputTokens") || Reflect.has(value, "totalTokens")) {
|
|
21417
|
+
return value;
|
|
21418
|
+
}
|
|
21419
|
+
if (!Reflect.has(value, "input_tokens") && !Reflect.has(value, "output_tokens")) {
|
|
21420
|
+
return value;
|
|
21421
|
+
}
|
|
21422
|
+
const inputTokens = Reflect.get(value, "input_tokens");
|
|
21423
|
+
const outputTokens = Reflect.get(value, "output_tokens");
|
|
21424
|
+
const reportedTotal = Reflect.get(value, "total_tokens");
|
|
21425
|
+
return {
|
|
21426
|
+
cachedInputTokens: Reflect.get(value, "cached_input_tokens"),
|
|
21427
|
+
cachedWriteTokens: Reflect.get(value, "cached_write_tokens"),
|
|
21428
|
+
inputTokens,
|
|
21429
|
+
outputTokens,
|
|
21430
|
+
reasoningOutputTokens: Reflect.get(value, "reasoning_output_tokens"),
|
|
21431
|
+
totalTokens: reportedTotal === void 0 && typeof inputTokens === "number" && typeof outputTokens === "number" ? inputTokens + outputTokens : reportedTotal
|
|
21432
|
+
};
|
|
21433
|
+
}
|
|
21434
|
+
var promptUsageSchema = external_exports.object({
|
|
21435
|
+
cachedReadTokens: TOKEN_COUNT.nullish(),
|
|
21436
|
+
cachedWriteTokens: TOKEN_COUNT.nullish(),
|
|
21437
|
+
inputTokens: TOKEN_COUNT,
|
|
21438
|
+
outputTokens: TOKEN_COUNT,
|
|
21439
|
+
thoughtTokens: TOKEN_COUNT.nullish(),
|
|
21440
|
+
totalTokens: TOKEN_COUNT
|
|
21441
|
+
}).readonly();
|
|
21442
|
+
var quotaTokenCountSchema = external_exports.preprocess(
|
|
21443
|
+
normalizeQuotaTokenCount,
|
|
21444
|
+
external_exports.object({
|
|
21445
|
+
cachedInputTokens: TOKEN_COUNT.optional(),
|
|
21446
|
+
cachedWriteTokens: TOKEN_COUNT.optional(),
|
|
21447
|
+
inputTokens: TOKEN_COUNT,
|
|
21448
|
+
outputTokens: TOKEN_COUNT,
|
|
21449
|
+
reasoningOutputTokens: TOKEN_COUNT.optional(),
|
|
21450
|
+
totalTokens: TOKEN_COUNT
|
|
21451
|
+
}).readonly()
|
|
21452
|
+
);
|
|
21453
|
+
var promptMetadataSchema = external_exports.object({
|
|
21454
|
+
messageId: external_exports.string().min(1).max(2048).optional(),
|
|
21455
|
+
quota: external_exports.object({
|
|
21456
|
+
model_usage: external_exports.array(
|
|
21457
|
+
external_exports.object({
|
|
21458
|
+
model: external_exports.string().min(1).max(255),
|
|
21459
|
+
token_count: quotaTokenCountSchema
|
|
21460
|
+
}).readonly()
|
|
21461
|
+
).max(100).readonly(),
|
|
21462
|
+
token_count: quotaTokenCountSchema.nullable()
|
|
21463
|
+
}).readonly().optional()
|
|
21464
|
+
}).readonly();
|
|
21465
|
+
var turnTokenUsageSchema = external_exports.object({
|
|
21466
|
+
// All input, including cache reads and cache writes.
|
|
21467
|
+
inputTokens: TOKEN_COUNT,
|
|
21468
|
+
// The part of `inputTokens` read from the prompt cache.
|
|
21469
|
+
cachedInputTokens: TOKEN_COUNT,
|
|
21470
|
+
// The part of `inputTokens` written to the prompt cache.
|
|
21471
|
+
cacheWriteTokens: TOKEN_COUNT,
|
|
21472
|
+
// All output, including reasoning.
|
|
21473
|
+
outputTokens: TOKEN_COUNT,
|
|
21474
|
+
// The part of `outputTokens` spent on reasoning; absent when the Agent does not report it separately.
|
|
21475
|
+
reasoningTokens: TOKEN_COUNT.optional()
|
|
21476
|
+
}).readonly().refine(
|
|
21477
|
+
(usage) => usage.cachedInputTokens + usage.cacheWriteTokens <= usage.inputTokens && (usage.reasoningTokens ?? 0) <= usage.outputTokens
|
|
21478
|
+
);
|
|
21479
|
+
var isTurnTokenUsage = (value) => turnTokenUsageSchema.safeParse(value).success;
|
|
21480
|
+
var agentPromptResponseSchema = external_exports.object({
|
|
21481
|
+
_meta: promptMetadataSchema.nullish(),
|
|
21482
|
+
stopReason: external_exports.enum(["end_turn", "max_tokens", "max_turn_requests", "refusal", "cancelled"]),
|
|
21483
|
+
usage: promptUsageSchema.nullish()
|
|
21484
|
+
}).readonly();
|
|
21485
|
+
function decodeAgentPromptResponse(value) {
|
|
21486
|
+
const result = agentPromptResponseSchema.safeParse(value);
|
|
21487
|
+
if (!result.success) {
|
|
21488
|
+
throw new ProtocolMessageError("Invalid agent prompt response", {
|
|
21489
|
+
cause: result.error
|
|
21490
|
+
});
|
|
21491
|
+
}
|
|
21492
|
+
return result.data;
|
|
21493
|
+
}
|
|
21494
|
+
|
|
21410
21495
|
// ../mobius-sdk/src/protocol/session/events/index.ts
|
|
21411
21496
|
var MAX_EVENT_COUNT = 1e4;
|
|
21412
21497
|
var MAX_COLLECTION_SIZE2 = 1e3;
|
|
@@ -21682,12 +21767,14 @@ var sessionBackgroundTaskSchema = external_exports.object({
|
|
|
21682
21767
|
toolCallId: external_exports.string().min(1).max(2048).optional().catch(void 0),
|
|
21683
21768
|
description: external_exports.string().max(500).optional().catch(void 0)
|
|
21684
21769
|
}).readonly();
|
|
21770
|
+
var promptTokenUsage = turnTokenUsageSchema.optional().catch(void 0);
|
|
21685
21771
|
var promptCompletedSchema = external_exports.object({
|
|
21686
21772
|
...lifecycleBase,
|
|
21687
21773
|
kind: external_exports.literal("prompt.completed"),
|
|
21688
21774
|
execution: external_exports.literal("not-started").optional(),
|
|
21689
21775
|
messageId: promptMessageId.optional(),
|
|
21690
|
-
stopReason: shortString
|
|
21776
|
+
stopReason: shortString,
|
|
21777
|
+
usage: promptTokenUsage
|
|
21691
21778
|
}).readonly();
|
|
21692
21779
|
var promptFailedSchema = external_exports.object({
|
|
21693
21780
|
...lifecycleBase,
|
|
@@ -21695,7 +21782,8 @@ var promptFailedSchema = external_exports.object({
|
|
|
21695
21782
|
code: identifierStringSchema,
|
|
21696
21783
|
kind: external_exports.literal("prompt.failed"),
|
|
21697
21784
|
message: external_exports.string().min(1).max(500),
|
|
21698
|
-
messageId: promptMessageId.optional()
|
|
21785
|
+
messageId: promptMessageId.optional(),
|
|
21786
|
+
usage: promptTokenUsage
|
|
21699
21787
|
}).readonly();
|
|
21700
21788
|
var lifecycleMetadataSchema = external_exports.discriminatedUnion("kind", [
|
|
21701
21789
|
// `changedByCommandId` names the command whose admission to or departure from the queue changed it. Runtimes
|
|
@@ -22760,76 +22848,6 @@ var encodeSessionPromptSuggestionReadCommand = (message) => encodeZodMessage(mes
|
|
|
22760
22848
|
var decodeSessionPromptSuggestionReadResult = (encoded) => decodeZodMessage(encoded, sessionPromptSuggestionReadResultSchema);
|
|
22761
22849
|
var encodeSessionPromptSuggestionReadResult = (message) => encodeZodMessage(message, sessionPromptSuggestionReadResultSchema);
|
|
22762
22850
|
|
|
22763
|
-
// ../mobius-sdk/src/protocol/session/prompt/usage.ts
|
|
22764
|
-
var TOKEN_COUNT = external_exports.number().int().nonnegative();
|
|
22765
|
-
function normalizeQuotaTokenCount(value) {
|
|
22766
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
22767
|
-
return value;
|
|
22768
|
-
}
|
|
22769
|
-
if (Reflect.has(value, "inputTokens") || Reflect.has(value, "outputTokens") || Reflect.has(value, "totalTokens")) {
|
|
22770
|
-
return value;
|
|
22771
|
-
}
|
|
22772
|
-
if (!Reflect.has(value, "input_tokens") && !Reflect.has(value, "output_tokens")) {
|
|
22773
|
-
return value;
|
|
22774
|
-
}
|
|
22775
|
-
const inputTokens = Reflect.get(value, "input_tokens");
|
|
22776
|
-
const outputTokens = Reflect.get(value, "output_tokens");
|
|
22777
|
-
const reportedTotal = Reflect.get(value, "total_tokens");
|
|
22778
|
-
return {
|
|
22779
|
-
cachedInputTokens: Reflect.get(value, "cached_input_tokens"),
|
|
22780
|
-
cachedWriteTokens: Reflect.get(value, "cached_write_tokens"),
|
|
22781
|
-
inputTokens,
|
|
22782
|
-
outputTokens,
|
|
22783
|
-
reasoningOutputTokens: Reflect.get(value, "reasoning_output_tokens"),
|
|
22784
|
-
totalTokens: reportedTotal === void 0 && typeof inputTokens === "number" && typeof outputTokens === "number" ? inputTokens + outputTokens : reportedTotal
|
|
22785
|
-
};
|
|
22786
|
-
}
|
|
22787
|
-
var promptUsageSchema = external_exports.object({
|
|
22788
|
-
cachedReadTokens: TOKEN_COUNT.nullish(),
|
|
22789
|
-
cachedWriteTokens: TOKEN_COUNT.nullish(),
|
|
22790
|
-
inputTokens: TOKEN_COUNT,
|
|
22791
|
-
outputTokens: TOKEN_COUNT,
|
|
22792
|
-
thoughtTokens: TOKEN_COUNT.nullish(),
|
|
22793
|
-
totalTokens: TOKEN_COUNT
|
|
22794
|
-
}).readonly();
|
|
22795
|
-
var quotaTokenCountSchema = external_exports.preprocess(
|
|
22796
|
-
normalizeQuotaTokenCount,
|
|
22797
|
-
external_exports.object({
|
|
22798
|
-
cachedInputTokens: TOKEN_COUNT.optional(),
|
|
22799
|
-
cachedWriteTokens: TOKEN_COUNT.optional(),
|
|
22800
|
-
inputTokens: TOKEN_COUNT,
|
|
22801
|
-
outputTokens: TOKEN_COUNT,
|
|
22802
|
-
reasoningOutputTokens: TOKEN_COUNT.optional(),
|
|
22803
|
-
totalTokens: TOKEN_COUNT
|
|
22804
|
-
}).readonly()
|
|
22805
|
-
);
|
|
22806
|
-
var promptMetadataSchema = external_exports.object({
|
|
22807
|
-
messageId: external_exports.string().min(1).max(2048).optional(),
|
|
22808
|
-
quota: external_exports.object({
|
|
22809
|
-
model_usage: external_exports.array(
|
|
22810
|
-
external_exports.object({
|
|
22811
|
-
model: external_exports.string().min(1).max(255),
|
|
22812
|
-
token_count: quotaTokenCountSchema
|
|
22813
|
-
}).readonly()
|
|
22814
|
-
).max(100).readonly(),
|
|
22815
|
-
token_count: quotaTokenCountSchema.nullable()
|
|
22816
|
-
}).readonly().optional()
|
|
22817
|
-
}).readonly();
|
|
22818
|
-
var agentPromptResponseSchema = external_exports.object({
|
|
22819
|
-
_meta: promptMetadataSchema.nullish(),
|
|
22820
|
-
stopReason: external_exports.enum(["end_turn", "max_tokens", "max_turn_requests", "refusal", "cancelled"]),
|
|
22821
|
-
usage: promptUsageSchema.nullish()
|
|
22822
|
-
}).readonly();
|
|
22823
|
-
function decodeAgentPromptResponse(value) {
|
|
22824
|
-
const result = agentPromptResponseSchema.safeParse(value);
|
|
22825
|
-
if (!result.success) {
|
|
22826
|
-
throw new ProtocolMessageError("Invalid agent prompt response", {
|
|
22827
|
-
cause: result.error
|
|
22828
|
-
});
|
|
22829
|
-
}
|
|
22830
|
-
return result.data;
|
|
22831
|
-
}
|
|
22832
|
-
|
|
22833
22851
|
// ../mobius-sdk/src/protocol/session/workspace/files.ts
|
|
22834
22852
|
var WORKSPACE_FILES_LIST_KIND = "workspace.files.list";
|
|
22835
22853
|
var WORKSPACE_FILES_KIND = "workspace.files";
|
|
@@ -77825,6 +77843,20 @@ var turnNotificationSchema = external_exports.object({
|
|
|
77825
77843
|
threadId: boundedText(256),
|
|
77826
77844
|
turn: turnSchema
|
|
77827
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
|
+
});
|
|
77828
77860
|
var commandApprovalParamsSchema = external_exports.object({
|
|
77829
77861
|
command: external_exports.string().nullish(),
|
|
77830
77862
|
commandActions: external_exports.array(external_exports.unknown()).max(1e3).nullish(),
|
|
@@ -78509,6 +78541,7 @@ var THREAD_NOTIFICATIONS = /* @__PURE__ */ new Set([
|
|
|
78509
78541
|
"thread/compacted",
|
|
78510
78542
|
"thread/name/updated",
|
|
78511
78543
|
"thread/settings/updated",
|
|
78544
|
+
"thread/tokenUsage/updated",
|
|
78512
78545
|
"turn/completed",
|
|
78513
78546
|
"turn/plan/updated",
|
|
78514
78547
|
"turn/started"
|
|
@@ -78591,6 +78624,29 @@ function steeringPrompt(prompt) {
|
|
|
78591
78624
|
}
|
|
78592
78625
|
return blocks;
|
|
78593
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
|
+
}
|
|
78594
78650
|
function agentMessageUpdate(messageId, text2, questions = []) {
|
|
78595
78651
|
return {
|
|
78596
78652
|
content: { text: text2, type: "text" },
|
|
@@ -78736,7 +78792,8 @@ var CodexOwnedAcpAgent = class {
|
|
|
78736
78792
|
steeringContent: /* @__PURE__ */ new Map(),
|
|
78737
78793
|
clientId: randomUUID8(),
|
|
78738
78794
|
input: { kind: "awaiting" },
|
|
78739
|
-
turn: { id: "" }
|
|
78795
|
+
turn: { id: "" },
|
|
78796
|
+
tokens: null
|
|
78740
78797
|
};
|
|
78741
78798
|
this.#turn = turn;
|
|
78742
78799
|
try {
|
|
@@ -78802,6 +78859,14 @@ var CodexOwnedAcpAgent = class {
|
|
|
78802
78859
|
if (!thread.success || thread.data.threadId !== this.#context.threadId()) {
|
|
78803
78860
|
return;
|
|
78804
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
|
+
}
|
|
78805
78870
|
if (method === "turn/started") {
|
|
78806
78871
|
const decoded = turnNotificationSchema.safeParse(params);
|
|
78807
78872
|
if (decoded.success && this.#turn !== null && (this.#turn.turn.id === "" || this.#turn.turn.id === decoded.data.turn.id)) {
|
|
@@ -79150,7 +79215,8 @@ var CodexOwnedAcpAgent = class {
|
|
|
79150
79215
|
steeringContent: /* @__PURE__ */ new Map(),
|
|
79151
79216
|
clientId: randomUUID8(),
|
|
79152
79217
|
input: { kind: "awaiting" },
|
|
79153
|
-
turn: { id: "" }
|
|
79218
|
+
turn: { id: "" },
|
|
79219
|
+
tokens: null
|
|
79154
79220
|
};
|
|
79155
79221
|
this.#agentMessages.clear();
|
|
79156
79222
|
this.#streamedReasoningSources.clear();
|
|
@@ -79262,7 +79328,7 @@ var CodexOwnedAcpAgent = class {
|
|
|
79262
79328
|
}
|
|
79263
79329
|
}
|
|
79264
79330
|
this.#turnSettledCompaction = this.#settleCompaction("cancelled") !== null;
|
|
79265
|
-
turn.completion.resolve({ stopReason: "cancelled" });
|
|
79331
|
+
turn.completion.resolve({ stopReason: "cancelled", ...turnQuota(turn.tokens) });
|
|
79266
79332
|
};
|
|
79267
79333
|
#cancelSampling = () => {
|
|
79268
79334
|
this.#sampling?.abort();
|
|
@@ -79395,10 +79461,10 @@ var CodexOwnedAcpAgent = class {
|
|
|
79395
79461
|
}
|
|
79396
79462
|
if (turn.status === "interrupted") {
|
|
79397
79463
|
this.#turnSettledCompaction = this.#settleCompaction("cancelled") !== null;
|
|
79398
|
-
active.completion.resolve({ stopReason: "cancelled" });
|
|
79464
|
+
active.completion.resolve({ stopReason: "cancelled", ...turnQuota(active.tokens) });
|
|
79399
79465
|
return;
|
|
79400
79466
|
}
|
|
79401
|
-
active.completion.resolve({ stopReason: "end_turn" });
|
|
79467
|
+
active.completion.resolve({ stopReason: "end_turn", ...turnQuota(active.tokens) });
|
|
79402
79468
|
};
|
|
79403
79469
|
};
|
|
79404
79470
|
|
|
@@ -87956,6 +88022,10 @@ async function normalizeOpenedSession(session, nativeSessionId, response, signal
|
|
|
87956
88022
|
...session.connection.commitLifecycle(response)
|
|
87957
88023
|
};
|
|
87958
88024
|
}
|
|
88025
|
+
function withTurnTokens(result, convert) {
|
|
88026
|
+
const tokens = convert(result);
|
|
88027
|
+
return tokens === void 0 ? result : { ...result, tokens };
|
|
88028
|
+
}
|
|
87959
88029
|
|
|
87960
88030
|
// src/engine/session/process/retained-agent-processes.ts
|
|
87961
88031
|
var RetainedAgentProcesses = class {
|
|
@@ -88444,6 +88514,58 @@ var AntigravityAdapter = class {
|
|
|
88444
88514
|
);
|
|
88445
88515
|
};
|
|
88446
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
|
+
|
|
88447
88569
|
// src/engine/acp/adapter/claude/adapter.ts
|
|
88448
88570
|
function openingRequest(params, execution) {
|
|
88449
88571
|
return {
|
|
@@ -88517,7 +88639,7 @@ var ClaudeAdapter = class {
|
|
|
88517
88639
|
closeSession = (...args) => this.#executionConnections.closeSession(...args);
|
|
88518
88640
|
releaseSession = (params) => this.#executionConnections.releaseSession(params);
|
|
88519
88641
|
readNativeHistoryRevision = (params) => this.#executionConnections.readNativeHistoryRevision(params);
|
|
88520
|
-
prompt = (...args) => this.#executionConnections.prompt(...args);
|
|
88642
|
+
prompt = async (...args) => withTurnTokens(await this.#executionConnections.prompt(...args), claudeTurnTokens);
|
|
88521
88643
|
steer = (...args) => this.#executionConnections.steer(...args);
|
|
88522
88644
|
renameSession = (...args) => this.#executionConnections.renameSession(...args);
|
|
88523
88645
|
configureSession = (...args) => this.#executionConnections.configureSession(...args);
|
|
@@ -88534,6 +88656,22 @@ var ClaudeAdapter = class {
|
|
|
88534
88656
|
);
|
|
88535
88657
|
};
|
|
88536
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
|
+
|
|
88537
88675
|
// src/engine/acp/adapter/codex/tool-event.ts
|
|
88538
88676
|
var toolEventSchema = external_exports.looseObject({
|
|
88539
88677
|
sessionUpdate: external_exports.enum(["tool_call", "tool_call_update"]),
|
|
@@ -88705,7 +88843,7 @@ var CodexAdapter = class {
|
|
|
88705
88843
|
signal.throwIfAborted();
|
|
88706
88844
|
return { kind: "untracked" };
|
|
88707
88845
|
};
|
|
88708
|
-
prompt = (...args) => this.#executionConnections.prompt(...args);
|
|
88846
|
+
prompt = async (...args) => withTurnTokens(await this.#executionConnections.prompt(...args), codexTurnTokens);
|
|
88709
88847
|
steer = (...args) => this.#executionConnections.steer(...args);
|
|
88710
88848
|
renameSession = (...args) => this.#executionConnections.renameSession(...args);
|
|
88711
88849
|
configureSession = (...args) => this.#executionConnections.configureSession(...args);
|
|
@@ -97658,7 +97796,11 @@ var AgentSession = class _AgentSession {
|
|
|
97658
97796
|
this.writeStoredSession((/* @__PURE__ */ new Date()).toISOString());
|
|
97659
97797
|
if (lifecycle !== void 0) {
|
|
97660
97798
|
const messageId = result._meta?.messageId;
|
|
97661
|
-
const completion = {
|
|
97799
|
+
const completion = {
|
|
97800
|
+
...messageId === void 0 ? {} : { messageId },
|
|
97801
|
+
stopReason: result.stopReason,
|
|
97802
|
+
...result.tokens === void 0 ? {} : { usage: result.tokens }
|
|
97803
|
+
};
|
|
97662
97804
|
if (result.stopReason !== "cancelled" && this.#recordedBackground.length > 0) {
|
|
97663
97805
|
this.#hold(
|
|
97664
97806
|
options.commandId,
|
|
@@ -98001,14 +98143,16 @@ var AgentSession = class _AgentSession {
|
|
|
98001
98143
|
if (this.#agentTurn?.held === true) {
|
|
98002
98144
|
this.#agentTurn = null;
|
|
98003
98145
|
}
|
|
98146
|
+
const usage = held.completion.usage === void 0 ? {} : { usage: held.completion.usage };
|
|
98004
98147
|
await this.recordLifecycleEvent({
|
|
98005
98148
|
payload: failure2 !== void 0 ? {
|
|
98006
98149
|
attemptId: held.attemptId,
|
|
98007
98150
|
code: failure2.code,
|
|
98008
98151
|
commandId: held.commandId,
|
|
98009
98152
|
kind: "prompt.failed",
|
|
98010
|
-
message: truncate(failure2.message, 500)
|
|
98011
|
-
|
|
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 },
|
|
98012
98156
|
type: "lifecycle-metadata"
|
|
98013
98157
|
});
|
|
98014
98158
|
this.#getObserver().onAgentTurn?.(this.#mobiusSessionId, this.#agentTurn?.commandId ?? null);
|
|
@@ -106285,4 +106429,4 @@ export {
|
|
|
106285
106429
|
* MIT Licensed
|
|
106286
106430
|
*)
|
|
106287
106431
|
*/
|
|
106288
|
-
//# sourceMappingURL=chunk-
|
|
106432
|
+
//# sourceMappingURL=chunk-W5AYDFKU.js.map
|