@glasser-ai/cli 0.1.66 → 0.1.74
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 +137 -22
- package/package.json +1 -1
package/dist/glasser.js
CHANGED
|
@@ -61548,6 +61548,16 @@ var clientUpgradeNoticeField = {
|
|
|
61548
61548
|
var CLIENT_VERSION_UNSUPPORTED = "client.version_unsupported";
|
|
61549
61549
|
|
|
61550
61550
|
// ../../packages/contract/src/common.ts
|
|
61551
|
+
var optionalRequestField = (schema2) => Schema_exports.optionalKey(Schema_exports.NullOr(schema2)).pipe(
|
|
61552
|
+
Schema_exports.decodeTo(Schema_exports.optional(Schema_exports.toType(schema2)), {
|
|
61553
|
+
decode: SchemaGetter_exports.transformOptional(
|
|
61554
|
+
(value3) => Option_exports.flatMap(value3, (item) => item === null ? Option_exports.none() : Option_exports.some(item))
|
|
61555
|
+
),
|
|
61556
|
+
encode: SchemaGetter_exports.transformOptional(
|
|
61557
|
+
(value3) => Option_exports.flatMap(value3, (item) => item === void 0 ? Option_exports.none() : Option_exports.some(item))
|
|
61558
|
+
)
|
|
61559
|
+
})
|
|
61560
|
+
);
|
|
61551
61561
|
var ErrorBody = Schema_exports.Struct({
|
|
61552
61562
|
code: Schema_exports.String,
|
|
61553
61563
|
message: Schema_exports.String,
|
|
@@ -64574,24 +64584,24 @@ var EndpointDetail = Schema_exports.Struct({
|
|
|
64574
64584
|
}).check(runModePairing).check(outputSchemaPairing);
|
|
64575
64585
|
var SEARCH_PAGE_DEFAULT = 5;
|
|
64576
64586
|
var SEARCH_PAGE_MAX = 20;
|
|
64577
|
-
var SearchTaskIdField =
|
|
64587
|
+
var SearchTaskIdField = optionalRequestField(
|
|
64578
64588
|
Schema_exports.String.annotate({
|
|
64579
64589
|
description: "The task this search belongs to. A search without a task_id starts a new task. The response returns its task_id. Send it on every later search, inspect and run of the same piece of work. Any stable string is accepted."
|
|
64580
64590
|
})
|
|
64581
64591
|
);
|
|
64582
|
-
var InspectTaskIdField =
|
|
64592
|
+
var InspectTaskIdField = optionalRequestField(
|
|
64583
64593
|
Schema_exports.String.annotate({
|
|
64584
64594
|
description: "The task this inspection belongs to, from a catalog search response. Any stable string is accepted."
|
|
64585
64595
|
})
|
|
64586
64596
|
);
|
|
64587
64597
|
var SearchEndpointsRequest = Schema_exports.Struct({
|
|
64588
64598
|
/** 关键词。缺省或空串返回全部(仍受 Policy 裁剪)。 */
|
|
64589
|
-
query:
|
|
64590
|
-
limit:
|
|
64599
|
+
query: optionalRequestField(Schema_exports.String),
|
|
64600
|
+
limit: optionalRequestField(
|
|
64591
64601
|
Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maximum: SEARCH_PAGE_MAX }))
|
|
64592
64602
|
),
|
|
64593
64603
|
/** 上一页响应的 next_cursor。绑定于 query:拿别的查询的游标来翻是 400,不是从头开始。 */
|
|
64594
|
-
cursor:
|
|
64604
|
+
cursor: optionalRequestField(Schema_exports.String),
|
|
64595
64605
|
task_id: SearchTaskIdField,
|
|
64596
64606
|
/** 调用方自己的键值(ADR-0028)。不参与检索,只落进 catalog_searches.metadata。 */
|
|
64597
64607
|
metadata: Schema_exports.optional(MetadataInput),
|
|
@@ -64621,8 +64631,15 @@ var SearchEndpointsRequest = Schema_exports.Struct({
|
|
|
64621
64631
|
* 眼下要的是每一件事都带着用户的诉求,而可选的时候大量 Task 是空的。
|
|
64622
64632
|
*
|
|
64623
64633
|
* 不能是空白串:`normalizeUseCase` 会把它归一成 null,等于没填。
|
|
64634
|
+
* 对外只公示 minLength,空白检查留在契约解码:实测当前 Connector 会按 `\S`
|
|
64635
|
+
* 拒绝正常的多字符用途。MCP 与 OpenAPI 仍从同一份契约生成。
|
|
64624
64636
|
*/
|
|
64625
|
-
use_case: Schema_exports.String.check(
|
|
64637
|
+
use_case: Schema_exports.String.check(
|
|
64638
|
+
Schema_exports.makeFilter((value3) => value3.trim().length > 0, {
|
|
64639
|
+
expected: "a string containing non-whitespace text",
|
|
64640
|
+
toJsonSchema: () => ({ minLength: 1 })
|
|
64641
|
+
})
|
|
64642
|
+
).annotate({
|
|
64626
64643
|
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."
|
|
64627
64644
|
}),
|
|
64628
64645
|
/**
|
|
@@ -64632,7 +64649,7 @@ var SearchEndpointsRequest = Schema_exports.Struct({
|
|
|
64632
64649
|
* CLI)在解码时就因缺 `use_case` 被拒,两个都带时读的是 `use_case`。留着只是为了带着它的
|
|
64633
64650
|
* 新请求不报错;随 `tasks.user_request` 列一起删。
|
|
64634
64651
|
*/
|
|
64635
|
-
user_request:
|
|
64652
|
+
user_request: optionalRequestField(
|
|
64636
64653
|
Schema_exports.String.annotate({
|
|
64637
64654
|
description: "Deprecated: the old name of use_case. Send use_case instead."
|
|
64638
64655
|
})
|
|
@@ -64676,7 +64693,7 @@ var SearchEndpointsResponse = Schema_exports.Struct({
|
|
|
64676
64693
|
var InspectEndpointRequest = Schema_exports.Struct({
|
|
64677
64694
|
provider: ProviderSlug,
|
|
64678
64695
|
endpoint: EndpointKey,
|
|
64679
|
-
endpoint_version:
|
|
64696
|
+
endpoint_version: optionalRequestField(
|
|
64680
64697
|
Schema_exports.Int.check(Schema_exports.isGreaterThan(0)).annotate({
|
|
64681
64698
|
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."
|
|
64682
64699
|
})
|
|
@@ -64706,8 +64723,11 @@ var RunFailure = Schema_exports.Struct({
|
|
|
64706
64723
|
kind: FailureKind,
|
|
64707
64724
|
message: Schema_exports.String
|
|
64708
64725
|
});
|
|
64726
|
+
var ProviderOutcome = Schema_exports.Struct({
|
|
64727
|
+
http_status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))
|
|
64728
|
+
});
|
|
64709
64729
|
var ProviderResponse = Schema_exports.Struct({
|
|
64710
|
-
|
|
64730
|
+
...ProviderOutcome.fields,
|
|
64711
64731
|
error: Schema_exports.optional(JsonValue)
|
|
64712
64732
|
});
|
|
64713
64733
|
var ChargeClause = Schema_exports.Literals([
|
|
@@ -64769,13 +64789,20 @@ var Run = Schema_exports.Struct({
|
|
|
64769
64789
|
*/
|
|
64770
64790
|
metadata: Metadata
|
|
64771
64791
|
});
|
|
64792
|
+
var OmittedBody = Schema_exports.Struct({ omitted: Schema_exports.Literal(true) });
|
|
64793
|
+
var RunSummary = Schema_exports.Struct({
|
|
64794
|
+
...Run.fields,
|
|
64795
|
+
input: OmittedBody,
|
|
64796
|
+
output: OmittedBody,
|
|
64797
|
+
provider_response: Schema_exports.NullOr(ProviderOutcome)
|
|
64798
|
+
});
|
|
64772
64799
|
var RunRequest = Schema_exports.Struct({
|
|
64773
64800
|
provider: ProviderSlug,
|
|
64774
64801
|
endpoint: EndpointKey,
|
|
64775
64802
|
/** Provider 原生输入 —— Adapter 只注入凭证与传输,不改字段名。 */
|
|
64776
64803
|
input: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown)),
|
|
64777
64804
|
/** 支持的兼容契约号,不固定 Price;新 Run 按受理时的 Price,已受理 Run 保持原条款。 */
|
|
64778
|
-
endpoint_version:
|
|
64805
|
+
endpoint_version: optionalRequestField(
|
|
64779
64806
|
Schema_exports.Int.check(Schema_exports.isGreaterThan(0)).annotate({
|
|
64780
64807
|
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."
|
|
64781
64808
|
})
|
|
@@ -64788,7 +64815,7 @@ var RunRequest = Schema_exports.Struct({
|
|
|
64788
64815
|
* 永远不参与幂等判定:同一个 `Idempotency-Key` 换一个 task_id 重发仍然是重放,
|
|
64789
64816
|
* 不会变成第二次执行。加字段时别把它挪进 `input`。
|
|
64790
64817
|
*/
|
|
64791
|
-
task_id:
|
|
64818
|
+
task_id: optionalRequestField(
|
|
64792
64819
|
Schema_exports.String.annotate({
|
|
64793
64820
|
description: "The task this run belongs to, from a catalog search response. Grouping only: it never affects routing, price or idempotency."
|
|
64794
64821
|
})
|
|
@@ -64818,7 +64845,7 @@ var ListRunsQuery = Schema_exports.Struct({
|
|
|
64818
64845
|
metadata: Schema_exports.optional(MetadataQuery)
|
|
64819
64846
|
});
|
|
64820
64847
|
var ListRunsResponse = Schema_exports.Struct({
|
|
64821
|
-
...Paginated(
|
|
64848
|
+
...Paginated(RunSummary).fields,
|
|
64822
64849
|
...clientUpgradeNoticeField
|
|
64823
64850
|
});
|
|
64824
64851
|
var RunId = Schema_exports.String.check(Schema_exports.isUUID());
|
|
@@ -64872,7 +64899,7 @@ var commonFields = {
|
|
|
64872
64899
|
* Solution 的调用方(Dify 插件、n8n)不走 search,所以拿不到我们签发的 id;
|
|
64873
64900
|
* 随便一个稳定的串就行,服务端不校验形状。
|
|
64874
64901
|
*/
|
|
64875
|
-
task_id:
|
|
64902
|
+
task_id: optionalRequestField(
|
|
64876
64903
|
Schema_exports.String.annotate({
|
|
64877
64904
|
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."
|
|
64878
64905
|
})
|
|
@@ -65179,7 +65206,7 @@ var runs = HttpApiGroup_exports.make("Runs").add(
|
|
|
65179
65206
|
operation(
|
|
65180
65207
|
"runs-list",
|
|
65181
65208
|
"List runs",
|
|
65182
|
-
|
|
65209
|
+
'Lists runs in reverse order of creation time, with optional filters on status, provider, endpoint, task and metadata. This endpoint uses cursor pagination. Each row is a run summary: input and output are replaced by {"omitted": true} and the provider error body is left out; GET /v1/runs/:runId returns the full Run. The list is scoped by the effective policy: runs of an endpoint this key cannot run are not readable either.'
|
|
65183
65210
|
)
|
|
65184
65211
|
)
|
|
65185
65212
|
).add(
|
|
@@ -65328,7 +65355,10 @@ var withoutLegacySearchFields = (document) => {
|
|
|
65328
65355
|
var glasserApi = HttpApi_exports.make("glasser").add(solutions).add(endpoints).add(runs).add(balance).middleware(RateLimit).middleware(Authentication).middleware(SchemaErrors).annotateMerge(
|
|
65329
65356
|
OpenApi_exports.annotations({
|
|
65330
65357
|
title: "Glasser",
|
|
65331
|
-
description: "One key, no contract, pay per call, across paid APIs bought wholesale. Every response carries x-request-id; every error body carries the same envelope."
|
|
65358
|
+
description: "One key, no contract, pay per call, across paid APIs bought wholesale. Every response carries x-request-id; every error body carries the same envelope.",
|
|
65359
|
+
// host 是契约的一部分:没有它,文档站 playground 退回 api.example.com 且发不出请求,
|
|
65360
|
+
// 拿 openapi.json 跑 codegen 的客户也拿不到 base URL。
|
|
65361
|
+
servers: [{ url: "https://api.glasser.ai" }]
|
|
65332
65362
|
})
|
|
65333
65363
|
).annotate(OpenApi_exports.Transform, withoutLegacySearchFields);
|
|
65334
65364
|
|
|
@@ -65348,6 +65378,51 @@ function isValidApiKeyFormat(token) {
|
|
|
65348
65378
|
return secret.length === SECRET_BYTES * 2 && /^[0-9a-f]+$/.test(secret);
|
|
65349
65379
|
}
|
|
65350
65380
|
|
|
65381
|
+
// src/agent.ts
|
|
65382
|
+
var RULES = [
|
|
65383
|
+
{ agent: "claude-code", vars: ["CLAUDECODE"] },
|
|
65384
|
+
{
|
|
65385
|
+
agent: "codex",
|
|
65386
|
+
vars: ["CODEX_SANDBOX", "CODEX_THREAD_ID", "CODEX_SANDBOX_NETWORK_DISABLED", "CODEX_CI"]
|
|
65387
|
+
},
|
|
65388
|
+
{ agent: "cursor", vars: ["CURSOR_AGENT"] },
|
|
65389
|
+
{ agent: "gemini-cli", vars: ["GEMINI_CLI"] },
|
|
65390
|
+
{ agent: "hermes", vars: ["HERMES_AGENT"] },
|
|
65391
|
+
{ agent: "openclaw", vars: ["OPENCLAW_SHELL"] },
|
|
65392
|
+
{ agent: "opencode", vars: ["OPENCODE"] },
|
|
65393
|
+
{ agent: "cline", vars: ["CLINE_ACTIVE"] },
|
|
65394
|
+
{ agent: "grok", vars: ["GROK_AGENT", "GROK_SESSION_ID"] },
|
|
65395
|
+
{ agent: "kiro", vars: ["KIRO_SESSION_ID"] },
|
|
65396
|
+
{ agent: "antigravity", vars: ["ANTIGRAVITY_CLI_ALIAS"] },
|
|
65397
|
+
// 宿主变量:Claude Code 的 SDK / 托管入口不一定设 CLAUDECODE;
|
|
65398
|
+
// 全权限的 Codex Desktop 可能一个 CODEX_* 都不设,只留这一个。
|
|
65399
|
+
{ agent: "claude-code", vars: ["CLAUDE_CODE_ENTRYPOINT"] },
|
|
65400
|
+
{ agent: "codex", vars: ["CODEX_INTERNAL_ORIGINATOR_OVERRIDE"] }
|
|
65401
|
+
];
|
|
65402
|
+
var SELF_REPORTED = ["AI_AGENT", "AGENT"];
|
|
65403
|
+
var AGENT_ENV_VARS = [
|
|
65404
|
+
.../* @__PURE__ */ new Set([...RULES.flatMap((rule) => rule.vars), ...SELF_REPORTED])
|
|
65405
|
+
];
|
|
65406
|
+
var MAX_SELF_REPORTED = 32;
|
|
65407
|
+
var cleanSelfReported = (raw2) => {
|
|
65408
|
+
const value3 = raw2.trim().toLowerCase().replaceAll(/[^a-z0-9._-]/g, "").slice(0, MAX_SELF_REPORTED);
|
|
65409
|
+
return value3 === "" ? void 0 : value3;
|
|
65410
|
+
};
|
|
65411
|
+
function detectAgent(env) {
|
|
65412
|
+
const isSet = (name) => (env(name) ?? "") !== "";
|
|
65413
|
+
for (const rule of RULES) {
|
|
65414
|
+
if (rule.vars.some(isSet)) return rule.agent;
|
|
65415
|
+
}
|
|
65416
|
+
for (const name of SELF_REPORTED) {
|
|
65417
|
+
const value3 = env(name);
|
|
65418
|
+
if (value3 !== void 0) {
|
|
65419
|
+
const cleaned = cleanSelfReported(value3);
|
|
65420
|
+
if (cleaned !== void 0) return cleaned;
|
|
65421
|
+
}
|
|
65422
|
+
}
|
|
65423
|
+
return void 0;
|
|
65424
|
+
}
|
|
65425
|
+
|
|
65351
65426
|
// src/exit.ts
|
|
65352
65427
|
var UsageError = class extends Data_exports.TaggedError("UsageError") {
|
|
65353
65428
|
[Runtime_exports.errorExitCode] = 2;
|
|
@@ -65398,6 +65473,27 @@ var apiKeyFromEnv = Effect_exports.gen(function* () {
|
|
|
65398
65473
|
}
|
|
65399
65474
|
return Option_exports.some(value3);
|
|
65400
65475
|
});
|
|
65476
|
+
var codingAgent = Effect_exports.gen(function* () {
|
|
65477
|
+
const values3 = /* @__PURE__ */ new Map();
|
|
65478
|
+
for (const name of AGENT_ENV_VARS) {
|
|
65479
|
+
const raw2 = yield* Config_exports.option(Config_exports.string(name)).pipe(Effect_exports.orDie);
|
|
65480
|
+
if (Option_exports.isSome(raw2)) values3.set(name, raw2.value);
|
|
65481
|
+
}
|
|
65482
|
+
return detectAgent((name) => values3.get(name));
|
|
65483
|
+
});
|
|
65484
|
+
var loginCampaignFromEnv = Effect_exports.gen(function* () {
|
|
65485
|
+
const read2 = (name) => Config_exports.option(Config_exports.string(name)).pipe(
|
|
65486
|
+
Effect_exports.orDie,
|
|
65487
|
+
Effect_exports.map((raw2) => Option_exports.getOrUndefined(raw2)?.trim() || void 0)
|
|
65488
|
+
);
|
|
65489
|
+
const source = yield* read2("GLASSER_UTM_SOURCE");
|
|
65490
|
+
const medium = yield* read2("GLASSER_UTM_MEDIUM");
|
|
65491
|
+
if (source === void 0 && medium === void 0) return void 0;
|
|
65492
|
+
return {
|
|
65493
|
+
...source === void 0 ? {} : { utm_source: source },
|
|
65494
|
+
...medium === void 0 ? {} : { utm_medium: medium }
|
|
65495
|
+
};
|
|
65496
|
+
});
|
|
65401
65497
|
var configDir = Effect_exports.gen(function* () {
|
|
65402
65498
|
const xdg = yield* Config_exports.option(Config_exports.string("XDG_CONFIG_HOME")).pipe(Effect_exports.orDie);
|
|
65403
65499
|
const base2 = Option_exports.isSome(xdg) && path5.isAbsolute(xdg.value) ? xdg.value : path5.join(os.homedir(), ".config");
|
|
@@ -66153,6 +66249,19 @@ var post4 = (url2, body) => Effect_exports.gen(function* () {
|
|
|
66153
66249
|
return yield* client.post(url2, { body: HttpBody_exports.jsonUnsafe(body) });
|
|
66154
66250
|
});
|
|
66155
66251
|
var decodeJson = (schema2, response) => response.json.pipe(Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(schema2)));
|
|
66252
|
+
function withCampaign(verificationUri, campaign) {
|
|
66253
|
+
if (campaign === void 0) return verificationUri;
|
|
66254
|
+
let url2;
|
|
66255
|
+
try {
|
|
66256
|
+
url2 = new URL(verificationUri);
|
|
66257
|
+
} catch {
|
|
66258
|
+
return verificationUri;
|
|
66259
|
+
}
|
|
66260
|
+
for (const [key, value3] of Object.entries(campaign)) {
|
|
66261
|
+
if (value3 !== void 0) url2.searchParams.set(key, value3);
|
|
66262
|
+
}
|
|
66263
|
+
return url2.toString();
|
|
66264
|
+
}
|
|
66156
66265
|
function createAuthorization(baseUrl2) {
|
|
66157
66266
|
return Effect_exports.gen(function* () {
|
|
66158
66267
|
const response = yield* post4(`${baseUrl2}/control/cli/authorizations`, {}).pipe(
|
|
@@ -66271,18 +66380,19 @@ var login = Command_exports.make(
|
|
|
66271
66380
|
}
|
|
66272
66381
|
const baseUrl2 = yield* apiBaseUrl;
|
|
66273
66382
|
const created = yield* createAuthorization(baseUrl2);
|
|
66383
|
+
const verificationUri = withCampaign(created.verification_uri, yield* loginCampaignFromEnv);
|
|
66274
66384
|
yield* Console_exports.error(
|
|
66275
66385
|
`First, confirm this code matches the browser:
|
|
66276
66386
|
|
|
66277
66387
|
${created.user_code}
|
|
66278
66388
|
`
|
|
66279
66389
|
);
|
|
66280
|
-
if (noBrowser || !openInBrowser(
|
|
66390
|
+
if (noBrowser || !openInBrowser(verificationUri)) {
|
|
66281
66391
|
yield* Console_exports.error(`Open this URL to approve:
|
|
66282
|
-
${
|
|
66392
|
+
${verificationUri}
|
|
66283
66393
|
`);
|
|
66284
66394
|
} else {
|
|
66285
|
-
yield* Console_exports.error(`Approving in the browser: ${
|
|
66395
|
+
yield* Console_exports.error(`Approving in the browser: ${verificationUri}
|
|
66286
66396
|
`);
|
|
66287
66397
|
}
|
|
66288
66398
|
yield* Console_exports.error("Waiting for approval\u2026");
|
|
@@ -66712,7 +66822,7 @@ import os3 from "node:os";
|
|
|
66712
66822
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
66713
66823
|
import os2 from "node:os";
|
|
66714
66824
|
import path7 from "node:path";
|
|
66715
|
-
var SKILL_MARKDOWN = true ? "---\nname: glasser\nversion: 0.1.66\ndescription: >\n Reach for this when a task needs external or paid data \u2014 person or company\n enrichment, person/company search, web, news, image, video, maps, places,\n scholar or shopping search, US property and rental data, SEC filings,\n company financials and stock prices, webpage scraping, lead lookup, or any\n other paid data API \u2014 and check the data sources before writing a scraper or\n telling the user something is inaccessible. 1,500+ paid,\n high-quality endpoints across many providers behind one Key: search, inspect\n the price, run, pay per call, no signup at each vendor. Works through the\n glasser CLI, or through the Glasser MCP server where the runtime cannot\n shell out. If the user already has their own key or integration for a\n specific provider, use that first.\n---\n\n# Glasser\n\nGlasser is a broker: it sells runnable third-party API operations\n(\"Endpoints\") under a single Key. You search the data sources, inspect an\nEndpoint's contract and Price, and run it \u2014 the response is the provider's\nown output, nothing renamed or reshaped.\n\n## Identify your surface FIRST\n\nDecide by the actual execution environment, not the product name and not\nwhether a terminal exists. The wrong setup cannot work.\n\n- **`glasser` MCP tools already loaded** (`search`, `inspect`, `run`,\n `runs_get`, `runs_list`, `runs_stop`, `balance`): nothing to install. The\n verbs map one to one onto the CLI commands below; only `run` differs, in\n that it needs an `idempotency_key` you generate (a UUID). Call `balance`;\n if it succeeds, skip to **First run**. The rules in this file apply either\n way.\n\n- **Hosted assistant** (claude.ai, Claude Desktop chat, Cowork, ChatGPT,\n Gemini \u2014 even with a code sandbox: it runs in the provider's cloud, not on\n the human's machine, and resets between tasks): do NOT install anything.\n Tell the human to add `https://api.glasser.ai/mcp` as a custom MCP\n connector and finish the OAuth consent, then stop. In Claude: Customize \u2192\n Connectors \u2192 Add custom connector \u2192 name `Glasser`, URL\n `https://api.glasser.ai/mcp` \u2192 Sign in now + Register automatically \u2192 Add\n \u2192 Connect \u2192 choose the Workspace \u2192 Allow \u2192 enable Glasser from the chat's\n \"+\" menu. Other clients: https://glasser.ai/docs/mcp-server.md. If the\n product has no custom connectors, say so and point to the same account's\n coding agent (ChatGPT \u2192 Codex, Gemini \u2192 Gemini CLI, Claude \u2192 Claude Code).\n\n- **Local coding agent** (Claude Code, Codex, Cursor, Copilot, Gemini CLI,\n OpenClaw, Hermes on the user's machine): the human authorized the whole\n flow by pasting this. If your runtime asks permission for shell commands,\n request it ONCE and work straight through. Continue to **Setup**.\n\n- **Sandboxed agent** (cloud container, restricted egress): run\n `curl -sI https://api.glasser.ai/health` first. A proxy 403, DNS failure\n or timeout means an egress allowlist. Do not retry, do not try other\n hosts. Tell the human `api.glasser.ai` is blocked by the environment's\n network policy, offer the MCP connector or an allowlist for `glasser.ai`\n and `api.glasser.ai` on 443, then stop.\n\nNever ask the human to paste a Key into chat.\n\n## Setup\n\n```sh\nglasser --version 2>/dev/null || npm install -g @glasser-ai/cli@latest\n```\n\nOne command when the CLI is missing, and it installs the current version.\nWithout npm, `curl -fsSL https://glasser.ai/install.sh | sh` does the same\njob. A fresh install selects the latest version, so no separate registry\nversion check is needed. The installer reports what it needs and where it\nwrote the binary \u2014 read its output rather than guessing. If the CLI was\nalready installed, the server tells you when to upgrade (see **Upgrading**).\n\nFor agents with persistent skills, run `glasser skill install`. It saves\nthis file for every coding agent it finds (Claude Code, Codex, Cursor, Gemini\nCLI, Copilot and others), so future sessions load it; the installer already\nran it. For any other agent, save the complete file from\nhttps://glasser.ai/SKILL.md in your user-level skill directory and enable it\nfor future sessions. Do this only during setup or CLI upgrades.\n\n## Authentication\n\nRun `glasser balance`. Exit 0 means authentication works; continue to\n**First run**. A missing or rejected Key needs one. Handle other failures\nfrom the error message instead of starting another login.\n\n**Where a Key comes from.** Two sources, and the environment takes precedence\nover the local store. `GLASSER_API_KEY` needs no file on disk, so it is what\nCI, scripts and scheduled jobs use, and it is the source that still works on a\nmachine whose own store will not outlive the session \u2014 a cloud session, a\ncontainer. Mint that Key in the console. The local store is what `glasser\nlogin` writes and what `glasser keys add --label <l> --key <k>` fills by hand;\nit lives on the machine the CLI ran on, and lasts as long as that machine does.\n\n**With a user present**, in this order:\n\n1. Run `glasser login` with your shell tool's background execution support.\n The CLI opens the sign-in page when possible and prints a fallback URL and\n a matching code.\n2. Relay that URL and code exactly as printed \u2014 a plain URL, readable in a\n terminal \u2014 with a brief explanation of the next step. Nothing else starts\n until this message is out.\n3. Wait for that same command to finish, using the shell tool's wait or output\n operation with short waits. A pending result means wait again, not return\n a final reply. Browser approval needs no further chat message. Give brief\n progress updates during the wait; the CLI polls for up to 15 minutes.\n Stop waiting when login succeeds, fails, expires, or the user cancels.\n\nOnce login succeeds, use the available balance in its output and continue to\n**First run**, unless login warns that `GLASSER_API_KEY` overrides the saved\nKey or the summary has no available balance. In either case, run\n`glasser balance` in the environment subsequent commands will use. Login's\nsummary uses the new Key directly; it does not verify an environment Key.\n\nIf that check rejects an environment Key, another login will not fix it.\nPreserve runtime-managed authentication: changing the variable or bypassing\nit for a command needs the user's authorization. When the user requires it\nto stay unchanged, report the blocker and the runtime correction needed.\nFor other failures, report the actual error; a network failure does not show\nthat a Key is invalid. If authorization expires, a new login needs a new\nURL and code relayed before waiting again.\nNever ask the user to paste a Key. `glasser login --json` is a usage error by\ndesign \u2014 that flow needs a human.\n\n## First run\n\nSetup is finished when login succeeds and reports the available balance\nwithout an environment Key override, or `glasser balance` exits 0 in the\nenvironment subsequent commands will use \u2014 with the MCP tools, when\n`balance` succeeds.\nIf setup is blocked, give a brief status, the confirmed cause, and the next\nstep needed to resolve it. You may state which steps succeeded, but do not\nclaim readiness or offer task prompts while authentication is blocked.\nLogin's balance is not usable evidence for commands that use a rejected Key.\n\nOnce setup is finished, if the user already gave you a task, continue it.\nFor a setup-only request, reply briefly in the user's language: confirm\nGlasser is ready, report the available balance from login or the balance\ncheck, then offer three ready-to-send task prompts, one per bullet.\nUse a conversational lead-in that explains how the suggestions can help\nthe user, rather than a generic list heading. Connect it to their goals\nwhen known, or briefly describe what they could accomplish with Glasser.\n\nBase the prompts on the user's project, interests or goals when that context\nis available. Otherwise, choose three varied examples from Glasser's\ncapabilities. Give each prompt a concrete subject and a clear result the\nuser can ask for.\n\nFor both completed and blocked setup, omit Workspace names/slugs, Key\nlabels/values/prefixes, and installation details such as versions, paths or\npackage-manager output. Name a configuration variable when it explains the\nblocker. Report useful status, not a transcript of the setup commands.\nSetup is not approval to spend: wait for the user to choose before starting\na paid Run.\n\n## Upgrading\n\nThe server tells you when to upgrade \u2014 you do not have to compare versions\nby hand. Upgrade when any of these appears:\n\n- a response carries a `client` block. It is present only when this CLI is\n behind, and it says everything needed to act: `client_version`,\n `minimum_version`, `latest_version`, a runnable `upgrade_command`, and a\n `reason`. It rides in the response body,\n so it reaches `-j` output like any other field;\n- a command fails with `control: \"client.version_unsupported\"`. This CLI is\n too old to read part of the catalog, and `search` and `inspect` are refused\n rather than answered with a shortened list \u2014 a missing row would be\n invisible to you. Run the `upgrade_command` from `details`, then retry;\n- a command printed an `Update available` notice \u2014 the CLI asks the npm\n registry at most once every three hours and prints this on stderr. This one\n never\n appears in `-j` mode, because both streams stay machine-clean; the `client`\n block above is the `-j` signal.\n\nAfter upgrading, refresh the installed Skill as described in **Setup**.\nThe Skill and the CLI update together. Never downgrade. An available update\nnever interrupts work: finish the task at hand, then upgrade before the\nnext one. If the registry is unreachable, proceed with the installed\nversion \u2014 do not block the task on an upgrade check.\n\n## When to use\n\n- The task needs a capability (enrich a person or company, search the web,\n etc.) and no key or integration for it exists in the environment.\n- Workflow, in order:\n 0. Every search needs `--use-case \"<what they asked for>\"`, a browse with no\n query included: the user's own request, in their words, with the subject\n in it. Search refuses to run without it. One piece of the user's work is\n one **task**. Search prints a task id; pass it back\n with `--task <id>` on every later search, inspect and run for that same\n piece of work. Run that first search on its own and wait for the id:\n searches started in parallel before you have it each open a separate\n task. After that, search in parallel as much as you like, each with\n `--task <id>`. Every command that prints a follow-up command already\n carries the id in it, so working from what you are given keeps a task\n together with no bookkeeping.\n\n The use case and the task id cost nothing. The task id lets you list one\n task's Runs together with `glasser runs list --task <id>`.\n 1. `glasser search \"<capability>\" --use-case \"<what they asked for>\"` \u2014 find candidate Endpoints. The\n Provider column reads `pdl (People Data Labs)`: the first word is the\n slug every `-p` flag takes, the name in parentheses is who the data\n comes from \u2014 use it when the user names a vendor, and when you report\n the source back. Several Providers may sell the same capability: the\n list is ranked by relevance only, the Price sits beside each row, and\n the choice is yours.\n - A page holds 5 rows and the footer says how many matches there are in\n total. Pass the printed cursor with `--cursor` to see the rest.\n - The Score column is the cosine similarity between your words and that\n Endpoint's description, in [-1, 1], shown as `-` when semantic scoring\n did not run. It is a similarity signal for comparing rows on one page,\n not a verdict: the row order comes from fusing a keyword and a semantic\n ranking, and the ranking always returns its nearest candidates.\n - **Neither a page of low scores nor reaching the last page shows that\n the catalog lacks a capability.** Before you tell the user something is\n unavailable: read the total, page through with `--cursor`, search again\n with different words (the catalog is indexed on how each Endpoint\n describes itself, which may not be your phrasing), and inspect every\n candidate whose name is close to the task \u2014 `inspect` is free.\n 2. `glasser inspect -p <provider> -e <endpoint>` \u2014 **read the Price and\n the charge clauses BEFORE running.** The Price is what a normal\n COMPLETED call costs; the charge clauses list the exceptions (e.g.\n `NO_RESULT $0.00` means an empty answer is free). For any given\n endpoint the clauses are authoritative. Also identify which input\n fields control result volume (`num`, `size`, `limit`, arrays of\n queries) \u2014 the charge rule may read the input, so volume parameters\n can change what a call costs. Start small; raise only when the user\n needs more.\n 3. `glasser run -p <provider> -e <endpoint> -i '<json>'` \u2014 execute.\n 4. Report the result AND the charge to the user (run output includes the\n charged amount). Every Run also prints a `Run URL` (the `run_url` field\n in `-j`; absent from the `-o` file): the Workspace console page holding\n that Run's records exactly as the Provider returned them, private to\n Workspace members. When your answer relies on a Run, cite that URL as\n its source \u2014 the Run id alone opens nothing for the user.\n\n## When NOT to use\n\n- **Precedence: an explicit user instruction > the user's own integrations\n and keys > Glasser.** If the user has their own key, client, or\n integration for the capability, use that instead.\n- **Runs spend the Workspace balance.** Do not run Endpoints speculatively,\n in loops, or for bulk operations without telling the user the per-call\n Price and getting their go-ahead.\n- Do not use it for capabilities the environment already provides for free.\n- **The catalog changes often** \u2014 Endpoints and Providers are added weekly.\n Search every time you need one; never cache or reuse a listing from an\n earlier session, and never answer \"what can Glasser do\" from memory.\n\n## Adding funds\n\nOnly the user can add funds, in the console at https://app.glasser.ai/balance \u2014\nno command or tool does it. Raise this only when a Run fails with\n`insufficient balance` or the user asks.\n\n- **Top up** on the Balance page.\n- **Grants** are free balance; users often call them \"credits\". The Balance\n page lists the Grants a Workspace can receive and their terms. Send the\n user there.\n\n## Commands\n\n| Command | Purpose |\n|---|---|\n| `glasser login` | Browser device authorization; stores a Key |\n| `glasser search [\"<query>\"] --use-case \"<sentence>\" [--limit N] [--cursor C] [--task T]` | Search Endpoints, 5 per page (max 20); `--use-case` is required on every search; `-q`/`--query` takes the same query; use `--query=<query>` when it starts with `-`; the footer prints the match total, the task id, the next-page cursor for `--cursor`, and a search-again command that carries the task and the use case |\n| `glasser inspect -p <provider> -e <endpoint> [--endpoint-version N] [--task T]` | Schemas, current Price, charge clauses, supported version |\n| `glasser run -p <provider> -e <endpoint> [-i '<json>' \\| -f <file>] [--idempotency-key K] [--task T] [--wait] [--wait-timeout s] [-o file]` | Execute an Endpoint |\n| `glasser runs list [--limit --cursor --status --provider --endpoint --task]` | List past Runs; `--task` is an exact match |\n| `glasser runs get -r <runId> [--wait] [-o file]` | Fetch one Run |\n| `glasser runs stop -r <runId>` | Stop a queued/running Run |\n| `glasser balance` | Balance, held and available; doubles as the auth probe |\n| `glasser balance history [--limit --cursor --kind]` | Ledger of charges, refunds, top-ups and Grants |\n| `glasser keys add/list/activate/remove` | Manage Keys stored on this machine |\n\nGlobal flags: `-j/--json` (raw JSON to stdout, errors as a single JSON\nobject on stderr), `--help`, `--version`.\n\nFacts that matter when scripting:\n\n- Exit codes: `0` success, `1` runtime failure, `2` usage error, `130`\n interrupted.\n- In `-j` mode, stdout is data only; parse stderr for the error object.\n- For large outputs, prefer `-o <file>` and read the file selectively \u2014\n dumping a full provider payload into your context wastes it.\n- Money is always an **exact decimal string** (e.g. `\"0.0125\"`), never a\n float. Do not do float arithmetic on it.\n- Env: `GLASSER_API_KEY`, `GLASSER_API_BASE_URL` (default\n `https://api.glasser.ai`; point it elsewhere and that stack's Workspace\n is what gets billed), `NO_COLOR`.\n\n## Run statuses and waiting\n\n| Status | Meaning |\n|---|---|\n| `QUEUED` | Accepted, not yet dispatched to the provider |\n| `RUNNING` | Dispatched, provider has not answered yet |\n| `COMPLETED` | Terminal \u2014 the provider answered (its answer may still be a \"not found\") |\n| `FAILED` | Terminal \u2014 no usable provider answer; the failure block says why |\n| `STOPPED` | Terminal \u2014 stopped via `runs stop`. Dispatch wins the race: a Run already sent to the provider completes and is charged |\n\nInspect shows each Endpoint's run mode: a `sync` Endpoint returns the\nfinished Run in the same response (its timeout is printed next to the\nmode) \u2014 `--wait` on those adds nothing. For anything still `QUEUED` or\n`RUNNING`, either pass `--wait` up front or poll with\n`glasser runs get -r <runId> --wait`; interactive sessions that want to\nkeep talking can fire without `--wait` and poll between replies.\n\n## Troubleshooting\n\n| Symptom | Meaning / action |\n|---|---|\n| `Invalid or missing API key` | Check the Key source. If `GLASSER_API_KEY` is set, correct it through its owner; login does not replace it. With no environment Key, use `glasser login` to replace a missing or rejected local Key |\n| Exit `2` | Your command line is wrong \u2014 fix it from the message; nothing reached the API and nothing was charged |\n| `Input does not match the endpoint's input schema` | Read the `issues:` lines under the error \u2014 they name the exact field and constraint. No Run was created and nothing was charged; fix the input and run again |\n| `insufficient balance` | The Workspace cannot cover the Price. Tell the user to add funds in the console (see **Adding funds**) \u2014 do not retry |\n| `rate_limited` | The Workspace or the endpoint is at its limit. Wait `retry_after_ms` (the error carries it; the hint prints it), then retry the same command once \u2014 do not loop |\n| Transport error / timeout with a retry hint | Outcome unknown \u2014 a Run may exist. Retry with the SAME Idempotency-Key exactly as the hint prints it |\n| `FAILED` with a charge shown | Legitimate when the charge clauses say so \u2014 report both the failure and the charge |\n| `Update available` notice | Finish the current task, re-run the installer, then update the installed skill as described in **Upgrading** |\n\n## Running safely\n\n- `run` prints `Charge: $X (rule)` \u2014 the amount billed under the\n endpoint's charge rule. Report that number to the user.\n- `run` prints the Idempotency-Key it used (auto-generated when omitted;\n `--json` mode requires an explicit `--idempotency-key`). On an ambiguous\n failure \u2014 timeout, dropped connection, nonzero exit with no clear answer \u2014\n **retry with the SAME key**: it returns the original Run instead of\n charging again.\n- **Two indicators, not one.** A Run's status and the provider's response\n are separate. `COMPLETED` means the provider answered \u2014 a `COMPLETED` Run\n whose payload is a provider 404 (\"person not found\") is a normal outcome,\n not an error. Whether it is charged follows the endpoint's charge clauses\n from inspect. Report both the Run status and what the provider actually\n said.\n- Use `--wait` to block until the Run settles; without it, poll with\n `glasser runs get -r <runId> --wait`.\n\n## Rules for agents\n\n1. The user's own keys, integrations and explicit instructions outrank\n Glasser \u2014 it fills gaps, never routes around what the user has.\n2. Always inspect before running; never guess input parameters \u2014 the input\n schema and charge clauses from `inspect` are the source of truth.\n3. Runs spend the Workspace balance: no speculative, looped, or bulk runs\n without naming the per-call Price and getting the user's go-ahead.\n4. Start with small volume parameters; raise them only on request.\n5. Interactive auth is `glasser login` \u2014 never ask the user to paste a Key.\n6. On an ambiguous failure, retry with the SAME Idempotency-Key.\n7. Carry the SAME `--task` through one piece of work, the way you carry that\n key \u2014 search prints it, inspect and run take it.\n8. Report two indicators after every run \u2014 the Run status and what the\n provider said \u2014 plus the printed `Charge:` amount; cite the `Run URL`,\n never the bare Run id, as the source of what your answer used.\n9. Money is an exact decimal string; never do float arithmetic on it.\n10. Prefer `-o <file>` for large outputs; `-j` when you parse.\n11. When any command prints an `Update available` notice: finish the task,\n re-run the installer, then update the installed skill as described in\n **Upgrading**.\n12. The CLI is the source of truth for flags \u2014 run `glasser <command>\n --help` when unsure.\n13. `rate_limited` means back off: wait `retry_after_ms`, then retry the\n same command once; never loop on it.\n\n`--endpoint-version` selects a supported compatible contract. It does not lock Price.\nCompatible updates keep the version; older versions work until explicitly retired.\nNew Runs use the selected version's Price at admission. Accepted Runs keep their original Price.\n" : readFileSync3(new URL("../../api/src/http/skill/SKILL.md", import.meta.url), "utf8");
|
|
66825
|
+
var SKILL_MARKDOWN = true ? "---\nname: glasser\nversion: 0.1.74\ndescription: >\n Reach for this when a task needs external or paid data \u2014 person or company\n enrichment, person/company search, web, news, image, video, maps, places,\n scholar or shopping search, US property and rental data, SEC filings,\n company financials and stock prices, webpage scraping, lead lookup, or any\n other paid data API \u2014 and check the data sources before writing a scraper or\n telling the user something is inaccessible. 1,500+ paid,\n high-quality endpoints across many providers behind one Key: search, inspect\n the price, run, pay per call, no signup at each vendor. Works through the\n glasser CLI, or through the Glasser MCP server where the runtime cannot\n shell out. If the user already has their own key or integration for a\n specific provider, use that first.\n---\n\n# Glasser\n\nGlasser is a broker: it sells runnable third-party API operations\n(\"Endpoints\") under a single Key. You search the data sources, inspect an\nEndpoint's contract and Price, and run it \u2014 the response is the provider's\nown output, nothing renamed or reshaped.\n\n## Identify your surface FIRST\n\nDecide by the actual execution environment, not the product name and not\nwhether a terminal exists. The wrong setup cannot work.\n\n- **`glasser` MCP tools already loaded** (`search`, `inspect`, `run`,\n `runs_get`, `runs_list`, `runs_stop`, `balance`): nothing to install. The\n verbs map one to one onto the CLI commands below; only `run` differs, in\n that it needs an `idempotency_key` you generate (a UUID). Call `balance`;\n if it succeeds, skip to **First run**. The rules in this file apply either\n way.\n\n- **Hosted assistant** (claude.ai, Claude Desktop chat, Cowork, ChatGPT,\n Gemini \u2014 even with a code sandbox: it runs in the provider's cloud, not on\n the human's machine, and resets between tasks): do NOT install anything.\n Tell the human to add Glasser as a custom MCP connector, then stop. In\n Claude, give them this link; it opens the Add custom connector dialog\n with the name and URL filled in:\n https://api.glasser.ai/connect/claude\n Then Continue \u2192 Add \u2192 sign in to Glasser, choose the Workspace, Allow.\n Glasser is on in the next chat. Other products: the server URL is\n `https://api.glasser.ai/mcp`; steps per client at\n https://glasser.ai/docs/mcp-server.md. If the product has no custom\n connectors, say so and point to the same account's coding agent\n (ChatGPT \u2192 Codex, Gemini \u2192 Gemini CLI, Claude \u2192 Claude Code).\n\n- **Local coding agent** (Claude Code, Codex, Cursor, Copilot, Gemini CLI,\n OpenClaw, Hermes on the user's machine): the human authorized the whole\n flow by pasting this. If your runtime asks permission for shell commands,\n request it ONCE and work straight through. Continue to **Setup**.\n\n- **Sandboxed agent** (cloud container, restricted egress): run\n `curl -sI https://api.glasser.ai/health` first. A proxy 403, DNS failure\n or timeout means an egress allowlist. Do not retry, do not try other\n hosts. Tell the human `api.glasser.ai` is blocked by the environment's\n network policy, offer the MCP connector or an allowlist for `glasser.ai`\n and `api.glasser.ai` on 443, then stop.\n\nNever ask the human to paste a Key into chat.\n\n## Setup\n\n```sh\nglasser --version 2>/dev/null || npm install -g @glasser-ai/cli@latest\n```\n\nOne command when the CLI is missing, and it installs the current version.\nWithout npm, `curl -fsSL https://glasser.ai/install.sh | sh` does the same\njob. A fresh install selects the latest version, so no separate registry\nversion check is needed. The installer reports what it needs and where it\nwrote the binary \u2014 read its output rather than guessing. If the CLI was\nalready installed, the server tells you when to upgrade (see **Upgrading**).\n\nFor agents with persistent skills, run `glasser skill install`. It saves\nthis file for every coding agent it finds (Claude Code, Codex, Cursor, Gemini\nCLI, Copilot and others), so future sessions load it; the installer already\nran it. For any other agent, save the complete file from\nhttps://glasser.ai/SKILL.md in your user-level skill directory and enable it\nfor future sessions. Do this only during setup or CLI upgrades.\n\n## Authentication\n\nRun `glasser balance`. Exit 0 means authentication works; continue to\n**First run**. A missing or rejected Key needs one. Handle other failures\nfrom the error message instead of starting another login.\n\n**Where a Key comes from.** Two sources, and the environment takes precedence\nover the local store. `GLASSER_API_KEY` needs no file on disk, so it is what\nCI, scripts and scheduled jobs use, and it is the source that still works on a\nmachine whose own store will not outlive the session \u2014 a cloud session, a\ncontainer. Mint that Key in the console. The local store is what `glasser\nlogin` writes and what `glasser keys add --label <l> --key <k>` fills by hand;\nit lives on the machine the CLI ran on, and lasts as long as that machine does.\n\n**With a user present**, in this order:\n\n1. Run `glasser login` with your shell tool's background execution support.\n The CLI opens the sign-in page when possible and prints a fallback URL and\n a matching code.\n2. Relay that URL and code exactly as printed \u2014 a plain URL, readable in a\n terminal \u2014 with a brief explanation of the next step. Nothing else starts\n until this message is out.\n3. Wait for that same command to finish, using the shell tool's wait or output\n operation with short waits. A pending result means wait again, not return\n a final reply. Browser approval needs no further chat message. Give brief\n progress updates during the wait; the CLI polls for up to 15 minutes.\n Stop waiting when login succeeds, fails, expires, or the user cancels.\n\nOnce login succeeds, use the available balance in its output and continue to\n**First run**, unless login warns that `GLASSER_API_KEY` overrides the saved\nKey or the summary has no available balance. In either case, run\n`glasser balance` in the environment subsequent commands will use. Login's\nsummary uses the new Key directly; it does not verify an environment Key.\n\nIf that check rejects an environment Key, another login will not fix it.\nPreserve runtime-managed authentication: changing the variable or bypassing\nit for a command needs the user's authorization. When the user requires it\nto stay unchanged, report the blocker and the runtime correction needed.\nFor other failures, report the actual error; a network failure does not show\nthat a Key is invalid. If authorization expires, a new login needs a new\nURL and code relayed before waiting again.\nNever ask the user to paste a Key. `glasser login --json` is a usage error by\ndesign \u2014 that flow needs a human.\n\n## First run\n\nSetup is finished when login succeeds and reports the available balance\nwithout an environment Key override, or `glasser balance` exits 0 in the\nenvironment subsequent commands will use \u2014 with the MCP tools, when\n`balance` succeeds.\nIf setup is blocked, give a brief status, the confirmed cause, and the next\nstep needed to resolve it. You may state which steps succeeded, but do not\nclaim readiness or offer task prompts while authentication is blocked.\nLogin's balance is not usable evidence for commands that use a rejected Key.\n\nOnce setup is finished, if the user already gave you a task, continue it.\nFor a setup-only request, reply briefly in the user's language: confirm\nGlasser is ready, report the available balance from login or the balance\ncheck, then offer three ready-to-send task prompts, one per bullet.\nUse a conversational lead-in that explains how the suggestions can help\nthe user, rather than a generic list heading. Connect it to their goals\nwhen known, or briefly describe what they could accomplish with Glasser.\n\nBase the prompts on the user's project, interests or goals when that context\nis available. Otherwise, choose three varied examples from Glasser's\ncapabilities. Give each prompt a concrete subject and a clear result the\nuser can ask for.\n\nFor both completed and blocked setup, omit Workspace names/slugs, Key\nlabels/values/prefixes, and installation details such as versions, paths or\npackage-manager output. Name a configuration variable when it explains the\nblocker. Report useful status, not a transcript of the setup commands.\nSetup is not approval to spend: wait for the user to choose before starting\na paid Run.\n\n## Upgrading\n\nThe server tells you when to upgrade \u2014 you do not have to compare versions\nby hand. Upgrade when any of these appears:\n\n- a response carries a `client` block. It is present only when this CLI is\n behind, and it says everything needed to act: `client_version`,\n `minimum_version`, `latest_version`, a runnable `upgrade_command`, and a\n `reason`. It rides in the response body,\n so it reaches `-j` output like any other field;\n- a command fails with `control: \"client.version_unsupported\"`. This CLI is\n too old to read part of the catalog, and `search` and `inspect` are refused\n rather than answered with a shortened list \u2014 a missing row would be\n invisible to you. Run the `upgrade_command` from `details`, then retry;\n- a command printed an `Update available` notice \u2014 the CLI asks the npm\n registry at most once every three hours and prints this on stderr. This one\n never\n appears in `-j` mode, because both streams stay machine-clean; the `client`\n block above is the `-j` signal.\n\nAfter upgrading, refresh the installed Skill as described in **Setup**.\nThe Skill and the CLI update together. Never downgrade. An available update\nnever interrupts work: finish the task at hand, then upgrade before the\nnext one. If the registry is unreachable, proceed with the installed\nversion \u2014 do not block the task on an upgrade check.\n\n## When to use\n\n- The task needs a capability (enrich a person or company, search the web,\n etc.) and no key or integration for it exists in the environment.\n- Workflow, in order:\n 0. Every search needs `--use-case \"<what they asked for>\"`, a browse with no\n query included: the user's own request, in their words, with the subject\n in it. Search refuses to run without it. One piece of the user's work is\n one **task**. Search prints a task id; pass it back\n with `--task <id>` on every later search, inspect and run for that same\n piece of work. Run that first search on its own and wait for the id:\n searches started in parallel before you have it each open a separate\n task. After that, search in parallel as much as you like, each with\n `--task <id>`. Every command that prints a follow-up command already\n carries the id in it, so working from what you are given keeps a task\n together with no bookkeeping.\n\n The use case and the task id cost nothing. The task id lets you list one\n task's Runs together with `glasser runs list --task <id>`.\n 1. `glasser search \"<capability>\" --use-case \"<what they asked for>\"` \u2014 find candidate Endpoints. The\n Provider column reads `pdl (People Data Labs)`: the first word is the\n slug every `-p` flag takes, the name in parentheses is who the data\n comes from \u2014 use it when the user names a vendor, and when you report\n the source back. Several Providers may sell the same capability: the\n list is ranked by relevance only, the Price sits beside each row, and\n the choice is yours.\n - A page holds 5 rows and the footer says how many matches there are in\n total. Pass the printed cursor with `--cursor` to see the rest.\n - The Score column is the cosine similarity between your words and that\n Endpoint's description, in [-1, 1], shown as `-` when semantic scoring\n did not run. It is a similarity signal for comparing rows on one page,\n not a verdict: the row order comes from fusing a keyword and a semantic\n ranking, and the ranking always returns its nearest candidates.\n - **Neither a page of low scores nor reaching the last page shows that\n the catalog lacks a capability.** Before you tell the user something is\n unavailable: read the total, page through with `--cursor`, search again\n with different words (the catalog is indexed on how each Endpoint\n describes itself, which may not be your phrasing), and inspect every\n candidate whose name is close to the task \u2014 `inspect` is free.\n 2. `glasser inspect -p <provider> -e <endpoint>` \u2014 **read the Price and\n the charge clauses BEFORE running.** The Price is what a normal\n COMPLETED call costs; the charge clauses list the exceptions (e.g.\n `NO_RESULT $0.00` means an empty answer is free). For any given\n endpoint the clauses are authoritative. Also identify which input\n fields control result volume (`num`, `size`, `limit`, arrays of\n queries) \u2014 the charge rule may read the input, so volume parameters\n can change what a call costs. Start small; raise only when the user\n needs more.\n 3. `glasser run -p <provider> -e <endpoint> -i '<json>'` \u2014 execute.\n 4. Report the result AND the charge to the user (run output includes the\n charged amount). Every Run also prints a `Run URL` (the `run_url` field\n in `-j`; absent from the `-o` file): the Workspace console page holding\n that Run's records exactly as the Provider returned them, private to\n Workspace members. When your answer relies on a Run, cite that URL as\n its source \u2014 the Run id alone opens nothing for the user.\n\n## When NOT to use\n\n- **Precedence: an explicit user instruction > the user's own integrations\n and keys > Glasser.** If the user has their own key, client, or\n integration for the capability, use that instead.\n- **Runs spend the Workspace balance.** Do not run Endpoints speculatively,\n in loops, or for bulk operations without telling the user the per-call\n Price and getting their go-ahead.\n- Do not use it for capabilities the environment already provides for free.\n- **The catalog changes often** \u2014 Endpoints and Providers are added weekly.\n Search every time you need one; never cache or reuse a listing from an\n earlier session, and never answer \"what can Glasser do\" from memory.\n\n## Adding funds\n\nOnly the user can add funds, in the console at https://app.glasser.ai/balance \u2014\nno command or tool does it. Raise this only when a Run fails with\n`insufficient balance` or the user asks.\n\n- **Top up** on the Balance page.\n- **Grants** are free balance; users often call them \"credits\". The Balance\n page lists the Grants a Workspace can receive and their terms. Send the\n user there.\n\n## Commands\n\n| Command | Purpose |\n|---|---|\n| `glasser login` | Browser device authorization; stores a Key |\n| `glasser search [\"<query>\"] --use-case \"<sentence>\" [--limit N] [--cursor C] [--task T]` | Search Endpoints, 5 per page (max 20); `--use-case` is required on every search; `-q`/`--query` takes the same query; use `--query=<query>` when it starts with `-`; the footer prints the match total, the task id, the next-page cursor for `--cursor`, and a search-again command that carries the task and the use case |\n| `glasser inspect -p <provider> -e <endpoint> [--endpoint-version N] [--task T]` | Schemas, current Price, charge clauses, supported version |\n| `glasser run -p <provider> -e <endpoint> [-i '<json>' \\| -f <file>] [--idempotency-key K] [--task T] [--wait] [--wait-timeout s] [-o file]` | Execute an Endpoint |\n| `glasser runs list [--limit --cursor --status --provider --endpoint --task]` | List past Runs; `--task` is an exact match |\n| `glasser runs get -r <runId> [--wait] [-o file]` | Fetch one Run |\n| `glasser runs stop -r <runId>` | Stop a queued/running Run |\n| `glasser balance` | Balance, held and available; doubles as the auth probe |\n| `glasser balance history [--limit --cursor --kind]` | Ledger of charges, refunds, top-ups and Grants |\n| `glasser keys add/list/activate/remove` | Manage Keys stored on this machine |\n\nGlobal flags: `-j/--json` (raw JSON to stdout, errors as a single JSON\nobject on stderr), `--help`, `--version`.\n\nFacts that matter when scripting:\n\n- Exit codes: `0` success, `1` runtime failure, `2` usage error, `130`\n interrupted.\n- In `-j` mode, stdout is data only; parse stderr for the error object.\n- For large outputs, prefer `-o <file>` and read the file selectively \u2014\n dumping a full provider payload into your context wastes it.\n- Money is always an **exact decimal string** (e.g. `\"0.0125\"`), never a\n float. Do not do float arithmetic on it.\n- Env: `GLASSER_API_KEY`, `GLASSER_API_BASE_URL` (default\n `https://api.glasser.ai`; point it elsewhere and that stack's Workspace\n is what gets billed), `NO_COLOR`.\n\n## Run statuses and waiting\n\n| Status | Meaning |\n|---|---|\n| `QUEUED` | Accepted, not yet dispatched to the provider |\n| `RUNNING` | Dispatched, provider has not answered yet |\n| `COMPLETED` | Terminal \u2014 the provider answered (its answer may still be a \"not found\") |\n| `FAILED` | Terminal \u2014 no usable provider answer; the failure block says why |\n| `STOPPED` | Terminal \u2014 stopped via `runs stop`. Dispatch wins the race: a Run already sent to the provider completes and is charged |\n\nInspect shows each Endpoint's run mode: a `sync` Endpoint returns the\nfinished Run in the same response (its timeout is printed next to the\nmode) \u2014 `--wait` on those adds nothing. For anything still `QUEUED` or\n`RUNNING`, either pass `--wait` up front or poll with\n`glasser runs get -r <runId> --wait`; interactive sessions that want to\nkeep talking can fire without `--wait` and poll between replies.\n\n## Troubleshooting\n\n| Symptom | Meaning / action |\n|---|---|\n| `Invalid or missing API key` | Check the Key source. If `GLASSER_API_KEY` is set, correct it through its owner; login does not replace it. With no environment Key, use `glasser login` to replace a missing or rejected local Key |\n| Exit `2` | Your command line is wrong \u2014 fix it from the message; nothing reached the API and nothing was charged |\n| `Input does not match the endpoint's input schema` | Read the `issues:` lines under the error \u2014 they name the exact field and constraint. No Run was created and nothing was charged; fix the input and run again |\n| `insufficient balance` | The Workspace cannot cover the Price. Tell the user to add funds in the console (see **Adding funds**) \u2014 do not retry |\n| `rate_limited` | The Workspace or the endpoint is at its limit. Wait `retry_after_ms` (the error carries it; the hint prints it), then retry the same command once \u2014 do not loop |\n| Transport error / timeout with a retry hint | Outcome unknown \u2014 a Run may exist. Retry with the SAME Idempotency-Key exactly as the hint prints it |\n| `FAILED` with a charge shown | Legitimate when the charge clauses say so \u2014 report both the failure and the charge |\n| `Update available` notice | Finish the current task, re-run the installer, then update the installed skill as described in **Upgrading** |\n\n## Running safely\n\n- `run` prints `Charge: $X (rule)` \u2014 the amount billed under the\n endpoint's charge rule. Report that number to the user.\n- `run` prints the Idempotency-Key it used (auto-generated when omitted;\n `--json` mode requires an explicit `--idempotency-key`). On an ambiguous\n failure \u2014 timeout, dropped connection, nonzero exit with no clear answer \u2014\n **retry with the SAME key**: it returns the original Run instead of\n charging again.\n- **Two indicators, not one.** A Run's status and the provider's response\n are separate. `COMPLETED` means the provider answered \u2014 a `COMPLETED` Run\n whose payload is a provider 404 (\"person not found\") is a normal outcome,\n not an error. Whether it is charged follows the endpoint's charge clauses\n from inspect. Report both the Run status and what the provider actually\n said.\n- Use `--wait` to block until the Run settles; without it, poll with\n `glasser runs get -r <runId> --wait`.\n\n## Rules for agents\n\n1. The user's own keys, integrations and explicit instructions outrank\n Glasser \u2014 it fills gaps, never routes around what the user has.\n2. Always inspect before running; never guess input parameters \u2014 the input\n schema and charge clauses from `inspect` are the source of truth.\n3. Runs spend the Workspace balance: no speculative, looped, or bulk runs\n without naming the per-call Price and getting the user's go-ahead.\n4. Start with small volume parameters; raise them only on request.\n5. Interactive auth is `glasser login` \u2014 never ask the user to paste a Key.\n6. On an ambiguous failure, retry with the SAME Idempotency-Key.\n7. Carry the SAME `--task` through one piece of work, the way you carry that\n key \u2014 search prints it, inspect and run take it.\n8. Report two indicators after every run \u2014 the Run status and what the\n provider said \u2014 plus the printed `Charge:` amount; cite the `Run URL`,\n never the bare Run id, as the source of what your answer used.\n9. Money is an exact decimal string; never do float arithmetic on it.\n10. Prefer `-o <file>` for large outputs; `-j` when you parse.\n11. When any command prints an `Update available` notice: finish the task,\n re-run the installer, then update the installed skill as described in\n **Upgrading**.\n12. The CLI is the source of truth for flags \u2014 run `glasser <command>\n --help` when unsure.\n13. `rate_limited` means back off: wait `retry_after_ms`, then retry the\n same command once; never loop on it.\n\n`--endpoint-version` selects a supported compatible contract. It does not lock Price.\nCompatible updates keep the version; older versions work until explicitly retired.\nNew Runs use the selected version's Price at admission. Accepted Runs keep their original Price.\n" : readFileSync3(new URL("../../api/src/http/skill/SKILL.md", import.meta.url), "utf8");
|
|
66716
66826
|
var SKILL_NAME = "glasser";
|
|
66717
66827
|
var absolute = (value3, fallback) => value3 !== void 0 && path7.isAbsolute(value3) ? value3 : fallback;
|
|
66718
66828
|
function agents(env) {
|
|
@@ -66822,7 +66932,7 @@ var skill = Command_exports.make("skill").pipe(
|
|
|
66822
66932
|
// package.json
|
|
66823
66933
|
var package_default = {
|
|
66824
66934
|
name: "@glasser-ai/cli",
|
|
66825
|
-
version: "0.1.
|
|
66935
|
+
version: "0.1.74",
|
|
66826
66936
|
description: "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
|
|
66827
66937
|
license: "MIT",
|
|
66828
66938
|
type: "module",
|
|
@@ -66890,9 +67000,14 @@ var CLI_VERSION = package_default.version;
|
|
|
66890
67000
|
|
|
66891
67001
|
// src/http.ts
|
|
66892
67002
|
var USER_AGENT = `@glasser-ai/cli/${CLI_VERSION}`;
|
|
66893
|
-
var
|
|
67003
|
+
var userAgentFor = (agent) => agent === void 0 ? USER_AGENT : `${USER_AGENT} AIAgent/${agent}`;
|
|
67004
|
+
var withClientIdentity = (client, userAgent = USER_AGENT) => client.pipe(HttpClient_exports.mapRequest(HttpClientRequest_exports.setHeader("user-agent", userAgent)));
|
|
66894
67005
|
var HttpClientLayer = HttpClient_exports.layerMergedContext(
|
|
66895
|
-
Effect_exports.
|
|
67006
|
+
Effect_exports.gen(function* () {
|
|
67007
|
+
const client = yield* HttpClient_exports.HttpClient;
|
|
67008
|
+
const agent = yield* codingAgent;
|
|
67009
|
+
return withClientIdentity(client, userAgentFor(agent));
|
|
67010
|
+
})
|
|
66896
67011
|
).pipe(Layer_exports.provide(NodeHttpClient_exports.layerUndici));
|
|
66897
67012
|
|
|
66898
67013
|
// src/json-mode.ts
|