@glasser-ai/cli 0.1.75 → 0.1.83
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 +235 -88
- package/package.json +1 -1
package/dist/glasser.js
CHANGED
|
@@ -61571,14 +61571,24 @@ var ErrorResponse = Schema_exports.Struct({
|
|
|
61571
61571
|
request_id: Schema_exports.String
|
|
61572
61572
|
});
|
|
61573
61573
|
var PaginationQuery = Schema_exports.Struct({
|
|
61574
|
-
limit: Schema_exports.optionalKey(
|
|
61575
|
-
|
|
61574
|
+
limit: Schema_exports.optionalKey(
|
|
61575
|
+
Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maximum: 100 })).annotate({
|
|
61576
|
+
description: "Page size, from 1 to 100. Default: 20."
|
|
61577
|
+
})
|
|
61578
|
+
),
|
|
61579
|
+
cursor: Schema_exports.optional(
|
|
61580
|
+
Schema_exports.String.annotate({
|
|
61581
|
+
description: "Pass next_cursor from the previous response to read the next page."
|
|
61582
|
+
})
|
|
61583
|
+
)
|
|
61576
61584
|
});
|
|
61577
61585
|
function Paginated(item) {
|
|
61578
61586
|
return Schema_exports.Struct({
|
|
61579
61587
|
data: Schema_exports.Array(item),
|
|
61580
61588
|
/** null 表示没有下一页。省略与 null 语义不同,这里恒定返回该字段。 */
|
|
61581
|
-
next_cursor: Schema_exports.NullOr(Schema_exports.String)
|
|
61589
|
+
next_cursor: Schema_exports.NullOr(Schema_exports.String).annotate({
|
|
61590
|
+
description: "Cursor for the next page. Null when there are no more entries."
|
|
61591
|
+
})
|
|
61582
61592
|
});
|
|
61583
61593
|
}
|
|
61584
61594
|
var METADATA_MAX_KEYS = 20;
|
|
@@ -61602,10 +61612,20 @@ var MetadataShape = Schema_exports.Record(Schema_exports.String, Schema_exports.
|
|
|
61602
61612
|
Schema_exports.isPropertyNames(Schema_exports.String.check(Schema_exports.isPattern(METADATA_KEY_PATTERN)))
|
|
61603
61613
|
);
|
|
61604
61614
|
var Metadata = MetadataShape.annotate({
|
|
61605
|
-
description: `Your
|
|
61615
|
+
description: `Your stored tracking fields. Use them to filter Runs. They never go to the Provider or affect routing, Price, or idempotency.
|
|
61616
|
+
|
|
61617
|
+
- Up to ${METADATA_MAX_KEYS} keys: lowercase letters, digits, and underscores; start with a letter; at most 40 characters.
|
|
61618
|
+
- Values: strings of 1\u2013${METADATA_VALUE_MAX_LENGTH} characters.
|
|
61619
|
+
- user_id: your End user's opaque ID, never their email address or name.`
|
|
61606
61620
|
});
|
|
61607
61621
|
var MetadataInput = Schema_exports.Union([MetadataShape, Schema_exports.Unknown]).annotate({
|
|
61608
|
-
description: `
|
|
61622
|
+
description: `Optional tracking fields, returned on the Run and available as filters. They never go to the Provider or affect routing, Price, or idempotency.
|
|
61623
|
+
|
|
61624
|
+
- Up to ${METADATA_MAX_KEYS} keys: lowercase letters, digits, and underscores; start with a letter; at most 40 characters.
|
|
61625
|
+
- Values: strings of 1\u2013${METADATA_VALUE_MAX_LENGTH} characters.
|
|
61626
|
+
- user_id: your End user's opaque ID, never their email address or name.
|
|
61627
|
+
|
|
61628
|
+
Invalid entries are dropped whole, not truncated. The request continues, and the Run returns the fields that were stored.`
|
|
61609
61629
|
});
|
|
61610
61630
|
var MetadataQuery = Schema_exports.String.annotate({
|
|
61611
61631
|
contentMediaType: "application/json",
|
|
@@ -61643,9 +61663,15 @@ var ERROR_CODES = {
|
|
|
61643
61663
|
|
|
61644
61664
|
// ../../packages/contract/src/balance.ts
|
|
61645
61665
|
var BalanceResponse = Schema_exports.Struct({
|
|
61646
|
-
balance_usd: UsdAmount
|
|
61647
|
-
|
|
61648
|
-
|
|
61666
|
+
balance_usd: UsdAmount.annotate({
|
|
61667
|
+
description: "Settled funds in the Workspace, including funds currently held for Runs."
|
|
61668
|
+
}),
|
|
61669
|
+
held_usd: UsdAmount.annotate({
|
|
61670
|
+
description: "Funds reserved for unfinished Runs. A Hold is not a charge."
|
|
61671
|
+
}),
|
|
61672
|
+
available_usd: UsdAmount.annotate({
|
|
61673
|
+
description: "Funds available for new Runs: balance_usd minus held_usd."
|
|
61674
|
+
}),
|
|
61649
61675
|
...clientUpgradeNoticeField
|
|
61650
61676
|
});
|
|
61651
61677
|
var BalanceEntryKind = Schema_exports.Literals([
|
|
@@ -61658,10 +61684,14 @@ var BalanceEntryKind = Schema_exports.Literals([
|
|
|
61658
61684
|
var BalanceEntry = Schema_exports.Struct({
|
|
61659
61685
|
id: Schema_exports.String,
|
|
61660
61686
|
kind: BalanceEntryKind,
|
|
61661
|
-
amount_usd: UsdSigned
|
|
61662
|
-
|
|
61687
|
+
amount_usd: UsdSigned.annotate({
|
|
61688
|
+
description: "Signed USD amount. Charges are negative. Use decimal arithmetic, not floating-point arithmetic, to total entries."
|
|
61689
|
+
}),
|
|
61690
|
+
balance_after_usd: UsdAmount.annotate({ description: "Workspace balance after this entry." }),
|
|
61663
61691
|
/** charge / refund 指向触发它的 run。 */
|
|
61664
|
-
run_id: Schema_exports.NullOr(Schema_exports.String)
|
|
61692
|
+
run_id: Schema_exports.NullOr(Schema_exports.String).annotate({
|
|
61693
|
+
description: "Related Run for a charge or refund; null when no Run is associated."
|
|
61694
|
+
}),
|
|
61665
61695
|
description: Schema_exports.String,
|
|
61666
61696
|
created_at: Timestamp
|
|
61667
61697
|
});
|
|
@@ -64529,19 +64559,27 @@ var endpointFields = {
|
|
|
64529
64559
|
}),
|
|
64530
64560
|
/** 不透明稳定的操作 key,如 /v5/person/enrich。 */
|
|
64531
64561
|
endpoint: EndpointKey,
|
|
64532
|
-
endpoint_version: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
|
|
64562
|
+
endpoint_version: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)).annotate({
|
|
64563
|
+
description: "Supported Endpoint version. Compatible updates keep this version."
|
|
64564
|
+
}),
|
|
64533
64565
|
/** 人写的名字与描述 —— 检索质量靠它们,不靠 Provider 文档原文(design §5)。 */
|
|
64534
64566
|
name: Schema_exports.String,
|
|
64535
64567
|
description: Schema_exports.String,
|
|
64536
64568
|
tags: Schema_exports.Array(Schema_exports.String),
|
|
64537
|
-
price: Price
|
|
64569
|
+
price: Price.annotate({
|
|
64570
|
+
description: "Current Price and charging rules. Price can change without an Endpoint version change. New Runs use the Price at admission; accepted Runs keep that Price."
|
|
64571
|
+
}),
|
|
64538
64572
|
run_mode: RunMode,
|
|
64539
64573
|
/**
|
|
64540
64574
|
* 从请求到终态响应的**外部**上限。只有 sync Endpoint 有:async 的 Run 同样
|
|
64541
64575
|
* 有界(QUEUED 的执行 deadline),但没有任何数字能界定一次**同步 HTTP 响应**
|
|
64542
64576
|
* —— 那正是这个字段承诺的东西。缺席表示不适用,不是默认值。
|
|
64543
64577
|
*/
|
|
64544
|
-
timeout_ms: Schema_exports.optional(
|
|
64578
|
+
timeout_ms: Schema_exports.optional(
|
|
64579
|
+
Schema_exports.Int.check(Schema_exports.isGreaterThan(0)).annotate({
|
|
64580
|
+
description: "For sync Endpoints, the maximum time in milliseconds from a Run request to its terminal response. Set your HTTP client timeout above this value."
|
|
64581
|
+
})
|
|
64582
|
+
)
|
|
64545
64583
|
};
|
|
64546
64584
|
var runModePairing = Schema_exports.makeFilter(
|
|
64547
64585
|
(value3) => {
|
|
@@ -64576,11 +64614,21 @@ var EndpointDetail = Schema_exports.Struct({
|
|
|
64576
64614
|
// 在决定跑不跑之前必经的一跳,所以升级信号挂在这里最省事。
|
|
64577
64615
|
...clientUpgradeNoticeField,
|
|
64578
64616
|
method: HttpMethod,
|
|
64579
|
-
input_schema: Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown)
|
|
64580
|
-
|
|
64581
|
-
|
|
64582
|
-
|
|
64583
|
-
|
|
64617
|
+
input_schema: Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown).annotate({
|
|
64618
|
+
description: "Provider-native JSON Schema for Run input."
|
|
64619
|
+
}),
|
|
64620
|
+
output_schema: Schema_exports.NullOr(Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown)).annotate({
|
|
64621
|
+
description: "JSON Schema for successful output. Null when no reliable schema is available; sample responses do not define a schema."
|
|
64622
|
+
}),
|
|
64623
|
+
output_schema_source: Schema_exports.NullOr(Schema_exports.Literals(["provider", "glasser"])).annotate({
|
|
64624
|
+
description: "Who defines the output schema: the Provider or Glasser. Null when output_schema is null."
|
|
64625
|
+
}),
|
|
64626
|
+
sample_input: Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown).annotate({
|
|
64627
|
+
description: "Example input. Adjust it to your request and validate it against input_schema."
|
|
64628
|
+
}),
|
|
64629
|
+
doc_url: Schema_exports.NullOr(Schema_exports.String).annotate({
|
|
64630
|
+
description: "Link to the Provider's documentation, when available."
|
|
64631
|
+
})
|
|
64584
64632
|
}).check(runModePairing).check(outputSchemaPairing);
|
|
64585
64633
|
var SEARCH_PAGE_DEFAULT = 5;
|
|
64586
64634
|
var SEARCH_PAGE_MAX = 20;
|
|
@@ -64596,12 +64644,22 @@ var InspectTaskIdField = optionalRequestField(
|
|
|
64596
64644
|
);
|
|
64597
64645
|
var SearchEndpointsRequest = Schema_exports.Struct({
|
|
64598
64646
|
/** 关键词。缺省或空串返回全部(仍受 Policy 裁剪)。 */
|
|
64599
|
-
query: optionalRequestField(
|
|
64647
|
+
query: optionalRequestField(
|
|
64648
|
+
Schema_exports.String.annotate({
|
|
64649
|
+
description: "Keywords that describe the data you need. Omit or leave empty to browse all Endpoints allowed by your Key's Policy."
|
|
64650
|
+
})
|
|
64651
|
+
),
|
|
64600
64652
|
limit: optionalRequestField(
|
|
64601
|
-
Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maximum: SEARCH_PAGE_MAX }))
|
|
64653
|
+
Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maximum: SEARCH_PAGE_MAX })).annotate({
|
|
64654
|
+
description: `Maximum results per page. Default: ${SEARCH_PAGE_DEFAULT}; maximum: ${SEARCH_PAGE_MAX}.`
|
|
64655
|
+
})
|
|
64602
64656
|
),
|
|
64603
64657
|
/** 上一页响应的 next_cursor。绑定于 query:拿别的查询的游标来翻是 400,不是从头开始。 */
|
|
64604
|
-
cursor: optionalRequestField(
|
|
64658
|
+
cursor: optionalRequestField(
|
|
64659
|
+
Schema_exports.String.annotate({
|
|
64660
|
+
description: "The next_cursor from the previous response. Use the same query; a cursor from a different query returns 400."
|
|
64661
|
+
})
|
|
64662
|
+
),
|
|
64605
64663
|
task_id: SearchTaskIdField,
|
|
64606
64664
|
/** 调用方自己的键值(ADR-0028)。不参与检索,只落进 catalog_searches.metadata。 */
|
|
64607
64665
|
metadata: Schema_exports.optional(MetadataInput),
|
|
@@ -64673,9 +64731,13 @@ var SearchHit = Schema_exports.Struct({
|
|
|
64673
64731
|
})
|
|
64674
64732
|
}).check(runModePairing);
|
|
64675
64733
|
var SearchEndpointsResponse = Schema_exports.Struct({
|
|
64676
|
-
data: Schema_exports.Array(SearchHit)
|
|
64734
|
+
data: Schema_exports.Array(SearchHit).annotate({
|
|
64735
|
+
description: "Endpoint summaries ranked by relevance and filtered by your Key's Policy. Price does not affect ranking."
|
|
64736
|
+
}),
|
|
64677
64737
|
...clientUpgradeNoticeField,
|
|
64678
|
-
next_cursor: Schema_exports.NullOr(Schema_exports.String)
|
|
64738
|
+
next_cursor: Schema_exports.NullOr(Schema_exports.String).annotate({
|
|
64739
|
+
description: "Pass this value as cursor to get the next page. Null means there are no more pages."
|
|
64740
|
+
}),
|
|
64679
64741
|
total: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0)).annotate({
|
|
64680
64742
|
description: "Total number of ranked candidates across all pages."
|
|
64681
64743
|
}),
|
|
@@ -64695,7 +64757,7 @@ var InspectEndpointRequest = Schema_exports.Struct({
|
|
|
64695
64757
|
endpoint: EndpointKey,
|
|
64696
64758
|
endpoint_version: optionalRequestField(
|
|
64697
64759
|
Schema_exports.Int.check(Schema_exports.isGreaterThan(0)).annotate({
|
|
64698
|
-
description: "Select a supported Endpoint version, or omit for the default.
|
|
64760
|
+
description: "Select a supported Endpoint version, including an older one, or omit for the default. Unavailable or retired versions return 409."
|
|
64699
64761
|
})
|
|
64700
64762
|
),
|
|
64701
64763
|
task_id: InspectTaskIdField,
|
|
@@ -64724,7 +64786,9 @@ var RunFailure = Schema_exports.Struct({
|
|
|
64724
64786
|
message: Schema_exports.String
|
|
64725
64787
|
});
|
|
64726
64788
|
var ProviderOutcome = Schema_exports.Struct({
|
|
64727
|
-
http_status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))
|
|
64789
|
+
http_status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 })).annotate({
|
|
64790
|
+
description: "HTTP status returned by the Provider. Check this even when the Run is COMPLETED."
|
|
64791
|
+
})
|
|
64728
64792
|
});
|
|
64729
64793
|
var ProviderResponse = Schema_exports.Struct({
|
|
64730
64794
|
...ProviderOutcome.fields,
|
|
@@ -64749,13 +64813,19 @@ var Run = Schema_exports.Struct({
|
|
|
64749
64813
|
* 像报告末尾的一条脚注;也是这笔付费数据的备份所在。只有 Workspace 成员
|
|
64750
64814
|
* 打得开;里面的 Records 永远不公开。
|
|
64751
64815
|
*/
|
|
64752
|
-
run_url: Schema_exports.String
|
|
64816
|
+
run_url: Schema_exports.String.annotate({
|
|
64817
|
+
description: "Open this Run in the console. Requires Workspace membership."
|
|
64818
|
+
}),
|
|
64753
64819
|
provider: ProviderSlug,
|
|
64754
64820
|
endpoint: EndpointKey,
|
|
64755
64821
|
endpoint_version: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
64756
|
-
status: RunStatus
|
|
64822
|
+
status: RunStatus.annotate({
|
|
64823
|
+
description: "QUEUED or RUNNING: still in progress. COMPLETED: a Provider response is available, including non-2xx responses. FAILED: read failure. STOPPED: stopped before dispatch. Read charge_usd separately from status."
|
|
64824
|
+
}),
|
|
64757
64825
|
/** 仅 FAILED 非 null。 */
|
|
64758
|
-
failure: Schema_exports.NullOr(RunFailure)
|
|
64826
|
+
failure: Schema_exports.NullOr(RunFailure).annotate({
|
|
64827
|
+
description: "Why the Run failed. Non-null only when status is FAILED."
|
|
64828
|
+
}),
|
|
64759
64829
|
input: Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown),
|
|
64760
64830
|
/**
|
|
64761
64831
|
* Provider 的 2xx body,经结构保持的净化(只删敏感字段,不重排业务数据)。
|
|
@@ -64764,14 +64834,24 @@ var Run = Schema_exports.Struct({
|
|
|
64764
64834
|
*/
|
|
64765
64835
|
output: JsonValue,
|
|
64766
64836
|
/** COMPLETED ⇔ 非 null。 */
|
|
64767
|
-
provider_response: Schema_exports.NullOr(ProviderResponse)
|
|
64837
|
+
provider_response: Schema_exports.NullOr(ProviderResponse).annotate({
|
|
64838
|
+
description: "Non-null only when status is COMPLETED.\n\n- For 2xx responses, output contains Provider-native JSON (any shape), or null for an empty body.\n- For non-2xx responses, error contains the Provider's error body and output is null.\n\nSensitive fields are removed from both bodies."
|
|
64839
|
+
}),
|
|
64768
64840
|
/** 实收 Charge(精确 USD 串)。未结算(QUEUED/RUNNING)时为 null,不是 "0.00"。 */
|
|
64769
|
-
charge_usd: Schema_exports.NullOr(UsdAmount)
|
|
64841
|
+
charge_usd: Schema_exports.NullOr(UsdAmount).annotate({
|
|
64842
|
+
description: "Final charge as an exact USD decimal string. Null while QUEUED or RUNNING. A FAILED Run can have a non-zero charge under the Endpoint's Price."
|
|
64843
|
+
}),
|
|
64770
64844
|
/** 产生 charge_usd 的条款。null = 零 Attempt 总则把 Charge 置 0。 */
|
|
64771
|
-
charge_basis: Schema_exports.NullOr(ChargeBasis)
|
|
64845
|
+
charge_basis: Schema_exports.NullOr(ChargeBasis).annotate({
|
|
64846
|
+
description: "Price clause used to calculate the charge. Null before settlement or when no Provider attempt was made."
|
|
64847
|
+
}),
|
|
64772
64848
|
/** stop 请求现在能否被接受。从「派发赢得竞争」这条规则推导,不是从状态猜。 */
|
|
64773
|
-
stoppable: Schema_exports.Boolean
|
|
64774
|
-
|
|
64849
|
+
stoppable: Schema_exports.Boolean.annotate({
|
|
64850
|
+
description: "Whether a stop request can currently be accepted. This does not guarantee that the Run can stop before dispatch."
|
|
64851
|
+
}),
|
|
64852
|
+
stop_requested_at: Schema_exports.NullOr(Timestamp).annotate({
|
|
64853
|
+
description: "When a stop was requested. The Run can still continue if dispatch had already started."
|
|
64854
|
+
}),
|
|
64775
64855
|
created_at: Timestamp,
|
|
64776
64856
|
started_at: Schema_exports.NullOr(Timestamp),
|
|
64777
64857
|
completed_at: Schema_exports.NullOr(Timestamp),
|
|
@@ -64800,11 +64880,15 @@ var RunRequest = Schema_exports.Struct({
|
|
|
64800
64880
|
provider: ProviderSlug,
|
|
64801
64881
|
endpoint: EndpointKey,
|
|
64802
64882
|
/** Provider 原生输入 —— Adapter 只注入凭证与传输,不改字段名。 */
|
|
64803
|
-
input: Schema_exports.optionalKey(
|
|
64883
|
+
input: Schema_exports.optionalKey(
|
|
64884
|
+
Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown).annotate({
|
|
64885
|
+
description: "Provider-native input. Build it from the input_schema returned by Inspect."
|
|
64886
|
+
})
|
|
64887
|
+
),
|
|
64804
64888
|
/** 支持的兼容契约号,不固定 Price;新 Run 按受理时的 Price,已受理 Run 保持原条款。 */
|
|
64805
64889
|
endpoint_version: optionalRequestField(
|
|
64806
64890
|
Schema_exports.Int.check(Schema_exports.isGreaterThan(0)).annotate({
|
|
64807
|
-
description: "Select a supported
|
|
64891
|
+
description: "Select a supported version, or omit for the default. Compatible updates keep the version; unavailable or retired versions return 409. A version does not lock Price: new Runs use the Price at admission, and accepted Runs keep it through settlement."
|
|
64808
64892
|
})
|
|
64809
64893
|
),
|
|
64810
64894
|
/**
|
|
@@ -64887,7 +64971,7 @@ var Limit = Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maxi
|
|
|
64887
64971
|
});
|
|
64888
64972
|
var providerField = (providers) => Schema_exports.optional(
|
|
64889
64973
|
Schema_exports.Literals(["auto", ...providers]).annotate({
|
|
64890
|
-
description:
|
|
64974
|
+
description: "Default auto: select the first eligible Provider in Glasser's preference order. A named Provider must support the request and be allowed by your Key; it does not fall back to another Provider. Available values are listed below."
|
|
64891
64975
|
})
|
|
64892
64976
|
);
|
|
64893
64977
|
var commonFields = {
|
|
@@ -64901,7 +64985,7 @@ var commonFields = {
|
|
|
64901
64985
|
*/
|
|
64902
64986
|
task_id: optionalRequestField(
|
|
64903
64987
|
Schema_exports.String.annotate({
|
|
64904
|
-
description: "
|
|
64988
|
+
description: "Group related Runs, including automatic fallback, under one Task. Reuse a stable string and filter the Runs list by task to retrieve them."
|
|
64905
64989
|
})
|
|
64906
64990
|
),
|
|
64907
64991
|
/**
|
|
@@ -64926,7 +65010,7 @@ var WEB_RESEARCH_PROVIDERS = ["serper", "serpapi", "exa", "dataforseo"];
|
|
|
64926
65010
|
var WebResearchRequest = Schema_exports.Struct({
|
|
64927
65011
|
action: Schema_exports.optional(
|
|
64928
65012
|
Schema_exports.Literals(WEB_RESEARCH_ACTIONS).annotate({
|
|
64929
|
-
description: "Default search
|
|
65013
|
+
description: "Default: search.\n\n- Supply query for search, news, places, scholar, shopping, images, videos, or answer.\n- Supply url for scrape or similar."
|
|
64930
65014
|
})
|
|
64931
65015
|
),
|
|
64932
65016
|
provider: providerField(WEB_RESEARCH_PROVIDERS),
|
|
@@ -64974,7 +65058,7 @@ var COMPANY_INTELLIGENCE_PROVIDERS = [
|
|
|
64974
65058
|
var CompanyIntelligenceRequest = Schema_exports.Struct({
|
|
64975
65059
|
action: Schema_exports.optional(
|
|
64976
65060
|
Schema_exports.Literals(COMPANY_INTELLIGENCE_ACTIONS).annotate({
|
|
64977
|
-
description: "Default enrich. enrich: profile and firmographics
|
|
65061
|
+
description: "Default: enrich. All actions require domain.\n\n- enrich: company profile and firmographics.\n- tech_stack, traffic, funding, news: the corresponding company data.\n- competitors: similar businesses. For competing domains in Google results, use SEO research with organic_competitors."
|
|
64978
65062
|
})
|
|
64979
65063
|
),
|
|
64980
65064
|
provider: providerField(COMPANY_INTELLIGENCE_PROVIDERS),
|
|
@@ -65014,7 +65098,7 @@ var PEOPLE_SEARCH_PROVIDERS = [
|
|
|
65014
65098
|
var PeopleSearchRequest = Schema_exports.Struct({
|
|
65015
65099
|
action: Schema_exports.optional(
|
|
65016
65100
|
Schema_exports.Literals(PEOPLE_SEARCH_ACTIONS).annotate({
|
|
65017
|
-
description: "Default search
|
|
65101
|
+
description: "Default: search.\n\n- search: supply at least one of job_titles, seniorities, locations, company_domain, or keywords.\n- enrich: supply linkedin_url, email, or full_name plus company_domain.\n- find_email: supply full_name and company_domain.\n\nFilters are never silently dropped. With auto, Providers that cannot apply them are skipped; a named Provider that cannot apply them returns 400."
|
|
65018
65102
|
})
|
|
65019
65103
|
),
|
|
65020
65104
|
provider: providerField(PEOPLE_SEARCH_PROVIDERS),
|
|
@@ -65057,7 +65141,14 @@ var SEO_RESEARCH_ACTIONS = [
|
|
|
65057
65141
|
"backlinks_overview",
|
|
65058
65142
|
"backlinks",
|
|
65059
65143
|
"referring_domains",
|
|
65060
|
-
"domain_rating"
|
|
65144
|
+
"domain_rating",
|
|
65145
|
+
"site_audit",
|
|
65146
|
+
"ai_visibility",
|
|
65147
|
+
"keyword_gap",
|
|
65148
|
+
"backlink_gap",
|
|
65149
|
+
"page_audit",
|
|
65150
|
+
"visibility_history",
|
|
65151
|
+
"ai_citations"
|
|
65061
65152
|
];
|
|
65062
65153
|
var SEO_RESEARCH_PROVIDERS = [
|
|
65063
65154
|
"semrush",
|
|
@@ -65069,12 +65160,22 @@ var SEO_RESEARCH_PROVIDERS = [
|
|
|
65069
65160
|
var SeoResearchRequest = Schema_exports.Struct({
|
|
65070
65161
|
action: Schema_exports.optional(
|
|
65071
65162
|
Schema_exports.Literals(SEO_RESEARCH_ACTIONS).annotate({
|
|
65072
|
-
description: "Default keyword_overview
|
|
65163
|
+
description: "Default: keyword_overview.\n\n- keyword_overview: supply one or more keywords.\n- keyword_ideas or serp: supply exactly one keyword in keywords.\n- site_audit: supply domain; limit is the number of pages to crawl (default 20, at most 100). The crawl runs asynchronously.\n- keyword_gap and backlink_gap: supply domain and one to four competitors.\n- page_audit: supply url (one page).\n- visibility_history: supply domain; limit is the number of months (default 12, at most 24).\n- All other actions: supply domain. organic_competitors finds domains ranking for the same keywords; ai_visibility counts how often AI answers cite the domain; ai_citations lists the domain's pages that AI answers cite."
|
|
65073
65164
|
})
|
|
65074
65165
|
),
|
|
65075
65166
|
provider: providerField(SEO_RESEARCH_PROVIDERS),
|
|
65076
65167
|
keywords: Schema_exports.optional(StringList),
|
|
65077
65168
|
domain: Schema_exports.optional(Domain),
|
|
65169
|
+
competitors: Schema_exports.optional(
|
|
65170
|
+
Schema_exports.Array(Domain).check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(4)).annotate({
|
|
65171
|
+
description: "Competitor domains for keyword_gap and backlink_gap, one to four. Full URLs are reduced to their host."
|
|
65172
|
+
})
|
|
65173
|
+
),
|
|
65174
|
+
url: Schema_exports.optional(
|
|
65175
|
+
NonEmpty.check(Schema_exports.isMaxLength(2048)).annotate({
|
|
65176
|
+
description: "One page URL for page_audit, such as https://stripe.com/pricing."
|
|
65177
|
+
})
|
|
65178
|
+
),
|
|
65078
65179
|
country: Schema_exports.optional(CountryCode),
|
|
65079
65180
|
...commonFields
|
|
65080
65181
|
});
|
|
@@ -65092,7 +65193,7 @@ var SocialResearchRequest = Schema_exports.Struct({
|
|
|
65092
65193
|
platform: Schema_exports.Literals(SOCIAL_PLATFORMS),
|
|
65093
65194
|
mode: Schema_exports.optional(
|
|
65094
65195
|
Schema_exports.Literals(SOCIAL_MODES).annotate({
|
|
65095
|
-
description: "Default search. search: posts matching query
|
|
65196
|
+
description: "Default: search. Every platform supports each mode.\n\n- search: posts matching query.\n- profile: account details from handle (Reddit: subreddit). For LinkedIn, supply a person or company url.\n- feed: recent posts or videos from handle. For LinkedIn, supply a company url.\n- post: one post or video from url.\n- find: other social profiles from handle. For LinkedIn, supply a person's profile url; for Reddit, supply query to find subreddits."
|
|
65096
65197
|
})
|
|
65097
65198
|
),
|
|
65098
65199
|
provider: providerField(SOCIAL_RESEARCH_PROVIDERS),
|
|
@@ -65119,7 +65220,7 @@ var MARKET_DATA_ACTIONS = [
|
|
|
65119
65220
|
var MARKET_DATA_PROVIDERS = ["rentcast", "serpapi"];
|
|
65120
65221
|
var MarketDataRequest = Schema_exports.Struct({
|
|
65121
65222
|
action: Schema_exports.Literals(MARKET_DATA_ACTIONS).annotate({
|
|
65122
|
-
description: "property_value
|
|
65223
|
+
description: "Choose the data to retrieve:\n\n- property_value or property_rent: supply address.\n- property_search, listings_sale, or listings_rental: supply address, city plus state, or zip.\n- market_stats: supply zip.\n- stock_quote: supply symbol."
|
|
65123
65224
|
}),
|
|
65124
65225
|
provider: providerField(MARKET_DATA_PROVIDERS),
|
|
65125
65226
|
/** 美国街道地址,如 "5500 Grand Lake Dr, San Antonio, TX 78244"。 */
|
|
@@ -65146,7 +65247,7 @@ var RunInFlight = Run.check(
|
|
|
65146
65247
|
).pipe(HttpApiSchema_exports.status(202));
|
|
65147
65248
|
var IdempotencyKeyHeaders = Schema_exports.Struct({
|
|
65148
65249
|
"idempotency-key": Schema_exports.String.check(Schema_exports.isMinLength(1)).annotate({
|
|
65149
|
-
description: "
|
|
65250
|
+
description: "Generate a unique value for each intended execution (a UUID is recommended). Retry with the same key and execution parameters to retrieve the original Run without a second charge. Changing execution parameters with the same key returns 409; changing task_id or metadata does not update the original Run."
|
|
65150
65251
|
})
|
|
65151
65252
|
});
|
|
65152
65253
|
var operation = (id2, summary, description) => OpenApi_exports.annotations({ identifier: id2, summary, description });
|
|
@@ -65159,7 +65260,7 @@ var endpoints = HttpApiGroup_exports.make("Endpoints").add(
|
|
|
65159
65260
|
operation(
|
|
65160
65261
|
"endpoints-search",
|
|
65161
65262
|
"Search runnable endpoints",
|
|
65162
|
-
"
|
|
65263
|
+
"Find runnable Endpoints by keyword; this returns Endpoint candidates, not business data. Results are ranked by relevance, filtered by your Key's Policy, and include Provider, Endpoint version, Price, and run mode. Compare candidates and Inspect before running.\n\nUse next_cursor for more results. Low scores or the last page do not prove that a capability is absent; try different keywords. Reuse the returned task_id for later calls on the same task."
|
|
65163
65264
|
)
|
|
65164
65265
|
)
|
|
65165
65266
|
).add(
|
|
@@ -65170,8 +65271,8 @@ var endpoints = HttpApiGroup_exports.make("Endpoints").add(
|
|
|
65170
65271
|
}).annotateMerge(
|
|
65171
65272
|
operation(
|
|
65172
65273
|
"endpoints-inspect",
|
|
65173
|
-
"Inspect
|
|
65174
|
-
"
|
|
65274
|
+
"Inspect an Endpoint",
|
|
65275
|
+
"Get an Endpoint's input schema, available output schema, Price, example input, version, run mode, and timeout. Inspect before the first Run and use the returned input_schema and endpoint_version.\n\nAn output_schema of null means no reliable schema is available. Endpoint versions do not lock Price: new Runs use the Price at admission. For sync Endpoints, set your HTTP client timeout above timeout_ms."
|
|
65175
65276
|
)
|
|
65176
65277
|
)
|
|
65177
65278
|
);
|
|
@@ -65193,8 +65294,8 @@ var runs = HttpApiGroup_exports.make("Runs").add(
|
|
|
65193
65294
|
}).annotateMerge(
|
|
65194
65295
|
operation(
|
|
65195
65296
|
"runs-create",
|
|
65196
|
-
"Run an
|
|
65197
|
-
"
|
|
65297
|
+
"Run an Endpoint",
|
|
65298
|
+
"Execute an Endpoint with Provider-native input prepared from Inspect. Glasser checks your Key's Policy and reserves the maximum charge before creating a Run. A refusal creates no Run and no charge. Reuse the same Idempotency-Key and execution parameters to retry without a second execution.\n\n- **200:** the Run has finished. Check its status, Provider response, and charge.\n- **202:** an async Run is still in progress. Use Get Run to read its result. Sync Endpoints always return a finished Run within their published timeout_ms.\n\nCOMPLETED can include a Provider error; check provider_response. Status and charge are independent: a FAILED Run can have a charge."
|
|
65198
65299
|
)
|
|
65199
65300
|
)
|
|
65200
65301
|
).add(
|
|
@@ -65205,8 +65306,10 @@ var runs = HttpApiGroup_exports.make("Runs").add(
|
|
|
65205
65306
|
}).annotateMerge(
|
|
65206
65307
|
operation(
|
|
65207
65308
|
"runs-list",
|
|
65208
|
-
"List
|
|
65209
|
-
|
|
65309
|
+
"List Runs",
|
|
65310
|
+
`Review Runs, newest first. Filter by status, Provider, Endpoint, Task, or metadata, and use next_cursor to read the next page. Only Runs permitted by your Key's Policy are visible.
|
|
65311
|
+
|
|
65312
|
+
Each row is a summary: input and output contain {"omitted": true}, and Provider error bodies are excluded. Use Get a Run for the full input, output, and error details.`
|
|
65210
65313
|
)
|
|
65211
65314
|
)
|
|
65212
65315
|
).add(
|
|
@@ -65217,8 +65320,8 @@ var runs = HttpApiGroup_exports.make("Runs").add(
|
|
|
65217
65320
|
}).annotateMerge(
|
|
65218
65321
|
operation(
|
|
65219
65322
|
"runs-get",
|
|
65220
|
-
"Get
|
|
65221
|
-
"
|
|
65323
|
+
"Get a Run",
|
|
65324
|
+
"Read a Run's current status, result, and charge. Use this to check an unfinished Run or retrieve a previous result.\n\nCheck status and provider_response before using output. A COMPLETED Run can include a Provider error; a FAILED Run can still have a charge."
|
|
65222
65325
|
)
|
|
65223
65326
|
)
|
|
65224
65327
|
).add(
|
|
@@ -65229,8 +65332,8 @@ var runs = HttpApiGroup_exports.make("Runs").add(
|
|
|
65229
65332
|
}).annotateMerge(
|
|
65230
65333
|
operation(
|
|
65231
65334
|
"runs-stop",
|
|
65232
|
-
"Stop a
|
|
65233
|
-
|
|
65335
|
+
"Stop a Run",
|
|
65336
|
+
"Request a stop and check the returned status. Accepting the request does not guarantee that execution stopped.\n\n- **Before dispatch:** the Run becomes STOPPED with no charge. An expired sync deadline takes precedence and produces FAILED with TIMED_OUT.\n- **After dispatch:** the Run continues; stop_requested_at records your request. Its Price determines the final charge.\n- **Already finished:** returns 409."
|
|
65234
65337
|
)
|
|
65235
65338
|
)
|
|
65236
65339
|
);
|
|
@@ -65242,7 +65345,7 @@ var solutionRunErrors = [
|
|
|
65242
65345
|
ERROR_WIRE.InsufficientBalance,
|
|
65243
65346
|
ERROR_WIRE.ServiceUnavailable
|
|
65244
65347
|
];
|
|
65245
|
-
var SOLUTION_RUN_TAIL = "
|
|
65348
|
+
var SOLUTION_RUN_TAIL = "\n\nMaps Glasser fields to a Provider Endpoint and returns a Run with Provider-native output.\n- provider=auto selects the first eligible Provider and tries the next only on PROVIDER_ERROR, TIMED_OUT, or a 503 at admission. No-result and in-flight Runs do not trigger fallback. A named Provider never falls back.\n- Each admitted fallback creates a separate Run with its own charge; the response contains the last Run. Use task_id to find related Runs.\n- Reuse the same Idempotency-Key and execution parameters when retrying. For a QUEUED or RUNNING result, poll Get Run. Check status, provider_response, and charge_usd independently.";
|
|
65246
65349
|
var solutions = HttpApiGroup_exports.make("Solutions").add(
|
|
65247
65350
|
HttpApiEndpoint_exports.post("gtm-web-research", "/v1/solutions/gtm/web_research", {
|
|
65248
65351
|
payload: WebResearchRequest,
|
|
@@ -65253,7 +65356,7 @@ var solutions = HttpApiGroup_exports.make("Solutions").add(
|
|
|
65253
65356
|
operation(
|
|
65254
65357
|
"gtm-web-research",
|
|
65255
65358
|
"Web research",
|
|
65256
|
-
`Search the web, news and
|
|
65359
|
+
`Search the web, news, places, and other public content, retrieve a page, or get an answer with sources. Choose an action and supply a query or URL as described below.${SOLUTION_RUN_TAIL}`
|
|
65257
65360
|
)
|
|
65258
65361
|
)
|
|
65259
65362
|
).add(
|
|
@@ -65266,7 +65369,7 @@ var solutions = HttpApiGroup_exports.make("Solutions").add(
|
|
|
65266
65369
|
operation(
|
|
65267
65370
|
"gtm-company-intelligence",
|
|
65268
65371
|
"Company intelligence",
|
|
65269
|
-
`
|
|
65372
|
+
`Look up a company by domain. Get its profile, technology, traffic, competitors, funding, or news. Omit action for a company profile.${SOLUTION_RUN_TAIL}`
|
|
65270
65373
|
)
|
|
65271
65374
|
)
|
|
65272
65375
|
).add(
|
|
@@ -65278,8 +65381,8 @@ var solutions = HttpApiGroup_exports.make("Solutions").add(
|
|
|
65278
65381
|
}).annotateMerge(
|
|
65279
65382
|
operation(
|
|
65280
65383
|
"gtm-people-search",
|
|
65281
|
-
"
|
|
65282
|
-
`Find
|
|
65384
|
+
"People search",
|
|
65385
|
+
`Find people by job title, seniority, location, or employer. You can also enrich a known person's profile or find their work email. Choose an action and supply its required fields below.${SOLUTION_RUN_TAIL}`
|
|
65283
65386
|
)
|
|
65284
65387
|
)
|
|
65285
65388
|
).add(
|
|
@@ -65291,8 +65394,8 @@ var solutions = HttpApiGroup_exports.make("Solutions").add(
|
|
|
65291
65394
|
}).annotateMerge(
|
|
65292
65395
|
operation(
|
|
65293
65396
|
"gtm-seo-research",
|
|
65294
|
-
"
|
|
65295
|
-
`
|
|
65397
|
+
"SEO research",
|
|
65398
|
+
`Research keyword volume and difficulty, search rankings, backlinks, keyword and backlink gaps against competitors, ranking history, site crawls, single-page checks, and AI answer citations. Choose an action and supply keywords, a domain, or a page URL.${SOLUTION_RUN_TAIL}`
|
|
65296
65399
|
)
|
|
65297
65400
|
)
|
|
65298
65401
|
).add(
|
|
@@ -65304,8 +65407,8 @@ var solutions = HttpApiGroup_exports.make("Solutions").add(
|
|
|
65304
65407
|
}).annotateMerge(
|
|
65305
65408
|
operation(
|
|
65306
65409
|
"gtm-social-research",
|
|
65307
|
-
"Social
|
|
65308
|
-
`Search
|
|
65410
|
+
"Social research",
|
|
65411
|
+
`Search social content or retrieve profiles and posts. Choose a platform and mode, then supply a query, handle, or URL. This Capability only reads data; it does not publish or change content.${SOLUTION_RUN_TAIL}`
|
|
65309
65412
|
)
|
|
65310
65413
|
)
|
|
65311
65414
|
).add(
|
|
@@ -65318,7 +65421,7 @@ var solutions = HttpApiGroup_exports.make("Solutions").add(
|
|
|
65318
65421
|
operation(
|
|
65319
65422
|
"gtm-market-data",
|
|
65320
65423
|
"Market data",
|
|
65321
|
-
`US property
|
|
65424
|
+
`Get US property records, value and rent estimates, listings, or local market statistics. You can also request stock quotes. Choose an action and supply a location or stock symbol.${SOLUTION_RUN_TAIL}`
|
|
65322
65425
|
)
|
|
65323
65426
|
)
|
|
65324
65427
|
);
|
|
@@ -65328,8 +65431,8 @@ var balance = HttpApiGroup_exports.make("Balance").add(
|
|
|
65328
65431
|
}).annotateMerge(
|
|
65329
65432
|
operation(
|
|
65330
65433
|
"balance",
|
|
65331
|
-
"Get balance
|
|
65332
|
-
"
|
|
65434
|
+
"Get balance",
|
|
65435
|
+
"Check your Workspace's funds and how much is available for new Runs. This free request also confirms that your Key works."
|
|
65333
65436
|
)
|
|
65334
65437
|
)
|
|
65335
65438
|
).add(
|
|
@@ -65340,8 +65443,8 @@ var balance = HttpApiGroup_exports.make("Balance").add(
|
|
|
65340
65443
|
}).annotateMerge(
|
|
65341
65444
|
operation(
|
|
65342
65445
|
"balance-history",
|
|
65343
|
-
"List
|
|
65344
|
-
"
|
|
65446
|
+
"List balance history",
|
|
65447
|
+
"Review charges, refunds, top-ups, Grants, and adjustments, newest first. Each entry shows the amount and the balance after it. Filter by kind and use next_cursor to read the next page."
|
|
65345
65448
|
)
|
|
65346
65449
|
)
|
|
65347
65450
|
);
|
|
@@ -65365,6 +65468,7 @@ var glasserApi = HttpApi_exports.make("glasser").add(solutions).add(endpoints).a
|
|
|
65365
65468
|
// src/config.ts
|
|
65366
65469
|
import os from "node:os";
|
|
65367
65470
|
import path5 from "node:path";
|
|
65471
|
+
import { isatty } from "node:tty";
|
|
65368
65472
|
|
|
65369
65473
|
// ../../packages/lib/src/api-key-format.ts
|
|
65370
65474
|
var API_KEY_PREFIX = "gl_";
|
|
@@ -65380,38 +65484,75 @@ function isValidApiKeyFormat(token) {
|
|
|
65380
65484
|
|
|
65381
65485
|
// src/agent.ts
|
|
65382
65486
|
var RULES = [
|
|
65487
|
+
// 这三家会顺带设别家的变量,所以排在被冒认的那一家前面:
|
|
65488
|
+
// Amp 设 CLAUDECODE,Kilo(opencode 的分支)设 OPENCODE,Grok 兼容 Claude Code 插件。
|
|
65489
|
+
{ agent: "amp", vars: ["AMP_CURRENT_THREAD_ID"] },
|
|
65490
|
+
{ agent: "kilo", vars: ["KILO", "KILO_PID"] },
|
|
65491
|
+
{
|
|
65492
|
+
agent: "grok",
|
|
65493
|
+
// GROK_AGENT 用户也会自己设来选 agent;grok 给子进程设的值是 1。
|
|
65494
|
+
vars: [{ name: "GROK_AGENT", equals: "1" }, "GROK_SESSION_ID", "GROK_PLUGIN_ROOT"]
|
|
65495
|
+
},
|
|
65383
65496
|
{ agent: "claude-code", vars: ["CLAUDECODE"] },
|
|
65384
65497
|
{
|
|
65385
65498
|
agent: "codex",
|
|
65386
65499
|
vars: ["CODEX_SANDBOX", "CODEX_THREAD_ID", "CODEX_SANDBOX_NETWORK_DISABLED", "CODEX_CI"]
|
|
65387
65500
|
},
|
|
65388
|
-
{
|
|
65501
|
+
{
|
|
65502
|
+
agent: "cursor",
|
|
65503
|
+
vars: ["CURSOR_AGENT", { name: "CURSOR_EXTENSION_HOST_ROLE", equals: "agent-exec" }]
|
|
65504
|
+
},
|
|
65389
65505
|
{ agent: "gemini-cli", vars: ["GEMINI_CLI"] },
|
|
65390
|
-
|
|
65391
|
-
{ agent: "
|
|
65392
|
-
{
|
|
65506
|
+
// Qwen Code 是 Gemini CLI 的分支,但不设 GEMINI_CLI。
|
|
65507
|
+
{ agent: "qwen-code", vars: ["QWEN_CODE"] },
|
|
65508
|
+
{
|
|
65509
|
+
agent: "hermes",
|
|
65510
|
+
// HERMES_AGENT 会被 execute_code 的环境白名单删掉;HERMES_SESSION_ID 每个入口都设,
|
|
65511
|
+
// HERMES_RPC_SOCKET / HERMES_KERNEL_SENTINEL 只在 execute_code 的内核里有。
|
|
65512
|
+
vars: ["HERMES_AGENT", "HERMES_SESSION_ID", "HERMES_RPC_SOCKET", "HERMES_KERNEL_SENTINEL"]
|
|
65513
|
+
},
|
|
65514
|
+
// 人在 OpenClaw TUI 里开的本地 shell 是 `tui-local`,agent 的命令是 `exec`。
|
|
65515
|
+
{ agent: "openclaw", vars: [{ name: "OPENCLAW_SHELL", equals: "exec" }] },
|
|
65516
|
+
{ agent: "opencode", vars: ["OPENCODE", "OPENCODE_CLIENT"] },
|
|
65393
65517
|
{ agent: "cline", vars: ["CLINE_ACTIVE"] },
|
|
65394
|
-
{ agent: "
|
|
65518
|
+
{ agent: "roo-code", vars: ["ROO_ACTIVE"] },
|
|
65519
|
+
{ agent: "copilot", vars: ["COPILOT_CLI", "COPILOT_AGENT_SESSION_ID", "COPILOT_AGENT"] },
|
|
65520
|
+
{ agent: "augment", vars: ["AUGMENT_AGENT"] },
|
|
65521
|
+
{ agent: "droid", vars: ["FACTORY_SESSION_ID"] },
|
|
65522
|
+
{ agent: "junie", vars: ["MATTERHORN_SESSION_ID", "JUNIE_DATA"] },
|
|
65523
|
+
{ agent: "crush", vars: ["CRUSH"] },
|
|
65524
|
+
{ agent: "pi", vars: ["PI_CODING_AGENT"] },
|
|
65525
|
+
{ agent: "goose", vars: ["GOOSE_TERMINAL"] },
|
|
65526
|
+
{ agent: "warp", vars: ["OZ_RUN_ID", "WARP_RUN_ID"] },
|
|
65395
65527
|
{ agent: "kiro", vars: ["KIRO_SESSION_ID"] },
|
|
65396
|
-
{ agent: "antigravity", vars: ["
|
|
65528
|
+
{ agent: "antigravity", vars: ["ANTIGRAVITY_AGENT"] },
|
|
65397
65529
|
// 宿主变量:Claude Code 的 SDK / 托管入口不一定设 CLAUDECODE;
|
|
65398
65530
|
// 全权限的 Codex Desktop 可能一个 CODEX_* 都不设,只留这一个。
|
|
65399
65531
|
{ agent: "claude-code", vars: ["CLAUDE_CODE_ENTRYPOINT"] },
|
|
65400
|
-
{ agent: "codex", vars: ["CODEX_INTERNAL_ORIGINATOR_OVERRIDE"] }
|
|
65532
|
+
{ agent: "codex", vars: ["CODEX_INTERNAL_ORIGINATOR_OVERRIDE"] },
|
|
65533
|
+
// IDE 终端整体都有的弱信号:人在 Kiro / Antigravity 的终端里手敲也有它们。
|
|
65534
|
+
{ agent: "kiro", vars: [{ name: "TERM_PROGRAM", equals: "kiro" }], noTty: true },
|
|
65535
|
+
{ agent: "antigravity", vars: ["ANTIGRAVITY_CLI_ALIAS"], noTty: true }
|
|
65401
65536
|
];
|
|
65402
65537
|
var SELF_REPORTED = ["AI_AGENT", "AGENT"];
|
|
65538
|
+
var ANONYMOUS_SELF_REPORTS = /* @__PURE__ */ new Set(["1", "true", "yes"]);
|
|
65539
|
+
var nameOf = (signal) => typeof signal === "string" ? signal : signal.name;
|
|
65403
65540
|
var AGENT_ENV_VARS = [
|
|
65404
|
-
.../* @__PURE__ */ new Set([...RULES.flatMap((rule) => rule.vars), ...SELF_REPORTED])
|
|
65541
|
+
.../* @__PURE__ */ new Set([...RULES.flatMap((rule) => rule.vars.map(nameOf)), ...SELF_REPORTED])
|
|
65405
65542
|
];
|
|
65406
65543
|
var MAX_SELF_REPORTED = 32;
|
|
65407
65544
|
var cleanSelfReported = (raw2) => {
|
|
65408
65545
|
const value3 = raw2.trim().toLowerCase().replaceAll(/[^a-z0-9._-]/g, "").slice(0, MAX_SELF_REPORTED);
|
|
65409
|
-
return value3 === "" ? void 0 : value3;
|
|
65546
|
+
return value3 === "" || ANONYMOUS_SELF_REPORTS.has(value3) ? void 0 : value3;
|
|
65410
65547
|
};
|
|
65411
|
-
function detectAgent(env) {
|
|
65412
|
-
const
|
|
65548
|
+
function detectAgent(env, stdinIsTty2) {
|
|
65549
|
+
const matches = (signal) => {
|
|
65550
|
+
const value3 = env(nameOf(signal)) ?? "";
|
|
65551
|
+
return typeof signal === "string" ? value3 !== "" : value3 === signal.equals;
|
|
65552
|
+
};
|
|
65413
65553
|
for (const rule of RULES) {
|
|
65414
|
-
if (rule.
|
|
65554
|
+
if (rule.noTty && stdinIsTty2) continue;
|
|
65555
|
+
if (rule.vars.some(matches)) return rule.agent;
|
|
65415
65556
|
}
|
|
65416
65557
|
for (const name of SELF_REPORTED) {
|
|
65417
65558
|
const value3 = env(name);
|
|
@@ -65473,13 +65614,14 @@ var apiKeyFromEnv = Effect_exports.gen(function* () {
|
|
|
65473
65614
|
}
|
|
65474
65615
|
return Option_exports.some(value3);
|
|
65475
65616
|
});
|
|
65617
|
+
var stdinIsTty = Effect_exports.sync(() => isatty(0));
|
|
65476
65618
|
var codingAgent = Effect_exports.gen(function* () {
|
|
65477
65619
|
const values3 = /* @__PURE__ */ new Map();
|
|
65478
65620
|
for (const name of AGENT_ENV_VARS) {
|
|
65479
65621
|
const raw2 = yield* Config_exports.option(Config_exports.string(name)).pipe(Effect_exports.orDie);
|
|
65480
65622
|
if (Option_exports.isSome(raw2)) values3.set(name, raw2.value);
|
|
65481
65623
|
}
|
|
65482
|
-
return detectAgent((name) => values3.get(name));
|
|
65624
|
+
return detectAgent((name) => values3.get(name), yield* stdinIsTty);
|
|
65483
65625
|
});
|
|
65484
65626
|
var loginCampaignFromEnv = Effect_exports.gen(function* () {
|
|
65485
65627
|
const read2 = (name) => Config_exports.option(Config_exports.string(name)).pipe(
|
|
@@ -66860,7 +67002,7 @@ import os3 from "node:os";
|
|
|
66860
67002
|
import { existsSync as existsSync2, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "node:fs";
|
|
66861
67003
|
import os2 from "node:os";
|
|
66862
67004
|
import path8 from "node:path";
|
|
66863
|
-
var SKILL_MARKDOWN = true ? "---\nname: glasser\nversion: 0.1.75\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" : readFileSync4(new URL("../../api/src/http/skill/SKILL.md", import.meta.url), "utf8");
|
|
67005
|
+
var SKILL_MARKDOWN = true ? "---\nname: glasser\nversion: 0.1.83\ndescription: >\n Reach for this when a task needs external or paid data \u2014 person or company\n enrichment, person/company search, job-posting search, contact unlock, web,\n news, image, video, maps, places, scholar or shopping search, US property\n and rental data, SEC filings, company financials and stock prices, webpage\n 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" : readFileSync4(new URL("../../api/src/http/skill/SKILL.md", import.meta.url), "utf8");
|
|
66864
67006
|
var SKILL_NAME = "glasser";
|
|
66865
67007
|
var absolute = (value3, fallback) => value3 !== void 0 && path8.isAbsolute(value3) ? value3 : fallback;
|
|
66866
67008
|
function agents(env) {
|
|
@@ -66970,7 +67112,7 @@ var skill = Command_exports.make("skill").pipe(
|
|
|
66970
67112
|
// package.json
|
|
66971
67113
|
var package_default = {
|
|
66972
67114
|
name: "@glasser-ai/cli",
|
|
66973
|
-
version: "0.1.
|
|
67115
|
+
version: "0.1.83",
|
|
66974
67116
|
description: "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
|
|
66975
67117
|
license: "MIT",
|
|
66976
67118
|
type: "module",
|
|
@@ -67038,7 +67180,11 @@ var CLI_VERSION = package_default.version;
|
|
|
67038
67180
|
|
|
67039
67181
|
// src/http.ts
|
|
67040
67182
|
var USER_AGENT = `@glasser-ai/cli/${CLI_VERSION}`;
|
|
67041
|
-
var userAgentFor = (agent) =>
|
|
67183
|
+
var userAgentFor = (agent, stdinIsTty2) => [
|
|
67184
|
+
USER_AGENT,
|
|
67185
|
+
...agent === void 0 ? [] : [`AIAgent/${agent}`],
|
|
67186
|
+
`tty/${stdinIsTty2 ? 1 : 0}`
|
|
67187
|
+
].join(" ");
|
|
67042
67188
|
var withClientIdentity = (client, userAgent = USER_AGENT, channel) => client.pipe(
|
|
67043
67189
|
HttpClient_exports.mapRequest((request5) => {
|
|
67044
67190
|
const identified = HttpClientRequest_exports.setHeader(request5, "user-agent", userAgent);
|
|
@@ -67050,8 +67196,9 @@ var HttpClientLayer = HttpClient_exports.layerMergedContext(
|
|
|
67050
67196
|
Effect_exports.gen(function* () {
|
|
67051
67197
|
const client = yield* HttpClient_exports.HttpClient;
|
|
67052
67198
|
const agent = yield* codingAgent;
|
|
67199
|
+
const tty = yield* stdinIsTty;
|
|
67053
67200
|
const dir2 = yield* configDir;
|
|
67054
|
-
return withClientIdentity(client, userAgentFor(agent), channelHeader(readChannel(dir2)));
|
|
67201
|
+
return withClientIdentity(client, userAgentFor(agent, tty), channelHeader(readChannel(dir2)));
|
|
67055
67202
|
})
|
|
67056
67203
|
).pipe(Layer_exports.provide(NodeHttpClient_exports.layerUndici));
|
|
67057
67204
|
|