@moxt-ai/mobius 0.0.470 → 0.0.471

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.
@@ -5,7 +5,7 @@ import {
5
5
  __toESM,
6
6
  __using,
7
7
  package_default
8
- } from "./chunk-6IXW5QQ2.js";
8
+ } from "./chunk-HPFAJPEN.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,90 @@ 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 agentPromptResponseSchema = external_exports.object({
21480
+ _meta: promptMetadataSchema.nullish(),
21481
+ stopReason: external_exports.enum(["end_turn", "max_tokens", "max_turn_requests", "refusal", "cancelled"]),
21482
+ usage: promptUsageSchema.nullish()
21483
+ }).readonly();
21484
+ function decodeAgentPromptResponse(value) {
21485
+ const result = agentPromptResponseSchema.safeParse(value);
21486
+ if (!result.success) {
21487
+ throw new ProtocolMessageError("Invalid agent prompt response", {
21488
+ cause: result.error
21489
+ });
21490
+ }
21491
+ return result.data;
21492
+ }
21493
+
21410
21494
  // ../mobius-sdk/src/protocol/session/events/index.ts
21411
21495
  var MAX_EVENT_COUNT = 1e4;
21412
21496
  var MAX_COLLECTION_SIZE2 = 1e3;
@@ -21682,12 +21766,14 @@ var sessionBackgroundTaskSchema = external_exports.object({
21682
21766
  toolCallId: external_exports.string().min(1).max(2048).optional().catch(void 0),
21683
21767
  description: external_exports.string().max(500).optional().catch(void 0)
21684
21768
  }).readonly();
21769
+ var promptTokenUsage = turnTokenUsageSchema.optional().catch(void 0);
21685
21770
  var promptCompletedSchema = external_exports.object({
21686
21771
  ...lifecycleBase,
21687
21772
  kind: external_exports.literal("prompt.completed"),
21688
21773
  execution: external_exports.literal("not-started").optional(),
21689
21774
  messageId: promptMessageId.optional(),
21690
- stopReason: shortString
21775
+ stopReason: shortString,
21776
+ usage: promptTokenUsage
21691
21777
  }).readonly();
21692
21778
  var promptFailedSchema = external_exports.object({
21693
21779
  ...lifecycleBase,
@@ -21695,7 +21781,8 @@ var promptFailedSchema = external_exports.object({
21695
21781
  code: identifierStringSchema,
21696
21782
  kind: external_exports.literal("prompt.failed"),
21697
21783
  message: external_exports.string().min(1).max(500),
21698
- messageId: promptMessageId.optional()
21784
+ messageId: promptMessageId.optional(),
21785
+ usage: promptTokenUsage
21699
21786
  }).readonly();
21700
21787
  var lifecycleMetadataSchema = external_exports.discriminatedUnion("kind", [
21701
21788
  // `changedByCommandId` names the command whose admission to or departure from the queue changed it. Runtimes
@@ -22760,76 +22847,6 @@ var encodeSessionPromptSuggestionReadCommand = (message) => encodeZodMessage(mes
22760
22847
  var decodeSessionPromptSuggestionReadResult = (encoded) => decodeZodMessage(encoded, sessionPromptSuggestionReadResultSchema);
22761
22848
  var encodeSessionPromptSuggestionReadResult = (message) => encodeZodMessage(message, sessionPromptSuggestionReadResultSchema);
22762
22849
 
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
22850
  // ../mobius-sdk/src/protocol/session/workspace/files.ts
22834
22851
  var WORKSPACE_FILES_LIST_KIND = "workspace.files.list";
22835
22852
  var WORKSPACE_FILES_KIND = "workspace.files";
@@ -106285,4 +106302,4 @@ export {
106285
106302
  * MIT Licensed
106286
106303
  *)
106287
106304
  */
106288
- //# sourceMappingURL=chunk-IGRR6CBP.js.map
106305
+ //# sourceMappingURL=chunk-7XY5VCQJ.js.map