@glasser-ai/cli 0.1.61 → 0.1.63

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 +68 -9
  2. package/package.json +1 -1
package/dist/glasser.js CHANGED
@@ -61571,6 +61571,36 @@ function Paginated(item) {
61571
61571
  next_cursor: Schema_exports.NullOr(Schema_exports.String)
61572
61572
  });
61573
61573
  }
61574
+ var METADATA_MAX_KEYS = 20;
61575
+ var METADATA_KEY_PATTERN = /^[a-z][a-z0-9_]{0,39}$/;
61576
+ var METADATA_VALUE_MAX_LENGTH = 500;
61577
+ var LONE_SURROGATE = new RegExp("\\p{Cs}", "u");
61578
+ var valueLengthOk = (value3) => {
61579
+ const length = [...value3].length;
61580
+ return length >= 1 && length <= METADATA_VALUE_MAX_LENGTH;
61581
+ };
61582
+ var valueCharactersOk = (value3) => !value3.includes("\0") && !LONE_SURROGATE.test(value3);
61583
+ var isMetadataValue = Schema_exports.makeFilter(
61584
+ (value3) => valueLengthOk(value3) && valueCharactersOk(value3),
61585
+ {
61586
+ expected: `a string of 1\u2013${METADATA_VALUE_MAX_LENGTH} characters, without NUL or unpaired surrogates`,
61587
+ toJsonSchema: () => ({ minLength: 1, maxLength: METADATA_VALUE_MAX_LENGTH })
61588
+ }
61589
+ );
61590
+ var MetadataShape = Schema_exports.Record(Schema_exports.String, Schema_exports.String.check(isMetadataValue)).check(
61591
+ Schema_exports.isMaxProperties(METADATA_MAX_KEYS),
61592
+ Schema_exports.isPropertyNames(Schema_exports.String.check(Schema_exports.isPattern(METADATA_KEY_PATTERN)))
61593
+ );
61594
+ var Metadata = MetadataShape.annotate({
61595
+ description: `Your own key-value strings for this call, for your records: up to ${METADATA_MAX_KEYS} keys (lowercase letters, digits and underscores, starting with a letter, at most 40 characters), string values of 1\u2013${METADATA_VALUE_MAX_LENGTH} characters. Glasser stores it, returns it on the Run and lets you filter runs by it; it never goes to a provider and never affects routing, price or idempotency. Put the id of your own end user in user_id. Use an opaque id, never an email address or a name.`
61596
+ });
61597
+ var MetadataInput = Schema_exports.Union([MetadataShape, Schema_exports.Unknown]).annotate({
61598
+ description: `Your own key-value strings for this call, for your records: up to ${METADATA_MAX_KEYS} keys (lowercase letters, digits and underscores, starting with a letter, at most 40 characters), string values of 1\u2013${METADATA_VALUE_MAX_LENGTH} characters. An entry that breaks these rules is dropped whole, never truncated, and the call goes ahead; the run returns the metadata that was stored. Glasser returns it on the Run and lets you filter runs by it; it never goes to a provider and never affects routing, price or idempotency. Put the id of your own end user in user_id. Use an opaque id, never an email address or a name.`
61599
+ });
61600
+ var MetadataQuery = Schema_exports.String.annotate({
61601
+ contentMediaType: "application/json",
61602
+ description: 'Return only runs whose metadata contains every key-value pair of this JSON object, for example {"user_id":"user_123"}. Exact match.'
61603
+ }).pipe(Schema_exports.decodeTo(Schema_exports.fromJsonString(Metadata)));
61574
61604
  var Timestamp = Schema_exports.String.annotate({
61575
61605
  format: "date-time",
61576
61606
  description: "ISO-8601 UTC timestamp"
@@ -64400,7 +64430,9 @@ var PriceRule = Schema_exports.Union([
64400
64430
  base_usd: UsdAmount,
64401
64431
  included_results: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0)),
64402
64432
  per_extra_result_usd: UsdAmount,
64403
- cap_usd: UsdAmount
64433
+ cap_usd: UsdAmount,
64434
+ /** 计费单位的单数名词(`row`、`page`、`credit`…);缺省即 `result`。人读的那一行已在 `display` 里。 */
64435
+ unit: Schema_exports.optionalKey(Schema_exports.String)
64404
64436
  }),
64405
64437
  /**
64406
64438
  * **兜底成员**:只要求 `type` 是字符串。
@@ -64561,6 +64593,8 @@ var SearchEndpointsRequest = Schema_exports.Struct({
64561
64593
  /** 上一页响应的 next_cursor。绑定于 query:拿别的查询的游标来翻是 400,不是从头开始。 */
64562
64594
  cursor: Schema_exports.optional(Schema_exports.String),
64563
64595
  task_id: SearchTaskIdField,
64596
+ /** 调用方自己的键值(ADR-0028)。不参与检索,只落进 catalog_searches.metadata。 */
64597
+ metadata: Schema_exports.optional(MetadataInput),
64564
64598
  /**
64565
64599
  * 这件事的 use case:用户自己的诉求。**只在这里收** —— 它属于这件事,不属于其中
64566
64600
  * 某一次调用,而 search 是这件事的第一次调用,也是 agent 手里那句话最新鲜的时候。
@@ -64647,7 +64681,9 @@ var InspectEndpointRequest = Schema_exports.Struct({
64647
64681
  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."
64648
64682
  })
64649
64683
  ),
64650
- task_id: InspectTaskIdField
64684
+ task_id: InspectTaskIdField,
64685
+ /** 调用方自己的键值(ADR-0028),落进 endpoint_inspections.metadata。 */
64686
+ metadata: Schema_exports.optional(MetadataInput)
64651
64687
  });
