@glasser-ai/cli 0.1.41 → 0.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/glasser.js +393 -8
  2. package/package.json +1 -1
package/dist/glasser.js CHANGED
@@ -64303,7 +64303,13 @@ var ERROR_STATUS = {
64303
64303
  var CurrentAuth = class extends Context_exports.Service()("CurrentAuth") {
64304
64304
  };
64305
64305
  var Authentication = class extends HttpApiMiddleware_exports.Service()("Authentication", {
64306
- error: ERROR_WIRE.Unauthorized,
64306
+ // 两种拒绝,调用方的正确反应不同:
64307
+ // 401 unauthorized —— Key 不对(格式、hash 查不到、已吊销),换一把 Key。
64308
+ // 403 forbidden —— Key 对,但它的 Workspace 或创建它的 User 处于 Suspension
64309
+ // (`control: "workspace.suspended"` / `"user.suspended"`)。
64310
+ // 换 Key 没用,重试也没用,要找我们。
64311
+ // 用数组而不是 Schema.Union,理由同下面 SchemaErrors 的注释。
64312
+ error: [ERROR_WIRE.Unauthorized, ERROR_WIRE.Forbidden],
64307
64313
  security: { bearer: HttpApiSecurity_exports.bearer }
64308
64314
  }) {
64309
64315
  };
@@ -64343,6 +64349,22 @@ var PriceRule = Schema_exports.Union([
64343
64349
  * 总额仍封在 `cap_usd` 下,所以最大 Charge 在调用之前依然已知。
64344
64350
  */
64345
64351
  partial_usd: Schema_exports.optionalKey(UsdAmount)
64352
+ }),
64353
+ /**
64354
+ * 按 token 计费:Provider 的计量单位就是 token,公开的 Price 照它报。
64355
+ *
64356
+ * 费率按**每 1M input token**,与厂商自己的标价同一个单位。上限仍是
64357
+ * `cap_usd` —— 一次请求的 token 数有 Provider 自己的硬上限,所以最大 Charge
64358
+ * 在调用之前依然已知,v1 的"有界"没有破。
64359
+ *
64360
+ * 只有 input 一条费率:今天接的 Provider(Jev)output 免费。将来两头收费的,
64361
+ * 加的是这个变体上的一个可选字段,不是新变体 —— 这个 union 在 openapi.json 里
64362
+ * 是封闭的 anyOf,多一个成员会让校验响应的客户端整支拒掉。
64363
+ */
64364
+ Schema_exports.Struct({
64365
+ type: Schema_exports.Literal("per_token"),
64366
+ per_million_input_tokens_usd: UsdAmount,
64367
+ cap_usd: UsdAmount
64346
64368
  })
64347
64369
  ]);
