@farthershore/client 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +162 -0
  2. package/README.md +9 -8
  3. package/dist/index.js +66 -54
  4. package/dist/types/api.generated.d.ts +13 -7
  5. package/dist/types/generated/schemas.d.ts +3670 -0
  6. package/dist/types/helpers/wait-for-frontend-build.d.ts +12 -4
  7. package/dist/types/index.d.ts +2 -2
  8. package/dist/types/operations/agents.d.ts +204 -12
  9. package/dist/types/operations/agreements.d.ts +139 -9
  10. package/dist/types/operations/analytics.d.ts +27 -5
  11. package/dist/types/operations/audit-notifications.d.ts +64 -7
  12. package/dist/types/operations/auth.d.ts +12 -4
  13. package/dist/types/operations/backends.d.ts +211 -9
  14. package/dist/types/operations/billing.d.ts +60 -4
  15. package/dist/types/operations/businesses.d.ts +730 -27
  16. package/dist/types/operations/change-sets.d.ts +426 -7
  17. package/dist/types/operations/consumers.d.ts +133 -14
  18. package/dist/types/operations/define.d.ts +16 -5
  19. package/dist/types/operations/environments.d.ts +40 -4
  20. package/dist/types/operations/frontend.d.ts +20 -2
  21. package/dist/types/operations/index.d.ts +3930 -193
  22. package/dist/types/operations/maker-tokens.d.ts +175 -11
  23. package/dist/types/operations/organizations.d.ts +321 -19
  24. package/dist/types/operations/personas.d.ts +98 -8
  25. package/dist/types/operations/plans-usage.d.ts +69 -3
  26. package/dist/types/operations/platform.d.ts +420 -12
  27. package/dist/types/operations/portal.d.ts +409 -16
  28. package/dist/types/operations/promo-codes.d.ts +126 -6
  29. package/dist/types/operations/variables.d.ts +170 -7
  30. package/dist/types/operations/webhooks.d.ts +77 -14
  31. package/dist/types/surface-types.d.ts +25 -3
  32. package/dist/types/transport.d.ts +5 -10
  33. package/dist/types/types.d.ts +382 -411
  34. package/dist/types/version.d.ts +2 -2
  35. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,168 @@ All notable changes to the API client are documented here. This package
4
4
  versions independently from the CLI and the other SDKs. Pre-1.0: minor versions
5
5
  may include breaking changes.
6
6
 
