@liberseek/boft-cli-linux-x64 0.8.4 → 0.8.5

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.
@@ -3098,10 +3098,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3098
3098
  const shape = def.shape;
3099
3099
  const propValues = {};
3100
3100
  for (const key in shape) {
3101
- const field2 = shape[key]._zod;
3102
- if (field2.values) {
3101
+ const field3 = shape[key]._zod;
3102
+ if (field3.values) {
3103
3103
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3104
- for (const v of field2.values)
3104
+ for (const v of field3.values)
3105
3105
  propValues[key].add(v);
3106
3106
  }
3107
3107
  }
@@ -14869,6 +14869,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
14869
14869
  cachedInputTokens: count,
14870
14870
  cacheWriteInputTokens: count,
14871
14871
  cacheKnownInputTokens: count,
14872
+ cacheHitCachedInputTokens: count,
14873
+ cacheHitInputTokens: count,
14872
14874
  outputTokens: count,
14873
14875
  reasoningOutputTokens: count,
14874
14876
  /** USD at the public price, summed over the priced requests only. */
@@ -14976,6 +14978,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
14976
14978
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
14977
14979
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
14978
14980
 
14981
+ // ../../shared-contracts/dist/thread-questions.js
14982
+ var field = external_exports.discriminatedUnion("type", [
14983
+ external_exports.object({
14984
+ id: external_exports.string().min(1),
14985
+ type: external_exports.literal("choice"),
14986
+ prompt: external_exports.string(),
14987
+ options: external_exports.array(external_exports.object({
14988
+ value: external_exports.string().min(1),
14989
+ label: external_exports.string(),
14990
+ description: external_exports.string().optional()
14991
+ })).min(1),
14992
+ multiple: external_exports.boolean(),
14993
+ allowOther: external_exports.boolean(),
14994
+ optional: external_exports.boolean()
14995
+ }),
14996
+ external_exports.object({
14997
+ id: external_exports.string().min(1),
14998
+ type: external_exports.literal("text"),
14999
+ prompt: external_exports.string(),
15000
+ multiline: external_exports.boolean(),
15001
+ secret: external_exports.literal(false),
15002
+ optional: external_exports.boolean(),
15003
+ placeholder: external_exports.string().optional(),
15004
+ prefill: external_exports.string().optional()
15005
+ })
15006
+ ]);
15007
+ var threadQuestionSchema = external_exports.object({
15008
+ interactionId: external_exports.string().min(1),
15009
+ turnId: external_exports.string().min(1),
15010
+ title: external_exports.string().optional(),
15011
+ questions: external_exports.array(field).min(1)
15012
+ }).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
15013
+ message: "Shared cards require at least one multi-select question"
15014
+ });
15015
+ var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
15016
+ var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
15017
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
15018
+ threadId: external_exports.string().min(1),
15019
+ turnId: external_exports.string().min(1),
15020
+ interactionId: external_exports.string().min(1),
15021
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
15022
+ cancelled: external_exports.boolean().default(false)
15023
+ });
15024
+ var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
15025
+
14979
15026
  // ../../shared-contracts/dist/harness-plugins.js
14980
15027
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
14981
15028
  var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
@@ -15745,7 +15792,10 @@ var harnessPluginRouteSchema = external_exports.object({
15745
15792
  harnessId: harnessPluginIdSchema,
15746
15793
  model: harnessModelRefSchema.optional(),
15747
15794
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15748
- permissionModeId: harnessPermissionModeIdSchema.optional()
15795
+ permissionModeId: harnessPermissionModeIdSchema.optional(),
15796
+ /** A draft prewarm create: stays unsubmitted until the user's first Turn.
15797
+ * Desktop forwards only the Model of a main-process prewarm to thread/start. */
15798
+ prewarm: external_exports.literal(true).optional()
15749
15799
  }).strict();
15750
15800
 
15751
15801
  // ../../shared-contracts/dist/harness-launch-settings.js
@@ -16356,26 +16406,26 @@ function parseHostUsage(value) {
16356
16406
  }
16357
16407
  }
