@glasser-ai/cli 0.1.46 → 0.1.48

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.
Files changed (2) hide show
  1. package/dist/glasser.js +222 -37
  2. package/package.json +2 -2
package/dist/glasser.js CHANGED
@@ -61529,6 +61529,24 @@ var runWith2 = (command, config) => {
61529
61529
  }, catchFilter2((error2) => isCliError(error2) && error2._tag === "ShowHelp" ? succeed2(error2) : fail2(error2), (error2) => andThen3(showHelp(command, error2, config.renderErrors !== false), fail6(error2))), catchFilter2((error2) => config.renderErrors !== false && isCliError(error2) && error2._tag === "UserError" ? succeed2(error2) : fail2(error2), (error2) => andThen3(showUserError(error2), fail6(error2))), catchFilter2((e) => isQuitError(e) ? succeed2(e) : fail2(e), (_) => interrupt2));
61530
61530
  };
61531
61531
 
61532
+ // ../../packages/contract/src/client.ts
61533
+ var ClientUpgradeNotice = Schema_exports.Struct({
61534
+ /** 这次调用报出来的版本(我们从 User-Agent 认的)。认不出形状时为 null。 */
61535
+ client_version: Schema_exports.NullOr(Schema_exports.String),
61536
+ /** 能解码当前响应的最低版本。低于它的调用会被结构化拒绝。 */
61537
+ minimum_version: Schema_exports.String,
61538
+ /** 已发布的最新版本。 */
61539
+ latest_version: Schema_exports.String,
61540
+ /** 一条可以直接执行的升级命令。 */
61541
+ upgrade_command: Schema_exports.String,
61542
+ /** 一句给 agent 读的理由 —— 为什么现在应该升级。 */
61543
+ reason: Schema_exports.String
61544
+ });
61545
+ var clientUpgradeNoticeField = {
61546
+ client: Schema_exports.optionalKey(ClientUpgradeNotice)
61547
+ };
61548
+ var CLIENT_VERSION_UNSUPPORTED = "client.version_unsupported";
61549
+
61532
61550
  // ../../packages/contract/src/common.ts