7
+ ## [0.2.0] - 2026-10-14
8
+
9
+ ### Changed
10
+
11
+ - **Breaking:** the last untyped `businesses.*` methods are typed from the zod
12
+ schemas in `@farthershore/contracts/business-contract-response`; no method
13
+ output is `unknown`, a loose record or an index signature any more.
14
+ `routes.read` → `BusinessRouteList` (one row per route, no compiled row
15
+ `id`), `contract.read` → `BusinessContract` (limits and meters typed),
16
+ `config.read` → `BusinessConfig` (`state: accepted | none | unreadable`,
17
+ the contract as `AcceptedBusinessContract` without an upstream credential's
18
+ token; no `ok`, contract hash or raw sync error; `githubSha` → `commitSha`,
19
+ `githubSyncStatus` → `repositorySyncStatus`), `configAttempts.read` →
20
+ `BusinessConfigAttemptList` (no raw proposal or payload), `status` →
21
+ `BusinessStatusResult` (runs report `publishStatus` / `billingStatus`;
22
+ applies' phases are `publish` / `billing`; `edgeCoherence` is replaced by
23
+ `serving: { status, coherent, message }`), `compile` →
24
+ `BusinessValidateResult` (was `ManifestCompileResult`; no record id, IR or
25
+ spec hash), `rbac.subjects.read` → `CustomPermissionSubjectList`,
26
+ `rbac.enable`/`disable` → `BusinessRbacUpdateResult`, `brand.uploadAsset` →
27
+ `BrandAssetUploadResult`, `subdomainAvailability.read` →
28
+ `ManagedSubdomainAvailability`. `PaginatedResult` and
29
+ `ManifestCompileDiagnostic` are removed (`BusinessDiagnostic`).
30
+ - **Breaking:** portal service-account / usage-limit and caller-identity
31
+ responses are typed from the zod schemas in
32
+ `@farthershore/contracts/{portal,auth}-response`. Every `portal.*` method
33
+ returns a real type instead of `unknown` (`PortalServiceAccountList`,
34
+ `PortalServiceAccountCreateResult`, …, `PortalUsageLimit(List)`,
35
+ `PortalUsageLimitDeleteResult`); `auth.context.issue` returns
36
+ `ContextTokenIssuance`. `MakerTokenContext` no longer carries `authVersion`;
37
+ `BuilderBootstrapContext` is the closed bootstrap (no `user.clerkUserId`,
38
+ organizations named by `{ id, type, name, slug }`).
39
+ - **Breaking:** operating-agent, bulletin, automation-rule, Knowledge Registry
40
+ and platform-operation responses are typed from the zod schemas in
41
+ `@farthershore/contracts/{agent,automation-rule,knowledge,platform-ops}-response`.
42
+ `AgentSummary`, `AgentStatus`, `AgentRunSummary` and `BulletinPost` are
43
+ closed (agent `config` is the closed `AgentConfig`); `agents.runs.show`
44
+ returns `AgentRunDetail` (was `Record<string, unknown>`); `automationRules.*`,
45
+ `knowledge.*.read`, `platform.resourceCounts.report`, `platform.denials.read`,
46
+ `platform.dependents.read` and `platform.workflowControl.{replay,rollback}`
47
+ return `AutomationRule(List)`, `KnowledgeIndex`, `ResourceCountReport`,
48
+ `DenialExplanation`, `BusinessDependents`, `ReplayResult` and
49
+ `ConfigRollbackPreview` instead of `unknown`. A run's `errorMessage` is a
50
+ fixed description of its `errorCode`; a run detail drops `traceRef` and
51
+ renames `resultJson` / `traceJson` to `result` / `trace`; an action receipt
52
+ carries `summary` / `reason` instead of its stored result. A config rollback
53
+ preview reports `currentCommitSha` (was `currentGithubSha`).
54
+ - **Breaking:** analytics, usage, plan-list and billing-connection responses
55
+ are typed from `@farthershore/contracts/{analytics,usage,billing}-response`.
56
+ `analytics.timeseries` / `latency` / `top` / `log` return their verb's
57
+ `{ result }` (`AnalyticsTimeseriesResult`, `AnalyticsPercentilesResult`,
58
+ `AnalyticsTopKResult`, `AnalyticsEventFeedResult`; `analytics.query` returns
59
+ `AnalyticsQueryResult`); `plans.read` returns `PlanList`, `usage.read`
60
+ `UsageSummary`, `usage.limits` `ManagementUsageLimitList`,
61
+ `billing.stripe.read` `StripeConnectionStatus`, `billing.stripe.delete`
62
+ `StripeDisconnectResult`, and `billing.taxSettings.read` / `update`
63
+ `TaxSettings` (all were `unknown`). Event-feed rows carry `request` instead
64
+ of the archived `payload`; the usage summary's `activeRuntimeKeys` is
65
+ `activeApiKeys`; usage limits name `plan: { key, version }` instead of
66
+ subscription and plan-version ids; the Stripe status has no account id.
67
+ - **Breaking:** variables, frontend, audit-log and notification-preference
68
+ responses are typed from the zod schemas in
69
+ `@farthershore/contracts/variable-response`, `frontend-response`,
70
+ `audit-log-response` and `communication`. `frontend.status` returns
71
+ `FrontendStatusResult`, `frontend.rollback` `FrontendRollbackResult` (a
72
+ preview `FrontendRollbackPreview`), `auditLogs.read` /
73
+ `auditLogs.business.read` `AuditLogPage`, and
74
+ `notifications.preferences.*` `NotificationPreferences`, instead of
75
+ `unknown`. `BusinessVariableRow` and `SecretMutationOperation` are generated
76
+ and closed: an operation drops `mutationId`, `state` and `result`, and its
77
+ `impact` is `{ integrations, subscriberCount }`; `generation` is `version`
78
+ on both. Frontend status renames
79
+ `activeReleaseHash` to `activeReleaseId` and a build's `manifestHash` to
80
+ `releaseId`.
81
+ - **Breaking:** `waitForFrontendBuild` reads the typed status (no `data`
82
+ envelope fallback); `BuildWaitResult.status` is the build status union (or
83
+ `UNKNOWN`). `readBuildDiagnostics` is removed: a build's `diagnostics` are
84
+ already typed.
85
+
86
+ - **Breaking:** agreement, promo-code and test-persona responses are typed from
87
+ the zod schemas in `@farthershore/contracts/{agreement,promo-code,persona}-response`.
88
+ `EconomicAgreement`, `SubjectPins` and `PromoCode` are closed; `AgreementPreview`
89
+ splits into `AgreementCreatePreview` / `AgreementAmendPreview` (typed effects);
90
+ `agreements.read` returns `EconomicAgreementList`; `personas.bootstrap`,
91
+ `personas.read`, `personas.rotate` and `personas.delete` return
92
+ `TestPersonaBootstrapResult`, `TestPersonaList`, `TestPersonaRotateResult` and
93
+ `TestPersonaDeleteResult` instead of `unknown`. `personas.bootstrap` no longer
94
+ takes `compiledPlanId` (pass `planKey`).
95
+ - **Breaking:** change set and Apply Timeline responses are typed from the zod
96
+ schemas in `@farthershore/contracts/change-set-response`.
97
+ `changeSets.propose` / `preview` / `proposalRead` return `ChangeSet`,
98
+ `proposalList` returns `ChangeSetList` (all were `unknown`), and a
99
+ `propose(…, { dryRun: true })` preview is typed `ChangeSetProposePreview`.
100
+ `ApplyTimelineEntry` / `ApplyTimelineEntryList` are closed and generated (the
101
+ list carries `environmentId`; apply phases are `publish` and `billing`).
102
+ - **Breaking:** organization and maker-token responses are typed from the zod
103
+ schemas in `@farthershore/contracts/organization-response` and
104
+ `maker-token-response`. Every `organizations.*` and `makerTokens.*` method
105
+ returns a real type instead of `unknown` (`OrganizationList`,
106
+ `OrganizationMembers`, `OrganizationRoleList`, `OrganizationOverview`,
107
+ `OrganizationBulletin`, `MakerTokenList`, `OrgMakerTokenCreateResult`,
108
+ `MakerTokenRotation`, …). `organizations.invitation.create` no longer
109
+ returns the accept token (it goes to the invitee by email only), so its
110
+ `meta.oneTimeSecret` is now `false` (code mode no longer gates or redacts it);
111
+ `makerTokens.create` takes a typed `businessScope`.
112
+ - **Breaking:** environment responses are typed from the zod schemas in
113
+ `@farthershore/contracts/environment-response`. `EnvironmentSummary` and
114
+ `EnvironmentListResult` are closed (no index signature; `branch` is always a
115
+ string), and `environments.create` returns the new `EnvironmentCreateResult`
116
+ (the environment plus `created` and `branchCreated`) instead of `unknown`.
117
+ - **Breaking:** business responses are typed from the zod schema in
118
+ `@farthershore/contracts` (generated into `src/generated/schemas.ts`).
119
+ `BusinessSummary` is closed (no index signature) and lists exactly what the
120
+ server sends; `businesses.read` / `businesses.rbac.read` return the new
121
+ `BusinessDetail` (with `environments`), `businesses.create` returns
122
+ `BusinessCreateResult` instead of `unknown`, and `businesses.publish` returns
123
+ `PublishBusinessResult` (a `{ dryRun: true }` call resolves to
124
+ `DryRunPreview<PublishBusinessResult>`, also exported as
125
+ `PublishBusinessPreview`). `PublishRelease` is derived from the same schema.
126
+ Each business plan carries `featured`.
127
+ - **Breaking:** backend and runtime-token responses are typed from the zod
128
+ schemas in `@farthershore/contracts/backend-response`. `backends.read` returns
129
+ `BackendList`, `backends.create` returns `BackendCreateResult` (a preview
130
+ resolves to `DryRunPreview<BackendCreatePreview>`), `backends.bind` returns
131
+ `BackendSummary`, `backends.delete` returns
132
+ `BackendDeleteResult`, `runtimeTokens.read` returns `RuntimeTokenList`, and
133
+ `runtimeTokens.mint` / `runtimeTokens.rotate` return `RuntimeTokenIssuance`
134
+ (the one-time plaintext `token`). `RuntimeTokenSummary` is generated from the
135
+ same schema. A backend's lifecycle is one `status` field; `agentStatus`,
136
+ `provisionStatus`, `readinessState` and `originHostname` are gone.
137
+ - **Breaking:** webhook responses are typed from the zod schemas in
138
+ `@farthershore/contracts/webhook-response`. `webhooks.read` returns
139
+ `WebhookEndpointList`, `webhooks.create` returns
140
+ `WebhookEndpointCreateResult` (the one-time signing `secret`),
141
+ `webhooks.update` returns `WebhookEndpointUpdateResult`,
142
+ `webhooks.rotateSecret` returns `WebhookEndpointRotateSecretResult` (the new
143
+ one-time `secret` plus `previousSecretExpiresAt`), `webhooks.delete` returns
144
+ `WebhookEndpointDeleteResult`, `webhooks.delivery.read` returns
145
+ `WebhookDeliveryList`, and `webhooks.eventType.read` returns
146
+ `WebhookEventTypeList`. `WebhookEndpoint`, `WebhookDelivery` and
147
+ `WebhookTestResult` are closed and generated from the same schemas; a
148
+ listed or updated endpoint has no `secret` field. A delivery's `status` is
149
+ `pending`, `success`, `failed` or `dead`; a test result always carries
150
+ `status`, `deliveryId`, `responseBody` and `error` (null when absent).
151
+ - New `webhooks.delivery.get({ businessId, webhookId, deliveryId })` returns
152
+ `WebhookDeliveryResult`: one delivery's metadata, the same fields as the
153
+ list. Neither the event payload nor the endpoint's response body is
154
+ returned (both can carry subscriber PII; no permission gates them yet).
155
+ - **Breaking:** consumer responses are typed from the zod schemas in
156
+ `@farthershore/contracts/consumer-response`. `consumers.read` returns
157
+ `BusinessConsumerList`, `consumers.migrateLatest` returns
158
+ `ConsumerMigrateLatestResult` (was `unknown`), `consumers.role.list` returns
159
+ `ConsumerRbacRoleList` and `consumers.apiKeys.list` returns
160
+ `ConsumerApiKeyList`; the other consumer types are generated from the same
161
+ schemas and closed. A member carries `accountRole` only (the stored `role`
162
+ enum is gone, also from `consumers.roles.assign`, which drops the membership
163
+ `id`). Migrate-latest answers `{ migrated, subscriberId, reason? }` with no
164
+ plan-version or subscription ids. `ConsumerRbacSettingsResult.defaultRoleKey`
165
+ is always present (null when unset).
166
+ - `operation<I, O, W>` takes an optional third type, the preview's `wouldHave`
167
+ when it differs from the output; `DryRunPreview<W>` uses it.
168
+
7
169
  ## [0.1.0] - 2026-10-12