16358
16408
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
16359
- for (const field2 of [
16409
+ for (const field3 of [
16360
16410
  "totalCredits",
16361
16411
  "contextUsagePercent",
16362
16412
  "apiOutputTokensPerSecond"
16363
16413
  ]) {
16364
- const candidate = value[field2];
16414
+ const candidate = value[field3];
16365
16415
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16366
- throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16416
+ throw new Error(`Harness Usage '${field3}' must be a finite non-negative number`);
16367
16417
  }
16368
16418
  }
16369
- for (const field2 of tokenFields) {
16370
- const candidate = value[field2];
16419
+ for (const field3 of tokenFields) {
16420
+ const candidate = value[field3];
16371
16421
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16372
- throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16422
+ throw new Error(`Harness Usage '${field3}' must be a non-negative safe integer`);
16373
16423
  }
16374
16424
  }
16375
- for (const field2 of safeIntegerFields) {
16376
- const candidate = value[field2];
16425
+ for (const field3 of safeIntegerFields) {
16426
+ const candidate = value[field3];
16377
16427
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16378
- throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16428
+ throw new Error(`Harness Usage '${field3}' must be a non-negative safe integer`);
16379
16429
  }
16380
16430
  }
16381
16431
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -16384,16 +16434,16 @@ function parseHostUsage(value) {
16384
16434
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
16385
16435
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
16386
16436
  }
16387
- for (const field2 of ["totalCredits", "contextUsagePercent"]) {
16388
- const candidate = value[field2];
16437
+ for (const field3 of ["totalCredits", "contextUsagePercent"]) {
16438
+ const candidate = value[field3];
16389
16439
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16390
- throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16440
+ throw new Error(`Harness Usage '${field3}' must be a finite non-negative number`);
16391
16441
  }
16392
16442
  }
16393
- for (const field2 of percentFields) {
16394
- const candidate = value[field2];
16443
+ for (const field3 of percentFields) {
16444
+ const candidate = value[field3];
16395
16445
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
16396
- throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
16446
+ throw new Error(`Harness Usage '${field3}' must be between 0 and 100`);
16397
16447
  }
16398
16448
  }
16399
16449
  if (value.sessionCacheUsage !== void 0) {
@@ -16464,19 +16514,19 @@ function parseHostUsageRequest(value) {
16464
16514
  if (typeof value.requestId !== "string" || value.requestId.length === 0) {
16465
16515
  throw new Error("Harness Usage request 'requestId' must be a non-empty string");
16466
16516
  }
16467
- for (const field2 of ["model", "provider"]) {
16468
- const candidate = value[field2];
16517
+ for (const field3 of ["model", "provider"]) {
16518
+ const candidate = value[field3];
16469
16519
  if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
16470
- throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
16520
+ throw new Error(`Harness Usage request '${field3}' must be a non-empty string`);
16471
16521
  }
16472
16522
  }
16473
16523
  if (value.historical !== void 0 && typeof value.historical !== "boolean") {
16474
16524
  throw new Error("Harness Usage request 'historical' must be a boolean");
16475
16525
  }
16476
- for (const field2 of requestTokenFields) {
16477
- const candidate = value[field2];
16526
+ for (const field3 of requestTokenFields) {
16527
+ const candidate = value[field3];
16478
16528
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16479
- throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
16529
+ throw new Error(`Harness Usage request '${field3}' must be a non-negative safe integer`);
16480
16530
  }
16481
16531
  }
16482
16532
  if (value.inputTokens === void 0 || value.outputTokens === void 0) {
@@ -16982,7 +17032,7 @@ var subscriptionSchema = external_exports.object({
16982
17032
  });
16983
17033
  function codingProduct(value) {
16984
17034
  const entry = recordSchema2.safeParse(value).data;
16985
- return [entry?.productId, entry?.productName].some((field2) => typeof field2 === "string" && field2.toLowerCase().includes("coding"));
17035
+ return [entry?.productId, entry?.productName].some((field3) => typeof field3 === "string" && field3.toLowerCase().includes("coding"));
16986
17036
  }
16987
17037
  async function queryEntitlement(family, apiKey, environment) {
16988
17038
  try {
@@ -17295,6 +17345,8 @@ async function accountConfig(installation, environment) {
17295
17345
  states
17296
17346
  },
17297
17347
  startPlan,
17348
+ signedIn: Boolean(family),
17349
+ startPlanChecked: !family || balanceData !== void 0,
17298
17350
  codingPlan
17299
17351
  };
17300
17352
  }
@@ -17400,6 +17452,8 @@ var CliTransport = class {
17400
17452
  // Aborting these cancels only this transport's running and queued shared verifications.
17401
17453
  #headerRequests = /* @__PURE__ */ new Map();
17402
17454
  #startPlan = false;
17455
+ #signedIn = false;
17456
+ #startPlanChecked = true;
17403
17457
  #codingPlan;
17404
17458
  #fault;
17405
17459
  #closed = false;
@@ -17412,6 +17466,14 @@ var CliTransport = class {
17412
17466
  get startPlan() {
17413
17467
  return this.#startPlan;
17414
17468
  }
17469
+ /** Whether ZCode Desktop is signed in to a Zhipu account, whatever that account is entitled to. */
17470
+ get signedIn() {
17471
+ return this.#signedIn;
17472
+ }
17473
+ /** False when the Start Plan balance could not be read, so its entitlement is unknown. */
17474
+ get startPlanChecked() {
17475
+ return this.#startPlanChecked;
17476
+ }
17415
17477
  constructor(options) {
17416
17478
  this.options = options;
17417
17479
  this.#context = {
@@ -17423,9 +17485,11 @@ var CliTransport = class {
17423
17485
  if (this.#child || this.#closed)
17424
17486
  throw new ZcodeError("invalidState", "ZCode transport already started or closed");
17425
17487
  const installation = await resolveInstallation(this.options.environment, this.options.app);
17426
- const { params: accountParams, startPlan, codingPlan } = await accountConfig(installation, this.options.environment);
17488
+ const { params: accountParams, startPlan, signedIn, startPlanChecked, codingPlan } = await accountConfig(installation, this.options.environment);
17427
17489
  this.#installation = installation;
17428
17490
  this.#startPlan = startPlan;
17491
+ this.#signedIn = signedIn;
17492
+ this.#startPlanChecked = startPlanChecked;
17429
17493
  this.#codingPlan = codingPlan;
17430
17494
  const child = spawn(installation.runtime, [installation.cli, "app-server", "--stdio", "--surface", "desktop"], {
17431
17495
  cwd: this.options.cwd,
@@ -17705,16 +17769,16 @@ var CliTransport = class {
17705
17769
  var CONFIG_URL = "https://zcode.z.ai/api/v1/client/configs";
17706
17770
  var CONFIG_TTL_MS = 6e4;
17707
17771
  var CONFIG_TIMEOUT_MS = 15e3;
17708
- var field = external_exports.string().min(1).optional().catch(void 0);
17772
+ var field2 = external_exports.string().min(1).optional().catch(void 0);
17709
17773
  var responseSchema = external_exports.object({
17710
17774
  data: external_exports.object({
17711
17775
  configs: external_exports.object({
17712
17776
  captcha: external_exports.object({
17713
17777
  enabled: external_exports.boolean().optional(),
17714
17778
  skip_model_request: external_exports.boolean().optional(),
17715
- region: field,
17716
- prefix: field,
17717
- sceneId: field
17779
+ region: field2,
17780
+ prefix: field2,
17781
+ sceneId: field2
17718
17782
  }).optional()
17719
17783
  })
17720
17784
  })
@@ -20127,9 +20191,20 @@ var ZcodeAdapter = class {
20127
20191
  if (!catalog.models.length)
20128
20192
  return {
20129
20193
  status: "unavailable",
20130
- error: {
20194
+ // A signed-in account without an active plan is not a login problem; only a signed-out
20195
+ // ZCode Desktop needs the login prompt.
20196
+ error: !transport.signedIn ? {
20131
20197
  code: "authenticationRequired",
20132
- message: "ZCode has no available models. Connect Start Plan or Personal Coding Plan in ZCode Desktop, or add a personal provider, then re-detect ZCode. Team Coding Plan is not supported.",
20198
+ message: "ZCode has no available models. Sign in to ZCode Desktop with a Start Plan or Personal Coding Plan account, or add a personal provider, then re-detect ZCode. Team Coding Plan is not supported.",
20199
+ retryable: true
20200
+ } : transport.startPlanChecked ? {
20201
+ code: "configurationRequired",
20202
+ message: "ZCode is signed in, but the account has no available models: no active Start Plan or event quota, no Personal Coding Plan, and no personal provider. Free trial and event quotas expire; subscribe to GLM Coding Plan or add a personal provider (API Key) in ZCode Desktop, then re-detect ZCode. Team Coding Plan is not supported.",
20203
+ retryable: true
20204
+ } : {
20205
+ // The balance request failed, so a valid Start Plan may just be unreadable now.
20206
+ code: "configurationRequired",
20207
+ message: "ZCode is signed in, but no models are available: the Start Plan balance could not be checked, and there is no Personal Coding Plan or personal provider. Re-detect ZCode in a moment; if this persists, check the network and the account in ZCode Desktop. Team Coding Plan is not supported.",
20133
20208
  retryable: true
20134
20209
  }
20135
20210
  };