@glasser-ai/cli 0.1.57 → 0.1.58
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/README.md +2 -2
- package/dist/glasser.js +42 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Re-run either command to upgrade. Then: `glasser login`.
|
|
|
16
16
|
## Commands
|
|
17
17
|
|
|
18
18
|
```
|
|
19
|
-
glasser search ["<query>"] [--limit N] [--cursor C] # no query lists the catalog
|
|
19
|
+
glasser search ["<query>"] --use-case "<ask>" [--limit N] [--cursor C] # no query lists the catalog; --use-case is always required
|
|
20
20
|
# -q/--query takes the same value; --query=<q> for a leading dash
|
|
21
21
|
glasser inspect -p <provider> -e <endpoint> [--endpoint-version N]
|
|
22
22
|
glasser run -p <provider> -e <endpoint> [-i '<json>'|@file | -f <path>]
|
|
@@ -100,7 +100,7 @@ requires `--force` so a prompt can never corrupt machine output.
|
|
|
100
100
|
## Development
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
|
-
pnpm --filter @glasser-ai/cli dev -- search -q "web search" # tsx, no build
|
|
103
|
+
pnpm --filter @glasser-ai/cli dev -- search -q "web search" --use-case "find a web search API" # tsx, no build
|
|
104
104
|
pnpm --filter @glasser-ai/cli build # esbuild → dist/glasser.js
|
|
105
105
|
node apps/cli/dist/glasser.js --help
|
|
106
106
|
cd apps/cli && pnpm link --global # a PATH `glasser` shim
|
package/dist/glasser.js
CHANGED
|
@@ -64565,22 +64565,24 @@ var SearchEndpointsRequest = Schema_exports.Struct({
|
|
|
64565
64565
|
* 眼里就是无用收集。它**不**参与这一次的排序;用途见 ADR-0024 —— use case 与最后
|
|
64566
64566
|
* 跑了哪支 Endpoint 配成一对,就是一条带标注的相关性样本。
|
|
64567
64567
|
*
|
|
64568
|
-
* 旧名 `user_request`
|
|
64568
|
+
* 旧名 `user_request` 仍然收但不再读,见下面那个字段。
|
|
64569
64569
|
*
|
|
64570
|
-
*
|
|
64571
|
-
*
|
|
64570
|
+
* **必填,每一次 search 都要**,翻页、换词重搜、不带 query 的浏览都不例外
|
|
64571
|
+
* (2026-09-28 起,Keith:初期先必填)。此前它是可选的,理由是必填会让还没升级的
|
|
64572
|
+
* 调用方直接失败,也会逼一个不理解这个字段的模型去编。这两条代价现在都接受:
|
|
64573
|
+
* 眼下要的是每一件事都带着用户的诉求,而可选的时候大量 Task 是空的。
|
|
64574
|
+
*
|
|
64575
|
+
* 不能是空白串:`normalizeUseCase` 会把它归一成 null,等于没填。
|
|
64572
64576
|
*/
|
|
64573
|
-
use_case: Schema_exports.
|
|
64574
|
-
|
|
64575
|
-
|
|
64576
|
-
})
|
|
64577
|
-
),
|
|
64577
|
+
use_case: Schema_exports.String.check(Schema_exports.isPattern(/\S/)).annotate({
|
|
64578
|
+
description: "Required on every search. The use case behind this search: what the user asked for, in their own words, with the subject in it \u2014 the company, domain, ticker, place or topic. Shorten a long request rather than rewriting it."
|
|
64579
|
+
}),
|
|
64578
64580
|
/**
|
|
64579
|
-
* `use_case` 的旧名(2026-09-24 之前)
|
|
64581
|
+
* `use_case` 的旧名(2026-09-24 之前)。
|
|
64580
64582
|
*
|
|
64581
|
-
* 0.1.54 及更早的
|
|
64582
|
-
*
|
|
64583
|
-
*
|
|
64583
|
+
* 2026-09-28 `use_case` 改为必填之后,这个字段**收而不读**:只带它的请求(0.1.54 及更早的
|
|
64584
|
+
* CLI)在解码时就因缺 `use_case` 被拒,两个都带时读的是 `use_case`。留着只是为了带着它的
|
|
64585
|
+
* 新请求不报错;随 `tasks.user_request` 列一起删。
|
|
64584
64586
|
*/
|
|
64585
64587
|
user_request: Schema_exports.optional(
|
|
64586
64588
|
Schema_exports.String.annotate({
|
|
@@ -65728,9 +65730,15 @@ var search = Command_exports.make(
|
|
|
65728
65730
|
limit: searchLimitFlag,
|
|
65729
65731
|
cursor: cursorFlag,
|
|
65730
65732
|
task: taskFlag,
|
|
65733
|
+
/*
|
|
65734
|
+
* 必填(契约 2026-09-28 起),但解析器里仍是 optional:隐藏的旧名 `--user-request`
|
|
65735
|
+
* 也能满足它,两个都没有才是用法错误 —— 在本地报,不白跑一趟服务端的 400。
|
|
65736
|
+
*/
|
|
65731
65737
|
useCase: Flag_exports.string("use-case").pipe(
|
|
65732
65738
|
Flag_exports.optional,
|
|
65733
|
-
Flag_exports.withDescription(
|
|
65739
|
+
Flag_exports.withDescription(
|
|
65740
|
+
"Required. What the user asked for, in their own words, with the subject in it"
|
|
65741
|
+
)
|
|
65734
65742
|
),
|
|
65735
65743
|
/*
|
|
65736
65744
|
* `--user-request` 是 2026-09-24 之前的名字(契约字段改名为 `use_case`),**照收不公示**:
|
|
@@ -65751,7 +65759,15 @@ var search = Command_exports.make(
|
|
|
65751
65759
|
});
|
|
65752
65760
|
}
|
|
65753
65761
|
const query = Option_exports.isSome(queryArg) ? queryArg : queryFlag;
|
|
65754
|
-
const
|
|
65762
|
+
const given = Option_exports.orElse(useCaseFlag, () => legacyUseCase).pipe(
|
|
65763
|
+
Option_exports.filter((value3) => value3.trim() !== "")
|
|
65764
|
+
);
|
|
65765
|
+
if (Option_exports.isNone(given)) {
|
|
65766
|
+
return yield* new UsageError({
|
|
65767
|
+
message: 'Every search needs --use-case: what the user asked for, in their own words, with the subject in it. For example: `glasser search "<query>" --use-case "<what the user asked for>"`.'
|
|
65768
|
+
});
|
|
65769
|
+
}
|
|
65770
|
+
const useCase = given.value;
|
|
65755
65771
|
const { client, call } = yield* api;
|
|
65756
65772
|
const response = yield* call(
|
|
65757
65773
|
client.Endpoints["endpoints-search"]({
|
|
@@ -65760,7 +65776,7 @@ var search = Command_exports.make(
|
|
|
65760
65776
|
...Option_exports.isSome(limit) ? { limit: limit.value } : {},
|
|
65761
65777
|
...Option_exports.isSome(cursor) ? { cursor: cursor.value } : {},
|
|
65762
65778
|
...Option_exports.isSome(task) ? { task_id: task.value } : {},
|
|
65763
|
-
|
|
65779
|
+
use_case: useCase
|
|
65764
65780
|
}
|
|
65765
65781
|
})
|
|
65766
65782
|
);
|
|
@@ -65769,7 +65785,7 @@ var search = Command_exports.make(
|
|
|
65769
65785
|
yield* Console_exports.log("No endpoints match \u2014 try other words.");
|
|
65770
65786
|
yield* Console_exports.error(`
|
|
65771
65787
|
Task: ${response.task_id}`);
|
|
65772
|
-
return yield* Console_exports.error(`Try again: ${retryLine(response.task_id)}`);
|
|
65788
|
+
return yield* Console_exports.error(`Try again: ${retryLine(response.task_id, useCase)}`);
|
|
65773
65789
|
}
|
|
65774
65790
|
yield* Console_exports.log(
|
|
65775
65791
|
table2(
|
|
@@ -65793,17 +65809,17 @@ Showing ${response.data.length} of ${response.total} matches.`);
|
|
|
65793
65809
|
);
|
|
65794
65810
|
if (response.next_cursor !== null) {
|
|
65795
65811
|
yield* Console_exports.error(
|
|
65796
|
-
`Next page: ${nextPageLine(query, response.next_cursor, response.task_id)}`
|
|
65812
|
+
`Next page: ${nextPageLine(query, response.next_cursor, response.task_id, useCase)}`
|
|
65797
65813
|
);
|
|
65798
65814
|
}
|
|
65799
|
-
yield* Console_exports.error(`Search again: ${retryLine(response.task_id)}`);
|
|
65815
|
+
yield* Console_exports.error(`Search again: ${retryLine(response.task_id, useCase)}`);
|
|
65800
65816
|
})
|
|
65801
65817
|
).pipe(Command_exports.withDescription("Search runnable endpoints"));
|
|
65802
|
-
function retryLine(taskId) {
|
|
65803
|
-
return `glasser search --task ${shellQuote(taskId)} -- "<other words>"`;
|
|
65818
|
+
function retryLine(taskId, useCase) {
|
|
65819
|
+
return `glasser search --task ${shellQuote(taskId)} --use-case ${shellQuote(useCase)} -- "<other words>"`;
|
|
65804
65820
|
}
|
|
65805
|
-
function nextPageLine(query, cursor, taskId) {
|
|
65806
|
-
const base2 = `glasser search --cursor ${cursor} --task ${shellQuote(taskId)}`;
|
|
65821
|
+
function nextPageLine(query, cursor, taskId, useCase) {
|
|
65822
|
+
const base2 = `glasser search --cursor ${cursor} --task ${shellQuote(taskId)} --use-case ${shellQuote(useCase)}`;
|
|
65807
65823
|
return Option_exports.isSome(query) ? `${base2} -- ${shellQuote(query.value)}` : base2;
|
|
65808
65824
|
}
|
|
65809
65825
|
var scoreLine = (score) => score === null ? "-" : score.toFixed(2);
|
|
@@ -66234,7 +66250,9 @@ ${kvBlock([
|
|
|
66234
66250
|
)
|
|
66235
66251
|
)
|
|
66236
66252
|
);
|
|
66237
|
-
yield* Console_exports.error(
|
|
66253
|
+
yield* Console_exports.error(
|
|
66254
|
+
'\nNext: glasser search -q "<what you need>" --use-case "<what the user asked for>"'
|
|
66255
|
+
);
|
|
66238
66256
|
})
|
|
66239
66257
|
).pipe(Command_exports.withDescription("Log in through the browser and store a Key"));
|
|
66240
66258
|
|
|
@@ -66615,7 +66633,7 @@ var runs2 = Command_exports.make("runs").pipe(
|
|
|
66615
66633
|
// package.json
|
|
66616
66634
|
var package_default = {
|
|
66617
66635
|
name: "@glasser-ai/cli",
|
|
66618
|
-
version: "0.1.
|
|
66636
|
+
version: "0.1.58",
|
|
66619
66637
|
description: "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
|
|
66620
66638
|
license: "MIT",
|
|
66621
66639
|
type: "module",
|