8
170
 
9
171
  ### Added
package/README.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # @farthershore/client
2
2
 
3
- The Farther Shore API client that the `farthershore` CLI and its MCP server
4
- run on: a namespaced, typed operation surface (`fs.runtimeTokens.revoke(…)`)
5
- over an authenticated `fetch` transport with exact retry and outcome
6
- semantics, pluggable credential sources, and typed errors.
7
-
8
- > **Status: `0.1.0`.** Pre-1.0: minor releases may include breaking changes.
9
- > Responses keep today's hand-written types; where none exists yet a method
10
- > returns `unknown`. Runtime schemas follow domain by domain.
3
+ The Farther Shore API client that the `farthershore` CLI runs on: a
4
+ namespaced, typed operation surface (`fs.runtimeTokens.revoke(…)`) over an
5
+ authenticated `fetch` transport with exact retry and outcome semantics,
6
+ pluggable credential sources, and typed errors.
7
+
8
+ > **Status: `0.2.0`.** Pre-1.0: minor releases may include breaking changes.
9
+ > Every response is typed. All but the publish-rollback receipt are generated
10
+ > from the platform's zod schemas (through the API's OpenAPI components), so a
11
+ > field exists in a type exactly when the server sends it.
11
12
 
12
13
  ```sh
13
14
  npm install @farthershore/client
package/dist/index.js CHANGED
@@ -2539,7 +2539,7 @@ var SPECS = {
2539
2539
  },
2540
2540
  "frontend.status": {
2541
2541
  summary: "Show the current frontend release, recent releases, and recent builds (incl. failure reasons)",
2542
- description: "Read a business's current frontend serve state (uiMode, active release hash + producing build, pin flag), the recent SUCCEEDED releases (rollback targets), and the recent builds \u2014 a FAILED build's `error` explains why a deploy didn't go live. Read-only.",
2542
+ description: "Read a business's current frontend serve state (uiMode, active release id + producing build, pin flag), the recent SUCCEEDED releases (rollback targets), and the recent builds \u2014 a FAILED build's `error` explains why a deploy didn't go live. Read-only.",
2543
2543
  destructive: false,
2544
2544
  oneTimeSecret: false,
2545
2545
  preview: false
@@ -2547,7 +2547,7 @@ var SPECS = {
2547
2547
  // DECISION: NEITHER side → destructive. Rollbacks are destructive: they re-activate an older frontend release for every visitor.
2548
2548
  "frontend.rollback": {
2549
2549
  summary: "Roll the business frontend back to a prior release (re-activate its releaseId)",
2550
- description: "Roll a business's frontend back to a prior release by its releaseId (manifest hash, from fs_frontend_status). Flips the live pointer back and pins it. The releaseId must belong to this target's build history.",
2550
+ description: "Roll a business's frontend back to a prior release by its releaseId (from fs_frontend_status). Flips the live pointer back and pins it. The releaseId must belong to this target's build history.",
2551
2551
  destructive: true,
2552
2552
  oneTimeSecret: false,
2553
2553
  preview: true,
@@ -2906,7 +2906,7 @@ var SPECS = {
2906
2906
  },
2907
2907
  "usage.read": {
2908
2908
  summary: "Show usage summary for the last 30 days",
2909
- description: "Read a business's usage summary \u2014 metered request counts and tier utilization. Without environmentId this rolls up EVERY environment. Read-only.",
2909
+ description: "Read a business's usage summary \u2014 request counts (all time and the last 30 days), active API keys, a per-member breakdown, and served requests that can never be rated. Without environmentId this rolls up EVERY environment. Read-only.",
2910
2910
  destructive: false,
2911
2911
  oneTimeSecret: false,
2912
2912
  preview: false,
@@ -2980,7 +2980,7 @@ var SPECS = {
2980
2980
  },
2981
2981
  "analytics.log": {
2982
2982
  summary: "Recent requests \u2014 the live metering signal, newest first",
2983
- description: "The most recent archived events for one business, newest first. Each row's `payload` carries the request detail (path, statusCode, latencyMs, orgId). Read-only.",
2983
+ description: "The most recent archived events for one business, newest first. Each request row's `request` carries the path, status code, subscriber, deny code and final response timing (gateway and backend milliseconds). Read-only.",
2984
2984
  destructive: false,
2985
2985
  oneTimeSecret: false,
2986
2986
  preview: false
@@ -3050,9 +3050,9 @@ var SPECS = {
3050
3050
  // exactly once; invitation reads never return it.
3051
3051
  "organization.invitation.create": {
3052
3052
  summary: "Invite a member to an organization",
3053
- description: "Invite a member to an organization. Returns the raw invitation token once; invitation listings never show it.",
3053
+ description: "Invite a member to an organization. The invitee receives the accept link by email; no response or listing ever carries the invitation token.",
3054
3054
  destructive: false,
3055
- oneTimeSecret: true,
3055
+ oneTimeSecret: false,
3056
3056
  preview: false,
3057
3057
  reconcile: { op: "organization.invitation.list_sent" }
3058
3058
  },
@@ -3209,7 +3209,7 @@ var SPECS = {
3209
3209
  },
3210
3210
  "stripe_connection.read": {
3211
3211
  summary: "Show the Stripe connection a business bills through (business override or org default)",
3212
- description: "Read the Stripe Connect account a business bills through \u2014 a per-business override when present, otherwise the organization default \u2014 including onboarding and tax-enrollment state. Read-only. Connecting Stripe is browser-only and has no tool.",
3212
+ description: "Read whether a business bills through a connected Stripe account \u2014 a per-business override when present, otherwise the organization default \u2014 and whether that account can take charges and card payments. Read-only. Connecting Stripe is browser-only and has no tool.",
3213
3213
  destructive: false,
3214
3214
  oneTimeSecret: false,
3215
3215
  preview: false
@@ -3884,6 +3884,11 @@ var ERROR_CODES = {
3884
3884
  // SSRF -- an attacker's endpoint could 302 to 169.254.169.254 and
3885
3885
  // bypass the runtime DNS check that runs before the initial fetch.
3886
3886
  WEBHOOK_REDIRECTED: "WEBHOOK_REDIRECTED",
3887
+ // A webhook create/update URL refused by the SSRF guard. ONE code and ONE
3888
+ // message for every refusal reason: telling "did not resolve" apart from
3889
+ // "resolves to a private address" (or echoing the address) would let a
3890
+ // caller map Core's internal network through the guard.
3891
+ WEBHOOK_URL_NOT_ALLOWED: "WEBHOOK_URL_NOT_ALLOWED",
3887
3892
  // Business-as-code (A5): contractual product state (plans / pricing /
3888
3893
  // gateway config / meters) is managed in the product's repo; core write
3889
3894
  // routes for it 409 once the product leaves its DRAFT creation window.
@@ -4222,8 +4227,14 @@ var verb = (op, name) => operation({
4222
4227
  run: (ctx, { businessId, query }) => runQuery(ctx, businessId, { verb: name, query })
4223
4228
  });
4224
4229
  var analyticsOperations = {
4225
- "analytics.timeseries": verb("analytics.timeseries", "timeseries"),
4226
- "analytics.latency": verb("analytics.latency", "percentiles"),
4230
+ "analytics.timeseries": verb(
4231
+ "analytics.timeseries",
4232
+ "timeseries"
4233
+ ),
4234
+ "analytics.latency": verb(
4235
+ "analytics.latency",
4236
+ "percentiles"
4237
+ ),
4227
4238
  "analytics.top": verb("analytics.top", "topK"),
4228
4239
  "analytics.log": verb("analytics.log", "eventFeed"),
4229
4240
  "analytics.query": operation({
@@ -4410,16 +4421,10 @@ var backendOperations = {
4410
4421
  op: "runtime_token.mint",
4411
4422
  run: (ctx, { businessId, ...data }) => send(ctx, "POST", runtimeTokens(businessId), data)
4412
4423
  }),
4413
- "runtimeTokens.rotate": operation(
4414
- {
4415
- op: "runtime_token.rotate",
4416
- run: (ctx, { businessId, tokenId }) => send(
4417
- ctx,
4418
- "POST",
4419
- `${runtimeTokens(businessId)}/${seg(tokenId)}/rotate`
4420
- )
4421
- }
4422
- ),
4424
+ "runtimeTokens.rotate": operation({
4425
+ op: "runtime_token.rotate",
4426
+ run: (ctx, { businessId, tokenId }) => send(ctx, "POST", `${runtimeTokens(businessId)}/${seg(tokenId)}/rotate`)
4427
+ }),
4423
4428
  "runtimeTokens.revoke": operation({
4424
4429
  op: "runtime_token.revoke",
4425
4430
  run: (ctx, { businessId, tokenId }) => send(ctx, "DELETE", `${runtimeTokens(businessId)}/${seg(tokenId)}`)
@@ -4430,13 +4435,22 @@ var backendOperations = {
4430
4435
  var billingOperations = {
4431
4436
  "billing.stripe.read": operation({
4432
4437
  op: "stripe_connection.read",
4433
- run: (ctx, { businessId }) => send(ctx, "GET", `/businesses/${seg(businessId)}/stripe/status`)
4438
+ run: (ctx, { businessId }) => send(
4439
+ ctx,
4440
+ "GET",
4441
+ `/businesses/${seg(businessId)}/stripe/status`
4442
+ )
4434
4443
  }),
4435
4444
  "billing.stripe.delete": operation({
4436
4445
  op: "stripe_connection.delete",
4437
- run: (ctx, { businessId, deleteAccount }) => send(ctx, "POST", `/businesses/${seg(businessId)}/stripe/disconnect`, {
4438
- deleteAccount: deleteAccount === true
4439
- })
4446
+ run: (ctx, { businessId, deleteAccount }) => send(
4447
+ ctx,
4448
+ "POST",
4449
+ `/businesses/${seg(businessId)}/stripe/disconnect`,
4450
+ {
4451
+ deleteAccount: deleteAccount === true
4452
+ }
4453
+ )
4440
4454
  }),
4441
4455
  "billing.taxSettings.read": operation({
4442
4456
  op: "tax_settings.read",
@@ -4797,6 +4811,7 @@ var environmentOperations = {
4797
4811
  op: "environment.create",
4798
4812
  run: (ctx, { businessId, ...data }) => send(ctx, "POST", environments(businessId), data)
4799
4813
  }),
4814
+ /** Resolves with no body; an environment already gone also resolves. */
4800
4815
  "environments.delete": operation({
4801
4816
  op: "environment.delete",
4802
4817
  run: (ctx, { businessId, environment }) => send(ctx, "DELETE", `${environments(businessId)}/${seg(environment)}`)
@@ -5493,6 +5508,16 @@ var webhookOperations = {
5493
5508
  offset: num(offset)
5494
5509
  })
5495
5510
  )
5511
+ }),
5512
+ "webhooks.delivery.get": operation({
5513
+ op: "webhook.delivery.read",
5514
+ summary: "Show one delivery attempt for a webhook endpoint",
5515
+ pagination: null,
5516
+ run: (ctx, { businessId, webhookId, deliveryId }) => send(
5517
+ ctx,
5518
+ "GET",
5519
+ `${webhook(businessId, webhookId)}/deliveries/${seg(deliveryId)}`
5520
+ )
5496
5521
  })
5497
5522
  };
5498
5523
 
@@ -5963,23 +5988,8 @@ async function poll(options) {
5963
5988
  }
5964
5989
 
5965
5990
  // src/helpers/wait-for-frontend-build.ts
5966
- var SUCCESS = /* @__PURE__ */ new Set(["SUCCEEDED", "SUCCESS"]);
5967
- var FAILURE = /* @__PURE__ */ new Set(["FAILED", "ERROR", "CANCELLED", "TIMED_OUT"]);
5991
+ var FAILURE = /* @__PURE__ */ new Set(["FAILED", "CANCELLED"]);
5968
5992
  var SUPERSEDED = "SUPERSEDED";
5969
- function readBuilds(payload) {
5970
- const data = payload?.data ?? payload;
5971
- const builds = data?.builds;
5972
- return Array.isArray(builds) ? builds : [];
5973
- }
5974
- function readServingStatus(payload) {
5975
- const data = payload?.data ?? payload;
5976
- const status = data?.status;
5977
- return {
5978
- activeBuildId: str(status?.activeBuildId),
5979
- uiMode: str(status?.uiMode)
5980
- };
5981
- }
5982
- var str = (v) => typeof v === "string" ? v : null;
5983
5993
  async function waitForFrontendBuild(source, input) {
5984
5994
  const intervalMs = input.intervalMs ?? 5e3;
5985
5995
  const sleep = input.sleep ?? sleepFor;
@@ -5992,6 +6002,7 @@ async function waitForFrontendBuild(source, input) {
5992
6002
  buildId: input.buildId ?? null,
5993
6003
  ref: null,
5994
6004
  error: null,
6005
+ diagnostics: [],
5995
6006
  activated: false,
5996
6007
  activeBuildId: null,
5997
6008
  timedOut: false
@@ -6009,39 +6020,40 @@ async function waitForFrontendBuild(source, input) {
6009
6020
  },
6010
6021
  signal ? { signal } : void 0
6011
6022
  );
6012
- const builds = readBuilds(payload).filter(
6013
- (build) => input.ref === void 0 || str(build.ref) === input.ref
6023
+ const builds = payload.builds.filter(
6024
+ (build) => input.ref === void 0 || build.ref === input.ref
6014
6025
  );
6015
- const serving = readServingStatus(payload);
6026
+ const serving = payload.status;
6016
6027
  const firstUnpinnedPoll = !baselined;
6017
6028
  if (firstUnpinnedPoll) {
6018
6029
  baselined = true;
6019
6030
  for (const build of builds) {
6020
- unpinnedBaselineIds.add(str(build.id));
6031
+ unpinnedBaselineIds.add(build.id);
6021
6032
  }
6022
6033
  }
6023
- const eligibleBuilds = input.buildId == null && input.ref === void 0 ? builds.filter((build) => !unpinnedBaselineIds.has(str(build.id))) : builds;
6024
- const row = (followId ? builds.find((b) => str(b.id) === followId) : void 0) ?? eligibleBuilds[0];
6034
+ const eligibleBuilds = input.buildId == null && input.ref === void 0 ? builds.filter((build) => !unpinnedBaselineIds.has(build.id)) : builds;
6035
+ const row = (followId ? builds.find((b) => b.id === followId) : void 0) ?? eligibleBuilds[0];
6025
6036
  if (row) {
6026
- const status = str(row.status) ?? "UNKNOWN";
6027
- const rowId = str(row.id);
6037
+ const status = row.status;
6038
+ const rowId = row.id;
6028
6039
  last = {
6029
6040
  status,
6030
6041
  buildId: rowId,
6031
- ref: str(row.ref),
6032
- error: str(row.error),
6042
+ ref: row.ref,
6043
+ error: row.error,
6044
+ diagnostics: row.diagnostics,
6033
6045
  activated: serving.uiMode === "custom-react" && serving.activeBuildId !== null && serving.activeBuildId === rowId,
6034
6046
  activeBuildId: serving.activeBuildId,
6035
6047
  timedOut: false
6036
6048
  };
6037
- if (followId === null && rowId !== null) followId = rowId;
6049
+ if (followId === null) followId = rowId;
6038
6050
  if (FAILURE.has(status)) return last;
6039
- if (SUCCESS.has(status) && last.activated) return last;
6051
+ if (status === "SUCCEEDED" && last.activated) return last;
6040
6052
  if (status === SUPERSEDED) {
6041
6053
  const successor = eligibleBuilds.find(
6042
- (b) => str(b.ref) === str(row.ref) && str(b.id) !== str(row.id)
6054
+ (b) => b.ref === row.ref && b.id !== row.id
6043
6055
  );
6044
- followId = successor ? str(successor.id) : null;
6056
+ followId = successor ? successor.id : null;
6045
6057
  }
6046
6058
  }
6047
6059
  if (now() >= deadline) return { ...last, timedOut: true };
@@ -6092,7 +6104,7 @@ function diagnosticsOf(parsed) {
6092
6104
  }
6093
6105
 
6094
6106
  // src/version.ts
6095
- var CLIENT_VERSION = "0.1.0";
6107
+ var CLIENT_VERSION = "0.2.0";
6096
6108
  var CLIENT_PRODUCT = `@farthershore/client/${CLIENT_VERSION}`;
6097
6109
 
6098
6110
  // src/transport.ts
@@ -107,7 +107,7 @@ export interface FartherShoreApi {
107
107
  /**
108
108
  * Recent requests — the live metering signal, newest first
109
109
  *
110
- * The most recent archived events for one business, newest first. Each row's `payload` carries the request detail (path, statusCode, latencyMs, orgId). Read-only.
110
+ * The most recent archived events for one business, newest first. Each request row's `request` carries the path, status code, subscriber, deny code and final response timing (gateway and backend milliseconds). Read-only.
111
111
  *
112
112
  * Operation `analytics.log` · read · requires `analytics:read`.
113
113
  */
@@ -272,7 +272,7 @@ export interface FartherShoreApi {
272
272
  /**
273
273
  * Show the Stripe connection a business bills through (business override or org default)
274
274
  *
275
- * Read the Stripe Connect account a business bills through — a per-business override when present, otherwise the organization default — including onboarding and tax-enrollment state. Read-only. Connecting Stripe is browser-only and has no tool.
275
+ * Read whether a business bills through a connected Stripe account — a per-business override when present, otherwise the organization default — and whether that account can take charges and card payments. Read-only. Connecting Stripe is browser-only and has no tool.
276
276
  *
277
277
  * Operation `stripe_connection.read` · read · requires `stripe_connection:read`.
278
278
  */
@@ -713,7 +713,7 @@ export interface FartherShoreApi {
713
713
  /**
714
714
  * Roll the business frontend back to a prior release (re-activate its releaseId)
715
715
  *
716
- * Roll a business's frontend back to a prior release by its releaseId (manifest hash, from fs_frontend_status). Flips the live pointer back and pins it. The releaseId must belong to this target's build history.
716
+ * Roll a business's frontend back to a prior release by its releaseId (from fs_frontend_status). Flips the live pointer back and pins it. The releaseId must belong to this target's build history.
717
717
  *
718
718
  * Operation `frontend.rollback` · write · requires `frontend:rollback` · destructive · supports `dryRun` · reconcile an unknown outcome with `frontend.status`.
719
719
  */
@@ -721,7 +721,7 @@ export interface FartherShoreApi {
721
721
  /**
722
722
  * Show the current frontend release, recent releases, and recent builds (incl. failure reasons)
723
723
  *
724
- * Read a business's current frontend serve state (uiMode, active release hash + producing build, pin flag), the recent SUCCEEDED releases (rollback targets), and the recent builds — a FAILED build's `error` explains why a deploy didn't go live. Read-only.
724
+ * Read a business's current frontend serve state (uiMode, active release id + producing build, pin flag), the recent SUCCEEDED releases (rollback targets), and the recent builds — a FAILED build's `error` explains why a deploy didn't go live. Read-only.
725
725
  *
726
726
  * Operation `frontend.status` · read · requires `frontend:read`.
727
727
  */
@@ -850,9 +850,9 @@ export interface FartherShoreApi {
850
850
  /**
851
851
  * Invite a member to an organization
852
852
  *
853
- * Invite a member to an organization. Returns the raw invitation token once; invitation listings never show it.
853
+ * Invite a member to an organization. The invitee receives the accept link by email; no response or listing ever carries the invitation token.
854
854
  *
855
- * Operation `organization.invitation.create` · write · requires `organization_invitation:create` · returns a one-time secret · reconcile an unknown outcome with `organization.invitation.list_sent`.
855
+ * Operation `organization.invitation.create` · write · requires `organization_invitation:create` · reconcile an unknown outcome with `organization.invitation.list_sent`.
856
856
  */
857
857
  readonly create: Method<"organizations.invitation.create">;
858
858
  /**
@@ -1219,7 +1219,7 @@ export interface FartherShoreApi {
1219
1219
  /**
1220
1220
  * Show usage summary for the last 30 days
1221
1221
  *
1222
- * Read a business's usage summary — metered request counts and tier utilization. Without environmentId this rolls up EVERY environment. Read-only.
1222
+ * Read a business's usage summary — request counts (all time and the last 30 days), active API keys, a per-member breakdown, and served requests that can never be rated. Without environmentId this rolls up EVERY environment. Read-only.
1223
1223
  *
1224
1224
  * Operation `usage.read` · read · requires `usage:read`.
1225
1225
  */
@@ -1295,6 +1295,12 @@ export interface FartherShoreApi {
1295
1295
  */
1296
1296
  readonly delete: Method<"webhooks.delete">;
1297
1297
  readonly delivery: {
1298
+ /**
1299
+ * Show one delivery attempt for a webhook endpoint
1300
+ *
1301
+ * Operation `webhook.delivery.read` · read · requires `webhook:delivery_read`.
1302
+ */
1303
+ readonly get: Method<"webhooks.delivery.get">;
1298
1304
  /**
1299
1305
  * List recent delivery attempts for a webhook endpoint
1300
1306
  *