61533
61551
  var ErrorBody = Schema_exports.Struct({
61534
61552
  code: Schema_exports.String,
@@ -61587,7 +61605,8 @@ var ERROR_CODES = {
61587
61605
  var BalanceResponse = Schema_exports.Struct({
61588
61606
  balance_usd: UsdAmount,
61589
61607
  held_usd: UsdAmount,
61590
- available_usd: UsdAmount
61608
+ available_usd: UsdAmount,
61609
+ ...clientUpgradeNoticeField
61591
61610
  });
61592
61611
  var BalanceEntryKind = Schema_exports.Literals([
61593
61612
  "charge",
@@ -61610,7 +61629,10 @@ var ListBalanceHistoryQuery = Schema_exports.Struct({
61610
61629
  ...PaginationQuery.fields,
61611
61630
  kind: Schema_exports.optional(BalanceEntryKind)
61612
61631
  });
61613
- var ListBalanceHistoryResponse = Paginated(BalanceEntry);
61632
+ var ListBalanceHistoryResponse = Schema_exports.Struct({
61633
+ ...Paginated(BalanceEntry).fields,
61634
+ ...clientUpgradeNoticeField
61635
+ });
61614
61636
 
61615
61637
  // ../../node_modules/effect/dist/unstable/httpapi/HttpApi.js
61616
61638
  var HttpApi_exports = {};
@@ -64365,10 +64387,51 @@ var PriceRule = Schema_exports.Union([
64365
64387
  type: Schema_exports.Literal("per_token"),
64366
64388
  per_million_input_tokens_usd: UsdAmount,
64367
64389
  cap_usd: UsdAmount
64368
- })
64390
+ }),
64391
+ /**
64392
+ * **兜底成员**:只要求 `type` 是字符串。
64393
+ *
64394
+ * 2026-09-20 上线 `per_token` 那天,所有已装的 CLI **整条命令失败** —— 不是
64395
+ * 降级,是整个响应解码失败:一行读不懂,search 一条都不返回。实测
64396
+ * (effect 4.0.0-rc.112,`HttpApiClient` 不传 ParseOptions,走默认值):
64397
+ *
64398
+ * 未知**字段** -> STRIPPED(onExcessProperty 默认 "ignore")
64399
+ * 未知**联合变体** -> REJECTED
64400
+ *
64401
+ * 所以这个 union 必须先开口,以后才能加规则。开口只在**公开契约**这一侧:
64402
+ * 内部的 `internalPriceSchema` 仍然封闭 —— 服务端必须认得自己的每一种规则,
64403
+ * 一条读不懂的规则在服务端是缺陷,不是可降级的输入。
64404
+ *
64405
+ * ⚠️ 兜底必须比任何新变体**先**到客户端手里。已装的 0.1.4x 救不回来
64406
+ * (它们编译进去的是封闭联合),但它们是最后一批会这样坏的客户端。
64407
+ *
64408
+ * 放在最后:union 按序尝试,已知变体先匹配,兜底只接未知的那些。
64409
+ * 兜底成员拿不出任何**已知**金额字段 —— 价格靠 `Price.display` 读,见下。
64410
+ *
64411
+ * ⚠️ 必须是 `StructWithRest` 而不是裸 `Struct`:裸 Struct 在 openapi.json 里带
64412
+ * `additionalProperties: false`,于是一个 `{type:"per_gpu_second", rate_usd:…}`
64413
+ * 在**校验 JSON Schema** 的客户端那里仍然一个成员都匹配不上 —— 兜底等于没加。
64414
+ * 带一条 `Record(String, Unknown)` rest 之后,未知字段合法,兜底才真的兜得住。
64415
+ */
64416
+ Schema_exports.StructWithRest(Schema_exports.Struct({ type: Schema_exports.String }), [
64417
+ Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown)
64418
+ ])
64369
64419
  ]);
