@hyperscale0/cli 1.0.0-beta.26 → 1.0.0-beta.27

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 (3) hide show
  1. package/README.md +61 -120
  2. package/hyperscale.js +52 -43
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,127 +1,68 @@
1
1
  # @hyperscale0/cli
2
2
 
3
- Hyperscale™ CLI: the founder command line. It logs a founder in,
4
- composes Products from HSX source, manages sandbox API keys, and runs one
5
- Product's frozen public actions.
3
+ The Hyperscale developer command line.
6
4
 
7
- ## Install
5
+ ## Start
8
6
 
9
- ```bash
7
+ ```sh
10
8
  npm install -g @hyperscale0/cli
11
- # or run directly with bunx / npx
12
- bunx @hyperscale0/cli --help
9
+ hyperscale auth login --base-url https://dev.hyperscale0.ai
10
+ hyperscale whoami --json
13
11
  ```
14
12
 
15
- ## Quickstart
16
-
17
- Mint a founder PAT in Hyperscale Portal at https://hyperscale0.ai/desk. Open
18
- Security, then Personal access tokens. Unapproved founders can request access at
19
- https://hyperscale0.ai/request-access.
20
-
21
- ```bash
22
- export HYPERSCALE_TOKEN="<your founder PAT>"
23
- bunx @hyperscale0/cli auth login --no-browser
24
- bunx @hyperscale0/cli whoami
25
- bunx @hyperscale0/cli product create --source product.hsx --name "Custom Escrow"
26
- bunx @hyperscale0/cli product select <Product id>
27
- bunx @hyperscale0/cli key create --name "Founder laptop"
28
- bunx @hyperscale0/cli compose check product.hsx
29
- bunx @hyperscale0/cli compose plan product.hsx
30
- bunx @hyperscale0/cli compose apply product.hsx --yes
31
- bunx @hyperscale0/cli activity list
32
- bunx @hyperscale0/cli ops list payment
33
-
34
- export HYPERSCALE_API_KEY="<your Product API key>"
35
- bunx @hyperscale0/cli product actions
36
- bunx @hyperscale0/cli product actions escrow_order.placeBuyerHold --json
37
- bunx @hyperscale0/cli product run escrow_order.placeBuyerHold --input '{"escrowOrderId":"eord_sandbox_..."}'
38
- bunx @hyperscale0/cli call account.list --input '{"limit":5}'
39
- ```
40
-
41
- ## Commands
42
-
43
- `product actions` lists the frozen Product surface. Pass one exact public
44
- operation id such as `escrow_order.placeBuyerHold` to return its full input
45
- schema, output schema, policies, build id, surface version, and operation-set
46
- digest.
47
- `product create` creates and selects a new Product with `--name <name>`
48
- from `--source <file.hsx>`.
49
- `product select <Product id>`
50
- stores the default Product used by compose, key, and Product commands when
51
- `--product` is absent.
52
- `compose check` compiles textual HSX and runs the independent composer check.
53
- `compose plan` diffs it against the selected Product. `compose apply`
54
- recomposes that Product and requires `--confirm`, or `--yes` for an agent.
55
- Compiler or composer refusal exits 2. Transport and server failure exit 1.
56
- `npx @hyperscale0/cli` runs the same commands. Add
57
- `--json` for machine-readable success and failure output.
58
- `auth login --no-browser` skips the localhost browser callback. Without a PAT,
59
- it prints the PAT desk and request-access URL. With `--token` or
60
- `HYPERSCALE_TOKEN`, it validates and stores that founder PAT without opening a
61
- browser.
62
-
63
- Founder PAT commands are `auth`, `whoami`, `product create/list/show/select`,
64
- `compose plan/apply`, `key`, and `activity`. They use
65
- `--token`, `HYPERSCALE_TOKEN`, or a stored login in that order. Product API
66
- key commands are `product actions/run`, `ops list`, and `call`. They use
67
- `HYPERSCALE_API_KEY` and need no founder login profile. `compose check`
68
- runs locally when no founder credential exists. On a clean machine, set the
69
- Product API key and pass `--product <id>`. Use `--base-url` and
70
- `--environment` when their defaults do not name the Product's plane.
71
-
72
- Point it at another host with `--base-url`, and at the live plane with
73
- `--environment live`. Live keys and sandbox keys are never interchangeable.
74
- The CLI stores the founder PAT in macOS Keychain by default. If Keychain is
75
- unavailable, it falls back to an owner-only 0600 file under
76
- `HYPERSCALE_CONFIG_DIR`, or `~/.config/hyperscale` by default. Set
77
- `HYPERSCALE_CREDENTIAL_STORE=file` to choose that file store and skip
78
- Keychain access. `auth logout` deletes local state and does not revoke the
79
- PAT. `auth logout --revoke` revokes the active PAT before deleting local
80
- state. Passkey login stays in the portal at
81
- https://hyperscale0.ai/signin.
82
-
83
- Run `bunx @hyperscale0/cli --help` for the full option list.
84
-
85
- ## Command shapes and automation
86
-
87
- When passing `--json`, commands emit structured JSON to stdout on success.
88
- Commands that create or switch active resources (`product create`, `product select`,
89
- `product show`, `key create`) include a
90
- `nextCommands` string array in their success envelope with recommended follow-up
91
- commands.
92
-
93
- Failures under `--json` emit a single JSON object strictly to stderr, leaving
94
- stdout empty. The stderr failure envelope contains:
95
- - `status`: the numeric HTTP status when the failure came from the API; absent otherwise
96
- - `error.code`: stable error code string
97
- - `error.message`: sanitized diagnostic message (capped at 1024 characters)
98
- - `error.fix`: actionable corrective step
99
- - `error.details`: structured error details or contextual payload
100
- - Correlation fields: `requestId`, `operationId`, `receiptId`, and `traceId` when reported by the upstream API
101
-
102
- ## Pricing and compose flags
103
-
104
- `compose apply` takes one confirmation form:
105
- - `--confirm`: confirm the mutation for a person
106
- - `--yes`: confirm the mutation without a prompt for an agent; accepts the candidate price current at apply time
107
- - `--pricing-identity <id>`: candidate pricing identity from `compose plan`; required with `--confirm` only when scheduled pricing exists
108
- - `--plan-file <path>`: saved JSON plan file from `compose plan --json`; used with `--confirm` to read the pricing identity when scheduled pricing exists
109
-
110
- ## Exit codes
111
-
112
- - `0`: Success
113
- - `1`: General failure (validation error, transport failure, server error, or unknown option)
114
- - `2`: Compiler or composer refusal (such as contract incompatibility or invalid composition)
115
-
116
- ## Reference
117
-
118
- - [Portal desk](https://hyperscale0.ai/desk)
119
- - [Developer entry point](https://hyperscale0.ai/developers)
120
- - [Documentation](https://hyperscale0.ai/docs)
121
-
122
- ## Security and license
123
-
124
- - Security: https://hyperscale0.ai/security
125
- - License: LicenseRef-Hyperscale-Proprietary
126
-
127
- Hyperscale™ is a trademark of Hyperscale LLC.
13
+ Use `bunx @hyperscale0/cli@latest` or `npx @hyperscale0/cli@latest`
14
+ without a global install. Browser login requests read-only scopes through
15
+ portal consent. Request different scopes with `auth login --scopes <scope,...>`.
16
+ The login summary shows the authority actually returned by the server.
17
+ Headless callers can use `auth login --no-browser --token <pat>`.
18
+
19
+ ## Product commands
20
+
21
+ `product select <id>` saves a Product. Member PATs use that Product's route.
22
+ `product actions` lists the selected Build's exact public action names.
23
+ `product run <instrument.action> --input-file request.json` runs one.
24
+ Product API keys still work through `HYPERSCALE_API_KEY` or `--api-key`.
25
+ The server's frozen operation set resolves aliases, never the bundled catalog.
26
+
27
+ `ops list --catalog` browses catalog command data without authentication.
28
+ `ops list` discovers operations for the active credential and Product.
29
+ `call <operation>` calls one with `--input` or `--input-file`.
30
+ `compose check/plan/apply <file.hsx>` uses the server composer.
31
+ Run `hyperscale help <command>` for options and examples.
32
+
33
+ ## Review and resume
34
+
35
+ HTTP 409 `approval_required` prints the server review URL, approval request
36
+ ID, waiting state and a local resume reference. Review happens in the browser.
37
+ Then run `hyperscale resume <reference>`. Resume replays the same origin,
38
+ environment, credential, path, body bytes and idempotency key from secure local
39
+ storage. Body and credential overrides are refused. `--yes` cannot approve
40
+ money. Approval is not evidence of execution.
41
+
42
+ A lost response does not mean failure. Keep the printed operation reference
43
+ and read its status before retrying. Resume never creates a new idempotency key.
44
+ Successful requests remove their saved credential copy. Review and uncertain
45
+ requests remain local until they complete. Logout removes the login credential;
46
+ it does not revoke separately saved pending requests. Use portal token revocation
47
+ if those requests must lose server authority.
48
+
49
+ ## Automation and storage
50
+
51
+ `--json` writes success to stdout and one error object to stderr on failure.
52
+ Errors retain HTTP status, code, message, fix, details and available correlation
53
+ IDs. Approval details include `approvalRequestId`, `reviewUrl`, `state`
54
+ and `resumeReference`. Exit 0 means success, 1 means failure or waiting for
55
+ review, and 2 means composer refusal. JSON help is also available.
56
+
57
+ Human output honors non-TTY streams, narrow terminals and NO_COLOR, including
58
+ an empty NO_COLOR value. Identifiers are never shortened.
59
+
60
+ Credentials and saved requests use macOS Keychain with an owner-only 0600 file
61
+ fallback under `HYPERSCALE_CONFIG_DIR` or `~/.config/hyperscale`.
62
+ `HYPERSCALE_CREDENTIAL_STORE=file` explicitly selects file storage.
63
+ Use `--base-url` or `HYPERSCALE_BASE_URL` for the API origin and
64
+ `--environment sandbox|live` for the environment partition.
65
+ Neither current estate connects to real bank infrastructure.
66
+
67
+ License: LicenseRef-Hyperscale-Proprietary.
68
+ Hyperscale is a trademark of Hyperscale LLC.
package/hyperscale.js CHANGED
@@ -1,44 +1,53 @@
1
1
  #!/usr/bin/env node
2
- import{spawn as Ge}from"node:child_process";import{createHash as Ot}from"node:crypto";import{createServer as jt}from"node:http";import{createInterface as Nt}from"node:readline/promises";import{chmod as he,mkdir as _t,readdir as Lt,readFile as q,rename as Ut,unlink as Ht,writeFile as Dt}from"node:fs/promises";import{homedir as Kt}from"node:os";import{basename as Jt,dirname as ke,join as se}from"node:path";var A={wordmark:"HYPERSCALE",columns:80,accent:{truecolour:[45,75,242],ansi16:34},strong:1,dim:2,reset:0,foregroundReset:39,weightReset:22,rule:"-",policy:{requireTTY:!0,honourNoColor:!0,json:"plain",nonTTY:"plain"}};var N="\x1B",Ue="\x07",Ct=new RegExp(`[${N}](?:\\[[0-?]*[ -/]*[@-~]|\\][^${Ue}${N}]*(?:${Ue}|${N}\\\\)|[PX^_][^${N}]*${N}\\\\|.)|[^\\P{Cc}\\t\\n\\r]`,"gu");function He(e){return String(e??"").replace(Ct,"")}function b(e,t,n){let o=!!e?.isTTY&&t?.NO_COLOR===void 0&&!n?.json,r=(u,l)=>f=>{let m=He(f);return o?`${u}${m}${l}`:m},s=u=>`${N}[${u}m`,i=t&&"COLORTERM"in t?t.COLORTERM:void 0,a=i==="truecolor"||i==="24bit"?`38;2;${A.accent.truecolour.join(";")}`:A.accent.ansi16,c=r(s(A.dim),s(A.weightReset));return{accent:r(s(a),s(A.foregroundReset)),strong:r(s(A.strong),s(A.weightReset)),dim:c,rule:u=>{let l=Number.isFinite(u)?Math.min(A.columns,Math.max(0,Math.floor(u))):A.columns;return c(A.rule.repeat(l))},text:He}}var x={wordmark:"HYPERSCALE",tagline:"For the company you have in mind.",viewBox:"0 0 32 32",strokeWidth:.32,paths:["M16 3.5L28.5 9.75V22.25L16 28.5L3.5 22.25V9.75Z","M3.5 9.75L16 16L28.5 9.75","M16 16V28.5","M16 5L24 9V17L16 21L8 17V9Z","M8 9L16 13L24 9","M16 13V21","M16 7L20 9V13L16 15L12 13V9Z","M12 9L16 11L20 9","M16 11V15"],wordmarkWeight:200,wordmarkTracking:"0.055em",strokeOffsetPx:1,wordmarkGapRatio:.25,construction:{slope:"1/2",halfWidths:[12.5,8,4],centres:[[16,16],[16,13],[16,11]],visibleVertexConnections:0,projection:"Three solid isometric cubes, each drawn as its silhouette and front edges, nesting toward the top corner. The outer cube is centred on the master; the middle and inner cubes sit higher so each rests inside the one before. No connecting edges."},sizeRule:{minimumPx:24,cubeCount:3,detailReduction:!1,description:"Keep all three cubes at every size of 24px or above."}};var eo=[x.paths[0],x.paths[1],x.paths[2],x.paths[3],x.paths[4],x.paths[5],x.paths[6],x.paths[7],x.paths[8]],to=x.strokeOffsetPx+x.strokeWidth;var pe=x.wordmark,no=`${pe}\u2122`,De="Hyperscale\u2122 is a trademark of Hyperscale LLC.";var Ke=x.tagline;function Je(e){return[e.strong(pe),"",Ke,"",e.accent("Run hyperscale auth login to sign in.")].join(`
3
- `)}function Ye(e,t){let n=e.text(t.identity),o=[e.strong("Logged in"),"",` Identity: ${n}`];if(t.team){let r=e.text(t.team);o.push(` Team: ${r}`)}return o.join(`
4
- `)}function fe(e){return[`${e.strong("Usage:")} hyperscale <command> [options]`,"","The founder command line.","",e.strong("Concepts:")," Blueprint -> Product A Blueprint is a public catalog template."," Composing one, or raw HSX, creates a Product."," Founder PAT vs API key A founder PAT manages the company: Blueprints,"," Products, composition, keys. A Product API key"," runs one Product's operations. Not interchangeable."," Actions vs operations product actions / product run execute a Product's"," frozen public contract. ops list / call invoke"," catalog operations from the machine document."," Public discovery blueprint list and blueprint show need no login.","",e.strong("Commands:")," start Create a Product and run its first published step"," help [command] Print help for hyperscale or a specific command"," auth login Sign in through the portal or save a founder PAT"," auth status Verify and show the active founder PAT"," auth logout [--revoke] Forget the local founder PAT, optionally revoke it"," blueprint list List public Blueprints without authentication"," blueprint show <id> Show one public Blueprint"," product create Create a Product from a Blueprint or HSX source"," product list List Products in the signed-in company"," product show [id] Show a Product (default: selected Product)"," product select <id> Select the default Product for later commands"," product actions [op-id] List frozen public actions or describe one exactly"," product run <op-id> Run one frozen public action"," compose check <file.hsx> Compile and check an HSX program"," compose plan <file.hsx> Diff an HSX program against the selected Product"," compose apply <file.hsx> Recompose the selected Product from checked HSX"," key create Create a sandbox Product API key"," key list List keys for the selected Product"," key revoke <id> Revoke a Product API key"," activity list List company activity"," whoami Show the user and company this founder PAT maps to"," ops list [filter] List callable operations (substring filter)"," call <operation> Call one operation by name or operation id","",e.strong("Options:")," --token <pat> Founder PAT (default: $HYPERSCALE_TOKEN)"," --api-key <key> Product API key (default: $HYPERSCALE_API_KEY)"," --base-url <url> API origin (default: $HYPERSCALE_BASE_URL)"," --environment <name> sandbox or live (default: $HYPERSCALE_ENVIRONMENT)"," --no-browser Skip browser login. Needs a PAT or it fails"," --revoke Revoke the founder PAT during auth logout"," --blueprint <slug> Blueprint for start or product create"," --source <file> HSX source for initial Product creation"," --name <name> Product or key name"," --product <id> Product id for key commands and actions"," --catalog-revision <id> Tenant catalog revision for HSX composition"," --json Print machine-readable JSON"," --help, -h Print this help"," --version, -v Print the CLI version","",De].join(`
5
- `)}function me(e,t){if(!t)return[`${e.strong("Usage:")} hyperscale auth login [--no-browser] [--token <pat>]`,"","Sign in through the portal callback or save a founder PAT.","",e.strong("Options:")," --no-browser Skip browser login. Saves the PAT or fails without one."," --token <pat> Founder PAT. Defaults to HYPERSCALE_TOKEN."," --json Print the saved session summary as one JSON document.","",e.strong("Notes:")," Without a PAT, the CLI opens portal sign-in and accepts one callback."," With --no-browser and no token, the command fails with a login error."," Pass HYPERSCALE_TOKEN or --token to save a PAT.","",e.strong("Example:")," hyperscale auth login --no-browser"].join(`
6
- `);if("subcommands"in t)return[`${e.strong("Usage:")} hyperscale ${t.prefix} <subcommand> [options]`,"",`Available ${t.prefix} subcommands:`,...t.subcommands.map(([o,r])=>` ${o.padEnd(20)} ${r}`),"",`Run "hyperscale help ${t.prefix} <subcommand>" for detailed options and examples.`].join(`
7
- `);let n=[`${e.strong("Usage:")} hyperscale ${t.usage}`,"",t.summary,"",e.strong("Options:"),...(t.options??[]).map(o=>` ${o}`)];return t.notes&&t.notes.length>0&&n.push("",e.strong("Notes:"),...t.notes.map(o=>` ${o}`)),t.example&&n.push("",e.strong("Example:"),` ${t.example}`),n.join(`
8
- `)}function _(e,t){let n=[];if(t.title&&n.push(e.strong(e.text(t.title)),""),t.columns.length===0)return n.join(`
9
- `);let o=t.columns.map(a=>e.text(a)),r=t.rows.map(a=>a.map(c=>e.text(c))),s=o.map((a,c)=>Math.max(a.length,...r.map(u=>(u[c]??"").length)));if(s.reduce((a,c)=>a+c,0)+2*(o.length-1)<=80){let a=o.map((c,u)=>u===o.length-1?c:c.padEnd(s[u])).join(" ");n.push(e.strong(a));for(let c of r){let u=o.map((l,f)=>{let m=c[f]??"";return f===o.length-1?m:m.padEnd(s[f])}).join(" ");n.push(u)}}else{let a=Math.max(...o.map(c=>c.length));for(let c=0;c<r.length;c++){let u=r[c];c>0&&n.push("");for(let l=0;l<o.length;l++){let f=o[l],m=u[l]??"";n.push(` ${f.padEnd(a)}: ${m}`)}}}return n.join(`
10
- `)}function L(e,t){let n=[];if(t.title&&n.push(e.strong(e.text(t.title)),""),t.fields.length===0)return n.join(`
11
- `);let o=t.fields.map(([s,i])=>[e.text(s),e.text(i)]),r=Math.max(...o.map(([s])=>s.length));for(let[s,i]of o){let a=` ${(s+":").padEnd(r+3)}`;if(i.includes(`
12
- `)){let c=i.split(`
13
- `);n.push(`${a}${c[0]}`);let u=" ".repeat(a.length);for(let l=1;l<c.length;l++)n.push(`${u}${c[l]}`)}else n.push(`${a}${i}`)}return n.join(`
14
- `)}function Me(e,t){let n=e.text(t.action),o=e.text(t.subject),r=typeof t.confirmation=="string"&&t.confirmation.trim()?e.text(t.confirmation):"Continue?";return[e.strong("Confirm mutation"),"",` Action: ${n}`,` Subject: ${o}`,"",` ${r} [y/N]`].join(`
15
- `)}function qe(e,t){let n=e.text(String(t.code)),o=e.text(t.message),r=e.accent(t.nextStep);return[e.strong(`Error [${n}]`),o,"",`Next step: ${r}`].join(`
16
- `)}var Xe="https://hyperscale0.ai",Ze="sandbox",Se="hyperscale-cli-session",Yt="/v1/personal-access-tokens/current",Ie=process.platform==="darwin"?"/usr/bin/security":null,Mt="config.json",Re="https://hyperscale0.ai/desk/security/tokens",Qe="https://hyperscale0.ai/request-access",Be=`Mint a founder PAT in Hyperscale Portal at ${Re}. Open Security, then Personal access tokens.`,qt=`Not logged in. Run "hyperscale auth login" to open Hyperscale Portal sign-in. In a headless environment, mint a founder PAT in Hyperscale Portal at ${Re}. Open Security, then Personal access tokens. Then set HYPERSCALE_TOKEN or pass --token. Unapproved founders can request access at ${Qe}.`,Bt=`Run "hyperscale auth login". For headless use, mint a founder PAT in Hyperscale Portal at ${Re}. Open Security, then Personal access tokens. Unapproved founders can request access at ${Qe}.`,Pe=3e4,Ft=2e3,Wt=120*1e3,ye={"auth login":{usage:"auth login [--no-browser] [--token <pat>]",summary:"Sign in through the portal callback or save a founder PAT.",options:["--no-browser Skip browser login. Saves the PAT or fails without one.","--token <pat> Founder PAT. Defaults to HYPERSCALE_TOKEN.","--json Print the saved session summary as one JSON document."],notes:["Without a PAT, the CLI opens portal sign-in and accepts one","localhost callback.","With --no-browser and no token, the command fails with a login","error and fix text. Pass HYPERSCALE_TOKEN or --token to save a PAT.","Set HYPERSCALE_CREDENTIAL_STORE=file to use the 0600 profile file","instead of macOS Keychain."],example:"hyperscale auth login --no-browser"},"auth status":{usage:"auth status [--json]",summary:"Verify and show the active founder PAT and selected Product.",options:["--json Print machine-readable JSON."],example:"hyperscale auth status --json"},"auth logout":{usage:"auth logout [--revoke] [--json]",summary:"Forget the local founder PAT. Optionally revoke it first.",options:["--revoke Revoke the PAT before deleting local state.","--json Print machine-readable JSON."],example:"hyperscale auth logout --revoke"},"product create":{usage:"product create --source <file> --name <name> [--catalog-revision <id>] [--json]",summary:"Create and select a Product. The command refuses a duplicate name.",options:["--source <file> HSX source file for initial Product creation.","--name <name> Required Product name.","--catalog-revision <id> Tenant catalog revision for HSX composition.","--json Print the creation summary as JSON."],example:'hyperscale product create --source product.hsx --name "Custom Product"'},"product list":{usage:"product list [--json]",summary:"List Products in the signed-in company.",options:["--json Print the complete collection as JSON."],example:"hyperscale product list"},"product show":{usage:"product show [id] [--json]",summary:"Show a Product summary, or the complete Product document as JSON.",options:["--json Print the complete Product document."],example:"hyperscale product show prd_sandbox_..."},"product select":{usage:"product select <id> [--json]",summary:"Verify a Product and save it as the default for later commands.",options:["--token <pat> Founder PAT. Defaults to HYPERSCALE_TOKEN or the stored login.","--base-url <url> API origin. Defaults to the active founder profile.","--environment <name> sandbox or live. Defaults to the active founder profile.","--json Print the selected Product id as JSON."],notes:["The CLI stores the selection in the active founder profile.","Product show, compose plan/apply, and key commands use it when --product is absent.","Product create selects the Product it creates."],example:"hyperscale product select prd_sandbox_..."},"product actions":{usage:"product actions [operation-id] [--product <id>] [--json]",summary:"List frozen public actions or show one action's full schemas.",options:["--product <id> Product to inspect. Defaults to the selected Product.","--api-key <key> Product API key. Defaults to HYPERSCALE_API_KEY.","--json Print machine-readable JSON."],notes:["Setup operation details include the public input schema used by hyperscale call.","When that schema has no required fields, omit --input or pass {}."],example:"hyperscale product actions escrow_order.placeBuyerHold --json"},"product run":{usage:"product run <operation-id> [--input <json> | --input-file <path>] [--idempotency-key <key>] [--json]",summary:"Run one frozen public action with a Product API key.",options:["--input <json> JSON input object. Stdin is used when piped.","--input-file <path> Read the JSON input object from a file.","--product <id> Product to call. Defaults to the selected Product.","--api-key <key> Product API key. Defaults to HYPERSCALE_API_KEY.","--idempotency-key <key> Send this exact Idempotency-Key header. The default is a generated UUID.","--json Print the key, receipt ids, and output as JSON."],notes:["Reuse an Idempotency-Key only with the same operation and input.",'If a bounded validation value appears as "[Truncated]", run "hyperscale product actions <operation-id>" for the full input schema.'],example:`hyperscale product run escrow_order.placeBuyerHold --input '{"escrowOrderId":"eord_sandbox_..."}' --idempotency-key hold-001`},"compose check":{usage:"compose check <file.hsx> [--catalog-revision <id>] [--json]",summary:"Ask the server to compile and check an HSX program.",options:["--catalog-revision <id> Compile against this immutable tenant catalog revision.","--json Print diagnostics and the verdict as JSON."],example:"hyperscale compose check product.hsx"},"compose plan":{usage:"compose plan <file.hsx> [--product <id>] [--catalog-revision <id>] [--json]",summary:"Diff an HSX program against a Product.",options:["--product <id> Product to compare. Defaults to the selected Product.","--catalog-revision <id> Compile against this immutable tenant catalog revision.","--json Print the plan as JSON."],example:"hyperscale compose plan product.hsx --json"},"compose apply":{usage:"compose apply <file.hsx> (--confirm [--pricing-identity <id> | --plan-file <path>] | --yes) [--product <id>] [--catalog-revision <id>] [--json]",summary:"Recompose the selected Product from checked HSX.",options:["--confirm Confirm the mutation for a person.","--yes Confirm the mutation without a prompt for an agent; accepts the candidate price current at apply time.","--pricing-identity <id> Candidate pricing identity from compose plan. Required with --confirm only when scheduled pricing exists.","--plan-file <path> Saved JSON plan file from compose plan --json. Used with --confirm to extract pricing identity when scheduled pricing exists.","--product <id> Product to recompose. Defaults to the selected Product.","--catalog-revision <id> Compile and persist against this immutable tenant catalog revision.","--json Print the result as JSON."],notes:["Apply --confirm requires a reviewed pricing identity or saved plan only when plan.pricing.scheduled exists; --yes selects the current candidate."],example:"hyperscale compose apply product.hsx --yes --pricing-identity <id>"},"key create":{usage:"key create [--name <name>] [--product <id>] [--json]",summary:"Create a sandbox Product API key.",options:["--name <name> Key name. Defaults to Founder CLI.","--product <id> Product for the key. Defaults to the selected Product.","--json Print the one-time secret and key metadata as JSON."],example:'hyperscale key create --name "Founder laptop"'},"key list":{usage:"key list [--product <id>] [--json]",summary:"List keys for one Product.",options:["--product <id> Product to inspect. Defaults to the selected Product.","--json Print the collection as JSON."],example:"hyperscale key list --json"},"key revoke":{usage:"key revoke <id> [--product <id>] [--json]",summary:"Revoke one Product API key.",options:["--product <id> Product that owns the key. Defaults to the selected Product.","--json Print the result as JSON."],example:"hyperscale key revoke key_sandbox_..."},"activity list":{usage:"activity list [--json]",summary:"List company activity with timestamps and resource targets.",options:["--json Print the complete collection as JSON."],example:"hyperscale activity list"},whoami:{usage:"whoami [--json]",summary:"Show the user and company the founder PAT resolves to.",options:["--json Print machine-readable JSON."],example:"hyperscale whoami --json"},"ops list":{usage:"ops list [filter] [--product <id>] [--json]",summary:"List callable operations from the Product machine document.",options:["filter Optional case-insensitive substring filter matching operation names and paths.","--product <id> Product to inspect. The Product API key must belong to it.","--api-key <key> Product API key. Defaults to HYPERSCALE_API_KEY.","--json Print matching operations as JSON."],notes:["The optional filter argument matches operation names and paths by case-insensitive substring."],example:"hyperscale ops list account"},call:{usage:"call <operation> [--input <json> | --input-file <path>] [--idempotency-key <key>] [--product <id>]",summary:"Call one operation from the Product machine document.",options:["--input <json> JSON input object. Stdin is used when piped.","--input-file <path> Read the JSON input object from a file.","--product <id> Product to call. The Product API key must belong to it.","--api-key <key> Product API key. Defaults to HYPERSCALE_API_KEY.","--idempotency-key <key> Send this exact Idempotency-Key header for a mutation. The default is a generated UUID."],notes:["Reuse an Idempotency-Key only with the same operation and input."],example:`hyperscale call account.create --input '{"currency":"SAR"}'`},help:{usage:"help [command]",summary:"Print help for hyperscale or a specific command.",options:[],notes:['Pass a command name to read its usage, options, and examples (e.g. "hyperscale help product create").'],example:"hyperscale help product create"}};function Fe(e,t){let n=t??b(process.stdout,process.env,{json:!1}),o=Object.keys(ye).sort((a,c)=>c.split(" ").length-a.split(" ").length),r=o.find(a=>a.split(" ").every((u,l)=>e[l]===u));if(r){let a=ye[r];return me(n,{usage:a.usage,summary:a.summary,options:a.options,notes:a.notes,example:a.example})}let s=e.join(" "),i=o.filter(a=>a.startsWith(`${s} `));if(i.length>0)return me(n,{prefix:s,subcommands:i.map(a=>[a.slice(s.length+1),ye[a].summary])});throw new d(`No help for ${e.join(" ")}. Run "hyperscale --help" to list commands.`,{fix:'Run "hyperscale --help" to list commands.'})}var d=class extends Error{constructor(t,n={}){super(t),typeof n.code=="string"&&(this.code=n.code),n.details!==void 0&&(this.details=n.details),Number.isInteger(n.exitCode)&&(this.exitCode=n.exitCode),typeof n.fix=="string"&&(this.fix=n.fix)}},O=class extends d{constructor(t,{requestId:n,status:o,code:r,details:s,operationId:i,receiptId:a,traceId:c,structuredError:u,fix:l}={}){super(t,{code:r,details:s,fix:l}),this.requestId=n,this.status=o,this.operationId=i??null,this.receiptId=a??null,this.traceId=c??null,this.structuredError=u}};function J(){return new d(qt,{fix:Bt})}function et(e){let t=e??"<id>";return new d(`This command needs a Product API key. Create one with "hyperscale key create --name 'Founder CLI' --product ${t}", then set HYPERSCALE_API_KEY or pass --api-key.`,{fix:`Run "hyperscale key create --name 'Founder CLI' --product ${t}", then set HYPERSCALE_API_KEY or pass --api-key.`})}var te=class extends d{constructor(t,n){super(t),this.code="check_failed",this.details=n,this.exitCode=2}},zt=new Set(["--api-key","--base-url","--catalog-revision","--environment","--idempotency-key","--input","--input-file","--name","--plan-file","--pricing-identity","--product","--source","--token"]);function Vt(e){let t=[],n={};for(let o=0;o<e.length;o+=1){let r=e[o];if(r==="-h")r="--help";else if(r==="-v")r="--version";else if(r.startsWith("-")&&!r.startsWith("--"))throw new d(`Unknown option: ${r}`);if(!r.startsWith("--")){t.push(r);continue}if(zt.has(r)){let s=e[o+1];if(s===void 0)throw new d(`${r} needs a value`);n[r]=s,o+=1;continue}if(r==="--help"||r==="--version"||r==="--json"||r==="--confirm"||r==="--yes"||r==="--no-browser"||r==="--revoke"){n[r]=!0;continue}throw new d(`Unknown option: ${r}`)}return{flags:n,positional:t}}function We(e,t){let n=e["--api-key"]??t.HYPERSCALE_API_KEY;if(!n)throw et();let o=e["--environment"]??t.HYPERSCALE_ENVIRONMENT??Ze;if(o!=="sandbox"&&o!=="live")throw new d(`Unknown environment: ${o}. Use sandbox or live.`);let r=(e["--base-url"]??t.HYPERSCALE_BASE_URL??Xe).replace(/\/+$/,"");return{apiKey:n,baseUrl:r,environment:o}}function ne(e,t,n={}){let o=e["--environment"]??t.HYPERSCALE_ENVIRONMENT??n.environment??Ze;if(o!=="sandbox"&&o!=="live")throw new d(`Unknown environment: ${o}. Use sandbox or live.`);let r=(e["--base-url"]??t.HYPERSCALE_BASE_URL??n.baseUrl??Xe).replace(/\/+$/,"");return ve(r),{baseUrl:r,environment:o}}function tt(e){return e.HYPERSCALE_CONFIG_DIR??se(Kt(),".config","hyperscale")}function nt(e){return se(tt(e),Mt)}function R(e,t){return se(tt(t),`session-${B(e)}.json`)}function ie(e){let t=e.HYPERSCALE_CREDENTIAL_STORE??"auto";if(t==="auto"||t==="file")return t;throw new d(`Unknown HYPERSCALE_CREDENTIAL_STORE value: ${t}. Use auto or file.`)}async function Ee(e,t){let n=R(e,t),o=`${Jt(n)}.`,r;try{r=await Lt(ke(n),{withFileTypes:!0})}catch(s){if(s&&s.code==="ENOENT")return;throw s}for(let s of r){if(!s.isFile()||!s.name.startsWith(o))continue;let i=s.name.slice(o.length);/^\d+\.[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.tmp$/.test(i)&&await M(se(ke(n),s.name))}}async function Gt(e){try{return JSON.parse(await q(e,"utf8"))}catch(t){if(t&&t.code==="ENOENT")return null;throw t instanceof SyntaxError?new d(`The CLI profile at ${e} is corrupt: not valid JSON.`,{code:"corrupt_profile",fix:`Back up or remove ${e} before logging in again with "hyperscale auth login" (or "hyperscale auth login --no-browser").`}):t}}async function Y(e,t){let n=Xt(e);await _t(n,{mode:448,recursive:!0}),await he(n,448);let o=`${e}.${process.pid}.${globalThis.crypto.randomUUID()}.tmp`;await Dt(o,t,{flag:"wx",mode:384}),await he(o,384);try{await Ut(o,e),await he(e,384)}catch(r){throw await M(o),r}}function Xt(e){return ke(e)}async function M(e){try{await Ht(e)}catch(t){if(!t||t.code!=="ENOENT")throw t}}function Zt(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new d(`The CLI profile at ${t} is corrupt: not a profile object.`,{code:"corrupt_profile",fix:`Back up or remove ${t} before logging in again with "hyperscale auth login" (or "hyperscale auth login --no-browser").`});let{baseUrl:n,email:o,environment:r,selectedProduct:s}=e;if(typeof n!="string"||typeof o!="string"||r!=="sandbox"&&r!=="live"||!(s===null||typeof s=="string"))throw new d(`The CLI profile at ${t} is corrupt: invalid profile fields.`,{code:"corrupt_profile",fix:`Back up or remove ${t} before logging in again with "hyperscale auth login" (or "hyperscale auth login --no-browser").`});return{baseUrl:n,email:o,environment:r,selectedProduct:s}}async function ae(e){let t=nt(e),n=await Gt(t);return n===null?null:Zt(n,t)}async function Te(e,t){let n={email:t.email,baseUrl:t.baseUrl,environment:t.environment,selectedProduct:t.selectedProduct??null};await Y(nt(e),`${JSON.stringify(n,null,2)}
17
- `)}function B(e){return Ot("sha256").update(`${e.baseUrl}\0${e.environment}\0${e.email}`).digest("hex")}async function ce(e,t){return Ie===null?{error:null,status:null,stdout:"",unavailable:!0}:await new Promise(n=>{let o={...process.env};delete o.HYPERSCALE_API_KEY,delete o.HYPERSCALE_TOKEN;let r=Ge(Ie,e,{env:o,stdio:["pipe","pipe","pipe"]}),s=[],i=!1,a=u=>{i||(i=!0,clearTimeout(c),n(u))},c=setTimeout(()=>{r.kill("SIGKILL"),a({error:null,status:null,stdout:"",unavailable:!0})},Ft);r.stdout.on("data",u=>s.push(u)),r.stderr.on("data",()=>{}),r.stdin.on("error",()=>{}),r.once("error",u=>a({error:u,status:null,stdout:"",unavailable:!0})),r.once("close",u=>a({error:null,status:u,stdout:Buffer.concat(s).toString("utf8"),unavailable:!1})),t===void 0?r.stdin.end():r.stdin.end(`${t}
18
- `)})}async function Ce(){return(await ce(["show-keychain-info"])).status===0}function ot(e){try{let t=typeof e=="string"?JSON.parse(e):e;if(t&&typeof t=="object"&&!Array.isArray(t)&&typeof t.token=="string"&&typeof t.tenantId=="string"&&(t.personalAccessTokenId===void 0||typeof t.personalAccessTokenId=="string")&&(t.tokenName===void 0||typeof t.tokenName=="string"))return{token:t.token,tenantId:t.tenantId,...t.personalAccessTokenId?{personalAccessTokenId:t.personalAccessTokenId}:{},...t.tokenName?{tokenName:t.tokenName}:{}}}catch{}return null}async function Qt(e,t,n){await Ee(e,n);let o=B(e);if(ie(n)==="auto"&&await Ce()){let r=JSON.stringify(t),s=["add-generic-password","-a",o,"-s",Se,"-U","-X",Buffer.from(r,"utf8").toString("hex")].join(" ");if((await ce(["-i"],s)).status===0)return await M(R(e,n)),"keychain"}return await Y(R(e,n),`${JSON.stringify({account:o,activeStore:"file",credential:t})}
19
- `),"file"}async function en(e,t){let n=B(e);try{let o=JSON.parse(await q(R(e,t),"utf8"));if(!o||typeof o!="object"||Array.isArray(o)||o.account!==n)return{state:"invalid"};if(o.revoked===!0)return{state:"revoked"};let r=ot(o.credential);return r?{activeStore:o.activeStore==="file"?"file":null,credential:r,state:"valid"}:{state:"invalid"}}catch(o){return o&&o.code==="ENOENT"?{state:"missing"}:{state:"invalid"}}}async function rt(e,t){await Ee(e,t);let n=ie(t),o=await en(e,t);if(o.state==="revoked")return null;if(o.state==="valid"&&(o.activeStore==="file"||n==="file"))return o.credential;if(n==="file")return null;let r=null;if(await Ce()){let s=await ce(["find-generic-password","-a",B(e),"-s",Se,"-w"]);s.status===0&&(r=ot(s.stdout.trim()))}return r||(o.state==="valid"?o.credential:null)}async function st(e,t){await Ee(e,t);let n=B(e);if(ie(t)==="file")return await Y(R(e,t),`${JSON.stringify({account:n,revoked:!0})}
20
- `),{keychainDeleted:!0};if(Ie===null)return await M(R(e,t)),{keychainDeleted:!0};if(!await Ce())return await Y(R(e,t),`${JSON.stringify({account:n,revoked:!0})}
21
- `),{keychainDeleted:!1};let o=await ce(["delete-generic-password","-a",n,"-s",Se]);return o.status!==0&&o.status!==44?(await Y(R(e,t),`${JSON.stringify({account:n,revoked:!0})}
22
- `),{keychainDeleted:!1}):(await M(R(e,t)),{keychainDeleted:!0})}function it(e,t){return e["--token"]!==void 0?e["--token"]:t.HYPERSCALE_TOKEN||void 0}async function $(e,t,n=!1){let o=await ae(t),r=it(e,t);if(r!==void 0){if(!r)throw J();let a=ne(e,t,o??{}),c=await U(a,r),u=o?.baseUrl===a.baseUrl&&o.environment===a.environment&&o.email===c.email;return{...a,email:c.email,identity:c,personalAccessTokenId:c.personalAccessTokenId,selectedProduct:u?o.selectedProduct:null,tenantId:c.tenantId,token:r,tokenName:c.name}}if(!o){if(n)return null;throw J()}let s=ne(e,t,o);if(s.baseUrl!==o.baseUrl||s.environment!==o.environment)throw new d(`The active founder login belongs to ${o.baseUrl} (${o.environment}). Log in again to change it.`);let i=await rt(o,t);if(!i){if(n)return null;throw J()}return{...o,...i}}function w(e){return e.replace(new RegExp("\\p{Cc}","gu"),t=>`
23
- \r`.includes(t)?t:"")}function at(e){try{return new URL(e).origin}catch{return null}}function ve(e){let t;try{t=new URL(e)}catch{t=null}if(!t||t.origin!==e)throw new d(`Invalid API origin: ${e}. Use a scheme, host, and optional port with nothing after them, such as https://hyperscale0.ai.`);let n=["localhost","127.0.0.1","[::1]","::1"].includes(t.hostname);if(t.protocol!=="https:"&&!(t.protocol==="http:"&&n))throw new d(`Refusing cleartext API origin ${e}: no credential was sent. Use https://${t.host} instead, or keep http:// only for a loopback API such as http://127.0.0.1:8787.`);return t.origin}var tn=/(?<![A-Za-z0-9_-])(?:hyperscale|arc)_[A-Za-z0-9_-]{32,}(?![A-Za-z0-9_-])/g,nn=/(?<![A-Za-z0-9_-])whsec_[A-Za-z0-9+/=]{32,}(?![A-Za-z0-9+/=])/g;function y(e,t=[]){let n=e;for(let o of t)typeof o=="string"&&o.length>0&&(n=n.replaceAll(o,"[redacted]"));return n.replaceAll(tn,"[redacted]").replaceAll(nn,"[redacted]")}function ct(e,t=[]){if(!e?.ok||!e?.headers)return;let n=e.headers.get("x-request-id"),o=e.headers.get("hyperscale-operation-id"),r=e.headers.get("hyperscale-receipt-id"),s=n?y(n,t):null,i=o?y(o,t):null,a=r?y(r,t):null;s&&process.stderr.write(`Request id: ${s}
24
- `),i&&process.stderr.write(`Operation: ${i}
25
- `),a&&process.stderr.write(`Receipt: ${a}
26
- `)}async function Oe(e,t,n={},o){let r=`${e.baseUrl}${t}`,s=ve(e.baseUrl);if(at(r)!==s)throw new d(`The requested path ${t} leaves the ${s} origin; refusing the request.`);let i=[o].filter(Boolean);try{let a=await fetch(r,{...n,headers:{accept:"application/json",...o?{authorization:`Bearer ${o}`}:{},"x-hyperscale-environment":e.environment,...n.headers},signal:AbortSignal.timeout(Pe),redirect:"manual"});if(a.status>=300&&a.status<400){let c=w(y(r,i));throw new d(`${c} redirected, so no credential was sent on. Point --base-url at the origin the API answers on.`,{code:"unexpected_redirect",fix:"Point --base-url at the origin the API answers on."})}return ct(a,i),{response:a,text:w(await a.text())}}catch(a){if(a instanceof d)throw a;let c=w(y(r,i)),u=n.headers?.["idempotency-key"]??n.headers?.["Idempotency-Key"],l=u?w(y(u,i)):void 0,f=w(y(a?.message??"network failure",i)),m=l?`Retry the request with the same idempotency key: ${l}.`:`Check that --base-url names the Hyperscale API origin and connectivity to ${c}.`;throw new d(`Could not reach ${c}: ${f}`,{code:"transport_error",details:{...l?{idempotencyKey:l}:{},path:t,url:c},fix:m})}}async function E(e,t,n={},o,r=[]){let{response:s,text:i}=await Oe(e,t,n,o);if(!s.ok)throw de(s,i,r);try{return JSON.parse(i)}catch{throw new d(`HTTP ${s.status} returned invalid JSON`)}}function C(e,t=globalThis.crypto.randomUUID()){return{body:JSON.stringify(e),headers:{"content-type":"application/json","idempotency-key":t},method:"POST"}}async function on(){let e=[];for await(let t of process.stdin)e.push(Buffer.from(t));return Buffer.concat(e).toString("utf8")}async function ue(e,t,n={},o){let r=`${e.baseUrl}${t}`,s=ve(e.baseUrl);if(at(r)!==s)throw new d(`The product document puts ${t} on another origin than the ${s} you configured; refusing to send the key there.`);let i=[e.apiKey].filter(Boolean);try{let a=await fetch(r,{...n,headers:{accept:"application/json",authorization:`Bearer ${e.apiKey}`,"x-hyperscale-environment":e.environment,...n.headers},signal:AbortSignal.timeout(Pe),redirect:"manual"});if(a.status>=300&&a.status<400){let c=w(y(r,i));throw new d(`${c} redirected, so the key was not sent on. Point --base-url at the origin the API answers on; the usual cause is http:// where it serves https://.`,{code:"unexpected_redirect",fix:"Point --base-url at the origin the API answers on; the usual cause is http:// where it serves https://."})}return ct(a,i),{response:a,text:w(await a.text())}}catch(a){if(a instanceof d)throw a;if(o&&(a?.name==="TimeoutError"||a?.name==="AbortError"))throw new d(`product run ${o} timed out after ${Pe/1e3} seconds.`);let c=w(y(r,i)),u=n.headers?.["idempotency-key"]??n.headers?.["Idempotency-Key"],l=u?w(y(u,i)):void 0,f=w(y(a?.message??"network failure",i)),m=l?`Retry the request with the same idempotency key: ${l}.`:`Check that --base-url names the Hyperscale API origin and connectivity to ${c}.`;throw new d(`Could not reach ${c}: ${f}`,{code:"transport_error",details:{...l?{idempotencyKey:l}:{},path:t,url:c},fix:m})}}async function ut(e){let{response:t,text:n}=await ue(e,"/v1/product.json");if(!t.ok)throw de(t,n,[e.apiKey]);let o=rn(n);if(!o)throw new d("The product document is not in the expected format.",{fix:'Run the latest unpinned CLI (e.g. "bunx @hyperscale0/cli@latest <command>"), or report the issue without including credentials.'});if(e.productId&&o.productId===void 0)throw new d(`The server's product document names no Product, so "--product ${e.productId}" cannot be checked against the API key. The platform predates Product identity in the descriptor: redeploy it, or drop --product.`);if(e.productId&&o.productId&&e.productId!==o.productId)throw new d(`Selected Product ${e.productId} does not match API key Product ${o.productId}. Run "hyperscale product select ${o.productId}" or pass "--product ${o.productId}". Or set HYPERSCALE_API_KEY to a key for ${e.productId}, or pass that key with --api-key.`);let r=o.operations.map(s=>{if(typeof s.summary!="string"||typeof s.description!="string")throw new d(`The product document carries no prose for ${s.operationId}. The server descriptor predates operation prose. Redeploy the platform, then recompose the Product.`);return{description:s.description,idempotency:s.idempotency,method:s.method,name:s.name,operationId:s.operationId,path:s.path,summary:s.summary}});return{compositionId:o.composition.id,operations:r,packageName:o.sdk?o.sdk.packageName.trim():null,title:o.title.trim()}}function rn(e){let t;try{t=JSON.parse(e)}catch{return null}let n=be(t),o=r=>typeof r=="string";if(!K(n)||n.schemaVersion!==1||!(n.productId===void 0||o(n.productId))||!o(n.title)||!K(n.composition)||!o(n.composition.id)||!Array.isArray(n.operations))return null;for(let r of n.operations)if(!K(r)||!o(r.method)||!o(r.path)||!o(r.name)||!o(r.operationId)||!o(r.idempotency))return null;return n.sdk!==void 0&&(!K(n.sdk)||!o(n.sdk.packageName))?null:n}function K(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function be(e){return typeof e=="string"?w(e):Array.isArray(e)?e.map(be):K(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[w(t),be(n)])):e}function dt(e){let t=e.get("x-trace-id");if(t&&t.trim()!=="")return t.trim();let n=e.get("traceparent");if(n){let o=/^00-([0-9a-fA-F]{32})-[0-9a-fA-F]{16}-[0-9a-fA-F]{2}$/.exec(n.trim());if(o)return o[1]}return null}function sn(e){if(!e||e.trim()==="")return null;try{return JSON.parse(e)}catch{return e}}function lt(e,t,n=[]){let o=e?.get?.("x-request-id")??t??null,r=e?.get?.("hyperscale-operation-id")??null,s=e?.get?.("hyperscale-receipt-id")??null,i=e?dt(e):null;return{requestId:o?w(y(o,n)):null,operationId:r?w(y(r,n)):null,receiptId:s?w(y(s,n)):null,traceId:i?w(y(i,n)):null}}function oe(e,t=[]){if(typeof e=="string")return w(y(e,t));if(Array.isArray(e))return e.map(n=>oe(n,t));if(e&&typeof e=="object"){let n=[];for(let[o,r]of Object.entries(e)){let s=w(y(o,t));n.push([s,oe(r,t)])}return Object.fromEntries(n)}return e}function pt(e,t=[],n){let o;try{o=JSON.parse(e)}catch{o=null}let r=o&&typeof o=="object"&&o.error&&typeof o.error=="object"?o.error:null;if(r){let a=typeof r.code=="string"?r.code:void 0,c=typeof r.fix=="string"?r.fix:void 0,u=c?w(y(c,t)):void 0,l=typeof r.message=="string"?r.message:n?`HTTP ${n}`:"HTTP error",f=w(y(l,t)),m=f.length>1024?f.slice(0,1024):f,k=a&&typeof r.message=="string"?`${a}: ${m}`:m,g=r.details!==void 0?oe(r.details,t):void 0,h=o&&typeof o=="object"&&typeof o.requestId=="string"?w(y(o.requestId,t)):void 0;return{code:a,details:g,fix:u,humanMessage:k,redactedMessage:m,requestId:h,structuredError:{code:a??"http_error",message:m,...g!==void 0?{details:g}:{},...u!==void 0?{fix:u}:{}}}}let s=n?`HTTP ${n}`:"HTTP error",i="Check that --base-url names the Hyperscale API origin, or report the issue without including credentials.";return{code:"http_error",details:void 0,fix:i,humanMessage:s,redactedMessage:s,requestId:void 0,structuredError:{code:"http_error",message:s,fix:i}}}function de(e,t,n=[]){let o=pt(t,n,e.status),r=lt(e.headers,o.requestId,n),s=o.humanMessage;return new O(`HTTP ${e.status}${s?` \xB7 ${s}`:""}${r.requestId?`
27
- Request id: ${r.requestId}`:""}`,{code:o.code,details:o.details,fix:o.fix,operationId:r.operationId,receiptId:r.receiptId,requestId:r.requestId,status:e.status,structuredError:o.structuredError,traceId:r.traceId})}function je(e,t){return{authenticated:!0,baseUrl:e.baseUrl,email:t.email,environment:e.environment,expiresAt:t.expiresAt,personalAccessTokenId:t.personalAccessTokenId,role:t.role,scopes:t.scopes,selectedProduct:e.selectedProduct,teamId:t.teamId,tenantId:t.tenantId,tokenName:t.name,userId:t.userId}}function an(e){if(!e||typeof e!="object"||typeof e.userId!="string"||typeof e.email!="string"||typeof e.tenantId!="string"||typeof e.teamId!="string"||typeof e.role!="string"||typeof e.personalAccessTokenId!="string"||typeof e.name!="string"||!Array.isArray(e.scopes)||e.scopes.some(t=>typeof t!="string")||typeof e.expiresAt!="string"||e.status!=="active")throw new d("personal_access_token.current returned invalid data");return e}async function U(e,t){try{return an(await E(e,Yt,{},t,[t]))}catch(n){throw!(n instanceof O)||n.status!==401?n:new d(`That founder PAT was not accepted (HTTP 401). ${Be}${n.requestId?` Request id: ${n.requestId}.`:""}`,{code:"founder_pat_rejected",fix:Be})}}function cn(e,t){return e.HYPERSCALE_CLI_BROWSER?{command:e.HYPERSCALE_CLI_BROWSER,args:[t]}:e.HYPERSCALE_NO_BROWSER==="1"||e.CI==="1"||e.CI==="true"||process.platform==="linux"&&!e.DISPLAY&&!e.WAYLAND_DISPLAY?null:process.platform==="darwin"?{command:"/usr/bin/open",args:[t]}:process.platform==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",t]}:{command:"xdg-open",args:[t]}}async function un(e,t){let n=cn(e,t);return n?new Promise(o=>{let r=Ge(n.command,n.args,{detached:!0,stdio:"ignore"});r.once("error",()=>o(!1)),r.once("spawn",()=>{r.unref(),o(!0)})}):!1}function ge(e){return new Promise(t=>{if(!e.listening){t();return}e.close(()=>t())})}async function dn(e,t){let n=globalThis.crypto.randomUUID(),o=!1,r,s=new Promise((g,h)=>{r={reject:h,resolve:g}}),i=jt((g,h)=>{let I=new URL(g.url??"/","http://127.0.0.1");if(g.method!=="GET"||I.pathname!=="/callback"){h.writeHead(404,{"content-type":"text/plain; charset=utf-8"}),h.end(`Not found.
28
- `);return}if(o){h.writeHead(409,{"content-type":"text/plain; charset=utf-8"}),h.end(`Login callback was already received.
29
- `);return}if(I.searchParams.get("state")!==n){h.writeHead(400,{"content-type":"text/plain; charset=utf-8"}),h.end(`Login state did not match. Return to the terminal.
30
- `);return}if(I.searchParams.get("error")!==null){o=!0,h.writeHead(200,{"content-type":"text/plain; charset=utf-8"}),h.end(`Login declined. Return to the terminal.
31
- `),r.reject(new d("Portal login was declined. Run hyperscale auth login to start again.",{code:"auth_callback_denied"}));return}let T=I.searchParams.get("grant"),v=I.searchParams.get("tenantId");if(!T||!v){h.writeHead(400,{"content-type":"text/plain; charset=utf-8"}),h.end(`Login callback is missing its grant or tenant.
32
- `);return}o=!0,h.writeHead(200,{"content-type":"text/plain; charset=utf-8"}),h.end(`Login received. Return to the terminal.
33
- `),r.resolve({grant:T,tenantId:v})});await new Promise((g,h)=>{let I=T=>h(T);i.once("error",I),i.listen(0,"127.0.0.1",()=>{i.off("error",I),g()})}),i.once("error",g=>r.reject(g));let a=i.address();if(!a||typeof a=="string")throw await ge(i),new d("Could not bind the localhost login callback");let c=`http://127.0.0.1:${a.port}/callback`,u=new URL("/auth/cli",e.baseUrl);u.searchParams.set("callback",c),u.searchParams.set("state",n);let l=new URL("/signin",e.baseUrl);l.searchParams.set("returnTo",`${u.pathname}${u.search}`);let f=l.toString();if(!await un(t,f))return await ge(i),null;process.stderr.write(`Opening portal sign-in: ${f}
34
- `);let k=setTimeout(()=>{r.reject(new d("Portal login timed out. Run hyperscale auth login to start a new callback.",{code:"auth_callback_timeout"}))},Wt);try{return await s}finally{clearTimeout(k),await ge(i)}}async function ze(e,t,n,o,r){let s=await ae(r),i={email:t.email,...e,selectedProduct:s&&s.email===t.email&&s.baseUrl===e.baseUrl&&s.environment===e.environment?s.selectedProduct:null},a=await Qt(i,{personalAccessTokenId:t.personalAccessTokenId,token:n,tokenName:t.name,tenantId:t.tenantId},r);try{await Te(r,i)}catch(u){throw await st(i,r),u}if(a==="file"){let u=ie(r)==="file"?"Founder PAT file storage is active.":"macOS Keychain is unavailable.";process.stderr.write(`${u} The founder PAT is in ${R(i,r)} with mode 0600.
35
- `)}let c=je(i,t);if(o["--json"])P(c);else{let u=b(process.stdout,r,{json:!1});p(Ye(u,{identity:t.email,team:t.teamId}))}}async function ln(e,t){let n=ne(e,t),o=it(e,t);if(o){if(!o.startsWith("hyperscale_pat_"))throw new d("Founder PATs start with hyperscale_pat_. Product API keys belong in HYPERSCALE_API_KEY.");let c=await U(n,o);await ze(n,c,o,e,t);return}if(e["--no-browser"])throw J();let r=await dn(n,t);if(!r)throw J();let s=await E(n,"/v1/personal-access-token-login-grants/exchange",C({tenantId:r.tenantId,grant:r.grant}),void 0,[r.grant]),i=s?.secret;if(typeof i!="string"||!i.startsWith("hyperscale_pat_")||s?.tenantId!==r.tenantId)throw new d("CLI login grant exchange returned an invalid PAT");let a=await U(n,i);await ze(n,a,i,e,t)}async function pn(e,t){let n=await $(e,t),o=n.identity??await U(n,n.token),r=je(n,o);if(e["--json"]){P(r);return}let s=b(process.stdout,t,{json:!1});p(L(s,{fields:[["User",o.email],["Tenant",o.tenantId],["Role",o.role],["Token",o.name],["Scopes",o.scopes.join(", ")],["Expires",o.expiresAt],["API",n.baseUrl],["Environment",n.environment],["Product",n.selectedProduct??"not selected"]]}))}async function fn(e,t){let n=await ae(t);if(!n){e["--json"]?P({status:"signed_out"}):p("Already logged out.");return}let o=await rt(n,t);if(e["--revoke"]&&!o)throw new d("The local founder PAT is missing, so the CLI cannot revoke it.");let r=o?.personalAccessTokenId,s=o?.tokenName;if(e["--revoke"]&&o){if(!r||!s){let c=await U(n,o.token);r=c.personalAccessTokenId,s=c.name}await E(n,`/v1/personal-access-tokens/${encodeURIComponent(r)}/revoke`,C({tenantId:o.tenantId,personalAccessTokenId:r}),o.token,[o.token])}let i=await st(n,t),a=e["--revoke"]===!0;mn(e,{cleanup:i,personalAccessTokenId:r,revoked:a,status:"signed_out",tokenName:s})}function mn(e,t){let n=t.cleanup.keychainDeleted?"complete":"tombstoned";if(e["--json"])P({credentialCleanup:n,...t.personalAccessTokenId?{personalAccessTokenId:t.personalAccessTokenId}:{},...t.revoked===void 0?{}:{revoked:t.revoked},status:t.status,...t.tokenName?{tokenName:t.tokenName}:{},...t.revoked===!1?{tokenStillValid:!0}:{}});else{let o=t.tokenName&&t.personalAccessTokenId?`${t.tokenName} (${t.personalAccessTokenId})`:"with unavailable local metadata";t.revoked?p(`Revoked founder PAT ${o} and forgot local state.`):(p(`Forgot local founder PAT ${o}.`),p("The PAT stays valid until expiry; revoke at /desk/security/tokens."))}t.cleanup.keychainDeleted||process.stderr.write(`Keychain cleanup failed. A 0600 profile tombstone blocks the stale founder PAT.
36
- `)}function F(e,t){if(!e||typeof e!="object"||!Array.isArray(e.items))throw new d(`${t} returned an invalid collection`);return e.items}async function le(e,t,n,o,r,s=[]){let i=[],a=new Set,c,u;for(;;){let k=new URLSearchParams(n);c&&k.set("cursor",c);let g=k.size>0?`?${k}`:"",h=await E(e,`${t}${g}`,{},r,s);u===void 0&&(u=h),i.push(...F(h,o));let I=h.nextCursor;if(typeof I!="string"||I.length===0)break;if(a.has(I))throw new d(`${o} repeated cursor ${I}`);a.add(I),c=I}let{items:l,nextCursor:f,...m}=u;return{...m,items:i}}function ft(e,t=[]){let n=e.headers.get("hyperscale-operation-id"),o=e.headers.get("hyperscale-receipt-id"),r=n?y(n,t):void 0,s=o?y(o,t):void 0;return{...r?{operationId:r}:{},...s?{receiptId:s}:{}}}function mt(e,t,n=[]){if(!e.ok)throw de(e,t,n);try{return JSON.parse(t)}catch{throw new d(`HTTP ${e.status} returned invalid JSON`)}}async function hn(e,t){let n=e["--source"],o=e["--name"];if(!n)throw new d("product create needs --source <file>",{fix:'Run "hyperscale product create --source <file.hsx> --name <name>".'});if(!o)throw new d("product create needs --name <name>");let r=await gt(n,"product create"),s=await $(e,t),i;try{i=await le(s,"/v1/products",{tenantId:s.tenantId},"product.list",s.token,[s.token])}catch(h){if(!(h instanceof O)||h.status!==403)throw h}let a=o.trim().toLocaleLowerCase("en-US"),c=(i?F(i,"product.list"):[]).find(h=>{let I=h?.displayName??h?.name;return typeof I=="string"&&I.trim().toLocaleLowerCase("en-US")===a});if(c){let h=c.productId??c.id??"<id>";throw new d(`A Product named ${JSON.stringify(o.trim())} already exists as ${h}.`,{code:"duplicate_product_name",fix:`Use "hyperscale product select ${h}" or choose another --name.`})}let u="/v1/products/instruments-compose",l={name:o,program:{source:r.source},tenantId:s.tenantId,...e["--catalog-revision"]?{catalogRevisionId:e["--catalog-revision"]}:{}},f=await E(s,u,C(l),s.token,[s.token]);if(typeof f?.productId!="string"||typeof f?.productBuildId!="string")throw new d("product.instruments.compose returned an invalid Product");await Te(t,{...s,selectedProduct:f.productId});let m=typeof f?.shown_once=="string"&&f.shown_once.length>0?f.shown_once:void 0,k=[`hyperscale product show ${f.productId}`,...m?[]:[`hyperscale key create --name "Founder CLI" --product ${f.productId}`]],g={nextCommands:k,nextSteps:k,productBuildId:f.productBuildId,productId:f.productId,selectedProduct:f.productId,...typeof f.startKeyId=="string"?{startKeyId:f.startKeyId}:{},...m?{shown_once:m}:{}};if(e["--json"]){P(g);return}p(`Product: ${g.productId}`),p(`Build: ${g.productBuildId}`),p(`Selected: ${g.selectedProduct}`),g.shown_once&&p(`Shown once Product API key: ${g.shown_once}`),p("Next:");for(let h of g.nextSteps)p(` ${h}`)}function ht(e){return new URLSearchParams({tenantId:e}).toString()}async function yn(e,t){let n=await $(e,t),o=await le(n,"/v1/products",{tenantId:n.tenantId},"product.list",n.token,[n.token]),r=F(o,"product.list");if(e["--json"]){P(o);return}if(r.length===0){p('No Products yet. Run "hyperscale product create --source <file.hsx> --name <name>".');return}let s=b(process.stdout,t,{json:!1});p(_(s,{columns:["ID","Name","Status"],rows:r.map(i=>[i.productId??i.id??"unknown",i.displayName??i.name??"unnamed",i.status??""])}))}async function gn(e,t,n){let o=await $(e,t),r=n??o.selectedProduct;if(!r)throw new d("product show needs an id because no Product is selected. Create a Product first.",{fix:'Run "hyperscale product list" to see existing Products, or "hyperscale product create" to create one.'});let s=await E(o,`/v1/products/${encodeURIComponent(r)}?${ht(o.tenantId)}`,{},o.token,[o.token]);if(e["--json"]){P({...s,nextCommands:[`hyperscale product actions --product ${r}`,`hyperscale key list --product ${r}`]});return}wn(s,r)}function wn(e,t){let n=e?.displayName??e?.name??"unnamed",o=e?.status??"unknown",r=e?.pricing?.currency??e?.cost?.currency??"SAR",s=e?.pricing?.current?.monthly??e?.cost?.platformMonthly,i=e?.pricing?.current?.setup??e?.cost?.platformSetup,a=[...Array.isArray(e?.readiness?.outstandingLiveRequirements)?e.readiness.outstandingLiveRequirements.map(l=>typeof l=="string"?l:l?.owner?`${l.key} (${l.owner})`:l?.key):[],...Array.isArray(e?.readiness?.liveUnavailableCapabilities)?e.readiness.liveUnavailableCapabilities.map(l=>`unavailable:${l}`):[],...Array.isArray(e?.cost?.blockers)?e.cost.blockers.map(l=>l?.code??"pricing"):[]],c=b(process.stdout,process.env,{json:!1}),u=[["Name",n],["Product",e?.productId??t],["Status",o]];if(e?.pricing?.scheduled){let l=e.pricing.current?.monthly,f=e.pricing.scheduled?.monthly;u.push(["Current billing price",`${r} ${l}/mo`],[`Accepted price from ${e.pricing.scheduled.effectiveAt}`,`${r} ${f}/mo`])}else u.push(["Monthly",s==null?"not returned":`${r} ${s}`]);u.push(["Setup",i==null?"not returned":`${r} ${i}`]),u.push(["Live",e?.readiness?.live===!0?"active":"not active"]),u.push(["Live blockers",a.length>0?a.join(", "):"none"]);for(let[l,f]of[["openapi","OpenAPI"],["mcp","MCP"],["sdk","SDK"],["graphql","GraphQL"]]){let m=e?.surfaces?.[l];m?.url&&u.push([f,m.url])}p(L(c,{fields:u})),p(""),p("Next:"),p(` hyperscale key create --name "Founder CLI" --product ${e?.productId??t}`)}async function kn(e,t,n){if(!n)throw new d("product select needs a Product id",{fix:'Run "hyperscale product list" to list Products, then pass one ID.'});let o=await $(e,t),r=await E(o,`/v1/products/${encodeURIComponent(n)}?${ht(o.tenantId)}`,{},o.token,[o.token]);if(r?.productId!==n)throw new d("product.retrieve returned the wrong Product");await Te(t,{...o,selectedProduct:n});let i={nextCommands:[`hyperscale product show ${n}`,`hyperscale key list --product ${n}`],productId:n,selected:!0};e["--json"]?P(i):p(`Selected Product: ${r.displayName??n} (${n})`)}function In(e){return e.map(t=>`${t.path}: error [composer] ${t.code}: ${t.message}`)}function Pn(e){return JSON.stringify(xe(e))}function xe(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(xe);let t={};for(let n of Object.keys(e).sort())t[n]=xe(e[n]);return t}function yt(e,t=""){if(e==null)return t;if(typeof e=="string")return e;if(typeof e=="object")try{return Pn(e)}catch{return t}return String(e)}async function gt(e,t="compose"){if(!e)throw new d(`${t} needs a .hsx file`,{fix:`Run "hyperscale ${t} <file.hsx>" with an existing .hsx file.`});if(!e.endsWith(".hsx"))throw new d(`${t} reads a .hsx file, got ${e}`,{fix:`Point ${t} at a file ending in .hsx.`});let n;try{n=await q(e,"utf8")}catch(o){throw new d(`Could not read ${e}: ${o.message}`)}return{file:e,source:n}}function bn(e){if(!e||typeof e!="object"||typeof e.ok!="boolean"||!Array.isArray(e.issues))throw new d("composer.check returned an invalid result",{fix:'Run the latest unpinned CLI (e.g. "bunx @hyperscale0/cli@latest <command>"), or report the issue without including credentials.'});return{issues:e.issues.map(n=>{if(!n||typeof n!="object"||typeof n.code!="string"||typeof n.message!="string"||typeof n.path!="string")throw new d("composer.check returned an invalid issue",{fix:'Run the latest unpinned CLI (e.g. "bunx @hyperscale0/cli@latest <command>"), or report the issue without including credentials.'});return{code:n.code,message:n.message,path:n.path}}),ok:e.ok}}async function Ne(e,t,n,o="none",r="compose"){let s=await gt(n,r),i=await $(e,t),a=o==="required"?W(i,e):o==="optional"?kt(i,e):void 0,c=await Oe(i,"/v1/composer/check",C({tenantId:i.tenantId,document:s.source,...e["--catalog-revision"]?{catalogRevisionId:e["--catalog-revision"]}:{}}),i.token),u=ft(c.response,[i.token]),l=bn(mt(c.response,c.text,[i.token]));if(!l.ok)throw new te(["composer.check refused the program.",...In(l.issues)].join(`
37
- `),{file:n,issues:l.issues,...u});return{check:l,receipt:u,context:i,productId:a,program:s,catalogRevisionId:e["--catalog-revision"]}}async function xn(e,t,n){let o=await Ne(e,t,n,"none","compose check");if(e["--json"]){P({command:"composer.check",file:n,issues:o.check.issues,ok:!0,...o.receipt});return}p(`Check passed: ${n}`)}async function wt(e,t){let n=await Oe(e.context,"/v1/composer/plan",C({document:e.program.source,tenantId:e.context.tenantId,...e.productId?{productId:e.productId}:{},...e.catalogRevisionId?{catalogRevisionId:e.catalogRevisionId}:{}}),e.context.token),o=mt(n.response,n.text,[e.context.token]),r=ft(n.response,[e.context.token]);if(!o||typeof o!="object"||typeof o.summary!="string"||!Array.isArray(o.actions)||!o.pricing||typeof o.pricing!="object")throw new d("composer.plan returned an invalid result");let s=o.actions.filter(i=>!i||typeof i!="object"||i.kind!=="configure_product");if(s.length>0)throw new te([o.summary,...s.map(i=>i&&typeof i=="object"?`${i.kind??"unknown"} ${i.target??"unknown"} ${yt(i.detail,"Composer refused this action.")}`:"unknown unknown Composer returned an invalid refusal action.")].join(`
38
- `),{actions:s,file:t,...r,...e.productId?{productId:e.productId}:{}});return{...o,...r}}async function $n(e,t,n){let o=await Ne(e,t,n,"optional","compose plan"),r=await wt(o,n);if(e["--json"]){P({command:"composer.plan",file:n,check:{...o.check,...o.receipt},plan:r,...o.productId?{productId:o.productId}:{}});return}p(r.summary);for(let i of r.actions)p(`${i.kind} ${i.target} ${yt(i.detail)}`);let s=r.pricing?.currency??"SAR";if(r.pricing?.scheduled){let i=r.pricing.current?.monthly,a=r.pricing.scheduled?.monthly;p(`Current billing price: ${s} ${i}/mo`),p(`Candidate price from ${r.pricing.scheduled.effectiveAt}: ${s} ${a}/mo`),p(`Pricing identity: ${r.pricing.scheduled.pricingIdentity}`)}else if(r.pricing){let i=r.pricing.monthly,a=r.pricing.activation;i!==void 0&&p(`Monthly: ${s} ${i}`),a!==void 0&&p(`Activation: ${s} ${a}`)}}async function An(e,t,n){if(!e["--confirm"]&&!e["--yes"])if(process.stdin.isTTY&&process.stderr.isTTY){let c=b(process.stderr,process.env,{json:!1});process.stderr.write(`${Me(c,{action:"recompose",subject:n,confirmation:"Recompose selected Product?"})}
39
- `);let u=Nt({input:process.stdin,output:process.stderr,terminal:!0});try{let l=await u.question("");if(l.trim().toLowerCase()!=="y"&&l.trim().toLowerCase()!=="yes")throw new d("Mutation cancelled.",{code:"cancelled"})}finally{u.close()}}else throw new d("compose apply changes the selected Product. Pass --confirm, or --yes for an agent.");let o=e["--pricing-identity"];if(!o&&e["--plan-file"]){let c=e["--plan-file"];try{let u=await q(c,"utf8"),l=JSON.parse(u);o=l.plan?.pricing?.scheduled?.pricingIdentity??l.pricing?.scheduled?.pricingIdentity??l.pricingIdentity}catch(u){throw new d(`Failed to read saved plan file ${c}: ${u.message}`)}}let r=await Ne(e,t,n,"required","compose apply"),s=await wt(r,n);if(s.pricing?.scheduled&&!o){if(!e["--yes"])throw new d(`compose apply --confirm requires --pricing-identity (or --plan-file). Run "hyperscale compose plan ${n}" to review candidate pricing and copy the pricing identity, or pass --yes to accept the current candidate.`);o=s.pricing.scheduled.pricingIdentity}let i=e["--idempotency-key"]??globalThis.crypto.randomUUID(),a;try{a=await E(r.context,"/v1/products/recompose",C({program:{source:r.program.source},...r.catalogRevisionId?{catalogRevisionId:r.catalogRevisionId}:{},...o?{pricingIdentity:o}:{},tenantId:r.context.tenantId,productId:r.productId},i),r.context.token,[r.context.token])}catch(c){throw c instanceof O&&c.code==="product_instrument_not_drained"&&(c.fix=`Drain live instrument instances, or create a new Product directly from source: hyperscale product create --source ${n} --name <name>`),c}if(!a||typeof a.productBuildId!="string")throw new d("product.recompose returned no new build identity");if(e["--json"]){P({command:"product.recompose",file:n,output:a});return}if(p(`Product: ${a.productId??r.productId}`),p(`Build: ${a.productBuildId}`),a.buildDigest&&p(`Digest: ${a.buildDigest}`),a.pricing?.scheduled){let c=a.pricing.currency??"SAR",u=a.pricing.current?.monthly,l=a.pricing.scheduled?.monthly;p(`Current billing price: ${c} ${u}/mo`),p(`Accepted price from ${a.pricing.scheduled.effectiveAt}: ${c} ${l}/mo`)}}function kt(e,t){let n=t["--product"]??e.selectedProduct;return typeof n=="string"&&n.length>0?n:void 0}function W(e,t){let n=kt(e,t);if(!n)throw new d("No Product selected. Pass --product <id> or create a Product first.",{fix:'Run "hyperscale product list" to see existing Products, or "hyperscale product create" to create one.'});return n}async function re(e,t){let n=await ae(t),o=W(n??{},e),r=ne(e,t,n??{});if(n&&(r.baseUrl!==n.baseUrl||r.environment!==n.environment))throw new d(`The selected Product belongs to ${n.baseUrl} (${n.environment}). Select a Product at the configured API origin first.`);let s=e["--api-key"]??t.HYPERSCALE_API_KEY;if(!s)throw et(o);return{...r,apiKey:s,productId:o}}async function It(e,t){let n=`/v1/products/${encodeURIComponent(e.productId)}/operation-set`,{response:o,text:r}=await ue(e,n,{},t);if(!o.ok)throw bt(o,r,[e.apiKey],{productId:e.productId});return En(r,o.status)}async function Sn(e,t,n){let o=await re(e,t),r=await It(o);if(n){Rn(r,n,e);return}if(e["--json"]){P(r);return}if(r.publicActions.length===0)p("No public actions");else{let s=b(process.stdout,t,{json:!1});p(_(s,{columns:["Operation ID","Input","Kind"],rows:r.publicActions.map(i=>{let a=i.idempotencyPolicy?.mode==="not_required"?"read-only":"mutation";return[`${i.instrument}.${i.name}`,vn(i.inputSchema),a]})}))}if(r.setupOperations.length>0){p("Setup operations (run with hyperscale call)");for(let s of r.setupOperations)p(s.operationName)}if(r.readOperationIds.length>0){p("Reads (run with hyperscale call)");for(let s of r.readOperationIds)p(Cn(s))}p(`Digest: ${r.tenantOperationSetDigest}`),p(`Setup digest: ${r.tenantSetupOperationSetDigest}`),p(`Read digest: ${r.tenantReadOperationSetDigest}`),p(`Build: ${r.productBuildId}`),p(`Surface version: ${r.tenantSurfaceVersion}`)}function Rn(e,t,n){let o=e.publicActions.find(c=>c&&`${c.instrument}.${c.name}`===t),r=Tn(t),s=e.setupOperations.find(c=>c&&(c.operationId===t||c.operationId===r||c.operationName===t));if(s){let{inputSchema:c,operationId:u,operationName:l}=s,f={status:e.status,productBuildId:e.productBuildId,tenantSurfaceVersion:e.tenantSurfaceVersion,tenantSetupOperationSetDigest:e.tenantSetupOperationSetDigest,setupOperationId:u,operationName:l,command:`hyperscale call ${l}`,inputSchema:c};if(n["--json"]){P(f);return}let m=b(process.stdout,n?process.env:{},{json:!1}),k=[["Operation ID",u],["Operation name",l],["Run",`hyperscale call ${l}`],["Input schema",JSON.stringify(c,null,2)]];(!Array.isArray(c.required)||c.required.length===0)&&k.push(["Input","omit --input or pass {}."]),k.push(["Setup digest",e.tenantSetupOperationSetDigest],["Build",e.productBuildId],["Surface version",e.tenantSurfaceVersion]),p(L(m,{fields:k}));return}if(!o)throw new d(`Unknown frozen public action: ${t}. Run "hyperscale product actions" to list exact names.`);let i={status:e.status,productBuildId:e.productBuildId,tenantSurfaceVersion:e.tenantSurfaceVersion,tenantOperationSetDigest:e.tenantOperationSetDigest,qualifiedName:`${o.instrument}.${o.name}`,publicAction:o};if(n["--json"]){P(i);return}let a=b(process.stdout,n?process.env:{},{json:!1});p(L(a,{fields:[["Operation ID",`${o.instrument}.${o.name}`],["Instrument",o.instrument],["Input schema",JSON.stringify(o.inputSchema,null,2)],["Output schema",JSON.stringify(o.outputSchema,null,2)],["Actor policy",JSON.stringify(o.actorPolicy,null,2)],["Port policy",JSON.stringify(o.portPolicy,null,2)],["Idempotency policy",JSON.stringify(o.idempotencyPolicy,null,2)],["Receipt policy",JSON.stringify(o.receiptPolicy,null,2)],["Receipt evidence",JSON.stringify(o.receiptEvidence,null,2)],["Digest",e.tenantOperationSetDigest],["Build",e.productBuildId],["Surface version",e.tenantSurfaceVersion]]}))}function En(e,t){let n;try{n=JSON.parse(e)}catch{throw new d(`HTTP ${t} returned invalid JSON`)}if(!n||typeof n!="object"||n.status!=="frozen"||typeof n.productBuildId!="string"||typeof n.tenantSurfaceVersion!="number"||typeof n.tenantOperationSetDigest!="string"||typeof n.tenantReadOperationSetDigest!="string"||typeof n.tenantSetupOperationSetDigest!="string"||!Array.isArray(n.publicActions)||!Array.isArray(n.readOperationIds)||!Array.isArray(n.setupOperationIds)||!Array.isArray(n.setupOperations))throw new d("The Product operation set is not in the expected format.",{fix:'Run the latest unpinned CLI (e.g. "bunx @hyperscale0/cli@latest <command>"), or report the issue without including credentials.'});return n.publicActions=n.publicActions.map(o=>{if(!o||typeof o!="object"||typeof o.instrument!="string"||o.instrument.length===0||typeof o.name!="string"||o.name.length===0)throw new d("The server's public action names no instrument or action name. The platform predates Product identity in public actions: redeploy it.");return{...o,qualifiedName:`${o.instrument}.${o.name}`}}),n}function Tn(e){return e.replaceAll(".","_")}function Cn(e){for(let t of["create","list","retrieve"]){let n=`_${t}`;if(e.endsWith(n))return`${e.slice(0,-n.length)}.${t}`}return e}function vn(e){if(!e||typeof e!="object")return"input schema unavailable";let t=e.properties&&typeof e.properties=="object"&&!Array.isArray(e.properties)?e.properties:{},n=new Set(Array.isArray(e.required)?e.required.filter(r=>typeof r=="string"):[]),o=Object.entries(t).map(([r,s])=>`${r}${n.has(r)?"":"?"}: ${Pt(s)}`);return o.length===0?"no input":o.join(", ")}function Pt(e){return!e||typeof e!="object"?"value":Array.isArray(e.enum)&&e.enum.length>0?e.enum.map(t=>String(t)).join(" | "):e.type==="array"?`${Pt(e.items)}[]`:typeof e.type=="string"?typeof e.format=="string"?`${e.type} (${e.format})`:e.type:"value"}async function On(e,t,n){if(!n)throw new d("product run needs a public action");let o=await re(e,t),r=await It(o,n);jn(r,n);let s=await xt(e),i=e["--idempotency-key"]??globalThis.crypto.randomUUID(),{response:a,text:c}=await ue(o,`/v1/operations/${encodeURIComponent(n)}`,{body:JSON.stringify(s),headers:{"content-type":"application/json","idempotency-key":i},method:"POST"},n);if(!a.ok)throw bt(a,c,[o.apiKey],{action:n,productId:o.productId});let u=a.headers.get("hyperscale-operation-id"),l=a.headers.get("hyperscale-receipt-id"),f=a.headers.get("x-request-id"),m=u?y(u,[o.apiKey]):null,k=l?y(l,[o.apiKey]):null,g=f?y(f,[o.apiKey]):null;if(e["--json"]){P({idempotencyKey:i,...g?{requestId:g}:{},operationId:m,receiptId:k,output:Nn(c)});return}m&&p(`Operation: ${m}`),k&&p(`Receipt: ${k}`),p(`Idempotency key: ${i}`);let h=$t(c);h&&p(h)}function jn(e,t){let n=e.publicActions.find(r=>r&&`${r.instrument}.${r.name}`===t);if(n)return n;let o=e.publicActions.map(r=>`${r.instrument}.${r.name}`).map(r=>({candidate:r,distance:Ae(t,r)})).sort((r,s)=>r.distance-s.distance||r.candidate.localeCompare(s.candidate)).slice(0,3).map(({candidate:r})=>r);throw new d(`Unknown frozen public action: ${t}. Closest valid names: ${o.join(", ")}. Run "hyperscale product actions" to list exact names.`)}function Nn(e){if(e.trim()==="")return null;try{return JSON.parse(e)}catch{return e}}function bt(e,t,n=[],o={}){let r=pt(t,n,e.status),s=lt(e.headers,r.requestId,n),i=r.code??"user_error",a=r.redactedMessage;if(typeof a=="string"&&a.includes("does not match API key Product")){let m=o.productId??a.match(/^Selected Product (\S+) does not match/)?.[1];m&&(a=`${a} Or set HYPERSCALE_API_KEY to a key for ${m}, or pass that key with --api-key.`)}let c=i==="user_error"?"":`${i}: `,u=`HTTP ${e.status} \xB7 ${c}${a}`,l=_n(r.details,n),f=r.fix;return i==="idempotency_conflict"?f="Reuse the same key only with the same operation and input. Use a new unique key for a different request.":e.status===409&&typeof a=="string"&&a.includes("capability-derived")?f='This Product has no frozen public actions. List its operations with "hyperscale ops list" and run them with "hyperscale call".':[a,...l].some(m=>typeof m=="string"&&m.includes("[Truncated]"))&&o.action&&(f=`Run "hyperscale product actions ${o.action}" to read the full input schema and allowed values.`),new O([u,...l].join(`
40
- `),{code:i,details:r.details,fix:f,operationId:s.operationId,receiptId:s.receiptId,requestId:s.requestId,status:e.status,traceId:s.traceId})}function _n(e,t){if(!e||typeof e!="object")return[];if(Array.isArray(e.issues))return e.issues.flatMap(o=>{if(!o||typeof o!="object")return[];let s=(Array.isArray(o.path)?o.path.join("."):"input")||"input";return typeof o.message=="string"?[`${s}: ${y(o.message,t)}`]:[]});let n=[];return $e(e,"",n,t),n}function $e(e,t,n,o){if(Array.isArray(e)){if(e.every(r=>r===null||typeof r!="object")){n.push(`${Ve(t)}: ${y(e.join(", "),o)}`);return}e.forEach((r,s)=>$e(r,`${t}[${s}]`,n,o));return}if(e&&typeof e=="object"){for(let[r,s]of Object.entries(e))$e(s,t?`${t}.${r}`:r,n,o);return}t&&n.push(`${Ve(t)}: ${y(String(e),o)}`)}function Ve(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll("."," ");return t.charAt(0).toUpperCase()+t.slice(1)}async function Ln(e,t){let n=await $(e,t),o=W(n,e),r=await E(n,"/v1/sandbox-api-keys",C({name:e["--name"]??"Founder CLI",tenantId:n.tenantId,productId:o}),n.token,[n.token]),s=["export HYPERSCALE_API_KEY=<paste the shown_once value>",`hyperscale product actions --product ${o}`];if(e["--json"]){let{secret:i,...a}=r;P({...a,...typeof i=="string"?{shown_once:i}:{},nextCommands:s});return}p(`Key: ${r.apiKeyId??"unknown"}`),p(`Product: ${r.productId??o}`),p(`Status: ${r.status??"unknown"}`),r.secret?(p(`Secret: ${r.secret}`),p("Store it now. Hyperscale will not return it again."),p("Next:"),p(" export HYPERSCALE_API_KEY=<paste the secret above>"),p(` hyperscale product actions --product ${o}`)):p("The key already existed, so the one-time secret is unavailable.")}async function Un(e,t){let n=await $(e,t),o=W(n,e),r=await le(n,"/v1/api-keys",{productId:o,tenantId:n.tenantId},"api_key.list",n.token,[n.token]),s=F(r,"api_key.list");if(e["--json"]){P(r);return}let i=b(process.stdout,t,{json:!1});p(_(i,{columns:["ID","Name","Status"],rows:s.map(a=>[a.apiKeyId,a.name??"unnamed",a.status??"unknown"])}))}async function Hn(e,t,n){if(!n)throw new d("key revoke needs an API key id",{fix:'Run "hyperscale key list" to list keys, then pass one ID.'});let o=await $(e,t),r=W(o,e),s=await E(o,`/v1/api-keys/${encodeURIComponent(n)}/revoke`,C({tenantId:o.tenantId,productId:r}),o.token,[o.token]);e["--json"]?P(s):p(`Key ${s.apiKeyId??n}: ${s.status??"revoked"}`)}async function Dn(e,t){let n=await $(e,t),o=n.identity??await U(n,n.token),r=je(n,o);if(e["--json"]){P(r);return}let s=b(process.stdout,t,{json:!1});p(L(s,{fields:[["User",o.email],["Tenant",o.tenantId],["Role",o.role],["Token",o.name],["Expires",o.expiresAt]]}))}async function Kn(e,t,n){let o=await ut(e),r=n?n.toLowerCase():null,s=r?o.operations.filter(a=>a.name.toLowerCase().includes(r)||a.path.toLowerCase().includes(r)):o.operations;if(t["--json"]){p(JSON.stringify(s,null,2));return}if(s.length===0){p(n?`No operation matches ${n}`:"No operations");return}let i=b(process.stdout,process.env,{json:!1});p(_(i,{columns:["Operation","Method","Path"],rows:s.map(a=>[a.name,a.method,a.path])}))}async function Jn(e,t){let n=await $(e,t),o=await le(n,"/v1/activity",{tenantId:n.tenantId},"activity.list",n.token,[n.token]),r=F(o,"activity.list");if(e["--json"]){P(o);return}let s=b(process.stdout,t,{json:!1});p(_(s,{columns:["Time","Activity","Target","Status"],rows:r.map(i=>{let a=i.operation??i.auditEvent??"activity",c=i.resourceKind&&i.resourceId?`${i.resourceKind}:${i.resourceId}`:i.resourceKind??i.resourceId??"-";return[i.occurredAt??"unknown",a,c,i.status??"recorded"]})}))}function Yn(e,t){let n={...t},o=[],r=e.path.replace(/\{([^}]+)\}/g,(s,i)=>{let a=n[i];return a==null?(o.push(i),""):(delete n[i],encodeURIComponent(String(a)))});if(o.length>0)throw new d(`${e.name} needs ${o.join(", ")} in --input`);return{path:r,remaining:n}}function Mn(e){let t=new URLSearchParams;for(let[o,r]of Object.entries(e))r!=null&&t.set(o,typeof r=="string"?r:JSON.stringify(r));let n=t.toString();return n?`?${n}`:""}function Ae(e,t){let n=Array.from({length:t.length+1},(o,r)=>r);for(let o=1;o<=e.length;o+=1){let r=[o];for(let s=1;s<=t.length;s+=1)r[s]=Math.min(r[s-1]+1,n[s]+1,n[s-1]+(e[o-1]===t[s-1]?0:1));n.splice(0,n.length,...r)}return n[t.length]}function qn(e,t){let n=e.find(s=>s.name===t);if(n)return n;let o=e.filter(s=>s.operationId===t);if(o.length===1)return o[0];if(o.length>1)throw new d(`${t} matches more than one operation. Use one of: ${o.map(s=>s.name).join(", ")}.`);let r=e.map(s=>({candidate:s,distance:Math.min(Ae(t,s.name),Ae(t,s.operationId))})).sort((s,i)=>s.distance-i.distance||s.candidate.name.localeCompare(i.candidate.name)).slice(0,3).flatMap(({candidate:s})=>[s.name,s.operationId]);throw new d(`${t} is not an operation in the selected Product's machine document. Closest valid names: ${r.join(", ")}.`)}async function Bn(e,t,n){if(!n)throw new d("call needs an operation name",{fix:'Run "hyperscale ops list" to list operations.'});let o=await ut(e),r=qn(o.operations,n),s=await xt(t),{path:i,remaining:a}=Yn(r,s),c={method:r.method},u=i;r.method==="GET"?u+=Mn(a):(c.body=JSON.stringify(a),c.headers={"content-type":"application/json",...r.idempotency==="not_required"?{}:{"idempotency-key":t["--idempotency-key"]??globalThis.crypto.randomUUID()}});let{response:l,text:f}=await ue(e,u,c);if(l.ok){if(t["--json"]){let m=sn(f),k=l.headers.get("x-request-id")??(m&&typeof m=="object"&&typeof m.requestId=="string"?m.requestId:null),g=l.headers.get("hyperscale-operation-id")??null,h=l.headers.get("hyperscale-receipt-id")??null,I=dt(l.headers),T=k?y(k,[e.apiKey]):null,v=g?y(g,[e.apiKey]):null,z=h?y(h,[e.apiKey]):null,j=I?y(I,[e.apiKey]):null;P({status:l.status,data:m,requestId:T,operationId:v,receiptId:z,traceId:j});return}p($t(f));return}throw de(l,f,[e.apiKey])}async function xt(e){if(e["--input"]!==void 0&&e["--input-file"]!==void 0)throw new d("Use only one of --input and --input-file");if(e["--input"]!==void 0)return we(e["--input"],"--input");if(e["--input-file"]!==void 0){let t;try{t=await q(e["--input-file"],"utf8")}catch(n){throw new d(`Could not read ${e["--input-file"]}: ${n.message}`)}return we(t,"--input-file")}if(!process.stdin.isTTY){let t=await on();if(t.trim()!=="")return we(t,"stdin")}return{}}function we(e,t="--input"){if(e===void 0)return{};let n;try{n=JSON.parse(e)}catch(o){throw new d(`${t} is not valid JSON: ${o.message}`)}if(n===null||typeof n!="object"||Array.isArray(n))throw new d(`${t} must be a JSON object`);return n}function $t(e){if(e.trim()==="")return"";try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function p(e){process.stdout.write(`${e}
41
- `)}function P(e){p(JSON.stringify(e,null,2))}function Fn(e,t){let n=t.includes("--json"),o=[process.env.HYPERSCALE_API_KEY,process.env.HYPERSCALE_TOKEN].filter(Boolean),r=e instanceof d,s=r?e.message:"The command failed unexpectedly.",i=w(y(String(s),o)),a=i.length>1024?i.slice(0,1024):i,c=r?e.fix??'Follow the message, or run "hyperscale --help" for command usage.':"Report the failure without including credentials.",u=w(y(String(c),o)),l=r&&typeof e.shownOnce=="string"?w(y(e.shownOnce,o)):void 0;if(!n){let S=b(process.stderr,process.env,{json:!1}),At=(typeof e?.structuredError?.code=="string"?e.structuredError.code:void 0)??(r&&typeof e.code=="string"?e.code:r?"user_error":"internal_error"),St=r?a:i,Rt=l?`
42
- Shown once Product API key: ${l}`:"",Et=qe(S,{code:At,message:St,nextStep:u});process.stderr.write(`${Et}${Rt}
43
- `);return}let f=(typeof e?.structuredError?.code=="string"?e.structuredError.code:void 0)??(r&&typeof e.code=="string"?e.code:r?"user_error":"internal_error"),m=(typeof e?.structuredError?.message=="string"?e.structuredError.message:void 0)??(r?e.message:"The command failed unexpectedly."),k=w(y(String(m),o)),g=k.length>1024?k.slice(0,1024):k,h=(typeof e?.structuredError?.fix=="string"?e.structuredError.fix:void 0)??(r?e.fix??'Follow the message, or run "hyperscale --help" for command usage.':"Report the failure without including credentials."),I=w(y(String(h),o)),T=I.length>1024?I.slice(0,1024):I,v=e?.structuredError?.details!==void 0?e.structuredError.details:r&&e.details!==void 0?e.details:void 0,z=v!==void 0?oe(v,o):void 0,j=r&&typeof e.status=="number"?e.status:void 0,V=S=>typeof S!="string"||S.trim().length===0?null:w(y(S.trim(),o)),G=r&&(e.requestId!==void 0||e.operationId!==void 0||e.receiptId!==void 0||e.traceId!==void 0),X=G?V(e.requestId):void 0,Z=G?V(e.operationId):void 0,Q=G?V(e.receiptId):void 0,ee=G?V(e.traceId):void 0,_e=S=>({...j!==void 0?{status:j}:{},error:{code:f,message:g,...S!==void 0?{details:S}:{},fix:T},...X!==void 0?{requestId:X}:{},...Z!==void 0?{operationId:Z}:{},...Q!==void 0?{receiptId:Q}:{},...ee!==void 0?{traceId:ee}:{},...l?{shown_once:l}:{}}),Le=S=>Buffer.byteLength(S,"utf8")>8192,H=_e(z),D=JSON.stringify(H);Le(D)&&z!==void 0&&(H=_e("[Truncated]"),D=JSON.stringify(H)),Le(D)&&(H={...j!==void 0?{status:j}:{},error:{code:f,message:g,fix:"[Truncated]"},...X!==void 0?{requestId:X}:{},...Z!==void 0?{operationId:Z}:{},...Q!==void 0?{receiptId:Q}:{},...ee!==void 0?{traceId:ee}:{}},D=JSON.stringify(H)),process.stderr.write(`${D}
44
- `)}async function Wn(){let{readFileSync:e}=await import("node:fs");return JSON.parse(e(new URL("./package.json",import.meta.url),"utf8")).version}async function zn(e,t){let{flags:n,positional:o}=Vt(e);if(n["--version"])return p(await Wn()),0;if(n["--help"]&&o.length>0){let i=b(process.stdout,t,{json:!1});return p(Fe(o,i)),0}if(o[0]==="help"){let i=o.slice(1),a=b(process.stdout,t,{json:!1});return i.length===0?p(fe(a)):p(Fe(i,a)),0}if(o.length===0&&!n["--help"]){if(n["--json"])throw new d('No command. Run "hyperscale --help" to list commands.');if(!await $(n,t,!0)){let a=b(process.stdout,t,{json:!1});return p(Je(a)),0}return p('Build your first Product with "hyperscale product create --source <file.hsx> --name <name>".'),p('Run "hyperscale --help" for every command.'),0}if(n["--help"]){let i=b(process.stdout,t,{json:!1});return p(fe(i)),0}let[r,...s]=o;if(r==="auth"){if(s[0]==="login")await ln(n,t);else if(s[0]==="status")await pn(n,t);else if(s[0]==="logout")await fn(n,t);else throw new d('Auth subcommands are "login", "status", and "logout"',{fix:'Run "hyperscale help auth" to see valid subcommands.'});return 0}if(r==="product"){if(s[0]==="create")await hn(n,t);else if(s[0]==="list")await yn(n,t);else if(s[0]==="show")await gn(n,t,s[1]);else if(s[0]==="select")await kn(n,t,s[1]);else if(s[0]==="actions")await Sn(n,t,s[1]);else if(s[0]==="run")await On(n,t,s[1]);else throw new d('Product subcommands are "create", "list", "show", "select", "actions", and "run"',{fix:'Run "hyperscale help product" to see valid subcommands.'});return 0}if(r==="compose"){if(s[0]==="check")await xn(n,t,s[1]);else if(s[0]==="plan")await $n(n,t,s[1]);else if(s[0]==="apply")await An(n,t,s[1]);else throw new d('Compose subcommands are "check", "plan", and "apply"',{fix:'Run "hyperscale help compose" to see valid subcommands.'});return 0}if(r==="key"){if(s[0]==="create")await Ln(n,t);else if(s[0]==="list")await Un(n,t);else if(s[0]==="revoke")await Hn(n,t,s[1]);else throw new d('Key subcommands are "create", "list", and "revoke"',{fix:'Run "hyperscale help key" to see valid subcommands.'});return 0}if(r==="whoami")return await Dn(n,t),0;if(r==="activity"){if(s[0]!=="list")throw new d('The only activity subcommand is "list"',{fix:'Run "hyperscale help activity" to see usage.'});return await Jn(n,t),0}if(r==="ops"){if(s[0]!=="list")throw new d('The only ops subcommand is "list"',{fix:'Run "hyperscale help ops" to see usage.'});let i=n["--product"]?await re(n,t):We(n,t);return await Kn(i,n,s[1]),0}if(r==="call"){let i=n["--product"]?await re(n,t):We(n,t);return await Bn(i,n,s[0]),0}throw new d(`Unknown command: ${r}`,{fix:'Run "hyperscale --help" to list commands.'})}zn(process.argv.slice(2),process.env).then(e=>{process.exitCode=e},e=>{Fn(e,process.argv.slice(2)),process.exitCode=e instanceof d&&Number.isInteger(e.exitCode)?e.exitCode:1});
2
+ import{spawn as rt}from"node:child_process";import{createHash as jt}from"node:crypto";import{createServer as Gt}from"node:http";import{createInterface as Nt}from"node:readline/promises";import{chmod as ve,mkdir as Ht,readdir as Ut,readFile as Y,rename as Dt,unlink as Bt,writeFile as zt}from"node:fs/promises";import{homedir as Kt}from"node:os";import{basename as Mt,dirname as ke,join as pe}from"node:path";var he={"x-generated":"Generated by the Hyperscale artifact pipeline; do not edit by hand",schemaVersion:1,commands:[{name:"account.balance.retrieve",operationId:"account_balance_retrieve",method:"GET",path:"/v1/accounts/{accountId}/balance",idempotency:"not_required",principal:"api_key",summary:"Retrieve an account balance"},{name:"account.close",operationId:"account_close",method:"POST",path:"/v1/accounts/{accountId}/close",idempotency:"required",principal:"api_key",summary:"Close an account"},{name:"account.create",operationId:"account_create",method:"POST",path:"/v1/accounts",idempotency:"required",principal:"api_key",summary:"Create an account"},{name:"account.freeze",operationId:"account_freeze",method:"POST",path:"/v1/accounts/{accountId}/freeze",idempotency:"required",principal:"api_key",summary:"Freeze an account"},{name:"account.list",operationId:"account_list",method:"GET",path:"/v1/accounts",idempotency:"not_required",principal:"api_key",summary:"List Accounts"},{name:"account.retrieve",operationId:"account_retrieve",method:"GET",path:"/v1/accounts/{accountId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an Account"},{name:"account.statement.export",operationId:"account_statement_export",method:"GET",path:"/v1/accounts/{accountId}/statements/{period}/export",idempotency:"not_required",principal:"api_key",summary:"Export a monthly account statement"},{name:"account.statement.retrieve",operationId:"account_statement_retrieve",method:"GET",path:"/v1/accounts/{accountId}/statements/{period}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a monthly account statement"},{name:"account.unfreeze",operationId:"account_unfreeze",method:"POST",path:"/v1/accounts/{accountId}/unfreeze",idempotency:"required",principal:"api_key",summary:"Unfreeze an account"},{name:"activity.list",operationId:"activity_list",method:"GET",path:"/v1/activity",idempotency:"not_required",principal:"api_key",summary:"List tenant activity"},{name:"api_key.list",operationId:"api_key_list",method:"GET",path:"/v1/api-keys",idempotency:"not_required",principal:"user_session",summary:"List API keys"},{name:"api_key.live.create",operationId:"api_key_live_create",method:"POST",path:"/v1/live-api-keys",idempotency:"required",principal:"user_session",summary:"Create a live API key"},{name:"api_key.retrieve",operationId:"api_key_retrieve",method:"GET",path:"/v1/api-keys/{apiKeyId}",idempotency:"not_required",principal:"user_session",summary:"Retrieve an API key"},{name:"api_key.revoke",operationId:"api_key_revoke",method:"POST",path:"/v1/api-keys/{apiKeyId}/revoke",idempotency:"required",principal:"user_session",summary:"Revoke a product API key"},{name:"api_key.sandbox.create",operationId:"api_key_sandbox_create",method:"POST",path:"/v1/sandbox-api-keys",idempotency:"required",principal:"user_session",summary:"Create a sandbox API key"},{name:"audit_event.list",operationId:"audit_event_list",method:"GET",path:"/v1/audit-events",idempotency:"not_required",principal:"api_key",summary:"List Audit events"},{name:"audit_event.retrieve",operationId:"audit_event_retrieve",method:"GET",path:"/v1/audit-events/{auditEventId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an Audit event"},{name:"authorised_decision.approve",operationId:"authorised_decision_approve",method:"POST",path:"/v1/authorised-decisions/{authorisedDecisionId}/approve",idempotency:"required",principal:"api_key",summary:"Approve instrument"},{name:"authorised_decision.create",operationId:"authorised_decision_create",method:"POST",path:"/v1/authorised-decisions",idempotency:"required",principal:"api_key",summary:"Create instrument"},{name:"authorised_decision.decline",operationId:"authorised_decision_decline",method:"POST",path:"/v1/authorised-decisions/{authorisedDecisionId}/decline",idempotency:"required",principal:"api_key",summary:"Decline instrument"},{name:"authorised_decision.list",operationId:"authorised_decision_list",method:"GET",path:"/v1/authorised-decisions",idempotency:"not_required",principal:"api_key",summary:"List authorised decisions"},{name:"authorised_decision.retrieve",operationId:"authorised_decision_retrieve",method:"GET",path:"/v1/authorised-decisions/{authorisedDecisionId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an authorised decision"},{name:"authorised_decision.revoke",operationId:"authorised_decision_revoke",method:"POST",path:"/v1/authorised-decisions/{authorisedDecisionId}/revoke",idempotency:"required",principal:"api_key",summary:"Revoke instrument"},{name:"beneficiary.create",operationId:"beneficiary_create",method:"POST",path:"/v1/beneficiaries",idempotency:"required",principal:"api_key",summary:"Create a beneficiary"},{name:"beneficiary.disable",operationId:"beneficiary_disable",method:"POST",path:"/v1/beneficiaries/{beneficiaryId}/disable",idempotency:"required",principal:"user_session",summary:"Disable a beneficiary"},{name:"beneficiary.list",operationId:"beneficiary_list",method:"GET",path:"/v1/beneficiaries",idempotency:"not_required",principal:"api_key",summary:"List Beneficiaries"},{name:"beneficiary.retrieve",operationId:"beneficiary_retrieve",method:"GET",path:"/v1/beneficiaries/{beneficiaryId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Beneficiary"},{name:"beneficiary.verify",operationId:"beneficiary_verify",method:"POST",path:"/v1/beneficiary-verifications",idempotency:"required",principal:"api_key",summary:"Verify a beneficiary"},{name:"billing_adjustment.list",operationId:"billing_adjustment_list",method:"GET",path:"/v1/billing-adjustments",idempotency:"not_required",principal:"api_key",summary:"List Billing adjustments"},{name:"billing_adjustment.retrieve",operationId:"billing_adjustment_retrieve",method:"GET",path:"/v1/billing-adjustments/{billingAdjustmentId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Billing adjustment"},{name:"billing_period.list",operationId:"billing_period_list",method:"GET",path:"/v1/billing-periods",idempotency:"not_required",principal:"api_key",summary:"List Billing periods"},{name:"billing_period.retrieve",operationId:"billing_period_retrieve",method:"GET",path:"/v1/billing-periods/{billingPeriodId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Billing period"},{name:"billing_subscription.list",operationId:"billing_subscription_list",method:"GET",path:"/v1/billing-subscriptions",idempotency:"not_required",principal:"api_key",summary:"List Billing subscriptions"},{name:"billing_subscription.retrieve",operationId:"billing_subscription_retrieve",method:"GET",path:"/v1/billing-subscriptions/{billingSubscriptionId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Billing subscription"},{name:"card.activate",operationId:"card_activate",method:"POST",path:"/v1/cards/{cardId}/activate",idempotency:"required",principal:"api_key",summary:"Activate a card"},{name:"card.cancel",operationId:"card_cancel",method:"POST",path:"/v1/cards/{cardId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel a card"},{name:"card.create",operationId:"card_create",method:"POST",path:"/v1/cards",idempotency:"required",principal:"api_key",summary:"Issue a card"},{name:"card.freeze",operationId:"card_freeze",method:"POST",path:"/v1/cards/{cardId}/freeze",idempotency:"required",principal:"api_key",summary:"Freeze a card"},{name:"card.list",operationId:"card_list",method:"GET",path:"/v1/cards",idempotency:"not_required",principal:"api_key",summary:"List cards"},{name:"card.retrieve",operationId:"card_retrieve",method:"GET",path:"/v1/cards/{cardId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a card"},{name:"card.unfreeze",operationId:"card_unfreeze",method:"POST",path:"/v1/cards/{cardId}/unfreeze",idempotency:"required",principal:"api_key",summary:"Unfreeze a card"},{name:"card.update",operationId:"card_update",method:"PATCH",path:"/v1/cards/{cardId}",idempotency:"required",principal:"api_key",summary:"Update a card"},{name:"card_authorization.approve",operationId:"card_authorization_approve",method:"POST",path:"/v1/card-authorizations/{cardAuthorizationId}/approve",idempotency:"required",principal:"api_key",summary:"Approve a card authorization"},{name:"card_authorization.capture",operationId:"card_authorization_capture",method:"POST",path:"/v1/card-authorizations/{cardAuthorizationId}/capture",idempotency:"required",principal:"api_key",summary:"Capture a card authorization"},{name:"card_authorization.create",operationId:"card_authorization_create",method:"POST",path:"/v1/card-authorizations",idempotency:"required",principal:"api_key",summary:"Request a card authorization"},{name:"card_authorization.decline",operationId:"card_authorization_decline",method:"POST",path:"/v1/card-authorizations/{cardAuthorizationId}/decline",idempotency:"required",principal:"api_key",summary:"Decline a card authorization"},{name:"card_authorization.list",operationId:"card_authorization_list",method:"GET",path:"/v1/card-authorizations",idempotency:"not_required",principal:"api_key",summary:"List card authorizations"},{name:"card_authorization.retrieve",operationId:"card_authorization_retrieve",method:"GET",path:"/v1/card-authorizations/{cardAuthorizationId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a card authorization"},{name:"card_authorization.reverse",operationId:"card_authorization_reverse",method:"POST",path:"/v1/card-authorizations/{cardAuthorizationId}/reverse",idempotency:"required",principal:"api_key",summary:"Reverse a card authorization"},{name:"card_dispute.create",operationId:"card_dispute_create",method:"POST",path:"/v1/card-disputes",idempotency:"required",principal:"api_key",summary:"File a card dispute"},{name:"card_dispute.list",operationId:"card_dispute_list",method:"GET",path:"/v1/card-disputes",idempotency:"not_required",principal:"api_key",summary:"List card disputes"},{name:"card_dispute.retrieve",operationId:"card_dispute_retrieve",method:"GET",path:"/v1/card-disputes/{cardDisputeId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a card dispute"},{name:"card_dispute.review",operationId:"card_dispute_review",method:"POST",path:"/v1/card-disputes/{cardDisputeId}/review",idempotency:"required",principal:"api_key",summary:"Review a card dispute"},{name:"card_dispute.update",operationId:"card_dispute_update",method:"PATCH",path:"/v1/card-disputes/{cardDisputeId}",idempotency:"required",principal:"api_key",summary:"Update a card dispute"},{name:"card_dispute.win",operationId:"card_dispute_win",method:"POST",path:"/v1/card-disputes/{cardDisputeId}/win",idempotency:"required",principal:"api_key",summary:"Win a card dispute"},{name:"card_transaction.create",operationId:"card_transaction_create",method:"POST",path:"/v1/card-transactions",idempotency:"required",principal:"api_key",summary:"Record a card transaction"},{name:"card_transaction.list",operationId:"card_transaction_list",method:"GET",path:"/v1/card-transactions",idempotency:"not_required",principal:"api_key",summary:"List card transactions"},{name:"card_transaction.refund",operationId:"card_transaction_refund",method:"POST",path:"/v1/card-transactions/{cardTransactionId}/refund",idempotency:"required",principal:"api_key",summary:"Refund a card transaction"},{name:"card_transaction.retrieve",operationId:"card_transaction_retrieve",method:"GET",path:"/v1/card-transactions/{cardTransactionId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a card transaction"},{name:"cardholder.activate",operationId:"cardholder_activate",method:"POST",path:"/v1/cardholders/{cardholderId}/activate",idempotency:"required",principal:"api_key",summary:"Activate a cardholder"},{name:"cardholder.close",operationId:"cardholder_close",method:"POST",path:"/v1/cardholders/{cardholderId}/close",idempotency:"required",principal:"api_key",summary:"Close a cardholder"},{name:"cardholder.create",operationId:"cardholder_create",method:"POST",path:"/v1/cardholders",idempotency:"required",principal:"api_key",summary:"Create a cardholder"},{name:"cardholder.list",operationId:"cardholder_list",method:"GET",path:"/v1/cardholders",idempotency:"not_required",principal:"api_key",summary:"List cardholders"},{name:"cardholder.resume",operationId:"cardholder_resume",method:"POST",path:"/v1/cardholders/{cardholderId}/resume",idempotency:"required",principal:"api_key",summary:"Resume a cardholder"},{name:"cardholder.retrieve",operationId:"cardholder_retrieve",method:"GET",path:"/v1/cardholders/{cardholderId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a cardholder"},{name:"cardholder.suspend",operationId:"cardholder_suspend",method:"POST",path:"/v1/cardholders/{cardholderId}/suspend",idempotency:"required",principal:"api_key",summary:"Suspend a cardholder"},{name:"cardholder.update",operationId:"cardholder_update",method:"PATCH",path:"/v1/cardholders/{cardholderId}",idempotency:"required",principal:"api_key",summary:"Update a cardholder"},{name:"catalog.author",operationId:"catalog_author",method:"POST",path:"/v1/catalog/author",idempotency:"required",principal:"user_session",summary:"Author a tenant catalog revision"},{name:"charge.list",operationId:"charge_list",method:"GET",path:"/v1/charges",idempotency:"not_required",principal:"api_key",summary:"List Charges"},{name:"charge.retrieve",operationId:"charge_retrieve",method:"GET",path:"/v1/charges/{chargeId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Charge"},{name:"circle_membership.create",operationId:"circle_membership_create",method:"POST",path:"/v1/circle-memberships",idempotency:"required",principal:"api_key",summary:"Join a savings circle"},{name:"circle_membership.list",operationId:"circle_membership_list",method:"GET",path:"/v1/circle-memberships",idempotency:"not_required",principal:"api_key",summary:"List circle memberships"},{name:"circle_membership.retrieve",operationId:"circle_membership_retrieve",method:"GET",path:"/v1/circle-memberships/{circleMembershipId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a circle membership"},{name:"claim.approve",operationId:"claim_approve",method:"POST",path:"/v1/claims/{claimId}/approve",idempotency:"required",principal:"api_key",summary:"Approve a claim"},{name:"claim.assess",operationId:"claim_assess",method:"POST",path:"/v1/claims/{claimId}/assess",idempotency:"required",principal:"api_key",summary:"Assess a claim"},{name:"claim.attest",operationId:"claim_attest",method:"POST",path:"/v1/claims/{claimId}/attest",idempotency:"required",principal:"api_key",summary:"Attest an out-of-band claim approval"},{name:"claim.create",operationId:"claim_create",method:"POST",path:"/v1/claims",idempotency:"required",principal:"api_key",summary:"File a claim"},{name:"claim.deny",operationId:"claim_deny",method:"POST",path:"/v1/claims/{claimId}/deny",idempotency:"required",principal:"api_key",summary:"Deny a claim"},{name:"claim.list",operationId:"claim_list",method:"GET",path:"/v1/claims",idempotency:"not_required",principal:"api_key",summary:"List claims"},{name:"claim.pay",operationId:"claim_pay",method:"POST",path:"/v1/claims/{claimId}/pay",idempotency:"required",principal:"api_key",summary:"Pay a claim"},{name:"claim.retrieve",operationId:"claim_retrieve",method:"GET",path:"/v1/claims/{claimId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a claim"},{name:"claim.reverse",operationId:"claim_reverse",method:"POST",path:"/v1/claims/{claimId}/reverse",idempotency:"required",principal:"api_key",summary:"Reverse claim approval"},{name:"claim.update",operationId:"claim_update",method:"PATCH",path:"/v1/claims/{claimId}",idempotency:"required",principal:"api_key",summary:"Update a claim"},{name:"collection.list",operationId:"collection_list",method:"GET",path:"/v1/collections",idempotency:"not_required",principal:"api_key",summary:"List Collections"},{name:"collection.pay_in.cancel",operationId:"collection_pay_in_cancel",method:"POST",path:"/v1/collections/{collectionId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel a reserved collection pay-in"},{name:"collection.pay_in.capture",operationId:"collection_pay_in_capture",method:"POST",path:"/v1/collections/{collectionId}/capture",idempotency:"required",principal:"api_key",summary:"Capture a reserved collection pay-in"},{name:"collection.pay_in.reserve",operationId:"collection_pay_in_reserve",method:"POST",path:"/v1/collections/reserve",idempotency:"required",principal:"api_key",summary:"Reserve a collection pay-in"},{name:"collection.retrieve",operationId:"collection_retrieve",method:"GET",path:"/v1/collections/{collectionId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Collection"},{name:"collections_case.agree_plan",operationId:"collections_case_agree_plan",method:"POST",path:"/v1/collections-cases/{collectionsCaseId}/agree-plan",idempotency:"required",principal:"api_key",summary:"Record an agreed settlement plan"},{name:"collections_case.assign",operationId:"collections_case_assign",method:"POST",path:"/v1/collections-cases/{collectionsCaseId}/assign",idempotency:"required",principal:"api_key",summary:"Assign a collections case to an agency"},{name:"collections_case.create",operationId:"collections_case_create",method:"POST",path:"/v1/collections-cases",idempotency:"required",principal:"api_key",summary:"Open a collections case"},{name:"collections_case.list",operationId:"collections_case_list",method:"GET",path:"/v1/collections-cases",idempotency:"not_required",principal:"api_key",summary:"List collections cases"},{name:"collections_case.recall",operationId:"collections_case_recall",method:"POST",path:"/v1/collections-cases/{collectionsCaseId}/recall",idempotency:"required",principal:"api_key",summary:"Recall a collections case"},{name:"collections_case.recover",operationId:"collections_case_recover",method:"POST",path:"/v1/collections-cases/{collectionsCaseId}/recover",idempotency:"required",principal:"api_key",summary:"Record a lump-sum recovery"},{name:"collections_case.retrieve",operationId:"collections_case_retrieve",method:"GET",path:"/v1/collections-cases/{collectionsCaseId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a collections case"},{name:"collections_case.return_uncollected",operationId:"collections_case_return_uncollected",method:"POST",path:"/v1/collections-cases/{collectionsCaseId}/return-uncollected",idempotency:"required",principal:"api_key",summary:"Record a case returned uncollected"},{name:"collections_case.update",operationId:"collections_case_update",method:"PATCH",path:"/v1/collections-cases/{collectionsCaseId}",idempotency:"required",principal:"api_key",summary:"Update a collections case"},{name:"composer.catalog",operationId:"composer_catalog",method:"GET",path:"/v1/composer/catalog",idempotency:"not_required",principal:"user_session",summary:"Retrieve the composer authoring vocabulary"},{name:"composer.check",operationId:"composer_check",method:"POST",path:"/v1/composer/check",idempotency:"not_required",principal:"user_session",summary:"Check an HSX program or compiled .udl document"},{name:"composer.plan",operationId:"composer_plan",method:"POST",path:"/v1/composer/plan",idempotency:"not_required",principal:"user_session",summary:"Plan an HSX program or compiled .udl document against a build"},{name:"consent.grant",operationId:"consent_grant",method:"POST",path:"/v1/consents",idempotency:"required",principal:"user_session",summary:"Grant scoped provider data consent"},{name:"consent.list",operationId:"consent_list",method:"GET",path:"/v1/consents",idempotency:"not_required",principal:"api_key",summary:"List Consents"},{name:"consent.retrieve",operationId:"consent_retrieve",method:"GET",path:"/v1/consents/{consentId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Consent"},{name:"consent.revoke",operationId:"consent_revoke",method:"POST",path:"/v1/consents/{consentId}/revoke",idempotency:"required",principal:"api_key",summary:"Revoke provider data consent"},{name:"contact_attempt.create",operationId:"contact_attempt_create",method:"POST",path:"/v1/contact-attempts",idempotency:"required",principal:"api_key",summary:"Record a contact attempt"},{name:"contact_attempt.list",operationId:"contact_attempt_list",method:"GET",path:"/v1/contact-attempts",idempotency:"not_required",principal:"api_key",summary:"List contact attempts"},{name:"contact_attempt.retrieve",operationId:"contact_attempt_retrieve",method:"GET",path:"/v1/contact-attempts/{contactAttemptId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a contact attempt"},{name:"contact_attempt.void",operationId:"contact_attempt_void",method:"POST",path:"/v1/contact-attempts/{contactAttemptId}/void",idempotency:"required",principal:"api_key",summary:"Void a contact attempt"},{name:"credit_agreement.advance",operationId:"credit_agreement_advance",method:"POST",path:"/v1/credit-agreements/{creditAgreementId}/advance",idempotency:"required",principal:"api_key",summary:"Advance a credit agreement"},{name:"credit_agreement.create",operationId:"credit_agreement_create",method:"POST",path:"/v1/credit-agreements",idempotency:"required",principal:"api_key",summary:"Create a credit agreement"},{name:"credit_agreement.list",operationId:"credit_agreement_list",method:"GET",path:"/v1/credit-agreements",idempotency:"not_required",principal:"api_key",summary:"List credit agreements"},{name:"credit_agreement.refinance",operationId:"credit_agreement_refinance",method:"POST",path:"/v1/credit-agreements/{creditAgreementId}/refinance",idempotency:"required",principal:"api_key",summary:"Refinance a credit agreement"},{name:"credit_agreement.reschedule",operationId:"credit_agreement_reschedule",method:"POST",path:"/v1/credit-agreements/{creditAgreementId}/reschedule",idempotency:"required",principal:"api_key",summary:"Reschedule a credit agreement"},{name:"credit_agreement.retrieve",operationId:"credit_agreement_retrieve",method:"GET",path:"/v1/credit-agreements/{creditAgreementId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a credit agreement"},{name:"credit_agreement.settle",operationId:"credit_agreement_settle",method:"POST",path:"/v1/credit-agreements/{creditAgreementId}/settle",idempotency:"required",principal:"api_key",summary:"Settle a credit agreement"},{name:"credit_agreement.update",operationId:"credit_agreement_update",method:"PATCH",path:"/v1/credit-agreements/{creditAgreementId}",idempotency:"required",principal:"api_key",summary:"Update a credit agreement"},{name:"credit_agreement.write_off",operationId:"credit_agreement_write_off",method:"POST",path:"/v1/credit-agreements/{creditAgreementId}/write-off",idempotency:"required",principal:"api_key",summary:"Write off a credit agreement"},{name:"credit_balance.list",operationId:"credit_balance_list",method:"GET",path:"/v1/credit-balances",idempotency:"not_required",principal:"api_key",summary:"List Credit balances"},{name:"credit_balance.retrieve",operationId:"credit_balance_retrieve",method:"GET",path:"/v1/credit-balances/{creditBalanceId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Credit balance"},{name:"credit_grant.list",operationId:"credit_grant_list",method:"GET",path:"/v1/credit-grants",idempotency:"not_required",principal:"api_key",summary:"List Credit grants"},{name:"credit_grant.retrieve",operationId:"credit_grant_retrieve",method:"GET",path:"/v1/credit-grants/{creditGrantId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Credit grant"},{name:"credit_ledger_entry.list",operationId:"credit_ledger_entry_list",method:"GET",path:"/v1/credit-ledger-entries",idempotency:"not_required",principal:"api_key",summary:"List Credit ledger"},{name:"credit_ledger_entry.retrieve",operationId:"credit_ledger_entry_retrieve",method:"GET",path:"/v1/credit-ledger-entries/{creditLedgerEntryId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Credit ledger entry"},{name:"credit_note.list",operationId:"credit_note_list",method:"GET",path:"/v1/credit-notes",idempotency:"not_required",principal:"api_key",summary:"List Credit notes"},{name:"credit_note.retrieve",operationId:"credit_note_retrieve",method:"GET",path:"/v1/credit-notes/{creditNoteId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Credit note"},{name:"credit_note_line.list",operationId:"credit_note_line_list",method:"GET",path:"/v1/credit-note-lines",idempotency:"not_required",principal:"api_key",summary:"List Credit note lines"},{name:"credit_note_line.retrieve",operationId:"credit_note_line_retrieve",method:"GET",path:"/v1/credit-note-lines/{creditNoteLineId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Credit note line"},{name:"customer.create",operationId:"customer_create",method:"POST",path:"/v1/customers",idempotency:"required",principal:"api_key",summary:"Create a customer"},{name:"customer.data.export",operationId:"customer_data_export",method:"GET",path:"/v1/customers/{customerId}/data-export",idempotency:"not_required",principal:"user_session",summary:"Export the customer's personal data"},{name:"customer.disable",operationId:"customer_disable",method:"POST",path:"/v1/customers/{customerId}/disable",idempotency:"required",principal:"user_session",summary:"Disable a customer"},{name:"customer.erase",operationId:"customer_erase",method:"POST",path:"/v1/customers/{customerId}/erase",idempotency:"required",principal:"user_session",summary:"Erase a customer (crypto-shred)"},{name:"customer.list",operationId:"customer_list",method:"GET",path:"/v1/customers",idempotency:"not_required",principal:"api_key",summary:"List Customers"},{name:"customer.login",operationId:"customer_login",method:"POST",path:"/v1/customer-identity/login",idempotency:"required",principal:"public",summary:"Log in an end customer to a product"},{name:"customer.logout",operationId:"customer_logout",method:"POST",path:"/v1/customer-identity/logout",idempotency:"required",principal:"customer_session",summary:"Log out the current end-customer session"},{name:"customer.reactivate",operationId:"customer_reactivate",method:"POST",path:"/v1/customers/{customerId}/reactivate",idempotency:"required",principal:"user_session",summary:"Reactivate a customer"},{name:"customer.retrieve",operationId:"customer_retrieve",method:"GET",path:"/v1/customers/{customerId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Customer"},{name:"customer.session.revoke",operationId:"customer_session_revoke",method:"POST",path:"/v1/customer-identity/sessions/{customerSessionId}/revoke",idempotency:"required",principal:"customer_session",summary:"Revoke one of the calling end customer's sessions"},{name:"customer.signup",operationId:"customer_signup",method:"POST",path:"/v1/customer-identity/signup",idempotency:"required",principal:"public",summary:"Sign up an end customer for a product"},{name:"customer.update",operationId:"customer_update",method:"PATCH",path:"/v1/customers/{customerId}",idempotency:"required",principal:"user_session",summary:"Update a customer"},{name:"customer_access.close",operationId:"customer_access_close",method:"POST",path:"/v1/customer-access/{customerAccessId}/close",idempotency:"required",principal:"api_key",summary:"Close customer access"},{name:"customer_access.create",operationId:"customer_access_create",method:"POST",path:"/v1/customer-access",idempotency:"required",principal:"user_session",summary:"Enroll a customer in a product"},{name:"customer_access.list",operationId:"customer_access_list",method:"GET",path:"/v1/customer-access",idempotency:"not_required",principal:"api_key",summary:"List Customer accesses"},{name:"customer_access.reactivate",operationId:"customer_access_reactivate",method:"POST",path:"/v1/customer-access/{customerAccessId}/reactivate",idempotency:"required",principal:"api_key",summary:"Reactivate customer access"},{name:"customer_access.retrieve",operationId:"customer_access_retrieve",method:"GET",path:"/v1/customer-access/{customerAccessId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Customer access"},{name:"customer_access.suspend",operationId:"customer_access_suspend",method:"POST",path:"/v1/customer-access/{customerAccessId}/suspend",idempotency:"required",principal:"api_key",summary:"Suspend customer access"},{name:"deposit.list",operationId:"deposit_list",method:"GET",path:"/v1/deposits",idempotency:"not_required",principal:"api_key",summary:"List Deposits"},{name:"deposit.retrieve",operationId:"deposit_retrieve",method:"GET",path:"/v1/deposits/{depositId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Deposit"},{name:"deposit_hold.cancel",operationId:"deposit_hold_cancel",method:"POST",path:"/v1/deposit-holds/{depositHoldId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel a deposit hold"},{name:"deposit_hold.claim",operationId:"deposit_hold_claim",method:"POST",path:"/v1/deposit-holds/{depositHoldId}/claim",idempotency:"required",principal:"api_key",summary:"Claim a deposit hold"},{name:"deposit_hold.create",operationId:"deposit_hold_create",method:"POST",path:"/v1/deposit-holds",idempotency:"required",principal:"api_key",summary:"Create a deposit hold"},{name:"deposit_hold.fund",operationId:"deposit_hold_fund",method:"POST",path:"/v1/deposit-holds/{depositHoldId}/fund",idempotency:"required",principal:"api_key",summary:"Fund a deposit hold"},{name:"deposit_hold.list",operationId:"deposit_hold_list",method:"GET",path:"/v1/deposit-holds",idempotency:"not_required",principal:"api_key",summary:"List deposit holds"},{name:"deposit_hold.retrieve",operationId:"deposit_hold_retrieve",method:"GET",path:"/v1/deposit-holds/{depositHoldId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a deposit hold"},{name:"deposit_hold.return",operationId:"deposit_hold_return",method:"POST",path:"/v1/deposit-holds/{depositHoldId}/return",idempotency:"required",principal:"api_key",summary:"Return a deposit hold"},{name:"developer.log.list",operationId:"developer_log_list",method:"GET",path:"/v1/developer-logs",idempotency:"not_required",principal:"api_key",summary:"List developer logs"},{name:"developer.log.retrieve",operationId:"developer_log_retrieve",method:"GET",path:"/v1/developer-logs/{operationId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a developer log"},{name:"entity.kyc.retrieve",operationId:"entity_kyc_retrieve",method:"GET",path:"/v1/entities/{entityId}/kyc",idempotency:"not_required",principal:"user_session",summary:"Retrieve an entity's KYC profile"},{name:"entity.kyc.submit",operationId:"entity_kyc_submit",method:"POST",path:"/v1/entities/{entityId}/kyc",idempotency:"required",principal:"user_session",summary:"Submit entity KYC profile fields"},{name:"entity.kyc.verification.start",operationId:"entity_kyc_verification_start",method:"POST",path:"/v1/entities/{entityId}/kyc/verify",idempotency:"required",principal:"user_session",summary:"Start entity KYC verification"},{name:"entity.update",operationId:"entity_update",method:"PATCH",path:"/v1/entities/{entityId}",idempotency:"required",principal:"user_session",summary:"Correct entity legal details"},{name:"escrow_order.cancel",operationId:"escrow_order_cancel",method:"POST",path:"/v1/escrow-orders/{escrowOrderId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel an escrow order"},{name:"escrow_order.collect_penalty",operationId:"escrow_order_collect_penalty",method:"POST",path:"/v1/escrow-orders/{escrowOrderId}/collect-penalty",idempotency:"required",principal:"api_key",summary:"Collect an escrow refund penalty"},{name:"escrow_order.create",operationId:"escrow_order_create",method:"POST",path:"/v1/escrow-orders",idempotency:"required",principal:"api_key",summary:"Create an escrow order"},{name:"escrow_order.dispute",operationId:"escrow_order_dispute",method:"POST",path:"/v1/escrow-orders/{escrowOrderId}/dispute",idempotency:"required",principal:"api_key",summary:"Dispute an escrow order"},{name:"escrow_order.fund",operationId:"escrow_order_fund",method:"POST",path:"/v1/escrow-orders/{escrowOrderId}/fund",idempotency:"required",principal:"api_key",summary:"Fund an escrow order"},{name:"escrow_order.list",operationId:"escrow_order_list",method:"GET",path:"/v1/escrow-orders",idempotency:"not_required",principal:"api_key",summary:"List escrow orders"},{name:"escrow_order.quote",operationId:"escrow_order_quote",method:"POST",path:"/v1/escrow-orders/{escrowOrderId}/quote",idempotency:"required",principal:"api_key",summary:"Quote an escrow refund"},{name:"escrow_order.refund",operationId:"escrow_order_refund",method:"POST",path:"/v1/escrow-orders/{escrowOrderId}/refund",idempotency:"required",principal:"api_key",summary:"Refund an escrow order"},{name:"escrow_order.release",operationId:"escrow_order_release",method:"POST",path:"/v1/escrow-orders/{escrowOrderId}/release",idempotency:"required",principal:"api_key",summary:"Release an escrow order"},{name:"escrow_order.resume",operationId:"escrow_order_resume",method:"POST",path:"/v1/escrow-orders/{escrowOrderId}/resume",idempotency:"required",principal:"api_key",summary:"Resume an escrow order"},{name:"escrow_order.retrieve",operationId:"escrow_order_retrieve",method:"GET",path:"/v1/escrow-orders/{escrowOrderId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an escrow order"},{name:"escrow_order.update",operationId:"escrow_order_update",method:"PATCH",path:"/v1/escrow-orders/{escrowOrderId}",idempotency:"required",principal:"api_key",summary:"Update an escrow order"},{name:"event.list",operationId:"event_list",method:"GET",path:"/v1/events",idempotency:"not_required",principal:"api_key",summary:"List events"},{name:"event.retrieve",operationId:"event_retrieve",method:"GET",path:"/v1/events/{eventId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an event"},{name:"expected_payment.cancel",operationId:"expected_payment_cancel",method:"POST",path:"/v1/expected-payments/{expectedPaymentId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel an expected payment"},{name:"expected_payment.create",operationId:"expected_payment_create",method:"POST",path:"/v1/expected-payments",idempotency:"required",principal:"api_key",summary:"Create an expected payment"},{name:"expected_payment.list",operationId:"expected_payment_list",method:"GET",path:"/v1/expected-payments",idempotency:"not_required",principal:"api_key",summary:"List Expected payments"},{name:"expected_payment.retrieve",operationId:"expected_payment_retrieve",method:"GET",path:"/v1/expected-payments/{expectedPaymentId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an Expected payment"},{name:"exposure_arrangement.approve",operationId:"exposure_arrangement_approve",method:"POST",path:"/v1/exposure-arrangements/{exposureArrangementId}/approve",idempotency:"required",principal:"api_key",summary:"Approve an exposure arrangement"},{name:"exposure_arrangement.close",operationId:"exposure_arrangement_close",method:"POST",path:"/v1/exposure-arrangements/{exposureArrangementId}/close",idempotency:"required",principal:"api_key",summary:"Close an exposure arrangement"},{name:"exposure_arrangement.create",operationId:"exposure_arrangement_create",method:"POST",path:"/v1/exposure-arrangements",idempotency:"required",principal:"api_key",summary:"Create an exposure arrangement"},{name:"exposure_arrangement.list",operationId:"exposure_arrangement_list",method:"GET",path:"/v1/exposure-arrangements",idempotency:"not_required",principal:"api_key",summary:"List exposure arrangements"},{name:"exposure_arrangement.reject",operationId:"exposure_arrangement_reject",method:"POST",path:"/v1/exposure-arrangements/{exposureArrangementId}/reject",idempotency:"required",principal:"api_key",summary:"Reject an exposure arrangement"},{name:"exposure_arrangement.retrieve",operationId:"exposure_arrangement_retrieve",method:"GET",path:"/v1/exposure-arrangements/{exposureArrangementId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an exposure arrangement"},{name:"exposure_arrangement.update",operationId:"exposure_arrangement_update",method:"PATCH",path:"/v1/exposure-arrangements/{exposureArrangementId}",idempotency:"required",principal:"api_key",summary:"Update an exposure arrangement"},{name:"extension.list",operationId:"extension_list",method:"GET",path:"/v1/extensions",idempotency:"not_required",principal:"public",summary:"List catalog extensions"},{name:"external_confirmation.list",operationId:"external_confirmation_list",method:"GET",path:"/v1/external-confirmation",idempotency:"not_required",principal:"user_session",summary:"List External Confirmations"},{name:"external_confirmation.retrieve",operationId:"external_confirmation_retrieve",method:"GET",path:"/v1/external-confirmation/{externalConfirmationId}",idempotency:"not_required",principal:"user_session",summary:"Retrieve an External Confirmation"},{name:"financial_address.create",operationId:"financial_address_create",method:"POST",path:"/v1/financial-addresses",idempotency:"required",principal:"api_key",summary:"Create a financial address"},{name:"financial_address.disable",operationId:"financial_address_disable",method:"POST",path:"/v1/financial-addresses/{financialAddressId}/disable",idempotency:"required",principal:"api_key",summary:"Disable a financial address"},{name:"financial_address.list",operationId:"financial_address_list",method:"GET",path:"/v1/financial-addresses",idempotency:"not_required",principal:"api_key",summary:"List Financial addresses"},{name:"financial_address.retrieve",operationId:"financial_address_retrieve",method:"GET",path:"/v1/financial-addresses/{financialAddressId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Financial address"},{name:"flight_booking.amend_collect",operationId:"flight_booking_amend_collect",method:"POST",path:"/v1/flight-bookings/{flightBookingId}/amend-collect",idempotency:"required",principal:"api_key",summary:"Collect an amended fare increase"},{name:"flight_booking.amend_fee",operationId:"flight_booking_amend_fee",method:"POST",path:"/v1/flight-bookings/{flightBookingId}/amend-fee",idempotency:"required",principal:"api_key",summary:"Collect a flight amendment fee"},{name:"flight_booking.amend_refund",operationId:"flight_booking_amend_refund",method:"POST",path:"/v1/flight-bookings/{flightBookingId}/amend-refund",idempotency:"required",principal:"api_key",summary:"Refund an amended fare decrease"},{name:"flight_booking.cancel_confirm",operationId:"flight_booking_cancel_confirm",method:"POST",path:"/v1/flight-bookings/{flightBookingId}/cancel-confirm",idempotency:"required",principal:"api_key",summary:"Confirm a flight booking cancellation"},{name:"flight_booking.cancel_quote",operationId:"flight_booking_cancel_quote",method:"POST",path:"/v1/flight-bookings/{flightBookingId}/cancel-quote",idempotency:"required",principal:"api_key",summary:"Quote a flight booking cancellation"},{name:"flight_booking.collect_penalty",operationId:"flight_booking_collect_penalty",method:"POST",path:"/v1/flight-bookings/{flightBookingId}/collect-penalty",idempotency:"required",principal:"api_key",summary:"Collect a flight cancellation penalty"},{name:"flight_booking.confirm",operationId:"flight_booking_confirm",method:"POST",path:"/v1/flight-bookings/{flightBookingId}/confirm",idempotency:"required",principal:"api_key",summary:"Confirm a flight booking"},{name:"flight_booking.create",operationId:"flight_booking_create",method:"POST",path:"/v1/flight-bookings",idempotency:"required",principal:"api_key",summary:"Hold a flight booking"},{name:"flight_booking.list",operationId:"flight_booking_list",method:"GET",path:"/v1/flight-bookings",idempotency:"not_required",principal:"api_key",summary:"List flight bookings"},{name:"flight_booking.release",operationId:"flight_booking_release",method:"POST",path:"/v1/flight-bookings/{flightBookingId}/release",idempotency:"required",principal:"api_key",summary:"Release a held flight booking"},{name:"flight_booking.retrieve",operationId:"flight_booking_retrieve",method:"GET",path:"/v1/flight-bookings/{flightBookingId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a flight booking"},{name:"flight_booking.update",operationId:"flight_booking_update",method:"PATCH",path:"/v1/flight-bookings/{flightBookingId}",idempotency:"required",principal:"api_key",summary:"Update a flight booking"},{name:"funded_settlement.accept",operationId:"funded_settlement_accept",method:"POST",path:"/v1/funded-settlements/{fundedSettlementId}/accept",idempotency:"required",principal:"api_key",summary:"Accept instrument"},{name:"funded_settlement.cancel",operationId:"funded_settlement_cancel",method:"POST",path:"/v1/funded-settlements/{fundedSettlementId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel instrument"},{name:"funded_settlement.close_refund",operationId:"funded_settlement_close_refund",method:"POST",path:"/v1/funded-settlements/{fundedSettlementId}/close-refund",idempotency:"required",principal:"api_key",summary:"Close Refund instrument"},{name:"funded_settlement.close_release",operationId:"funded_settlement_close_release",method:"POST",path:"/v1/funded-settlements/{fundedSettlementId}/close-release",idempotency:"required",principal:"api_key",summary:"Close Release instrument"},{name:"funded_settlement.create",operationId:"funded_settlement_create",method:"POST",path:"/v1/funded-settlements",idempotency:"required",principal:"api_key",summary:"Create instrument"},{name:"funded_settlement.fund",operationId:"funded_settlement_fund",method:"POST",path:"/v1/funded-settlements/{fundedSettlementId}/fund",idempotency:"required",principal:"api_key",summary:"Fund instrument"},{name:"funded_settlement.list",operationId:"funded_settlement_list",method:"GET",path:"/v1/funded-settlements",idempotency:"not_required",principal:"api_key",summary:"List funded settlements"},{name:"funded_settlement.prepare_refund",operationId:"funded_settlement_prepare_refund",method:"POST",path:"/v1/funded-settlements/{fundedSettlementId}/prepare-refund",idempotency:"required",principal:"api_key",summary:"Prepare Refund instrument"},{name:"funded_settlement.prepare_release",operationId:"funded_settlement_prepare_release",method:"POST",path:"/v1/funded-settlements/{fundedSettlementId}/prepare-release",idempotency:"required",principal:"api_key",summary:"Prepare Release instrument"},{name:"funded_settlement.record_funding_authority",operationId:"funded_settlement_record_funding_authority",method:"POST",path:"/v1/funded-settlements/{fundedSettlementId}/record-funding-authority",idempotency:"required",principal:"api_key",summary:"Record Funding Authority instrument"},{name:"funded_settlement.refund",operationId:"funded_settlement_refund",method:"POST",path:"/v1/funded-settlements/{fundedSettlementId}/refund",idempotency:"required",principal:"api_key",summary:"Refund instrument"},{name:"funded_settlement.release",operationId:"funded_settlement_release",method:"POST",path:"/v1/funded-settlements/{fundedSettlementId}/release",idempotency:"required",principal:"api_key",summary:"Release instrument"},{name:"funded_settlement.retrieve",operationId:"funded_settlement_retrieve",method:"GET",path:"/v1/funded-settlements/{fundedSettlementId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a funded settlement"},{name:"funding_commitment.create",operationId:"funding_commitment_create",method:"POST",path:"/v1/funding-commitments",idempotency:"required",principal:"api_key",summary:"Commit from the investor's original wallet"},{name:"funding_commitment.list",operationId:"funding_commitment_list",method:"GET",path:"/v1/funding-commitments",idempotency:"not_required",principal:"api_key",summary:"List funding commitments"},{name:"funding_commitment.retrieve",operationId:"funding_commitment_retrieve",method:"GET",path:"/v1/funding-commitments/{fundingCommitmentId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a funding commitment"},{name:"funding_commitment.withdraw",operationId:"funding_commitment_withdraw",method:"POST",path:"/v1/funding-commitments/{fundingCommitmentId}/withdraw",idempotency:"required",principal:"api_key",summary:"Withdraw once before the round closes"},{name:"funding_round.close",operationId:"funding_round_close",method:"POST",path:"/v1/funding-rounds/{fundingRoundId}/close",idempotency:"required",principal:"api_key",summary:"Snapshot tickets and fund one obligation atomically"},{name:"funding_round.create",operationId:"funding_round_create",method:"POST",path:"/v1/funding-rounds",idempotency:"required",principal:"api_key",summary:"Open a round with immutable terms"},{name:"funding_round.list",operationId:"funding_round_list",method:"GET",path:"/v1/funding-rounds",idempotency:"not_required",principal:"api_key",summary:"List funding rounds"},{name:"funding_round.retrieve",operationId:"funding_round_retrieve",method:"GET",path:"/v1/funding-rounds/{fundingRoundId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a funding round"},{name:"held_settlement.abandon",operationId:"held_settlement_abandon",method:"POST",path:"/v1/held-settlements/{heldSettlementId}/abandon",idempotency:"required",principal:"api_key",summary:"Abandon the hold before it is funded"},{name:"held_settlement.cancel",operationId:"held_settlement_cancel",method:"POST",path:"/v1/held-settlements/{heldSettlementId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel the hold and return the held amount"},{name:"held_settlement.create",operationId:"held_settlement_create",method:"POST",path:"/v1/held-settlements",idempotency:"required",principal:"api_key",summary:"Open a held settlement"},{name:"held_settlement.dispute",operationId:"held_settlement_dispute",method:"POST",path:"/v1/held-settlements/{heldSettlementId}/dispute",idempotency:"required",principal:"api_key",summary:"Dispute a held settlement settlement"},{name:"held_settlement.fund",operationId:"held_settlement_fund",method:"POST",path:"/v1/held-settlements/{heldSettlementId}/fund",idempotency:"required",principal:"api_key",summary:"Fund the hold and collect the custody fee"},{name:"held_settlement.list",operationId:"held_settlement_list",method:"GET",path:"/v1/held-settlements",idempotency:"not_required",principal:"api_key",summary:"List held settlements"},{name:"held_settlement.release",operationId:"held_settlement_release",method:"POST",path:"/v1/held-settlements/{heldSettlementId}/release",idempotency:"required",principal:"api_key",summary:"Release the hold to the payee early"},{name:"held_settlement.resume",operationId:"held_settlement_resume",method:"POST",path:"/v1/held-settlements/{heldSettlementId}/resume",idempotency:"required",principal:"api_key",summary:"Resume a held settlement settlement"},{name:"held_settlement.retrieve",operationId:"held_settlement_retrieve",method:"GET",path:"/v1/held-settlements/{heldSettlementId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a held settlement"},{name:"hotel_stay.amend_collect",operationId:"hotel_stay_amend_collect",method:"POST",path:"/v1/hotel-stays/{hotelStayId}/amend-collect",idempotency:"required",principal:"api_key",summary:"Collect an amended rate increase"},{name:"hotel_stay.amend_fee",operationId:"hotel_stay_amend_fee",method:"POST",path:"/v1/hotel-stays/{hotelStayId}/amend-fee",idempotency:"required",principal:"api_key",summary:"Collect a stay amendment fee"},{name:"hotel_stay.amend_refund",operationId:"hotel_stay_amend_refund",method:"POST",path:"/v1/hotel-stays/{hotelStayId}/amend-refund",idempotency:"required",principal:"api_key",summary:"Refund an amended rate decrease"},{name:"hotel_stay.cancel_confirm",operationId:"hotel_stay_cancel_confirm",method:"POST",path:"/v1/hotel-stays/{hotelStayId}/cancel-confirm",idempotency:"required",principal:"api_key",summary:"Confirm a hotel stay cancellation"},{name:"hotel_stay.cancel_quote",operationId:"hotel_stay_cancel_quote",method:"POST",path:"/v1/hotel-stays/{hotelStayId}/cancel-quote",idempotency:"required",principal:"api_key",summary:"Quote a hotel stay cancellation"},{name:"hotel_stay.collect_penalty",operationId:"hotel_stay_collect_penalty",method:"POST",path:"/v1/hotel-stays/{hotelStayId}/collect-penalty",idempotency:"required",principal:"api_key",summary:"Collect a hotel cancellation penalty"},{name:"hotel_stay.confirm",operationId:"hotel_stay_confirm",method:"POST",path:"/v1/hotel-stays/{hotelStayId}/confirm",idempotency:"required",principal:"api_key",summary:"Confirm a hotel stay"},{name:"hotel_stay.create",operationId:"hotel_stay_create",method:"POST",path:"/v1/hotel-stays",idempotency:"required",principal:"api_key",summary:"Hold a hotel stay"},{name:"hotel_stay.list",operationId:"hotel_stay_list",method:"GET",path:"/v1/hotel-stays",idempotency:"not_required",principal:"api_key",summary:"List hotel stays"},{name:"hotel_stay.release",operationId:"hotel_stay_release",method:"POST",path:"/v1/hotel-stays/{hotelStayId}/release",idempotency:"required",principal:"api_key",summary:"Release a held hotel stay"},{name:"hotel_stay.retrieve",operationId:"hotel_stay_retrieve",method:"GET",path:"/v1/hotel-stays/{hotelStayId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a hotel stay"},{name:"hotel_stay.update",operationId:"hotel_stay_update",method:"PATCH",path:"/v1/hotel-stays/{hotelStayId}",idempotency:"required",principal:"api_key",summary:"Update a hotel stay"},{name:"human_approval.approve",operationId:"human_approval_approve",method:"POST",path:"/v1/human-approval/requests/{approvalRequestId}/approve",idempotency:"required",principal:"user_session",summary:"Approve a human approval request"},{name:"human_approval.approver.list",operationId:"human_approval_approver_list",method:"GET",path:"/v1/human-approval/requests/{approvalRequestId}/approvers",idempotency:"not_required",principal:"api_key",summary:"List eligible approvers for a human approval request"},{name:"human_approval.cancel",operationId:"human_approval_cancel",method:"POST",path:"/v1/human-approval/requests/{approvalRequestId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel a human approval request"},{name:"human_approval.expire",operationId:"human_approval_expire",method:"POST",path:"/v1/human-approval/expire",idempotency:"required",principal:"api_key",summary:"Expire overdue pending human approval requests"},{name:"human_approval.request.create",operationId:"human_approval_request_create",method:"POST",path:"/v1/human-approval/requests",idempotency:"required",principal:"api_key",summary:"Create a human approval request"},{name:"human_approval.request.list",operationId:"human_approval_request_list",method:"GET",path:"/v1/human-approval/requests",idempotency:"not_required",principal:"api_key",summary:"List human approval requests for the organization"},{name:"human_approval.request.retrieve",operationId:"human_approval_request_retrieve",method:"GET",path:"/v1/human-approval/requests/{approvalRequestId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a human approval request by ID"},{name:"human_approval.review.begin",operationId:"human_approval_review_begin",method:"POST",path:"/v1/human-approval/requests/{approvalRequestId}/review",idempotency:"required",principal:"user_session",summary:"Begin a browser human review ceremony"},{name:"installment.create",operationId:"installment_create",method:"POST",path:"/v1/installments",idempotency:"required",principal:"api_key",summary:"Schedule an installment"},{name:"installment.list",operationId:"installment_list",method:"GET",path:"/v1/installments",idempotency:"not_required",principal:"api_key",summary:"List installments"},{name:"installment.retrieve",operationId:"installment_retrieve",method:"GET",path:"/v1/installments/{installmentId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an installment"},{name:"installment.update",operationId:"installment_update",method:"PATCH",path:"/v1/installments/{installmentId}",idempotency:"required",principal:"api_key",summary:"Update an installment"},{name:"installment.write_off",operationId:"installment_write_off",method:"POST",path:"/v1/installments/{installmentId}/write-off",idempotency:"required",principal:"api_key",summary:"Write off an installment"},{name:"internal_transfer.adjust",operationId:"internal_transfer_adjust",method:"POST",path:"/v1/internal-transfers/{originalTransferId}/adjust",idempotency:"required",principal:"api_key",summary:"Adjust a posted transfer"},{name:"internal_transfer.create",operationId:"internal_transfer_create",method:"POST",path:"/v1/internal-transfers",idempotency:"required",principal:"api_key",summary:"Create an internal transfer"},{name:"internal_transfer.list",operationId:"internal_transfer_list",method:"GET",path:"/v1/internal-transfers",idempotency:"not_required",principal:"api_key",summary:"List Internal Transfers"},{name:"internal_transfer.post",operationId:"internal_transfer_post",method:"POST",path:"/v1/internal-transfers/{transferId}/post",idempotency:"required",principal:"api_key",summary:"Post a reserved transfer"},{name:"internal_transfer.reserve",operationId:"internal_transfer_reserve",method:"POST",path:"/v1/internal-transfers/reserve",idempotency:"required",principal:"api_key",summary:"Reserve an internal transfer"},{name:"internal_transfer.retrieve",operationId:"internal_transfer_retrieve",method:"GET",path:"/v1/internal-transfers/{transferId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an Internal Transfer"},{name:"internal_transfer.reverse",operationId:"internal_transfer_reverse",method:"POST",path:"/v1/internal-transfers/{originalTransferId}/reverse",idempotency:"required",principal:"api_key",summary:"Reverse a posted transfer in full"},{name:"internal_transfer.void",operationId:"internal_transfer_void",method:"POST",path:"/v1/internal-transfers/{transferId}/void",idempotency:"required",principal:"api_key",summary:"Void a reserved transfer"},{name:"invoice.list",operationId:"invoice_list",method:"GET",path:"/v1/invoices",idempotency:"not_required",principal:"api_key",summary:"List Invoices"},{name:"invoice.preview",operationId:"invoice_preview",method:"GET",path:"/v1/invoices/preview",idempotency:"not_required",principal:"user_session",summary:"Preview an invoice"},{name:"invoice.retrieve",operationId:"invoice_retrieve",method:"GET",path:"/v1/invoices/{invoiceId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an Invoice"},{name:"invoice_line.list",operationId:"invoice_line_list",method:"GET",path:"/v1/invoice-lines",idempotency:"not_required",principal:"api_key",summary:"List Invoice lines"},{name:"invoice_line.retrieve",operationId:"invoice_line_retrieve",method:"GET",path:"/v1/invoice-lines/{invoiceLineId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an Invoice line"},{name:"kyc.requirements.retrieve",operationId:"kyc_requirements_retrieve",method:"GET",path:"/v1/kyc/requirements",idempotency:"not_required",principal:"public",summary:"Retrieve KYC tier requirements"},{name:"lender_distribution.create",operationId:"lender_distribution_create",method:"POST",path:"/v1/lender-distributions",idempotency:"required",principal:"api_key",summary:"Claim a lender's share of an agreement's repayments"},{name:"lender_distribution.list",operationId:"lender_distribution_list",method:"GET",path:"/v1/lender-distributions",idempotency:"not_required",principal:"api_key",summary:"List lender distributions"},{name:"lender_distribution.retrieve",operationId:"lender_distribution_retrieve",method:"GET",path:"/v1/lender-distributions/{lenderDistributionId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a lender distribution"},{name:"listing.create",operationId:"listing_create",method:"POST",path:"/v1/listings",idempotency:"required",principal:"api_key",summary:"Draft a listing"},{name:"listing.list",operationId:"listing_list",method:"GET",path:"/v1/listings",idempotency:"not_required",principal:"api_key",summary:"List listings"},{name:"listing.publish",operationId:"listing_publish",method:"POST",path:"/v1/listings/{listingId}/publish",idempotency:"required",principal:"api_key",summary:"Publish a listing"},{name:"listing.reopen",operationId:"listing_reopen",method:"POST",path:"/v1/listings/{listingId}/reopen",idempotency:"required",principal:"api_key",summary:"Reopen a listing"},{name:"listing.reserve",operationId:"listing_reserve",method:"POST",path:"/v1/listings/{listingId}/reserve",idempotency:"required",principal:"api_key",summary:"Reserve a listing"},{name:"listing.retrieve",operationId:"listing_retrieve",method:"GET",path:"/v1/listings/{listingId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a listing"},{name:"listing.sell",operationId:"listing_sell",method:"POST",path:"/v1/listings/{listingId}/sell",idempotency:"required",principal:"api_key",summary:"Sell a listing"},{name:"listing.update",operationId:"listing_update",method:"PATCH",path:"/v1/listings/{listingId}",idempotency:"required",principal:"api_key",summary:"Update a listing"},{name:"listing.withdraw",operationId:"listing_withdraw",method:"POST",path:"/v1/listings/{listingId}/withdraw",idempotency:"required",principal:"api_key",summary:"Withdraw a listing"},{name:"meter_period_snapshot.list",operationId:"meter_period_snapshot_list",method:"GET",path:"/v1/meter-period-snapshots",idempotency:"not_required",principal:"api_key",summary:"List Meter period snapshots"},{name:"meter_period_snapshot.retrieve",operationId:"meter_period_snapshot_retrieve",method:"GET",path:"/v1/meter-period-snapshots/{meterPeriodSnapshotId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Meter period snapshot"},{name:"motor_policy.bind",operationId:"motor_policy_bind",method:"POST",path:"/v1/motor-policies/{motorPolicyId}/bind",idempotency:"required",principal:"api_key",summary:"Bind a motor policy"},{name:"motor_policy.cancel",operationId:"motor_policy_cancel",method:"POST",path:"/v1/motor-policies/{motorPolicyId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel a quoted motor policy"},{name:"motor_policy.create",operationId:"motor_policy_create",method:"POST",path:"/v1/motor-policies",idempotency:"required",principal:"api_key",summary:"Quote a motor policy"},{name:"motor_policy.deny_claim",operationId:"motor_policy_deny_claim",method:"POST",path:"/v1/motor-policies/{motorPolicyId}/deny-claim",idempotency:"required",principal:"api_key",summary:"Deny a motor claim"},{name:"motor_policy.list",operationId:"motor_policy_list",method:"GET",path:"/v1/motor-policies",idempotency:"not_required",principal:"api_key",summary:"List motor policies"},{name:"motor_policy.open_claim",operationId:"motor_policy_open_claim",method:"POST",path:"/v1/motor-policies/{motorPolicyId}/open-claim",idempotency:"required",principal:"api_key",summary:"Open a motor claim"},{name:"motor_policy.retrieve",operationId:"motor_policy_retrieve",method:"GET",path:"/v1/motor-policies/{motorPolicyId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a motor policy"},{name:"motor_policy.settle_claim",operationId:"motor_policy_settle_claim",method:"POST",path:"/v1/motor-policies/{motorPolicyId}/settle-claim",idempotency:"required",principal:"api_key",summary:"Settle a motor claim"},{name:"motor_policy.update",operationId:"motor_policy_update",method:"PATCH",path:"/v1/motor-policies/{motorPolicyId}",idempotency:"required",principal:"api_key",summary:"Update a motor policy"},{name:"operation.list",operationId:"operation_list",method:"GET",path:"/v1/operations",idempotency:"not_required",principal:"api_key",summary:"List Operations"},{name:"operation.retrieve",operationId:"operation_retrieve",method:"GET",path:"/v1/operations/{operationId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an Operation"},{name:"order.cancel",operationId:"order_cancel",method:"POST",path:"/v1/orders/{orderId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel an order"},{name:"order.confirm",operationId:"order_confirm",method:"POST",path:"/v1/orders/{orderId}/confirm",idempotency:"required",principal:"api_key",summary:"Confirm an order"},{name:"order.create",operationId:"order_create",method:"POST",path:"/v1/orders",idempotency:"required",principal:"api_key",summary:"Create an order"},{name:"order.fulfill",operationId:"order_fulfill",method:"POST",path:"/v1/orders/{orderId}/fulfill",idempotency:"required",principal:"api_key",summary:"Fulfill an order"},{name:"order.list",operationId:"order_list",method:"GET",path:"/v1/orders",idempotency:"not_required",principal:"api_key",summary:"List orders"},{name:"order.retrieve",operationId:"order_retrieve",method:"GET",path:"/v1/orders/{orderId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve an order"},{name:"order.update",operationId:"order_update",method:"PATCH",path:"/v1/orders/{orderId}",idempotency:"required",principal:"api_key",summary:"Update an order"},{name:"payout.create",operationId:"payout_create",method:"POST",path:"/v1/payouts",idempotency:"required",principal:"api_key",summary:"Create a payout"},{name:"payout.list",operationId:"payout_list",method:"GET",path:"/v1/payouts",idempotency:"not_required",principal:"api_key",summary:"List Payouts"},{name:"payout.retrieve",operationId:"payout_retrieve",method:"GET",path:"/v1/payouts/{payoutId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Payout"},{name:"payout_run.cancel",operationId:"payout_run_cancel",method:"POST",path:"/v1/payout-runs/{payoutRunId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel a payout run"},{name:"payout_run.create",operationId:"payout_run_create",method:"POST",path:"/v1/payout-runs",idempotency:"required",principal:"api_key",summary:"Schedule a payout run"},{name:"payout_run.list",operationId:"payout_run_list",method:"GET",path:"/v1/payout-runs",idempotency:"not_required",principal:"api_key",summary:"List payout runs"},{name:"payout_run.retrieve",operationId:"payout_run_retrieve",method:"GET",path:"/v1/payout-runs/{payoutRunId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a payout run"},{name:"payout_run.update",operationId:"payout_run_update",method:"PATCH",path:"/v1/payout-runs/{payoutRunId}",idempotency:"required",principal:"api_key",summary:"Update a payout run"},{name:"payout_run.withhold",operationId:"payout_run_withhold",method:"POST",path:"/v1/payout-runs/{payoutRunId}/withhold",idempotency:"required",principal:"api_key",summary:"Withhold from a payout run"},{name:"personal_access_token.create",operationId:"personal_access_token_create",method:"POST",path:"/v1/personal-access-tokens",idempotency:"required",principal:"user_session",summary:"Create a personal access token"},{name:"personal_access_token.current",operationId:"personal_access_token_current",method:"GET",path:"/v1/personal-access-tokens/current",idempotency:"not_required",principal:"user_session",summary:"Describe the personal access token making this request"},{name:"personal_access_token.list",operationId:"personal_access_token_list",method:"GET",path:"/v1/personal-access-tokens",idempotency:"not_required",principal:"user_session",summary:"List personal access tokens for the caller's Company"},{name:"personal_access_token.login_grant.create",operationId:"personal_access_token_login_grant_create",method:"POST",path:"/v1/personal-access-token-login-grants",idempotency:"required",principal:"user_session",summary:"Create a CLI login grant"},{name:"personal_access_token.login_grant.exchange",operationId:"personal_access_token_login_grant_exchange",method:"POST",path:"/v1/personal-access-token-login-grants/exchange",idempotency:"required",principal:"public",summary:"Exchange a CLI login grant"},{name:"personal_access_token.revoke",operationId:"personal_access_token_revoke",method:"POST",path:"/v1/personal-access-tokens/{personalAccessTokenId}/revoke",idempotency:"required",principal:"user_session",summary:"Revoke a personal access token"},{name:"policy.bind",operationId:"policy_bind",method:"POST",path:"/v1/policies/{policyId}/bind",idempotency:"required",principal:"api_key",summary:"Bind a policy"},{name:"policy.cancel",operationId:"policy_cancel",method:"POST",path:"/v1/policies/{policyId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel a policy"},{name:"policy.confirm_refund",operationId:"policy_confirm_refund",method:"POST",path:"/v1/policies/{policyId}/confirm-refund",idempotency:"required",principal:"api_key",summary:"Confirm active policy refund"},{name:"policy.create",operationId:"policy_create",method:"POST",path:"/v1/policies",idempotency:"required",principal:"api_key",summary:"Quote a policy"},{name:"policy.endorse",operationId:"policy_endorse",method:"POST",path:"/v1/policies/{policyId}/endorse",idempotency:"required",principal:"api_key",summary:"Endorse a policy"},{name:"policy.list",operationId:"policy_list",method:"GET",path:"/v1/policies",idempotency:"not_required",principal:"api_key",summary:"List policies"},{name:"policy.preview",operationId:"policy_preview",method:"POST",path:"/v1/policies/{policyId}/preview",idempotency:"required",principal:"api_key",summary:"Preview policy cancellation"},{name:"policy.quote_refund",operationId:"policy_quote_refund",method:"POST",path:"/v1/policies/{policyId}/quote-refund",idempotency:"required",principal:"api_key",summary:"Quote active policy refund"},{name:"policy.retrieve",operationId:"policy_retrieve",method:"GET",path:"/v1/policies/{policyId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a policy"},{name:"policy.update",operationId:"policy_update",method:"PATCH",path:"/v1/policies/{policyId}",idempotency:"required",principal:"api_key",summary:"Update a policy"},{name:"policy.withdraw",operationId:"policy_withdraw",method:"POST",path:"/v1/policies/{policyId}/withdraw",idempotency:"required",principal:"api_key",summary:"Withdraw a policy quote"},{name:"premium_claim.approve",operationId:"premium_claim_approve",method:"POST",path:"/v1/premium-claims/{premiumClaimId}/approve",idempotency:"required",principal:"api_key",summary:"Approve instrument"},{name:"premium_claim.assess",operationId:"premium_claim_assess",method:"POST",path:"/v1/premium-claims/{premiumClaimId}/assess",idempotency:"required",principal:"api_key",summary:"Assess instrument"},{name:"premium_claim.attest",operationId:"premium_claim_attest",method:"POST",path:"/v1/premium-claims/{premiumClaimId}/attest",idempotency:"required",principal:"api_key",summary:"Attest instrument"},{name:"premium_claim.create",operationId:"premium_claim_create",method:"POST",path:"/v1/premium-claims",idempotency:"required",principal:"api_key",summary:"Create instrument"},{name:"premium_claim.deny",operationId:"premium_claim_deny",method:"POST",path:"/v1/premium-claims/{premiumClaimId}/deny",idempotency:"required",principal:"api_key",summary:"Deny instrument"},{name:"premium_claim.list",operationId:"premium_claim_list",method:"GET",path:"/v1/premium-claims",idempotency:"not_required",principal:"api_key",summary:"List premium claims"},{name:"premium_claim.pay",operationId:"premium_claim_pay",method:"POST",path:"/v1/premium-claims/{premiumClaimId}/pay",idempotency:"required",principal:"api_key",summary:"Pay instrument"},{name:"premium_claim.record_authority",operationId:"premium_claim_record_authority",method:"POST",path:"/v1/premium-claims/{premiumClaimId}/record-authority",idempotency:"required",principal:"api_key",summary:"Record Authority instrument"},{name:"premium_claim.retrieve",operationId:"premium_claim_retrieve",method:"GET",path:"/v1/premium-claims/{premiumClaimId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a premium claim"},{name:"premium_claim.reverse",operationId:"premium_claim_reverse",method:"POST",path:"/v1/premium-claims/{premiumClaimId}/reverse",idempotency:"required",principal:"api_key",summary:"Reverse instrument"},{name:"premium_cover.attest",operationId:"premium_cover_attest",method:"POST",path:"/v1/premium-covers/{premiumCoverId}/attest",idempotency:"required",principal:"api_key",summary:"Attest instrument"},{name:"premium_cover.bind",operationId:"premium_cover_bind",method:"POST",path:"/v1/premium-covers/{premiumCoverId}/bind",idempotency:"required",principal:"api_key",summary:"Bind instrument"},{name:"premium_cover.cancel",operationId:"premium_cover_cancel",method:"POST",path:"/v1/premium-covers/{premiumCoverId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel instrument"},{name:"premium_cover.create",operationId:"premium_cover_create",method:"POST",path:"/v1/premium-covers",idempotency:"required",principal:"api_key",summary:"Create instrument"},{name:"premium_cover.lapse",operationId:"premium_cover_lapse",method:"POST",path:"/v1/premium-covers/{premiumCoverId}/lapse",idempotency:"required",principal:"api_key",summary:"Lapse instrument"},{name:"premium_cover.list",operationId:"premium_cover_list",method:"GET",path:"/v1/premium-covers",idempotency:"not_required",principal:"api_key",summary:"List premium covers"},{name:"premium_cover.retrieve",operationId:"premium_cover_retrieve",method:"GET",path:"/v1/premium-covers/{premiumCoverId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a premium cover"},{name:"premium_slice.collect",operationId:"premium_slice_collect",method:"POST",path:"/v1/premium-slices/{premiumSliceId}/collect",idempotency:"required",principal:"api_key",summary:"Collect instrument"},{name:"premium_slice.create",operationId:"premium_slice_create",method:"POST",path:"/v1/premium-slices",idempotency:"required",principal:"api_key",summary:"Create instrument"},{name:"premium_slice.list",operationId:"premium_slice_list",method:"GET",path:"/v1/premium-slices",idempotency:"not_required",principal:"api_key",summary:"List premium slices"},{name:"premium_slice.refund",operationId:"premium_slice_refund",method:"POST",path:"/v1/premium-slices/{premiumSliceId}/refund",idempotency:"required",principal:"api_key",summary:"Refund instrument"},{name:"premium_slice.retrieve",operationId:"premium_slice_retrieve",method:"GET",path:"/v1/premium-slices/{premiumSliceId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a premium slice"},{name:"priced_borrower_limit.approve",operationId:"priced_borrower_limit_approve",method:"POST",path:"/v1/priced-borrower-limits/{pricedBorrowerLimitId}/approve",idempotency:"required",principal:"api_key",summary:"Approve the limit"},{name:"priced_borrower_limit.close",operationId:"priced_borrower_limit_close",method:"POST",path:"/v1/priced-borrower-limits/{pricedBorrowerLimitId}/close",idempotency:"required",principal:"api_key",summary:"Close the limit without moving money"},{name:"priced_borrower_limit.create",operationId:"priced_borrower_limit_create",method:"POST",path:"/v1/priced-borrower-limits",idempotency:"required",principal:"api_key",summary:"Propose a bound limit"},{name:"priced_borrower_limit.list",operationId:"priced_borrower_limit_list",method:"GET",path:"/v1/priced-borrower-limits",idempotency:"not_required",principal:"api_key",summary:"List priced borrower limits"},{name:"priced_borrower_limit.retrieve",operationId:"priced_borrower_limit_retrieve",method:"GET",path:"/v1/priced-borrower-limits/{pricedBorrowerLimitId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a priced borrower limit"},{name:"priced_borrower_limit.update",operationId:"priced_borrower_limit_update",method:"PATCH",path:"/v1/priced-borrower-limits/{pricedBorrowerLimitId}",idempotency:"required",principal:"api_key",summary:"Update a priced borrower limit"},{name:"priced_collections_case.assign",operationId:"priced_collections_case_assign",method:"POST",path:"/v1/priced-collections-cases/{pricedCollectionsCaseId}/assign",idempotency:"required",principal:"api_key",summary:"Ask the licensed agency to accept this referral"},{name:"priced_collections_case.create",operationId:"priced_collections_case_create",method:"POST",path:"/v1/priced-collections-cases",idempotency:"required",principal:"api_key",summary:"Refer an overdue slice without creating another debt"},{name:"priced_collections_case.list",operationId:"priced_collections_case_list",method:"GET",path:"/v1/priced-collections-cases",idempotency:"not_required",principal:"api_key",summary:"List priced collections cases"},{name:"priced_collections_case.recall",operationId:"priced_collections_case_recall",method:"POST",path:"/v1/priced-collections-cases/{pricedCollectionsCaseId}/recall",idempotency:"required",principal:"api_key",summary:"Recall the referral without moving money"},{name:"priced_collections_case.recover",operationId:"priced_collections_case_recover",method:"POST",path:"/v1/priced-collections-cases/{pricedCollectionsCaseId}/recover",idempotency:"required",principal:"api_key",summary:"Recover instrument"},{name:"priced_collections_case.retrieve",operationId:"priced_collections_case_retrieve",method:"GET",path:"/v1/priced-collections-cases/{pricedCollectionsCaseId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a priced collections case"},{name:"priced_collections_case.return_uncollected",operationId:"priced_collections_case_return_uncollected",method:"POST",path:"/v1/priced-collections-cases/{pricedCollectionsCaseId}/return-uncollected",idempotency:"required",principal:"api_key",summary:"Record an unsuccessful referral without forgiving the debt"},{name:"priced_contact_attempt.create",operationId:"priced_contact_attempt_create",method:"POST",path:"/v1/priced-contact-attempts",idempotency:"required",principal:"api_key",summary:"Bind contact evidence to the assigned case and its exact debt"},{name:"priced_contact_attempt.list",operationId:"priced_contact_attempt_list",method:"GET",path:"/v1/priced-contact-attempts",idempotency:"not_required",principal:"api_key",summary:"List priced contact attempts"},{name:"priced_contact_attempt.retrieve",operationId:"priced_contact_attempt_retrieve",method:"GET",path:"/v1/priced-contact-attempts/{pricedContactAttemptId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a priced contact attempt"},{name:"priced_contact_attempt.void",operationId:"priced_contact_attempt_void",method:"POST",path:"/v1/priced-contact-attempts/{pricedContactAttemptId}/void",idempotency:"required",principal:"api_key",summary:"Void mistaken contact evidence without deleting it"},{name:"priced_installment.complete",operationId:"priced_installment_complete",method:"POST",path:"/v1/priced-installments/{pricedInstallmentId}/complete",idempotency:"required",principal:"api_key",summary:"Close the slice only after its principal and profit have paid exactly"},{name:"priced_installment.create",operationId:"priced_installment_create",method:"POST",path:"/v1/priced-installments",idempotency:"required",principal:"api_key",summary:"Schedule a slice before disbursement freezes the schedule"},{name:"priced_installment.list",operationId:"priced_installment_list",method:"GET",path:"/v1/priced-installments",idempotency:"not_required",principal:"api_key",summary:"List priced installments"},{name:"priced_installment.retrieve",operationId:"priced_installment_retrieve",method:"GET",path:"/v1/priced-installments/{pricedInstallmentId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a priced installment"},{name:"priced_installment_payment.create",operationId:"priced_installment_payment_create",method:"POST",path:"/v1/priced-installment-payments",idempotency:"required",principal:"api_key",summary:"Bind a payment to one live slice and its obligation"},{name:"priced_installment_payment.list",operationId:"priced_installment_payment_list",method:"GET",path:"/v1/priced-installment-payments",idempotency:"not_required",principal:"api_key",summary:"List priced installment payments"},{name:"priced_installment_payment.repay",operationId:"priced_installment_payment_repay",method:"POST",path:"/v1/priced-installment-payments/{pricedInstallmentPaymentId}/repay",idempotency:"required",principal:"api_key",summary:"Allocate the identified payment to outstanding debt in the authored order"},{name:"priced_installment_payment.retrieve",operationId:"priced_installment_payment_retrieve",method:"GET",path:"/v1/priced-installment-payments/{pricedInstallmentPaymentId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a priced installment payment"},{name:"priced_obligation.complete",operationId:"priced_obligation_complete",method:"POST",path:"/v1/priced-obligations/{pricedObligationId}/complete",idempotency:"required",principal:"api_key",summary:"Close only after all dated slices have paid exactly"},{name:"priced_obligation.create",operationId:"priced_obligation_create",method:"POST",path:"/v1/priced-obligations",idempotency:"required",principal:"api_key",summary:"Bind the signed terms and approved limits"},{name:"priced_obligation.disburse",operationId:"priced_obligation_disburse",method:"POST",path:"/v1/priced-obligations/{pricedObligationId}/disburse",idempotency:"required",principal:"api_key",summary:"Disburse the exact principal once after all slices exist"},{name:"priced_obligation.list",operationId:"priced_obligation_list",method:"GET",path:"/v1/priced-obligations",idempotency:"not_required",principal:"api_key",summary:"List priced obligations"},{name:"priced_obligation.payoff",operationId:"priced_obligation_payoff",method:"POST",path:"/v1/priced-obligations/{pricedObligationId}/payoff",idempotency:"required",principal:"api_key",summary:"Payoff instrument"},{name:"priced_obligation.record_authority",operationId:"priced_obligation_record_authority",method:"POST",path:"/v1/priced-obligations/{pricedObligationId}/record-authority",idempotency:"required",principal:"api_key",summary:"Record Authority instrument"},{name:"priced_obligation.record_write_off_authority",operationId:"priced_obligation_record_write_off_authority",method:"POST",path:"/v1/priced-obligations/{pricedObligationId}/record-write-off-authority",idempotency:"required",principal:"api_key",summary:"Record Write Off Authority instrument"},{name:"priced_obligation.retrieve",operationId:"priced_obligation_retrieve",method:"GET",path:"/v1/priced-obligations/{pricedObligationId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a priced obligation"},{name:"priced_obligation.write_off",operationId:"priced_obligation_write_off",method:"POST",path:"/v1/priced-obligations/{pricedObligationId}/write-off",idempotency:"required",principal:"api_key",summary:"Stop future collections without moving or refunding cash"},{name:"priced_portfolio_limit.approve",operationId:"priced_portfolio_limit_approve",method:"POST",path:"/v1/priced-portfolio-limits/{pricedPortfolioLimitId}/approve",idempotency:"required",principal:"api_key",summary:"Approve the limit"},{name:"priced_portfolio_limit.close",operationId:"priced_portfolio_limit_close",method:"POST",path:"/v1/priced-portfolio-limits/{pricedPortfolioLimitId}/close",idempotency:"required",principal:"api_key",summary:"Close the limit without moving money"},{name:"priced_portfolio_limit.create",operationId:"priced_portfolio_limit_create",method:"POST",path:"/v1/priced-portfolio-limits",idempotency:"required",principal:"api_key",summary:"Propose a bound limit"},{name:"priced_portfolio_limit.list",operationId:"priced_portfolio_limit_list",method:"GET",path:"/v1/priced-portfolio-limits",idempotency:"not_required",principal:"api_key",summary:"List priced portfolio limits"},{name:"priced_portfolio_limit.retrieve",operationId:"priced_portfolio_limit_retrieve",method:"GET",path:"/v1/priced-portfolio-limits/{pricedPortfolioLimitId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a priced portfolio limit"},{name:"product.activation.retrieve",operationId:"product_activation_retrieve",method:"GET",path:"/v1/products/{productId}/activation",idempotency:"not_required",principal:"api_key",summary:"Retrieve product activation readiness and cost"},{name:"product.balance_sheet.retrieve",operationId:"product_balance_sheet_retrieve",method:"GET",path:"/v1/products/{productId}/balance-sheet",idempotency:"not_required",principal:"api_key",summary:"Retrieve the product balance sheet"},{name:"product.build.kit.download",operationId:"product_build_kit_download",method:"POST",path:"/v1/products/{productId}/build/kit/downloads",idempotency:"required",principal:"user_session",summary:"Prepare a Hyperscale Kit download"},{name:"product.build.kit.retrieve",operationId:"product_build_kit_retrieve",method:"GET",path:"/v1/products/{productId}/build/kit",idempotency:"not_required",principal:"user_session",summary:"Retrieve the Hyperscale Kit manifest for a product build"},{name:"product.build.retrieve",operationId:"product_build_retrieve",method:"GET",path:"/v1/products/{productId}/build",idempotency:"not_required",principal:"user_session",summary:"Retrieve product setup details"},{name:"product.capability.retire",operationId:"product_capability_retire",method:"POST",path:"/v1/product-capabilities/{productCapabilityId}/retire",idempotency:"required",principal:"user_session",summary:"Retire a product capability"},{name:"product.capability.unretire",operationId:"product_capability_unretire",method:"POST",path:"/v1/product-capabilities/{productCapabilityId}/unretire",idempotency:"required",principal:"user_session",summary:"Unretire a product capability"},{name:"product.close",operationId:"product_close",method:"POST",path:"/v1/products/{productId}/close",idempotency:"required",principal:"user_session",summary:"Close a product"},{name:"product.desk.execute",operationId:"product_desk_execute",method:"POST",path:"/v1/products/{productId}/desk/execute",idempotency:"required",principal:"user_session",summary:"Execute an internal transfer or reservation from the product desk"},{name:"product.dials.configure",operationId:"product_dials_configure",method:"POST",path:"/v1/products/{productId}/dials",idempotency:"required",principal:"api_key",summary:"Configure a product dial"},{name:"product.dials.retrieve",operationId:"product_dials_retrieve",method:"GET",path:"/v1/products/{productId}/dials",idempotency:"not_required",principal:"api_key",summary:"Retrieve configured product dials"},{name:"product.disable",operationId:"product_disable",method:"POST",path:"/v1/products/{productId}/disable",idempotency:"required",principal:"user_session",summary:"Disable a product"},{name:"product.earn.rate.list",operationId:"product_earn_rate_list",method:"GET",path:"/v1/products/{productId}/earn-rates",idempotency:"not_required",principal:"api_key",summary:"List product earn rates"},{name:"product.earn.rate.set",operationId:"product_earn_rate_set",method:"POST",path:"/v1/products/{productId}/earn-rates",idempotency:"required",principal:"api_key",summary:"Configure a product earn rate"},{name:"product.earnings.settle",operationId:"product_earnings_settle",method:"POST",path:"/v1/products/{productId}/earnings/settlements",idempotency:"required",principal:"api_key",summary:"Settle product earnings"},{name:"product.guidance.retrieve",operationId:"product_guidance_retrieve",method:"GET",path:"/v1/products/{productId}/guidance",idempotency:"not_required",principal:"api_key",summary:"Retrieve deterministic product guidance"},{name:"product.instruments.compose",operationId:"product_instruments_compose",method:"POST",path:"/v1/products/instruments-compose",idempotency:"required",principal:"user_session",summary:"Create a Product from HSX source or business instruments"},{name:"product.list",operationId:"product_list",method:"GET",path:"/v1/products",idempotency:"not_required",principal:"api_key",summary:"List your Products"},{name:"product.margin.retrieve",operationId:"product_margin_retrieve",method:"GET",path:"/v1/products/{productId}/margin",idempotency:"not_required",principal:"api_key",summary:"Retrieve the product margin view"},{name:"product.operation_set.retrieve",operationId:"product_operation_set_retrieve",method:"GET",path:"/v1/products/{productId}/operation-set",idempotency:"not_required",principal:"api_key",summary:"Retrieve a product's frozen operation set"},{name:"product.primitives.create",operationId:"product_primitives_create",method:"POST",path:"/v1/products/primitives-create",idempotency:"required",principal:"user_session",summary:"Create a Product from horizontal primitives"},{name:"product.reactivate",operationId:"product_reactivate",method:"POST",path:"/v1/products/{productId}/reactivate",idempotency:"required",principal:"user_session",summary:"Reactivate a product"},{name:"product.recompose",operationId:"product_recompose",method:"POST",path:"/v1/products/recompose",idempotency:"required",principal:"user_session",summary:"Recompose a Product around a new instrument set"},{name:"product.retrieve",operationId:"product_retrieve",method:"GET",path:"/v1/products/{productId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Product"},{name:"product.treasury.provision",operationId:"product_treasury_provision",method:"POST",path:"/v1/products/{productId}/treasury/provision",idempotency:"required",principal:"api_key",summary:"Provision product treasury accounts"},{name:"product.treasury.retrieve",operationId:"product_treasury_retrieve",method:"GET",path:"/v1/products/{productId}/treasury",idempotency:"not_required",principal:"api_key",summary:"Retrieve product treasury balances"},{name:"product.update",operationId:"product_update",method:"PATCH",path:"/v1/products/{productId}",idempotency:"required",principal:"api_key",summary:"Rename a product"},{name:"product_capability.list",operationId:"product_capability_list",method:"GET",path:"/v1/product-capabilities",idempotency:"not_required",principal:"user_session",summary:"List Product capabilities"},{name:"product_capability.retrieve",operationId:"product_capability_retrieve",method:"GET",path:"/v1/product-capabilities/{productCapabilityId}",idempotency:"not_required",principal:"user_session",summary:"Retrieve a Product capability"},{name:"receipt.list",operationId:"receipt_list",method:"GET",path:"/v1/receipts",idempotency:"not_required",principal:"api_key",summary:"List Receipts"},{name:"receipt.retrieve",operationId:"receipt_retrieve",method:"GET",path:"/v1/receipts/{receiptId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Receipt"},{name:"reporting_artifact.list",operationId:"reporting_artifact_list",method:"GET",path:"/v1/reporting-artifacts",idempotency:"not_required",principal:"user_session",summary:"List Reporting artifacts"},{name:"reporting_artifact.retrieve",operationId:"reporting_artifact_retrieve",method:"GET",path:"/v1/reporting-artifacts/{reportingArtifactId}",idempotency:"not_required",principal:"user_session",summary:"Retrieve a Reporting artifact"},{name:"sale_settlement.abandon",operationId:"sale_settlement_abandon",method:"POST",path:"/v1/sale-settlements/{saleSettlementId}/abandon",idempotency:"required",principal:"api_key",summary:"Abandon an unfunded sale settlement"},{name:"sale_settlement.cancel",operationId:"sale_settlement_cancel",method:"POST",path:"/v1/sale-settlements/{saleSettlementId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel a sale settlement"},{name:"sale_settlement.collect_service_fee",operationId:"sale_settlement_collect_service_fee",method:"POST",path:"/v1/sale-settlements/{saleSettlementId}/collect-service-fee",idempotency:"required",principal:"api_key",summary:"Collect the sale settlement service fee"},{name:"sale_settlement.confirm_handover",operationId:"sale_settlement_confirm_handover",method:"POST",path:"/v1/sale-settlements/{saleSettlementId}/confirm-handover",idempotency:"required",principal:"api_key",summary:"Confirm handover of a sale settlement"},{name:"sale_settlement.create",operationId:"sale_settlement_create",method:"POST",path:"/v1/sale-settlements",idempotency:"required",principal:"api_key",summary:"Create a sale settlement"},{name:"sale_settlement.fund_piece",operationId:"sale_settlement_fund_piece",method:"POST",path:"/v1/sale-settlements/{saleSettlementId}/fund-piece",idempotency:"required",principal:"api_key",summary:"Fund a piece of a sale settlement"},{name:"sale_settlement.list",operationId:"sale_settlement_list",method:"GET",path:"/v1/sale-settlements",idempotency:"not_required",principal:"api_key",summary:"List sale settlements"},{name:"sale_settlement.refund_piece",operationId:"sale_settlement_refund_piece",method:"POST",path:"/v1/sale-settlements/{saleSettlementId}/refund-piece",idempotency:"required",principal:"api_key",summary:"Refund a piece of a sale settlement"},{name:"sale_settlement.release_piece",operationId:"sale_settlement_release_piece",method:"POST",path:"/v1/sale-settlements/{saleSettlementId}/release-piece",idempotency:"required",principal:"api_key",summary:"Release a piece of a sale settlement"},{name:"sale_settlement.retrieve",operationId:"sale_settlement_retrieve",method:"GET",path:"/v1/sale-settlements/{saleSettlementId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a sale settlement"},{name:"sale_settlement.unfund_piece",operationId:"sale_settlement_unfund_piece",method:"POST",path:"/v1/sale-settlements/{saleSettlementId}/unfund-piece",idempotency:"required",principal:"api_key",summary:"Unfund a piece of a sale settlement"},{name:"sandbox.account.fund",operationId:"sandbox_account_fund",method:"POST",path:"/v1/sandbox/account-funding",idempotency:"required",principal:"api_key",summary:"Fund a sandbox account"},{name:"sandbox.beneficiary.accept",operationId:"sandbox_beneficiary_accept",method:"POST",path:"/v1/sandbox/beneficiaries/{beneficiaryId}/accept",idempotency:"required",principal:"api_key",summary:"Accept and activate a sandbox beneficiary at the sponsor bank"},{name:"sandbox.clock.advance",operationId:"sandbox_clock_advance",method:"POST",path:"/v1/sandbox/clock/advance",idempotency:"required",principal:"api_key",summary:"Advance the sandbox Product clock"},{name:"sandbox.customer.onboard",operationId:"sandbox_customer_onboard",method:"POST",path:"/v1/sandbox/customer-onboarding",idempotency:"required",principal:"api_key",summary:"Create a sandbox customer with cleared KYC"},{name:"sandbox.customer_access.activate",operationId:"sandbox_customer_access_activate",method:"POST",path:"/v1/sandbox/customer-access/{customerAccessId}/activate",idempotency:"required",principal:"api_key",summary:"Activate sandbox customer access"},{name:"sandbox.platform.fire",operationId:"sandbox_platform_fire",method:"POST",path:"/v1/sandbox/platform/fire",idempotency:"required",principal:"api_key",summary:"Run a Product platform action in sandbox"},{name:"sandbox_bank_credit.request",operationId:"sandbox_bank_credit_request",method:"POST",path:"/v1/sandbox-bank-credits",idempotency:"required",principal:"api_key",summary:"Queue a sandbox bank credit"},{name:"savings_circle.close",operationId:"savings_circle_close",method:"POST",path:"/v1/savings-circles/{savingsCircleId}/close",idempotency:"required",principal:"api_key",summary:"Close a completed circle"},{name:"savings_circle.create",operationId:"savings_circle_create",method:"POST",path:"/v1/savings-circles",idempotency:"required",principal:"api_key",summary:"Form a savings circle"},{name:"savings_circle.disband",operationId:"savings_circle_disband",method:"POST",path:"/v1/savings-circles/{savingsCircleId}/disband",idempotency:"required",principal:"api_key",summary:"Disband a forming circle"},{name:"savings_circle.list",operationId:"savings_circle_list",method:"GET",path:"/v1/savings-circles",idempotency:"not_required",principal:"api_key",summary:"List savings circles"},{name:"savings_circle.retrieve",operationId:"savings_circle_retrieve",method:"GET",path:"/v1/savings-circles/{savingsCircleId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a savings circle"},{name:"share_allocation.cancel",operationId:"share_allocation_cancel",method:"POST",path:"/v1/share-allocations/{shareAllocationId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel a share allocation"},{name:"share_allocation.create",operationId:"share_allocation_create",method:"POST",path:"/v1/share-allocations",idempotency:"required",principal:"api_key",summary:"Subscribe to shares"},{name:"share_allocation.list",operationId:"share_allocation_list",method:"GET",path:"/v1/share-allocations",idempotency:"not_required",principal:"api_key",summary:"List share allocations"},{name:"share_allocation.retrieve",operationId:"share_allocation_retrieve",method:"GET",path:"/v1/share-allocations/{shareAllocationId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a share allocation"},{name:"share_allocation.settle",operationId:"share_allocation_settle",method:"POST",path:"/v1/share-allocations/{shareAllocationId}/settle",idempotency:"required",principal:"api_key",summary:"Settle a share allocation"},{name:"share_offering.close",operationId:"share_offering_close",method:"POST",path:"/v1/share-offerings/{shareOfferingId}/close",idempotency:"required",principal:"api_key",summary:"Close a share offering"},{name:"share_offering.create",operationId:"share_offering_create",method:"POST",path:"/v1/share-offerings",idempotency:"required",principal:"api_key",summary:"Draft a share offering"},{name:"share_offering.list",operationId:"share_offering_list",method:"GET",path:"/v1/share-offerings",idempotency:"not_required",principal:"api_key",summary:"List share offerings"},{name:"share_offering.publish",operationId:"share_offering_publish",method:"POST",path:"/v1/share-offerings/{shareOfferingId}/publish",idempotency:"required",principal:"api_key",summary:"Publish a share offering"},{name:"share_offering.retrieve",operationId:"share_offering_retrieve",method:"GET",path:"/v1/share-offerings/{shareOfferingId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a share offering"},{name:"subject.create",operationId:"subject_create",method:"POST",path:"/v1/subjects",idempotency:"required",principal:"api_key",summary:"Create a subject"},{name:"subject.list",operationId:"subject_list",method:"GET",path:"/v1/subjects",idempotency:"not_required",principal:"api_key",summary:"List Subjects"},{name:"subject.retrieve",operationId:"subject_retrieve",method:"GET",path:"/v1/subjects/{subjectId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Subject"},{name:"subject_kind.create",operationId:"subject_kind_create",method:"POST",path:"/v1/subject-kinds",idempotency:"required",principal:"user_session",summary:"Register a subject kind"},{name:"subject_kind.list",operationId:"subject_kind_list",method:"GET",path:"/v1/subject-kinds",idempotency:"not_required",principal:"api_key",summary:"List registered subject kinds"},{name:"support.booking.cancel",operationId:"support_booking_cancel",method:"POST",path:"/v1/support/bookings/{bookingId}/cancel",idempotency:"required",principal:"user_session",summary:"Cancel a support booking"},{name:"support.booking.request",operationId:"support_booking_request",method:"POST",path:"/v1/support/bookings",idempotency:"required",principal:"user_session",summary:"Book a video-call session with support"},{name:"support.ticket.close",operationId:"support_ticket_close",method:"POST",path:"/v1/support/tickets/{ticketId}/close",idempotency:"required",principal:"user_session",summary:"Close a support ticket"},{name:"support.ticket.message.post",operationId:"support_ticket_message_post",method:"POST",path:"/v1/support/tickets/{ticketId}/messages",idempotency:"required",principal:"user_session",summary:"Reply on a support ticket"},{name:"support.ticket.open",operationId:"support_ticket_open",method:"POST",path:"/v1/support/tickets",idempotency:"required",principal:"user_session",summary:"Open a support ticket"},{name:"support_booking.list",operationId:"support_booking_list",method:"GET",path:"/v1/support-bookings",idempotency:"not_required",principal:"user_session",summary:"List Support bookings"},{name:"support_booking.retrieve",operationId:"support_booking_retrieve",method:"GET",path:"/v1/support-bookings/{supportBookingId}",idempotency:"not_required",principal:"user_session",summary:"Retrieve a Support booking"},{name:"support_plan_selection.list",operationId:"support_plan_selection_list",method:"GET",path:"/v1/support-plan-selections",idempotency:"not_required",principal:"user_session",summary:"List Support plans"},{name:"support_plan_selection.retrieve",operationId:"support_plan_selection_retrieve",method:"GET",path:"/v1/support-plan-selections/{supportPlanSelectionId}",idempotency:"not_required",principal:"user_session",summary:"Retrieve a Support plan"},{name:"support_ticket.list",operationId:"support_ticket_list",method:"GET",path:"/v1/support-tickets",idempotency:"not_required",principal:"user_session",summary:"List Support tickets"},{name:"support_ticket.retrieve",operationId:"support_ticket_retrieve",method:"GET",path:"/v1/support-tickets/{supportTicketId}",idempotency:"not_required",principal:"user_session",summary:"Retrieve a Support ticket"},{name:"support_ticket_message.list",operationId:"support_ticket_message_list",method:"GET",path:"/v1/support-ticket-messages",idempotency:"not_required",principal:"user_session",summary:"List Support messages"},{name:"support_ticket_message.retrieve",operationId:"support_ticket_message_retrieve",method:"GET",path:"/v1/support-ticket-messages/{supportTicketMessageId}",idempotency:"not_required",principal:"user_session",summary:"Retrieve a Support message"},{name:"system.health",operationId:"system_health",method:"GET",path:"/v1/health",idempotency:"not_required",principal:"public",summary:"Check API health"},{name:"team.member.invite",operationId:"team_member_invite",method:"POST",path:"/v1/team/members/invite",idempotency:"required",principal:"user_session",summary:"Invite an email address to the caller's team"},{name:"team.member.invite.revoke",operationId:"team_member_invite_revoke",method:"POST",path:"/v1/team/members/invitations/{invitationId}/revoke",idempotency:"required",principal:"user_session",summary:"Revoke a pending team invitation"},{name:"team.member.list",operationId:"team_member_list",method:"GET",path:"/v1/team/members",idempotency:"not_required",principal:"user_session",summary:"List the caller's team members and pending invitations"},{name:"team.member.mfa.reset",operationId:"team_member_mfa_reset",method:"POST",path:"/v1/team/members/{userId}/mfa/reset",idempotency:"required",principal:"user_session",summary:"Reset another team member's lost MFA factor"},{name:"team.member.remove",operationId:"team_member_remove",method:"POST",path:"/v1/team/members/{userId}/remove",idempotency:"required",principal:"user_session",summary:"Remove a member from the caller's team"},{name:"team.member.role.update",operationId:"team_member_role_update",method:"POST",path:"/v1/team/members/{userId}/role",idempotency:"required",principal:"user_session",summary:"Change a team member's role"},{name:"team.role.create",operationId:"team_role_create",method:"POST",path:"/v1/team/roles",idempotency:"required",principal:"user_session",summary:"Create a custom team role"},{name:"team.role.delete",operationId:"team_role_delete",method:"POST",path:"/v1/team/roles/{roleId}/delete",idempotency:"required",principal:"user_session",summary:"Delete an unused custom role"},{name:"team.role.list",operationId:"team_role_list",method:"GET",path:"/v1/team/roles",idempotency:"not_required",principal:"user_session",summary:"List the caller's custom team roles"},{name:"team.role.update",operationId:"team_role_update",method:"POST",path:"/v1/team/roles/{roleId}",idempotency:"required",principal:"user_session",summary:"Rename a custom role or change its permissions"},{name:"tenant.activation_requirements.retrieve",operationId:"tenant_activation_requirements_retrieve",method:"GET",path:"/v1/tenants/{tenantId}/activation-requirements",idempotency:"not_required",principal:"user_session",summary:"Retrieve organization activation requirements"},{name:"tenant.bank_connection.configure",operationId:"tenant_bank_connection_configure",method:"POST",path:"/v1/tenants/{tenantId}/bank-connection",idempotency:"required",principal:"user_session",summary:"Configure the organization's bank connection"},{name:"tenant.bank_connection.test",operationId:"tenant_bank_connection_test",method:"POST",path:"/v1/tenants/{tenantId}/bank-connection/tests",idempotency:"required",principal:"user_session",summary:"Test the organization's bank connection"},{name:"tenant.bank_onboarding.submit",operationId:"tenant_bank_onboarding_submit",method:"POST",path:"/v1/tenants/{tenantId}/bank-onboarding-submissions",idempotency:"required",principal:"user_session",summary:"Submit verified organization details for bank onboarding"},{name:"tenant.list",operationId:"tenant_list",method:"GET",path:"/v1/tenants",idempotency:"not_required",principal:"user_session",summary:"List Companies"},{name:"tenant.retrieve",operationId:"tenant_retrieve",method:"GET",path:"/v1/tenants/{tenantId}",idempotency:"not_required",principal:"user_session",summary:"Retrieve a Company"},{name:"tenant.safeguarding.retrieve",operationId:"tenant_safeguarding_retrieve",method:"GET",path:"/v1/treasury/safeguarding",idempotency:"not_required",principal:"user_session",summary:"Retrieve safeguarding standing per master"},{name:"tenant.security.configure",operationId:"tenant_security_configure",method:"POST",path:"/v1/tenant/security",idempotency:"required",principal:"user_session",summary:"Configure the organization security policy"},{name:"tenant.settlement_iban.set",operationId:"tenant_settlement_iban_set",method:"POST",path:"/v1/treasury/settlement-iban",idempotency:"required",principal:"user_session",summary:"Set the organization settlement IBAN"},{name:"tenant.treasury.retrieve",operationId:"tenant_treasury_retrieve",method:"GET",path:"/v1/treasury",idempotency:"not_required",principal:"user_session",summary:"Retrieve the organization treasury"},{name:"tenant.treasury.statements.retrieve",operationId:"tenant_treasury_statements_retrieve",method:"GET",path:"/v1/treasury/statements",idempotency:"not_required",principal:"user_session",summary:"Retrieve the organization treasury statement window"},{name:"tenant.update",operationId:"tenant_update",method:"PATCH",path:"/v1/tenants/{tenantId}",idempotency:"required",principal:"user_session",summary:"Rename the organization"},{name:"tenant_bank_connection.list",operationId:"tenant_bank_connection_list",method:"GET",path:"/v1/tenant-bank-connections",idempotency:"not_required",principal:"user_session",summary:"List Bank connections"},{name:"tenant_bank_connection.retrieve",operationId:"tenant_bank_connection_retrieve",method:"GET",path:"/v1/tenant-bank-connections/{tenantBankConnectionId}",idempotency:"not_required",principal:"user_session",summary:"Retrieve a Bank connection"},{name:"trade_settlement.abandon",operationId:"trade_settlement_abandon",method:"POST",path:"/v1/trade-settlements/{tradeSettlementId}/abandon",idempotency:"required",principal:"api_key",summary:"Abandon the trade before its atomic funding batch"},{name:"trade_settlement.cancel",operationId:"trade_settlement_cancel",method:"POST",path:"/v1/trade-settlements/{tradeSettlementId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel and refund both funded trade sides atomically"},{name:"trade_settlement.create",operationId:"trade_settlement_create",method:"POST",path:"/v1/trade-settlements",idempotency:"required",principal:"api_key",summary:"Create a two-party trade settlement"},{name:"trade_settlement.dispute",operationId:"trade_settlement_dispute",method:"POST",path:"/v1/trade-settlements/{tradeSettlementId}/dispute",idempotency:"required",principal:"api_key",summary:"Claw back the whole released trade before maturity"},{name:"trade_settlement.fund",operationId:"trade_settlement_fund",method:"POST",path:"/v1/trade-settlements/{tradeSettlementId}/fund",idempotency:"required",principal:"api_key",summary:"Fund both trade sides and collect both custody fees atomically"},{name:"trade_settlement.list",operationId:"trade_settlement_list",method:"GET",path:"/v1/trade-settlements",idempotency:"not_required",principal:"api_key",summary:"List trade settlements"},{name:"trade_settlement.release",operationId:"trade_settlement_release",method:"POST",path:"/v1/trade-settlements/{tradeSettlementId}/release",idempotency:"required",principal:"api_key",summary:"Reserve both trade payouts for the clawback window"},{name:"trade_settlement.retrieve",operationId:"trade_settlement_retrieve",method:"GET",path:"/v1/trade-settlements/{tradeSettlementId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a trade settlement"},{name:"transfer_return.create",operationId:"transfer_return_create",method:"POST",path:"/v1/transfer-returns",idempotency:"required",principal:"api_key",summary:"Initiate a transfer return"},{name:"travel_package.cancel",operationId:"travel_package_cancel",method:"POST",path:"/v1/travel-packages/{travelPackageId}/cancel",idempotency:"required",principal:"api_key",summary:"Cancel a booked travel package"},{name:"travel_package.complete",operationId:"travel_package_complete",method:"POST",path:"/v1/travel-packages/{travelPackageId}/complete",idempotency:"required",principal:"api_key",summary:"Complete a delivered travel package"},{name:"travel_package.confirm",operationId:"travel_package_confirm",method:"POST",path:"/v1/travel-packages/{travelPackageId}/confirm",idempotency:"required",principal:"api_key",summary:"Confirm a travel package"},{name:"travel_package.create",operationId:"travel_package_create",method:"POST",path:"/v1/travel-packages",idempotency:"required",principal:"api_key",summary:"Draft a travel package"},{name:"travel_package.list",operationId:"travel_package_list",method:"GET",path:"/v1/travel-packages",idempotency:"not_required",principal:"api_key",summary:"List travel packages"},{name:"travel_package.retrieve",operationId:"travel_package_retrieve",method:"GET",path:"/v1/travel-packages/{travelPackageId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a travel package"},{name:"trust_evidence.attach",operationId:"trust_evidence_attach",method:"POST",path:"/v1/trust-reviews/{trustReviewId}/evidence",idempotency:"required",principal:"user_session",summary:"Attach trust evidence"},{name:"trust_evidence.list",operationId:"trust_evidence_list",method:"GET",path:"/v1/trust-review-evidence",idempotency:"not_required",principal:"api_key",summary:"List Trust Review evidence"},{name:"trust_evidence.retrieve",operationId:"trust_evidence_retrieve",method:"GET",path:"/v1/trust-review-evidence/{trustEvidenceId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve Trust Review evidence"},{name:"trust_requirement.list",operationId:"trust_requirement_list",method:"GET",path:"/v1/trust-requirements",idempotency:"not_required",principal:"api_key",summary:"List Trust Review requirements"},{name:"trust_requirement.respond",operationId:"trust_requirement_respond",method:"POST",path:"/v1/trust-requirements/{trustRequirementId}/respond",idempotency:"required",principal:"api_key",summary:"Respond to a trust requirement"},{name:"trust_requirement.retrieve",operationId:"trust_requirement_retrieve",method:"GET",path:"/v1/trust-requirements/{trustRequirementId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Trust Review requirement"},{name:"trust_review.create",operationId:"trust_review_create",method:"POST",path:"/v1/trust-reviews",idempotency:"required",principal:"user_session",summary:"Create a trust review"},{name:"trust_review.list",operationId:"trust_review_list",method:"GET",path:"/v1/trust-reviews",idempotency:"not_required",principal:"api_key",summary:"List Trust reviews"},{name:"trust_review.retrieve",operationId:"trust_review_retrieve",method:"GET",path:"/v1/trust-reviews/{trustReviewId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Trust review"},{name:"trust_review.submit",operationId:"trust_review_submit",method:"POST",path:"/v1/trust-reviews/{trustReviewId}/submit",idempotency:"required",principal:"user_session",summary:"Submit a trust review"},{name:"usage_record.list",operationId:"usage_record_list",method:"GET",path:"/v1/usage-records",idempotency:"not_required",principal:"api_key",summary:"List Usage records"},{name:"usage_record.retrieve",operationId:"usage_record_retrieve",method:"GET",path:"/v1/usage-records/{usageRecordId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a Usage record"},{name:"user.email.verification.confirm",operationId:"user_email_verification_confirm",method:"POST",path:"/v1/identity/email-verification/confirm",idempotency:"required",principal:"public",summary:"Confirm a Hyperscale email address from its verification link"},{name:"user.email.verification.request",operationId:"user_email_verification_request",method:"POST",path:"/v1/identity/email-verification/request",idempotency:"required",principal:"user_session",summary:"Mail a fresh email verification link to the current user"},{name:"user.login",operationId:"user_login",method:"POST",path:"/v1/identity/login",idempotency:"required",principal:"public",summary:"Log in a Hyperscale user"},{name:"user.login.mfa.verify",operationId:"user_login_mfa_verify",method:"POST",path:"/v1/identity/login/mfa/verify",idempotency:"required",principal:"public",summary:"Complete a Hyperscale MFA login challenge"},{name:"user.logout",operationId:"user_logout",method:"POST",path:"/v1/identity/logout",idempotency:"required",principal:"user_session",summary:"Log out the current Hyperscale user session"},{name:"user.mfa.recovery_codes.list",operationId:"user_mfa_recovery_codes_list",method:"GET",path:"/v1/identity/mfa/recovery-codes",idempotency:"not_required",principal:"user_session",summary:"Count your remaining MFA recovery codes"},{name:"user.mfa.recovery_codes.regenerate",operationId:"user_mfa_recovery_codes_regenerate",method:"POST",path:"/v1/identity/mfa/recovery-codes/regenerate",idempotency:"required",principal:"user_session",summary:"Replace your MFA recovery codes"},{name:"user.mfa.totp.disable",operationId:"user_mfa_totp_disable",method:"POST",path:"/v1/identity/mfa/totp/disable",idempotency:"required",principal:"user_session",summary:"Disable the current Hyperscale user's active TOTP factor"},{name:"user.mfa.totp.enrollment.begin",operationId:"user_mfa_totp_enrollment_begin",method:"POST",path:"/v1/identity/mfa/totp/enrollment/begin",idempotency:"required",principal:"user_session",summary:"Begin TOTP enrollment for the current Hyperscale user"},{name:"user.mfa.totp.enrollment.confirm",operationId:"user_mfa_totp_enrollment_confirm",method:"POST",path:"/v1/identity/mfa/totp/enrollment/confirm",idempotency:"required",principal:"user_session",summary:"Confirm TOTP enrollment with a first valid code"},{name:"user.password.reset.confirm",operationId:"user_password_reset_confirm",method:"POST",path:"/v1/identity/password-reset/confirm",idempotency:"required",principal:"public",summary:"Confirm a Hyperscale password reset"},{name:"user.password.reset.request",operationId:"user_password_reset_request",method:"POST",path:"/v1/identity/password-reset/request",idempotency:"required",principal:"public",summary:"Request a Hyperscale password reset email"},{name:"user.session.handoff.create",operationId:"user_session_handoff_create",method:"POST",path:"/v1/identity/sessions/handoff",idempotency:"required",principal:"user_session",summary:"Create a session handoff code for host transition"},{name:"user.session.handoff.exchange",operationId:"user_session_handoff_exchange",method:"POST",path:"/v1/identity/sessions/handoff/exchange",idempotency:"required",principal:"public",summary:"Exchange a session handoff code for a new session on target host"},{name:"user.session.list",operationId:"user_session_list",method:"GET",path:"/v1/identity/sessions",idempotency:"not_required",principal:"user_session",summary:"List active Hyperscale user sessions"},{name:"user.session.revoke",operationId:"user_session_revoke",method:"POST",path:"/v1/identity/sessions/{sessionId}/revoke",idempotency:"required",principal:"user_session",summary:"Revoke a Hyperscale user session by id"},{name:"user.signup",operationId:"user_signup",method:"POST",path:"/v1/identity/signup",idempotency:"required",principal:"public",summary:"Sign up a Hyperscale user and create their team"},{name:"vehicle_escrow.collect_penalty",operationId:"vehicle_escrow_collect_penalty",method:"POST",path:"/v1/vehicle-escrows/{vehicleEscrowId}/collect-penalty",idempotency:"required",principal:"api_key",summary:"Collect a vehicle cancellation penalty"},{name:"vehicle_escrow.confirm_cancel",operationId:"vehicle_escrow_confirm_cancel",method:"POST",path:"/v1/vehicle-escrows/{vehicleEscrowId}/confirm-cancel",idempotency:"required",principal:"api_key",summary:"Confirm a vehicle escrow cancellation"},{name:"vehicle_escrow.create",operationId:"vehicle_escrow_create",method:"POST",path:"/v1/vehicle-escrows",idempotency:"required",principal:"api_key",summary:"Create a vehicle escrow"},{name:"vehicle_escrow.fund",operationId:"vehicle_escrow_fund",method:"POST",path:"/v1/vehicle-escrows/{vehicleEscrowId}/fund",idempotency:"required",principal:"api_key",summary:"Fund a vehicle escrow"},{name:"vehicle_escrow.list",operationId:"vehicle_escrow_list",method:"GET",path:"/v1/vehicle-escrows",idempotency:"not_required",principal:"api_key",summary:"List vehicle escrows"},{name:"vehicle_escrow.quote_cancel",operationId:"vehicle_escrow_quote_cancel",method:"POST",path:"/v1/vehicle-escrows/{vehicleEscrowId}/quote-cancel",idempotency:"required",principal:"api_key",summary:"Quote a vehicle escrow cancellation"},{name:"vehicle_escrow.release",operationId:"vehicle_escrow_release",method:"POST",path:"/v1/vehicle-escrows/{vehicleEscrowId}/release",idempotency:"required",principal:"api_key",summary:"Release a vehicle escrow"},{name:"vehicle_escrow.retrieve",operationId:"vehicle_escrow_retrieve",method:"GET",path:"/v1/vehicle-escrows/{vehicleEscrowId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a vehicle escrow"},{name:"vehicle_escrow.update",operationId:"vehicle_escrow_update",method:"PATCH",path:"/v1/vehicle-escrows/{vehicleEscrowId}",idempotency:"required",principal:"api_key",summary:"Update a vehicle escrow"},{name:"vehicle_listing.complete",operationId:"vehicle_listing_complete",method:"POST",path:"/v1/vehicle-listings/{vehicleListingId}/complete",idempotency:"required",principal:"api_key",summary:"Complete a vehicle listing sale"},{name:"vehicle_listing.create",operationId:"vehicle_listing_create",method:"POST",path:"/v1/vehicle-listings",idempotency:"required",principal:"api_key",summary:"Create a vehicle listing"},{name:"vehicle_listing.delist",operationId:"vehicle_listing_delist",method:"POST",path:"/v1/vehicle-listings/{vehicleListingId}/delist",idempotency:"required",principal:"api_key",summary:"Delist a vehicle listing"},{name:"vehicle_listing.list",operationId:"vehicle_listing_list",method:"GET",path:"/v1/vehicle-listings",idempotency:"not_required",principal:"api_key",summary:"List vehicle listings"},{name:"vehicle_listing.reserve",operationId:"vehicle_listing_reserve",method:"POST",path:"/v1/vehicle-listings/{vehicleListingId}/reserve",idempotency:"required",principal:"api_key",summary:"Reserve a vehicle listing"},{name:"vehicle_listing.retrieve",operationId:"vehicle_listing_retrieve",method:"GET",path:"/v1/vehicle-listings/{vehicleListingId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a vehicle listing"},{name:"vehicle_listing.unreserve",operationId:"vehicle_listing_unreserve",method:"POST",path:"/v1/vehicle-listings/{vehicleListingId}/unreserve",idempotency:"required",principal:"api_key",summary:"Return a reserved vehicle listing to the market"},{name:"vehicle_listing.update",operationId:"vehicle_listing_update",method:"PATCH",path:"/v1/vehicle-listings/{vehicleListingId}",idempotency:"required",principal:"api_key",summary:"Update a vehicle listing"},{name:"wallet.activate",operationId:"wallet_activate",method:"POST",path:"/v1/wallets/{walletId}/activate",idempotency:"required",principal:"api_key",summary:"Activate a wallet"},{name:"wallet.close",operationId:"wallet_close",method:"POST",path:"/v1/wallets/{walletId}/close",idempotency:"required",principal:"api_key",summary:"Close a wallet"},{name:"wallet.create",operationId:"wallet_create",method:"POST",path:"/v1/wallets",idempotency:"required",principal:"api_key",summary:"Create a wallet"},{name:"wallet.freeze",operationId:"wallet_freeze",method:"POST",path:"/v1/wallets/{walletId}/freeze",idempotency:"required",principal:"api_key",summary:"Freeze a wallet"},{name:"wallet.list",operationId:"wallet_list",method:"GET",path:"/v1/wallets",idempotency:"not_required",principal:"api_key",summary:"List wallets"},{name:"wallet.retrieve",operationId:"wallet_retrieve",method:"GET",path:"/v1/wallets/{walletId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a wallet"},{name:"wallet.topup",operationId:"wallet_topup",method:"POST",path:"/v1/wallets/{walletId}/topup",idempotency:"required",principal:"api_key",summary:"Top up a wallet"},{name:"wallet.unfreeze",operationId:"wallet_unfreeze",method:"POST",path:"/v1/wallets/{walletId}/unfreeze",idempotency:"required",principal:"api_key",summary:"Unfreeze a wallet"},{name:"wallet.update",operationId:"wallet_update",method:"PATCH",path:"/v1/wallets/{walletId}",idempotency:"required",principal:"api_key",summary:"Update a wallet"},{name:"wallet.withdraw",operationId:"wallet_withdraw",method:"POST",path:"/v1/wallets/{walletId}/withdraw",idempotency:"required",principal:"api_key",summary:"Withdraw from a wallet"},{name:"wallet_spend.create",operationId:"wallet_spend_create",method:"POST",path:"/v1/wallet-spends",idempotency:"required",principal:"api_key",summary:"Create a wallet spend"},{name:"wallet_spend.list",operationId:"wallet_spend_list",method:"GET",path:"/v1/wallet-spends",idempotency:"not_required",principal:"api_key",summary:"List wallet spends"},{name:"wallet_spend.post",operationId:"wallet_spend_post",method:"POST",path:"/v1/wallet-spends/{walletSpendId}/post",idempotency:"required",principal:"api_key",summary:"Post a wallet spend"},{name:"wallet_spend.refund",operationId:"wallet_spend_refund",method:"POST",path:"/v1/wallet-spends/{walletSpendId}/refund",idempotency:"required",principal:"api_key",summary:"Refund a wallet spend"},{name:"wallet_spend.retrieve",operationId:"wallet_spend_retrieve",method:"GET",path:"/v1/wallet-spends/{walletSpendId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a wallet spend"},{name:"webhook.delivery.list",operationId:"webhook_delivery_list",method:"GET",path:"/v1/webhook-endpoints/{webhookEndpointId}/deliveries",idempotency:"not_required",principal:"api_key",summary:"List webhook deliveries"},{name:"webhook.delivery.resend",operationId:"webhook_delivery_resend",method:"POST",path:"/v1/webhook-endpoints/{webhookEndpointId}/deliveries/{webhookDeliveryId}/resend",idempotency:"required",principal:"api_key",summary:"Resend a webhook delivery"},{name:"webhook.endpoint.create",operationId:"webhook_endpoint_create",method:"POST",path:"/v1/webhook-endpoints",idempotency:"required",principal:"api_key",summary:"Create a webhook endpoint"},{name:"webhook.endpoint.delete",operationId:"webhook_endpoint_delete",method:"POST",path:"/v1/webhook-endpoints/{webhookEndpointId}/delete",idempotency:"required",principal:"api_key",summary:"Delete a webhook endpoint"},{name:"webhook.endpoint.disable",operationId:"webhook_endpoint_disable",method:"POST",path:"/v1/webhook-endpoints/{webhookEndpointId}/disable",idempotency:"required",principal:"api_key",summary:"Disable a webhook endpoint"},{name:"webhook.endpoint.enable",operationId:"webhook_endpoint_enable",method:"POST",path:"/v1/webhook-endpoints/{webhookEndpointId}/enable",idempotency:"required",principal:"api_key",summary:"Enable a webhook endpoint"},{name:"webhook.endpoint.list",operationId:"webhook_endpoint_list",method:"GET",path:"/v1/webhook-endpoints",idempotency:"not_required",principal:"api_key",summary:"List webhook endpoints"},{name:"webhook.endpoint.recover",operationId:"webhook_endpoint_recover",method:"POST",path:"/v1/webhook-endpoints/{webhookEndpointId}/recover",idempotency:"required",principal:"api_key",summary:"Recover webhook deliveries"},{name:"webhook.endpoint.retrieve",operationId:"webhook_endpoint_retrieve",method:"GET",path:"/v1/webhook-endpoints/{webhookEndpointId}",idempotency:"not_required",principal:"api_key",summary:"Retrieve a webhook endpoint"},{name:"webhook.endpoint.secret.rotate",operationId:"webhook_endpoint_secret_rotate",method:"POST",path:"/v1/webhook-endpoints/{webhookEndpointId}/secret/rotate",idempotency:"required",principal:"api_key",summary:"Rotate a webhook endpoint signing secret"},{name:"webhook.endpoint.update",operationId:"webhook_endpoint_update",method:"PATCH",path:"/v1/webhook-endpoints/{webhookEndpointId}",idempotency:"required",principal:"api_key",summary:"Update a webhook endpoint"}]};var S={wordmark:"HYPERSCALE",columns:80,accent:{truecolour:[45,75,242],ansi16:34},strong:1,dim:2,reset:0,foregroundReset:39,weightReset:22,rule:"-",policy:{requireTTY:!0,honourNoColor:!0,json:"plain",nonTTY:"plain"}};var j="\x1B",ze="\x07",$t=new RegExp(`[${j}](?:\\[[0-?]*[ -/]*[@-~]|\\][^${ze}${j}]*(?:${ze}|${j}\\\\)|[PX^_][^${j}]*${j}\\\\|.)|[^\\P{Cc}\\t\\n\\r]`,"gu");function Ke(e){return String(e??"").replace($t,"")}function w(e,t,r){let i=!!e?.isTTY&&t?.NO_COLOR===void 0&&!r?.json,n=(p,d)=>y=>{let u=Ke(y);return i?`${p}${u}${d}`:u},a=p=>`${j}[${p}m`,o=t&&"COLORTERM"in t?t.COLORTERM:void 0,s=o==="truecolor"||o==="24bit"?`38;2;${S.accent.truecolour.join(";")}`:S.accent.ansi16,c=n(a(S.dim),a(S.weightReset));return{accent:n(a(s),a(S.foregroundReset)),strong:n(a(S.strong),a(S.weightReset)),dim:c,rule:p=>{let d=Number.isFinite(p)?Math.min(S.columns,Math.max(0,Math.floor(p))):S.columns;return c(S.rule.repeat(d))},text:Ke}}var b={wordmark:"HYPERSCALE",tagline:"For the company you have in mind.",viewBox:"0 0 32 32",strokeWidth:.32,paths:["M16 3.5L28.5 9.75V22.25L16 28.5L3.5 22.25V9.75Z","M3.5 9.75L16 16L28.5 9.75","M16 16V28.5","M16 5L24 9V17L16 21L8 17V9Z","M8 9L16 13L24 9","M16 13V21","M16 7L20 9V13L16 15L12 13V9Z","M12 9L16 11L20 9","M16 11V15"],wordmarkWeight:200,wordmarkTracking:"0.055em",strokeOffsetPx:1,wordmarkGapRatio:.25,construction:{slope:"1/2",halfWidths:[12.5,8,4],centres:[[16,16],[16,13],[16,11]],visibleVertexConnections:0,projection:"Three solid isometric cubes, each drawn as its silhouette and front edges, nesting toward the top corner. The outer cube is centred on the master; the middle and inner cubes sit higher so each rests inside the one before. No connecting edges."},sizeRule:{minimumPx:24,cubeCount:3,detailReduction:!1,description:"Keep all three cubes at every size of 24px or above."}};var mi=[b.paths[0],b.paths[1],b.paths[2],b.paths[3],b.paths[4],b.paths[5],b.paths[6],b.paths[7],b.paths[8]],li=b.strokeOffsetPx+b.strokeWidth;var _e=b.wordmark,ui=`${_e}\u2122`;var Me=b.tagline;function Je(e){return[e.strong(_e),"",Me,"",e.accent("Run hyperscale auth login to sign in.")].join(`
3
+ `)}function Ye(e,t){let r=e.text(t.identity),i=[e.strong("Logged in"),"",` Identity: ${r}`];if(t.team){let n=e.text(t.team);i.push(` Team: ${n}`)}return i.join(`
4
+ `)}function fe(e,t){if(!t)return[`${e.strong("Usage:")} hyperscale auth login [--no-browser] [--token <pat>]`,"","Sign in through the portal callback or save a founder PAT.","",e.strong("Options:")," --no-browser Skip browser login. Saves the PAT or fails without one."," --token <pat> Founder PAT. Defaults to HYPERSCALE_TOKEN."," --json Print the saved session summary as one JSON document.","",e.strong("Notes:")," Without a PAT, the CLI opens portal sign-in and accepts one callback."," With --no-browser and no token, the command fails with a login error."," Pass HYPERSCALE_TOKEN or --token to save a PAT.","",e.strong("Example:")," hyperscale auth login --no-browser"].join(`
5
+ `);if("subcommands"in t)return[`${e.strong("Usage:")} hyperscale ${t.prefix} <subcommand> [options]`,"",`Available ${t.prefix} subcommands:`,...t.subcommands.map(([i,n])=>` ${i.padEnd(20)} ${n}`),"",`Run "hyperscale help ${t.prefix} <subcommand>" for detailed options and examples.`].join(`
6
+ `);let r=[`${e.strong("Usage:")} hyperscale ${t.usage}`,"",t.summary,"",e.strong("Options:"),...(t.options??[]).map(i=>` ${i}`)];return t.notes&&t.notes.length>0&&r.push("",e.strong("Notes:"),...t.notes.map(i=>` ${i}`)),t.example&&r.push("",e.strong("Example:"),` ${t.example}`),r.join(`
7
+ `)}function Fe(e,t){let r=[];if(t.title&&r.push(e.strong(e.text(t.title)),""),t.columns.length===0)return r.join(`
8
+ `);let i=t.columns.map(s=>e.text(s)),n=t.rows.map(s=>s.map(c=>e.text(c))),a=i.map((s,c)=>Math.max(s.length,...n.map(p=>(p[c]??"").length)));if(a.reduce((s,c)=>s+c,0)+2*(i.length-1)<=80){let s=i.map((c,p)=>p===i.length-1?c:c.padEnd(a[p])).join(" ");r.push(e.strong(s));for(let c of n){let p=i.map((d,y)=>{let u=c[y]??"";return y===i.length-1?u:u.padEnd(a[y])}).join(" ");r.push(p)}}else{let s=Math.max(...i.map(c=>c.length));for(let c=0;c<n.length;c++){let p=n[c];c>0&&r.push("");for(let d=0;d<i.length;d++){let y=i[d],u=p[d]??"";r.push(` ${y.padEnd(s)}: ${u}`)}}}return r.join(`
9
+ `)}function G(e,t){let r=[];if(t.title&&r.push(e.strong(e.text(t.title)),""),t.fields.length===0)return r.join(`
10
+ `);let i=t.fields.map(([a,o])=>[e.text(a),e.text(o)]),n=Math.max(...i.map(([a])=>a.length));for(let[a,o]of i){let s=` ${(a+":").padEnd(n+3)}`;if(o.includes(`
11
+ `)){let c=o.split(`
12
+ `);r.push(`${s}${c[0]}`);let p=" ".repeat(s.length);for(let d=1;d<c.length;d++)r.push(`${p}${c[d]}`)}else r.push(`${s}${o}`)}return r.join(`
13
+ `)}function We(e,t){let r=e.text(t.action),i=e.text(t.subject),n=typeof t.confirmation=="string"&&t.confirmation.trim()?e.text(t.confirmation):"Continue?";return[e.strong("Confirm mutation"),"",` Action: ${r}`,` Subject: ${i}`,"",` ${n} [y/N]`].join(`
14
+ `)}function Ve(e,t){let r=e.text(String(t.code)),i=e.text(t.message),n=e.accent(t.nextStep);return[e.strong(`Error [${r}]`),i,"",`Next step: ${n}`].join(`
15
+ `)}var it="https://hyperscale0.ai",nt="sandbox",Oe="hyperscale-cli-session",Jt="/v1/personal-access-tokens/current",we=process.platform==="darwin"?"/usr/bin/security":null,Yt="config.json",Ee="https://hyperscale0.ai/desk/security/tokens",at="https://hyperscale0.ai/request-access",Xe=`Mint a founder PAT in Hyperscale Portal at ${Ee}. Open Security, then Personal access tokens.`,Ft=`Not logged in. Run "hyperscale auth login" to open Hyperscale Portal sign-in. In a headless environment, mint a founder PAT in Hyperscale Portal at ${Ee}. Open Security, then Personal access tokens. Then set HYPERSCALE_TOKEN or pass --token. Unapproved founders can request access at ${at}.`,Wt=`Run "hyperscale auth login". For headless use, mint a founder PAT in Hyperscale Portal at ${Ee}. Open Security, then Personal access tokens. Unapproved founders can request access at ${at}.`,ot=3e4,Vt=2e3,Xt=120*1e3,K={resume:{usage:"resume <reference> [--json]",summary:"Replay a saved request after browser review or a lost response.",notes:["Uses the saved credential, body and idempotency key. No overrides.","Review does not mean execution succeeded. --yes cannot approve money."],example:"hyperscale resume <reference> --json"},"auth login":{usage:"auth login [--scopes <list>] [--no-browser] [--token <pat>]",summary:"Sign in through the portal callback or save a founder PAT.",options:["--scopes <list> Comma-separated scopes. Default: read-only consent.","--product <id> Select the Product route for member PAT calls.","--no-browser Skip browser login. Saves the PAT or fails without one.","--token <pat> Founder PAT. Defaults to HYPERSCALE_TOKEN.","--json Print the saved session summary as one JSON document."],notes:["Without a PAT, the CLI opens portal sign-in and accepts one","localhost callback.","With --no-browser and no token, the command fails with a login","error and fix text. Pass HYPERSCALE_TOKEN or --token to save a PAT.","Set HYPERSCALE_CREDENTIAL_STORE=file to use the 0600 profile file","instead of macOS Keychain."],example:"hyperscale auth login --no-browser"},"auth status":{usage:"auth status [--json]",summary:"Verify and show the active founder PAT and selected Product.",options:["--json Print machine-readable JSON."],example:"hyperscale auth status --json"},"auth logout":{usage:"auth logout [--revoke] [--json]",summary:"Forget the local founder PAT. Optionally revoke it first.",options:["--revoke Revoke the PAT before deleting local state.","--json Print machine-readable JSON."],example:"hyperscale auth logout --revoke"},"product create":{usage:"product create --source <file> --name <name> [--catalog-revision <id>] [--json]",summary:"Create and select a Product. The command refuses a duplicate name.",options:["--source <file> HSX source file for initial Product creation.","--name <name> Required Product name.","--catalog-revision <id> Tenant catalog revision for HSX composition.","--json Print the creation summary as JSON."],example:'hyperscale product create --source product.hsx --name "Custom Product"'},"product list":{usage:"product list [--json]",summary:"List Products in the signed-in company.",options:["--json Print the complete collection as JSON."],example:"hyperscale product list"},"product show":{usage:"product show [id] [--json]",summary:"Show a Product summary, or the complete Product document as JSON.",options:["--json Print the complete Product document."],example:"hyperscale product show prd_sandbox_..."},"product select":{usage:"product select <id> [--json]",summary:"Verify a Product and save it as the default for later commands.",options:["--token <pat> Founder PAT. Defaults to HYPERSCALE_TOKEN or the stored login.","--base-url <url> API origin. Defaults to the active founder profile.","--environment <name> sandbox or live. Defaults to the active founder profile.","--json Print the selected Product id as JSON."],notes:["The CLI stores the selection in the active founder profile.","When --product is absent, commands use the saved selection.","This includes product show, compose plan/apply, and key commands.","Product create selects the Product it creates."],example:"hyperscale product select prd_sandbox_..."},"product actions":{usage:"product actions [operation-id] [--product <id>] [--json]",summary:"List frozen public actions or show one action's full schemas.",options:["--product <id> Product to inspect. Defaults to the selected Product.","--api-key <key> Product API key. Defaults to HYPERSCALE_API_KEY.","--json Print machine-readable JSON."],notes:["Setup operation details include the public input schema used by hyperscale call.","When that schema has no required fields, omit --input or pass {}."],example:"hyperscale product actions escrow_order.placeBuyerHold --json"},"product run":{usage:"product run <operation-id> [--input <json> | --input-file <path>] [--idempotency-key <key>] [--json]",summary:"Run one frozen public action with a Product API key.",options:["--input <json> JSON input object. Stdin is used when piped.","--input-file <path> Read the JSON input object from a file.","--product <id> Product to call. Defaults to the selected Product.","--api-key <key> Product API key. Defaults to HYPERSCALE_API_KEY.","--idempotency-key <key> Send this exact Idempotency-Key header. The default is a generated UUID.","--json Print the key, receipt ids, and output as JSON."],notes:["Reuse an Idempotency-Key only with the same operation and input.",'If a bounded validation value appears as "[Truncated]", run "hyperscale product actions <operation-id>" for the full input schema.'],example:`hyperscale product run escrow_order.placeBuyerHold --input '{"escrowOrderId":"eord_sandbox_..."}' --idempotency-key hold-001`},"compose check":{usage:"compose check <file.hsx> [--catalog-revision <id>] [--json]",summary:"Ask the server to compile and check an HSX program.",options:["--catalog-revision <id> Compile against this immutable tenant catalog revision.","--json Print diagnostics and the verdict as JSON."],example:"hyperscale compose check product.hsx"},"compose plan":{usage:"compose plan <file.hsx> [--product <id>] [--catalog-revision <id>] [--json]",summary:"Diff an HSX program against a Product.",options:["--product <id> Product to compare. Defaults to the selected Product.","--catalog-revision <id> Compile against this immutable tenant catalog revision.","--json Print the plan as JSON."],example:"hyperscale compose plan product.hsx --json"},"compose apply":{usage:"compose apply <file.hsx> (--confirm [--pricing-identity <id> | --plan-file <path>] | --yes) [--product <id>] [--catalog-revision <id>] [--json]",summary:"Recompose the selected Product from checked HSX.",options:["--confirm Confirm the mutation for a person.","--yes Confirm the mutation without a prompt for an agent; accepts the candidate price current at apply time.","--pricing-identity <id> Candidate pricing identity from compose plan. Required with --confirm only when scheduled pricing exists.","--plan-file <path> Saved JSON plan file from compose plan --json. Used with --confirm to extract pricing identity when scheduled pricing exists.","--product <id> Product to recompose. Defaults to the selected Product.","--catalog-revision <id> Compile and persist against this immutable tenant catalog revision.","--json Print the result as JSON."],notes:["Apply --confirm requires a reviewed pricing identity or saved plan only when plan.pricing.scheduled exists; --yes selects the current candidate."],example:"hyperscale compose apply product.hsx --yes --pricing-identity <id>"},"key create":{usage:"key create [--name <name>] [--product <id>] [--json]",summary:"Create a sandbox Product API key.",options:["--name <name> Key name. Defaults to Founder CLI.","--product <id> Product for the key. Defaults to the selected Product.","--json Print the one-time secret and key metadata as JSON."],example:'hyperscale key create --name "Founder laptop"'},"key list":{usage:"key list [--product <id>] [--json]",summary:"List keys for one Product.",options:["--product <id> Product to inspect. Defaults to the selected Product.","--json Print the collection as JSON."],example:"hyperscale key list --json"},"key revoke":{usage:"key revoke <id> [--product <id>] [--json]",summary:"Revoke one Product API key.",options:["--product <id> Product that owns the key. Defaults to the selected Product.","--json Print the result as JSON."],example:"hyperscale key revoke key_sandbox_..."},"activity list":{usage:"activity list [--json]",summary:"List company activity with timestamps and resource targets.",options:["--json Print the complete collection as JSON."],example:"hyperscale activity list"},whoami:{usage:"whoami [--json]",summary:"Show the user and company the founder PAT resolves to.",options:["--json Print machine-readable JSON."],example:"hyperscale whoami --json"},"ops list":{usage:"ops list [filter] [--catalog] [--product <id>] [--json]",summary:"List Product operations. Use --catalog for the bundled catalog.",options:["filter Optional case-insensitive substring filter matching operation names and paths.","--catalog Browse bundled contract commands without a credential.","--product <id> Product to inspect. PATs use its Product route.","--api-key <key> Product API key. Defaults to HYPERSCALE_API_KEY.","--json Print matching operations as JSON."],notes:["The optional filter argument matches operation names and paths by case-insensitive substring."],example:"hyperscale ops list account"},call:{usage:"call <operation> [--input <json> | --input-file <path>] [--idempotency-key <key>] [--product <id>]",summary:"Call a catalog operation or a selected Product operation.",options:["--input <json> JSON input object. Stdin is used when piped.","--input-file <path> Read the JSON input object from a file.","--product <id> Product to call. PATs use its Product route.","--api-key <key> Product API key. Defaults to HYPERSCALE_API_KEY.","--idempotency-key <key> Send this exact Idempotency-Key header for a mutation. The default is a generated UUID."],notes:["Reuse an Idempotency-Key only with the same operation and input."],example:`hyperscale call account.create --input '{"currency":"SAR"}'`},help:{usage:"help [command]",summary:"Print help for hyperscale or a specific command.",options:[],notes:['Pass a command name to read its usage, options, and examples (e.g. "hyperscale help product create").'],example:"hyperscale help product create"}};function U(e,t){let r=Math.min(80,process.stdout.columns||80),i=t.columns.map((n,a)=>Math.max(n.length,...t.rows.map(o=>String(o[a]??"").length)));return i.reduce((n,a)=>n+a,0)+2*(i.length-1)<=r?Fe(e,t):[t.title?e.strong(t.title):null,...t.rows.map(n=>t.columns.map((a,o)=>`${e.strong(a)}: ${e.text(String(n[o]??""))}`).join(`
16
+ `))].filter(Boolean).join(`
17
+
18
+ `)}function Qt(e){return e.split(`
19
+ `).flatMap(t=>{if(g(t).length<=80)return[t];let r=t.match(/^\s*/)[0],i=[],n=r;for(let a of t.trimStart().match(/\S+\s*/g)??[])g(n+a.trimEnd()).length>80&&n.trim()&&(i.push(n.trimEnd()),n=r),n+=a;return n.trim()&&i.push(n.trimEnd()),i}).join(`
20
+ `)}function Zt(e,t,r){if(e["--json"]){let n=Object.entries(K).filter(([a])=>!t.length||a===t.join(" ")||a.startsWith(`${t.join(" ")} `));if(!n.length)throw new m(`No help for ${t.join(" ")}.`,{fix:'Run "hyperscale --help" to list commands.'});k({usage:"hyperscale <command> [options]",commands:Object.fromEntries(n)});return}let i=w(process.stdout,r,{json:!1});l(Qt(t.length?tr(t,i):er(i)))}function er(e){return[e.strong("Usage: hyperscale <command> [options]"),"","The developer command line.","",U(e,{title:"Commands:",columns:["Command","Purpose"],rows:Object.entries(K).map(([t,r])=>[t,r.summary])}),"","Start:"," hyperscale auth login --base-url https://dev.hyperscale0.ai"," hyperscale whoami --json","","HSX source:"," product create --source <file> Create and select a new Product"," compose apply <file.hsx> Recompose the selected Product from checked HSX","","Options:"," --base-url <origin> API origin, or HYPERSCALE_BASE_URL"," --environment <name> sandbox or live, or HYPERSCALE_ENVIRONMENT"," --token <pat> Member PAT, or HYPERSCALE_TOKEN"," --api-key <key> Product key, or HYPERSCALE_API_KEY"," --product <id> Selected Product for this command"," --json Success on stdout, failure on stderr"," --help, -h Command help"," --version, -v Package version","","Browser login requests read-only scopes. The server decides authority.","Product actions come from the selected Build. Use their exact names.","Approval waits for browser review. Resume replays the saved request.","--yes confirms compose only. It cannot approve money.","Exit codes: 0 success, 1 failure or waiting, 2 composer refusal.",'Run "hyperscale help <command>" for options and examples.',"Hyperscale is a trademark of Hyperscale LLC."].join(`
21
+ `)}function tr(e,t){let r=t??w(process.stdout,process.env,{json:!1}),i=Object.keys(K).sort((s,c)=>c.split(" ").length-s.split(" ").length),n=i.find(s=>s.split(" ").every((p,d)=>e[d]===p));if(n){let s=K[n];return fe(r,{usage:s.usage,summary:s.summary,options:s.options,notes:s.notes,example:s.example})}let a=e.join(" "),o=i.filter(s=>s.startsWith(`${a} `));if(o.length>0)return fe(r,{prefix:a,subcommands:o.map(s=>[s.slice(a.length+1),K[s].summary])});throw new m(`No help for ${e.join(" ")}. Run "hyperscale --help" to list commands.`,{fix:'Run "hyperscale --help" to list commands.'})}var m=class extends Error{constructor(t,r={}){super(t),typeof r.code=="string"&&(this.code=r.code),r.details!==void 0&&(this.details=r.details),Number.isInteger(r.exitCode)&&(this.exitCode=r.exitCode),typeof r.fix=="string"&&(this.fix=r.fix)}},$=class extends m{constructor(t,{requestId:r,status:i,code:n,details:a,operationId:o,receiptId:s,traceId:c,structuredError:p,fix:d}={}){super(t,{code:n,details:a,fix:d}),this.requestId=r,this.status=i,this.operationId=o??null,this.receiptId=s??null,this.traceId=c??null,this.structuredError=p}};function M(){return new m(Ft,{fix:Wt})}function rr(e){let t=e??"<id>";return new m(`This command needs a Product API key. Create one with "hyperscale key create --name 'Founder CLI' --product ${t}", then set HYPERSCALE_API_KEY or pass --api-key.`,{fix:`Run "hyperscale key create --name 'Founder CLI' --product ${t}", then set HYPERSCALE_API_KEY or pass --api-key.`})}var ae=class extends m{constructor(t,r){super(t),this.code="check_failed",this.details=r,this.exitCode=2}},ir=new Set(["--api-key","--base-url","--catalog-revision","--environment","--idempotency-key","--input","--input-file","--name","--plan-file","--pricing-identity","--product","--source","--scopes","--token"]);function nr(e){let t=[],r={};for(let i=0;i<e.length;i+=1){let n=e[i];if(n==="-h")n="--help";else if(n==="-v")n="--version";else if(n.startsWith("-")&&!n.startsWith("--"))throw new m(`Unknown option: ${n}`);if(!n.startsWith("--")){t.push(n);continue}if(ir.has(n)){let a=e[i+1];if(a===void 0)throw new m(`${n} needs a value`);r[n]=a,i+=1;continue}if(n==="--help"||n==="--version"||n==="--json"||n==="--confirm"||n==="--yes"||n==="--no-browser"||n==="--catalog"||n==="--revoke"){r[n]=!0;continue}throw new m(`Unknown option: ${n}`)}return{flags:r,positional:t}}function ar(e,t){let r=e["--api-key"]??t.HYPERSCALE_API_KEY;if(!r)throw rr();let i=e["--environment"]??t.HYPERSCALE_ENVIRONMENT??nt;if(i!=="sandbox"&&i!=="live")throw new m(`Unknown environment: ${i}. Use sandbox or live.`);let n=(e["--base-url"]??t.HYPERSCALE_BASE_URL??it).replace(/\/+$/,"");return{apiKey:r,baseUrl:n,environment:i,env:t}}function oe(e,t,r={}){let i=e["--environment"]??t.HYPERSCALE_ENVIRONMENT??r.environment??nt;if(i!=="sandbox"&&i!=="live")throw new m(`Unknown environment: ${i}. Use sandbox or live.`);let n=(e["--base-url"]??t.HYPERSCALE_BASE_URL??r.baseUrl??it).replace(/\/+$/,"");return Le(n),{baseUrl:n,environment:i,env:t}}function st(e){return e.HYPERSCALE_CONFIG_DIR??pe(Kt(),".config","hyperscale")}function ct(e){return pe(st(e),Yt)}function q(e,t){return pe(st(t),`session-${W(e)}.json`)}function F(e){let t=e.HYPERSCALE_CREDENTIAL_STORE??"auto";if(t==="auto"||t==="file")return t;throw new m(`Unknown HYPERSCALE_CREDENTIAL_STORE value: ${t}. Use auto or file.`)}async function Re(e,t){let r=q(e,t),i=`${Mt(r)}.`,n;try{n=await Ut(ke(r),{withFileTypes:!0})}catch(a){if(a&&a.code==="ENOENT")return;throw a}for(let a of n){if(!a.isFile()||!a.name.startsWith(i))continue;let o=a.name.slice(i.length);/^\d+\.[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.tmp$/.test(o)&&await N(pe(ke(r),a.name))}}async function or(e){try{return JSON.parse(await Y(e,"utf8"))}catch(t){if(t&&t.code==="ENOENT")return null;throw t instanceof SyntaxError?new m(`The CLI profile at ${e} is corrupt: not valid JSON.`,{code:"corrupt_profile",fix:`Back up or remove ${e} before logging in again with "hyperscale auth login" (or "hyperscale auth login --no-browser").`}):t}}async function J(e,t){let r=sr(e);await Ht(r,{mode:448,recursive:!0}),await ve(r,448);let i=`${e}.${process.pid}.${globalThis.crypto.randomUUID()}.tmp`;await zt(i,t,{flag:"wx",mode:384}),await ve(i,384);try{await Dt(i,e),await ve(e,384)}catch(n){throw await N(i),n}}function sr(e){return ke(e)}async function N(e){try{await Bt(e)}catch(t){if(!t||t.code!=="ENOENT")throw t}}function cr(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new m(`The CLI profile at ${t} is corrupt: not a profile object.`,{code:"corrupt_profile",fix:`Back up or remove ${t} before logging in again with "hyperscale auth login" (or "hyperscale auth login --no-browser").`});let{baseUrl:r,email:i,environment:n,selectedProduct:a}=e;if(typeof r!="string"||typeof i!="string"||n!=="sandbox"&&n!=="live"||!(a===null||typeof a=="string"))throw new m(`The CLI profile at ${t} is corrupt: invalid profile fields.`,{code:"corrupt_profile",fix:`Back up or remove ${t} before logging in again with "hyperscale auth login" (or "hyperscale auth login --no-browser").`});return{baseUrl:r,email:i,environment:n,selectedProduct:a}}async function de(e){let t=ct(e),r=await or(t);return r===null?null:cr(r,t)}async function xe(e,t){let r={email:t.email,baseUrl:t.baseUrl,environment:t.environment,selectedProduct:t.selectedProduct??null};await J(ct(e),`${JSON.stringify(r,null,2)}
22
+ `)}function W(e){return jt("sha256").update(`${e.baseUrl}\0${e.environment}\0${e.email}`).digest("hex")}async function me(e,t){return we===null?{error:null,status:null,stdout:"",unavailable:!0}:await new Promise(r=>{let i={...process.env};delete i.HYPERSCALE_API_KEY,delete i.HYPERSCALE_TOKEN;let n=rt(we,e,{env:i,stdio:["pipe","pipe","pipe"]}),a=[],o=!1,s=p=>{o||(o=!0,clearTimeout(c),r(p))},c=setTimeout(()=>{n.kill("SIGKILL"),s({error:null,status:null,stdout:"",unavailable:!0})},Vt);n.stdout.on("data",p=>a.push(p)),n.stderr.on("data",()=>{}),n.stdin.on("error",()=>{}),n.once("error",p=>s({error:p,status:null,stdout:"",unavailable:!0})),n.once("close",p=>s({error:null,status:p,stdout:Buffer.concat(a).toString("utf8"),unavailable:!1})),t===void 0?n.stdin.end():n.stdin.end(`${t}
23
+ `)})}async function Ce(){return(await me(["show-keychain-info"])).status===0}function pt(e){try{let t=typeof e=="string"?JSON.parse(e):e;if(t&&typeof t=="object"&&!Array.isArray(t)&&typeof t.token=="string"&&typeof t.tenantId=="string"&&(t.personalAccessTokenId===void 0||typeof t.personalAccessTokenId=="string")&&(t.tokenName===void 0||typeof t.tokenName=="string"))return{...x(t.savedRequest)?{savedRequest:t.savedRequest}:{},token:t.token,tenantId:t.tenantId,...t.personalAccessTokenId?{personalAccessTokenId:t.personalAccessTokenId}:{},...t.tokenName?{tokenName:t.tokenName}:{}}}catch{}return null}async function be(e,t,r){await Re(e,r);let i=W(e);if(F(r)==="auto"&&await Ce()){let n=JSON.stringify(t),a=["add-generic-password","-a",i,"-s",Oe,"-U","-X",Buffer.from(n,"utf8").toString("hex")].join(" ");if((await me(["-i"],a)).status===0)return await N(q(e,r)),"keychain"}return await J(q(e,r),`${JSON.stringify({account:i,activeStore:"file",credential:t})}
24
+ `),"file"}async function pr(e,t){let r=W(e);try{let i=JSON.parse(await Y(q(e,t),"utf8"));if(!i||typeof i!="object"||Array.isArray(i)||i.account!==r)return{state:"invalid"};if(i.revoked===!0)return{state:"revoked"};let n=pt(i.credential);return n?{activeStore:i.activeStore==="file"?"file":null,credential:n,state:"valid"}:{state:"invalid"}}catch(i){return i&&i.code==="ENOENT"?{state:"missing"}:{state:"invalid"}}}async function Ae(e,t){await Re(e,t);let r=F(t),i=await pr(e,t);if(i.state==="revoked")return null;if(i.state==="valid"&&(i.activeStore==="file"||r==="file"))return i.credential;if(r==="file")return null;let n=null;if(await Ce()){let a=await me(["find-generic-password","-a",W(e),"-s",Oe,"-w"]);a.status===0&&(n=pt(a.stdout.trim()))}return n||(i.state==="valid"?i.credential:null)}async function $e(e,t){await Re(e,t);let r=W(e);if(F(t)==="file")return await J(q(e,t),`${JSON.stringify({account:r,revoked:!0})}
25
+ `),{keychainDeleted:!0};if(we===null)return await N(q(e,t)),{keychainDeleted:!0};if(!await Ce())return await J(q(e,t),`${JSON.stringify({account:r,revoked:!0})}
26
+ `),{keychainDeleted:!1};let i=await me(["delete-generic-password","-a",r,"-s",Oe]);return i.status!==0&&i.status!==44?(await J(q(e,t),`${JSON.stringify({account:r,revoked:!0})}
27
+ `),{keychainDeleted:!1}):(await N(q(e,t)),{keychainDeleted:!0})}function dt(e,t){return e["--token"]!==void 0?e["--token"]:t.HYPERSCALE_TOKEN||void 0}async function T(e,t,r=!1){let i=await de(t),n=dt(e,t);if(n!==void 0){if(!n)throw M();let s=oe(e,t,i??{}),c=await H(s,n),p=i?.baseUrl===s.baseUrl&&i.environment===s.environment&&i.email===c.email;return{...s,email:c.email,identity:c,personalAccessTokenId:c.personalAccessTokenId,selectedProduct:p?i.selectedProduct:null,tenantId:c.tenantId,token:n,tokenName:c.name}}if(!i){if(r)return null;throw M()}let a=oe(e,t,i);if(a.baseUrl!==i.baseUrl||a.environment!==i.environment)throw new m(`The active founder login belongs to ${i.baseUrl} (${i.environment}). Log in again to change it.`);let o=await Ae(i,t);if(!o){if(r)return null;throw M()}return{...i,...o,env:t}}function g(e){return e.replace(new RegExp("\\p{Cc}","gu"),t=>`
28
+ \r`.includes(t)?t:"")}function mt(e){try{return new URL(e).origin}catch{return null}}function Le(e){let t;try{t=new URL(e)}catch{t=null}if(!t||t.origin!==e)throw new m(`Invalid API origin: ${e}. Use a scheme, host, and optional port with nothing after them, such as https://hyperscale0.ai.`);let r=["localhost","127.0.0.1","[::1]","::1"].includes(t.hostname);if(t.protocol!=="https:"&&!(t.protocol==="http:"&&r))throw new m(`Refusing cleartext API origin ${e}: no credential was sent. Use https://${t.host} instead, or keep http:// only for a loopback API such as http://127.0.0.1:8787.`);return t.origin}var dr=/(?<![A-Za-z0-9_-])(?:hyperscale|arc)_[A-Za-z0-9_-]{32,}(?![A-Za-z0-9_-])/g,mr=/(?<![A-Za-z0-9_-])whsec_[A-Za-z0-9+/=]{32,}(?![A-Za-z0-9+/=])/g;function _(e,t=[]){let r=e;for(let i of t)typeof i=="string"&&i.length>0&&(r=r.replaceAll(i,"[redacted]"));return r.replaceAll(dr,"[redacted]").replaceAll(mr,"[redacted]")}function lt(e,t=[]){if(!e?.ok||!e?.headers)return;let r=e.headers.get("x-request-id"),i=e.headers.get("hyperscale-operation-id"),n=e.headers.get("hyperscale-receipt-id"),a=r?_(r,t):null,o=i?_(i,t):null,s=n?_(n,t):null;a&&process.stderr.write(`Request id: ${a}
29
+ `),o&&process.stderr.write(`Operation: ${o}
30
+ `),s&&process.stderr.write(`Receipt: ${s}
31
+ `)}function ut(e){if(!/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(e??""))throw new m("Use the local reference printed with the waiting request.");return{baseUrl:"local-resume",environment:"sandbox",email:e.toLowerCase()}}async function Qe(e,t){let r={...e.config,apiKey:t};return e.transport==="control"?ur(r,e.path,e.init,t):hr(r,e.path,e.init)}async function je(e,t,r,i,n,a,o){let s=new Headers(r.headers);if(!n||!s.get("idempotency-key"))return Qe({config:e,path:t,init:r,transport:i},n);r={...r,headers:Object.fromEntries(s)};let c=(o??globalThis.crypto.randomUUID()).toLowerCase(),p=ut(c),d={config:{baseUrl:e.baseUrl,environment:e.environment,productId:e.productId,operationId:e.operationId},path:t,init:r,transport:i};await be(p,{token:n,tenantId:"",savedRequest:d},a);let y;try{y=await Qe(d,n)}catch(h){if(h instanceof m){let I=h.details?.operationId??e.operationId;I&&(d.config.operationId=I,await be(p,{token:n,tenantId:"",savedRequest:d},a),h.operationId=I,h.message+=`
32
+ Outcome unknown. Operation: ${I}`),h.details={...h.details,...I?{operationId:I}:{},resumeReference:c},h.fix=`${h.fix??"Read back the operation before retrying."} Saved request: hyperscale resume ${c}`}throw h}let u=y.response.ok?null:D(y.response,y.text,[n]);if(u?.status===409&&u.code==="approval_required"){let h=x(u.details)?u.details:{},I=typeof h.state=="string"?h.state:"unknown",f=typeof h.approvalRequestId=="string"?h.approvalRequestId:null,v=typeof h.reviewUrl=="string"?h.reviewUrl:null;throw u.details={...h,state:I,approvalRequestId:f,reviewUrl:v,resumeReference:c},u.message=`Waiting for review. State: ${I}
33
+ Approval request: ${f??"not returned"}
34
+ Review: ${v??"not returned; ask the requester to open the approval desk"}${u.requestId?`
35
+ Request id: ${u.requestId}`:""}`,u.fix=`Review in your browser, then run "hyperscale resume ${c}". --yes cannot approve money.`,u.structuredError={code:u.code,message:u.message,details:u.details,fix:u.fix},u}return F(a)==="file"?await N(q(p,a)):await $e(p,a),y}async function le(e,t,r={}){return je(e,t,r,"product",e.apiKey,e.env)}async function Ge(e,t,r={},i){return je(e,t,r,"control",i,e.env)}async function lr(e,t,r){for(let p of Object.keys(e))if(p!=="--json"&&p!=="--yes")throw new m(`Resume cannot change ${p}. It replays the saved credential, body and idempotency key.`,{code:"resume_binding_mismatch"});let i=ut(r),n=await Ae(i,t),a=n?.savedRequest;if(!a||!x(a.config)||typeof a.path!="string"||!x(a.init)||!new Headers(a.init.headers).get("idempotency-key")||!["control","product"].includes(a.transport))throw new m("No saved request for that reference on this machine.");let{response:o,text:s}=await je(a.config,a.path,a.init,a.transport,n.token,t,r);if(!o.ok)throw D(o,s,[n.token]);let c=V(o.headers,void 0,[n.token]);e["--json"]?k({status:o.status,data:_t(s),...c}):(c.operationId&&l(`Operation: ${c.operationId}`),c.receiptId&&l(`Receipt: ${c.receiptId}`),l(Ue(s)))}async function ur(e,t,r={},i){let n=`${e.baseUrl}${t}`,a=Le(e.baseUrl);if(mt(n)!==a)throw new m(`The requested path ${t} leaves the ${a} origin; refusing the request.`);let o=[i].filter(Boolean),s={};try{let c=await fetch(n,{...r,headers:{accept:"application/json",...i?{authorization:`Bearer ${i}`}:{},"x-hyperscale-environment":e.environment,...r.headers},signal:AbortSignal.timeout(ot),redirect:"manual"});if(c.status>=300&&c.status<400){let p=g(_(n,o));throw new m(`${p} redirected, so no credential was sent on. Point --base-url at the origin the API answers on.`,{code:"unexpected_redirect",fix:"Point --base-url at the origin the API answers on."})}return s=V(c.headers,void 0,o),lt(c,o),{response:c,text:g(await c.text())}}catch(c){if(c instanceof m)throw c;let p=g(_(n,o)),d=new Headers(r.headers).get("idempotency-key"),y=d?g(_(d,o)):void 0,u=g(_(c?.message??"network failure",o)),h=y?`Retry the request with the same idempotency key: ${y}.`:`Check that --base-url names the Hyperscale API origin and connectivity to ${p}.`;throw new m(`Could not reach ${p}: ${u}`,{code:"transport_error",details:{...y?{idempotencyKey:y}:{},...s,path:t,url:p},fix:`${s.operationId?`Outcome unknown. Operation: ${s.operationId}. Read its status before retrying. `:""}${h}`})}}async function E(e,t,r={},i,n=[]){let{response:a,text:o}=await Ge(e,t,r,i);if(!a.ok)throw D(a,o,n);try{return JSON.parse(o)}catch{throw new m(`HTTP ${a.status} returned invalid JSON`)}}function C(e,t=globalThis.crypto.randomUUID()){return{body:JSON.stringify(e),headers:{"content-type":"application/json","idempotency-key":t},method:"POST"}}async function yr(){let e=[];for await(let t of process.stdin)e.push(Buffer.from(t));return Buffer.concat(e).toString("utf8")}async function hr(e,t,r={}){let i=`${e.baseUrl}${t}`,n=Le(e.baseUrl);if(mt(i)!==n)throw new m(`The product document puts ${t} on another origin than the ${n} you configured; refusing to send the key there.`);let a=[e.apiKey].filter(Boolean),o={};try{let s=await fetch(i,{...r,headers:{accept:"application/json",authorization:`Bearer ${e.apiKey}`,"x-hyperscale-environment":e.environment,...r.headers},signal:AbortSignal.timeout(ot),redirect:"manual"});if(s.status>=300&&s.status<400){let c=g(_(i,a));throw new m(`${c} redirected, so the key was not sent on. Point --base-url at the origin the API answers on; the usual cause is http:// where it serves https://.`,{code:"unexpected_redirect",fix:"Point --base-url at the origin the API answers on; the usual cause is http:// where it serves https://."})}return o=V(s.headers,void 0,a),lt(s,a),{response:s,text:g(await s.text())}}catch(s){if(s instanceof m)throw s;let c=g(_(i,a)),p=new Headers(r.headers).get("idempotency-key"),d=p?g(_(p,a)):void 0,y=g(_(s?.message??"network failure",a)),u=d?`Retry the request with the same idempotency key: ${d}.`:`Check that --base-url names the Hyperscale API origin and connectivity to ${c}.`;throw new m(`Could not reach ${c}: ${y}`,{code:"transport_error",details:{...d?{idempotencyKey:d}:{},...o,path:t,url:c},fix:`${o.operationId?`Outcome unknown. Operation: ${o.operationId}. Read its status before retrying. `:""}${u}`})}}async function yt(e){let{response:t,text:r}=await le(e,"/v1/product.json");if(!t.ok)throw D(t,r,[e.apiKey]);let i=_r(r);if(!i)throw new m("The product document is not in the expected format.",{fix:'Run the latest unpinned CLI (e.g. "bunx @hyperscale0/cli@latest <command>"), or report the issue without including credentials.'});if(e.productId&&i.productId===void 0)throw new m(`The server's product document names no Product, so "--product ${e.productId}" cannot be checked against the API key. The platform predates Product identity in the descriptor: redeploy it, or drop --product.`);if(e.productId&&i.productId&&e.productId!==i.productId)throw new m(`Selected Product ${e.productId} does not match API key Product ${i.productId}. Run "hyperscale product select ${i.productId}" or pass "--product ${i.productId}". Or set HYPERSCALE_API_KEY to a key for ${e.productId}, or pass that key with --api-key.`);let n=i.operations.map(a=>{if(typeof a.summary!="string"||typeof a.description!="string")throw new m(`The product document carries no prose for ${a.operationId}. The server descriptor predates operation prose. Redeploy the platform, then recompose the Product.`);return{description:a.description,idempotency:a.idempotency,method:a.method,name:a.name,operationId:a.operationId,path:a.path,summary:a.summary}});return{compositionId:i.composition.id,operations:n,packageName:i.sdk?i.sdk.packageName.trim():null,title:i.title.trim()}}function _r(e){let t;try{t=JSON.parse(e)}catch{return null}let r=Te(t),i=n=>typeof n=="string";if(!x(r)||r.schemaVersion!==1||!(r.productId===void 0||i(r.productId))||!i(r.title)||!x(r.composition)||!i(r.composition.id)||!Array.isArray(r.operations))return null;for(let n of r.operations)if(!x(n)||!i(n.method)||!i(n.path)||!i(n.name)||!i(n.operationId)||!i(n.idempotency))return null;return r.sdk!==void 0&&(!x(r.sdk)||!i(r.sdk.packageName))?null:r}function x(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Te(e){return typeof e=="string"?g(e):Array.isArray(e)?e.map(Te):x(e)?Object.fromEntries(Object.entries(e).map(([t,r])=>[g(t),Te(r)])):e}function ht(e){let t=e.get("x-trace-id");if(t&&t.trim()!=="")return t.trim();let r=e.get("traceparent");if(r){let i=/^00-([0-9a-fA-F]{32})-[0-9a-fA-F]{16}-[0-9a-fA-F]{2}$/.exec(r.trim());if(i)return i[1]}return null}function _t(e){if(!e||e.trim()==="")return null;try{return JSON.parse(e)}catch{return e}}function V(e,t,r=[]){let i=e?.get?.("x-request-id")??t??null,n=e?.get?.("hyperscale-operation-id")??null,a=e?.get?.("hyperscale-receipt-id")??null,o=e?ht(e):null;return{requestId:i?g(_(i,r)):null,operationId:n?g(_(n,r)):null,receiptId:a?g(_(a,r)):null,traceId:o?g(_(o,r)):null}}function se(e,t=[]){if(typeof e=="string")return g(_(e,t));if(Array.isArray(e))return e.map(r=>se(r,t));if(e&&typeof e=="object"){let r=[];for(let[i,n]of Object.entries(e)){let a=g(_(i,t));r.push([a,se(n,t)])}return Object.fromEntries(r)}return e}function ft(e,t=[],r){let i;try{i=JSON.parse(e)}catch{i=null}let n=i&&typeof i=="object"&&i.error&&typeof i.error=="object"?i.error:null;if(n){let s=typeof n.code=="string"?n.code:void 0,c=typeof n.fix=="string"?n.fix:void 0,p=c?g(_(c,t)):void 0,d=typeof n.message=="string"?n.message:r?`HTTP ${r}`:"HTTP error",y=g(_(d,t)),u=y.length>1024?y.slice(0,1024):y,h=s&&typeof n.message=="string"?`${s}: ${u}`:u,I=n.details!==void 0?se(n.details,t):void 0,f=i&&typeof i=="object"&&typeof i.requestId=="string"?g(_(i.requestId,t)):void 0;return{code:s,details:I,fix:p,humanMessage:h,redactedMessage:u,requestId:f,structuredError:{code:s??"http_error",message:u,...I!==void 0?{details:I}:{},...p!==void 0?{fix:p}:{}}}}let a=r?`HTTP ${r}`:"HTTP error",o="Check that --base-url names the Hyperscale API origin, or report the issue without including credentials.";return{code:"http_error",details:void 0,fix:o,humanMessage:a,redactedMessage:a,requestId:void 0,structuredError:{code:"http_error",message:a,fix:o}}}function D(e,t,r=[]){let i=ft(t,r,e.status),n=V(e.headers,i.requestId,r),a=i.humanMessage;return new $(`HTTP ${e.status}${a?` \xB7 ${a}`:""}${n.requestId?`
36
+ Request id: ${n.requestId}`:""}`,{code:i.code,details:i.details,fix:i.fix,operationId:n.operationId,receiptId:n.receiptId,requestId:n.requestId,status:e.status,structuredError:i.structuredError,traceId:n.traceId})}function Ne(e,t){return{authenticated:!0,baseUrl:e.baseUrl,email:t.email,environment:e.environment,expiresAt:t.expiresAt,personalAccessTokenId:t.personalAccessTokenId,role:t.role,scopes:t.scopes,selectedProduct:e.selectedProduct,teamId:t.teamId,tenantId:t.tenantId,tokenName:t.name,userId:t.userId}}function fr(e){if(!e||typeof e!="object"||typeof e.userId!="string"||typeof e.email!="string"||typeof e.tenantId!="string"||typeof e.teamId!="string"||typeof e.role!="string"||typeof e.personalAccessTokenId!="string"||typeof e.name!="string"||!Array.isArray(e.scopes)||e.scopes.some(t=>typeof t!="string")||typeof e.expiresAt!="string"||e.status!=="active")throw new m("personal_access_token.current returned invalid data");return e}async function H(e,t){try{return fr(await E(e,Jt,{},t,[t]))}catch(r){throw!(r instanceof $)||r.status!==401?r:new m(`That founder PAT was not accepted (HTTP 401). ${Xe}${r.requestId?` Request id: ${r.requestId}.`:""}`,{code:"founder_pat_rejected",fix:Xe})}}function vr(e,t){return e.HYPERSCALE_CLI_BROWSER?{command:e.HYPERSCALE_CLI_BROWSER,args:[t]}:e.HYPERSCALE_NO_BROWSER==="1"||e.CI==="1"||e.CI==="true"||process.platform==="linux"&&!e.DISPLAY&&!e.WAYLAND_DISPLAY?null:process.platform==="darwin"?{command:"/usr/bin/open",args:[t]}:process.platform==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",t]}:{command:"xdg-open",args:[t]}}async function Ir(e,t){let r=vr(e,t);return r?new Promise(i=>{let n=rt(r.command,r.args,{detached:!0,stdio:"ignore"});n.once("error",()=>i(!1)),n.once("spawn",()=>{n.unref(),i(!0)})}):!1}function Ie(e){return new Promise(t=>{if(!e.listening){t();return}e.close(()=>t())})}async function gr(e,t,r){let i=globalThis.crypto.randomUUID(),n=!1,a,o=new Promise((f,v)=>{a={reject:v,resolve:f}}),s=Gt((f,v)=>{let P=new URL(f.url??"/","http://127.0.0.1");if(f.method!=="GET"||P.pathname!=="/callback"){v.writeHead(404,{"content-type":"text/plain; charset=utf-8"}),v.end(`Not found.
37
+ `);return}if(n){v.writeHead(409,{"content-type":"text/plain; charset=utf-8"}),v.end(`Login callback was already received.
38
+ `);return}if(P.searchParams.get("state")!==i){v.writeHead(400,{"content-type":"text/plain; charset=utf-8"}),v.end(`Login state did not match. Return to the terminal.
39
+ `);return}if(P.searchParams.get("error")!==null){n=!0,v.writeHead(200,{"content-type":"text/plain; charset=utf-8"}),v.end(`Login declined. Return to the terminal.
40
+ `),a.reject(new m("Portal login was declined. Run hyperscale auth login to start again.",{code:"auth_callback_denied"}));return}let R=P.searchParams.get("grant"),A=P.searchParams.get("tenantId");if(!R||!A){v.writeHead(400,{"content-type":"text/plain; charset=utf-8"}),v.end(`Login callback is missing its grant or tenant.
41
+ `);return}n=!0,v.writeHead(200,{"content-type":"text/plain; charset=utf-8"}),v.end(`Login received. Return to the terminal.
42
+ `),a.resolve({grant:R,tenantId:A})});await new Promise((f,v)=>{let P=R=>v(R);s.once("error",P),s.listen(0,"127.0.0.1",()=>{s.off("error",P),f()})}),s.once("error",f=>a.reject(f));let c=s.address();if(!c||typeof c=="string")throw await Ie(s),new m("Could not bind the localhost login callback");let p=`http://127.0.0.1:${c.port}/callback`,d=new URL("/auth/cli",e.baseUrl);d.searchParams.set("callback",p),d.searchParams.set("state",i),d.searchParams.set("scopes",r);let y=new URL("/signin",e.baseUrl);y.searchParams.set("returnTo",`${d.pathname}${d.search}`);let u=y.toString();if(!await Ir(t,u))return await Ie(s),null;process.stderr.write(`Opening portal sign-in: ${u}
43
+ `);let I=setTimeout(()=>{a.reject(new m("Portal login timed out. Run hyperscale auth login to start a new callback.",{code:"auth_callback_timeout"}))},Xt);try{return await o}finally{clearTimeout(I),await Ie(s)}}async function Ze(e,t,r,i,n){let a=await de(n),o={email:t.email,...e,selectedProduct:a&&a.email===t.email&&a.baseUrl===e.baseUrl&&a.environment===e.environment?a.selectedProduct:null};i["--product"]&&(o.selectedProduct=i["--product"]);let s=await be(o,{personalAccessTokenId:t.personalAccessTokenId,token:r,tokenName:t.name,tenantId:t.tenantId},n);try{await xe(n,o)}catch(p){throw await $e(o,n),p}if(s==="file"){let p=F(n)==="file"?"Founder PAT file storage is active.":"macOS Keychain is unavailable.";process.stderr.write(`${p} The founder PAT is in ${q(o,n)} with mode 0600.
44
+ `)}let c=Ne(o,t);if(i["--json"])k(c);else{let p=w(process.stdout,n,{json:!1});l(Ye(p,{identity:t.email,team:t.teamId})),l(`Role: ${g(t.role)}`),l(`Tenant: ${g(t.tenantId)}`),l(`Scopes: ${t.scopes.map(g).join(", ")||"none"}`),l(`Product: ${o.selectedProduct??"not selected"}`)}}async function kr(e,t){let r=oe(e,t),i=dt(e,t);if(i){if(!i.startsWith("hyperscale_pat_"))throw new m("Founder PATs start with hyperscale_pat_. Product API keys belong in HYPERSCALE_API_KEY.");let c=await H(r,i);await Ze(r,c,i,e,t);return}if(e["--no-browser"])throw M();let n=await gr(r,t,e["--scopes"]??"activity:read,billing:read,catalog:read,products:read");if(!n)throw M();let a=await E(r,"/v1/personal-access-token-login-grants/exchange",C({tenantId:n.tenantId,grant:n.grant}),void 0,[n.grant]),o=a?.secret;if(typeof o!="string"||!o.startsWith("hyperscale_pat_")||a?.tenantId!==n.tenantId)throw new m("CLI login grant exchange returned an invalid PAT");let s=await H(r,o);await Ze(r,s,o,e,t)}async function wr(e,t){let r=await T(e,t),i=r.identity??await H(r,r.token),n=Ne(r,i);if(e["--json"]){k(n);return}let a=w(process.stdout,t,{json:!1});l(G(a,{fields:[["User",i.email],["Tenant",i.tenantId],["Role",i.role],["Token",i.name],["Scopes",i.scopes.join(", ")],["Expires",i.expiresAt],["API",r.baseUrl],["Environment",r.environment],["Product",r.selectedProduct??"not selected"]]}))}async function br(e,t){let r=await de(t);if(!r){e["--json"]?k({status:"signed_out"}):l("Already logged out.");return}let i=await Ae(r,t);if(e["--revoke"]&&!i)throw new m("The local founder PAT is missing, so the CLI cannot revoke it.");let n=i?.personalAccessTokenId,a=i?.tokenName;if(e["--revoke"]&&i){if(!n||!a){let c=await H(r,i.token);n=c.personalAccessTokenId,a=c.name}await E({...r,env:t},`/v1/personal-access-tokens/${encodeURIComponent(n)}/revoke`,C({tenantId:i.tenantId,personalAccessTokenId:n}),i.token,[i.token])}let o=await $e(r,t),s=e["--revoke"]===!0;Tr(e,{cleanup:o,personalAccessTokenId:n,revoked:s,status:"signed_out",tokenName:a})}function Tr(e,t){let r=t.cleanup.keychainDeleted?"complete":"tombstoned";if(e["--json"])k({credentialCleanup:r,...t.personalAccessTokenId?{personalAccessTokenId:t.personalAccessTokenId}:{},...t.revoked===void 0?{}:{revoked:t.revoked},status:t.status,...t.tokenName?{tokenName:t.tokenName}:{},...t.revoked===!1?{tokenStillValid:!0}:{}});else{let i=t.tokenName&&t.personalAccessTokenId?`${t.tokenName} (${t.personalAccessTokenId})`:"with unavailable local metadata";t.revoked?l(`Revoked founder PAT ${i} and forgot local state.`):(l(`Forgot local founder PAT ${i}.`),l("The PAT stays valid until expiry; revoke at /desk/security/tokens."))}t.cleanup.keychainDeleted||process.stderr.write(`Keychain cleanup failed. A 0600 profile tombstone blocks the stale founder PAT.
45
+ `)}function X(e,t){if(!e||typeof e!="object"||!Array.isArray(e.items))throw new m(`${t} returned an invalid collection`);return e.items}async function ue(e,t,r,i,n,a=[]){let o=[],s=new Set,c,p;for(;;){let h=new URLSearchParams(r);c&&h.set("cursor",c);let I=h.size>0?`?${h}`:"",f=await E(e,`${t}${I}`,{},n,a);p===void 0&&(p=f),o.push(...X(f,i));let v=f.nextCursor;if(typeof v!="string"||v.length===0)break;if(s.has(v))throw new m(`${i} repeated cursor ${v}`);s.add(v),c=v}let{items:d,nextCursor:y,...u}=p;return{...u,items:o}}function vt(e,t=[]){let r=e.headers.get("hyperscale-operation-id"),i=e.headers.get("hyperscale-receipt-id"),n=r?_(r,t):void 0,a=i?_(i,t):void 0;return{...n?{operationId:n}:{},...a?{receiptId:a}:{}}}function It(e,t,r=[]){if(!e.ok)throw D(e,t,r);try{return JSON.parse(t)}catch{throw new m(`HTTP ${e.status} returned invalid JSON`)}}async function Pr(e,t){let r=e["--source"],i=e["--name"];if(!r)throw new m("product create needs --source <file>",{fix:'Run "hyperscale product create --source <file.hsx> --name <name>".'});if(!i)throw new m("product create needs --name <name>");let n=await wt(r,"product create"),a=await T(e,t),o;try{o=await ue(a,"/v1/products",{tenantId:a.tenantId},"product.list",a.token,[a.token])}catch(f){if(!(f instanceof $)||f.status!==403)throw f}let s=i.trim().toLocaleLowerCase("en-US"),c=(o?X(o,"product.list"):[]).find(f=>{let v=f?.displayName??f?.name;return typeof v=="string"&&v.trim().toLocaleLowerCase("en-US")===s});if(c){let f=c.productId??c.id??"<id>";throw new m(`A Product named ${JSON.stringify(i.trim())} already exists as ${f}.`,{code:"duplicate_product_name",fix:`Use "hyperscale product select ${f}" or choose another --name.`})}let p="/v1/products/instruments-compose",d={name:i,program:{source:n.source},tenantId:a.tenantId,...e["--catalog-revision"]?{catalogRevisionId:e["--catalog-revision"]}:{}},y=await E(a,p,C(d),a.token,[a.token]);if(typeof y?.productId!="string"||typeof y?.productBuildId!="string")throw new m("product.instruments.compose returned an invalid Product");await xe(t,{...a,selectedProduct:y.productId});let u=typeof y?.shown_once=="string"&&y.shown_once.length>0?y.shown_once:void 0,h=[`hyperscale product show ${y.productId}`,...u?[]:[`hyperscale key create --name "Founder CLI" --product ${y.productId}`]],I={nextCommands:h,nextSteps:h,productBuildId:y.productBuildId,productId:y.productId,selectedProduct:y.productId,...typeof y.startKeyId=="string"?{startKeyId:y.startKeyId}:{},...u?{shown_once:u}:{}};if(e["--json"]){k(I);return}l(`Product: ${I.productId}`),l(`Build: ${I.productBuildId}`),l(`Selected: ${I.selectedProduct}`),I.shown_once&&l(`Shown once Product API key: ${I.shown_once}`),l("Next:");for(let f of I.nextSteps)l(` ${f}`)}function gt(e){return new URLSearchParams({tenantId:e}).toString()}async function Sr(e,t){let r=await T(e,t),i=await ue(r,"/v1/products",{tenantId:r.tenantId},"product.list",r.token,[r.token]),n=X(i,"product.list");if(e["--json"]){k(i);return}if(n.length===0){l('No Products yet. Run "hyperscale product create --source <file.hsx> --name <name>".');return}let a=w(process.stdout,t,{json:!1});l(U(a,{columns:["ID","Name","Status"],rows:n.map(o=>[o.productId??o.id??"unknown",o.displayName??o.name??"unnamed",o.status??""])}))}async function qr(e,t,r){let i=await T(e,t),n=r??i.selectedProduct;if(!n)throw new m("product show needs an id because no Product is selected. Create a Product first.",{fix:'Run "hyperscale product list" to see existing Products, or "hyperscale product create" to create one.'});let a=await E(i,`/v1/products/${encodeURIComponent(n)}?${gt(i.tenantId)}`,{},i.token,[i.token]);if(e["--json"]){k({...a,nextCommands:[`hyperscale product actions --product ${n}`,`hyperscale key list --product ${n}`]});return}Or(a,n)}function Or(e,t){let r=e?.displayName??e?.name??"unnamed",i=e?.status??"unknown",n=e?.pricing?.currency??e?.cost?.currency??"SAR",a=e?.pricing?.current?.monthly??e?.cost?.platformMonthly,o=e?.pricing?.current?.setup??e?.cost?.platformSetup,s=[...Array.isArray(e?.readiness?.outstandingLiveRequirements)?e.readiness.outstandingLiveRequirements.map(d=>typeof d=="string"?d:d?.owner?`${d.key} (${d.owner})`:d?.key):[],...Array.isArray(e?.readiness?.liveUnavailableCapabilities)?e.readiness.liveUnavailableCapabilities.map(d=>`unavailable:${d}`):[],...Array.isArray(e?.cost?.blockers)?e.cost.blockers.map(d=>d?.code??"pricing"):[]],c=w(process.stdout,process.env,{json:!1}),p=[["Name",r],["Product",e?.productId??t],["Status",i]];if(e?.pricing?.scheduled){let d=e.pricing.current?.monthly,y=e.pricing.scheduled?.monthly;p.push(["Current billing price",`${n} ${d}/mo`],[`Accepted price from ${e.pricing.scheduled.effectiveAt}`,`${n} ${y}/mo`])}else p.push(["Monthly",a==null?"not returned":`${n} ${a}`]);p.push(["Setup",o==null?"not returned":`${n} ${o}`]),p.push(["Live",e?.readiness?.live===!0?"active":"not active"]),p.push(["Live blockers",s.length>0?s.join(", "):"none"]);for(let[d,y]of[["openapi","OpenAPI"],["mcp","MCP"],["sdk","SDK"],["graphql","GraphQL"]]){let u=e?.surfaces?.[d];u?.url&&p.push([y,u.url])}l(G(c,{fields:p})),l(""),l("Next:"),l(` hyperscale key create --name "Founder CLI" --product ${e?.productId??t}`)}async function Er(e,t,r){if(!r)throw new m("product select needs a Product id",{fix:'Run "hyperscale product list" to list Products, then pass one ID.'});let i=await T(e,t),n=await E(i,`/v1/products/${encodeURIComponent(r)}?${gt(i.tenantId)}`,{},i.token,[i.token]);if(n?.productId!==r)throw new m("product.retrieve returned the wrong Product");await xe(t,{...i,selectedProduct:r});let o={nextCommands:[`hyperscale product show ${r}`,`hyperscale key list --product ${r}`],productId:r,selected:!0};e["--json"]?k(o):l(`Selected Product: ${n.displayName??r} (${r})`)}function Rr(e){return e.map(t=>`${t.path}: error [composer] ${t.code}: ${t.message}`)}function xr(e){return JSON.stringify(Pe(e))}function Pe(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Pe);let t={};for(let r of Object.keys(e).sort())t[r]=Pe(e[r]);return t}function kt(e,t=""){if(e==null)return t;if(typeof e=="string")return e;if(typeof e=="object")try{return xr(e)}catch{return t}return String(e)}async function wt(e,t="compose"){if(!e)throw new m(`${t} needs a .hsx file`,{fix:`Run "hyperscale ${t} <file.hsx>" with an existing .hsx file.`});if(!e.endsWith(".hsx"))throw new m(`${t} reads a .hsx file, got ${e}`,{fix:`Point ${t} at a file ending in .hsx.`});let r;try{r=await Y(e,"utf8")}catch(i){throw new m(`Could not read ${e}: ${i.message}`)}return{file:e,source:r}}function Cr(e){if(!e||typeof e!="object"||typeof e.ok!="boolean"||!Array.isArray(e.issues))throw new m("composer.check returned an invalid result",{fix:'Run the latest unpinned CLI (e.g. "bunx @hyperscale0/cli@latest <command>"), or report the issue without including credentials.'});return{issues:e.issues.map(r=>{if(!r||typeof r!="object"||typeof r.code!="string"||typeof r.message!="string"||typeof r.path!="string")throw new m("composer.check returned an invalid issue",{fix:'Run the latest unpinned CLI (e.g. "bunx @hyperscale0/cli@latest <command>"), or report the issue without including credentials.'});return{code:r.code,message:r.message,path:r.path}}),ok:e.ok}}async function He(e,t,r,i="none",n="compose"){let a=await wt(r,n),o=await T(e,t),s=i==="required"?Q(o,e):i==="optional"?Tt(o,e):void 0,c=await Ge(o,"/v1/composer/check",C({tenantId:o.tenantId,document:a.source,...e["--catalog-revision"]?{catalogRevisionId:e["--catalog-revision"]}:{}}),o.token),p=vt(c.response,[o.token]),d=Cr(It(c.response,c.text,[o.token]));if(!d.ok)throw new ae(["composer.check refused the program.",...Rr(d.issues)].join(`
46
+ `),{file:r,issues:d.issues,...p});return{check:d,receipt:p,context:o,productId:s,program:a,catalogRevisionId:e["--catalog-revision"]}}async function Ar(e,t,r){let i=await He(e,t,r,"none","compose check");if(e["--json"]){k({command:"composer.check",file:r,issues:i.check.issues,ok:!0,...i.receipt});return}l(`Check passed: ${r}`)}async function bt(e,t){let r=await Ge(e.context,"/v1/composer/plan",C({document:e.program.source,tenantId:e.context.tenantId,...e.productId?{productId:e.productId}:{},...e.catalogRevisionId?{catalogRevisionId:e.catalogRevisionId}:{}}),e.context.token),i=It(r.response,r.text,[e.context.token]),n=vt(r.response,[e.context.token]);if(!i||typeof i!="object"||typeof i.summary!="string"||!Array.isArray(i.actions)||!i.pricing||typeof i.pricing!="object")throw new m("composer.plan returned an invalid result");let a=i.actions.filter(o=>!o||typeof o!="object"||o.kind!=="configure_product");if(a.length>0)throw new ae([i.summary,...a.map(o=>o&&typeof o=="object"?`${o.kind??"unknown"} ${o.target??"unknown"} ${kt(o.detail,"Composer refused this action.")}`:"unknown unknown Composer returned an invalid refusal action.")].join(`
47
+ `),{actions:a,file:t,...n,...e.productId?{productId:e.productId}:{}});return{...i,...n}}async function $r(e,t,r){let i=await He(e,t,r,"optional","compose plan"),n=await bt(i,r);if(e["--json"]){k({command:"composer.plan",file:r,check:{...i.check,...i.receipt},plan:n,...i.productId?{productId:i.productId}:{}});return}l(n.summary);for(let o of n.actions)l(`${o.kind} ${o.target} ${kt(o.detail)}`);let a=n.pricing?.currency??"SAR";if(n.pricing?.scheduled){let o=n.pricing.current?.monthly,s=n.pricing.scheduled?.monthly;l(`Current billing price: ${a} ${o}/mo`),l(`Candidate price from ${n.pricing.scheduled.effectiveAt}: ${a} ${s}/mo`),l(`Pricing identity: ${n.pricing.scheduled.pricingIdentity}`)}else if(n.pricing){let o=n.pricing.monthly,s=n.pricing.activation;o!==void 0&&l(`Monthly: ${a} ${o}`),s!==void 0&&l(`Activation: ${a} ${s}`)}}async function Lr(e,t,r){if(!e["--confirm"]&&!e["--yes"])if(process.stdin.isTTY&&process.stderr.isTTY){let c=w(process.stderr,process.env,{json:!1});process.stderr.write(`${We(c,{action:"recompose",subject:r,confirmation:"Recompose selected Product?"})}
48
+ `);let p=Nt({input:process.stdin,output:process.stderr,terminal:!0});try{let d=await p.question("");if(d.trim().toLowerCase()!=="y"&&d.trim().toLowerCase()!=="yes")throw new m("Mutation cancelled.",{code:"cancelled"})}finally{p.close()}}else throw new m("compose apply changes the selected Product. Pass --confirm, or --yes for an agent.");let i=e["--pricing-identity"];if(!i&&e["--plan-file"]){let c=e["--plan-file"];try{let p=await Y(c,"utf8"),d=JSON.parse(p);i=d.plan?.pricing?.scheduled?.pricingIdentity??d.pricing?.scheduled?.pricingIdentity??d.pricingIdentity}catch(p){throw new m(`Failed to read saved plan file ${c}: ${p.message}`)}}let n=await He(e,t,r,"required","compose apply"),a=await bt(n,r);if(a.pricing?.scheduled&&!i){if(!e["--yes"])throw new m(`compose apply --confirm requires --pricing-identity (or --plan-file). Run "hyperscale compose plan ${r}" to review candidate pricing and copy the pricing identity, or pass --yes to accept the current candidate.`);i=a.pricing.scheduled.pricingIdentity}let o=e["--idempotency-key"]??globalThis.crypto.randomUUID(),s;try{s=await E(n.context,"/v1/products/recompose",C({program:{source:n.program.source},...n.catalogRevisionId?{catalogRevisionId:n.catalogRevisionId}:{},...i?{pricingIdentity:i}:{},tenantId:n.context.tenantId,productId:n.productId},o),n.context.token,[n.context.token])}catch(c){throw c instanceof $&&c.code==="product_instrument_not_drained"&&(c.fix=`Drain live instrument instances, or create a new Product directly from source: hyperscale product create --source ${r} --name <name>`),c}if(!s||typeof s.productBuildId!="string")throw new m("product.recompose returned no new build identity");if(e["--json"]){k({command:"product.recompose",file:r,output:s});return}if(l(`Product: ${s.productId??n.productId}`),l(`Build: ${s.productBuildId}`),s.buildDigest&&l(`Digest: ${s.buildDigest}`),s.pricing?.scheduled){let c=s.pricing.currency??"SAR",p=s.pricing.current?.monthly,d=s.pricing.scheduled?.monthly;l(`Current billing price: ${c} ${p}/mo`),l(`Accepted price from ${s.pricing.scheduled.effectiveAt}: ${c} ${d}/mo`)}}function Tt(e,t){let r=t["--product"]??e.selectedProduct;return typeof r=="string"&&r.length>0?r:void 0}function Q(e,t){let r=Tt(e,t);if(!r)throw new m("No Product selected. Pass --product <id> or create a Product first.",{fix:'Run "hyperscale product list" to see existing Products, or "hyperscale product create" to create one.'});return r}async function et(e,t){if(e["--product"])return ce(e,t);if(e["--api-key"]??t.HYPERSCALE_API_KEY)return ar(e,t);let r=await T(e,t);return r.selectedProduct?ce(e,t):{...r,apiKey:r.token,member:!0}}async function ce(e,t){let r=await de(t),i=Q(r??{},e),n=oe(e,t,r??{});if(r&&(n.baseUrl!==r.baseUrl||n.environment!==r.environment))throw new m(`The selected Product belongs to ${r.baseUrl} (${r.environment}). Select a Product at the configured API origin first.`);let a=e["--api-key"]??t.HYPERSCALE_API_KEY;if(a)return{...n,apiKey:a,productId:i};let o=await T(e,t);return{...n,apiKey:o.token,productId:i,member:!0}}async function ye(e){let t=`/v1/products/${encodeURIComponent(e.productId)}/operation-set`,{response:r,text:i}=await le(e,t);if(!r.ok)throw St(r,i,[e.apiKey],{productId:e.productId});return Nr(i,r.status)}async function jr(e,t,r){let i=await ce(e,t),n=await ye(i);if(r){Gr(n,r,e);return}if(e["--json"]){k(n);return}if(n.publicActions.length===0)l("No public actions");else{let a=w(process.stdout,t,{json:!1});l(U(a,{columns:["Operation ID","Input","Kind"],rows:n.publicActions.map(o=>{let s=o.idempotencyPolicy?.mode==="not_required"?"read-only":"mutation";return[`${o.instrument}.${o.name}`,Dr(o.inputSchema),s]})}))}if(n.setupOperations.length>0){l("Setup operations (run with hyperscale call)");for(let a of n.setupOperations)l(a.operationName)}if(n.readOperationIds.length>0){l("Reads (run with hyperscale call)");for(let a of n.readOperationIds)l(Ur(a))}l(`Digest: ${n.tenantOperationSetDigest}`),l(`Setup digest: ${n.tenantSetupOperationSetDigest}`),l(`Read digest: ${n.tenantReadOperationSetDigest}`),l(`Build: ${n.productBuildId}`),l(`Surface version: ${n.tenantSurfaceVersion}`)}function Gr(e,t,r){let i=e.publicActions.find(c=>c&&`${c.instrument}.${c.name}`===t),n=Hr(t),a=e.setupOperations.find(c=>c&&(c.operationId===t||c.operationId===n||c.operationName===t));if(a){let{inputSchema:c,operationId:p,operationName:d}=a,y={status:e.status,productBuildId:e.productBuildId,tenantSurfaceVersion:e.tenantSurfaceVersion,tenantSetupOperationSetDigest:e.tenantSetupOperationSetDigest,setupOperationId:p,operationName:d,command:`hyperscale call ${d}`,inputSchema:c};if(r["--json"]){k(y);return}let u=w(process.stdout,r?process.env:{},{json:!1}),h=[["Operation ID",p],["Operation name",d],["Run",`hyperscale call ${d}`],["Input schema",JSON.stringify(c,null,2)]];(!Array.isArray(c.required)||c.required.length===0)&&h.push(["Input","omit --input or pass {}."]),h.push(["Setup digest",e.tenantSetupOperationSetDigest],["Build",e.productBuildId],["Surface version",e.tenantSurfaceVersion]),l(G(u,{fields:h}));return}if(!i)throw new m(`Unknown frozen public action: ${t}. Run "hyperscale product actions" to list exact names.`);let o={status:e.status,productBuildId:e.productBuildId,tenantSurfaceVersion:e.tenantSurfaceVersion,tenantOperationSetDigest:e.tenantOperationSetDigest,qualifiedName:`${i.instrument}.${i.name}`,publicAction:i};if(r["--json"]){k(o);return}let s=w(process.stdout,r?process.env:{},{json:!1});l(G(s,{fields:[["Operation ID",`${i.instrument}.${i.name}`],["Instrument",i.instrument],["Input schema",JSON.stringify(i.inputSchema,null,2)],["Output schema",JSON.stringify(i.outputSchema,null,2)],["Actor policy",JSON.stringify(i.actorPolicy,null,2)],["Port policy",JSON.stringify(i.portPolicy,null,2)],["Idempotency policy",JSON.stringify(i.idempotencyPolicy,null,2)],["Receipt policy",JSON.stringify(i.receiptPolicy,null,2)],["Receipt evidence",JSON.stringify(i.receiptEvidence,null,2)],["Digest",e.tenantOperationSetDigest],["Build",e.productBuildId],["Surface version",e.tenantSurfaceVersion]]}))}function Nr(e,t){let r;try{r=JSON.parse(e)}catch{throw new m(`HTTP ${t} returned invalid JSON`)}if(!r||typeof r!="object"||r.status!=="frozen"||typeof r.productBuildId!="string"||typeof r.tenantSurfaceVersion!="number"||typeof r.tenantOperationSetDigest!="string"||typeof r.tenantReadOperationSetDigest!="string"||typeof r.tenantSetupOperationSetDigest!="string"||!Array.isArray(r.publicActions)||!Array.isArray(r.readOperationIds)||!Array.isArray(r.setupOperationIds)||!Array.isArray(r.setupOperations))throw new m("The Product operation set is not in the expected format.",{fix:'Run the latest unpinned CLI (e.g. "bunx @hyperscale0/cli@latest <command>"), or report the issue without including credentials.'});return r.publicActions=r.publicActions.map(i=>{if(!i||typeof i!="object"||typeof i.instrument!="string"||i.instrument.length===0||typeof i.name!="string"||i.name.length===0)throw new m("The server's public action names no instrument or action name. The platform predates Product identity in public actions: redeploy it.");return{...i,qualifiedName:`${i.instrument}.${i.name}`}}),r}function Hr(e){return e.replaceAll(".","_")}function Ur(e){for(let t of["create","list","retrieve"]){let r=`_${t}`;if(e.endsWith(r))return`${e.slice(0,-r.length)}.${t}`}return e}function Dr(e){if(!e||typeof e!="object")return"input schema unavailable";let t=e.properties&&typeof e.properties=="object"&&!Array.isArray(e.properties)?e.properties:{},r=new Set(Array.isArray(e.required)?e.required.filter(n=>typeof n=="string"):[]),i=Object.entries(t).map(([n,a])=>`${n}${r.has(n)?"":"?"}: ${Pt(a)}`);return i.length===0?"no input":i.join(", ")}function Pt(e){return!e||typeof e!="object"?"value":Array.isArray(e.enum)&&e.enum.length>0?e.enum.map(t=>String(t)).join(" | "):e.type==="array"?`${Pt(e.items)}[]`:typeof e.type=="string"?typeof e.format=="string"?`${e.type} (${e.format})`:e.type:"value"}async function Br(e,t,r){if(!r)throw new m("product run needs a public action");let i=await ce(e,t),n=await ye(i);zr(n,r);let a=await qt(e),o=e["--idempotency-key"]??globalThis.crypto.randomUUID(),{response:s,text:c}=await le(i,i.member?`/v1/products/${encodeURIComponent(i.productId)}/operations/${encodeURIComponent(r)}`:`/v1/operations/${encodeURIComponent(r)}`,{body:JSON.stringify(a),headers:{"content-type":"application/json","idempotency-key":o},method:"POST"});if(!s.ok)throw St(s,c,[i.apiKey],{action:r,productId:i.productId});let p=s.headers.get("hyperscale-operation-id"),d=s.headers.get("hyperscale-receipt-id"),y=s.headers.get("x-request-id"),u=p?_(p,[i.apiKey]):null,h=d?_(d,[i.apiKey]):null,I=y?_(y,[i.apiKey]):null;if(e["--json"]){k({idempotencyKey:o,...I?{requestId:I}:{},operationId:u,receiptId:h,output:Kr(c)});return}u&&l(`Operation: ${u}`),h&&l(`Receipt: ${h}`),l(`Idempotency key: ${o}`);let f=Ue(c);f&&l(f)}function zr(e,t){let r=e.publicActions.find(n=>n&&`${n.instrument}.${n.name}`===t);if(r)return r;let i=e.publicActions.map(n=>`${n.instrument}.${n.name}`).map(n=>({candidate:n,distance:qe(t,n)})).sort((n,a)=>n.distance-a.distance||n.candidate.localeCompare(a.candidate)).slice(0,3).map(({candidate:n})=>n);throw new m(`Unknown frozen public action: ${t}. Closest valid names: ${i.join(", ")}. Run "hyperscale product actions" to list exact names.`)}function Kr(e){if(e.trim()==="")return null;try{return JSON.parse(e)}catch{return e}}function St(e,t,r=[],i={}){let n=ft(t,r,e.status),a=V(e.headers,n.requestId,r),o=n.code??"user_error",s=n.redactedMessage;if(typeof s=="string"&&s.includes("does not match API key Product")){let u=i.productId??s.match(/^Selected Product (\S+) does not match/)?.[1];u&&(s=`${s} Or set HYPERSCALE_API_KEY to a key for ${u}, or pass that key with --api-key.`)}let c=o==="user_error"?"":`${o}: `,p=`HTTP ${e.status} \xB7 ${c}${s}`,d=Mr(n.details,r),y=n.fix;return o==="idempotency_conflict"?y="Reuse the same key only with the same operation and input. Use a new unique key for a different request.":e.status===409&&typeof s=="string"&&s.includes("capability-derived")?y='This Product has no frozen public actions. List its operations with "hyperscale ops list" and run them with "hyperscale call".':[s,...d].some(u=>typeof u=="string"&&u.includes("[Truncated]"))&&i.action&&(y=`Run "hyperscale product actions ${i.action}" to read the full input schema and allowed values.`),new $([p,...d].join(`
49
+ `),{code:o,details:n.details,fix:y,operationId:a.operationId,receiptId:a.receiptId,requestId:a.requestId,status:e.status,traceId:a.traceId})}function Mr(e,t){if(!e||typeof e!="object")return[];if(Array.isArray(e.issues))return e.issues.flatMap(i=>{if(!i||typeof i!="object")return[];let a=(Array.isArray(i.path)?i.path.join("."):"input")||"input";return typeof i.message=="string"?[`${a}: ${_(i.message,t)}`]:[]});let r=[];return Se(e,"",r,t),r}function Se(e,t,r,i){if(Array.isArray(e)){if(e.every(n=>n===null||typeof n!="object")){r.push(`${tt(t)}: ${_(e.join(", "),i)}`);return}e.forEach((n,a)=>Se(n,`${t}[${a}]`,r,i));return}if(e&&typeof e=="object"){for(let[n,a]of Object.entries(e))Se(a,t?`${t}.${n}`:n,r,i);return}t&&r.push(`${tt(t)}: ${_(String(e),i)}`)}function tt(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll("."," ");return t.charAt(0).toUpperCase()+t.slice(1)}async function Jr(e,t){let r=await T(e,t),i=Q(r,e),n=await E(r,"/v1/sandbox-api-keys",C({name:e["--name"]??"Founder CLI",tenantId:r.tenantId,productId:i}),r.token,[r.token]),a=["export HYPERSCALE_API_KEY=<paste the shown_once value>",`hyperscale product actions --product ${i}`];if(e["--json"]){let{secret:o,...s}=n;k({...s,...typeof o=="string"?{shown_once:o}:{},nextCommands:a});return}l(`Key: ${n.apiKeyId??"unknown"}`),l(`Product: ${n.productId??i}`),l(`Status: ${n.status??"unknown"}`),n.secret?(l(`Secret: ${n.secret}`),l("Store it now. Hyperscale will not return it again."),l("Next:"),l(" export HYPERSCALE_API_KEY=<paste the secret above>"),l(` hyperscale product actions --product ${i}`)):l("The key already existed, so the one-time secret is unavailable.")}async function Yr(e,t){let r=await T(e,t),i=Q(r,e),n=await ue(r,"/v1/api-keys",{productId:i,tenantId:r.tenantId},"api_key.list",r.token,[r.token]),a=X(n,"api_key.list");if(e["--json"]){k(n);return}let o=w(process.stdout,t,{json:!1});l(U(o,{columns:["ID","Name","Status"],rows:a.map(s=>[s.apiKeyId,s.name??"unnamed",s.status??"unknown"])}))}async function Fr(e,t,r){if(!r)throw new m("key revoke needs an API key id",{fix:'Run "hyperscale key list" to list keys, then pass one ID.'});let i=await T(e,t),n=Q(i,e),a=await E(i,`/v1/api-keys/${encodeURIComponent(r)}/revoke`,C({tenantId:i.tenantId,productId:n}),i.token,[i.token]);e["--json"]?k(a):l(`Key ${a.apiKeyId??r}: ${a.status??"revoked"}`)}async function Wr(e,t){let r=await T(e,t),i=r.identity??await H(r,r.token),n=Ne(r,i);if(e["--json"]){k(n);return}let a=w(process.stdout,t,{json:!1});l(G(a,{fields:[["User",i.email],["Tenant",i.tenantId],["Role",i.role],["Token",i.name],["Expires",i.expiresAt]]}))}async function Vr(e,t,r){let i;if(e.catalog||e.member&&!e.productId)i={operations:he.commands.filter(s=>e.catalog||s.principal==="user_session")};else if(e.member){let s=await ye(e);i={operations:[...s.setupOperations,...s.readOperations??[]].map(c=>({...c,name:c.operationName,method:"POST",path:`/v1/products/${encodeURIComponent(e.productId)}/operations/${encodeURIComponent(c.operationName)}`}))}}else i=await yt(e);let n=r?r.toLowerCase():null,a=n?i.operations.filter(s=>s.name.toLowerCase().includes(n)||s.path.toLowerCase().includes(n)):i.operations;if(t["--json"]){l(JSON.stringify(a,null,2));return}if(a.length===0){l(r?`No operation matches ${r}`:"No operations");return}let o=w(process.stdout,process.env,{json:!1});l(U(o,{columns:["Operation","Method","Path"],rows:a.map(s=>[s.name,s.method,s.path])}))}async function Xr(e,t){let r=await T(e,t),i=await ue(r,"/v1/activity",{tenantId:r.tenantId},"activity.list",r.token,[r.token]),n=X(i,"activity.list");if(e["--json"]){k(i);return}let a=w(process.stdout,t,{json:!1});l(U(a,{columns:["Time","Activity","Target","Status"],rows:n.map(o=>{let s=o.operation??o.auditEvent??"activity",c=o.resourceKind&&o.resourceId?`${o.resourceKind}:${o.resourceId}`:o.resourceKind??o.resourceId??"-";return[o.occurredAt??"unknown",s,c,o.status??"recorded"]})}))}function Qr(e,t){let r={...t},i=[],n=e.path.replace(/\{([^}]+)\}/g,(a,o)=>{let s=r[o];return s==null?(i.push(o),""):(delete r[o],encodeURIComponent(String(s)))});if(i.length>0)throw new m(`${e.name} needs ${i.join(", ")} in --input`);return{path:n,remaining:r}}function Zr(e){let t=new URLSearchParams;for(let[i,n]of Object.entries(e))n!=null&&t.set(i,typeof n=="string"?n:JSON.stringify(n));let r=t.toString();return r?`?${r}`:""}function qe(e,t){let r=Array.from({length:t.length+1},(i,n)=>n);for(let i=1;i<=e.length;i+=1){let n=[i];for(let a=1;a<=t.length;a+=1)n[a]=Math.min(n[a-1]+1,r[a]+1,r[a-1]+(e[i-1]===t[a-1]?0:1));r.splice(0,r.length,...n)}return r[t.length]}function ei(e,t){let r=e.find(a=>a.name===t);if(r)return r;let i=e.filter(a=>a.operationId===t);if(i.length===1)return i[0];if(i.length>1)throw new m(`${t} matches more than one operation. Use one of: ${i.map(a=>a.name).join(", ")}.`);let n=e.map(a=>({candidate:a,distance:Math.min(qe(t,a.name),qe(t,a.operationId))})).sort((a,o)=>a.distance-o.distance||a.candidate.name.localeCompare(o.candidate.name)).slice(0,3).flatMap(({candidate:a})=>[a.name,a.operationId]);throw new m(`${t} is not an operation in the selected Product's machine document. Closest valid names: ${n.join(", ")}.`)}async function ti(e,t,r){if(!r)throw new m("call needs an operation name",{fix:'Run "hyperscale ops list" to list operations.'});let i;if(e.member&&e.productId){let u=await ye(e);i=[...u.setupOperations,...u.readOperations??[]].map(h=>({...h,name:h.operationName,method:"POST",path:`/v1/products/${encodeURIComponent(e.productId)}/operations/${encodeURIComponent(h.operationName)}`,idempotency:u.readOperationIds.includes(h.operationId)?"not_required":"required"}))}else e.member?i=he.commands.filter(u=>u.principal==="user_session"):i=(await yt(e)).operations;let n=ei(i,r),a=await qt(t);e.member&&!e.productId&&a.tenantId===void 0&&(a.tenantId=e.tenantId);let{path:o,remaining:s}=Qr(n,a),c={method:n.method},p=o;n.method==="GET"?p+=Zr(s):(c.body=JSON.stringify(s),c.headers={"content-type":"application/json",...n.idempotency==="not_required"?{}:{"idempotency-key":t["--idempotency-key"]??globalThis.crypto.randomUUID()}});let{response:d,text:y}=await le(e,p,c);if(d.ok){if(t["--json"]){let u=_t(y),h=d.headers.get("x-request-id")??(u&&typeof u=="object"&&typeof u.requestId=="string"?u.requestId:null),I=d.headers.get("hyperscale-operation-id")??null,f=d.headers.get("hyperscale-receipt-id")??null,v=ht(d.headers),P=h?_(h,[e.apiKey]):null,R=I?_(I,[e.apiKey]):null,A=f?_(f,[e.apiKey]):null,L=v?_(v,[e.apiKey]):null;k({status:d.status,data:u,requestId:P,operationId:R,receiptId:A,traceId:L});return}l(Ue(y));return}throw D(d,y,[e.apiKey])}async function qt(e){if(e["--input"]!==void 0&&e["--input-file"]!==void 0)throw new m("Use only one of --input and --input-file");if(e["--input"]!==void 0)return ge(e["--input"],"--input");if(e["--input-file"]!==void 0){let t;try{t=await Y(e["--input-file"],"utf8")}catch(r){throw new m(`Could not read ${e["--input-file"]}: ${r.message}`)}return ge(t,"--input-file")}if(!process.stdin.isTTY){let t=await yr();if(t.trim()!=="")return ge(t,"stdin")}return{}}function ge(e,t="--input"){if(e===void 0)return{};let r;try{r=JSON.parse(e)}catch(i){throw new m(`${t} is not valid JSON: ${i.message}`)}if(r===null||typeof r!="object"||Array.isArray(r))throw new m(`${t} must be a JSON object`);return r}function Ue(e){if(e.trim()==="")return"";try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function l(e){process.stdout.write(`${e}
50
+ `)}function k(e){l(JSON.stringify(e,null,2))}function ri(e,t){let r=t.includes("--json"),i=[process.env.HYPERSCALE_API_KEY,process.env.HYPERSCALE_TOKEN].filter(Boolean),n=e instanceof m,a=n?e.message:"The command failed unexpectedly.",o=g(_(String(a),i)),s=o.length>1024?o.slice(0,1024):o,c=n?e.fix??'Follow the message, or run "hyperscale --help" for command usage.':"Report the failure without including credentials.",p=g(_(String(c),i)),d=n&&typeof e.shownOnce=="string"?g(_(e.shownOnce,i)):void 0;if(!r){let O=w(process.stderr,process.env,{json:!1}),Ot=(typeof e?.structuredError?.code=="string"?e.structuredError.code:void 0)??(n&&typeof e.code=="string"?e.code:n?"user_error":"internal_error"),Et=n?s:o,Rt=d?`
51
+ Shown once Product API key: ${d}`:"",xt=Ve(O,{code:Ot,message:Et,nextStep:p});process.stderr.write(`${xt}${Rt}
52
+ `);return}let y=(typeof e?.structuredError?.code=="string"?e.structuredError.code:void 0)??(n&&typeof e.code=="string"?e.code:n?"user_error":"internal_error"),u=(typeof e?.structuredError?.message=="string"?e.structuredError.message:void 0)??(n?e.message:"The command failed unexpectedly."),h=g(_(String(u),i)),I=h.length>1024?h.slice(0,1024):h,f=(typeof e?.structuredError?.fix=="string"?e.structuredError.fix:void 0)??(n?e.fix??'Follow the message, or run "hyperscale --help" for command usage.':"Report the failure without including credentials."),v=g(_(String(f),i)),P=v.length>1024?v.slice(0,1024):v,R=e?.structuredError?.details!==void 0?e.structuredError.details:n&&e.details!==void 0?e.details:void 0,A=R!==void 0?se(R,i):void 0,L=n&&typeof e.status=="number"?e.status:void 0,Z=O=>typeof O!="string"||O.trim().length===0?null:g(_(O.trim(),i)),ee=n&&(e.requestId!==void 0||e.operationId!==void 0||e.receiptId!==void 0||e.traceId!==void 0),te=ee?Z(e.requestId):void 0,re=ee?Z(e.operationId):void 0,ie=ee?Z(e.receiptId):void 0,ne=ee?Z(e.traceId):void 0,De=O=>({...L!==void 0?{status:L}:{},error:{code:y,message:I,...O!==void 0?{details:O}:{},fix:P},...te!==void 0?{requestId:te}:{},...re!==void 0?{operationId:re}:{},...ie!==void 0?{receiptId:ie}:{},...ne!==void 0?{traceId:ne}:{},...d?{shown_once:d}:{}}),Be=O=>Buffer.byteLength(O,"utf8")>8192,B=De(A),z=JSON.stringify(B);Be(z)&&A!==void 0&&(B=De("[Truncated]"),z=JSON.stringify(B)),Be(z)&&(B={...L!==void 0?{status:L}:{},error:{code:y,message:I,fix:"[Truncated]"},...te!==void 0?{requestId:te}:{},...re!==void 0?{operationId:re}:{},...ie!==void 0?{receiptId:ie}:{},...ne!==void 0?{traceId:ne}:{}},z=JSON.stringify(B)),process.stderr.write(`${z}
53
+ `)}async function ii(){let{readFileSync:e}=await import("node:fs");return JSON.parse(e(new URL("./package.json",import.meta.url),"utf8")).version}async function ni(e,t){let{flags:r,positional:i}=nr(e);if(r["--version"])return l(await ii()),0;if(r["--help"]||i[0]==="help")return Zt(r,i[0]==="help"?i.slice(1):i,t),0;if(i.length===0&&!r["--help"]){if(r["--json"])throw new m('No command. Run "hyperscale --help" to list commands.');if(!await T(r,t,!0)){let s=w(process.stdout,t,{json:!1});return l(Je(s)),0}return l('Build your first Product with "hyperscale product create --source <file.hsx> --name <name>".'),l('Run "hyperscale --help" for every command.'),0}let[n,...a]=i;if(n==="resume")return await lr(r,t,a[0]),0;if(n==="auth"){if(a[0]==="login")await kr(r,t);else if(a[0]==="status")await wr(r,t);else if(a[0]==="logout")await br(r,t);else throw new m('Auth subcommands are "login", "status", and "logout"',{fix:'Run "hyperscale help auth" to see valid subcommands.'});return 0}if(n==="product"){if(a[0]==="create")await Pr(r,t);else if(a[0]==="list")await Sr(r,t);else if(a[0]==="show")await qr(r,t,a[1]);else if(a[0]==="select")await Er(r,t,a[1]);else if(a[0]==="actions")await jr(r,t,a[1]);else if(a[0]==="run")await Br(r,t,a[1]);else throw new m('Product subcommands are "create", "list", "show", "select", "actions", and "run"',{fix:'Run "hyperscale help product" to see valid subcommands.'});return 0}if(n==="compose"){if(a[0]==="check")await Ar(r,t,a[1]);else if(a[0]==="plan")await $r(r,t,a[1]);else if(a[0]==="apply")await Lr(r,t,a[1]);else throw new m('Compose subcommands are "check", "plan", and "apply"',{fix:'Run "hyperscale help compose" to see valid subcommands.'});return 0}if(n==="key"){if(a[0]==="create")await Jr(r,t);else if(a[0]==="list")await Yr(r,t);else if(a[0]==="revoke")await Fr(r,t,a[1]);else throw new m('Key subcommands are "create", "list", and "revoke"',{fix:'Run "hyperscale help key" to see valid subcommands.'});return 0}if(n==="whoami")return await Wr(r,t),0;if(n==="activity"){if(a[0]!=="list")throw new m('The only activity subcommand is "list"',{fix:'Run "hyperscale help activity" to see usage.'});return await Xr(r,t),0}if(n==="ops"){if(a[0]!=="list")throw new m('The only ops subcommand is "list"',{fix:'Run "hyperscale help ops" to see usage.'});let o=r["--catalog"]?{catalog:!0}:await et(r,t);return await Vr(o,r,a[1]),0}if(n==="call"){let o=await et(r,t);return await ti(o,r,a[0]),0}throw new m(`Unknown command: ${n}`,{fix:'Run "hyperscale --help" to list commands.'})}ni(process.argv.slice(2),process.env).then(e=>{process.exitCode=e},e=>{ri(e,process.argv.slice(2)),process.exitCode=e instanceof m&&Number.isInteger(e.exitCode)?e.exitCode:1});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperscale0/cli",
3
- "version": "1.0.0-beta.26",
3
+ "version": "1.0.0-beta.27",
4
4
  "description": "Hyperscale CLI: compose Products, manage keys, and call Product operations.",
5
5
  "license": "LicenseRef-Hyperscale-Proprietary",
6
6
  "author": "Hyperscale LLC",
@@ -20,5 +20,5 @@
20
20
  "publishConfig": {
21
21
  "access": "public"
22
22
  },
23
- "gitHead": "ed8866f5e5201aad938ad0219da06e430a513467"
23
+ "gitHead": "732a2b4a0e28e292913a966b4e55ace703ac8820"
24
24
  }