@glasser-ai/cli 0.1.18 → 0.1.20
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/dist/glasser.js +94 -80
- package/package.json +1 -1
package/dist/glasser.js
CHANGED
|
@@ -64493,7 +64493,7 @@ var endpoints = HttpApiGroup_exports.make("Endpoints").add(
|
|
|
64493
64493
|
operation(
|
|
64494
64494
|
"endpoints-search",
|
|
64495
64495
|
"Search runnable endpoints",
|
|
64496
|
-
"Searches the
|
|
64496
|
+
"Searches the data sources by keyword and returns ranked endpoint summaries, each identified by provider, endpoint, and endpoint_version, with its price and run mode. Several providers may sell the same capability; the ranking is relevance-only and the price is shown alongside so the caller chooses. Pages are short by default (5, up to 20): pass next_cursor back as cursor for the next page; the cursor is bound to the query. The list is already scoped to the calling key's effective policy: every endpoint in it is one this key can run. An empty list is a valid answer \u2014 when no data source matches, the endpoint says so instead of returning the nearest wrong operation."
|
|
64497
64497
|
)
|
|
64498
64498
|
)
|
|
64499
64499
|
).add(
|
|
@@ -64824,78 +64824,7 @@ function sleepMs(ms) {
|
|
|
64824
64824
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
64825
64825
|
}
|
|
64826
64826
|
|
|
64827
|
-
// package.json
|
|
64828
|
-
var package_default = {
|
|
64829
|
-
name: "@glasser-ai/cli",
|
|
64830
|
-
version: "0.1.18",
|
|
64831
|
-
description: "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
|
|
64832
|
-
license: "MIT",
|
|
64833
|
-
type: "module",
|
|
64834
|
-
bin: {
|
|
64835
|
-
glasser: "./dist/glasser.js"
|
|
64836
|
-
},
|
|
64837
|
-
files: [
|
|
64838
|
-
"dist",
|
|
64839
|
-
"!dist/metafile.json",
|
|
64840
|
-
"README.md",
|
|
64841
|
-
"LICENSE",
|
|
64842
|
-
"THIRD_PARTY_NOTICES"
|
|
64843
|
-
],
|
|
64844
|
-
repository: {
|
|
64845
|
-
type: "git",
|
|
64846
|
-
url: "git+https://github.com/Surething-io/glasser.git",
|
|
64847
|
-
directory: "apps/cli"
|
|
64848
|
-
},
|
|
64849
|
-
homepage: "https://glasser.ai/docs/cli",
|
|
64850
|
-
keywords: [
|
|
64851
|
-
"glasser",
|
|
64852
|
-
"cli",
|
|
64853
|
-
"api",
|
|
64854
|
-
"endpoints",
|
|
64855
|
-
"agents"
|
|
64856
|
-
],
|
|
64857
|
-
publishConfig: {
|
|
64858
|
-
access: "public",
|
|
64859
|
-
provenance: false
|
|
64860
|
-
},
|
|
64861
|
-
scripts: {
|
|
64862
|
-
dev: "tsx src/main.ts",
|
|
64863
|
-
build: "node build.mjs",
|
|
64864
|
-
prepack: "node build.mjs && node ../../scripts/generate-third-party-notices.mjs",
|
|
64865
|
-
lint: "biome lint .",
|
|
64866
|
-
"lint:fix": "biome lint --write .",
|
|
64867
|
-
format: "biome format --write .",
|
|
64868
|
-
"format:check": "biome format .",
|
|
64869
|
-
check: "biome check --write .",
|
|
64870
|
-
"check-types": "tsc --noEmit",
|
|
64871
|
-
test: "vitest run",
|
|
64872
|
-
"test:watch": "vitest",
|
|
64873
|
-
"test:p0": "vitest run .p0. --passWithNoTests",
|
|
64874
|
-
"test:p1": "vitest run .p1. --passWithNoTests",
|
|
64875
|
-
"test:integration": "vitest run --config vitest.integration.config.ts"
|
|
64876
|
-
},
|
|
64877
|
-
devDependencies: {
|
|
64878
|
-
"@effect/platform-node": "4.0.0-rc.112",
|
|
64879
|
-
"@repo/contract": "workspace:*",
|
|
64880
|
-
"@repo/lib": "workspace:*",
|
|
64881
|
-
"@repo/typescript-config": "workspace:*",
|
|
64882
|
-
"@types/node": "^22.15.3",
|
|
64883
|
-
effect: "4.0.0-rc.112",
|
|
64884
|
-
esbuild: "^0.26.0",
|
|
64885
|
-
tsx: "^4.21.0",
|
|
64886
|
-
typescript: "catalog:",
|
|
64887
|
-
vitest: "^4.1.5"
|
|
64888
|
-
},
|
|
64889
|
-
engines: {
|
|
64890
|
-
node: ">=22"
|
|
64891
|
-
}
|
|
64892
|
-
};
|
|
64893
|
-
|
|
64894
|
-
// src/version.ts
|
|
64895
|
-
var CLI_VERSION = package_default.version;
|
|
64896
|
-
|
|
64897
64827
|
// src/client.ts
|
|
64898
|
-
var USER_AGENT = `@glasser-ai/cli/${CLI_VERSION}`;
|
|
64899
64828
|
var NO_KEY_MESSAGE = "No Key configured. Run `glasser keys add --label <label> --key <key>` or set GLASSER_API_KEY.";
|
|
64900
64829
|
var ApiFailure = class extends Data_exports.TaggedError("ApiFailure") {
|
|
64901
64830
|
};
|
|
@@ -64917,10 +64846,8 @@ var buildApiWith = (key) => Effect_exports.gen(function* () {
|
|
|
64917
64846
|
baseUrl: baseUrl2,
|
|
64918
64847
|
transformClient: (http2) => http2.pipe(
|
|
64919
64848
|
HttpClient_exports.mapRequest(HttpClientRequest_exports.bearerToken(key)),
|
|
64920
|
-
//
|
|
64921
|
-
//
|
|
64922
|
-
// 三者打的是同一批端点。它不携带任何机器或用户信息。
|
|
64923
|
-
HttpClient_exports.mapRequest(HttpClientRequest_exports.setHeader("user-agent", USER_AGENT)),
|
|
64849
|
+
// User-Agent 不在这里加:身份属于**传输层**(http.ts),这样登录流那样
|
|
64850
|
+
// 用不了本客户端的路径也一样报得上名。
|
|
64924
64851
|
HttpClient_exports.transform(
|
|
64925
64852
|
(effect2) => Effect_exports.suspend(() => {
|
|
64926
64853
|
box.current = null;
|
|
@@ -65115,6 +65042,16 @@ var balanceRoot = Command_exports.make(
|
|
|
65115
65042
|
).pipe(Command_exports.withDescription("Balance, held and available"));
|
|
65116
65043
|
var balance2 = balanceRoot.pipe(Command_exports.withSubcommands([history]));
|
|
65117
65044
|
|
|
65045
|
+
// ../../packages/lib/src/price-line.ts
|
|
65046
|
+
function priceRuleParts(rule) {
|
|
65047
|
+
if (rule.type === "flat") return { main: `$${rule.amount_usd}/call`, cap: null };
|
|
65048
|
+
return { main: `$${rule.per_result_usd}/result`, cap: rule.cap_usd };
|
|
65049
|
+
}
|
|
65050
|
+
function priceRuleLine(rule) {
|
|
65051
|
+
const parts2 = priceRuleParts(rule);
|
|
65052
|
+
return parts2.cap === null ? parts2.main : `${parts2.main} (cap $${parts2.cap})`;
|
|
65053
|
+
}
|
|
65054
|
+
|
|
65118
65055
|
// src/commands/search.ts
|
|
65119
65056
|
var search = Command_exports.make(
|
|
65120
65057
|
"search",
|
|
@@ -65122,7 +65059,7 @@ var search = Command_exports.make(
|
|
|
65122
65059
|
query: Flag_exports.string("query").pipe(
|
|
65123
65060
|
Flag_exports.withAlias("q"),
|
|
65124
65061
|
Flag_exports.optional,
|
|
65125
|
-
Flag_exports.withDescription("Keyword query; omit to list the
|
|
65062
|
+
Flag_exports.withDescription("Keyword query; omit to list the data sources")
|
|
65126
65063
|
),
|
|
65127
65064
|
limit: searchLimitFlag,
|
|
65128
65065
|
cursor: cursorFlag
|
|
@@ -65169,8 +65106,7 @@ function providerLine(endpoint2) {
|
|
|
65169
65106
|
return endpoint2.provider_label === endpoint2.provider ? endpoint2.provider : `${endpoint2.provider} (${endpoint2.provider_label})`;
|
|
65170
65107
|
}
|
|
65171
65108
|
function priceLine(price) {
|
|
65172
|
-
|
|
65173
|
-
return `$${price.rule.per_result_usd}/result (cap $${price.rule.cap_usd})`;
|
|
65109
|
+
return priceRuleLine(price.rule);
|
|
65174
65110
|
}
|
|
65175
65111
|
function modeLine(endpoint2) {
|
|
65176
65112
|
return endpoint2.run_mode === "sync" ? `sync ${endpoint2.timeout_ms}ms` : "async";
|
|
@@ -65956,6 +65892,83 @@ var runs2 = Command_exports.make("runs").pipe(
|
|
|
65956
65892
|
Command_exports.withSubcommands([runsList, runsGet, runsStop])
|
|
65957
65893
|
);
|
|
65958
65894
|
|
|
65895
|
+
// package.json
|
|
65896
|
+
var package_default = {
|
|
65897
|
+
name: "@glasser-ai/cli",
|
|
65898
|
+
version: "0.1.20",
|
|
65899
|
+
description: "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
|
|
65900
|
+
license: "MIT",
|
|
65901
|
+
type: "module",
|
|
65902
|
+
bin: {
|
|
65903
|
+
glasser: "./dist/glasser.js"
|
|
65904
|
+
},
|
|
65905
|
+
files: [
|
|
65906
|
+
"dist",
|
|
65907
|
+
"!dist/metafile.json",
|
|
65908
|
+
"README.md",
|
|
65909
|
+
"LICENSE",
|
|
65910
|
+
"THIRD_PARTY_NOTICES"
|
|
65911
|
+
],
|
|
65912
|
+
repository: {
|
|
65913
|
+
type: "git",
|
|
65914
|
+
url: "git+https://github.com/Surething-io/glasser.git",
|
|
65915
|
+
directory: "apps/cli"
|
|
65916
|
+
},
|
|
65917
|
+
homepage: "https://glasser.ai/docs/cli",
|
|
65918
|
+
keywords: [
|
|
65919
|
+
"glasser",
|
|
65920
|
+
"cli",
|
|
65921
|
+
"api",
|
|
65922
|
+
"endpoints",
|
|
65923
|
+
"agents"
|
|
65924
|
+
],
|
|
65925
|
+
publishConfig: {
|
|
65926
|
+
access: "public",
|
|
65927
|
+
provenance: false
|
|
65928
|
+
},
|
|
65929
|
+
scripts: {
|
|
65930
|
+
dev: "tsx src/main.ts",
|
|
65931
|
+
build: "node build.mjs",
|
|
65932
|
+
prepack: "node build.mjs && node ../../scripts/generate-third-party-notices.mjs",
|
|
65933
|
+
lint: "biome lint .",
|
|
65934
|
+
"lint:fix": "biome lint --write .",
|
|
65935
|
+
format: "biome format --write .",
|
|
65936
|
+
"format:check": "biome format .",
|
|
65937
|
+
check: "biome check --write .",
|
|
65938
|
+
"check-types": "tsc --noEmit",
|
|
65939
|
+
test: "vitest run",
|
|
65940
|
+
"test:watch": "vitest",
|
|
65941
|
+
"test:p0": "vitest run .p0. --passWithNoTests",
|
|
65942
|
+
"test:p1": "vitest run .p1. --passWithNoTests",
|
|
65943
|
+
"test:integration": "vitest run --config vitest.integration.config.ts"
|
|
65944
|
+
},
|
|
65945
|
+
devDependencies: {
|
|
65946
|
+
"@effect/platform-node": "4.0.0-rc.112",
|
|
65947
|
+
"@repo/contract": "workspace:*",
|
|
65948
|
+
"@repo/lib": "workspace:*",
|
|
65949
|
+
"@repo/typescript-config": "workspace:*",
|
|
65950
|
+
"@types/node": "^22.15.3",
|
|
65951
|
+
effect: "4.0.0-rc.112",
|
|
65952
|
+
esbuild: "^0.26.0",
|
|
65953
|
+
tsx: "^4.21.0",
|
|
65954
|
+
typescript: "catalog:",
|
|
65955
|
+
vitest: "^4.1.5"
|
|
65956
|
+
},
|
|
65957
|
+
engines: {
|
|
65958
|
+
node: ">=22"
|
|
65959
|
+
}
|
|
65960
|
+
};
|
|
65961
|
+
|
|
65962
|
+
// src/version.ts
|
|
65963
|
+
var CLI_VERSION = package_default.version;
|
|
65964
|
+
|
|
65965
|
+
// src/http.ts
|
|
65966
|
+
var USER_AGENT = `@glasser-ai/cli/${CLI_VERSION}`;
|
|
65967
|
+
var withClientIdentity = (client) => client.pipe(HttpClient_exports.mapRequest(HttpClientRequest_exports.setHeader("user-agent", USER_AGENT)));
|
|
65968
|
+
var HttpClientLayer = HttpClient_exports.layerMergedContext(
|
|
65969
|
+
Effect_exports.map(HttpClient_exports.HttpClient, withClientIdentity)
|
|
65970
|
+
).pipe(Layer_exports.provide(NodeHttpClient_exports.layerUndici));
|
|
65971
|
+
|
|
65959
65972
|
// src/render/errors.ts
|
|
65960
65973
|
function describeFailure(error2, extraHint) {
|
|
65961
65974
|
const base2 = describe(error2);
|
|
@@ -66184,7 +66197,8 @@ var StrictEnvLayer = Layer_exports.succeed(
|
|
|
66184
66197
|
);
|
|
66185
66198
|
var MainLayer = Layer_exports.mergeAll(
|
|
66186
66199
|
NodeServices_exports.layer,
|
|
66187
|
-
|
|
66200
|
+
// 出网只有这一个客户端,身份由它保证(http.ts)。
|
|
66201
|
+
HttpClientLayer,
|
|
66188
66202
|
CliConfigLayer,
|
|
66189
66203
|
StrictEnvLayer
|
|
66190
66204
|
);
|