@sortlist/cli 0.64.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/{chunk-RCCV6ET2.js → chunk-R7GAJC42.js} +15 -1
- package/dist/chunk-R7GAJC42.js.map +1 -0
- package/dist/core.d.ts +12 -1
- package/dist/core.js +11 -3
- package/dist/index.js +2 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/sortlist-cli/SKILL.md +8 -1
- package/skills/sortlist-cli/references/billing-and-permissions.md +5 -0
- package/skills/sortlist-cli/references/identity-and-accounts.md +7 -0
- package/skills/sortlist-cli/references/value-and-growth.md +163 -0
- package/skills/sortlist-go-to-market/SKILL.md +6 -0
- package/dist/chunk-RCCV6ET2.js.map +0 -1
package/package.json
CHANGED
|
@@ -110,6 +110,9 @@ missing first page.
|
|
|
110
110
|
|
|
111
111
|
## Costs and permission
|
|
112
112
|
|
|
113
|
+
The same rules apply when the Sortlist connector (`https://mcp.sortlist.com/mcp`) runs the call
|
|
114
|
+
instead of `sl`: its `_reveal` tools take `maxCredits` as the approved ceiling.
|
|
115
|
+
|
|
113
116
|
Read [billing-and-permissions.md](references/billing-and-permissions.md) before quoting a paid
|
|
114
117
|
operation, revealing data, changing billing, or reporting spend. Three quantities differ:
|
|
115
118
|
|
|
@@ -143,6 +146,10 @@ units separately from verified or estimated billing credits and mark incomplete
|
|
|
143
146
|
scheduler. A plan for a future action is not evidence that it is scheduled.
|
|
144
147
|
- For Hermes company membership, invitations, applications, credentials and subscriptions, read
|
|
145
148
|
[identity-and-accounts.md](references/identity-and-accounts.md). Keep secrets out of files and logs.
|
|
149
|
+
- When credits or a verified plan limit affect the task, or the user asks about referrals or a useful
|
|
150
|
+
handoff, read [value and growth](references/value-and-growth.md). Preserve the work, offer a relevant
|
|
151
|
+
available way forward and retain the user's choice. A referral reward needs an actual program;
|
|
152
|
+
company access and email access do not authorize inviting outside friends.
|
|
146
153
|
|
|
147
154
|
## Errors
|
|
148
155
|
|
|
@@ -153,7 +160,7 @@ units separately from verified or estimated billing credits and mark incomplete
|
|
|
153
160
|
| Company/token refused (exit 4) | Verify caller, membership and intended `--company`; do not retry against another payer silently. |
|
|
154
161
|
| `INVALID_INTERACTION`, expired `after` | The previous search cannot be paginated; consider a new search explicitly within scope and budget. |
|
|
155
162
|
| Subscription timeout or still filling (exit 5) | Preserve context and use the recovery rules above. |
|
|
156
|
-
| `INSUFFICIENT_CREDITS` | Stop paid work, report the payer and
|
|
163
|
+
| `INSUFFICIENT_CREDITS` | Stop paid work, preserve the selection, report the payer and readable shortfall, and use the value-and-growth guidance for a useful scope or funding choice. |
|
|
157
164
|
| Endpoint unreachable (exit 3) | Check endpoint and connectivity; do not switch environments to make an error disappear. |
|
|
158
165
|
|
|
159
166
|
Exit 1 covers GraphQL or business errors. `SL_DEBUG=1` prints queries, variables and responses;
|
|
@@ -50,6 +50,11 @@ a no-reveal preview within the user's constraints, and prepare the exact paid co
|
|
|
50
50
|
missing pricing question if needed. A request for "spend no more than X" does not make an unknown
|
|
51
51
|
price safe.
|
|
52
52
|
|
|
53
|
+
If the next scoped lot exceeds the readable balance or a verified plan limit, preserve the work and
|
|
54
|
+
use [value and growth](value-and-growth.md) to offer a useful smaller scope or an actually available
|
|
55
|
+
funding route. Pending referral rewards are not spendable balance; a credit shortfall is not
|
|
56
|
+
permission to send invitations, buy credits or change a subscription.
|
|
57
|
+
|
|
53
58
|
For Atlas, calculate conservatively over every possibly new dimension on every selected record:
|
|
54
59
|
|
|
55
60
|
```text
|
|
@@ -94,6 +94,13 @@ Read help, prepare the exact change and obtain any authorization missing from th
|
|
|
94
94
|
| `cancel-company-subscription` | Can end access immediately and forfeit the remaining period; verify the current effect. |
|
|
95
95
|
| `create-company-billing-portal-session` | Returns a billing management URL for the user to open themselves. |
|
|
96
96
|
|
|
97
|
+
Company invitations are access grants, not a referral or credit-reward mechanism. For a requested
|
|
98
|
+
collaboration, ensure the available access fits the intended recipient; an email label may not bind
|
|
99
|
+
the invitation to that address, and a created code is not proof of an email sent. Use
|
|
100
|
+
[value and growth](value-and-growth.md) for an actual referral program or a private handoff that
|
|
101
|
+
does not require broader membership. A billing portal link does not establish an available checkout
|
|
102
|
+
or top-up; discover its actual capabilities before offering one.
|
|
103
|
+
|
|
97
104
|
Never disclose invitation codes beyond the intended user. Return a newly created secret only to
|
|
98
105
|
the authorized user for storage and never place it in a file, shared log or later repeat. Record
|
|
99
106
|
non-secret credential IDs for management instead. `sl token` prints a bearer token; do not echo
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Help the customer get more value
|
|
2
|
+
|
|
3
|
+
Read when an observed credit or plan limit affects the task, the user asks about plans or referrals,
|
|
4
|
+
or their requested handoff or recurring work creates a useful collaboration or return path.
|
|
5
|
+
Ordinary searches and refinements need no commercial suggestion. Deliver the useful result first;
|
|
6
|
+
when a limit intervenes, preserve the work and explain the smallest decision that unlocks progress.
|
|
7
|
+
|
|
8
|
+
## Choose a helpful moment
|
|
9
|
+
|
|
10
|
+
Use the customer's next objective and observed account state, rather than a generic sales prompt.
|
|
11
|
+
Keep technical checks behind the conversation. Match the customer's language.
|
|
12
|
+
|
|
13
|
+
| Observed moment | Useful action | Growth opportunity, when supported |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| The next approved lot costs more than the readable balance | Save the selection and quote. Show the balance, cost and shortfall; reuse owned data or offer a useful smaller lot. | Offer an eligible referral program or a verified funding route if it solves the timing and shortfall. |
|
|
16
|
+
| A first usable result is ready and the user has named a colleague who should act on it | Prepare a private, concise handoff explaining the selection, reasons and next action. | Offer the appropriate collaboration access only if it fits that person's role. An external example can use a reusable method or synthetic data instead. |
|
|
17
|
+
| The user wants the same job again | Retain a reusable brief and exclusions in supported task state; give a short way to resume. | A requested recurring flow may justify an available watcher or plan, with its actual caps and cost. Saving a recipe does not start monitoring. |
|
|
18
|
+
| A verified plan limit repeatedly prevents the requested volume or feature | Compare the current plan with the smallest available option that covers the observed need. | Explain the incremental benefit and total price; a top-up or smaller run may fit better than a new subscription. |
|
|
19
|
+
| The user asks to recommend the product or earn credits | Read the actual referral terms and eligibility, then prepare a useful invitation for people the user chooses. | Give the returned referral link and track supported outcomes, rather than asking the user to describe the program. |
|
|
20
|
+
| The user comes back with a prior list or unfinished task | Reuse the brief, selection, owned fields and last decision. | Resume toward the next useful outcome without repeating onboarding, repurchasing data or repeating a declined offer. |
|
|
21
|
+
|
|
22
|
+
A small balance alone is not an urgent limit. Compare it with the next scoped quote; if it covers
|
|
23
|
+
the task, continue. Missing balance is unknown, not zero. An access or scope error is not evidence
|
|
24
|
+
that buying a plan grants permission. Use [billing](billing-and-permissions.md) and
|
|
25
|
+
[identity](identity-and-accounts.md) for actual reads, prices and permissions.
|
|
26
|
+
Keep credits and offers scoped to the actual company, environment and product; do not assume
|
|
27
|
+
credits transfer between products. Respect the returned balance contract: a balance already net
|
|
28
|
+
of open reservations must not have those reservations subtracted again.
|
|
29
|
+
|
|
30
|
+
Offer at most one relevant commercial suggestion per task, alongside an honest way to continue
|
|
31
|
+
with existing data, reduce scope or stop. Answer explicit follow-up questions normally. Keep a
|
|
32
|
+
declined suggestion suppressed for the same objective until the user asks or material facts change;
|
|
33
|
+
another page or a new chat is not by itself a reason to repeat it. Reuse a supplied preference for
|
|
34
|
+
no upgrade or referral suggestions. A technical error or poor result calls for a fix, not a pitch.
|
|
35
|
+
If no relevant, available option improves the outcome, leave the suggestion out.
|
|
36
|
+
|
|
37
|
+
## Credit recovery without losing momentum
|
|
38
|
+
|
|
39
|
+
Keep the result already earned usable. Give the customer a simple choice with concrete consequences,
|
|
40
|
+
for example: "Your list is saved. The next step needs 80 credits; you have 60. We can unlock a useful
|
|
41
|
+
smaller group now or keep the full selection ready for later." These numbers are illustrative;
|
|
42
|
+
use the actual selection, ownership, price and balance before making such a claim. Do not spend
|
|
43
|
+
or alter the selected records to fit a budget without an existing authorization covering that change.
|
|
44
|
+
|
|
45
|
+
When a referral offer is actually available, relate it to the job: "This program awards credits
|
|
46
|
+
after an eligible friend completes the stated step. It can help with a later batch; it will not
|
|
47
|
+
unlock today's batch immediately." Only say this if the program's actual timing supports it.
|
|
48
|
+
Show the reward and condition plainly. Never suggest that sending an invitation itself refills a
|
|
49
|
+
balance unless that is the verified rule, or count pending rewards as spendable credits.
|
|
50
|
+
|
|
51
|
+
For an available plan or credit purchase, compare the right unit: one-off versus recurring need,
|
|
52
|
+
credits required, included allowance, renewal, expiry, immediate/prorated charge and cancellation
|
|
53
|
+
effect where relevant. Use returned catalog/quote information or official terms actually available
|
|
54
|
+
to the user. Do not invent a top-up, discount, trial, checkout URL or monetary conversion from the
|
|
55
|
+
unit-price table. A billing portal may manage cards and invoices without supporting a purchase.
|
|
56
|
+
If the needed commercial route is unavailable, retain the work and explain that specific limit.
|
|
57
|
+
Check a readable upcoming renewal or already scheduled plan change before proposing another change;
|
|
58
|
+
an expected future allowance is not credit available now.
|
|
59
|
+
|
|
60
|
+
## Referral is separate from company access
|
|
61
|
+
|
|
62
|
+
Check discovery and available first-party program information before offering a reward. Establish:
|
|
63
|
+
|
|
64
|
+
- The active program and this account's eligibility, including whether existing users qualify.
|
|
65
|
+
- Who receives which reward, in what units, and the qualifying action, delay, caps and expiry.
|
|
66
|
+
- The official referral link or supported invitation action and the new user's intended destination.
|
|
67
|
+
- Which status and reward records the available tools can actually read.
|
|
68
|
+
|
|
69
|
+
If the program or essential terms cannot be verified, omit the reward offer and use an available
|
|
70
|
+
alternative. Do not invent `sl referral` commands or make the customer supply a nonexistent tariff
|
|
71
|
+
or program. A user-requested recommendation can still have a prepared message without a reward claim.
|
|
72
|
+
Do not substitute an administrative credit grant for a referral program.
|
|
73
|
+
|
|
74
|
+
An invitation to join the paying company is **not** a referral. Company membership can grant
|
|
75
|
+
application and credential management access. The invitation email may be a label rather than an
|
|
76
|
+
enforced recipient restriction, and creating a code does not prove email delivery. Never use
|
|
77
|
+
`create-company-invitation` to invite outside friends for credits. For a requested teammate,
|
|
78
|
+
verify the intended company, recipient and access effect through the
|
|
79
|
+
[membership workflow](identity-and-accounts.md#hermes-operations-and-effects). If the available role
|
|
80
|
+
is broader than the requested collaboration, offer a private handoff instead of granting that access.
|
|
81
|
+
|
|
82
|
+
Having email access or Atlas contact details is not permission to recruit those people. Use people
|
|
83
|
+
the user names or a recipient-selection task they explicitly request. Do not mine an inbox, address
|
|
84
|
+
book or prospect list to build a referral audience. Prepare recipient, sender, channel, destination
|
|
85
|
+
and exact message before any missing sending authorization. Reuse an existing specific approval;
|
|
86
|
+
a generic desire for more credits does not authorize sending. Keep the choice personal and useful,
|
|
87
|
+
with no automatic follow-up sequence or claimed mutual relationship.
|
|
88
|
+
|
|
89
|
+
Make the invitation useful to the recipient: one relevant outcome they can try and the genuine
|
|
90
|
+
referral benefit, if any. Share the reusable method or synthetic example, not the inviter's private
|
|
91
|
+
prospects, customer context or paid data. Keep the account invitation or referral link out of a
|
|
92
|
+
public export unless the user has specifically chosen that publication.
|
|
93
|
+
|
|
94
|
+
## Track the outcome that actually happened
|
|
95
|
+
|
|
96
|
+
Use existing authorized task state for conversational continuity. If durable state is unavailable,
|
|
97
|
+
use the current conversation and disclose that limit when it matters. Do not create an analytics
|
|
98
|
+
endpoint, external upload, tracking pixel, scheduled poll or hidden follow-up. Product telemetry
|
|
99
|
+
requires an existing documented collection mechanism; a skill instruction does not implement one.
|
|
100
|
+
When saving a reusable brief, return a supported private attachment/link or a short copyable recipe
|
|
101
|
+
so the customer can take it to another chat. Explain when resumption needs that artifact; a saved
|
|
102
|
+
local file alone is not evidence that a different chat can retrieve it automatically.
|
|
103
|
+
|
|
104
|
+
A small local record can retain the acting company/environment, objective key, moment, offer kind,
|
|
105
|
+
terms reference/date, last decision and time, plus non-secret invitation/referral/subscription IDs
|
|
106
|
+
when returned. Reuse these IDs for deduplication and reconciliation after an uncertain response.
|
|
107
|
+
Store the next useful action and its scope so a return does not restart onboarding. Keep recipient
|
|
108
|
+
addresses in the authorized send workflow rather than copying them into analytics. Never store
|
|
109
|
+
invitation codes, signed access URLs, credentials or raw inbox/prospect content in growth state.
|
|
110
|
+
|
|
111
|
+
Distinguish events and the evidence needed for each; these are event concepts, not API field names:
|
|
112
|
+
|
|
113
|
+
| Stage | Evidence |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| Relevant suggestion shown | The host actually rendered the offer, tied to a real task moment. |
|
|
116
|
+
| Accepted, declined or dismissed | The customer's actual choice; a question left unanswered is pending. |
|
|
117
|
+
| Invitation/link prepared, created or delivered | The respective draft, creation response or delivery confirmation. These are separate outcomes. |
|
|
118
|
+
| Recipient joined | A readable acceptance/membership event, not the existence of a code or a sent email. |
|
|
119
|
+
| Referred user activated | The program's qualifying action recorded by its authoritative service, not a guessed link click. |
|
|
120
|
+
| Reward credited | A program reward/transaction record tied to the referral and beneficiary. A balance increase alone cannot attribute it. |
|
|
121
|
+
| Plan changed | The confirmed resulting subscription, including its effective date. A checkout link or intent is not a purchase. |
|
|
122
|
+
|
|
123
|
+
Deduplicate by returned event or conversion ID within its program, company and environment; one
|
|
124
|
+
referral can qualify, activate and pay a reward without becoming three new users. Without a readable
|
|
125
|
+
event source, report the later stage as unknown, not zero or successful. Reconcile an uncertain send
|
|
126
|
+
or accepted write before retrying; do not create another invitation merely to refresh its status.
|
|
127
|
+
Check supported status when the user asks or the task legitimately resumes, not in an invented
|
|
128
|
+
background monitor. Report a pending reward and a spendable reward separately.
|
|
129
|
+
|
|
130
|
+
For product measurement, separate eligible moments, suggestions shown, choices, delivered invites,
|
|
131
|
+
new-user activations, verified rewards and confirmed plan changes. Compare completion of the original
|
|
132
|
+
customer task and declines as well as conversions; an invitation count alone does not prove growth.
|
|
133
|
+
Never fabricate time saved, revenue, conversion uplift or attribution from a conversation transcript.
|
|
134
|
+
|
|
135
|
+
## Keep the conversation light
|
|
136
|
+
|
|
137
|
+
Use a useful result followed by one short, optional, contextual question when a choice is needed.
|
|
138
|
+
Use the host's question tool when suitable, with the real costs and consequences from the available
|
|
139
|
+
evidence. Avoid a menu of products after every answer, manufactured urgency or a promotional
|
|
140
|
+
watermark in a private deliverable. Lead with the feasible action, not a diagnostic checklist.
|
|
141
|
+
In the main reply, give the result, the next-step cost/shortfall if relevant and one useful choice.
|
|
142
|
+
Keep accounting internals and the full discovery record in supporting detail. For a referral, show
|
|
143
|
+
the reward, qualifying action and timing, with material limits accessible through its official
|
|
144
|
+
terms or a supported details view before the customer commits. Do not turn every eligibility check
|
|
145
|
+
into a separate paragraph. When an option is unavailable, explain it once and keep the useful draft
|
|
146
|
+
or saved result prominent; do not repeat every action that did not happen.
|
|
147
|
+
|
|
148
|
+
For example, using illustrative figures only: "Ta sélection est prête. Il manque 20 crédits pour
|
|
149
|
+
les 40 noms, ou on peut commencer par 30. Ton parrainage éligible peut aussi apporter 120 crédits
|
|
150
|
+
après la première recherche d'un nouvel utilisateur, sous 24 heures. Je peux préparer le message
|
|
151
|
+
pour une personne de ton choix." Include the actual terms link and costs in the supported decision
|
|
152
|
+
view; preparing that message does not send it. Do not copy these figures into a real quote.
|
|
153
|
+
|
|
154
|
+
Other examples to adapt, only when their prerequisites hold:
|
|
155
|
+
|
|
156
|
+
- **First result and named handoff:** "The shortlist is ready, with a reason for each priority. I can
|
|
157
|
+
prepare a private summary for the colleague you mentioned." Preparing it does not send it.
|
|
158
|
+
- **Recurring job:** "Your criteria and exclusions are saved here. Next time, say 'continue this list'."
|
|
159
|
+
Say this only after the host has actually retained them; it is not an automatic refresh promise.
|
|
160
|
+
- **Right-sized plan:** "At your stated monthly volume, this available option covers the gap for the
|
|
161
|
+
quoted recurring price. For this one job, keeping the smaller batch is also sufficient."
|
|
162
|
+
- **Verified referral:** "You can earn the stated credits when an eligible friend completes the
|
|
163
|
+
program's qualifying step. I can prepare a short invitation for someone you choose."
|
|
@@ -75,3 +75,9 @@ Lead with useful results, with detail and evidence available in the deliverable.
|
|
|
75
75
|
coverage gaps in ordinary language. Report costs and any running watchers or pending actions only
|
|
76
76
|
when relevant and supported by the actual responses. A small preview is an intermediate result when
|
|
77
77
|
the user asked for a substantial prospect list, not completion of that request.
|
|
78
|
+
|
|
79
|
+
When a real credit/plan limit intervenes, or a requested handoff, recurring job or referral creates
|
|
80
|
+
a useful next step, read [value and growth](../sortlist-cli/references/value-and-growth.md).
|
|
81
|
+
Help the customer preserve and reuse their result, collaborate with the intended person or choose
|
|
82
|
+
an available plan that fits their need. Ordinary delivery needs no promotional ending; honor a
|
|
83
|
+
declined offer and keep referrals separate from company membership and prospect outreach.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/router-client.ts","../src/core/catalog.ts","../src/graphql/query-builder.ts","../src/core/run-operation.ts","../src/core/introspect.ts"],"sourcesContent":["export interface ResponseError {\n message: string;\n path?: (string | number)[];\n extensions?: Record<string, unknown>;\n}\n\nexport interface GraphQLResponse<T = Record<string, unknown>> {\n data?: T;\n errors?: ResponseError[];\n}\n\nexport function codeOf(errors: ResponseError[]): string | null {\n for (const { extensions } of errors) {\n const code = extensions?.code;\n if (typeof code === 'string') return code;\n }\n\n return null;\n}\n\nexport function serviceOf(errors: ResponseError[]): string | null {\n for (const { extensions } of errors) {\n const service = extensions?.service;\n if (typeof service === 'string') return service;\n }\n\n return null;\n}\n\n/** Did anything actually resolve? An all-null payload beside an error is a failure. */\nexport function hasResolvedField(data: unknown): boolean {\n if (data === null || data === undefined) return false;\n\n return Object.values(data as Record<string, unknown>).some((value) => value !== null);\n}\n\nexport type RouterErrorKind = 'graphql' | 'http' | 'unreachable' | 'no_data';\n\nexport class RouterError extends Error {\n readonly kind: RouterErrorKind;\n readonly code: string | null;\n readonly httpStatus?: number;\n readonly graphqlErrors: ResponseError[];\n readonly service: string | null;\n readonly statusText?: string;\n readonly body?: string;\n\n constructor(\n message: string,\n details: {\n kind: RouterErrorKind;\n code: string | null;\n httpStatus?: number;\n graphqlErrors?: ResponseError[];\n statusText?: string;\n body?: string;\n cause?: unknown;\n },\n ) {\n super(message, details.cause === undefined ? undefined : { cause: details.cause });\n this.name = 'RouterError';\n this.kind = details.kind;\n this.code = details.code;\n this.httpStatus = details.httpStatus;\n this.graphqlErrors = details.graphqlErrors ?? [];\n this.service = serviceOf(this.graphqlErrors);\n this.statusText = details.statusText;\n this.body = details.body;\n }\n}\n\nexport interface RouterClient {\n execute(query: string, variables?: Record<string, unknown>, signal?: AbortSignal): Promise<Record<string, unknown>>;\n subscribe(\n query: string,\n variables: Record<string, unknown> | undefined,\n signal?: AbortSignal,\n ): AsyncGenerator<Record<string, unknown>>;\n openSubscription(\n query: string,\n variables: Record<string, unknown> | undefined,\n signal?: AbortSignal,\n ): Promise<AsyncGenerator<Record<string, unknown>>>;\n}\n\nexport interface RouterClientOptions {\n endpoint: string;\n token?: string;\n companyId?: string;\n headers?: Record<string, string>;\n fetch?: typeof fetch;\n onPartialErrors?: (errors: ResponseError[]) => void;\n}\n\nexport interface ServerSentEvent {\n event: string;\n data: string;\n}\n\nexport async function* parseEventStream(chunks: AsyncIterable<Uint8Array | string>): AsyncGenerator<ServerSentEvent> {\n const decoder = new TextDecoder();\n let buffer = '';\n\n for await (const chunk of chunks) {\n buffer += typeof chunk === 'string' ? chunk : decoder.decode(chunk, { stream: true });\n buffer = buffer.replaceAll('\\r\\n', '\\n');\n\n let boundary = buffer.indexOf('\\n\\n');\n while (boundary !== -1) {\n const block = buffer.slice(0, boundary);\n buffer = buffer.slice(boundary + 2);\n const parsed = parseEventBlock(block);\n if (parsed) yield parsed;\n boundary = buffer.indexOf('\\n\\n');\n }\n }\n\n const rest = parseEventBlock(buffer);\n if (rest) yield rest;\n}\n\nfunction parseEventBlock(block: string): ServerSentEvent | null {\n let event = 'message';\n const data: string[] = [];\n\n for (const line of block.split('\\n')) {\n if (line === '' || line.startsWith(':')) continue;\n const colon = line.indexOf(':');\n const field = colon === -1 ? line : line.slice(0, colon);\n const value = colon === -1 ? '' : line.slice(colon + 1).replace(/^ /, '');\n if (field === 'event') event = value;\n if (field === 'data') data.push(value);\n }\n\n return data.length > 0 || event !== 'message' ? { event, data: data.join('\\n') } : null;\n}\n\nfunction parseErrors(body: string): ResponseError[] | null {\n try {\n const errors = (JSON.parse(body) as GraphQLResponse).errors;\n return errors?.length ? errors : null;\n } catch {\n return null;\n }\n}\n\nexport function setHeader(headers: Record<string, string>, name: string, value: string): void {\n for (const existing of Object.keys(headers)) {\n if (existing.toLowerCase() === name.toLowerCase()) delete headers[existing];\n }\n headers[name] = value;\n}\n\nexport function withJsonBody(headers: Record<string, string> = {}): Record<string, string> {\n const labelled = Object.keys(headers).some((name) => name.toLowerCase() === 'content-type');\n return labelled ? { ...headers } : { 'Content-Type': 'application/json', ...headers };\n}\n\nexport function createRouterClient(options: RouterClientOptions): RouterClient {\n function headersFor(accept?: string): Record<string, string> {\n const headers = withJsonBody(options.headers);\n if (options.token) setHeader(headers, 'Authorization', `Bearer ${options.token}`);\n if (options.companyId) setHeader(headers, 'X-Company-Id', options.companyId);\n if (accept) setHeader(headers, 'Accept', accept);\n\n return headers;\n }\n\n async function post(\n query: string,\n variables: Record<string, unknown> | undefined,\n headers: Record<string, string>,\n signal?: AbortSignal,\n ): Promise<Response> {\n const send = options.fetch ?? fetch;\n let res: Response;\n try {\n res = await send(options.endpoint, {\n method: 'POST',\n headers,\n body: JSON.stringify({ query, variables }),\n ...(signal ? { signal } : {}),\n });\n } catch (err) {\n throw new RouterError((err as Error).message, { kind: 'unreachable', code: 'UNREACHABLE', cause: err });\n }\n\n if (res.ok) return res;\n\n const body = await res.text();\n const errors = parseErrors(body) ?? [];\n throw new RouterError(`HTTP ${res.status} ${res.statusText}`, {\n kind: 'http',\n code: codeOf(errors) ?? `HTTP_${res.status}`,\n httpStatus: res.status,\n graphqlErrors: errors,\n statusText: res.statusText,\n body,\n });\n }\n\n function failWith(errors: ResponseError[]): never {\n throw new RouterError(errors[0]?.message ?? 'GraphQL errors', {\n kind: 'graphql',\n code: codeOf(errors),\n graphqlErrors: errors,\n });\n }\n\n async function respond(\n query: string,\n variables: Record<string, unknown> | undefined,\n signal?: AbortSignal,\n ): Promise<GraphQLResponse> {\n try {\n const res = await post(query, variables, headersFor(), signal);\n return (await res.json()) as GraphQLResponse;\n } catch (err) {\n throw signal?.aborted ? signal.reason : err;\n }\n }\n\n async function execute(\n query: string,\n variables?: Record<string, unknown>,\n signal?: AbortSignal,\n ): Promise<Record<string, unknown>> {\n const json = await respond(query, variables, signal);\n\n if (json.errors?.length) {\n if (!hasResolvedField(json.data)) failWith(json.errors);\n\n options.onPartialErrors?.(json.errors);\n return json.data as Record<string, unknown>;\n }\n\n if (!json.data) throw new RouterError('No data returned from API.', { kind: 'no_data', code: 'NO_DATA' });\n\n return json.data;\n }\n\n async function* events(res: Response): AsyncGenerator<Record<string, unknown>> {\n if (!res.body) return;\n\n for await (const { event, data } of parseEventStream(res.body as unknown as AsyncIterable<Uint8Array>)) {\n if (event === 'complete') return;\n if (event !== 'next' && event !== 'message') continue;\n\n const payload = JSON.parse(data) as GraphQLResponse;\n if (payload.errors?.length && !hasResolvedField(payload.data)) failWith(payload.errors);\n\n if (payload.errors?.length) options.onPartialErrors?.(payload.errors);\n if (payload.data) yield payload.data;\n }\n }\n\n async function openSubscription(\n query: string,\n variables: Record<string, unknown> | undefined,\n signal?: AbortSignal,\n ): Promise<AsyncGenerator<Record<string, unknown>>> {\n return events(await post(query, variables, headersFor('text/event-stream'), signal));\n }\n\n async function* subscribe(\n query: string,\n variables: Record<string, unknown> | undefined,\n signal?: AbortSignal,\n ): AsyncGenerator<Record<string, unknown>> {\n yield* await openSubscription(query, variables, signal);\n }\n\n return { execute, subscribe, openSubscription };\n}\n","import {\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNonNullType,\n isObjectType,\n isUnionType,\n type GraphQLArgument,\n type GraphQLField,\n type GraphQLInputField,\n type GraphQLInputType,\n type GraphQLNamedType,\n type GraphQLObjectType,\n type GraphQLOutputType,\n type GraphQLSchema,\n} from 'graphql';\n\nimport { type OperationKind } from '../graphql/query-builder.ts';\nimport { type IntrospectedSchema } from './introspect.ts';\n\nexport type { OperationKind };\n\nexport interface OperationArg {\n name: string;\n type: GraphQLInputType;\n required: boolean;\n description?: string | null;\n defaultValue?: unknown;\n}\n\nexport interface OperationSpec {\n fieldName: string;\n kind: OperationKind;\n service: string;\n description: string;\n args: OperationArg[];\n inputWrapper: boolean;\n resultSubscription?: string;\n scopes?: string[][];\n}\n\nconst SKIP_FIELDS = new Set(['node', 'nodes', 'id', '_entities', '_service']);\n\nconst KIND_ORDER: OperationKind[] = ['query', 'mutation', 'subscription'];\n\nexport function unwrap(type: GraphQLOutputType | GraphQLInputType): GraphQLNamedType {\n if (isNonNullType(type)) return unwrap(type.ofType as GraphQLOutputType | GraphQLInputType);\n if (isListType(type)) return unwrap(type.ofType as GraphQLOutputType | GraphQLInputType);\n return type as GraphQLNamedType;\n}\n\nfunction operationArg(field: GraphQLArgument | GraphQLInputField): OperationArg {\n return {\n name: field.name,\n type: field.type,\n required: isNonNullType(field.type),\n description: field.description,\n ...(field.defaultValue === undefined ? {} : { defaultValue: field.defaultValue }),\n };\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * For mutations with a single `input` argument of an Input type,\n * return the fields of that input type for flattening into CLI options.\n */\nexport function getInputFields(field: GraphQLField<unknown, unknown>): OperationArg[] | null {\n if (field.args.length !== 1) return null;\n const arg = field.args[0];\n if (arg.name !== 'input') return null;\n const argType = isNonNullType(arg.type) ? arg.type.ofType : arg.type;\n if (!isInputObjectType(argType)) return null;\n return Object.values(argType.getFields()).map(operationArg);\n}\n\nexport function supersededBy(\n field: GraphQLField<unknown, unknown>,\n siblings: Record<string, GraphQLField<unknown, unknown>>,\n): string | null {\n const replacement = field.deprecationReason?.match(/`(\\w+)`/)?.[1];\n if (!replacement || SKIP_FIELDS.has(replacement)) return null;\n\n const sibling = siblings[replacement];\n return sibling && !sibling.deprecationReason ? replacement : null;\n}\n\nfunction argumentNames(field: GraphQLField<unknown, unknown>): Set<string> {\n return new Set((getInputFields(field) ?? field.args).map((a) => a.name));\n}\n\nconst RESULT_OF_MUTATION = /(?:result|outcome) of an? `(\\w+)` call|then call `(\\w+)`/;\n\nexport function resultSubscriptions(schema: GraphQLSchema): Map<string, string> {\n const pairs = new Map<string, string>();\n const mutations = schema.getMutationType()?.getFields() ?? {};\n\n for (const [name, field] of Object.entries(schema.getSubscriptionType()?.getFields() ?? {})) {\n const match = field.description?.match(RESULT_OF_MUTATION);\n const mutation = match?.[1] ?? match?.[2];\n if (!mutation || !mutations[mutation]) continue;\n const mutationArguments = argumentNames(mutations[mutation]);\n if (!field.args.some((a) => a.name === 'externalId') || !mutationArguments.has('externalId')) continue;\n if (field.args.some((a) => isNonNullType(a.type) && !mutationArguments.has(a.name))) continue;\n pairs.set(mutation, name);\n }\n\n return pairs;\n}\n\nexport function subscriptionVariablesFor(\n schema: GraphQLSchema,\n subscription: string,\n mutationArguments: Record<string, unknown>,\n externalId: string,\n): Record<string, unknown> {\n const variables: Record<string, unknown> = {};\n for (const arg of schema.getSubscriptionType()?.getFields()[subscription]?.args ?? []) {\n if (mutationArguments[arg.name] !== undefined) variables[arg.name] = mutationArguments[arg.name];\n }\n return { ...variables, externalId };\n}\n\nexport function isStillFilling(result: unknown): boolean {\n return isRecord(result) && result.status === 'FILLING';\n}\n\nexport const PAGE_STATUS_FIELD = 'status';\n\nexport function deliversFillingPages(schema: GraphQLSchema, subscriptionName: string): boolean {\n const field = schema.getSubscriptionType()?.getFields()[subscriptionName];\n const returnType = field ? unwrap(field.type) : null;\n const status = returnType && isObjectType(returnType) ? returnType.getFields()[PAGE_STATUS_FIELD] : undefined;\n const statusType = status ? unwrap(status.type) : null;\n return Boolean(statusType && isEnumType(statusType) && statusType.getValue('FILLING'));\n}\n\nfunction exposedFields(\n type: GraphQLObjectType,\n services: Map<string, string>,\n): Array<{ fieldName: string; field: GraphQLField<unknown, unknown>; service: string }> {\n const fields = type.getFields();\n const exposed = [];\n for (const [fieldName, field] of Object.entries(fields)) {\n if (SKIP_FIELDS.has(fieldName) || fieldName.startsWith('__')) continue;\n if (supersededBy(field, fields)) continue;\n\n const returnType = unwrap(field.type);\n if (isInterfaceType(returnType) || isUnionType(returnType)) continue;\n\n const service = services.get(fieldName);\n if (service) exposed.push({ fieldName, field, service });\n }\n return exposed;\n}\n\nexport function listOperations(introspected: IntrospectedSchema): OperationSpec[] {\n const { schema, fieldServices, fieldScopes } = introspected;\n const pairs = resultSubscriptions(schema);\n const operations: OperationSpec[] = [];\n\n const rootTypes = [\n { kind: 'query' as const, type: schema.getQueryType() },\n { kind: 'mutation' as const, type: schema.getMutationType() },\n { kind: 'subscription' as const, type: schema.getSubscriptionType() },\n ];\n\n for (const { kind, type } of rootTypes) {\n const services = type && fieldServices.get(type.name);\n if (!type || !services) continue;\n\n for (const { fieldName, field, service } of exposedFields(type, services)) {\n const inputFields = getInputFields(field);\n const args: OperationArg[] = inputFields ?? field.args.map(operationArg);\n const resultSubscription = kind === 'mutation' ? pairs.get(fieldName) : undefined;\n const scopes = fieldScopes.get(type.name)?.get(fieldName);\n\n operations.push({\n fieldName,\n kind,\n service,\n description: field.description ?? '',\n args,\n inputWrapper: inputFields != null,\n ...(resultSubscription ? { resultSubscription } : {}),\n ...(scopes ? { scopes } : {}),\n });\n }\n }\n\n return operations.sort(\n (a, b) =>\n a.service.localeCompare(b.service) ||\n a.fieldName.localeCompare(b.fieldName) ||\n KIND_ORDER.indexOf(a.kind) - KIND_ORDER.indexOf(b.kind),\n );\n}\n","/**\n * Runtime GraphQL query builder.\n * Dynamically constructs operations from an introspected schema\n * with user-controlled depth and field selection.\n */\nimport {\n astFromValue,\n isAbstractType,\n isEnumType,\n isListType,\n isNonNullType,\n isObjectType,\n isScalarType,\n Kind,\n parse,\n print,\n TypeInfo,\n visit,\n visitWithTypeInfo,\n type ArgumentNode,\n type GraphQLAbstractType,\n type GraphQLArgument,\n type GraphQLField,\n type GraphQLNamedType,\n type GraphQLObjectType,\n type GraphQLOutputType,\n type GraphQLSchema,\n type ValueNode,\n} from 'graphql';\n\nexport const CLI_OPERATION_PREFIX = 'SlCli_';\n\n// ── Helpers ──\n\nfunction unwrap(type: GraphQLOutputType): GraphQLNamedType {\n if (isNonNullType(type)) return unwrap(type.ofType);\n if (isListType(type)) return unwrap(type.ofType);\n return type as GraphQLNamedType;\n}\n\nfunction isLeaf(type: GraphQLNamedType): boolean {\n return isScalarType(type) || isEnumType(type);\n}\n\nfunction ucfirst(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\n// Payload types where `id` often fails at runtime\nconst PAYLOAD_TYPE_PATTERN = /(?:Response|Payload|MutationPayload)$/;\n// What a mutation payload carries besides its result: an id that often fails at runtime, and\n// Relay's echo of an input the CLI never sends.\nconst PAYLOAD_PLUMBING = new Set(['id', 'clientMutationId']);\n\n/**\n * A mutation payload is a wrapper around the result, not a level of it: at the default depth a\n * caller wants the account the mutation returns, not the wrapper's scalars. So the wrapper is\n * crossed for free, the way a connection's `nodes` is.\n */\nfunction effectiveDepth(returnType: GraphQLNamedType, depth: number): number {\n return isObjectType(returnType) && PAYLOAD_TYPE_PATTERN.test(returnType.name) ? depth + 1 : depth;\n}\n\n// ── Selection set builder ──\n\nexport interface QueryOptions {\n /** Max nesting depth for sub-objects (default: 0) */\n depth?: number;\n /** Only include these fields (dot-notation for nested, e.g. \"organization.name\") */\n fields?: string[];\n /** Exclude these fields (dot-notation for nested) */\n exclude?: string[];\n /** Select `totalCount` on connections (default: false) */\n totalCount?: boolean;\n reveal?: string[];\n}\n\nfunction buildSelections(\n type: GraphQLNamedType,\n schema: GraphQLSchema,\n depth: number,\n exclude: Set<string>,\n prefix: string,\n totalCount: boolean,\n visited: Set<string>,\n): string[] {\n if (!isObjectType(type)) return [];\n if (visited.has(type.name)) return [];\n visited.add(type.name);\n\n const fields = type.getFields();\n const lines: string[] = [];\n const isPayload = PAYLOAD_TYPE_PATTERN.test(type.name);\n\n // Relay Connection pattern. The connection/`nodes` wrapper is not a semantic\n // nesting level, so the node type inherits the caller's `depth` unchanged —\n // otherwise object fields on the node (e.g. Contact.organization) would never\n // be selected regardless of --depth.\n if (isConnection(type)) {\n const nodesType = unwrap(fields.nodes.type);\n const nodeSelections = buildSelections(\n nodesType,\n schema,\n depth,\n exclude,\n `${prefix}nodes.`,\n totalCount,\n new Set(visited),\n );\n return connectionSelections(type, nodeSelections, totalCount);\n }\n\n for (const [name, field] of Object.entries(fields)) {\n if (name.startsWith('__')) continue;\n if (isPayload && PAYLOAD_PLUMBING.has(name)) continue;\n\n const fullPath = `${prefix}${name}`;\n if (exclude.has(fullPath) || exclude.has(name)) continue;\n\n if (!isAutoSelectable(field)) continue;\n\n const namedType = unwrap(field.type);\n\n if (isLeaf(namedType)) {\n lines.push(name);\n } else if (isObjectType(namedType) && isConnection(namedType) && field.args.length === 0) {\n const pageSelections = buildSelections(\n namedType,\n schema,\n depth,\n exclude,\n `${fullPath}.`,\n totalCount,\n new Set(visited),\n );\n if (pageSelections.length > 0) {\n lines.push(`${name} {`);\n for (const sel of pageSelections) lines.push(` ${sel}`);\n lines.push(`}`);\n }\n } else if (isObjectType(namedType) && depth > 0) {\n const subSelections = buildSelections(\n namedType,\n schema,\n depth - 1,\n exclude,\n `${fullPath}.`,\n totalCount,\n new Set(visited),\n );\n if (subSelections.length > 0) {\n lines.push(`${fieldCall(name, field)} {`);\n for (const sel of subSelections) lines.push(` ${sel}`);\n lines.push(`}`);\n }\n } else if (isAbstractType(namedType) && depth > 0) {\n lines.push(`${name} {`);\n for (const sel of abstractSelections(\n namedType,\n schema,\n depth - 1,\n exclude,\n `${fullPath}.`,\n totalCount,\n visited,\n )) {\n lines.push(` ${sel}`);\n }\n lines.push(`}`);\n }\n }\n\n return lines;\n}\n\n/**\n * A union or interface is read through its members: `__typename` says which one\n * came back, and one inline fragment per possible type carries that type's fields,\n * so a payload's `authentication` renders as the hosted link or the accepted\n * credentials, whichever the subgraph answered.\n */\nfunction abstractSelections(\n type: GraphQLAbstractType,\n schema: GraphQLSchema,\n depth: number,\n exclude: Set<string>,\n prefix: string,\n totalCount: boolean,\n visited: Set<string>,\n): string[] {\n const lines = ['__typename'];\n for (const member of schema.getPossibleTypes(type)) {\n const memberSelections = buildSelections(member, schema, depth, exclude, prefix, totalCount, new Set(visited));\n if (memberSelections.length === 0) continue;\n lines.push(`... on ${member.name} {`);\n for (const sel of memberSelections) lines.push(` ${sel}`);\n lines.push(`}`);\n }\n return lines;\n}\n\n/** A nested connection left unbounded is costed at its max page size per parent row, which blows the complexity budget. */\nconst NESTED_PAGE_SIZE = 10;\n\nfunction fieldCall(name: string, field: GraphQLField<unknown, unknown>): string {\n const named = unwrap(field.type);\n const pageable = isObjectType(named) && isConnection(named) && field.args.some((a) => a.name === 'first');\n return pageable ? `${name}(first: ${NESTED_PAGE_SIZE})` : name;\n}\n\nfunction deliveredPageField(type: GraphQLObjectType): GraphQLField<unknown, unknown> | null {\n const pages = Object.values(type.getFields()).filter((field) => {\n const named = unwrap(field.type);\n return isObjectType(named) && isConnection(named) && field.args.length === 0;\n });\n return pages.length === 1 ? pages[0] : null;\n}\n\nfunction isConnection(type: GraphQLObjectType): boolean {\n const fields = type.getFields();\n return Boolean(fields.nodes) && Boolean(fields.pageInfo);\n}\n\nfunction isAutoSelectable(field: GraphQLField<unknown, unknown>): boolean {\n if (field.name.startsWith('__') || field.deprecationReason != null) return false;\n return !field.args.some((a) => isNonNullType(a.type) && a.defaultValue === undefined);\n}\n\nfunction selectableFields(type: GraphQLObjectType): GraphQLField<unknown, unknown>[] {\n return Object.values(type.getFields()).filter(isAutoSelectable);\n}\n\n/**\n * What the edge carries besides the node — a reveal report, a distance, a\n * filter match. Selected whenever present, one level deep: these are small\n * value objects that describe the row, and losing them for the sake of a\n * shorter query is losing the answer.\n */\nfunction edgeExtras(connection: GraphQLObjectType): { edge: GraphQLObjectType; lines: string[] } | null {\n const edgesField = connection.getFields().edges;\n if (!edgesField) return null;\n const edge = unwrap(edgesField.type);\n if (!isObjectType(edge)) return null;\n\n const lines: string[] = [];\n for (const field of selectableFields(edge)) {\n if (field.name === 'node' || field.name === 'cursor' || field.name === 'id') continue;\n const named = unwrap(field.type);\n if (isLeaf(named)) {\n lines.push(field.name);\n } else if (isObjectType(named)) {\n const leaves = selectableFields(named)\n .filter((sub) => isLeaf(unwrap(sub.type)))\n .map((sub) => sub.name);\n if (leaves.length > 0) lines.push(`${field.name} { ${leaves.join(' ')} }`);\n }\n }\n\n return lines.length === 0 ? null : { edge, lines };\n}\n\n/**\n * `nodes { … }` when the edge is a plain wrapper; `edges { node { … } … }` when\n * it carries more, so what the server says about each row comes along.\n */\nfunction connectionSelections(connection: GraphQLObjectType, nodeSelections: string[], totalCount: boolean): string[] {\n if (nodeSelections.length === 0) return [];\n const lines: string[] = [];\n const extras = edgeExtras(connection);\n\n if (extras) {\n lines.push('edges {');\n lines.push(' node {');\n for (const sel of nodeSelections) lines.push(` ${sel}`);\n lines.push(' }');\n for (const extra of extras.lines) lines.push(` ${extra}`);\n lines.push('}');\n } else {\n lines.push('nodes {');\n for (const sel of nodeSelections) lines.push(` ${sel}`);\n lines.push('}');\n }\n lines.push('pageInfo {');\n lines.push(' hasNextPage');\n lines.push(' endCursor');\n lines.push('}');\n if (totalCount && connection.getFields().totalCount) lines.push('totalCount');\n for (const extra of connectionExtras(connection)) lines.push(extra);\n return lines;\n}\n\nconst CONNECTION_PLUMBING = new Set(['edges', 'nodes', 'pageInfo', 'totalCount', 'approximateTotalCount']);\n\nfunction isConnectionExtraPath(connection: GraphQLObjectType, nodesType: GraphQLNamedType, path: string): boolean {\n const [top] = path.split('.');\n if (CONNECTION_PLUMBING.has(top)) return false;\n if (isObjectType(nodesType) && nodesType.getFields()[top]) return false;\n return Boolean(connection.getFields()[top]);\n}\n\n/**\n * What a connection says about the page as a whole — the bill of a reveal, for\n * one — selected two levels deep so a summary with a per-item split comes along.\n */\nfunction connectionExtras(connection: GraphQLObjectType): string[] {\n return selectableFields(connection)\n .filter((field) => !CONNECTION_PLUMBING.has(field.name))\n .flatMap((field) => {\n const named = unwrap(field.type);\n if (isLeaf(named)) return [field.name];\n if (!isObjectType(named)) return [];\n const inner = selectableFields(named).flatMap((sub) => {\n const subType = unwrap(sub.type);\n if (isLeaf(subType)) return [sub.name];\n if (!isObjectType(subType)) return [];\n const leaves = selectableFields(subType).filter((leaf) => isLeaf(unwrap(leaf.type)));\n return leaves.length === 0 ? [] : [`${sub.name} { ${leaves.map((leaf) => leaf.name).join(' ')} }`];\n });\n return inner.length === 0 ? [] : [`${field.name} { ${inner.join(' ')} }`];\n });\n}\n\n/**\n * A misspelt field used to be dropped silently, so `--fields email` printed\n * every other column and left the caller wondering where the email went.\n */\nfunction fieldNamesOf(type: GraphQLNamedType): string[] {\n return isObjectType(type) ? Object.keys(type.getFields()) : [];\n}\n\nexport class UnknownFieldError extends Error {\n readonly field: string;\n readonly suggestions: string[];\n\n constructor(field: string, type: GraphQLNamedType, candidates: string[] = fieldNamesOf(type)) {\n const names = candidates.filter((name) => !name.startsWith('__'));\n const needle = field.toLowerCase();\n const suggestions = names.filter((name) => {\n const candidate = name.toLowerCase();\n return candidate.includes(needle) || needle.includes(candidate);\n });\n super(`${type.name} has no field \"${field}\".`);\n this.name = 'UnknownFieldError';\n this.field = field;\n this.suggestions = suggestions.length > 0 ? suggestions : names;\n }\n}\n\n// ── Public API ──\n\nexport interface BuiltQuery {\n query: string;\n variables: Record<string, unknown>;\n /** The root field name (e.g. \"agency\", \"createChat\") */\n fieldName: string;\n}\n\n/**\n * Build a GraphQL query/mutation string for a root operation field.\n *\n * @param schema - The introspected GraphQL schema\n * @param kind - \"query\" or \"mutation\"\n * @param fieldName - The root field name (e.g. \"agency\", \"createChat\")\n * @param variables - Variable values to send\n * @param options - Depth, field inclusion/exclusion\n */\nexport type OperationKind = 'query' | 'mutation' | 'subscription';\n\nexport function rootTypeOf(schema: GraphQLSchema, kind: OperationKind): GraphQLObjectType | null | undefined {\n if (kind === 'query') return schema.getQueryType();\n if (kind === 'mutation') return schema.getMutationType();\n return schema.getSubscriptionType();\n}\n\nexport function buildQuery(\n schema: GraphQLSchema,\n kind: OperationKind,\n fieldName: string,\n variables: Record<string, unknown>,\n options: QueryOptions = {},\n): BuiltQuery {\n const rootType = rootTypeOf(schema, kind);\n if (!rootType) throw new Error(`No ${kind} type in schema`);\n\n const field = rootType.getFields()[fieldName];\n if (!field) throw new Error(`Unknown ${kind} field: ${fieldName}`);\n\n const returnType = unwrap(field.type);\n const depth = effectiveDepth(returnType, options.depth ?? 0);\n const exclude = new Set(options.exclude ?? []);\n const wantsTotalCount = options.totalCount === true;\n\n // Build variable definitions from the field's arguments\n const allArgs = field.args;\n\n const varDefsInner = allArgs.map((a) => `$${a.name}: ${a.type.toString()}`).join(', ');\n const fieldArgsInner = allArgs.map((a) => `${a.name}: $${a.name}`).join(', ');\n const varDefs = allArgs.length > 0 ? `(${varDefsInner})` : '';\n const fieldArgs = allArgs.length > 0 ? `(${fieldArgsInner})` : '';\n\n // Build selection set\n let selectionBody: string;\n if (isLeaf(returnType)) {\n selectionBody = ` ${fieldName}${fieldArgs}`;\n } else if (isAbstractType(returnType)) {\n const indent = ' ';\n const body = abstractSelections(returnType, schema, depth, exclude, '', wantsTotalCount, new Set())\n .map((s) => `${indent}${s}`)\n .join('\\n');\n selectionBody = ` ${fieldName}${fieldArgs} {\\n${body}\\n }`;\n } else {\n // Filter fields if --fields is provided\n let selections: string[];\n if (options.fields && options.fields.length > 0) {\n selections = buildFieldsFromList(returnType, schema, options.fields, wantsTotalCount);\n } else {\n selections = buildSelections(returnType, schema, depth, exclude, '', wantsTotalCount, new Set());\n }\n\n if (selections.length === 0) {\n // Fallback: at minimum select __typename\n selectionBody = ` ${fieldName}${fieldArgs} {\\n __typename\\n }`;\n } else {\n const indent = ' ';\n const body = selections.map((s) => `${indent}${s}`).join('\\n');\n selectionBody = ` ${fieldName}${fieldArgs} {\\n${body}\\n }`;\n }\n }\n\n const opName = `${CLI_OPERATION_PREFIX}${ucfirst(fieldName)}`;\n const query = `${kind} ${opName}${varDefs} {\\n${selectionBody}\\n }`;\n\n if (options.reveal !== undefined)\n return { query: withNestedReveal(schema, query, options.reveal), variables, fieldName };\n return { query, variables, fieldName };\n}\n\nfunction revealValue(argument: GraphQLArgument, reveal: string[]): ValueNode {\n let value: ValueNode | null | undefined;\n try {\n value = astFromValue(reveal, argument.type);\n } catch (err) {\n throw new Error(`Cannot write reveal ${JSON.stringify(reveal)}: ${(err as Error).message}`, { cause: err });\n }\n if (!value) throw new Error(`Cannot write reveal ${JSON.stringify(reveal)} as ${argument.type.toString()}.`);\n return value;\n}\n\nfunction withNestedReveal(schema: GraphQLSchema, query: string, reveal: string[]): string {\n const typeInfo = new TypeInfo(schema);\n const revealed = visit(\n parse(query),\n visitWithTypeInfo(typeInfo, {\n Field(node, _key, _parent, _path, ancestors) {\n const nested = ancestors.some((ancestor) => 'kind' in ancestor && ancestor.kind === Kind.FIELD);\n const argument = typeInfo.getFieldDef()?.args.find((arg) => arg.name === 'reveal');\n if (!nested || !argument) return undefined;\n const written: ArgumentNode = {\n kind: Kind.ARGUMENT,\n name: { kind: Kind.NAME, value: argument.name },\n value: revealValue(argument, reveal),\n };\n const others = (node.arguments ?? []).filter((arg) => arg.name.value !== argument.name);\n return { ...node, arguments: [...others, written] };\n },\n }),\n );\n\n return print(revealed);\n}\n\n/**\n * Build selections from an explicit field list (e.g. --fields id,name,slug).\n */\nfunction buildFieldsFromList(\n type: GraphQLNamedType,\n schema: GraphQLSchema,\n requestedPaths: string[],\n totalCount: boolean,\n): string[] {\n if (!isObjectType(type)) return [];\n const fields = type.getFields();\n const page = deliveredPageField(type);\n const fieldPaths = page\n ? requestedPaths.map((path) => (fields[path.split('.')[0]] ? path : `${page.name}.${path}`))\n : requestedPaths;\n\n // Relay Connection pattern — unwrap to the node type. The id always comes\n // along: it is what a row is titled by and what the next command is pasted.\n if (isConnection(type)) {\n const nodesType = unwrap(fields.nodes.type);\n const nodePaths = fieldPaths.filter((path) => !isConnectionExtraPath(type, nodesType, path));\n const withId = isObjectType(nodesType) && nodesType.getFields().id && !nodePaths.includes('id');\n const nodeSelections = buildFieldsFromList(\n nodesType,\n schema,\n withId ? ['id', ...nodePaths] : nodePaths,\n totalCount,\n );\n return connectionSelections(type, nodeSelections, totalCount);\n }\n\n const lines: string[] = [];\n\n // Group by top-level field\n const grouped = new Map<string, string[]>();\n for (const fp of fieldPaths) {\n const [top, ...rest] = fp.split('.');\n if (!grouped.has(top)) grouped.set(top, []);\n if (rest.length > 0) grouped.get(top)!.push(rest.join('.'));\n }\n\n for (const [name, subPaths] of grouped) {\n const field = fields[name];\n if (!field) throw new UnknownFieldError(name, type);\n\n const namedType = unwrap(field.type);\n if (isLeaf(namedType)) {\n lines.push(name);\n } else if (isObjectType(namedType) && subPaths.length > 0) {\n const subSelections = buildFieldsFromList(namedType, schema, subPaths, totalCount);\n if (subSelections.length > 0) {\n lines.push(`${fieldCall(name, field)} {`);\n for (const sel of subSelections) lines.push(` ${sel}`);\n lines.push(`}`);\n }\n } else if (isAbstractType(namedType)) {\n lines.push(`${name} {`);\n for (const sel of abstractFieldsFromList(namedType, schema, subPaths, totalCount)) lines.push(` ${sel}`);\n lines.push(`}`);\n }\n }\n\n return lines;\n}\n\n/**\n * `--fields authentication.url` names a field of one member; each member takes\n * the paths it knows, and a path no member knows is refused against the union\n * itself. Without sub-paths, every member's leaf fields are selected.\n */\nfunction abstractFieldsFromList(\n type: GraphQLAbstractType,\n schema: GraphQLSchema,\n subPaths: string[],\n totalCount: boolean,\n): string[] {\n const members = schema.getPossibleTypes(type);\n if (subPaths.length === 0) {\n return abstractSelections(type, schema, 0, new Set(), '', totalCount, new Set());\n }\n\n const lines = ['__typename'];\n const claimed = new Set<string>();\n for (const member of members) {\n const known = subPaths.filter((fp) => Boolean(member.getFields()[fp.split('.')[0]]));\n if (known.length === 0) continue;\n for (const fp of known) claimed.add(fp);\n lines.push(`... on ${member.name} {`);\n for (const sel of buildFieldsFromList(member, schema, known, totalCount)) lines.push(` ${sel}`);\n lines.push(`}`);\n }\n const unknown = subPaths.find((fp) => !claimed.has(fp));\n if (unknown !== undefined) {\n throw new UnknownFieldError(unknown.split('.')[0], type, members.flatMap(fieldNamesOf));\n }\n\n return lines;\n}\n","import { randomUUID } from 'node:crypto';\nimport { setTimeout as delay } from 'node:timers/promises';\nimport { isDeepStrictEqual } from 'node:util';\nimport { type GraphQLSchema } from 'graphql';\n\nimport { buildQuery, type QueryOptions } from '../graphql/query-builder.ts';\nimport {\n deliversFillingPages,\n isRecord,\n isStillFilling,\n PAGE_STATUS_FIELD,\n subscriptionVariablesFor,\n type OperationSpec,\n} from './catalog.ts';\nimport { RouterError, type RouterClient } from './router-client.ts';\n\nexport type RunResult =\n | { state: 'done'; data: unknown; externalId?: string }\n | { state: 'complete'; data: unknown; externalId: string; nextCursor: string | null }\n | { state: 'filling'; ended: WaitEnding; data: unknown; externalId: string; nextCursor: string | null }\n | { state: 'pending'; ended: WaitEnding; externalId: string };\n\nexport type WaitEnding = 'timeout' | 'closed';\n\nexport interface RunOperationInput {\n schema: GraphQLSchema;\n spec: OperationSpec;\n args: Record<string, unknown>;\n selection: QueryOptions;\n client: RouterClient;\n waitSeconds?: number;\n signal?: AbortSignal;\n onPage?: (page: unknown) => void;\n newExternalId?: () => string;\n readStored?: (signal: AbortSignal) => Promise<RunResult | null>;\n}\n\nexport class ResultNotDeliveredError extends Error {\n readonly subscription: string;\n\n constructor(subscription: string) {\n super(`${subscription} closed without delivering a result.`);\n this.name = 'ResultNotDeliveredError';\n this.subscription = subscription;\n }\n}\n\nexport interface Listener {\n events: AsyncGenerator<Record<string, unknown>>;\n stop: () => void;\n timedOut: () => boolean;\n signal: AbortSignal;\n}\n\nexport interface ListenOptions {\n onReopen?: () => void;\n}\n\nexport function isAbort(err: unknown): boolean {\n return err instanceof Error && (err.name === 'AbortError' || err.name === 'TimeoutError');\n}\n\nexport function isDroppedStream(err: unknown): boolean {\n if (!(err instanceof Error) || isAbort(err)) return false;\n const code = (err.cause as { code?: unknown } | undefined)?.code;\n\n return err.message === 'terminated' || code === 'UND_ERR_SOCKET' || code === 'ECONNRESET';\n}\n\nexport function nextPageCursor(result: unknown): string | null {\n if (!isRecord(result)) return null;\n for (const value of Object.values(result)) {\n const pageInfo = isRecord(value) && isRecord(value.pageInfo) ? value.pageInfo : null;\n if (pageInfo?.hasNextPage === true && typeof pageInfo.endCursor === 'string') return pageInfo.endCursor;\n }\n return null;\n}\n\ninterface Deadline {\n signal: AbortSignal;\n timedOut: () => boolean;\n stop: () => void;\n}\n\nfunction deadlineAfter(seconds: number, signal?: AbortSignal): Deadline {\n const controller = new AbortController();\n let expired = false;\n const timer = setTimeout(() => {\n expired = true;\n controller.abort();\n }, seconds * 1000);\n const forward = () => controller.abort(signal?.reason);\n if (signal?.aborted) forward();\n signal?.addEventListener('abort', forward, { once: true });\n\n return {\n signal: controller.signal,\n timedOut: () => expired,\n stop: () => {\n clearTimeout(timer);\n signal?.removeEventListener('abort', forward);\n controller.abort();\n },\n };\n}\n\nfunction abortReasonOr(err: unknown, signal?: AbortSignal): unknown {\n return signal?.aborted ? signal.reason : err;\n}\n\nconst RECONNECT_DELAYS_MS = [500, 1000, 2000];\n\nfunction reconnectDelay(attempts: number): number {\n return RECONNECT_DELAYS_MS[Math.min(attempts, RECONNECT_DELAYS_MS.length - 1)];\n}\n\nconst GATEWAY_STATUSES = new Set([502, 503, 504]);\n\nfunction reconnectable(err: unknown): boolean {\n if (isDroppedStream(err)) return true;\n if (!(err instanceof RouterError)) return false;\n return err.kind === 'unreachable' || (err.kind === 'http' && GATEWAY_STATUSES.has(err.httpStatus ?? 0));\n}\n\nasync function subscribeWithin(\n deadline: Deadline,\n client: RouterClient,\n query: string,\n variables: Record<string, unknown>,\n signal: AbortSignal | undefined,\n options: ListenOptions,\n): Promise<AsyncGenerator<Record<string, unknown>>> {\n const open = () => client.openSubscription(query, variables, deadline.signal);\n const giveUpUnlessReconnectable = (err: unknown) => {\n if (signal?.aborted) throw signal.reason;\n if (deadline.timedOut() || !reconnectable(err)) throw err;\n };\n\n let first: AsyncGenerator<Record<string, unknown>>;\n try {\n first = await open();\n } catch (err) {\n throw abortReasonOr(err, signal);\n }\n\n let attempts = 0;\n async function reopen(): Promise<AsyncGenerator<Record<string, unknown>>> {\n for (;;) {\n try {\n await delay(reconnectDelay(attempts), undefined, { signal: deadline.signal });\n attempts += 1;\n return await open();\n } catch (err) {\n giveUpUnlessReconnectable(err);\n }\n }\n }\n\n async function* events(): AsyncGenerator<Record<string, unknown>> {\n let current = first;\n for (;;) {\n try {\n for await (const event of current) {\n attempts = 0;\n yield event;\n }\n return;\n } catch (err) {\n giveUpUnlessReconnectable(err);\n }\n current = await reopen();\n options.onReopen?.();\n }\n }\n\n return events();\n}\n\nexport async function listen(\n client: RouterClient,\n query: string,\n variables: Record<string, unknown>,\n seconds: number,\n signal?: AbortSignal,\n options: ListenOptions = {},\n): Promise<Listener> {\n const deadline = deadlineAfter(seconds, signal);\n try {\n const events = await subscribeWithin(deadline, client, query, variables, signal, options);\n return { events, stop: deadline.stop, timedOut: deadline.timedOut, signal: deadline.signal };\n } catch (err) {\n deadline.stop();\n throw err;\n }\n}\n\nfunction wrap(spec: OperationSpec, args: Record<string, unknown>): Record<string, unknown> {\n return spec.inputWrapper ? { input: args } : args;\n}\n\nfunction withPageStatus(schema: GraphQLSchema, subscription: string, selection: QueryOptions): QueryOptions {\n if (!selection.fields || selection.fields.includes(PAGE_STATUS_FIELD)) return selection;\n if (!deliversFillingPages(schema, subscription)) return selection;\n\n return { ...selection, fields: [...selection.fields, PAGE_STATUS_FIELD] };\n}\n\nfunction timedOutBy(err: unknown, deadline: Deadline): boolean {\n const cause = err instanceof Error ? err.cause : undefined;\n\n return deadline.timedOut() && (isAbort(err) || isAbort(cause));\n}\n\nexport interface Page {\n data: unknown;\n nextCursor: string | null;\n filling: boolean;\n streamed: boolean;\n}\n\ninterface Wait {\n latest?: Page;\n readFailure?: unknown;\n ended: boolean;\n byArrival: boolean;\n delivered: unknown[];\n onPage?: (page: unknown) => void;\n}\n\nfunction edgeCount(data: unknown): number {\n if (!isRecord(data)) return 0;\n let count = 0;\n for (const value of Object.values(data)) {\n const edges = isRecord(value) ? (value.edges ?? value.nodes) : undefined;\n if (Array.isArray(edges)) count += edges.length;\n }\n return count;\n}\n\nexport function supersedes(page: Page, current: Page | undefined, byArrival: boolean): boolean {\n if (!current) return true;\n if (page.filling !== current.filling) return !page.filling;\n if (byArrival) return true;\n const more = page.filling ? edgeCount(page.data) - edgeCount(current.data) : 0;\n return more > 0 || (more === 0 && page.streamed);\n}\n\nfunction offer(wait: Wait, page: Page): void {\n if (wait.ended || !supersedes(page, wait.latest, wait.byArrival)) return;\n wait.latest = page;\n if (!wait.onPage || wait.delivered.some((seen) => isDeepStrictEqual(seen, page.data))) return;\n wait.delivered.push(page.data);\n wait.onPage(page.data);\n}\n\nfunction completed(wait: Wait): boolean {\n return wait.latest?.filling === false;\n}\n\nfunction whenAborted(signal: AbortSignal): Promise<never> {\n return new Promise((_, reject) => {\n if (signal.aborted) reject(signal.reason);\n else signal.addEventListener('abort', () => reject(signal.reason), { once: true });\n });\n}\n\nclass StoredReads {\n readonly completed: Promise<void>;\n readonly failed: Promise<never>;\n private finish: () => void = () => undefined;\n private fail: (err: unknown) => void = () => undefined;\n private readonly inflight = new Set<Promise<void>>();\n private started = 0;\n private newestSettled = 0;\n\n constructor(\n private readonly wait: Wait,\n private readonly read: (signal: AbortSignal) => Promise<RunResult | null>,\n private readonly signal: AbortSignal,\n ) {\n this.completed = new Promise((resolve) => {\n this.finish = resolve;\n });\n this.failed = new Promise((_, reject) => {\n this.fail = reject;\n });\n this.failed.catch(() => undefined);\n }\n\n start(): void {\n this.started += 1;\n const reading: Promise<void> = this.take(this.started)\n .catch((err: unknown) => this.fail(err))\n .finally(() => this.inflight.delete(reading));\n this.inflight.add(reading);\n }\n\n settled(): Promise<unknown> {\n return Promise.race([Promise.allSettled([...this.inflight]), this.failed, whenAborted(this.signal)]);\n }\n\n private async take(order: number): Promise<void> {\n let result: RunResult | null;\n try {\n result = await this.read(this.signal);\n } catch (err) {\n if (!this.signal.aborted) this.settle(order, err);\n return;\n }\n if (this.signal.aborted) return;\n this.settle(order, undefined);\n if (result?.state !== 'complete' && result?.state !== 'filling') return;\n try {\n offer(this.wait, {\n data: result.data,\n nextCursor: result.nextCursor,\n filling: result.state === 'filling',\n streamed: false,\n });\n } catch (err) {\n this.fail(err);\n }\n if (completed(this.wait)) this.finish();\n }\n\n private settle(order: number, failure: unknown): void {\n if (order < this.newestSettled) return;\n this.newestSettled = order;\n this.wait.readFailure = failure;\n }\n}\n\nasync function follow(events: AsyncGenerator<Record<string, unknown>>, wait: Wait, fieldName: string): Promise<void> {\n for await (const data of events) {\n if (!(fieldName in data)) continue;\n const delivered = data[fieldName];\n offer(wait, {\n data: delivered,\n nextCursor: nextPageCursor(delivered),\n filling: isStillFilling(delivered),\n streamed: true,\n });\n if (completed(wait)) return;\n }\n}\n\nfunction withExternalId(input: RunOperationInput, subscription: string | undefined): Record<string, unknown> {\n const args = { ...input.args };\n if (subscription !== undefined && typeof args.externalId !== 'string') {\n args.externalId = (input.newExternalId ?? (() => `sl-${randomUUID()}`))();\n }\n return args;\n}\n\nasync function runWithoutWaiting(\n input: RunOperationInput,\n variables: Record<string, unknown>,\n externalId: string | undefined,\n): Promise<RunResult> {\n const { schema, spec, client } = input;\n const built = buildQuery(schema, spec.kind, spec.fieldName, variables, input.selection);\n const data = await client.execute(built.query, built.variables, input.signal);\n const done: RunResult = { state: 'done', data: data[built.fieldName] };\n return externalId === undefined ? done : { ...done, externalId };\n}\n\nexport async function runOperation(input: RunOperationInput): Promise<RunResult> {\n try {\n return await runUntilSettled(input);\n } catch (err) {\n throw abortReasonOr(err, input.signal);\n }\n}\n\nasync function runUntilSettled(input: RunOperationInput): Promise<RunResult> {\n const { spec, waitSeconds } = input;\n if (spec.kind === 'subscription') {\n throw new Error(`${spec.fieldName} is a subscription: listen to it rather than run it.`);\n }\n const subscription = spec.resultSubscription;\n const args = withExternalId(input, subscription);\n const variables = wrap(spec, args);\n\n if (subscription === undefined || waitSeconds === undefined) {\n const externalId = subscription === undefined ? undefined : (args.externalId as string);\n return runWithoutWaiting(input, variables, externalId);\n }\n\n return runWaiting(input, subscription, args, variables, waitSeconds);\n}\n\nasync function runWaiting(\n input: RunOperationInput,\n subscription: string,\n args: Record<string, unknown>,\n variables: Record<string, unknown>,\n waitSeconds: number,\n): Promise<RunResult> {\n const { schema, spec, client } = input;\n const externalId = args.externalId as string;\n const subscriptionVariables = subscriptionVariablesFor(schema, subscription, args, externalId);\n const listened = buildQuery(\n schema,\n 'subscription',\n subscription,\n subscriptionVariables,\n withPageStatus(schema, subscription, input.selection),\n );\n const reveal = input.selection.reveal;\n const mutation = buildQuery(schema, spec.kind, spec.fieldName, variables, reveal === undefined ? {} : { reveal });\n\n const wait: Wait = { ended: false, byArrival: !input.readStored, delivered: [], onPage: input.onPage };\n const deadline = deadlineAfter(waitSeconds, input.signal);\n const reads = input.readStored ? new StoredReads(wait, input.readStored, deadline.signal) : undefined;\n let opened = false;\n try {\n const events = await subscribeWithin(\n deadline,\n client,\n listened.query,\n listened.variables,\n input.signal,\n reads ? { onReopen: () => reads.start() } : {},\n );\n opened = true;\n await client.execute(mutation.query, mutation.variables, input.signal);\n const following = follow(events, wait, listened.fieldName);\n if (reads) await followWithReads(following, reads, wait);\n else await following;\n } catch (err) {\n if (input.signal?.aborted || !timedOutBy(err, deadline)) throw err;\n if (!opened) throw notSent(err, spec.fieldName, subscription, waitSeconds);\n if (!wait.latest) return { state: 'pending', ended: 'timeout', externalId };\n return resultOf(wait.latest, externalId, 'timeout');\n } finally {\n wait.ended = true;\n deadline.stop();\n }\n\n return closedOn(wait, externalId, subscription);\n}\n\nasync function followWithReads(following: Promise<void>, reads: StoredReads, wait: Wait): Promise<void> {\n following.catch(() => undefined);\n reads.start();\n await Promise.race([following, reads.completed, reads.failed]);\n if (!completed(wait)) await reads.settled();\n}\n\nfunction notSent(cause: unknown, mutation: string, subscription: string, waitSeconds: number): RouterError {\n return new RouterError(`${subscription} did not open within ${waitSeconds}s, so ${mutation} was not sent.`, {\n kind: 'unreachable',\n code: 'UNREACHABLE',\n cause,\n });\n}\n\nfunction resultOf(latest: Page, externalId: string, ended: WaitEnding): RunResult {\n const { data, nextCursor } = latest;\n if (latest.filling) return { state: 'filling', ended, externalId, data, nextCursor };\n return { state: 'complete', externalId, data, nextCursor };\n}\n\nfunction closedOn(wait: Wait, externalId: string, subscription: string): RunResult {\n if (!wait.latest) throw wait.readFailure ?? new ResultNotDeliveredError(subscription);\n return resultOf(wait.latest, externalId, 'closed');\n}\n","import { buildClientSchema, getIntrospectionQuery, type GraphQLSchema, type IntrospectionQuery } from 'graphql';\n\nimport { setHeader, withJsonBody } from './router-client.ts';\n\nexport type FieldServiceMap = Map<string, Map<string, string>>;\nexport type FieldScopeMap = Map<string, Map<string, string[][]>>;\n\nexport interface IntrospectedSchema {\n schema: GraphQLSchema;\n fieldServices: FieldServiceMap;\n fieldScopes: FieldScopeMap;\n /** All subgraph names observed in the supergraph, regardless of scope visibility. */\n services: Set<string>;\n}\n\n/**\n * The router injects `appliedDirectives` into introspection responses — this\n * isn't a standard introspection field, so we read it from the raw JSON.\n */\nexport interface RawField {\n name: string;\n appliedDirectives?: Array<{\n name: string;\n args: Array<{ name: string; value: unknown }>;\n }>;\n}\n\ninterface RawType {\n name: string;\n fields?: RawField[];\n}\n\nexport interface RawIntrospection {\n __schema: {\n queryType?: { name: string } | null;\n mutationType?: { name: string } | null;\n types: RawType[];\n };\n}\n\nexport async function fetchIntrospection(\n endpoint: string,\n token: string | null,\n fetchImpl: typeof fetch = fetch,\n baseHeaders: Record<string, string> = {},\n): Promise<{ introspection: IntrospectionQuery; raw: RawIntrospection }> {\n const headers = withJsonBody(baseHeaders);\n if (token) setHeader(headers, 'Authorization', `Bearer ${token}`);\n\n const res = await fetchImpl(endpoint, {\n method: 'POST',\n headers,\n body: JSON.stringify({ query: getIntrospectionQuery({ oneOf: true }) }),\n });\n\n if (!res.ok) {\n throw new Error(`Introspection failed: HTTP ${res.status} ${res.statusText}`);\n }\n\n const json = (await res.json()) as {\n data?: IntrospectionQuery & RawIntrospection;\n errors?: Array<{ message: string }>;\n };\n\n if (json.errors?.length) {\n throw new Error(`Introspection errors: ${json.errors.map((e) => e.message).join(', ')}`);\n }\n\n if (!json.data) {\n throw new Error('Introspection returned no data');\n }\n\n return { introspection: json.data as IntrospectionQuery, raw: json.data as RawIntrospection };\n}\n\n/**\n * Walk the raw introspection response and build:\n * - a `typeName → fieldName → subgraph` map from `@join__field(graph: ...)` directives\n * - the full set of subgraph names observed anywhere in the response (including types\n * whose root-fields were hidden by scope filtering — still useful so the CLI can\n * expose empty sub-commands that explain the scope gap)\n */\nconst CLI_TAG = 'cli';\n\nfunction isTaggedForCli(field: RawField): boolean {\n return (\n field.appliedDirectives?.some(\n (d) => d.name === 'tag' && d.args.some((a) => a.name === 'name' && a.value === CLI_TAG),\n ) ?? false\n );\n}\n\nexport function requiredScopes(field: RawField): string[][] | undefined {\n const value = field.appliedDirectives\n ?.find((directive) => directive.name === 'requiresScopes')\n ?.args.find((arg) => arg.name === 'scopes')?.value;\n const parsed: unknown = typeof value === 'string' ? JSON.parse(value) : value;\n if (!Array.isArray(parsed)) return undefined;\n\n return parsed.filter(Array.isArray).map((alternative: unknown[]) => alternative.map(String));\n}\n\nfunction parseIntrospection(raw: RawIntrospection): {\n fieldServices: FieldServiceMap;\n fieldScopes: FieldScopeMap;\n services: Set<string>;\n} {\n const fieldServices: FieldServiceMap = new Map();\n const fieldScopes: FieldScopeMap = new Map();\n const services = new Set<string>();\n\n for (const type of raw.__schema.types ?? []) {\n if (!type.fields?.length) continue;\n\n let fieldMap: Map<string, string> | null = null;\n let scopeMap: Map<string, string[][]> | null = null;\n\n for (const field of type.fields) {\n const directive = field.appliedDirectives?.find((d) => d.name === 'join__field');\n if (!directive) continue;\n const graphArg = directive.args.find((a) => a.name === 'graph');\n if (!graphArg || typeof graphArg.value !== 'string') continue;\n services.add(graphArg.value);\n if (!isTaggedForCli(field)) continue;\n fieldMap ??= new Map();\n fieldMap.set(field.name, graphArg.value);\n const scopes = requiredScopes(field);\n if (scopes?.length) {\n scopeMap ??= new Map();\n scopeMap.set(field.name, scopes);\n }\n }\n\n if (fieldMap) fieldServices.set(type.name, fieldMap);\n if (scopeMap) fieldScopes.set(type.name, scopeMap);\n }\n\n return { fieldServices, fieldScopes, services };\n}\n\nexport function buildIntrospected(introspection: IntrospectionQuery, raw: RawIntrospection): IntrospectedSchema | null {\n try {\n const { fieldServices, fieldScopes, services } = parseIntrospection(raw);\n return { schema: buildClientSchema(introspection), fieldServices, fieldScopes, services };\n } catch {\n return null;\n }\n}\n\nexport async function introspect(\n endpoint: string,\n token: string | null,\n fetchImpl?: typeof fetch,\n headers?: Record<string, string>,\n): Promise<IntrospectedSchema> {\n const { introspection, raw } = await fetchIntrospection(endpoint, token, fetchImpl, headers);\n const built = buildIntrospected(introspection, raw);\n if (!built) throw new Error('introspection did not build');\n\n return built;\n}\n"],"mappings":";AAWO,SAAS,OAAO,QAAwC;AAC7D,aAAW,EAAE,WAAW,KAAK,QAAQ;AACnC,UAAM,OAAO,YAAY;AACzB,QAAI,OAAO,SAAS,SAAU,QAAO;AAAA,EACvC;AAEA,SAAO;AACT;AAEO,SAAS,UAAU,QAAwC;AAChE,aAAW,EAAE,WAAW,KAAK,QAAQ;AACnC,UAAM,UAAU,YAAY;AAC5B,QAAI,OAAO,YAAY,SAAU,QAAO;AAAA,EAC1C;AAEA,SAAO;AACT;AAGO,SAAS,iBAAiB,MAAwB;AACvD,MAAI,SAAS,QAAQ,SAAS,OAAW,QAAO;AAEhD,SAAO,OAAO,OAAO,IAA+B,EAAE,KAAK,CAAC,UAAU,UAAU,IAAI;AACtF;AAIO,IAAM,cAAN,cAA0B,MAAM;AAAA,E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