64652
64688
 
64653
64689
  // ../../packages/contract/src/rate-limit.ts
@@ -64726,7 +64762,12 @@ var Run = Schema_exports.Struct({
64726
64762
  * 而 `GET /v1/runs?task=` 拿去筛的也是归一化后的值。打印请求里那份会让人
64727
64763
  * 拿着一个筛不回来的串。
64728
64764
  */
64729
- task_id: Schema_exports.NullOr(Schema_exports.String)
64765
+ task_id: Schema_exports.NullOr(Schema_exports.String),
64766
+ /**
64767
+ * 调用方附在受理请求上的键值(ADR-0028),没带就是 `{}`。重放回的是**首次受理**
64768
+ * 时那一份:metadata 不在幂等哈希里,重试头上换一份不会改写它。
64769
+ */
64770
+ metadata: Metadata
64730
64771
  });
64731
64772
  var RunRequest = Schema_exports.Struct({
64732
64773
  provider: ProviderSlug,
@@ -64751,7 +64792,13 @@ var RunRequest = Schema_exports.Struct({
64751
64792
  Schema_exports.String.annotate({
64752
64793
  description: "The task this run belongs to, from a catalog search response. Grouping only: it never affects routing, price or idempotency."
64753
64794
  })
64754
- )
64795
+ ),
64796
+ /**
64797
+ * 调用方自己的键值(ADR-0028)。与 task_id 同理**不进 `canonicalHash`**(那个哈希
64798
+ * 按名字读四个键),也不进 `input`:它从不发给 Provider。解码不失败,由 runs 的
64799
+ * service 用 `sanitizeMetadata` 按条目清洗。
64800
+ */
64801
+ metadata: Schema_exports.optional(MetadataInput)
64755
64802
  });
64756
64803
  var ListRunsQuery = Schema_exports.Struct({
64757
64804
  ...PaginationQuery.fields,
@@ -64763,7 +64810,12 @@ var ListRunsQuery = Schema_exports.Struct({
64763
64810
  Schema_exports.String.annotate({
64764
64811
  description: "Return only runs recorded against this task. Exact match."
64765
64812
  })
64766
- )
64813
+ ),
64814
+ /**
64815
+ * JSON 编码的对象,包含匹配(`metadata @> …`)。它是在 Workspace 与 effective policy
64816
+ * 之上**多加的一个谓词**,从来不是授权边界。MCP 的 `runs_list` 不公示它(ADR-0028)。
64817
+ */
64818
+ metadata: Schema_exports.optional(MetadataQuery)
64767
64819
  });
64768
64820
  var ListRunsResponse = Schema_exports.Struct({
64769
64821
  ...Paginated(Run).fields,
@@ -64824,7 +64876,12 @@ var commonFields = {
64824
64876
  Schema_exports.String.annotate({
64825
64877
  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."
64826
64878
  })
64827
- )
64879
+ ),
64880
+ /**
64881
+ * 调用方自己的键值(ADR-0028)。`auto` 兜底的每一跳都带同一份,在
64882
+ * `solutionRunOperation` 的 runChain 里逐跳带上,与 task_id 同一处。
64883
+ */
64884
+ metadata: Schema_exports.optional(MetadataInput)
64828
64885
  };
64829
64886
  var WEB_RESEARCH_ACTIONS = [
64830
64887
  "search",
@@ -65018,8 +65075,10 @@ var SocialResearchRequest = Schema_exports.Struct({
65018
65075
  description: "A username without @, or a subreddit name without r/."
65019
65076
  })
65020
65077
  ),
65021
- url: Schema_exports.optional(NonEmpty.check(Schema_exports.isMaxLength(2048)))
65078
+ url: Schema_exports.optional(NonEmpty.check(Schema_exports.isMaxLength(2048))),
65022
65079
  // 没有 limit:社交端点按游标翻页,没有一个收行数;收下又不读是撒谎。
65080
+ // 不用 commonFields(没有 limit),metadata 单独加;它也没有 task_id,那是另一个缺口。
65081
+ metadata: commonFields.metadata
65023
65082
  });
65024
65083
  var MARKET_DATA_ACTIONS = [
65025
65084
  "property_value",
@@ -65120,7 +65179,7 @@ var runs = HttpApiGroup_exports.make("Runs").add(
65120
65179
  operation(
65121
65180
  "runs-list",
65122
65181
  "List runs",
65123
- "Lists runs in reverse order of creation time, with optional filters on status, provider, and endpoint. This endpoint uses cursor pagination. The list is scoped by the effective policy: runs of an endpoint this key cannot run are not readable either."
65182
+ "Lists runs in reverse order of creation time, with optional filters on status, provider, endpoint, task and metadata. This endpoint uses cursor pagination. The list is scoped by the effective policy: runs of an endpoint this key cannot run are not readable either."
65124
65183
  )
65125
65184
  )
65126
65185
  ).add(
@@ -66647,7 +66706,7 @@ var runs2 = Command_exports.make("runs").pipe(
66647
66706
  // package.json
66648
66707
  var package_default = {
66649
66708
  name: "@glasser-ai/cli",
66650
- version: "0.1.61",
66709
+ version: "0.1.63",
66651
66710
  description: "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
66652
66711
  license: "MIT",
66653
66712
  type: "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasser-ai/cli",
3
- "version": "0.1.61",
3
+ "version": "0.1.63",
4
4
  "description": "Search, inspect and run paid API endpoints with one Key — the Glasser CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",