64348
64370
  var Price = Schema_exports.Struct({
@@ -64576,6 +64598,267 @@ var RunIdParam = Schema_exports.Struct({
64576
64598
  runId: RunId
64577
64599
  });
64578
64600
 
64601
+ // ../../packages/contract/src/solutions.ts
64602
+ var SOLUTION_IDS = ["gtm"];
64603
+ var SolutionId = Schema_exports.Literals(SOLUTION_IDS);
64604
+ var GTM_CAPABILITIES = [
64605
+ "web_research",
64606
+ "company_intelligence",
64607
+ "people_search",
64608
+ "seo_research",
64609
+ "social_research",
64610
+ "market_data"
64611
+ ];
64612
+ var GtmCapability = Schema_exports.Literals(GTM_CAPABILITIES);
64613
+ var NonEmpty = Schema_exports.String.check(Schema_exports.isMinLength(1));
64614
+ var StringList = Schema_exports.Array(NonEmpty.check(Schema_exports.isMaxLength(200))).check(
64615
+ Schema_exports.isMinLength(1),
64616
+ Schema_exports.isMaxLength(20)
64617
+ );
64618
+ var CountryCode = Schema_exports.String.check(
64619
+ Schema_exports.isMinLength(2),
64620
+ Schema_exports.isMaxLength(60)
64621
+ ).annotate({
64622
+ description: "Country as a two-letter ISO code or a country name, e.g. us, gb, de, Germany. Default us. An unsupported country is refused with the supported list."
64623
+ });
64624
+ var LanguageCode = Schema_exports.String.check(Schema_exports.isPattern(/^[A-Za-z]{2}$/)).annotate({
64625
+ description: "Two-letter language code such as en, de."
64626
+ });
64627
+ var Domain = Schema_exports.String.check(Schema_exports.isMinLength(3), Schema_exports.isMaxLength(253)).annotate({
64628
+ description: "A website domain such as stripe.com. A full URL is accepted and reduced to its host."
64629
+ });
64630
+ var Limit = Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maximum: 100 })).annotate({
64631
+ description: "Rows to return. Keep it small: the routed Endpoint's charge rule may read it. Each capability caps it further."
64632
+ });
64633
+ var providerField = (providers) => Schema_exports.optional(
64634
+ Schema_exports.Literals(["auto", ...providers]).annotate({
64635
+ description: `Data provider: auto (default) or one of ${providers.join(", ")}. Name one only when the caller asks for that vendor.`
64636
+ })
64637
+ );
64638
+ var commonFields = {
64639
+ limit: Schema_exports.optional(Limit)
64640
+ };
64641
+ var WEB_RESEARCH_ACTIONS = [
64642
+ "search",
64643
+ "news",
64644
+ "places",
64645
+ "scholar",
64646
+ "shopping",
64647
+ "images",
64648
+ "videos",
64649
+ "answer",
64650
+ "scrape",
64651
+ "similar"
64652
+ ];
64653
+ var WEB_RESEARCH_PROVIDERS = ["serper", "serpapi", "exa", "dataforseo"];
64654
+ var WebResearchRequest = Schema_exports.Struct({
64655
+ action: Schema_exports.optional(
64656
+ Schema_exports.Literals(WEB_RESEARCH_ACTIONS).annotate({
64657
+ description: "Default search. search, news, places, scholar, shopping, images, videos and answer take query; scrape and similar take url."
64658
+ })
64659
+ ),
64660
+ provider: providerField(WEB_RESEARCH_PROVIDERS),
64661
+ query: Schema_exports.optional(NonEmpty.check(Schema_exports.isMaxLength(500))),
64662
+ url: Schema_exports.optional(NonEmpty.check(Schema_exports.isMaxLength(2048))),
64663
+ /**
64664
+ * 搜索类 action 才有国家和语言;scrape / similar 是一个页面,没有。给了能用国家
64665
+ * 的搜索却点名不看国家的 Provider(Exa、SerpApi 的 places / scholar)是 400,
64666
+ * 不静默丢 —— 同 people_search 的过滤条件。
64667
+ */
64668
+ country: Schema_exports.optional(
64669
+ CountryCode.annotate({
64670
+ description: "Country for search-type actions, as a two-letter ISO code or a country name. Default us. Not for scrape or similar. Refused with 400 when the named provider cannot apply it."
64671
+ })
64672
+ ),
64673
+ language: Schema_exports.optional(
64674
+ LanguageCode.annotate({
64675
+ description: "Language for search-type actions, two letters such as en, de. Not for scrape or similar."
64676
+ })
64677
+ ),
64678
+ ...commonFields
64679
+ });
64680
+ var COMPANY_INTELLIGENCE_ACTIONS = [
64681
+ "enrich",
64682
+ "tech_stack",
64683
+ "traffic",
64684
+ "competitors",
64685
+ "funding",
64686
+ "news"
64687
+ ];
64688
+ var COMPANY_INTELLIGENCE_PROVIDERS = [
64689
+ "apollo",
64690
+ "pdl",
64691
+ "hunter",
64692
+ "prospeo",
64693
+ "predictleads",
64694
+ "leadmagic",
64695
+ "builtwith",
64696
+ "dataforseo",
64697
+ "ahrefs",
64698
+ "apify",
64699
+ "exa",
64700
+ "serper"
64701
+ ];
64702
+ var CompanyIntelligenceRequest = Schema_exports.Struct({
64703
+ action: Schema_exports.optional(
64704
+ Schema_exports.Literals(COMPANY_INTELLIGENCE_ACTIONS).annotate({
64705
+ description: "Default enrich. enrich: profile and firmographics; tech_stack; traffic; competitors: businesses similar to the company (for the domains it competes with in Google results use seo_research organic_competitors); funding; news. All take domain."
64706
+ })
64707
+ ),
64708
+ provider: providerField(COMPANY_INTELLIGENCE_PROVIDERS),
64709
+ domain: Domain,
64710
+ country: Schema_exports.optional(CountryCode),
64711
+ /** 只有 news + serper 读它:用公司名而不是域名搜新闻。 */
64712
+ query: Schema_exports.optional(
64713
+ NonEmpty.check(Schema_exports.isMaxLength(200)).annotate({
64714
+ description: "For news via Serper only: the company name to search Google News by, instead of the domain. Other actions and providers ignore it."
64715
+ })
64716
+ ),
64717
+ ...commonFields
64718
+ });
64719
+ var PEOPLE_SEARCH_ACTIONS = ["search", "enrich", "find_email"];
64720
+ var SENIORITIES = [
64721
+ "owner",
64722
+ "founder",
64723
+ "c_suite",
64724
+ "partner",
64725
+ "vp",
64726
+ "head",
64727
+ "director",
64728
+ "manager",
64729
+ "senior",
64730
+ "entry",
64731
+ "intern"
64732
+ ];
64733
+ var Seniority = Schema_exports.Literals(SENIORITIES);
64734
+ var PEOPLE_SEARCH_PROVIDERS = [
64735
+ "apollo",
64736
+ "pdl",
64737
+ "leadmagic",
64738
+ "zoominfo",
64739
+ "hunter",
64740
+ "prospeo"
64741
+ ];
64742
+ var PeopleSearchRequest = Schema_exports.Struct({
64743
+ action: Schema_exports.optional(
64744
+ Schema_exports.Literals(PEOPLE_SEARCH_ACTIONS).annotate({
64745
+ description: "Default search. search: people matching job_titles, seniorities, locations, company_domain or keywords (at least one); a filter is never silently dropped \u2014 under auto a Provider that cannot apply one of the given filters is skipped, a named Provider that cannot is refused with 400. enrich: one person from linkedin_url, email, or full_name plus company_domain. find_email: the work email of full_name at company_domain."
64746
+ })
64747
+ ),
64748
+ provider: providerField(PEOPLE_SEARCH_PROVIDERS),
64749
+ job_titles: Schema_exports.optional(StringList),
64750
+ seniorities: Schema_exports.optional(
64751
+ Schema_exports.Array(Seniority).check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(SENIORITIES.length)).annotate({
64752
+ description: `Seniority levels, one or more of ${SENIORITIES.join(", ")}.`
64753
+ })
64754
+ ),
64755
+ locations: Schema_exports.optional(StringList),
64756
+ company_domain: Schema_exports.optional(Domain),
64757
+ keywords: Schema_exports.optional(NonEmpty.check(Schema_exports.isMaxLength(300))),
64758
+ full_name: Schema_exports.optional(NonEmpty.check(Schema_exports.isMaxLength(200))),
64759
+ email: Schema_exports.optional(
64760
+ Schema_exports.String.check(
64761
+ Schema_exports.isMaxLength(320),
64762
+ Schema_exports.isPattern(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)
64763
+ ).annotate({
64764
+ description: "An email address."
64765
+ })
64766
+ ),
64767
+ /** 是人的主页(`/in/`),不是公司页:传公司页每家都查不到,有的还收钱。 */
64768
+ linkedin_url: Schema_exports.optional(
64769
+ Schema_exports.String.check(
64770
+ Schema_exports.isMaxLength(2048),
64771
+ Schema_exports.isPattern(/linkedin\.com\/in\/[^/?#\s]+/i)
64772
+ ).annotate({
64773
+ description: "The person's LinkedIn profile URL, linkedin.com/in/<slug>. Not a company page."
64774
+ })
64775
+ ),
64776
+ ...commonFields
64777
+ });
64778
+ var SEO_RESEARCH_ACTIONS = [
64779
+ "keyword_overview",
64780
+ "keyword_ideas",
64781
+ "serp",
64782
+ "domain_overview",
64783
+ "ranked_keywords",
64784
+ "organic_competitors",
64785
+ "backlinks_overview",
64786
+ "backlinks",
64787
+ "referring_domains",
64788
+ "domain_rating"
64789
+ ];
64790
+ var SEO_RESEARCH_PROVIDERS = [
64791
+ "semrush",
64792
+ "serpstat",
64793
+ "dataforseo",
64794
+ "ahrefs",
64795
+ "serper"
64796
+ ];
64797
+ var SeoResearchRequest = Schema_exports.Struct({
64798
+ action: Schema_exports.optional(
64799
+ Schema_exports.Literals(SEO_RESEARCH_ACTIONS).annotate({
64800
+ description: "Default keyword_overview. keyword_overview takes keywords (several at once); keyword_ideas and serp take exactly one keyword in keywords; domain_overview, ranked_keywords, organic_competitors (domains ranking for the same keywords), backlinks_overview, backlinks, referring_domains and domain_rating take domain."
64801
+ })
64802
+ ),
64803
+ provider: providerField(SEO_RESEARCH_PROVIDERS),
64804
+ keywords: Schema_exports.optional(StringList),
64805
+ domain: Schema_exports.optional(Domain),
64806
+ country: Schema_exports.optional(CountryCode),
64807
+ ...commonFields
64808
+ });
64809
+ var SOCIAL_PLATFORMS = [
64810
+ "reddit",
64811
+ "x",
64812
+ "youtube",
64813
+ "tiktok",
64814
+ "instagram",
64815
+ "linkedin"
64816
+ ];
64817
+ var SOCIAL_MODES = ["search", "profile", "feed", "post", "find"];
64818
+ var SOCIAL_RESEARCH_PROVIDERS = ["scrapecreators", "apify", "tikhub"];
64819
+ var SocialResearchRequest = Schema_exports.Struct({
64820
+ platform: Schema_exports.Literals(SOCIAL_PLATFORMS),
64821
+ mode: Schema_exports.optional(
64822
+ Schema_exports.Literals(SOCIAL_MODES).annotate({
64823
+ description: "Default search. search: posts matching query. profile: the account itself \u2014 bio, follower counts, links \u2014 from handle (reddit: the subreddit; linkedin: url of a person's profile or a company page). feed: the account's recent posts or videos, from handle (linkedin: url of a company page). post: one post or video from url. find: an account's other social profiles, from handle."
64824
+ })
64825
+ ),
64826
+ provider: providerField(SOCIAL_RESEARCH_PROVIDERS),
64827
+ query: Schema_exports.optional(NonEmpty.check(Schema_exports.isMaxLength(500))),
64828
+ handle: Schema_exports.optional(
64829
+ NonEmpty.check(Schema_exports.isMaxLength(100)).annotate({
64830
+ description: "A username without @, or a subreddit name without r/."
64831
+ })
64832
+ ),
64833
+ url: Schema_exports.optional(NonEmpty.check(Schema_exports.isMaxLength(2048)))
64834
+ // 没有 limit:社交端点按游标翻页,没有一个收行数;收下又不读是撒谎。
64835
+ });
64836
+ var MARKET_DATA_ACTIONS = [
64837
+ "property_value",
64838
+ "property_rent",
64839
+ "property_search",
64840
+ "listings_sale",
64841
+ "listings_rental",
64842
+ "market_stats",
64843
+ "stock_quote"
64844
+ ];
64845
+ var MARKET_DATA_PROVIDERS = ["rentcast", "serpapi"];
64846
+ var MarketDataRequest = Schema_exports.Struct({
64847
+ action: Schema_exports.Literals(MARKET_DATA_ACTIONS).annotate({
64848
+ description: "property_value and property_rent take address. property_search, listings_sale and listings_rental take address, or city plus state, or zip. market_stats takes zip. stock_quote takes symbol."
64849
+ }),
64850
+ provider: providerField(MARKET_DATA_PROVIDERS),
64851
+ /** 美国街道地址,如 "5500 Grand Lake Dr, San Antonio, TX 78244"。 */
64852
+ address: Schema_exports.optional(NonEmpty.check(Schema_exports.isMaxLength(300))),
64853
+ city: Schema_exports.optional(NonEmpty.check(Schema_exports.isMaxLength(100))),
64854
+ /** 两位州码。 */
64855
+ state: Schema_exports.optional(Schema_exports.String.check(Schema_exports.isPattern(/^[A-Za-z]{2}$/))),
64856
+ zip: Schema_exports.optional(Schema_exports.String.check(Schema_exports.isPattern(/^\d{5}$/))),
64857
+ /** 行情代码,如 "AAPL:NASDAQ"。 */
64858
+ symbol: Schema_exports.optional(NonEmpty.check(Schema_exports.isMaxLength(40))),
64859
+ ...commonFields
64860
+ });
64861
+
64579
64862
  // ../../packages/contract/src/api.ts
64580
64863
  var RunTerminal = Run.check(
64581
64864
  Schema_exports.makeFilter((run7) => isTerminalRunStatus(run7.status), {
@@ -64587,6 +64870,11 @@ var RunInFlight = Run.check(
64587
64870
  description: "an in-flight run: QUEUED or RUNNING"
64588
64871
  })
64589
64872
  ).pipe(HttpApiSchema_exports.status(202));
64873
+ var IdempotencyKeyHeaders = Schema_exports.Struct({
64874
+ "idempotency-key": Schema_exports.String.check(Schema_exports.isMinLength(1)).annotate({
64875
+ description: "A caller-generated idempotency key (a UUID is recommended). One key binds to one run: a retry with the same key after a network timeout is a read, not a second execution."
64876
+ })
64877
+ });
64590
64878
  var operation = (id2, summary, description) => OpenApi_exports.annotations({ identifier: id2, summary, description });
64591
64879
  var endpoints = HttpApiGroup_exports.make("Endpoints").add(
64592
64880
  HttpApiEndpoint_exports.post("endpoints-search", "/v1/endpoints/search", {
@@ -64616,11 +64904,7 @@ var endpoints = HttpApiGroup_exports.make("Endpoints").add(
64616
64904
  var runs = HttpApiGroup_exports.make("Runs").add(
64617
64905
  HttpApiEndpoint_exports.post("runs-create", "/v1/runs", {
64618
64906
  payload: RunRequest,
64619
- headers: Schema_exports.Struct({
64620
- "idempotency-key": Schema_exports.String.check(Schema_exports.isMinLength(1)).annotate({
64621
- description: "A caller-generated idempotency key (a UUID is recommended). One key binds to one run: a retry with the same key after a network timeout is a read, not a second execution."
64622
- })
64623
- }),
64907
+ headers: IdempotencyKeyHeaders,
64624
64908
  success: [RunTerminal, RunInFlight],
64625
64909
  error: [
64626
64910
  ERROR_WIRE.ValidationFailed,
@@ -64676,6 +64960,94 @@ var runs = HttpApiGroup_exports.make("Runs").add(
64676
64960
  )
64677
64961
  )
64678
64962
  );
64963
+ var solutionRunErrors = [
64964
+ ERROR_WIRE.ValidationFailed,
64965
+ ERROR_WIRE.IdempotencyKeyRequired,
64966
+ ERROR_WIRE.IdempotencyConflict,
64967
+ ERROR_WIRE.EndpointNotPermitted,
64968
+ ERROR_WIRE.InsufficientBalance,
64969
+ ERROR_WIRE.ServiceUnavailable
64970
+ ];
64971
+ var SOLUTION_RUN_TAIL = " Routes to one Endpoint per action; provider auto picks the first preferred Provider this key may run, a named provider forces it. The response is exactly the Run that POST /v1/runs returns \u2014 provider-native output, exact charge_usd, run_url; its provider, endpoint and input say which Endpoint served the call. Under auto, a Provider error, timeout or rate limit falls back to the next preferred Provider; a no-result answer does not. Each fallback hop is its own Run, visible in the runs list. Idempotency-Key is required and behaves exactly as on POST /v1/runs.";
64972
+ var solutions = HttpApiGroup_exports.make("Solutions").add(
64973
+ HttpApiEndpoint_exports.post("gtm-web-research", "/v1/solutions/gtm/web_research", {
64974
+ payload: WebResearchRequest,
64975
+ headers: IdempotencyKeyHeaders,
64976
+ success: [RunTerminal, RunInFlight],
64977
+ error: solutionRunErrors
64978
+ }).annotateMerge(
64979
+ operation(
64980
+ "gtm-web-research",
64981
+ "Web research",
64982
+ `Search the web, news and places, read a page's content, or get an answer with sources. Actions search, news, places, scholar, shopping, images, videos and answer take query; scrape and similar take url. Providers: Serper, SerpApi, Exa, DataForSEO.${SOLUTION_RUN_TAIL}`
64983
+ )
64984
+ )
64985
+ ).add(
64986
+ HttpApiEndpoint_exports.post("gtm-company-intelligence", "/v1/solutions/gtm/company_intelligence", {
64987
+ payload: CompanyIntelligenceRequest,
64988
+ headers: IdempotencyKeyHeaders,
64989
+ success: [RunTerminal, RunInFlight],
64990
+ error: solutionRunErrors
64991
+ }).annotateMerge(
64992
+ operation(
64993
+ "gtm-company-intelligence",
64994
+ "Company intelligence",
64995
+ `From a domain, get the company profile and firmographics, technology stack, website traffic, similar companies, funding rounds or news. Providers: Apollo, People Data Labs, Hunter, Prospeo, PredictLeads, LeadMagic, BuiltWith, DataForSEO, Ahrefs, Apify, Exa, Serper.${SOLUTION_RUN_TAIL}`
64996
+ )
64997
+ )
64998
+ ).add(
64999
+ HttpApiEndpoint_exports.post("gtm-people-search", "/v1/solutions/gtm/people_search", {
65000
+ payload: PeopleSearchRequest,
65001
+ headers: IdempotencyKeyHeaders,
65002
+ success: [RunTerminal, RunInFlight],
65003
+ error: solutionRunErrors
65004
+ }).annotateMerge(
65005
+ operation(
65006
+ "gtm-people-search",
65007
+ "Find prospects",
65008
+ `Find contacts by title, seniority, location or employer, enrich one person's profile, or find a work email. Providers: Apollo, People Data Labs, LeadMagic, ZoomInfo, Hunter, Prospeo.${SOLUTION_RUN_TAIL}`
65009
+ )
65010
+ )
65011
+ ).add(
65012
+ HttpApiEndpoint_exports.post("gtm-seo-research", "/v1/solutions/gtm/seo_research", {
65013
+ payload: SeoResearchRequest,
65014
+ headers: IdempotencyKeyHeaders,
65015
+ success: [RunTerminal, RunInFlight],
65016
+ error: solutionRunErrors
65017
+ }).annotateMerge(
65018
+ operation(
65019
+ "gtm-seo-research",
65020
+ "Keywords and SEO",
65021
+ `Keyword volume and difficulty, keyword ideas, Google results for a keyword, a domain's organic overview, ranking keywords and organic competitors, backlink totals and rows, referring domains, domain rating. Providers: Semrush, Serpstat, DataForSEO, Ahrefs, Serper.${SOLUTION_RUN_TAIL}`
65022
+ )
65023
+ )
65024
+ ).add(
65025
+ HttpApiEndpoint_exports.post("gtm-social-research", "/v1/solutions/gtm/social_research", {
65026
+ payload: SocialResearchRequest,
65027
+ headers: IdempotencyKeyHeaders,
65028
+ success: [RunTerminal, RunInFlight],
65029
+ error: solutionRunErrors
65030
+ }).annotateMerge(
65031
+ operation(
65032
+ "gtm-social-research",
65033
+ "Social media search",
65034
+ `Search posts, read a profile or channel, fetch one post, or find an account's other profiles on Reddit, X, YouTube, TikTok, Instagram and LinkedIn. Read-only. Takes platform and mode instead of action. Providers: ScrapeCreators, Apify, TikHub.${SOLUTION_RUN_TAIL}`
65035
+ )
65036
+ )
65037
+ ).add(
65038
+ HttpApiEndpoint_exports.post("gtm-market-data", "/v1/solutions/gtm/market_data", {
65039
+ payload: MarketDataRequest,
65040
+ headers: IdempotencyKeyHeaders,
65041
+ success: [RunTerminal, RunInFlight],
65042
+ error: solutionRunErrors
65043
+ }).annotateMerge(
65044
+ operation(
65045
+ "gtm-market-data",
65046
+ "Market data",
65047
+ `US property values, rent estimates, property records, for-sale and rental listings, ZIP-code market statistics, and stock quotes. Providers: RentCast, SerpApi.${SOLUTION_RUN_TAIL}`
65048
+ )
65049
+ )
65050
+ );
64679
65051
  var balance = HttpApiGroup_exports.make("Balance").add(
64680
65052
  HttpApiEndpoint_exports.get("balance", "/v1/balance", {
64681
65053
  success: BalanceResponse
@@ -64699,7 +65071,7 @@ var balance = HttpApiGroup_exports.make("Balance").add(
64699
65071
  )
64700
65072
  )
64701
65073
  );
64702
- var glasserApi = HttpApi_exports.make("glasser").add(endpoints).add(runs).add(balance).middleware(RateLimit).middleware(Authentication).middleware(SchemaErrors).annotateMerge(
65074
+ var glasserApi = HttpApi_exports.make("glasser").add(solutions).add(endpoints).add(runs).add(balance).middleware(RateLimit).middleware(Authentication).middleware(SchemaErrors).annotateMerge(
64703
65075
  OpenApi_exports.annotations({
64704
65076
  title: "Glasser",
64705
65077
  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."
@@ -65151,6 +65523,9 @@ var balance2 = balanceRoot.pipe(Command_exports.withSubcommands([history]));
65151
65523
  // ../../packages/lib/src/price-line.ts
65152
65524
  function priceRuleParts(rule) {
65153
65525
  if (rule.type === "flat") return { main: `$${rule.amount_usd}/call`, cap: null };
65526
+ if (rule.type === "per_token") {
65527
+ return { main: `$${rule.per_million_input_tokens_usd}/1M input tokens`, cap: rule.cap_usd };
65528
+ }
65154
65529
  return { main: `$${rule.per_result_usd}/result`, cap: rule.cap_usd };
65155
65530
  }
65156
65531
  function priceRuleLine(rule) {
@@ -65522,6 +65897,14 @@ function pollUntilDone(options4) {
65522
65897
  message: "This authorization was already redeemed elsewhere. If that was not you, revoke the Key in the console; then run `glasser login` again."
65523
65898
  });
65524
65899
  }
65900
+ if (response.status === 403) {
65901
+ const refusal = yield* response.json.pipe(Effect_exports.catch(() => Effect_exports.succeed(null)));
65902
+ const message = refusal?.error?.message;
65903
+ return yield* new LoginFailed({
65904
+ code: "login_forbidden",
65905
+ message: typeof message === "string" ? message : "The server refused to create a Key for this sign-in."
65906
+ });
65907
+ }
65525
65908
  if (response.status !== 200) return null;
65526
65909
  const body = yield* decodeJson(PollResponse, response).pipe(
65527
65910
  Effect_exports.catch(() => Effect_exports.succeed(null))
@@ -66005,7 +66388,7 @@ var runs2 = Command_exports.make("runs").pipe(
66005
66388
  // package.json
66006
66389
  var package_default = {
66007
66390
  name: "@glasser-ai/cli",
66008
- version: "0.1.41",
66391
+ version: "0.1.46",
66009
66392
  description: "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
66010
66393
  license: "MIT",
66011
66394
  type: "module",
@@ -66160,6 +66543,7 @@ function renderJson(failure) {
66160
66543
  message: failure.message,
66161
66544
  // 只省略 undefined:null 是 API 明确说的"没有可退避的时长",要照传。
66162
66545
  ...failure.retryAfterMs === void 0 ? {} : { retry_after_ms: failure.retryAfterMs },
66546
+ ...failure.control === void 0 ? {} : { control: failure.control },
66163
66547
  ...failure.details === void 0 ? {} : { details: failure.details },
66164
66548
  ...failure.hint === void 0 ? {} : { hint: failure.hint }
66165
66549
  },
@@ -66227,6 +66611,7 @@ function describeApiCause(cause, requestId) {
66227
66611
  // 这里逐字段重建,信封上不搬过来的字段就丢了 —— API 的 429 消息说"看
66228
66612
  // retry_after_ms",数字必须跟着到达。
66229
66613
  ...envelope.retry_after_ms === void 0 ? {} : { retryAfterMs: envelope.retry_after_ms },
66614
+ ...typeof envelope.control === "string" ? { control: envelope.control } : {},
66230
66615
  ...envelope.details === void 0 ? {} : { details: envelope.details },
66231
66616
  ...hintFor(envelope),
66232
66617
  exitCode: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasser-ai/cli",
3
- "version": "0.1.41",
3
+ "version": "0.1.46",
4
4
  "description": "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",