64420
+ var PriceDisplay = Schema_exports.Struct({
64421
+ /** 主价,精确 USD 串。与 `unit` 拼成一行:`$` + amount_usd + `/` + unit。 */
64422
+ amount_usd: UsdAmount,
64423
+ /**
64424
+ * 计量单位的**单数名**,自由字符串,不是枚举 —— 加一种计量不改 schema,
64425
+ * 因此不破坏任何已装的客户端。今天的取值:`call`、`result`、
64426
+ * `1M input tokens`。
64427
+ */
64428
+ unit: Schema_exports.String,
64429
+ /** 这一次调用的封顶价 —— 分档与否都封在它下面。flat 没有上限,这个字段就不出现。 */
64430
+ cap_usd: Schema_exports.optionalKey(UsdAmount)
64431
+ });
64370
64432
  var Price = Schema_exports.Struct({
64371
64433
  rule: PriceRule,
64434
+ display: PriceDisplay,
64372
64435
  charges: Schema_exports.Struct({
64373
64436
  NO_RESULT: UsdAmount,
64374
64437
  PROVIDER_ERROR: UsdAmount,
@@ -64453,6 +64516,9 @@ var outputSchemaPairing = Schema_exports.makeFilter(
64453
64516
  var HttpMethod = Schema_exports.Literals(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"]);
64454
64517
  var EndpointDetail = Schema_exports.Struct({
64455
64518
  ...endpointFields,
64519
+ // 落后的客户端才会看到它(packages/contract/src/client.ts)。inspect 是 agent
64520
+ // 在决定跑不跑之前必经的一跳,所以升级信号挂在这里最省事。
64521
+ ...clientUpgradeNoticeField,
64456
64522
  method: HttpMethod,
64457
64523
  input_schema: Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown),
64458
64524
  output_schema: Schema_exports.NullOr(Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown)),
@@ -64462,6 +64528,11 @@ var EndpointDetail = Schema_exports.Struct({
64462
64528
  }).check(runModePairing).check(outputSchemaPairing);
64463
64529
  var SEARCH_PAGE_DEFAULT = 5;
64464
64530
  var SEARCH_PAGE_MAX = 20;
64531
+ var TaskIdField = Schema_exports.optional(
64532
+ Schema_exports.String.annotate({
64533
+ description: "The task this call belongs to. Omit on the first search of a piece of work and one is minted and returned; pass it back on every later search, inspect and run so they are recorded as one task. Any stable string is accepted."
64534
+ })
64535
+ );
64465
64536
  var SearchEndpointsRequest = Schema_exports.Struct({
64466
64537
  /** 关键词。缺省或空串返回全部(仍受 Policy 裁剪)。 */
64467
64538
  query: Schema_exports.optional(Schema_exports.String),
@@ -64469,7 +64540,23 @@ var SearchEndpointsRequest = Schema_exports.Struct({
64469
64540
  Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maximum: SEARCH_PAGE_MAX }))
64470
64541
  ),
64471
64542
  /** 上一页响应的 next_cursor。绑定于 query:拿别的查询的游标来翻是 400,不是从头开始。 */
64472
- cursor: Schema_exports.optional(Schema_exports.String)
64543
+ cursor: Schema_exports.optional(Schema_exports.String),
64544
+ task_id: TaskIdField,
64545
+ /**
64546
+ * Agent 转述的用户诉求。**只在这里收** —— 它属于这件事,不属于其中某一次调用,
64547
+ * 而 search 是这件事的第一次调用,也是 agent 手里那句话最新鲜的时候。
64548
+ *
64549
+ * 要的是转述,不是原话:原话会把第三方个人数据带进来,而这个字段的用途
64550
+ * (理解需求、将来做数据源匹配)不需要原话。
64551
+ *
64552
+ * 可选,而且必须可选:必填会让还没升级的调用方直接失败,也会逼一个不理解这个
64553
+ * 字段的模型去编 —— 编出来的比 null 更糟,因为在数据里分不出来。
64554
+ */
64555
+ user_request: Schema_exports.optional(
64556
+ Schema_exports.String.annotate({
64557
+ description: "One sentence, in your own words, on what the user is trying to achieve. Never their verbatim words, and never names, email addresses or other personal details. Recorded against the task as background; it does not affect results."
64558
+ })
64559
+ )
64473
64560
  });
64474
64561
  var SearchHit = Schema_exports.Struct({
64475
64562
  ...endpointFields,
@@ -64489,9 +64576,20 @@ var SearchHit = Schema_exports.Struct({
64489
64576
  }).check(runModePairing);
64490
64577
  var SearchEndpointsResponse = Schema_exports.Struct({
64491
64578
  data: Schema_exports.Array(SearchHit),
64579
+ ...clientUpgradeNoticeField,
64492
64580
  next_cursor: Schema_exports.NullOr(Schema_exports.String),
64493
64581
  total: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0)).annotate({
64494
64582
  description: "Total number of ranked candidates across all pages."
64583
+ }),
64584
+ /**
64585
+ * 这次检索算在哪件事上。**恒定存在** —— 请求没带就是这里签发的那个。
64586
+ *
64587
+ * 它放在 `total` 旁边而不是塞进每一行:它是关于这次调用的,不是关于某支
64588
+ * Endpoint 的。这个响应当初就没复用 `Paginated` 而是自己写了一份,为的正是
64589
+ * 能挂这种同级字段。
64590
+ */
64591
+ task_id: Schema_exports.String.annotate({
64592
+ description: "The task this search was recorded against \u2014 the one you sent, or a newly minted one if you sent none. Pass it back on every later search, inspect and run for the same piece of work."
64495
64593
  })
64496
64594
  });
64497
64595
  var InspectEndpointRequest = Schema_exports.Struct({
@@ -64501,7 +64599,8 @@ var InspectEndpointRequest = Schema_exports.Struct({
64501
64599
  Schema_exports.Int.check(Schema_exports.isGreaterThan(0)).annotate({
64502
64600
  description: "Select a supported Endpoint version, or omit for the default. Returns the current Price for that version; selecting a version does not lock its Price."
64503
64601
  })
64504
- )
64602
+ ),
64603
+ task_id: TaskIdField
64505
64604
  });
64506
64605
 
64507
64606
  // ../../packages/contract/src/rate-limit.ts
@@ -64572,7 +64671,15 @@ var Run = Schema_exports.Struct({
64572
64671
  stop_requested_at: Schema_exports.NullOr(Timestamp),
64573
64672
  created_at: Timestamp,
64574
64673
  started_at: Schema_exports.NullOr(Timestamp),
64575
- completed_at: Schema_exports.NullOr(Timestamp)
64674
+ completed_at: Schema_exports.NullOr(Timestamp),
64675
+ /**
64676
+ * 这条 Run 属于哪件事。调用方没报就是 null —— 那是常态,不是缺陷。
64677
+ *
64678
+ * 回的是**落库的那个值**,不是请求里那个:它经过了归一化(去空白、截断),
64679
+ * 而 `GET /v1/runs?task=` 拿去筛的也是归一化后的值。打印请求里那份会让人
64680
+ * 拿着一个筛不回来的串。
64681
+ */
64682
+ task_id: Schema_exports.NullOr(Schema_exports.String)
64576
64683
  });
64577
64684
  var RunRequest = Schema_exports.Struct({
64578
64685
  provider: ProviderSlug,
@@ -64584,15 +64691,37 @@ var RunRequest = Schema_exports.Struct({
64584
64691
  Schema_exports.Int.check(Schema_exports.isGreaterThan(0)).annotate({
64585
64692
  description: "Select a supported Endpoint version. Compatible updates keep this version; it does not lock the Price. New Runs use the Price at admission. Omit to use the default version. Unavailable or retired versions return 409."
64586
64693
  })
64694
+ ),
64695
+ /**
64696
+ * 这次 Run 算在哪件事上 —— 从 `POST /v1/endpoints/search` 的响应里拿。
64697
+ *
64698
+ * ⚠️ **它不进 `canonicalHash`。** 那个哈希按名字读四个键(provider、endpoint、
64699
+ * input、endpoint_version,见 `features/runs/service.ts`),所以这个同级字段
64700
+ * 永远不参与幂等判定:同一个 `Idempotency-Key` 换一个 task_id 重发仍然是重放,
64701
+ * 不会变成第二次执行。加字段时别把它挪进 `input`。
64702
+ */
64703
+ task_id: Schema_exports.optional(
64704
+ Schema_exports.String.annotate({
64705
+ description: "The task this run belongs to, from a catalog search response. Grouping only: it never affects routing, price or idempotency."
64706
+ })
64587
64707
  )
64588
64708
  });
64589
64709
  var ListRunsQuery = Schema_exports.Struct({
64590
64710
  ...PaginationQuery.fields,
64591
64711
  status: Schema_exports.optional(RunStatus),
64592
64712
  provider: Schema_exports.optional(Schema_exports.String),
64593
- endpoint: Schema_exports.optional(Schema_exports.String)
64713
+ endpoint: Schema_exports.optional(Schema_exports.String),
64714
+ /** 精确相等,不是前缀、不是包含 —— Task id 是个不透明串,要么知道全部要么不知道。 */
64715
+ task: Schema_exports.optional(
64716
+ Schema_exports.String.annotate({
64717
+ description: "Return only runs recorded against this task. Exact match."
64718
+ })
64719
+ )
64720
+ });
64721
+ var ListRunsResponse = Schema_exports.Struct({
64722
+ ...Paginated(Run).fields,
64723
+ ...clientUpgradeNoticeField
64594
64724
  });
64595
- var ListRunsResponse = Paginated(Run);
64596
64725
  var RunId = Schema_exports.String.check(Schema_exports.isUUID());
64597
64726
  var RunIdParam = Schema_exports.Struct({
64598
64727
  runId: RunId
@@ -64636,7 +64765,19 @@ var providerField = (providers) => Schema_exports.optional(
64636
64765
  })
64637
64766
  );
64638
64767
  var commonFields = {
64639
- limit: Schema_exports.optional(Limit)
64768
+ limit: Schema_exports.optional(Limit),
64769
+ /**
64770
+ * 这次调用算在哪件事上。六个 Capability 共用 —— 一次 `auto` 兜底会产生好几条
64771
+ * Run(每一跳一条,见 api.ts),带上它那几条才是一件事。
64772
+ *
64773
+ * Solution 的调用方(Dify 插件、n8n)不走 search,所以拿不到我们签发的 id;
64774
+ * 随便一个稳定的串就行,服务端不校验形状。
64775
+ */
64776
+ task_id: Schema_exports.optional(
64777
+ Schema_exports.String.annotate({
64778
+ description: "The task this call belongs to. Reuse one value across the calls you make for one piece of work; under provider auto each fallback hop is its own run, and this is what records them as one task. Any stable string is accepted."
64779
+ })
64780
+ )
64640
64781
  };
64641
64782
  var WEB_RESEARCH_ACTIONS = [
64642
64783
  "search",
@@ -65435,6 +65576,10 @@ var cursorFlag = Flag_exports.string("cursor").pipe(
65435
65576
  Flag_exports.optional,
65436
65577
  Flag_exports.withDescription("Pagination cursor from a previous response")
65437
65578
  );
65579
+ var taskFlag = Flag_exports.string("task").pipe(
65580
+ Flag_exports.optional,
65581
+ Flag_exports.withDescription("Task id from a search response; groups these calls as one piece of work")
65582
+ );
65438
65583
  function literalsFlag(name, literals2, description) {
65439
65584
  return Flag_exports.string(name).pipe(
65440
65585
  Flag_exports.mapTryCatch(
@@ -65521,15 +65666,11 @@ var balanceRoot = Command_exports.make(
65521
65666
  var balance2 = balanceRoot.pipe(Command_exports.withSubcommands([history]));
65522
65667
 
65523
65668
  // ../../packages/lib/src/price-line.ts
65524
- function priceRuleParts(rule) {
65525
- if (rule.type === "flat") return { main: `$${rule.amount_usd}/call`, cap: null };
65526
- if (rule.type === "per_token") {
65527
- return { main: `$${rule.per_million_input_tokens_usd}/1M input tokens`, cap: rule.cap_usd };
65528
- }
65529
- return { main: `$${rule.per_result_usd}/result`, cap: rule.cap_usd };
65669
+ function priceDisplayParts(display) {
65670
+ return { main: `$${display.amount_usd}/${display.unit}`, cap: display.cap_usd ?? null };
65530
65671
  }
65531
- function priceRuleLine(rule) {
65532
- const parts2 = priceRuleParts(rule);
65672
+ function priceDisplayLine(display) {
65673
+ const parts2 = priceDisplayParts(display);
65533
65674
  return parts2.cap === null ? parts2.main : `${parts2.main} (cap $${parts2.cap})`;
65534
65675
  }
65535
65676
 
@@ -65547,9 +65688,14 @@ var search = Command_exports.make(
65547
65688
  Flag_exports.withDescription("Keyword query; same as the positional argument")
65548
65689
  ),
65549
65690
  limit: searchLimitFlag,
65550
- cursor: cursorFlag
65691
+ cursor: cursorFlag,
65692
+ task: taskFlag,
65693
+ userRequest: Flag_exports.string("user-request").pipe(
65694
+ Flag_exports.optional,
65695
+ Flag_exports.withDescription("One sentence on what the user is trying to achieve, in your own words")
65696
+ )
65551
65697
  },
65552
- ({ queryArg, query: queryFlag, limit, cursor }) => Effect_exports.gen(function* () {
65698
+ ({ queryArg, query: queryFlag, limit, cursor, task, userRequest }) => Effect_exports.gen(function* () {
65553
65699
  const json2 = yield* JsonMode;
65554
65700
  if (Option_exports.isSome(queryArg) && Option_exports.isSome(queryFlag)) {
65555
65701
  return yield* new UsageError({
@@ -65563,13 +65709,18 @@ var search = Command_exports.make(
65563
65709
  payload: {
65564
65710
  ...Option_exports.isSome(query) ? { query: query.value } : {},
65565
65711
  ...Option_exports.isSome(limit) ? { limit: limit.value } : {},
65566
- ...Option_exports.isSome(cursor) ? { cursor: cursor.value } : {}
65712
+ ...Option_exports.isSome(cursor) ? { cursor: cursor.value } : {},
65713
+ ...Option_exports.isSome(task) ? { task_id: task.value } : {},
65714
+ ...Option_exports.isSome(userRequest) ? { user_request: userRequest.value } : {}
65567
65715
  }
65568
65716
  })
65569
65717
  );
65570
65718
  if (json2) return yield* Console_exports.log(jsonPretty(response));
65571
65719
  if (response.data.length === 0) {
65572
- return yield* Console_exports.log("No endpoints match \u2014 try other words.");
65720
+ yield* Console_exports.log("No endpoints match \u2014 try other words.");
65721
+ yield* Console_exports.error(`
65722
+ Task: ${response.task_id}`);
65723
+ return yield* Console_exports.error(`Try again: ${retryLine(response.task_id)}`);
65573
65724
  }
65574
65725
  yield* Console_exports.log(
65575
65726
  table2(
@@ -65587,14 +65738,22 @@ var search = Command_exports.make(
65587
65738
  );
65588
65739
  yield* Console_exports.error(`
65589
65740
  Showing ${response.data.length} of ${response.total} matches.`);
65590
- yield* Console_exports.error("Inspect with: glasser inspect -p <provider> -e <endpoint>");
65741
+ yield* Console_exports.error(`Task: ${response.task_id}`);
65742
+ yield* Console_exports.error(
65743
+ `Inspect with: glasser inspect -p <provider> -e <endpoint> --task ${shellQuote(response.task_id)}`
65744
+ );
65591
65745
  if (response.next_cursor !== null) {
65592
- yield* Console_exports.error(`Next page: ${nextPageLine(query, response.next_cursor)}`);
65746
+ yield* Console_exports.error(
65747
+ `Next page: ${nextPageLine(query, response.next_cursor, response.task_id)}`
65748
+ );
65593
65749
  }
65594
65750
  })
65595
65751
  ).pipe(Command_exports.withDescription("Search runnable endpoints"));
65596
- function nextPageLine(query, cursor) {
65597
- const base2 = `glasser search --cursor ${cursor}`;
65752
+ function retryLine(taskId) {
65753
+ return `glasser search --task ${shellQuote(taskId)} -- "<other words>"`;
65754
+ }
65755
+ function nextPageLine(query, cursor, taskId) {
65756
+ const base2 = `glasser search --cursor ${cursor} --task ${shellQuote(taskId)}`;
65598
65757
  return Option_exports.isSome(query) ? `${base2} -- ${shellQuote(query.value)}` : base2;
65599
65758
  }
65600
65759
  var scoreLine = (score) => score === null ? "-" : score.toFixed(2);
@@ -65602,7 +65761,7 @@ function providerLine(endpoint2) {
65602
65761
  return endpoint2.provider_label === endpoint2.provider ? endpoint2.provider : `${endpoint2.provider} (${endpoint2.provider_label})`;
65603
65762
  }
65604
65763
  function priceLine(price) {
65605
- return priceRuleLine(price.rule);
65764
+ return priceDisplayLine(price.display);
65606
65765
  }
65607
65766
  function modeLine(endpoint2) {
65608
65767
  return endpoint2.run_mode === "sync" ? `sync ${endpoint2.timeout_ms}ms` : "async";
@@ -65611,8 +65770,13 @@ function modeLine(endpoint2) {
65611
65770
  // src/commands/inspect.ts
65612
65771
  var inspect2 = Command_exports.make(
65613
65772
  "inspect",
65614
- { provider: providerFlag, endpoint: endpointFlag, endpointVersion: endpointVersionFlag },
65615
- ({ provider, endpoint: endpoint2, endpointVersion }) => Effect_exports.gen(function* () {
65773
+ {
65774
+ provider: providerFlag,
65775
+ endpoint: endpointFlag,
65776
+ endpointVersion: endpointVersionFlag,
65777
+ task: taskFlag
65778
+ },
65779
+ ({ provider, endpoint: endpoint2, endpointVersion, task }) => Effect_exports.gen(function* () {
65616
65780
  const json2 = yield* JsonMode;
65617
65781
  const { client, call } = yield* api;
65618
65782
  const detail = yield* call(
@@ -65620,7 +65784,8 @@ var inspect2 = Command_exports.make(
65620
65784
  payload: {
65621
65785
  provider,
65622
65786
  endpoint: endpoint2,
65623
- ...Option_exports.isSome(endpointVersion) ? { endpoint_version: endpointVersion.value } : {}
65787
+ ...Option_exports.isSome(endpointVersion) ? { endpoint_version: endpointVersion.value } : {},
65788
+ ...Option_exports.isSome(task) ? { task_id: task.value } : {}
65624
65789
  }
65625
65790
  })
65626
65791
  );
@@ -65651,10 +65816,10 @@ ${jsonPretty(detail.output_schema)}`
65651
65816
  );
65652
65817
  yield* Console_exports.log(`
65653
65818
  Run it:
65654
- ${runItLine(detail)}`);
65819
+ ${runItLine(detail, task)}`);
65655
65820
  })
65656
65821
  ).pipe(Command_exports.withDescription("Inspect one endpoint: schemas, price, version"));
65657
- function runItLine(detail) {
65822
+ function runItLine(detail, task = Option_exports.none()) {
65658
65823
  return [
65659
65824
  "glasser run -p",
65660
65825
  shellQuote(detail.provider),
@@ -65663,7 +65828,8 @@ function runItLine(detail) {
65663
65828
  "-i",
65664
65829
  shellQuote(JSON.stringify(detail.sample_input)),
65665
65830
  "--endpoint-version",
65666
- String(detail.endpoint_version)
65831
+ String(detail.endpoint_version),
65832
+ ...Option_exports.isSome(task) ? ["--task", shellQuote(task.value)] : []
65667
65833
  ].join(" ");
65668
65834
  }
65669
65835
 
@@ -66086,6 +66252,13 @@ function renderRun(run7) {
66086
66252
  ["Provider", run7.provider],
66087
66253
  ["Endpoint", `${run7.endpoint} @ v${run7.endpoint_version}`],
66088
66254
  ["Charge", formatCharge(run7)],
66255
+ /*
66256
+ * 打的是 `run.task_id` —— **响应里的那个值**,不是命令行上传进去的那个。
66257
+ * 两者可能差一次归一化(去空白、截到上限),而 `runs list --task` 拿去筛的
66258
+ * 是落库的那一份;印请求里那一份会让人拿着一个筛不回来的串。
66259
+ * 没带 Task 就整行不出现,不印 "—":这一行是可选的,空破折号只是噪音。
66260
+ */
66261
+ ...run7.task_id === null ? [] : [["Task", run7.task_id]],
66089
66262
  ["Created", run7.created_at],
66090
66263
  ["Done", run7.completed_at ?? "\u2014"]
66091
66264
  ]);
@@ -66203,6 +66376,7 @@ var run6 = Command_exports.make(
66203
66376
  Flag_exports.optional,
66204
66377
  Flag_exports.withDescription("Reuse a key to retry safely; generated (and shown) when omitted")
66205
66378
  ),
66379
+ task: taskFlag,
66206
66380
  wait: waitFlag,
66207
66381
  waitTimeout: waitTimeoutFlag,
66208
66382
  output: outputFileFlag
@@ -66247,7 +66421,8 @@ var run6 = Command_exports.make(
66247
66421
  provider: flags.provider,
66248
66422
  endpoint: flags.endpoint,
66249
66423
  ...input === void 0 ? {} : { input },
66250
- ...Option_exports.isSome(flags.endpointVersion) ? { endpoint_version: flags.endpointVersion.value } : {}
66424
+ ...Option_exports.isSome(flags.endpointVersion) ? { endpoint_version: flags.endpointVersion.value } : {},
66425
+ ...Option_exports.isSome(flags.task) ? { task_id: flags.task.value } : {}
66251
66426
  },
66252
66427
  headers: { "idempotency-key": idempotencyKey }
66253
66428
  })
@@ -66315,7 +66490,8 @@ var runsList = Command_exports.make(
66315
66490
  Flag_exports.withAlias("e"),
66316
66491
  Flag_exports.optional,
66317
66492
  Flag_exports.withDescription("Filter by endpoint")
66318
- )
66493
+ ),
66494
+ task: taskFlag
66319
66495
  },
66320
66496
  (flags) => Effect_exports.gen(function* () {
66321
66497
  const json2 = yield* JsonMode;
@@ -66327,7 +66503,8 @@ var runsList = Command_exports.make(
66327
66503
  ...Option_exports.isSome(flags.cursor) ? { cursor: flags.cursor.value } : {},
66328
66504
  ...Option_exports.isSome(flags.status) ? { status: flags.status.value } : {},
66329
66505
  ...Option_exports.isSome(flags.provider) ? { provider: flags.provider.value } : {},
66330
- ...Option_exports.isSome(flags.endpoint) ? { endpoint: flags.endpoint.value } : {}
66506
+ ...Option_exports.isSome(flags.endpoint) ? { endpoint: flags.endpoint.value } : {},
66507
+ ...Option_exports.isSome(flags.task) ? { task: flags.task.value } : {}
66331
66508
  }
66332
66509
  })
66333
66510
  );
@@ -66388,7 +66565,7 @@ var runs2 = Command_exports.make("runs").pipe(
66388
66565
  // package.json
66389
66566
  var package_default = {
66390
66567
  name: "@glasser-ai/cli",
66391
- version: "0.1.46",
66568
+ version: "0.1.48",
66392
66569
  description: "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
66393
66570
  license: "MIT",
66394
66571
  type: "module",
@@ -66619,6 +66796,14 @@ function describeApiCause(cause, requestId) {
66619
66796
  };
66620
66797
  }
66621
66798
  function hintFor(envelope) {
66799
+ if (envelope.control === CLIENT_VERSION_UNSUPPORTED) {
66800
+ const upgrade = envelope.details?.upgrade_command;
66801
+ if (typeof upgrade === "string") {
66802
+ return {
66803
+ hint: `Run \`${upgrade}\`, then retry the same command. Until then this CLI cannot read part of the catalog, and search and inspect are refused rather than answered with a shortened list.`
66804
+ };
66805
+ }
66806
+ }
66622
66807
  if (envelope.code === "endpoint_version_mismatch") {
66623
66808
  const current = envelope.details?.current_version;
66624
66809
  if (typeof current === "number") {
@@ -66649,7 +66834,7 @@ function asEnvelope(cause) {
66649
66834
  // src/update-check.ts
66650
66835
  import { mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
66651
66836
  import path7 from "node:path";
66652
- var UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
66837
+ var UPDATE_CHECK_INTERVAL_MS = 3 * 60 * 60 * 1e3;
66653
66838
  var REGISTRY_LATEST_URL = "https://registry.npmjs.org/@glasser-ai/cli/latest";
66654
66839
  var FETCH_TIMEOUT_MS = 2e3;
66655
66840
  function updateCheckPath(dir2) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@glasser-ai/cli",
3
- "version": "0.1.46",
4
- "description": "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
3
+ "version": "0.1.48",
4
+ "description": "Search, inspect and run paid API endpoints with one Key — the Glasser CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "bin": {