@stackbone/cli 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/main.js CHANGED
@@ -695,7 +695,17 @@ var init_contract$1 = __esmMin((() => {
695
695
  }),
696
696
  runtimeUrl: z.url().nullable().optional()
697
697
  });
698
- })), deploymentStatusSchema, deploymentResponseSchema;
698
+ }));
699
+ //#endregion
700
+ //#region ../../libs/shared/validators/src/lib/agents/deployments.ts
701
+ function protocolOf(raw) {
702
+ try {
703
+ return new URL(raw).protocol;
704
+ } catch {
705
+ return null;
706
+ }
707
+ }
708
+ var deploymentStatusSchema, deploymentUrlSchema, deploymentResponseSchema;
699
709
  var init_deployments = __esmMin((() => {
700
710
  init_organizations();
701
711
  deploymentStatusSchema = z.enum([
@@ -704,11 +714,15 @@ var init_deployments = __esmMin((() => {
704
714
  "ready",
705
715
  "failed"
706
716
  ]);
717
+ deploymentUrlSchema = z.url().refine((raw) => {
718
+ const protocol = protocolOf(raw);
719
+ return protocol === null || protocol === "https:";
720
+ }, { error: (issue) => `scheme "${protocolOf(String(issue.input))}" is not supported — register the box by its https:// address` });
707
721
  z.object({
708
722
  organizationSlug: organizationSlugSchema,
709
723
  agentSlug: agentSlugSchema,
710
724
  installationId: z.uuid(),
711
- url: z.url(),
725
+ url: deploymentUrlSchema,
712
726
  hmacSecret: z.string().min(1),
713
727
  imageTag: z.string().min(1).max(200).optional()
714
728
  });
@@ -15725,7 +15739,7 @@ var emulatorCors = (allowlist) => cors({
15725
15739
  var STACKBONE_CLI_BUILD_VERSION, EMULATOR_CAPABILITY_ROUTES, EMULATOR_CAPABILITIES, buildContractResponse;
15726
15740
  var init_contract = __esmMin((() => {
15727
15741
  init_src$19();
15728
- STACKBONE_CLI_BUILD_VERSION = "0.5.0";
15742
+ STACKBONE_CLI_BUILD_VERSION = "0.5.1";
15729
15743
  EMULATOR_CAPABILITY_ROUTES = {
15730
15744
  "database.postgres_direct": "/api/db",
15731
15745
  "rag.basic": "/api/rag",
@@ -30750,6 +30764,37 @@ var init_types$1 = __esmMin((() => {
30750
30764
  requestBodySchema: z.unknown().optional(),
30751
30765
  /** Original Swagger body parameter name; allows body values alongside query filters. */
30752
30766
  bodyArgName: z.string().optional(),
30767
+ /**
30768
+ * SEND THIS OPERATION'S BODY AS A FORM, not as JSON. The executor then encodes
30769
+ * the same payload as `application/x-www-form-urlencoded` in the bracket
30770
+ * dialect (`metadata[plan]=pro`, `items[0][price]=p_1`). Absent — the case for
30771
+ * every operation of every other connector — the body is JSON, byte for byte
30772
+ * as before.
30773
+ *
30774
+ * Declared on a document as `x-stackbone-body-encoding: form`, the fifth of the
30775
+ * `x-stackbone-*` extensions and read by the same rules: a per-operation
30776
+ * literal, ignored rather than coerced when it is anything else.
30777
+ *
30778
+ * EXPLICIT, NEVER INFERRED FROM THE SPEC'S CONTENT TYPE. A document that
30779
+ * declares `application/x-www-form-urlencoded` under `requestBody.content` is
30780
+ * saying what the provider ACCEPTS, and plenty of specs list several media
30781
+ * types or the wrong one. Switching the serialisation on that reading would
30782
+ * make a spec edit silently change what goes on the wire, which is the
30783
+ * data-corruption class `openapi-introspector.ts` refuses everywhere else.
30784
+ *
30785
+ * ONE declared value rather than a `json` / `form` pair, because a second
30786
+ * spelling of today's default is a second thing that can be got wrong for no
30787
+ * gain: absent already means JSON and always has.
30788
+ *
30789
+ * Per-OPERATION, like the flags above. Stripe is the first provider we want it
30790
+ * for and its API is form-encoded end to end, but a provider that takes a form
30791
+ * on one endpoint and JSON on the next must not have the whole connector
30792
+ * switched over.
30793
+ *
30794
+ * MULTIPART IS NOT HERE. A body of arbitrary bytes with a caller-chosen
30795
+ * content type is what `rawBody` already does.
30796
+ */
30797
+ bodyEncoding: z.literal("form").optional(),
30753
30798
  responseSchema: z.unknown().optional(),
30754
30799
  /**
30755
30800
  * This operation's body is BYTES, not JSON. The executor then resolves the
@@ -31006,7 +31051,7 @@ function hasTopLevelAlternation(pattern) {
31006
31051
  }
31007
31052
  return false;
31008
31053
  }
31009
- var argTargetSchema, triggerCursorSchema, triggerScopeParamSchema, unanchoredPatternReason, triggerListStepSchema, triggerItemStepSchema, declarativePollSchema, strategyPollSchema, pollSpecSchema, triggerDescriptorSchema;
31054
+ var argTargetSchema, triggerCursorSchema, compileAnchored, triggerScopeParamSchema, unanchoredPatternReason, triggerListStepSchema, triggerItemStepSchema, declarativePollSchema, strategyPollSchema, pollSpecSchema, triggerDescriptorSchema;
31010
31055
  var init_trigger_descriptor = __esmMin((() => {
31011
31056
  init_paths();
31012
31057
  argTargetSchema = z.union([z.string(), z.array(z.string()).min(1)], { error: "must be a parameter name (one literal key, dots included) or a non-empty array of path segments to nest it under" });
@@ -31080,7 +31125,25 @@ var init_trigger_descriptor = __esmMin((() => {
31080
31125
  * that is a definition promising a margin the data cannot honour, and a
31081
31126
  * failed tick on the row beats a protection that silently is not there.
31082
31127
  */
31083
- lookbackMs: z.number().int().positive().optional()
31128
+ lookbackMs: z.number().int().positive().optional(),
31129
+ /**
31130
+ * The unit this cursor's stamps are counted in, when they are not ISO date
31131
+ * strings. Stripe is the case: an event's `created` is seconds from the
31132
+ * epoch and the list filter takes the same integer.
31133
+ *
31134
+ * DECLARED, never inferred from the value, and that is the whole point of
31135
+ * the field. `timestamp` already admits numbers — a Supabase
31136
+ * `{cursorColumn}` may resolve to an integer `id` — so reading a 10-digit
31137
+ * number as seconds because it looks like seconds would turn those ids into
31138
+ * instants: the future check would start barring them and the lookback
31139
+ * would start subtracting from them, both silently.
31140
+ *
31141
+ * Absent is every trigger written before this, unchanged: the stamp reader
31142
+ * takes the two ISO shapes and nothing else. Its arithmetic lives in
31143
+ * `parseStamp` / `formatStamp` (`stamps.ts`) and nowhere else — the refine
31144
+ * below names the value only to refuse a margin finer than one tick of it.
31145
+ */
31146
+ unit: z.enum(["unix-seconds"]).optional()
31084
31147
  }), z.object({
31085
31148
  kind: z.literal("opaque"),
31086
31149
  /** Dot-path in the list response to the next opaque token. */
@@ -31097,6 +31160,13 @@ var init_trigger_descriptor = __esmMin((() => {
31097
31160
  */
31098
31161
  lookbackMs: z.never({ error: "lookbackMs is only meaningful on a timestamp cursor: an opaque cursor is a token the provider minted, and there is no instant to move back from" }).optional()
31099
31162
  })]);
31163
+ compileAnchored = (pattern) => {
31164
+ try {
31165
+ return new RegExp(`^(?:${pattern})$`);
31166
+ } catch {
31167
+ return;
31168
+ }
31169
+ };
31100
31170
  triggerScopeParamSchema = z.object({
31101
31171
  /**
31102
31172
  * The list arg the value is written into, and the key the subscription stores
@@ -31134,6 +31204,23 @@ var init_trigger_descriptor = __esmMin((() => {
31134
31204
  /** Placeholder for the field — a real example, not a shape. */
31135
31205
  example: z.string().optional(),
31136
31206
  /**
31207
+ * Values Studio offers while the operator types. SUGGESTIONS, not options:
31208
+ * the field stays free text and anything `pattern` accepts is still valid.
31209
+ *
31210
+ * The distinction is the whole point. Stripe's `type` takes any of the many
31211
+ * event names its API emits, plus a wildcard family — a closed dropdown could
31212
+ * not express `charge.*` and would be a list too long to read either way.
31213
+ * What an operator actually needs is to be shown that `charge.succeeded`
31214
+ * exists before typing `charge.suceeded`, which passes every pattern anyone
31215
+ * would write and then polls green forever, delivering nothing.
31216
+ *
31217
+ * So this is a spelling aid for a value nothing else can check. A connector
31218
+ * whose scope really IS a closed set should say so with a `pattern` that
31219
+ * alternates over it; that refusal happens at register time, where a refusal
31220
+ * belongs, and this field is not a substitute for it.
31221
+ */
31222
+ suggestions: z.array(z.string()).optional(),
31223
+ /**
31137
31224
  * A poll cannot run without a required value, so the register endpoint refuses
31138
31225
  * the link rather than arming one that would fail every tick. An OPTIONAL one
31139
31226
  * left blank is simply not sent, which is how a caller asks for the provider's
@@ -31168,6 +31255,15 @@ var init_trigger_descriptor = __esmMin((() => {
31168
31255
  }
31169
31256
  }, { message: "pattern must be a compilable regular expression" }).optional()
31170
31257
  }).superRefine((param, ctx) => {
31258
+ if (param.pattern !== void 0 && param.suggestions !== void 0) {
31259
+ const anchored = compileAnchored(param.pattern);
31260
+ const refused = anchored === void 0 ? [] : param.suggestions.filter((value) => !anchored.test(value));
31261
+ if (refused.length > 0) ctx.addIssue({
31262
+ code: "custom",
31263
+ path: ["suggestions"],
31264
+ message: `every suggestion must satisfy this param's own \`pattern\` (${param.pattern}), or the field offers a value its register endpoint refuses: ${refused.join(", ")}`
31265
+ });
31266
+ }
31171
31267
  if (param.template === void 0) return;
31172
31268
  if (param.pattern === void 0) {
31173
31269
  ctx.addIssue({
@@ -31217,6 +31313,27 @@ var init_trigger_descriptor = __esmMin((() => {
31217
31313
  * because this is how EVERY GraphQL provider answers, not a Linear quirk.
31218
31314
  */
31219
31315
  errorsPath: z.string().optional(),
31316
+ /**
31317
+ * WHICH END OF THE FEED THIS OPERATION RETURNS FIRST (PLA-1510).
31318
+ *
31319
+ * Documentation only: the engine never sorts, and it delivers `items` in
31320
+ * whatever order the provider gave them. What this changes is the sentence
31321
+ * `scripts/generate-trigger-reference.ts` prints on a trigger's public page,
31322
+ * and through it what an operator planning a backlog drain expects.
31323
+ *
31324
+ * DECLARED, NEVER INFERRED, and never defaulted. The generator used to print
31325
+ * `oldest first` as a literal for every timestamp cursor, which was false for
31326
+ * five of the nine declarative triggers in this catalog — Stripe's event
31327
+ * feed, GitHub's commits and all three Linear triggers come back newest
31328
+ * first. A default would put that same false sentence on any trigger whose
31329
+ * author did not think about it, which is the failure this field exists to
31330
+ * end. Absent, the page says nothing about order, which is the only honest
31331
+ * thing to say about an order nobody established.
31332
+ *
31333
+ * The order matters because the per-tick ceiling is real: a walk that gets
31334
+ * cut off keeps the end it read and passes over the other one.
31335
+ */
31336
+ order: z.enum(["oldest-first", "newest-first"]).optional(),
31220
31337
  /** Page-walk wiring: the request arg that carries the page token + where the
31221
31338
  * next token is read from. Absent for non-paged list operations. */
31222
31339
  pageToken: z.object({
@@ -31286,7 +31403,73 @@ var init_trigger_descriptor = __esmMin((() => {
31286
31403
  * stops on `items.length < stride`, and it also ADVANCES by this, so `0`
31287
31404
  * would re-request page one until the bound (PLA-1142). */
31288
31405
  stride: z.number().int().positive()
31289
- }).optional()
31406
+ }).optional(),
31407
+ /**
31408
+ * Paging by the LAST ITEM THE CALLER ALREADY HOLDS: the next page is
31409
+ * addressed by the data, not by a token the provider hands back. Stripe is
31410
+ * the case — `starting_after` takes the id of the last item on the page just
31411
+ * read — and it is the common shape for anything that paginates a
31412
+ * time-ordered feed.
31413
+ *
31414
+ * The engine reads `itemPath` off the LAST element of the page and sends it
31415
+ * as `param` on the next request. Page 0 carries neither, exactly as
31416
+ * `pageToken` sends no token on its first call.
31417
+ *
31418
+ * `hasMorePath` IS REQUIRED HERE, unlike inside `pageToken`, and the
31419
+ * difference is not an oversight. A token walk has the token itself as a
31420
+ * second end signal: a provider that nulls it on the last page ends the walk
31421
+ * with no flag at all. This shape has no such signal — the last item's id is
31422
+ * always there, on the final page as much as on the first — so without a
31423
+ * flag the walk would run to `MAX_PAGES` against the provider's rate limit on
31424
+ * every tick, or stop on an empty page one call too late. A required flag is
31425
+ * also reversible into an optional one; the reverse is not.
31426
+ *
31427
+ * A declared flag that comes back neither `true` nor `false` breaks the walk
31428
+ * WITHOUT draining it, the same rule the token walk follows: the provider
31429
+ * failed to answer, and reading that as "no more" advances the cursor past
31430
+ * pages nobody read.
31431
+ *
31432
+ * Mutually exclusive with the other three shapes.
31433
+ */
31434
+ pageLastId: z.object({
31435
+ /** Request arg carrying the last item's id, e.g. `starting_after`. */
31436
+ param: argTargetSchema,
31437
+ /**
31438
+ * Dot-path, ON AN ITEM, to the value that fills `param` — `id` for
31439
+ * Stripe. Non-empty, because `getPath(item, '')` is the whole item, which
31440
+ * is never a page address.
31441
+ */
31442
+ itemPath: z.string().min(1),
31443
+ /**
31444
+ * Dot-path to the boolean saying another page exists — Stripe's
31445
+ * `has_more`. Read BEFORE asking for the next page, and only `true`
31446
+ * continues the walk.
31447
+ */
31448
+ hasMorePath: z.string().min(1)
31449
+ }).optional(),
31450
+ /**
31451
+ * Where the provider says another page exists, for a list step the engine
31452
+ * CANNOT page — no token in the response, no offset in the request, and no
31453
+ * addressable last item. Stripe USED to be the case here, before `pageLastId`
31454
+ * above existed; it is kept because a provider that reports `has_more` and
31455
+ * exposes no way at all to ask for the next page is still expressible.
31456
+ *
31457
+ * Without this the walk reads one page and reports itself DRAINED, because
31458
+ * the null-token rule is what ends an unpaged walk. The items below that
31459
+ * page are then under the marker the cursor just advanced to, never listed
31460
+ * again, with no warning and a green row — the failure `pageToken`'s own
31461
+ * `hasMorePath` doc calls the worst the intake can have. Declared here, a
31462
+ * page that answers `true` breaks the walk WITHOUT draining it, so the tick
31463
+ * reports it cut off and the loss is at least visible.
31464
+ *
31465
+ * Only for a list step that declares no paging shape: `pageToken` and
31466
+ * `pageLastId` carry their own `hasMorePath`, and `pageNumber` / `pageSkip`
31467
+ * end their walk on a short page and never read this. All are refused below.
31468
+ *
31469
+ * A non-empty path, because `getPath(value, '')` is the whole response —
31470
+ * never a boolean, so an empty path would cut off every tick forever.
31471
+ */
31472
+ hasMorePath: z.string().min(1).optional()
31290
31473
  }).superRefine((list, ctx) => {
31291
31474
  const params = (list.scopeParams ?? []).map((param) => param.param);
31292
31475
  const duplicated = [...new Set(params.filter((name, i) => params.indexOf(name) !== i))];
@@ -31298,13 +31481,23 @@ var init_trigger_descriptor = __esmMin((() => {
31298
31481
  const declared = [
31299
31482
  "pageToken",
31300
31483
  "pageNumber",
31301
- "pageSkip"
31484
+ "pageSkip",
31485
+ "pageLastId"
31302
31486
  ].filter((shape) => list[shape] !== void 0);
31303
31487
  if (declared.length > 1) ctx.addIssue({
31304
31488
  code: "custom",
31305
31489
  path: [declared[1] ?? "pageNumber"],
31306
31490
  message: `a list step declares ONE paging shape, and this one declares ${declared.length} (${declared.join(", ")}): the engine would silently use ${declared[0]} and ignore the rest`
31307
31491
  });
31492
+ if (list.hasMorePath !== void 0 && declared.length > 0) {
31493
+ const shape = declared[0];
31494
+ const ownsAFlag = shape === "pageToken" || shape === "pageLastId";
31495
+ ctx.addIssue({
31496
+ code: "custom",
31497
+ path: ["hasMorePath"],
31498
+ message: ownsAFlag ? `this list step declares ${shape}, which reads its own hasMorePath and never this one — move the flag inside ${shape}, or drop the paging shape` : `this list step declares ${shape}, which ends its walk on a short page and never reads hasMorePath — drop one of the two`
31499
+ });
31500
+ }
31308
31501
  });
31309
31502
  triggerItemStepSchema = z.object({
31310
31503
  /** The OpenAPI `operationId` that fetches one item's full detail. */
@@ -31338,6 +31531,11 @@ var init_trigger_descriptor = __esmMin((() => {
31338
31531
  * absent, the event payload is the raw item verbatim. */
31339
31532
  map: z.record(z.string(), z.string()).optional()
31340
31533
  }).superRefine((spec, ctx) => {
31534
+ if (spec.cursor.kind === "timestamp" && spec.cursor.unit === "unix-seconds" && spec.cursor.lookbackMs !== void 0 && spec.cursor.lookbackMs % 1e3 !== 0) ctx.addIssue({
31535
+ code: "custom",
31536
+ path: ["cursor", "lookbackMs"],
31537
+ message: `a unix-seconds cursor carries whole seconds, so a lookback of ${spec.cursor.lookbackMs}ms floors to ${Math.floor(spec.cursor.lookbackMs / 1e3)}s on the wire — declare a multiple of 1000`
31538
+ });
31341
31539
  const cursor = spec.cursor;
31342
31540
  const cursorParam = cursor.kind === "timestamp" ? cursor.param : cursor.requestParam;
31343
31541
  const clash = spec.list.scopeParams?.find((param) => sameArgTarget([param.param], cursorParam));
@@ -32362,6 +32560,7 @@ var init_github_connector = __esmMin((() => {
32362
32560
  kind: "declarative",
32363
32561
  list: {
32364
32562
  operationId: "listCommits",
32563
+ order: "newest-first",
32365
32564
  args: { "X-GitHub-Api-Version": "2022-11-28" },
32366
32565
  pageNumber: {
32367
32566
  param: "page",
@@ -32481,6 +32680,7 @@ var init_github_connector = __esmMin((() => {
32481
32680
  kind: "declarative",
32482
32681
  list: {
32483
32682
  operationId: "listIssues",
32683
+ order: "oldest-first",
32484
32684
  args: {
32485
32685
  "X-GitHub-Api-Version": "2022-11-28",
32486
32686
  state: "all",
@@ -33226,6 +33426,7 @@ var init_google_drive_connector = __esmMin((() => {
33226
33426
  kind: "declarative",
33227
33427
  list: {
33228
33428
  operationId: "drive.files.list",
33429
+ order: "oldest-first",
33229
33430
  scopeParams: [{
33230
33431
  param: "q",
33231
33432
  displayName: "Folder ID",
@@ -33462,6 +33663,7 @@ var init_linear_connector = __esmMin((() => {
33462
33663
  kind: "declarative",
33463
33664
  list: {
33464
33665
  operationId: "graphql",
33666
+ order: "newest-first",
33465
33667
  args: {
33466
33668
  query: ISSUE_CREATED_DOCUMENT,
33467
33669
  variables: { first: 50 }
@@ -33559,6 +33761,7 @@ var init_linear_connector = __esmMin((() => {
33559
33761
  kind: "declarative",
33560
33762
  list: {
33561
33763
  operationId: "graphql",
33764
+ order: "newest-first",
33562
33765
  args: {
33563
33766
  query: COMMENT_CREATED_DOCUMENT,
33564
33767
  variables: { first: 50 }
@@ -33669,6 +33872,7 @@ var init_linear_connector = __esmMin((() => {
33669
33872
  kind: "declarative",
33670
33873
  list: {
33671
33874
  operationId: "graphql",
33875
+ order: "newest-first",
33672
33876
  args: {
33673
33877
  query: ISSUE_UPDATED_DOCUMENT,
33674
33878
  variables: { first: 50 }
@@ -33931,6 +34135,1020 @@ var init_outlook_app_only_connector = __esmMin((() => {
33931
34135
  };
33932
34136
  }));
33933
34137
  //#endregion
34138
+ //#region ../../libs/shared/connect-registry/src/lib/catalog/stripe/stripe.connector.ts
34139
+ var IDEMPOTENCY_KEY_PARAM, CHARGE_SCHEMA, STRIPE_CONNECTOR;
34140
+ var init_stripe_connector = __esmMin((() => {
34141
+ IDEMPOTENCY_KEY_PARAM = {
34142
+ name: "Idempotency-Key",
34143
+ in: "header",
34144
+ required: false,
34145
+ description: "A caller-chosen key that stays the same on every retry of the same call — a message id, a run id — and different for a genuinely new one. Stripe replays the first response for 24 hours instead of performing the operation again, and refuses a reused key whose arguments changed. Omitted, a retry is a second write.",
34146
+ schema: { type: "string" }
34147
+ };
34148
+ CHARGE_SCHEMA = {
34149
+ type: "object",
34150
+ properties: {
34151
+ id: { type: "string" },
34152
+ object: { type: "string" },
34153
+ amount: {
34154
+ type: "integer",
34155
+ description: "What was charged, in the smallest unit of `currency`."
34156
+ },
34157
+ amount_captured: { type: "integer" },
34158
+ amount_refunded: { type: "integer" },
34159
+ currency: { type: "string" },
34160
+ customer: {
34161
+ type: ["string", "null"],
34162
+ description: "The customer id, or null for a charge made without one."
34163
+ },
34164
+ description: { type: ["string", "null"] },
34165
+ failure_code: { type: ["string", "null"] },
34166
+ failure_message: { type: ["string", "null"] },
34167
+ paid: { type: "boolean" },
34168
+ refunded: { type: "boolean" },
34169
+ receipt_url: { type: ["string", "null"] },
34170
+ payment_intent: { type: ["string", "null"] },
34171
+ status: {
34172
+ type: "string",
34173
+ description: "One of `succeeded`, `pending` or `failed`."
34174
+ },
34175
+ created: { type: "integer" },
34176
+ livemode: { type: "boolean" },
34177
+ metadata: {
34178
+ type: "object",
34179
+ additionalProperties: true
34180
+ }
34181
+ },
34182
+ required: [
34183
+ "id",
34184
+ "object",
34185
+ "amount",
34186
+ "amount_captured",
34187
+ "amount_refunded",
34188
+ "currency",
34189
+ "created",
34190
+ "livemode",
34191
+ "metadata",
34192
+ "paid",
34193
+ "refunded",
34194
+ "status"
34195
+ ]
34196
+ };
34197
+ STRIPE_CONNECTOR = {
34198
+ id: "stripe",
34199
+ displayName: "Stripe",
34200
+ description: "Read a Stripe account — its event feed, its charges, one payment intent, one invoice, one subscription, the dispute on a charge, the balance — and write two things: a payment intent, and a refund. Exposes an `event-received` trigger.",
34201
+ credentialNote: "Create a restricted key (`rk_…`) in your Stripe dashboard with read permission on Events, Charges, Customers, Payment Intents, Balance, Invoices, Subscriptions and Disputes. Tick only the resources your workflows read: a key missing one answers that operation with a 403 and leaves the rest working. If a workflow also creates payment intents or issues refunds, that key needs WRITE on Payment Intents and Refunds too — a read-only key answers those two with a 403.\n\nA full secret key (`sk_…`) works for everything and is the account’s master credential, so it can do a great deal more than this connector asks for.\n\nTwo of the reads follow fields Stripe moved in a recent API version: the subscription behind an invoice, and a subscription’s billing period. Nothing here pins a version, so the account’s own pinned version decides which shape arrives. Check it in the dashboard under Developers before you map those two.\n\nStart with a test-mode key while you wire a workflow up. Test mode and live mode are separate accounts of everything — events, charges, balance — and an event carries `livemode` so a workflow can tell which one it came from.\n\nThe key is held by the broker. It never reaches a workspace or a browser.",
34202
+ logoUrl: "https://t0.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://stripe.com/&size=64",
34203
+ category: "productivity",
34204
+ protocol: "openapi",
34205
+ baseUrl: "https://api.stripe.com",
34206
+ authMode: "api_key",
34207
+ placement: { kind: "bearer" },
34208
+ scopes: [],
34209
+ specSource: {
34210
+ kind: "inline",
34211
+ document: {
34212
+ openapi: "3.1.0",
34213
+ info: {
34214
+ title: "Stripe API (subset)",
34215
+ version: "2026-08-26.dahlia"
34216
+ },
34217
+ servers: [{ url: "https://api.stripe.com" }],
34218
+ paths: {
34219
+ "/v1/events": { get: {
34220
+ operationId: "listEvents",
34221
+ summary: "List the account's events, newest first",
34222
+ description: "The list endpoint behind the `event-received` trigger. Newest first, and Stripe keeps events for 30 days, so this is a recent window and never the account’s whole history. `created[gte]` is the bracketed spelling of Stripe’s `created` range filter and takes seconds from the epoch rather than an ISO string, the same unit every `created` field in this API is measured in. `type` takes one event name or a family with a `*` wildcard; Stripe also accepts a `types` array, which this document does not declare because one query parameter here carries one value.",
34223
+ parameters: [
34224
+ {
34225
+ name: "created[gte]",
34226
+ in: "query",
34227
+ required: false,
34228
+ description: "Only events created at or after this instant, in seconds from the epoch. Inclusive on purpose — the trigger below explains why the strict `created[gt]` is the wrong filter for a whole-second stamp.",
34229
+ schema: { type: "integer" }
34230
+ },
34231
+ {
34232
+ name: "type",
34233
+ in: "query",
34234
+ required: false,
34235
+ description: "One event name (`charge.succeeded`), or a family with a wildcard (`charge.*`). Omitted, every type the account emits is listed.",
34236
+ schema: { type: "string" }
34237
+ },
34238
+ {
34239
+ name: "limit",
34240
+ in: "query",
34241
+ required: false,
34242
+ description: "Events per page, 1 to 100. Stripe sends 10 when this is absent, so a caller that wants a full page has to ask.",
34243
+ schema: { type: "integer" }
34244
+ },
34245
+ {
34246
+ name: "starting_after",
34247
+ in: "query",
34248
+ required: false,
34249
+ description: "The id of the last event on the previous page. Stripe pages by the id you already hold rather than by a token it hands back, which is why `has_more` is the only thing the response says about a next page.",
34250
+ schema: { type: "string" }
34251
+ }
34252
+ ],
34253
+ responses: { "200": {
34254
+ description: "One page of events, newest first.",
34255
+ content: { "application/json": { schema: {
34256
+ type: "object",
34257
+ properties: {
34258
+ object: { type: "string" },
34259
+ url: { type: "string" },
34260
+ has_more: {
34261
+ type: "boolean",
34262
+ description: "Another page exists after this one. Stripe names no next cursor: the caller sends the last id as `starting_after`."
34263
+ },
34264
+ data: {
34265
+ type: "array",
34266
+ items: {
34267
+ type: "object",
34268
+ description: "One event envelope. `data.object` is the API resource the event is about, and its shape follows `type` — a charge for `charge.succeeded`, an invoice for `invoice.created`.",
34269
+ properties: {
34270
+ id: { type: "string" },
34271
+ object: { type: "string" },
34272
+ api_version: { type: ["string", "null"] },
34273
+ created: {
34274
+ type: "integer",
34275
+ description: "Seconds from the epoch. The trigger cursor reads this."
34276
+ },
34277
+ livemode: { type: "boolean" },
34278
+ pending_webhooks: { type: "integer" },
34279
+ type: { type: "string" },
34280
+ request: {
34281
+ type: ["object", "null"],
34282
+ properties: {
34283
+ id: { type: ["string", "null"] },
34284
+ idempotency_key: { type: ["string", "null"] }
34285
+ }
34286
+ },
34287
+ data: {
34288
+ type: "object",
34289
+ properties: {
34290
+ object: {
34291
+ type: "object",
34292
+ additionalProperties: true
34293
+ },
34294
+ previous_attributes: {
34295
+ type: "object",
34296
+ additionalProperties: true,
34297
+ description: "The attributes as they were before the change, on a `*.updated` event only."
34298
+ }
34299
+ },
34300
+ required: ["object"]
34301
+ }
34302
+ },
34303
+ required: [
34304
+ "id",
34305
+ "object",
34306
+ "created",
34307
+ "livemode",
34308
+ "pending_webhooks",
34309
+ "type",
34310
+ "data"
34311
+ ]
34312
+ }
34313
+ }
34314
+ },
34315
+ required: [
34316
+ "object",
34317
+ "data",
34318
+ "has_more",
34319
+ "url"
34320
+ ]
34321
+ } } }
34322
+ } }
34323
+ } },
34324
+ "/v1/customers": { get: {
34325
+ operationId: "listCustomers",
34326
+ summary: "List customers, filtered by email address",
34327
+ description: "Customers, newest first, and the one hop from a person to their payments: every other read here is keyed by a Stripe id, so a workflow that starts from a mail, a form or a chat message has nothing to look up. Feed an id from here to `listCharges`’ `customer` filter.\n\nA LIST and not a lookup, because an email is not unique on a Stripe account: the same address can sit on several customers, created by different integrations or by a checkout that made a new one each time. A caller that reads `data[0]` and acts on it is refunding whichever row Stripe happened to return first. Zero rows is a normal answer too — the sender may simply not be a customer.\n\nOnly exact addresses match. Stripe does not do partial or case-insensitive matching on this filter; its Search API is a different endpoint with its own query language and is not declared here.",
34328
+ parameters: [
34329
+ {
34330
+ name: "email",
34331
+ in: "query",
34332
+ required: false,
34333
+ description: "Only customers whose address is exactly this one. Omitted, the answer is every customer, newest first.",
34334
+ schema: { type: "string" }
34335
+ },
34336
+ {
34337
+ name: "limit",
34338
+ in: "query",
34339
+ required: false,
34340
+ description: "Customers per page, 1 to 100. Stripe defaults it to 10.",
34341
+ schema: { type: "integer" }
34342
+ },
34343
+ {
34344
+ name: "starting_after",
34345
+ in: "query",
34346
+ required: false,
34347
+ description: "The id of the last customer on the previous page.",
34348
+ schema: { type: "string" }
34349
+ }
34350
+ ],
34351
+ responses: { "200": {
34352
+ description: "One page of customers, newest first.",
34353
+ content: { "application/json": { schema: {
34354
+ type: "object",
34355
+ properties: {
34356
+ object: { type: "string" },
34357
+ url: { type: "string" },
34358
+ has_more: { type: "boolean" },
34359
+ data: {
34360
+ type: "array",
34361
+ items: {
34362
+ type: "object",
34363
+ properties: {
34364
+ id: { type: "string" },
34365
+ object: { type: "string" },
34366
+ email: { type: ["string", "null"] },
34367
+ name: { type: ["string", "null"] },
34368
+ created: { type: "integer" },
34369
+ livemode: { type: "boolean" }
34370
+ },
34371
+ required: [
34372
+ "id",
34373
+ "object",
34374
+ "created",
34375
+ "livemode"
34376
+ ]
34377
+ }
34378
+ }
34379
+ },
34380
+ required: [
34381
+ "object",
34382
+ "data",
34383
+ "has_more",
34384
+ "url"
34385
+ ]
34386
+ } } }
34387
+ } }
34388
+ } },
34389
+ "/v1/charges": { get: {
34390
+ operationId: "listCharges",
34391
+ summary: "List the account's charges, newest first",
34392
+ description: "Charges, newest first. Amounts are in the currency’s smallest unit — 4900 in `eur` is 49.00 euros, and a zero-decimal currency like `jpy` has no such factor at all, so nothing may divide by 100 unconditionally. `created[gte]` takes seconds from the epoch, as everywhere else in this API.",
34393
+ parameters: [
34394
+ {
34395
+ name: "created[gte]",
34396
+ in: "query",
34397
+ required: false,
34398
+ description: "Only charges created at or after this instant, in seconds from the epoch.",
34399
+ schema: { type: "integer" }
34400
+ },
34401
+ {
34402
+ name: "customer",
34403
+ in: "query",
34404
+ required: false,
34405
+ description: "Only charges for this customer id (`cus_…`).",
34406
+ schema: { type: "string" }
34407
+ },
34408
+ {
34409
+ name: "payment_intent",
34410
+ in: "query",
34411
+ required: false,
34412
+ description: "Only charges belonging to this payment intent (`pi_…`).",
34413
+ schema: { type: "string" }
34414
+ },
34415
+ {
34416
+ name: "limit",
34417
+ in: "query",
34418
+ required: false,
34419
+ description: "Charges per page, 1 to 100. Stripe defaults it to 10.",
34420
+ schema: { type: "integer" }
34421
+ },
34422
+ {
34423
+ name: "starting_after",
34424
+ in: "query",
34425
+ required: false,
34426
+ description: "The id of the last charge on the previous page.",
34427
+ schema: { type: "string" }
34428
+ }
34429
+ ],
34430
+ responses: { "200": {
34431
+ description: "One page of charges, newest first.",
34432
+ content: { "application/json": { schema: {
34433
+ type: "object",
34434
+ properties: {
34435
+ object: { type: "string" },
34436
+ url: { type: "string" },
34437
+ has_more: { type: "boolean" },
34438
+ data: {
34439
+ type: "array",
34440
+ items: CHARGE_SCHEMA
34441
+ }
34442
+ },
34443
+ required: [
34444
+ "object",
34445
+ "data",
34446
+ "has_more",
34447
+ "url"
34448
+ ]
34449
+ } } }
34450
+ } }
34451
+ } },
34452
+ "/v1/charges/{charge}": { get: {
34453
+ operationId: "getCharge",
34454
+ summary: "Retrieve one charge by id",
34455
+ description: "One charge, by the `ch_…` a workflow already holds. The alternative is walking `listCharges` and matching client-side, which works on a quiet account and stops working on a busy one: the charge falls off the page and the caller reports no amount for a charge that exists. The path parameter is named `charge` because that is what Stripe’s own document calls it.\n\nThe body is the same shape `listCharges` returns as a page item, down to the nullable fields — it is one declaration, so a field readable from the list is readable here.",
34456
+ parameters: [{
34457
+ name: "charge",
34458
+ in: "path",
34459
+ required: true,
34460
+ description: "The charge id, e.g. `ch_3PqR2sC0mNqLxYzA0kL1mN2o`.",
34461
+ schema: { type: "string" }
34462
+ }],
34463
+ responses: { "200": {
34464
+ description: "The charge.",
34465
+ content: { "application/json": { schema: CHARGE_SCHEMA } }
34466
+ } }
34467
+ } },
34468
+ "/v1/payment_intents/{intent}": { get: {
34469
+ operationId: "getPaymentIntent",
34470
+ summary: "Retrieve one payment intent by id",
34471
+ description: "One payment intent. The path parameter is named `intent` because that is what Stripe’s own document calls it; the value is the `pi_…` id.\n\n`client_secret` is left out of the schema below, and that is a note rather than a filter: Stripe returns it on every read of an intent and the broker hands the body back as it arrived. It is the value a browser uses to confirm the payment, so a workflow that keeps it has put a bearer credential for one payment into its own output. Leaving it undeclared says do not reach for it; nothing stops you.",
34472
+ parameters: [{
34473
+ name: "intent",
34474
+ in: "path",
34475
+ required: true,
34476
+ description: "The payment intent id, e.g. `pi_3PqR2sC0mNqLxYzA1cD2eF3g`.",
34477
+ schema: { type: "string" }
34478
+ }],
34479
+ responses: { "200": {
34480
+ description: "The payment intent.",
34481
+ content: { "application/json": { schema: {
34482
+ type: "object",
34483
+ properties: {
34484
+ id: { type: "string" },
34485
+ object: { type: "string" },
34486
+ amount: {
34487
+ type: "integer",
34488
+ description: "What was asked for, in the smallest unit of `currency`."
34489
+ },
34490
+ amount_received: { type: "integer" },
34491
+ currency: { type: "string" },
34492
+ customer: { type: ["string", "null"] },
34493
+ description: { type: ["string", "null"] },
34494
+ capture_method: { type: "string" },
34495
+ confirmation_method: { type: "string" },
34496
+ status: {
34497
+ type: "string",
34498
+ description: "One of `requires_payment_method`, `requires_confirmation`, `requires_action`, `processing`, `requires_capture`, `canceled` or `succeeded`."
34499
+ },
34500
+ created: { type: "integer" },
34501
+ livemode: { type: "boolean" },
34502
+ metadata: {
34503
+ type: "object",
34504
+ additionalProperties: true
34505
+ }
34506
+ },
34507
+ required: [
34508
+ "id",
34509
+ "object",
34510
+ "created",
34511
+ "livemode",
34512
+ "status"
34513
+ ]
34514
+ } } }
34515
+ } }
34516
+ } },
34517
+ "/v1/balance": { get: {
34518
+ operationId: "getBalance",
34519
+ summary: "Retrieve the account balance",
34520
+ description: "The balance, as arrays and not as one number: `available` and `pending` carry an entry per currency, because a Stripe account can hold several at once. An account that takes only euros still answers a one-element array, so a caller reads the entry whose `currency` it wants rather than the first one.",
34521
+ parameters: [],
34522
+ responses: { "200": {
34523
+ description: "The account balance, one entry per currency.",
34524
+ content: { "application/json": { schema: {
34525
+ type: "object",
34526
+ properties: {
34527
+ object: { type: "string" },
34528
+ livemode: { type: "boolean" },
34529
+ available: {
34530
+ type: "array",
34531
+ description: "Funds that can be paid out now, one entry per currency.",
34532
+ items: {
34533
+ type: "object",
34534
+ properties: {
34535
+ amount: { type: "integer" },
34536
+ currency: { type: "string" }
34537
+ },
34538
+ required: ["amount", "currency"]
34539
+ }
34540
+ },
34541
+ pending: {
34542
+ type: "array",
34543
+ description: "Funds not settled yet, one entry per currency.",
34544
+ items: {
34545
+ type: "object",
34546
+ properties: {
34547
+ amount: { type: "integer" },
34548
+ currency: { type: "string" }
34549
+ },
34550
+ required: ["amount", "currency"]
34551
+ }
34552
+ }
34553
+ },
34554
+ required: [
34555
+ "object",
34556
+ "available",
34557
+ "pending"
34558
+ ]
34559
+ } } }
34560
+ } }
34561
+ } },
34562
+ "/v1/invoices/{invoice}": { get: {
34563
+ operationId: "getInvoice",
34564
+ summary: "Retrieve one invoice by id",
34565
+ description: "One invoice, by the `in_…` an event or a workflow already holds. Read it when the snapshot on the event is not enough: an invoice moves through `draft`, `open`, `paid`, `uncollectible` and `void`, and a run that started on `invoice.payment_failed` may be looking at one that has since been paid.\n\nTHE SUBSCRIPTION BEHIND AN INVOICE IS NOT A TOP-LEVEL FIELD. It is `parent.subscription_details.subscription`, and `parent` is null on an invoice nobody subscribed for. THIS DEPENDS ON THE ACCOUNT’S API VERSION: nothing here sends a `Stripe-Version` header, so Stripe serves whatever version the account is pinned to, and an account pinned before `parent` existed answers a top-level `subscription` instead. Read the version in the Stripe dashboard under Developers, and expect the older shape on an account nobody has upgraded. A workflow that wants the subscription reads that path and then calls `getSubscription`.\n\n`lines` is one page of up to ten entries, which is what a read of the invoice returns; an invoice with more has them behind its own endpoint, which this connector does not expose. A workflow that adds up `lines.data` on a longer invoice under-counts, and nothing errors, so check `lines.has_more` before you total anything.",
34566
+ parameters: [{
34567
+ name: "invoice",
34568
+ in: "path",
34569
+ required: true,
34570
+ description: "The invoice id, e.g. `in_1PqR2sC0mNqLxYzA3bC4dE5f`.",
34571
+ schema: { type: "string" }
34572
+ }],
34573
+ responses: { "200": {
34574
+ description: "The invoice.",
34575
+ content: { "application/json": { schema: {
34576
+ type: "object",
34577
+ properties: {
34578
+ id: { type: "string" },
34579
+ object: { type: "string" },
34580
+ number: {
34581
+ type: ["string", "null"],
34582
+ description: "The reference a customer sees. Null until the invoice is finalized."
34583
+ },
34584
+ status: {
34585
+ type: ["string", "null"],
34586
+ description: "One of `draft`, `open`, `paid`, `uncollectible` or `void`."
34587
+ },
34588
+ amount_due: {
34589
+ type: "integer",
34590
+ description: "In the smallest unit of `currency`, like every amount here."
34591
+ },
34592
+ amount_paid: { type: "integer" },
34593
+ amount_remaining: { type: "integer" },
34594
+ total: { type: "integer" },
34595
+ subtotal: { type: "integer" },
34596
+ currency: { type: "string" },
34597
+ customer: { type: ["string", "null"] },
34598
+ customer_email: { type: ["string", "null"] },
34599
+ customer_name: { type: ["string", "null"] },
34600
+ description: { type: ["string", "null"] },
34601
+ collection_method: {
34602
+ type: "string",
34603
+ description: "Either `charge_automatically` or `send_invoice`."
34604
+ },
34605
+ hosted_invoice_url: {
34606
+ type: ["string", "null"],
34607
+ description: "The Stripe-hosted page for this invoice. Null while it is a draft."
34608
+ },
34609
+ invoice_pdf: { type: ["string", "null"] },
34610
+ due_date: { type: ["integer", "null"] },
34611
+ period_start: { type: "integer" },
34612
+ period_end: { type: "integer" },
34613
+ created: { type: "integer" },
34614
+ livemode: { type: "boolean" },
34615
+ metadata: {
34616
+ type: "object",
34617
+ additionalProperties: true
34618
+ },
34619
+ parent: {
34620
+ type: ["object", "null"],
34621
+ description: "What generated this invoice. Null when nothing did.",
34622
+ properties: {
34623
+ type: { type: "string" },
34624
+ subscription_details: {
34625
+ type: ["object", "null"],
34626
+ properties: { subscription: {
34627
+ type: "string",
34628
+ description: "The `sub_…` this invoice bills, which `getSubscription` takes."
34629
+ } }
34630
+ }
34631
+ }
34632
+ },
34633
+ lines: {
34634
+ type: "object",
34635
+ description: "One page of line items, up to ten.",
34636
+ properties: {
34637
+ object: { type: "string" },
34638
+ has_more: { type: "boolean" },
34639
+ data: {
34640
+ type: "array",
34641
+ items: {
34642
+ type: "object",
34643
+ properties: {
34644
+ id: { type: "string" },
34645
+ object: { type: "string" },
34646
+ description: { type: ["string", "null"] },
34647
+ amount: { type: "integer" },
34648
+ currency: { type: "string" },
34649
+ quantity: { type: ["integer", "null"] }
34650
+ },
34651
+ required: [
34652
+ "id",
34653
+ "object",
34654
+ "amount",
34655
+ "currency"
34656
+ ]
34657
+ }
34658
+ }
34659
+ },
34660
+ required: [
34661
+ "object",
34662
+ "data",
34663
+ "has_more"
34664
+ ]
34665
+ }
34666
+ },
34667
+ required: [
34668
+ "id",
34669
+ "object",
34670
+ "amount_due",
34671
+ "amount_paid",
34672
+ "amount_remaining",
34673
+ "total",
34674
+ "subtotal",
34675
+ "currency",
34676
+ "collection_method",
34677
+ "period_start",
34678
+ "period_end",
34679
+ "created",
34680
+ "livemode",
34681
+ "lines"
34682
+ ]
34683
+ } } }
34684
+ } }
34685
+ } },
34686
+ "/v1/subscriptions/{subscription_exposed_id}": { get: {
34687
+ operationId: "getSubscription",
34688
+ summary: "Retrieve one subscription by id",
34689
+ description: "One subscription, by the `sub_…` an event, an invoice or a workflow already holds. The path parameter is named `subscription_exposed_id` because that is what Stripe’s own document calls it; the value is still the `sub_…` id. Read it to answer whether a customer is still paying: `status` is one of `active`, `trialing`, `past_due`, `unpaid`, `canceled`, `incomplete`, `incomplete_expired` or `paused`.\n\nTHE BILLING PERIOD IS ON EACH ITEM, NOT ON THE SUBSCRIPTION. Stripe moved `current_period_start` and `current_period_end` onto the subscription items, because one subscription can bill several prices on different clocks. THIS TOO DEPENDS ON THE ACCOUNT’S API VERSION, for the same reason the invoice’s `parent` does: an account pinned to a version from before the move answers the period on the subscription itself and nothing on the items. A workflow that wants the period reads `items.data[0].current_period_end`, and it should say out loud that it is taking the first item.\n\n`items` IS ONE PAGE. Stripe answers a page of subscription items with `has_more` beside them, and the rest sit behind their own endpoint, which this connector does not expose. A workflow that adds up `items.data` on a subscription carrying more than one page under-counts, and nothing errors, so check `items.has_more` before you total anything.\n\n`cancel_at_period_end` is the field that says a cancellation is scheduled. A subscription with it set is still `active` and still collecting, which is why reading `status` alone answers the wrong question.",
34690
+ parameters: [{
34691
+ name: "subscription_exposed_id",
34692
+ in: "path",
34693
+ required: true,
34694
+ description: "The subscription id, e.g. `sub_1PqR2sC0mNqLxYzA6gH7iJ8k`.",
34695
+ schema: { type: "string" }
34696
+ }],
34697
+ responses: { "200": {
34698
+ description: "The subscription.",
34699
+ content: { "application/json": { schema: {
34700
+ type: "object",
34701
+ properties: {
34702
+ id: { type: "string" },
34703
+ object: { type: "string" },
34704
+ customer: { type: "string" },
34705
+ status: { type: "string" },
34706
+ currency: { type: "string" },
34707
+ collection_method: { type: "string" },
34708
+ description: { type: ["string", "null"] },
34709
+ cancel_at_period_end: { type: "boolean" },
34710
+ cancel_at: { type: ["integer", "null"] },
34711
+ canceled_at: { type: ["integer", "null"] },
34712
+ ended_at: { type: ["integer", "null"] },
34713
+ trial_start: { type: ["integer", "null"] },
34714
+ trial_end: { type: ["integer", "null"] },
34715
+ start_date: { type: "integer" },
34716
+ created: { type: "integer" },
34717
+ latest_invoice: {
34718
+ type: ["string", "null"],
34719
+ description: "The `in_…` of the most recent invoice, which `getInvoice` takes."
34720
+ },
34721
+ livemode: { type: "boolean" },
34722
+ metadata: {
34723
+ type: "object",
34724
+ additionalProperties: true
34725
+ },
34726
+ items: {
34727
+ type: "object",
34728
+ description: "The priced items this subscription bills, and where the billing period lives.",
34729
+ properties: {
34730
+ object: { type: "string" },
34731
+ has_more: { type: "boolean" },
34732
+ data: {
34733
+ type: "array",
34734
+ items: {
34735
+ type: "object",
34736
+ properties: {
34737
+ id: { type: "string" },
34738
+ object: { type: "string" },
34739
+ quantity: { type: "integer" },
34740
+ current_period_start: { type: "integer" },
34741
+ current_period_end: { type: "integer" },
34742
+ price: {
34743
+ type: "object",
34744
+ properties: {
34745
+ id: { type: "string" },
34746
+ currency: { type: "string" },
34747
+ unit_amount: {
34748
+ type: ["integer", "null"],
34749
+ description: "Null on a tiered or metered price, where no single amount exists."
34750
+ },
34751
+ recurring: {
34752
+ type: ["object", "null"],
34753
+ properties: {
34754
+ interval: {
34755
+ type: "string",
34756
+ description: "One of `day`, `week`, `month` or `year`."
34757
+ },
34758
+ interval_count: { type: "integer" }
34759
+ }
34760
+ }
34761
+ },
34762
+ required: ["id", "currency"]
34763
+ }
34764
+ },
34765
+ required: [
34766
+ "id",
34767
+ "object",
34768
+ "current_period_start",
34769
+ "current_period_end",
34770
+ "price"
34771
+ ]
34772
+ }
34773
+ }
34774
+ },
34775
+ required: [
34776
+ "object",
34777
+ "data",
34778
+ "has_more"
34779
+ ]
34780
+ }
34781
+ },
34782
+ required: [
34783
+ "id",
34784
+ "object",
34785
+ "customer",
34786
+ "status",
34787
+ "currency",
34788
+ "collection_method",
34789
+ "cancel_at_period_end",
34790
+ "start_date",
34791
+ "created",
34792
+ "livemode",
34793
+ "items"
34794
+ ]
34795
+ } } }
34796
+ } }
34797
+ } },
34798
+ "/v1/charges/{charge}/dispute": { get: {
34799
+ operationId: "getChargeDispute",
34800
+ summary: "Retrieve the dispute on a charge",
34801
+ description: "The dispute a cardholder raised against a charge, by the `ch_…` the charge event carried. A dispute hangs off its charge rather than standing alone, which is why this reads through the charge and takes no dispute id.\n\nON A `charge.dispute.*` EVENT THE OBJECT IS THE DISPUTE, so the id this operation wants is `data.object.charge` and never `data.object.id`. The latter is a `du_…`, and the call answers 404 with `No dispute for charge: du_…`, a message that points at the wrong mistake.\n\nA CHARGE WITH NO DISPUTE IS AN ERROR AND NOT AN EMPTY ANSWER. Stripe answers 404 with `No dispute for charge: ch_…`, verified against a test account on 2026-09-17. So this is not the way to ask whether a charge was disputed: reach for it on a run started by a `charge.dispute.*` event, or handle the failure.\n\n`evidence_details.due_by` is the deadline, and it is the field the whole operation exists for: miss it and the dispute is lost by default. `is_charge_refundable` says whether refunding is still an option, which usually stops being one once a dispute opens.",
34802
+ parameters: [{
34803
+ name: "charge",
34804
+ in: "path",
34805
+ required: true,
34806
+ description: "The disputed charge id, e.g. `ch_3PqR2sC0mNqLxYzA0kL1mN2o`.",
34807
+ schema: { type: "string" }
34808
+ }],
34809
+ responses: { "200": {
34810
+ description: "The dispute on that charge.",
34811
+ content: { "application/json": { schema: {
34812
+ type: "object",
34813
+ properties: {
34814
+ id: { type: "string" },
34815
+ object: { type: "string" },
34816
+ charge: { type: "string" },
34817
+ payment_intent: { type: ["string", "null"] },
34818
+ amount: {
34819
+ type: "integer",
34820
+ description: "What is being disputed, in the smallest unit of `currency`. It can be less than the charge."
34821
+ },
34822
+ currency: { type: "string" },
34823
+ reason: {
34824
+ type: "string",
34825
+ description: "What the cardholder claimed, such as `fraudulent`, `product_not_received`, `duplicate` or `credit_not_processed`."
34826
+ },
34827
+ status: {
34828
+ type: "string",
34829
+ description: "One of `warning_needs_response`, `warning_under_review`, `warning_closed`, `needs_response`, `under_review`, `won`, `lost` or `prevented`."
34830
+ },
34831
+ is_charge_refundable: { type: "boolean" },
34832
+ created: { type: "integer" },
34833
+ livemode: { type: "boolean" },
34834
+ metadata: {
34835
+ type: "object",
34836
+ additionalProperties: true
34837
+ },
34838
+ evidence_details: {
34839
+ type: "object",
34840
+ properties: {
34841
+ due_by: {
34842
+ type: ["integer", "null"],
34843
+ description: "When evidence has to be submitted. Null while no response is owed."
34844
+ },
34845
+ has_evidence: { type: "boolean" },
34846
+ past_due: { type: "boolean" },
34847
+ submission_count: { type: "integer" }
34848
+ },
34849
+ required: [
34850
+ "has_evidence",
34851
+ "past_due",
34852
+ "submission_count"
34853
+ ]
34854
+ }
34855
+ },
34856
+ required: [
34857
+ "id",
34858
+ "object",
34859
+ "charge",
34860
+ "amount",
34861
+ "currency",
34862
+ "reason",
34863
+ "status",
34864
+ "is_charge_refundable",
34865
+ "created",
34866
+ "livemode",
34867
+ "evidence_details"
34868
+ ]
34869
+ } } }
34870
+ } }
34871
+ } },
34872
+ "/v1/payment_intents": { post: {
34873
+ operationId: "createPaymentIntent",
34874
+ summary: "Create a payment intent",
34875
+ description: "Creates a payment intent — Stripe’s record of an intent to collect money, which a browser then confirms. `amount` is in the currency’s smallest unit, so 4900 with `eur` is 49.00 euros and a zero-decimal currency like `jpy` has no such factor at all. The intent comes back `requires_payment_method`: creating one moves no money and charges nobody, which is why this operation needs no confirmation step here.\n\n`client_secret` is left out of the response schema, and it is worth knowing exactly how little that does. The schema documents an operation; it never filters a response. `connect-action-executor.ts` parses the provider body and returns it whole, and nothing in the broker reads `responseSchema` at all — so Stripe sends the secret and the workflow receives it, declared or not. Logs are a different story: `@stackbone/redaction` masks any key ending in `secret`, so a logged body loses it. A run’s output is not scrubbed, so a workflow that returns this response persists a bearer credential for one payment. Take the fields you need.\n\nIf a workflow of yours also watches this account’s event feed, declare `echoPath: 'id'` on the call and open that workflow with `isOwnEcho('stripe', event.data.object.id)`: creating an intent raises `payment_intent.created` on the feed, and the `pi_…` id is the value both sides can compare. Without it a link scoped to a payment-intent family, pointed at a workflow that creates intents, starts itself again on every lap.",
34876
+ "x-stackbone-body-encoding": "form",
34877
+ parameters: [IDEMPOTENCY_KEY_PARAM],
34878
+ requestBody: {
34879
+ required: true,
34880
+ content: { "application/x-www-form-urlencoded": { schema: {
34881
+ type: "object",
34882
+ properties: {
34883
+ amount: {
34884
+ type: "integer",
34885
+ description: "How much to collect, in the smallest unit of `currency`. 4900 is 49.00 in a two-decimal currency."
34886
+ },
34887
+ currency: {
34888
+ type: "string",
34889
+ description: "Three-letter ISO code, lowercase, e.g. `eur`."
34890
+ },
34891
+ customer: {
34892
+ type: "string",
34893
+ description: "Optional customer id (`cus_…`) to attach the intent to."
34894
+ },
34895
+ description: {
34896
+ type: "string",
34897
+ description: "Free text shown on the payment in the Stripe dashboard."
34898
+ },
34899
+ metadata: {
34900
+ type: "object",
34901
+ additionalProperties: { type: "string" },
34902
+ description: "Arbitrary key/value pairs stored on the intent, sent as `metadata[key]=value`."
34903
+ }
34904
+ },
34905
+ required: ["amount", "currency"]
34906
+ } } }
34907
+ },
34908
+ responses: { "200": {
34909
+ description: "The payment intent, newly created.",
34910
+ content: { "application/json": { schema: {
34911
+ type: "object",
34912
+ properties: {
34913
+ id: { type: "string" },
34914
+ object: { type: "string" },
34915
+ amount: { type: "integer" },
34916
+ amount_received: { type: "integer" },
34917
+ currency: { type: "string" },
34918
+ customer: { type: ["string", "null"] },
34919
+ description: { type: ["string", "null"] },
34920
+ status: {
34921
+ type: "string",
34922
+ description: "A freshly created intent is `requires_payment_method` until something confirms it."
34923
+ },
34924
+ created: { type: "integer" },
34925
+ livemode: { type: "boolean" },
34926
+ metadata: {
34927
+ type: "object",
34928
+ additionalProperties: true
34929
+ }
34930
+ },
34931
+ required: [
34932
+ "id",
34933
+ "object",
34934
+ "created",
34935
+ "livemode",
34936
+ "status"
34937
+ ]
34938
+ } } }
34939
+ } }
34940
+ } },
34941
+ "/v1/refunds": { post: {
34942
+ operationId: "createRefund",
34943
+ summary: "Refund a charge or a payment intent",
34944
+ description: "Gives money back. Name one of `charge` or `payment_intent`, never both — Stripe refuses the pair rather than picking one. Omit `amount` to refund the whole thing; supply it, in the smallest unit, for a partial refund. Two calls are two refunds: nothing about the arguments makes a repeat a no-op, and the second fails only once the charge has nothing left to give back. Send `Idempotency-Key` to make a retry safe — see the parameter. If a workflow of yours also watches this account's event feed, declare `echoPath: 'charge'` on the call and open that workflow with `isOwnEcho('stripe', event.data.object.id)`: a refund raises `charge.refunded` on the feed, and the charge id is the value both sides can compare.\n\n`reason` takes exactly `duplicate`, `fraudulent` or `requested_by_customer`. Any other string is refused, so it is an enum rather than free text.",
34945
+ "x-stackbone-body-encoding": "form",
34946
+ parameters: [IDEMPOTENCY_KEY_PARAM],
34947
+ requestBody: {
34948
+ required: true,
34949
+ content: { "application/x-www-form-urlencoded": { schema: {
34950
+ type: "object",
34951
+ properties: {
34952
+ charge: {
34953
+ type: "string",
34954
+ description: "The charge to refund (`ch_…`). Mutually exclusive with `payment_intent`."
34955
+ },
34956
+ payment_intent: {
34957
+ type: "string",
34958
+ description: "The payment intent to refund (`pi_…`). Mutually exclusive with `charge`."
34959
+ },
34960
+ amount: {
34961
+ type: "integer",
34962
+ description: "How much to give back, in the smallest unit. Omitted refunds the full amount."
34963
+ },
34964
+ reason: {
34965
+ type: "string",
34966
+ enum: [
34967
+ "duplicate",
34968
+ "fraudulent",
34969
+ "requested_by_customer"
34970
+ ],
34971
+ description: "Why. Stripe accepts these three strings and no others."
34972
+ },
34973
+ metadata: {
34974
+ type: "object",
34975
+ additionalProperties: { type: "string" },
34976
+ description: "Key/value pairs stored on the refund, as `metadata[key]=value`."
34977
+ }
34978
+ },
34979
+ required: []
34980
+ } } }
34981
+ },
34982
+ responses: { "200": {
34983
+ description: "The refund.",
34984
+ content: { "application/json": { schema: {
34985
+ type: "object",
34986
+ properties: {
34987
+ id: { type: "string" },
34988
+ object: { type: "string" },
34989
+ amount: { type: "integer" },
34990
+ currency: { type: "string" },
34991
+ charge: { type: ["string", "null"] },
34992
+ payment_intent: { type: ["string", "null"] },
34993
+ reason: { type: ["string", "null"] },
34994
+ status: {
34995
+ type: "string",
34996
+ description: "One of `pending`, `succeeded`, `failed` or `canceled`. A card refund in test mode comes back `succeeded` at once."
34997
+ },
34998
+ created: { type: "integer" },
34999
+ metadata: {
35000
+ type: "object",
35001
+ additionalProperties: true
35002
+ }
35003
+ },
35004
+ required: [
35005
+ "id",
35006
+ "object",
35007
+ "created",
35008
+ "status"
35009
+ ]
35010
+ } } }
35011
+ } }
35012
+ } }
35013
+ }
35014
+ }
35015
+ },
35016
+ triggers: [{
35017
+ id: "event-received",
35018
+ displayName: "Stripe event",
35019
+ description: "A Stripe event is the account’s own record of something that happened: a charge succeeded, an invoice was created. This link reads that feed and starts one run per event recorded after you turn it on. The event arrives whole — `type` names what happened, and `data.object` carries the thing it happened to.",
35020
+ docs: "Starts a run for each event Stripe records on the account, from the moment you turn the link on. The event arrives whole: `type` names what happened, and the object it happened to rides along with it. That object is a charge on a charge.succeeded event and an invoice on an invoice.created one, so a mapping that reads a charge field belongs on a link scoped to charge events.\n\nEvent type takes one name, or a family with a wildcard such as `charge.*`. Left blank, every type the account emits starts a run.\n\nTest mode and live mode are separate feeds. A test key sees only test events, and every event carries a `livemode` flag saying which feed it came from.\n\nCAUTION: a poll walks page after page until Stripe says there are no more, and stops at 10,000 events. Reaching that ceiling marks the tick cut off, so the loss is on the record rather than silent, but those events do not arrive on a later poll. Only a very busy account gets near it.\n\nCAUTION: Stripe keeps events for 30 days. A link switched off for longer resumes from a bookmark older than anything the feed still holds, and whatever expired in the meantime never arrives.\n\nCAUTION: this connector writes, and a workflow that creates a payment intent or issues a refund through this connection raises events on the very feed this link reads. A refund raises a charge.refunded event, so a link scoped to `charge.*` that also refunds starts itself again, and deduplication cannot stop it because every lap carries a new event id. There are two guards. The cheap one is the scope: keep the writing workflow off the types its own writes raise. That is why the event type field offers no charge or payment intent wildcard, though it still accepts one you type yourself. The other guard is `isOwnEcho` inside the workflow body, which compares a value the delivery carried against one your own write recorded. Declare an echo path on the write so it records the charge id, or the payment intent id, and compare it against the id the event object carries. Compare the resource id and never the event id, which is new on every lap and would match nothing. The `createRefund` and `createPaymentIntent` pages name the exact paths. A mapping cannot skip an event: every delivery starts a run.",
35021
+ sampleData: {
35022
+ id: "evt_1PqR2sC0mNqLxYzA3bK4dEf5",
35023
+ object: "event",
35024
+ api_version: "2026-08-26.dahlia",
35025
+ created: 1757836921,
35026
+ livemode: false,
35027
+ pending_webhooks: 0,
35028
+ request: {
35029
+ id: "req_9fT2kQwZ1aBcDe",
35030
+ idempotency_key: null
35031
+ },
35032
+ type: "charge.succeeded",
35033
+ data: { object: {
35034
+ id: "ch_3PqR2sC0mNqLxYzA0kL1mN2o",
35035
+ object: "charge",
35036
+ amount: 4900,
35037
+ amount_captured: 4900,
35038
+ amount_refunded: 0,
35039
+ currency: "eur",
35040
+ customer: "cus_QhT8kLmNoPqRs",
35041
+ description: "Stackbone Pro, monthly",
35042
+ paid: true,
35043
+ refunded: false,
35044
+ receipt_url: "https://pay.stripe.com/receipts/payment/example",
35045
+ payment_intent: "pi_3PqR2sC0mNqLxYzA1cD2eF3g",
35046
+ status: "succeeded",
35047
+ created: 1757836920,
35048
+ livemode: false,
35049
+ metadata: { workspace: "stackbone-demo" }
35050
+ } }
35051
+ },
35052
+ outputSchema: {
35053
+ type: "object",
35054
+ properties: {
35055
+ id: { type: "string" },
35056
+ object: { type: "string" },
35057
+ api_version: { type: ["string", "null"] },
35058
+ created: {
35059
+ type: "integer",
35060
+ description: "When Stripe recorded the event, in seconds from the epoch."
35061
+ },
35062
+ livemode: {
35063
+ type: "boolean",
35064
+ description: "False for an event from test mode, true for one from live mode."
35065
+ },
35066
+ pending_webhooks: { type: "integer" },
35067
+ type: { type: "string" },
35068
+ request: {
35069
+ type: ["object", "null"],
35070
+ properties: {
35071
+ id: { type: ["string", "null"] },
35072
+ idempotency_key: { type: ["string", "null"] }
35073
+ }
35074
+ },
35075
+ data: {
35076
+ type: "object",
35077
+ properties: {
35078
+ object: {
35079
+ type: "object",
35080
+ additionalProperties: true
35081
+ },
35082
+ previous_attributes: {
35083
+ type: "object",
35084
+ additionalProperties: true
35085
+ }
35086
+ },
35087
+ required: ["object"]
35088
+ }
35089
+ },
35090
+ required: [
35091
+ "id",
35092
+ "object",
35093
+ "created",
35094
+ "livemode",
35095
+ "pending_webhooks",
35096
+ "type",
35097
+ "data"
35098
+ ]
35099
+ },
35100
+ poll: {
35101
+ kind: "declarative",
35102
+ list: {
35103
+ operationId: "listEvents",
35104
+ args: { limit: 100 },
35105
+ itemsPath: "data",
35106
+ order: "newest-first",
35107
+ pageLastId: {
35108
+ param: "starting_after",
35109
+ itemPath: "id",
35110
+ hasMorePath: "has_more"
35111
+ },
35112
+ scopeParams: [{
35113
+ param: "type",
35114
+ displayName: "Event type",
35115
+ description: "One event name, or a family with a wildcard: `charge.*`. Blank delivers every type the account emits.",
35116
+ example: "charge.succeeded",
35117
+ required: false,
35118
+ pattern: "^[a-z0-9_.*]+$",
35119
+ suggestions: [
35120
+ "charge.succeeded",
35121
+ "charge.failed",
35122
+ "charge.refunded",
35123
+ "charge.dispute.created",
35124
+ "payment_intent.succeeded",
35125
+ "payment_intent.payment_failed",
35126
+ "payment_intent.canceled",
35127
+ "invoice.paid",
35128
+ "invoice.payment_failed",
35129
+ "invoice.*",
35130
+ "customer.subscription.created",
35131
+ "customer.subscription.updated",
35132
+ "customer.subscription.deleted",
35133
+ "customer.subscription.*",
35134
+ "checkout.session.completed",
35135
+ "payout.paid",
35136
+ "payout.failed"
35137
+ ]
35138
+ }]
35139
+ },
35140
+ cursor: {
35141
+ kind: "timestamp",
35142
+ field: "created",
35143
+ param: "created[gte]",
35144
+ unit: "unix-seconds"
35145
+ },
35146
+ dedup: { idPath: "id" }
35147
+ }
35148
+ }]
35149
+ };
35150
+ }));
35151
+ //#endregion
33934
35152
  //#region ../../libs/shared/connect-registry/src/lib/catalog/supabase/supabase.connector.ts
33935
35153
  var SUPABASE_CONNECTOR;
33936
35154
  var init_supabase_connector = __esmMin((() => {
@@ -34033,6 +35251,7 @@ var init_supabase_connector = __esmMin((() => {
34033
35251
  kind: "declarative",
34034
35252
  list: {
34035
35253
  operationId: "GET /{table}",
35254
+ order: "oldest-first",
34036
35255
  args: {
34037
35256
  order: "{cursorColumn}.asc",
34038
35257
  and: "({cursorColumn}.not.is.null)"
@@ -34146,6 +35365,7 @@ var init_built_in_catalog = __esmMin((() => {
34146
35365
  init_linear_connector();
34147
35366
  init_outlook_connector();
34148
35367
  init_outlook_app_only_connector();
35368
+ init_stripe_connector();
34149
35369
  init_supabase_connector();
34150
35370
  init_telegram_connector();
34151
35371
  init_whatsapp_connector();
@@ -34156,6 +35376,7 @@ var init_built_in_catalog = __esmMin((() => {
34156
35376
  LINEAR_CONNECTOR,
34157
35377
  OUTLOOK_CONNECTOR,
34158
35378
  OUTLOOK_APP_ONLY_CONNECTOR,
35379
+ STRIPE_CONNECTOR,
34159
35380
  SUPABASE_CONNECTOR,
34160
35381
  TELEGRAM_CONNECTOR,
34161
35382
  WHATSAPP_CONNECTOR
@@ -34562,6 +35783,7 @@ function buildOperation(rawPath, resolvedPath, method, operation, pathLevelParam
34562
35783
  const rawResponse = declaredRawResponse === true || declaredRawResponse === "when-requested" ? declaredRawResponse : void 0;
34563
35784
  const declaredVersionPath = operation["x-stackbone-version-path"];
34564
35785
  const versionPath = typeof declaredVersionPath === "string" && declaredVersionPath !== "" ? declaredVersionPath : void 0;
35786
+ const bodyEncoding = operation["x-stackbone-body-encoding"] === "form" ? "form" : void 0;
34565
35787
  const continuation = readContinuation(operation);
34566
35788
  return {
34567
35789
  operationId,
@@ -34573,6 +35795,7 @@ function buildOperation(rawPath, resolvedPath, method, operation, pathLevelParam
34573
35795
  ...parameters.length > 0 ? { parameters } : {},
34574
35796
  ...requestBodySchema !== void 0 ? { requestBodySchema } : {},
34575
35797
  ...bodyArgName !== void 0 ? { bodyArgName } : {},
35798
+ ...bodyEncoding !== void 0 ? { bodyEncoding } : {},
34576
35799
  ...responseSchema !== void 0 ? { responseSchema } : {},
34577
35800
  ...rawBody ? { rawBody } : {},
34578
35801
  ...rawResponse !== void 0 ? { rawResponse } : {},
@@ -34806,8 +36029,15 @@ async function mapWithConcurrency(items, limit, fn) {
34806
36029
  var init_concurrency = __esmMin((() => {}));
34807
36030
  //#endregion
34808
36031
  //#region ../../libs/shared/connect-registry/src/lib/triggers/stamps.ts
34809
- /** The instant a stamp names, or `null` for anything that is not a stamp. */
34810
- function parseStamp(value) {
36032
+ /**
36033
+ * The instant a stamp names, or `null` for anything that is not a stamp.
36034
+ *
36035
+ * `unit` is the cursor's declared unit, passed by every caller that has one.
36036
+ * Omitted — the case for every trigger written before units existed — the two
36037
+ * ISO shapes above are the only ones read, exactly as before.
36038
+ */
36039
+ function parseStamp(value, unit) {
36040
+ if (unit === "unix-seconds") return parseUnixSeconds(value);
34811
36041
  if (typeof value !== "string") return null;
34812
36042
  const zoned = EXPLICIT_OFFSET.test(value);
34813
36043
  const zoneless = !zoned && ZONELESS_STAMP.test(value);
@@ -34823,17 +36053,36 @@ function parseStamp(value) {
34823
36053
  }
34824
36054
  };
34825
36055
  }
36056
+ /** A stamp counted in seconds from the epoch, as a number or as its digits. */
36057
+ function parseUnixSeconds(value) {
36058
+ const numeric = typeof value === "number";
36059
+ if (!numeric && !(typeof value === "string" && UNIX_SECONDS.test(value))) return null;
36060
+ const seconds = numeric ? value : Number(value);
36061
+ if (!Number.isSafeInteger(seconds) || Math.abs(seconds) >= 0xe8d4a51000) return null;
36062
+ return {
36063
+ epochMs: seconds * 1e3,
36064
+ shape: {
36065
+ unit: "unix-seconds",
36066
+ numeric
36067
+ }
36068
+ };
36069
+ }
34826
36070
  /** Write an instant in the shape {@link parseStamp} read. */
34827
36071
  function formatStamp(epochMs, shape) {
36072
+ if (shape.unit === "unix-seconds") {
36073
+ const seconds = Math.floor(epochMs / 1e3);
36074
+ return shape.numeric ? seconds : String(seconds);
36075
+ }
34828
36076
  const iso = new Date(epochMs).toISOString();
34829
36077
  const withFraction = shape.fractional ? iso : iso.replace(/\.\d{3}Z$/, "Z");
34830
36078
  if (shape.zoned) return withFraction;
34831
36079
  return withFraction.slice(0, -1).replace("T", shape.separator);
34832
36080
  }
34833
- var EXPLICIT_OFFSET, ZONELESS_STAMP;
36081
+ var EXPLICIT_OFFSET, ZONELESS_STAMP, UNIX_SECONDS;
34834
36082
  var init_stamps = __esmMin((() => {
34835
36083
  EXPLICIT_OFFSET = /(?:Z|[+-]\d{2}:?\d{2})$/i;
34836
36084
  ZONELESS_STAMP = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?$/;
36085
+ UNIX_SECONDS = /^\d{1,12}$/;
34837
36086
  }));
34838
36087
  //#endregion
34839
36088
  //#region ../../libs/shared/connect-registry/src/lib/triggers/list-args.ts
@@ -34871,17 +36120,30 @@ function scopeValue(param, scope) {
34871
36120
  * same filter the stored one did and has to parse the way that one parsed. An
34872
36121
  * offset other than `Z` comes back as `Z`; it names the same instant.
34873
36122
  *
34874
- * @throws on a stored cursor that is not a date stamp — a number, or a string
34875
- * in no shape `parseStamp` reads. The margin is the definition's promise; a
34876
- * cursor it cannot be applied to is that promise unkept, and the failed tick
34877
- * puts the reason on the row where an operator sees it. Sending the cursor
34878
- * unmoved would keep the row green and the margin fictional.
34879
- */
34880
- function withLookback(cursor, stored) {
36123
+ * @throws on a stored cursor the reader cannot take, whenever the definition
36124
+ * claimed it could be read: a declared `unit`, a declared `lookbackMs`, or both
36125
+ * (PLA-1506). Refusing to PARSE a value is not the same as refusing to SEND it,
36126
+ * and sending it is the worse of the two. A `unix-seconds` cursor holding a
36127
+ * 13-digit millisecond value goes out verbatim, matches nothing, never advances,
36128
+ * and every tick after it reports `polled` on a green row — the definition's
36129
+ * promise unkept with nothing anywhere to say so. The failed tick puts the value
36130
+ * on the row where an operator sees it.
36131
+ *
36132
+ * A cursor that declares NEITHER is passed through unread, and has to be: an
36133
+ * opaque provider token, a Supabase integer id, the `'12345'` that
36134
+ * `declarative-poll.spec.ts` pins as passing through untouched. Reading is owed
36135
+ * only where the definition said the value is readable.
36136
+ */
36137
+ function cursorForRequest(cursor, stored) {
34881
36138
  if (stored === null || stored === void 0) return stored;
34882
- if (cursor.kind !== "timestamp" || cursor.lookbackMs === void 0) return stored;
34883
- const stamp = parseStamp(stored);
34884
- if (stamp === null) throw new Error(`trigger declares a cursor lookback of ${cursor.lookbackMs}ms but the stored cursor ${JSON.stringify(stored)} is not a date stamp, so there is nothing to move back — a lookback belongs on a date-stamped cursor only`);
36139
+ if (cursor.kind !== "timestamp") return stored;
36140
+ if (cursor.unit === void 0 && cursor.lookbackMs === void 0) return stored;
36141
+ const stamp = parseStamp(stored, cursor.unit);
36142
+ if (stamp === null) {
36143
+ const value = JSON.stringify(stored);
36144
+ throw new Error(cursor.lookbackMs !== void 0 ? `trigger declares a cursor lookback of ${cursor.lookbackMs}ms but the stored cursor ${value} cannot be read as an instant` + (cursor.unit === void 0 ? ", and this cursor declares no unit, so only an ISO date stamp can be moved back" : ` in the declared unit ${cursor.unit}`) + " — there is nothing to subtract the margin from" : `trigger declares a cursor unit of ${cursor.unit} but the stored cursor ${value} cannot be read in it — sending it on would filter for a moment that is not the one it names, match nothing, and leave the marker where it is on a green row`);
36145
+ }
36146
+ if (cursor.lookbackMs === void 0) return stored;
34885
36147
  return formatStamp(stamp.epochMs - cursor.lookbackMs, stamp.shape);
34886
36148
  }
34887
36149
  /**
@@ -34892,11 +36154,13 @@ function withLookback(cursor, stored) {
34892
36154
  * failed tick.
34893
36155
  * @throws when a scope clause and the cursor clause target one key and the
34894
36156
  * cursor declares no `composeWith` to join them with.
36157
+ * @throws when the stored cursor cannot be read in the unit or shape the
36158
+ * definition declared — see {@link cursorForRequest}.
34895
36159
  */
34896
36160
  function buildListArgs(spec, input) {
34897
36161
  const args = { ...spec.list.args ?? {} };
34898
36162
  const cursorParam = spec.cursor.kind === "timestamp" ? spec.cursor.param : spec.cursor.requestParam;
34899
- const cursor = withLookback(spec.cursor, input.cursor);
36163
+ const cursor = cursorForRequest(spec.cursor, input.cursor);
34900
36164
  const cursorValue = cursor === null || cursor === void 0 ? void 0 : spec.cursor.kind === "timestamp" && spec.cursor.cursorTemplate ? fill(spec.cursor.cursorTemplate, "{cursor}", String(cursor)) : cursor;
34901
36165
  let collidingClause = void 0;
34902
36166
  for (const param of spec.list.scopeParams ?? []) {
@@ -34921,7 +36185,8 @@ function buildListArgs(spec, input) {
34921
36185
  } else if (spec.list.pageNumber) {
34922
36186
  setPath(args, spec.list.pageNumber.pageSizeParam, spec.list.pageNumber.size);
34923
36187
  setPath(args, spec.list.pageNumber.param, page.index + 1);
34924
- } else if (spec.list.pageToken && page.token !== null && page.token !== void 0) setPath(args, spec.list.pageToken.requestParam, page.token);
36188
+ } else if (spec.list.pageLastId && page.lastId !== null && page.lastId !== void 0) setPath(args, spec.list.pageLastId.param, page.lastId);
36189
+ else if (spec.list.pageToken && page.token !== null && page.token !== void 0) setPath(args, spec.list.pageToken.requestParam, page.token);
34925
36190
  return args;
34926
36191
  }
34927
36192
  var init_list_args = __esmMin((() => {
@@ -35027,10 +36292,22 @@ function firstErrorMessage(errors) {
35027
36292
  return String(first);
35028
36293
  }
35029
36294
  }
35030
- function laterOf(a, b) {
36295
+ /**
36296
+ * The later of two markers. With a `unit` declared both sides are read as
36297
+ * INSTANTS, because the lexical fallback below gets a declared unit wrong every
36298
+ * time: `'1757000000'` sorts under `'2026-…'`, so a unix marker would lose to
36299
+ * the ISO value the seed used to mint and the cursor would never move — the
36300
+ * link green, the poll asking for the same window forever.
36301
+ */
36302
+ function laterOf(a, b, unit) {
35031
36303
  const other = typeof b === "string" || typeof b === "number" ? b : void 0;
35032
36304
  if (a === void 0) return other;
35033
36305
  if (other === void 0) return a;
36306
+ if (unit !== void 0) {
36307
+ const left = parseStamp(a, unit);
36308
+ const right = parseStamp(other, unit);
36309
+ if (left !== null && right !== null) return left.epochMs > right.epochMs ? a : other;
36310
+ }
35034
36311
  if (typeof a === "number" && typeof other === "number") return a > other ? a : other;
35035
36312
  return String(a) > String(other) ? a : other;
35036
36313
  }
@@ -35057,14 +36334,15 @@ function laterOf(a, b) {
35057
36334
  * A provider clock running ahead therefore makes the marker trail by the skew
35058
36335
  * and re-list once — which dedup absorbs — rather than stall.
35059
36336
  *
35060
- * Only date STRINGS are judged, and only the two shapes `parseStamp` reads: a
35061
- * numeric cursor is ambiguous (seconds or milliseconds, or a provider's own
35062
- * sequence) and is left alone, and so is anything that is not a date shape —
35063
- * which is what keeps `Date.parse('12345')`, the year 12345, from barring a
35064
- * numeric-looking id. A zoneless stamp is read as UTC; `stamps.ts` says why.
36337
+ * Only values `parseStamp` reads are judged: the two date shapes, plus a number
36338
+ * when the cursor DECLARES its unit. An undeclared numeric cursor is ambiguous
36339
+ * (seconds or milliseconds, or a provider's own sequence) and is left alone, and
36340
+ * so is anything that is not a date shape — which is what keeps
36341
+ * `Date.parse('12345')`, the year 12345, from barring a numeric-looking id. A
36342
+ * zoneless stamp is read as UTC; `stamps.ts` says why.
35065
36343
  */
35066
- function isFuture(value) {
35067
- const stamp = parseStamp(value);
36344
+ function isFuture(value, unit) {
36345
+ const stamp = parseStamp(value, unit);
35068
36346
  return stamp !== null && stamp.epochMs > Date.now();
35069
36347
  }
35070
36348
  /** The greatest value across items AND across every declared field (ISO strings
@@ -35072,14 +36350,15 @@ function isFuture(value) {
35072
36350
  * yet. `undefined` when no item carries a usable value — an item barred from
35073
36351
  * moving the marker is still delivered; it is re-listed until its date arrives,
35074
36352
  * and dedup absorbs that. */
35075
- function latestTimestamp(items, field) {
36353
+ function latestTimestamp(items, field, unit) {
35076
36354
  const fields = typeof field === "string" ? [field] : field;
35077
36355
  let latest;
35078
36356
  for (const item of items) for (const path of fields) {
35079
36357
  const value = getPath(item, path);
35080
36358
  if (typeof value !== "string" && typeof value !== "number") continue;
35081
- if (isFuture(value)) continue;
35082
- latest = laterOf(value, latest);
36359
+ if (unit !== void 0 && parseStamp(value, unit) === null) continue;
36360
+ if (isFuture(value, unit)) continue;
36361
+ latest = laterOf(value, latest, unit);
35083
36362
  }
35084
36363
  return latest;
35085
36364
  }
@@ -35093,6 +36372,7 @@ function createDeclarativePoll(spec) {
35093
36372
  const rawItems = [];
35094
36373
  let opaqueNext;
35095
36374
  let pageToken;
36375
+ let pageLastId;
35096
36376
  let drained = false;
35097
36377
  let pagesWalked = 0;
35098
36378
  for (let page = 0; page < 100; page += 1) {
@@ -35102,7 +36382,8 @@ function createDeclarativePoll(spec) {
35102
36382
  cursor,
35103
36383
  page: {
35104
36384
  index: page,
35105
- token: pageToken
36385
+ token: pageToken,
36386
+ lastId: pageLastId
35106
36387
  }
35107
36388
  });
35108
36389
  const response = await ctx.runOperation(spec.list.operationId, args);
@@ -35124,9 +36405,20 @@ function createDeclarativePoll(spec) {
35124
36405
  drained = true;
35125
36406
  break;
35126
36407
  }
36408
+ } else if (spec.list.pageLastId) {
36409
+ const hasMore = getPath(response, spec.list.pageLastId.hasMorePath);
36410
+ if (hasMore === false) {
36411
+ drained = true;
36412
+ break;
36413
+ }
36414
+ if (hasMore !== true) break;
36415
+ const last = Array.isArray(items) && items.length > 0 ? items[items.length - 1] : void 0;
36416
+ const next = last === void 0 ? void 0 : getPath(last, spec.list.pageLastId.itemPath);
36417
+ if (next === null || next === void 0) break;
36418
+ pageLastId = next;
35127
36419
  } else {
35128
36420
  pageToken = spec.list.pageToken ? getPath(response, spec.list.pageToken.responsePath) : void 0;
35129
- const hasMorePath = spec.list.pageToken?.hasMorePath;
36421
+ const hasMorePath = spec.list.pageToken?.hasMorePath ?? spec.list.hasMorePath;
35130
36422
  const hasMore = hasMorePath === void 0 ? void 0 : getPath(response, hasMorePath);
35131
36423
  if (hasMore === false) {
35132
36424
  drained = true;
@@ -35134,6 +36426,7 @@ function createDeclarativePoll(spec) {
35134
36426
  }
35135
36427
  if (hasMorePath !== void 0 && hasMore !== true) break;
35136
36428
  if (pageToken === null || pageToken === void 0) {
36429
+ if (spec.list.pageToken === void 0 && hasMorePath !== void 0) break;
35137
36430
  drained = true;
35138
36431
  break;
35139
36432
  }
@@ -35152,7 +36445,7 @@ function createDeclarativePoll(spec) {
35152
36445
  id: dedupId(item, spec.dedup),
35153
36446
  payload: withScopeFields(spec.map ? mapFields(spec.map, item) : item, spec.list.scopeParams, ctx.scope)
35154
36447
  }));
35155
- const nextCursor = spec.cursor.kind === "opaque" ? opaqueNext ?? cursor ?? null : laterOf(latestTimestamp(items, spec.cursor.field), cursor) ?? null;
36448
+ const nextCursor = spec.cursor.kind === "opaque" ? opaqueNext ?? cursor ?? null : laterOf(latestTimestamp(items, spec.cursor.field, spec.cursor.unit), cursor, spec.cursor.unit) ?? null;
35156
36449
  if (!drained) return {
35157
36450
  items: events,
35158
36451
  nextCursor,
@@ -35320,6 +36613,7 @@ var init_src$4 = __esmMin((() => {
35320
36613
  init_trigger_descriptor();
35321
36614
  init_declarative_poll();
35322
36615
  init_list_args();
36616
+ init_stamps();
35323
36617
  init_paths();
35324
36618
  init_concurrency();
35325
36619
  init_built_in_strategies();
@@ -36312,6 +37606,70 @@ var init_body_error = __esmMin((() => {
36312
37606
  init_src$20();
36313
37607
  }));
36314
37608
  //#endregion
37609
+ //#region ../../libs/runtime/connect-broker/src/lib/executor/form-encoding.ts
37610
+ /**
37611
+ * Encode an object as a form body. Returns the `&`-joined pairs, with no leading
37612
+ * `?` and no trailing separator; an object with nothing to send returns the
37613
+ * empty string.
37614
+ *
37615
+ * The value rules, each of which a provider can tell apart:
37616
+ *
37617
+ * - `null` and `undefined` are OMITTED, key and all. A form body has no null:
37618
+ * the wire can only carry text, so `x=null` would set the field to the
37619
+ * four-letter string. Omitting is the one encoding that means "not sent".
37620
+ * - the empty string is NOT omitted — `x=` is how a form body clears a field,
37621
+ * and a caller that wrote `''` asked for exactly that.
37622
+ * - an empty object or an empty array contributes NO pairs, because it has no
37623
+ * leaf to hang a key off. Same reading as `qs` and as Stripe's own client.
37624
+ * - booleans go out as `true` / `false`, numbers as their digits.
37625
+ *
37626
+ * @param body the arguments to send, already stripped of anything the broker
37627
+ * consumes (see `buildRequestBody`).
37628
+ */
37629
+ function encodeFormBody(body) {
37630
+ const pairs = [];
37631
+ for (const [key, value] of Object.entries(body)) appendPairs(encodeURIComponent(key), value, pairs);
37632
+ return pairs.join("&");
37633
+ }
37634
+ /**
37635
+ * Walk one value into `pairs`, carrying the key prefix built so far. The prefix
37636
+ * arrives ALREADY ENCODED, which is why the brackets this function adds survive
37637
+ * literally: `encodeURIComponent` would turn `[` into `%5B`, and while every
37638
+ * provider decodes that back, a percent-escaped key is unreadable in a log and
37639
+ * in a spec assertion for no gain.
37640
+ */
37641
+ function appendPairs(key, value, pairs) {
37642
+ if (value === null || value === void 0) return;
37643
+ if (Array.isArray(value)) {
37644
+ value.forEach((item, index) => appendPairs(`${key}[${index}]`, item, pairs));
37645
+ return;
37646
+ }
37647
+ if (isNestable(value)) {
37648
+ for (const [childKey, childValue] of Object.entries(value)) appendPairs(`${key}[${encodeURIComponent(childKey)}]`, childValue, pairs);
37649
+ return;
37650
+ }
37651
+ pairs.push(`${key}=${encodeURIComponent(String(value))}`);
37652
+ }
37653
+ /**
37654
+ * Is this value a structure to walk into, or a leaf to stringify?
37655
+ *
37656
+ * Only a PLAIN object counts. A `Date`, a `Map`, a class instance — anything
37657
+ * with its own prototype — has no enumerable own entries worth speaking of, so
37658
+ * walking it would emit NOTHING and the field would vanish from the request with
37659
+ * no error anywhere. Stringifying it instead sends `[object Map]`, which the
37660
+ * provider rejects with a 400 naming the field. A loud rejection beats a field
37661
+ * that silently never arrived.
37662
+ *
37663
+ * In practice every body reaching here was parsed from JSON and is plain, so
37664
+ * this branch is a guard against the day something else does.
37665
+ */
37666
+ function isNestable(value) {
37667
+ if (typeof value !== "object" || value === null) return false;
37668
+ const proto = Object.getPrototypeOf(value);
37669
+ return proto === Object.prototype || proto === null;
37670
+ }
37671
+ var init_form_encoding = __esmMin((() => {}));
37672
+ //#endregion
36315
37673
  //#region ../../libs/runtime/connect-broker/src/lib/executor/provider-error-classes.ts
36316
37674
  /**
36317
37675
  * Classify one failed provider response, or answer `null` for anything the
@@ -36737,25 +38095,50 @@ function brokerCodeForProviderStatus(status) {
36737
38095
  }
36738
38096
  }
36739
38097
  /**
36740
- * Build the JSON request body for an OpenAPI operation. When the operation
36741
- * names a Swagger body argument containing an object, send that object directly.
38098
+ * Build the request body for an OpenAPI operation. When the operation names a
38099
+ * Swagger body argument containing an object, send that object directly.
36742
38100
  * Otherwise, every payload key that is NOT a declared path/query/
36743
38101
  * header param becomes the body. Sets `content-type` when a body is produced.
36744
38102
  * Returns `undefined` for body-less operations (e.g. GET).
38103
+ *
38104
+ * JSON unless the operation declares `bodyEncoding: 'form'` — see
38105
+ * {@link serialiseRequestBody}. Both exits go through it, because a provider
38106
+ * that only speaks form-encoding speaks it on every endpoint and a Swagger
38107
+ * named body is not the exception.
38108
+ *
38109
+ * Exported for the specs: the encoding is a property of THIS function — which
38110
+ * bytes go out with which `content-type` — and asserting it here is a direct
38111
+ * reading rather than an inference from what a `fetch` stub was handed.
36745
38112
  */
36746
38113
  function buildRequestBody(operation, args, headers) {
36747
38114
  if (operation.requestBodySchema === void 0) return void 0;
36748
38115
  const namedBody = operation.bodyArgName === void 0 ? void 0 : args[operation.bodyArgName];
36749
- if (namedBody !== null && typeof namedBody === "object") {
36750
- headers["content-type"] = "application/json";
36751
- return JSON.stringify(namedBody);
36752
- }
38116
+ if (namedBody !== null && typeof namedBody === "object") return serialiseRequestBody(operation, namedBody, headers);
36753
38117
  const consumed = /* @__PURE__ */ new Set();
36754
38118
  for (const param of operation.parameters ?? []) if (param.in === "path" || param.in === "query" || param.in === "header") consumed.add(param.name);
36755
38119
  for (const arg of brokerConsumedArgs(operation)) consumed.add(arg.name);
36756
38120
  const body = {};
36757
38121
  for (const [key, value] of Object.entries(args)) if (!consumed.has(key)) body[key] = value;
36758
38122
  if (Object.keys(body).length === 0) return void 0;
38123
+ return serialiseRequestBody(operation, body, headers);
38124
+ }
38125
+ /**
38126
+ * Serialise one already-assembled body, and set the `content-type` it goes out
38127
+ * with. The two travel together on purpose: a form body sent under
38128
+ * `application/json` is a provider parsing `amount=2000` as malformed JSON, and
38129
+ * a JSON body under the form header is a provider reading `{"amount":2000}` as
38130
+ * ONE field whose name is that whole string — it answers 200 and stores
38131
+ * nonsense. Neither failure is readable from the operator's side, so the header
38132
+ * is never set anywhere but here.
38133
+ *
38134
+ * `bodyEncoding` is the operation's own declaration (`x-stackbone-body-encoding`
38135
+ * in the document); absent, this is the JSON path exactly as it has always been.
38136
+ */
38137
+ function serialiseRequestBody(operation, body, headers) {
38138
+ if (operation.bodyEncoding === "form") {
38139
+ headers["content-type"] = "application/x-www-form-urlencoded";
38140
+ return encodeFormBody(body);
38141
+ }
36759
38142
  headers["content-type"] = "application/json";
36760
38143
  return JSON.stringify(body);
36761
38144
  }
@@ -36981,6 +38364,7 @@ var init_connect_action_executor = __esmMin((() => {
36981
38364
  init_connection_fence();
36982
38365
  init_delete_guard();
36983
38366
  init_body_error();
38367
+ init_form_encoding();
36984
38368
  init_provider_error_classes();
36985
38369
  init_spec_request();
36986
38370
  init_operation_continuation();
@@ -52195,14 +53579,13 @@ var init_trigger_strategies = __esmMin((() => {
52195
53579
  }));
52196
53580
  //#endregion
52197
53581
  //#region ../../libs/runtime/workspace-runtime/src/lib/connect-inbound/timestamp-poll-cursor.ts
52198
- var epoch, createTimestampPoll;
53582
+ var readStamp, createTimestampPoll;
52199
53583
  var init_timestamp_poll_cursor = __esmMin((() => {
52200
53584
  init_src$4();
52201
- epoch = (value) => {
52202
- if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})$/i.test(value)) throw new Error("Invalid timestamp cursor: expected an ISO date stamp");
52203
- const parsed = Date.parse(value);
52204
- if (!Number.isFinite(parsed)) throw new Error("Invalid timestamp cursor: unreadable date stamp");
52205
- return parsed;
53585
+ readStamp = (value, unit) => {
53586
+ const stamp = parseStamp(value, unit);
53587
+ if (stamp === null) throw new Error(unit === void 0 ? "Invalid timestamp cursor: expected an ISO date stamp" : `Invalid timestamp cursor: expected a stamp in ${unit}`);
53588
+ return stamp;
52206
53589
  };
52207
53590
  createTimestampPoll = (spec) => {
52208
53591
  const rawPoll = createDeclarativePoll(spec);
@@ -52212,8 +53595,10 @@ var init_timestamp_poll_cursor = __esmMin((() => {
52212
53595
  if (cursor === null || typeof cursor !== "object" || !("kind" in cursor)) return rawPoll(ctx, cursor);
52213
53596
  if (cursor.kind !== "timestamp-v1") throw new Error("Invalid timestamp cursor: unknown version");
52214
53597
  const stored = cursor;
52215
- const valueEpoch = epoch(stored.value);
52216
- const floorEpoch = epoch(stored.floor);
53598
+ const unit = cursorSpec.unit;
53599
+ const value = readStamp(stored.value, unit);
53600
+ const valueEpoch = value.epochMs;
53601
+ const floorEpoch = readStamp(stored.floor, unit).epochMs;
52217
53602
  if (valueEpoch < floorEpoch) throw new Error("Invalid timestamp cursor: value precedes arming floor");
52218
53603
  const lookbackMs = Math.min(cursorSpec.lookbackMs ?? 0, valueEpoch - floorEpoch);
52219
53604
  const result = await createDeclarativePoll({
@@ -52222,8 +53607,8 @@ var init_timestamp_poll_cursor = __esmMin((() => {
52222
53607
  ...cursorSpec,
52223
53608
  lookbackMs
52224
53609
  }
52225
- })(ctx, new Date(valueEpoch).toISOString());
52226
- const next = epoch(result.nextCursor) > valueEpoch ? result.nextCursor : stored.value;
53610
+ })(ctx, unit === void 0 ? new Date(valueEpoch).toISOString() : formatStamp(valueEpoch, value.shape));
53611
+ const next = readStamp(result.nextCursor, unit).epochMs > valueEpoch ? result.nextCursor : stored.value;
52227
53612
  return {
52228
53613
  ...result,
52229
53614
  nextCursor: {
@@ -52386,7 +53771,11 @@ var init_trigger_capability = __esmMin((() => {
52386
53771
  if (!descriptor || descriptor.poll.kind !== "declarative") return null;
52387
53772
  if (descriptor.poll.cursor.kind !== "timestamp") return null;
52388
53773
  if (SCOPE_TEMPLATE.test(descriptor.poll.list.operationId)) return null;
52389
- const value = armedAt.toISOString();
53774
+ const unit = descriptor.poll.cursor.unit;
53775
+ const value = unit === void 0 ? armedAt.toISOString() : formatStamp(armedAt.getTime(), {
53776
+ unit,
53777
+ numeric: true
53778
+ });
52390
53779
  return descriptor.poll.cursor.lookbackMs === void 0 ? value : {
52391
53780
  kind: "timestamp-v1",
52392
53781
  value,
@@ -67414,7 +68803,8 @@ var init_workflow_http_schemas = __esmMin((() => {
67414
68803
  displayName: z.string().optional(),
67415
68804
  description: z.string().optional(),
67416
68805
  example: z.string().optional(),
67417
- required: z.boolean()
68806
+ required: z.boolean(),
68807
+ suggestions: z.array(z.string()).optional().openapi({ example: ["charge.succeeded", "charge.*"] })
67418
68808
  })).openapi({ description: "The per-subscription values this trigger needs, declared by the connector. The register dialog renders a field each and the register call must carry every required one. Empty when the credential is the trigger's whole scope." }),
67419
68809
  cursorColumn: z.object({ default: z.string() }).nullable().openapi({
67420
68810
  description: "Present when the poll cursor advances on a column the subscription chooses; `default` pre-fills the field.",
@@ -71266,7 +72656,7 @@ var toWorkflowExport = (name) => `${toCamelCase(name)}Workflow`;
71266
72656
  var index_ts_default = "import { tool } from \"@langchain/core/tools\";\nimport { z } from \"zod\";\nimport { defineDeepAgent } from \"@stackbone/sdk/deep\";\n\n// A deep agent is a single file: a name, a model, and optional tools /\n// sub-agents. `stackbone dev` discovers it by its folder\n// (`deep-agents/{{name}}/`), builds the LangGraph graph in-process (no server,\n// no port), and serves it over the standard OpenAI + Anthropic chat wire — point\n// any client at the emulator and select this agent with `\"model\": \"{{name}}\"`.\n\n// ITS INSTRUCTION IS NOT IN THIS FILE. Write it in Studio, under the prompt\n// named `{{name}}` (the agent's name is its default prompt key). Until you do,\n// the agent runs with an empty instruction — it answers, it just has no persona\n// yet. To put values into the text, declare them here and reference them in the\n// prompt with the double-brace syntax:\n//\n// instructions: { key: \"{{name}}\", variables: { tone: \"friendly\" } },\n\n// A tiny example tool. Delete it (and the `tools` field below) if your agent\n// needs none, or add more — each is a plain LangChain `tool(...)`.\nconst addNumbers = tool(\n async ({ a, b }: { a: number; b: number }) => String(a + b),\n {\n name: \"add_numbers\",\n description: \"Add two integers and return the sum.\",\n schema: z.object({ a: z.number().int(), b: z.number().int() }),\n },\n);\n\nexport default defineDeepAgent({\n // Must match the folder name: it is who this agent's prompts belong to.\n name: \"{{name}}\",\n model: \"openai/gpt-4o-mini\",\n tools: [addNumbers],\n});\n";
71267
72657
  //#endregion
71268
72658
  //#region src/services/scaffold/templates/shell/AGENTS.md.tmpl?raw
71269
- var AGENTS_md_default = "# Agent instructions\n\nThis project is the **{{name}}** Stackbone workspace — a multi-agent project. It\nholds one or more in-process deep agents plus the durable workflows that\norchestrate them:\n\n- `deep-agents/<name>/` — one deep agent per folder (discovered by its `index.ts`).\n Its code is `deep-agents/<name>/index.ts`, which `export default defineDeepAgent({\n name, model, tools })`. Its INSTRUCTION is not in the code: it is written in\n Studio, under the prompt keyed by the agent's name, so changing the wording is an\n edit rather than a deploy. A deep agent is a plain JS module: no server, no port,\n no HTTP code — the emulator builds its LangGraph graph in-process and serves it\n over the standard OpenAI + Anthropic chat wire.\n- `workflows/<name>.workflow.ts` — one durable Workflow SDK workflow per file:\n a plain async function tagged `\"use workflow\"`, with each `\"use step\"` a\n durable checkpoint, and its contract declared as sibling `inputSchema` /\n `outputSchema` exports.\n\n`stackbone dev` discovers every deep agent and workflow by convention — there is no\nregistry file to hand-edit.\n\n## Always use the Stackbone skills\n\n`stackbone init` / `stackbone link` install four skills into this workspace for\nevery coding agent you picked (Claude Code, Cursor, Windsurf, Codex, Cline, …), and\nadd the `stackbone-docs` MCP server to that agent's configuration.\n**Use them — do not improvise from memory.** The skills tell you how to work here:\nthe shapes, the order of operations, the rules. The SDK surface, the CLI flags and\nthe error catalog are read from the docs MCP server (`search_docs`, `get_doc`); each\nskill names the page to read before you touch a surface.\n\n| Skill | Use it when… |\n| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `stackbone` | **Editing agent or workflow code.** Writing a `defineDeepAgent`, a `*.workflow.ts`, DB CRUD, storage uploads, LLM calls, RAG, queues, HITL, secrets, or prompts. |\n| `stackbone-cli` | **Running or shipping the workspace.** Scaffolding (`init` / `add` / `link`), the local emulator (`dev`), compiling the deployable bundle (`build`), DB migrations (`db migrate`), reading metadata. |\n| `stackbone-debug` | **Triaging a failure.** An error, a 4xx/5xx, a stuck or timed-out run, a HITL run waiting on approval, a failed deploy, or a quota/billing response. Locate the cause, then fix it. |\n| `stackbone-coder` | **Starting a new piece, feature…** — interviews, then scaffolds it by description. |\n\n## Grow the workspace\n\n```sh\nstackbone add agent <name> # add a deep agent (alias of add deep-agent)\nstackbone add workflow <name> # add a durable workflow\nstackbone add workflow-agent <name> # add a deep agent + a workflow wired to call it\n```\n\n## Edit a deep agent\n\n- The agent lives in `deep-agents/<name>/index.ts` as `defineDeepAgent({ name,\n model, tools })` from `@stackbone/sdk/deep`. Its tools are plain LangChain\n `tool(...)` values.\n- Its behaviour and tone are its PROMPT, written in Studio and keyed by the agent's\n name. Write text there, never in the code. Pass values into it with\n `instructions: { variables: { ... } }`, and point it at another key with\n `instructions: { key: \"...\" }`. An agent whose prompt is still empty runs and\n answers — it just has no persona yet.\n- Pick the model with a bare id string (resolved through the deployment's **model\n provider**, i.e. whatever OpenAI-compatible endpoint it is pointed at) — e.g.\n `model: \"openai/gpt-4o-mini\"` — or pass a built LangChain model instance.\n- Follow the `stackbone` skill for every `client.*` / `stackbone.*` surface.\n\n## Edit a workflow\n\nA workflow is a bare async function — no class, no decorators:\n\n```ts\nexport const inputSchema = z.object({ message: z.string() });\nexport const outputSchema = z.object({ reply: z.string() });\n\nexport async function myWorkflow(input) {\n \"use workflow\";\n const reply = await askAgent(input.message); // a durable step\n return { reply };\n}\n```\n\nThe `inputSchema` / `outputSchema` exports next to the function ARE the contract.\nTag each durable checkpoint with `\"use step\"`.\n\n## Reaching a deep agent or a connector\n\n- To call a deep agent from a workflow step, use `callDeepAgent` from\n `@stackbone/sdk/workflow` inside a `\"use step\"` — it runs the agent IN-PROCESS\n (no HTTP, no HMAC):\n\n ```ts\n import { callDeepAgent } from '@stackbone/sdk/workflow';\n\n async function askAgent(message: string) {\n \"use step\";\n const { text } = await callDeepAgent('support', message);\n return text;\n }\n ```\n\n- To call a connector directly (typed when its types are generated), use the\n ambient handle:\n\n ```ts\n import { stackbone } from '@stackbone/sdk';\n await stackbone.connection('stub-mail').sendMail({ to, subject, body });\n ```\n\n## Run it locally\n\n```sh\npnpm install\nstackbone dev # runs the workspace against a local World + Studio\n```\n\n**The first run stops for setup.** With no model provider configured, `stackbone\ndev` brings up the local stack and then holds the workflows and agents back,\nprinting a Studio link to finish setup in the browser. Saving there starts the\nworkspace in place, with no restart. To skip that step entirely, export the\nendpoint before booting:\n\n```sh\nexport MODEL_PROVIDER_BASE_URL=https://openrouter.ai/api/v1\nexport MODEL_PROVIDER_API_KEY=sk-... # omit for a keyless local gateway\n```\n\nUse the `stackbone-cli` skill for the emulator, migrations, and building the\nbundle you deploy, and the `stackbone-debug` skill the moment something fails.\n\nThe full SDK and CLI reference lives at https://docs.stackbone.ai, and is\nserved over MCP at https://docs.stackbone.ai/mcp so you can search it from\nhere. Run `stackbone docs` for the connection details.\n";
72659
+ var AGENTS_md_default = "# Agent instructions\n\nThis project is the **{{name}}** Stackbone workspace — a multi-agent project. It\nholds one or more in-process deep agents plus the durable workflows that\norchestrate them:\n\n- `deep-agents/<name>/` — one deep agent per folder (discovered by its `index.ts`).\n Its code is `deep-agents/<name>/index.ts`, which `export default defineDeepAgent({\n name, model, tools })`. Its INSTRUCTION is not in the code: it is written in\n Studio, under the prompt keyed by the agent's name, so changing the wording is an\n edit rather than a deploy. A deep agent is a plain JS module: no server, no port,\n no HTTP code — the emulator builds its LangGraph graph in-process and serves it\n over the standard OpenAI + Anthropic chat wire.\n- `workflows/<name>.workflow.ts` — one durable Workflow SDK workflow per file:\n a plain async function tagged `\"use workflow\"`, with each `\"use step\"` a\n durable checkpoint, and its contract declared as sibling `inputSchema` /\n `outputSchema` exports.\n\n`stackbone dev` discovers every deep agent and workflow by convention — there is no\nregistry file to hand-edit.\n\n## Always use the Stackbone skills\n\n`stackbone init` / `stackbone link` install seven skills into this workspace for\nevery coding agent you picked (Claude Code, Cursor, Windsurf, Codex, Cline, …), and\nadd the `stackbone-docs` MCP server to that agent's configuration.\n**Use them — do not improvise from memory.** The skills tell you how to work here:\nthe shapes, the order of operations, the rules. The SDK surface, the CLI flags and\nthe error catalog are read from the docs MCP server (`search_docs`, `get_doc`); each\nskill names the page to read before you touch a surface.\n\n| Skill | Use it when… |\n| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `stackbone` | **Editing agent or workflow code.** Writing a `defineDeepAgent`, a `*.workflow.ts`, DB CRUD, storage uploads, LLM calls, RAG, queues, HITL, secrets, or prompts. |\n| `stackbone-cli` | **Running or shipping the workspace.** Scaffolding (`init` / `add` / `link`), the local emulator (`dev`), compiling the deployable bundle (`build`), DB migrations (`db migrate`), reading metadata. |\n| `stackbone-debug` | **Triaging a failure.** An error, a 4xx/5xx, a stuck or timed-out run, a HITL run waiting on approval, a failed deploy, or a quota/billing response. Locate the cause, then fix it. |\n| `stackbone-coder` | **Starting a new piece, feature…** — interviews, then scaffolds it by description. |\n| `stackbone-evals` | **Measuring whether it works.** Turning a Playground exchange into an eval case, a case into a suite, a suite into a run, and comparing two variants of the same suite. |\n| `stackbone-guardrails` | **Putting limits on a running agent.** Blocking a turn, masking data on its way out, or holding it for a person. The rule is state on the box, so it needs no rebuild. |\n| `stackbone-integrations` | **Wiring the workspace to the outside.** Registering a connection, arming a trigger so a workflow starts on its own, and binding what a run outputs to a destination. |\n\n## Grow the workspace\n\n```sh\nstackbone add agent <name> # add a deep agent (alias of add deep-agent)\nstackbone add workflow <name> # add a durable workflow\nstackbone add workflow-agent <name> # add a deep agent + a workflow wired to call it\n```\n\n## Edit a deep agent\n\n- The agent lives in `deep-agents/<name>/index.ts` as `defineDeepAgent({ name,\n model, tools })` from `@stackbone/sdk/deep`. Its tools are plain LangChain\n `tool(...)` values.\n- Its behaviour and tone are its PROMPT, written in Studio and keyed by the agent's\n name. Write text there, never in the code. Pass values into it with\n `instructions: { variables: { ... } }`, and point it at another key with\n `instructions: { key: \"...\" }`. An agent whose prompt is still empty runs and\n answers — it just has no persona yet.\n- Pick the model with a bare id string (resolved through the deployment's **model\n provider**, i.e. whatever OpenAI-compatible endpoint it is pointed at) — e.g.\n `model: \"openai/gpt-4o-mini\"` — or pass a built LangChain model instance.\n- Follow the `stackbone` skill for every `client.*` / `stackbone.*` surface.\n\n## Edit a workflow\n\nA workflow is a bare async function — no class, no decorators:\n\n```ts\nexport const inputSchema = z.object({ message: z.string() });\nexport const outputSchema = z.object({ reply: z.string() });\n\nexport async function myWorkflow(input) {\n \"use workflow\";\n const reply = await askAgent(input.message); // a durable step\n return { reply };\n}\n```\n\nThe `inputSchema` / `outputSchema` exports next to the function ARE the contract.\nTag each durable checkpoint with `\"use step\"`.\n\n## Reaching a deep agent or a connector\n\n- To call a deep agent from a workflow step, use `callDeepAgent` from\n `@stackbone/sdk/workflow` inside a `\"use step\"` — it runs the agent IN-PROCESS\n (no HTTP, no HMAC):\n\n ```ts\n import { callDeepAgent } from '@stackbone/sdk/workflow';\n\n async function askAgent(message: string) {\n \"use step\";\n const { text } = await callDeepAgent('support', message);\n return text;\n }\n ```\n\n- To call a connector directly (typed when its types are generated), use the\n ambient handle:\n\n ```ts\n import { stackbone } from '@stackbone/sdk';\n await stackbone.connection('stub-mail').sendMail({ to, subject, body });\n ```\n\n## Run it locally\n\n```sh\npnpm install\nstackbone dev # runs the workspace against a local World + Studio\n```\n\n**The first run stops for setup.** With no model provider configured, `stackbone\ndev` brings up the local stack and then holds the workflows and agents back,\nprinting a Studio link to finish setup in the browser. Saving there starts the\nworkspace in place, with no restart. To skip that step entirely, export the\nendpoint before booting:\n\n```sh\nexport MODEL_PROVIDER_BASE_URL=https://openrouter.ai/api/v1\nexport MODEL_PROVIDER_API_KEY=sk-... # omit for a keyless local gateway\n```\n\nUse the `stackbone-cli` skill for the emulator, migrations, and building the\nbundle you deploy, and the `stackbone-debug` skill the moment something fails.\n\nThe full SDK and CLI reference lives at https://docs.stackbone.ai, and is\nserved over MCP at https://docs.stackbone.ai/mcp so you can search it from\nhere. Run `stackbone docs` for the connection details.\n";
71270
72660
  //#endregion
71271
72661
  //#region src/services/scaffold/templates/shell/CLAUDE.md.tmpl?raw
71272
72662
  var CLAUDE_md_default = "# CLAUDE.md\n\nThis is the **{{name}}** Stackbone workspace. The full agent-development guidance\nlives in `AGENTS.md` — read it.\n\n@AGENTS.md\n\n## Claude Code note\n\nThe Stackbone skills (`stackbone`, `stackbone-cli`, `stackbone-debug`,\n`stackbone-coder`) are installed for Claude Code under `.claude/`, and the\n`stackbone-docs` MCP server is registered in `.mcp.json`. Invoke the skills\nthrough the Skill tool:\n\n- `stackbone` — write/edit deep agents (`deep-agents/<name>/index.ts`) and\n workflows (`workflows/<name>.workflow.ts`).\n- `stackbone-cli` — run the emulator (`stackbone dev`), migrate the DB, compile\n the deployable bundle (`stackbone build`).\n- `stackbone-debug` — triage any error or stuck run, then return to the skill\n above to apply the fix.\n- `stackbone-coder` — start a new agent or workflow from a one-line idea.\n\nEach skill says how to find the docs page to read before you touch a surface\n(`list_docs`, then `get_doc`); read it instead of guessing a flag or a signature.\n";
@@ -71302,7 +72692,7 @@ var calls_workflow_ts_default = "import { z } from \"zod\";\nimport { streamDeep
71302
72692
  var plain_workflow_ts_default = "import { z } from \"zod\";\n\n/**\n * Workflow \"{{name}}\" — a durable pipeline.\n *\n * Each `\"use step\"` is a durable checkpoint: kill the runtime mid-run and it\n * resumes from the last completed step instead of replaying everything.\n */\n\n// THE contract — sibling exports next to the bare workflow function. The build\n// harvests these (by convention) into the manifest + a live validator. The\n// parameter type is DERIVED from `inputSchema` and the RETURN type from\n// `outputSchema` (both `z.infer`), so neither side can drift from the contract\n// the build harvests. Without the return annotation the schema is published to\n// Studio and the generated types and never compared to what the body returns\n// (PLA-1272).\nexport const inputSchema = z.object({\n message: z.string().describe(\"The input to process\"),\n});\n\nexport const outputSchema = z.object({\n message: z.string(),\n processed: z.boolean(),\n});\n\ntype {{Name}}Input = z.infer<typeof inputSchema>;\n\nexport async function {{export}}(input: {{Name}}Input): Promise<z.infer<typeof outputSchema>> {\n \"use workflow\";\n\n const result = await processMessage(input); // step 1 — durable checkpoint\n return result;\n}\n\nasync function processMessage(input: {{Name}}Input) {\n \"use step\";\n // Replace this with the deterministic work of your step (DB write, HTTP call,\n // an LLM call, …). Returning a value records it as the step's checkpoint.\n return { message: input.message, processed: true };\n}\n";
71303
72693
  //#endregion
71304
72694
  //#region src/services/scaffold/template-loader.ts
71305
- var SDK_TEMPLATE_VERSION = "0.5.0";
72695
+ var SDK_TEMPLATE_VERSION = "0.6.0";
71306
72696
  var PREFIX = "./templates/";
71307
72697
  var templates = new Map(Object.entries(/* @__PURE__ */ Object.assign({
71308
72698
  "./templates/deep-agents/index.ts.tmpl": index_ts_default,
@@ -75274,7 +76664,7 @@ var REDIS_IMAGE$1 = "redis:7-alpine";
75274
76664
  * Same image and pin as `stackbone dev`'s compose, so the emulator and the
75275
76665
  * deliverable run the identical backend.
75276
76666
  */
75277
- var MINIO_IMAGE$1 = "minio/minio:RELEASE.2025-03-12T18-04-18Z";
76667
+ var MINIO_IMAGE$1 = "quay.io/minio/minio:RELEASE.2025-03-12T18-04-18Z";
75278
76668
  /** Access key the bundled MinIO is created with. The secret is generated per package. */
75279
76669
  var MINIO_ACCESS_KEY = "stackbone";
75280
76670
  /** Bucket the init container creates, and the agent's `STACKBONE_S3_BUCKET`. */
@@ -78643,7 +80033,7 @@ var readStackboneConfig = async (cwd) => readJsonFile(stackboneConfigPath(cwd),
78643
80033
  //#region src/dev/compose-template.ts
78644
80034
  var POSTGRES_IMAGE = "pgvector/pgvector:pg17";
78645
80035
  var REDIS_IMAGE = "redis:7-alpine";
78646
- var MINIO_IMAGE = "minio/minio:RELEASE.2025-03-12T18-04-18Z";
80036
+ var MINIO_IMAGE = "quay.io/minio/minio:RELEASE.2025-03-12T18-04-18Z";
78647
80037
  var PGVECTOR_INIT_SQL = `-- Generated by stackbone dev. Runs once on Postgres first boot via
78648
80038
  -- /docker-entrypoint-initdb.d. The queue extension is gone (BullMQ over Redis
78649
80039
  -- is the only job engine); only pgvector is enabled here.
@@ -84311,6 +85701,7 @@ var assertBoxCanBeRegistered = (contract) => {
84311
85701
  };
84312
85702
  //#endregion
84313
85703
  //#region src/commands/link/link.command.ts
85704
+ init_src$19();
84314
85705
  var requireLinkField = (value, flag, description) => {
84315
85706
  const trimmed = (value ?? "").trim();
84316
85707
  if (trimmed.length === 0) throw new StackboneCliError({
@@ -84321,6 +85712,27 @@ var requireLinkField = (value, flag, description) => {
84321
85712
  return trimmed;
84322
85713
  };
84323
85714
  /**
85715
+ * PLA-1583 — `link` refuses a plain `http://` box before it touches anything.
85716
+ *
85717
+ * The rule itself comes from `deploymentUrlSchema`, the very schema the control
85718
+ * plane validates the request body with, imported rather than restated: a rule
85719
+ * written twice is a rule the CLI and the API drift apart on, and the CLI is
85720
+ * the caller that used to pass `--url` straight through while only the browser
85721
+ * wizard refused one. What this adds is WHERE the refusal lands — here, before
85722
+ * the handshake dials the box, instead of as a 400 after the operator has
85723
+ * already watched `link` talk to it.
85724
+ */
85725
+ var requireEncryptedUrl = (url) => {
85726
+ const checked = deploymentUrlSchema.safeParse(url);
85727
+ if (checked.success) return;
85728
+ const refusedScheme = checked.error.issues.find((issue) => issue.code === "custom");
85729
+ throw new StackboneCliError({
85730
+ code: "generic",
85731
+ message: `\`--url ${url}\` cannot be registered: ${refusedScheme?.message ?? checked.error.issues[0]?.message ?? "it is not an https:// address"}`,
85732
+ suggestion: refusedScheme ? "Terminate TLS at your own proxy and pass its https:// address. Callbacks from the control plane and calls from the browser reach the box over this URL; the HMAC secret signs them, it does not encrypt them." : "Pass the full address, scheme and host, like https://box.example.com — a bare host is not enough to know where to call."
85733
+ });
85734
+ };
85735
+ /**
84324
85736
  * STA-440 — what `link` tells the operator about the box's browser-identity gate.
84325
85737
  * `null` when the box verifies identity: there is nothing to say. The other two
84326
85738
  * read differently on purpose — a box that reports it is not verifying is a
@@ -84423,6 +85835,7 @@ var runLink = async (ctx, args) => {
84423
85835
  colors: true
84424
85836
  }));
84425
85837
  const url = requireLinkField(args.url, "url", "the public URL of the deployed agent");
85838
+ requireEncryptedUrl(url);
84426
85839
  const secret = requireLinkField(args.secret, "secret", "the HMAC secret the deployed agent authenticates its callbacks with");
84427
85840
  const tag = requireLinkField(args.tag, "tag", "the tag of the deep-agents image you deployed");
84428
85841
  const agentsArg = readAgentsArg(args.agents);