@keystrokehq/cli 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/{accept.handler-DWuxmMuY.mjs → accept.handler-BU6kg8ET.mjs} +1 -1
  2. package/dist/{admin-BK4bFTTd.mjs → admin-B4GNbCl5.mjs} +9 -9
  3. package/dist/{agent-manifest-sJFbH5H8.mjs → agent-manifest-CZdlCTFs.mjs} +5 -5
  4. package/dist/{agents-DYnw2VPX.mjs → agents-DDqXmmFV.mjs} +6 -6
  5. package/dist/api-DuKKdCpF.mjs +246 -0
  6. package/dist/{api-keys-Dizx3YqE.mjs → api-keys-BE_hLonn.mjs} +5 -5
  7. package/dist/{auth-BqsKd4IA.mjs → auth-DNK5MYm4.mjs} +5 -5
  8. package/dist/{auth.handler-BsoWeCFD.mjs → auth.handler-DrjDODhZ.mjs} +1 -1
  9. package/dist/{build-agents-DfbiMZ_e-CgnKa9A6.mjs → build-agents-DseUtzd4-DIDGsZWL.mjs} +12 -13
  10. package/dist/{build-metadata-zidV9Cai-Bq37kBOM.mjs → build-metadata-xqeWhaTS-WR8IooGe.mjs} +19 -35
  11. package/dist/{build-progress-DigAP-BN.mjs → build-progress-CITED2tv.mjs} +1 -1
  12. package/dist/{build-tasks-O1jYtlv1-Bkw0w1r3.mjs → build-tasks-GVuMLS0h-DnS9QWzf.mjs} +4 -4
  13. package/dist/{build-workflows-3fdvdHHf-BDTy9QgT.mjs → build-workflows-Dmzay1vP-DKVuBAjD.mjs} +17 -18
  14. package/dist/{build.handler-B2UDhh72.mjs → build.handler-DI146Cd3.mjs} +4 -4
  15. package/dist/{clear.handler-BR97yudD.mjs → clear.handler-B1c17nAi.mjs} +1 -1
  16. package/dist/{commander-DcftG6dX.mjs → commander-BwtBoukr.mjs} +2 -2
  17. package/dist/{common-B3bLe3Mk.mjs → common-BaGFkj3n.mjs} +2 -2
  18. package/dist/{connect-DQ4xIcyE.mjs → connect-IPcL37np.mjs} +12 -6
  19. package/dist/{connect.handler-CWSLgf87.mjs → connect.handler-ToY6qmMz.mjs} +74 -224
  20. package/dist/{context-1VgRbzr-.mjs → context-DQ4IA0yO.mjs} +1 -1
  21. package/dist/{create.handler-C2CkPWsy.mjs → create.handler-BAyG0PmG.mjs} +1 -1
  22. package/dist/credential-requirements-FtBk5JVB.mjs +250 -0
  23. package/dist/credentials-Bu1MBiCL.mjs +182 -0
  24. package/dist/{credentials-D8_AwH9o.mjs → credentials-CZiu-534.mjs} +12 -7
  25. package/dist/{current-deployment-workflow-B05z0EQa.mjs → current-deployment-workflow-B4IufKqe.mjs} +5 -5
  26. package/dist/{current.handler-CuAtMZmm.mjs → current.handler-DA4FGfUP.mjs} +1 -1
  27. package/dist/{declared-credential-requirements-BtlcsEVn.mjs → declared-credential-requirements-B6h4WRv4.mjs} +5 -34
  28. package/dist/{delete.handler-DDY3X1Zm.mjs → delete.handler-CJcyvnUF.mjs} +1 -1
  29. package/dist/{deploy-B8TYutOi.mjs → deploy-BvaFgVvf.mjs} +1 -1
  30. package/dist/{deploy-Cn6FFnOM.mjs → deploy-CqXOhecY.mjs} +2 -2
  31. package/dist/{deploy-progress-XAfautnA.mjs → deploy-progress-CLO-yidq.mjs} +1 -1
  32. package/dist/{deploy.handler-D1DcAe-h.mjs → deploy.handler-DQg_rXgs.mjs} +16 -16
  33. package/dist/{detect-env-access-CwkOYeYM-D4o8gRZs.mjs → detect-env-access-CwkOYeYM-EmkYvbfJ.mjs} +1 -1
  34. package/dist/{diff.handler-BU6IewNG.mjs → diff.handler-BXg47NIZ.mjs} +3 -3
  35. package/dist/{dist-DvO0q6Fo.mjs → dist-BMkNN03r.mjs} +16 -16
  36. package/dist/{env.handler-C6YAmHLi.mjs → env.handler-DFKzjIQT.mjs} +10 -7
  37. package/dist/{error-boundary-CpaVvFXk.mjs → error-boundary-B2ZKRkZI.mjs} +1 -1
  38. package/dist/{file-metadata-BvGM-B2v.mjs → file-metadata-Dwy9KKq_.mjs} +2 -2
  39. package/dist/{import-module-DDPnzlJ1-BIBSgOhK.mjs → import-module-DEI7R8Yh-Xz-KAPvB.mjs} +248 -246
  40. package/dist/{init-Da6_obl0.mjs → init-DhnABm3J.mjs} +2 -2
  41. package/dist/{init.handler-Cq2nk8DO.mjs → init.handler-QgehN8B4.mjs} +4 -4
  42. package/dist/{inspect.handler-D4YGryQB.mjs → inspect.handler-CerVdo23.mjs} +3 -3
  43. package/dist/{integration-catalog-DtNWaMvh.mjs → integration-catalog-BRrJIAVz.mjs} +5 -5
  44. package/dist/{integrations-CB_Ukq2g.mjs → integrations-7-U7nmkh.mjs} +7 -6
  45. package/dist/{invites-BOhuBtoq.mjs → invites-CmGmnUla.mjs} +4 -4
  46. package/dist/{invites.list.handler-C-Wv6E1g.mjs → invites.list.handler-CmkIf-uW.mjs} +1 -1
  47. package/dist/{invites.resend.handler-CI78XlQS.mjs → invites.resend.handler-FZl20yat.mjs} +1 -1
  48. package/dist/{invites.revoke.handler-DigAgNwB.mjs → invites.revoke.handler-D95mrfmB.mjs} +1 -1
  49. package/dist/keystroke.mjs +21 -21
  50. package/dist/{list-enrichment-Cxlq6BB9.mjs → list-enrichment-I4XQaMg0.mjs} +5 -1
  51. package/dist/{list.handler-OiLEylzS.mjs → list.handler-BrTW2viq.mjs} +1 -1
  52. package/dist/{list.handler-CsODcH6e.mjs → list.handler-Cp767f5l.mjs} +1 -1
  53. package/dist/{list.handler-BsyGhXns.mjs → list.handler-DRnHsEa0.mjs} +1 -1
  54. package/dist/{list.handler-B6IByHHB.mjs → list.handler-DXl8igi2.mjs} +13 -5
  55. package/dist/{list.handler-BpVNYShU.mjs → list.handler-DsYyTUhA.mjs} +1 -1
  56. package/dist/{list.handler--a1JEGSD.mjs → list.handler-H8aQSsFM.mjs} +3 -3
  57. package/dist/{list.handler-Dr9Ti-dt.mjs → list.handler-k8k7wVIV.mjs} +3 -3
  58. package/dist/{listen-DUPk6cZC.mjs → listen-DckJq0y0.mjs} +2 -2
  59. package/dist/{listen.handler-B5WimrfF.mjs → listen.handler-Bf5MXKPO.mjs} +2 -2
  60. package/dist/{logs-C5_4lh3p.mjs → logs-D_l5BIn2.mjs} +3 -3
  61. package/dist/{logs.handler-CBHPwDuC.mjs → logs.handler-kYO3Uv9t.mjs} +2 -2
  62. package/dist/{members.add.handler-LcQJYBsu.mjs → members.add.handler-C2cppd-9.mjs} +1 -1
  63. package/dist/{members.invite.handler-p279O2aC.mjs → members.invite.handler-DY6kS4LN.mjs} +1 -1
  64. package/dist/{members.list.handler-Cjukjuot.mjs → members.list.handler-CFBG3SBw.mjs} +1 -1
  65. package/dist/{members.remove.handler-CzxPiQFv.mjs → members.remove.handler-LQ61_qip.mjs} +1 -1
  66. package/dist/{members.update.handler-CX5q86e3.mjs → members.update.handler-CqISA1mf.mjs} +1 -1
  67. package/dist/{normalize-path-CojS-CgQ-D_WTiHKw.mjs → normalize-path-CojS-CgQ-D5D0AIHR.mjs} +1 -1
  68. package/dist/{org-CnlKW-Hl.mjs → org-KQ2nD0yN.mjs} +15 -15
  69. package/dist/{orgs.create.handler-DRILhxdn.mjs → orgs.create.handler-Mv5CTGcG.mjs} +1 -1
  70. package/dist/{orgs.get.handler-Cue6stoX.mjs → orgs.get.handler-DvvOhshX.mjs} +1 -1
  71. package/dist/{orgs.list.handler-fuDLNI5X.mjs → orgs.list.handler-wWAg6cKg.mjs} +1 -1
  72. package/dist/{paused.handler-CuOVH4DZ.mjs → paused.handler-CbMkPD9e.mjs} +1 -1
  73. package/dist/{project-config-D9eFU8Jk.mjs → project-config-CJGSh2RQ.mjs} +4 -7
  74. package/dist/{projects-DN7dX6nN.mjs → projects-CWLOF5x4.mjs} +656 -3
  75. package/dist/{projects-DdgHbUpR.mjs → projects-CYqeKQGT.mjs} +4 -4
  76. package/dist/{requirements.handler-CX13XiXT.mjs → requirements.handler-CnDTBcH5.mjs} +5 -5
  77. package/dist/{resolve-project-C6UAOfAG.mjs → resolve-project-bVPMcs-y.mjs} +1 -1
  78. package/dist/{run-polling-1CTIeDea.mjs → run-polling-49w3PYAv.mjs} +3 -3
  79. package/dist/{run.handler-BxLH75WW.mjs → run.handler-CX3YiJmj.mjs} +5 -5
  80. package/dist/{runs-lfE7r6i2.mjs → runs-HJejvQnQ.mjs} +2 -2
  81. package/dist/{schema-BgGlAs8a.mjs → schema-DFJiNWyd.mjs} +2 -1
  82. package/dist/schemas-DodkHgnS.mjs +280 -0
  83. package/dist/{skills-sync.handler-CntKndFm.mjs → skills-sync.handler-Cf74vKJA.mjs} +1 -1
  84. package/dist/{skills.command-X5zZwz2d.mjs → skills.command-KyAwBeST.mjs} +3 -3
  85. package/dist/{source-analysis-CHkWMC40.mjs → source-analysis-CJPymdaA.mjs} +1 -1
  86. package/dist/{source-analysis-DEEChuND-Csu0oOlw.mjs → source-analysis-DEEChuND-zifGW9QF.mjs} +3 -3
  87. package/dist/{src--fCtOxNX.mjs → src-D-dFmoAF.mjs} +1 -1
  88. package/dist/{switch.handler-RaeKZ3ZB.mjs → switch.handler-DfsKVtR6.mjs} +1 -1
  89. package/dist/{sync-C89mJp7Y.mjs → sync-Coh9YPjY.mjs} +2 -2
  90. package/dist/{sync.handler-BoAHHUQs.mjs → sync.handler-vvFIUut1.mjs} +6 -6
  91. package/dist/{schedule-BWAI6qLx.mjs → task-BBgEvdG1.mjs} +395 -25
  92. package/dist/{task-target-build-D5IrHqSl.mjs → task-target-build-atWwwnSF.mjs} +8 -8
  93. package/dist/task-target-deploy-CRsrQTOy.mjs +4 -0
  94. package/dist/{task-target-deploy-Bf5i3ox1-2K0hAwzk.mjs → task-target-deploy-CZBGNC0H-BwPSfaJQ.mjs} +2 -2
  95. package/dist/task-target-deploy-runner.mjs +5 -5
  96. package/dist/{test-gPQJRkqa.mjs → test-BzpSLhV8.mjs} +32 -144
  97. package/dist/{test.handler-B5GF5txS.mjs → test.handler-St9sBXyH.mjs} +1 -1
  98. package/dist/{trigger-artifacts-B3OCTX9K-ME6IVdUB.mjs → trigger-artifacts-RizI57RC-C-yCtEi-.mjs} +9 -9
  99. package/dist/{trigger-manifest-B3Gq1739.mjs → trigger-manifest-D5rnpPkA.mjs} +1 -1
  100. package/dist/{try-deploy.handler-dA_YGWRq.mjs → try-deploy.handler-32lU1tg4.mjs} +9 -9
  101. package/dist/{upgrade-xByIxaYu.mjs → upgrade-YavAf8AC.mjs} +2 -2
  102. package/dist/{upload.handler-BFDM6n_6.mjs → upload.handler-DemogvI1.mjs} +129 -18
  103. package/dist/{users.get.handler-CzaYM2bi.mjs → users.get.handler-B20PMSbl.mjs} +1 -1
  104. package/dist/{users.list.handler-CpOWwzBb.mjs → users.list.handler-BplFTjv3.mjs} +1 -1
  105. package/dist/{users.set-role.handler-BjiSNP2d.mjs → users.set-role.handler-wdmI6o3G.mjs} +1 -1
  106. package/dist/{utils-C_qCshBA.mjs → utils-DpEtybzI.mjs} +2 -2
  107. package/dist/{validate.handler-BtDSKAFY.mjs → validate.handler-BoRyygMl.mjs} +3 -3
  108. package/dist/{workflow-build-Z2_jkOsZ.mjs → workflow-build-CoJMwpPO.mjs} +32 -32
  109. package/dist/{workflow-manifest-BfL74mjp.mjs → workflow-build-manifest-OPFqFD6f.mjs} +26 -28
  110. package/dist/{workflow-bundler-BzHk73PM-tt09RbIA.mjs → workflow-bundler-BzHk73PM-UJQa7Ubk.mjs} +2 -2
  111. package/dist/{workflows-V09d2r2H.mjs → workflows-Cag9O9hx.mjs} +26 -27
  112. package/dist/{writer-CtvttJdP-DZJ0mZCm.mjs → writer-CtvttJdP-BfNsrheU.mjs} +5 -5
  113. package/package.json +10 -8
  114. package/dist/constants-BUgIAu2a.mjs +0 -8
  115. package/dist/credential-requirements-BCW8aQWS.mjs +0 -480
  116. package/dist/credentials-DAQfKqn0.mjs +0 -152025
  117. package/dist/get-intrinsic-BjqiGgLt.mjs +0 -658
  118. package/dist/hosted-action-dispatcher-registry-BWEtn13o.mjs +0 -126
  119. package/dist/schema-B-Wgo4rJ.mjs +0 -81
  120. package/dist/schemas-9FmGqrPT.mjs +0 -42
  121. package/dist/task-1qz1XNq7.mjs +0 -96
  122. package/dist/task-target-deploy-Bzfftyru.mjs +0 -4
  123. /package/dist/{agent-bundle-package-DWV6B_5q-B-qzc3zC.mjs → agent-bundle-package-DWV6B_5q-cB76j6UL.mjs} +0 -0
  124. /package/dist/{browser-CvuyMLhI.mjs → browser-B4K0VW8p.mjs} +0 -0
  125. /package/dist/{clear-cache.handler-D-wboLB6.mjs → clear-cache.handler-Dywqc7TG.mjs} +0 -0
  126. /package/dist/{clear.handler-BC6pz0x-.mjs → clear.handler-ui4e1CnJ.mjs} +0 -0
  127. /package/dist/{concurrency-gXn9Rw8x-CnBnF2cg.mjs → concurrency-gXn9Rw8x-CaI6Vtbu.mjs} +0 -0
  128. /package/dist/{credential-env-map-C23GV6LN.mjs → credential-env-map-D0zgoUl0.mjs} +0 -0
  129. /package/dist/{credential-schema-mismatch-DM9Y91jL.mjs → credential-schema-mismatch-8pqwvswO.mjs} +0 -0
  130. /package/dist/{diff-utils-AATn2n56.mjs → diff-utils-BoXI705D.mjs} +0 -0
  131. /package/dist/{layout-CXkZEsXI.mjs → layout-DRf9qUf8.mjs} +0 -0
  132. /package/dist/{logs.handler-ClIIOeQB.mjs → logs.handler-DxSKmDCq.mjs} +0 -0
  133. /package/dist/{metadata-layout-C6ed-9dl-C6Bylr_z.mjs → metadata-layout-C6ed-9dl-EF5pCtIH.mjs} +0 -0
  134. /package/dist/{options-CIVqkc8V.mjs → options-DFPs-tAB.mjs} +0 -0
  135. /package/dist/{oxc-B3KI3rf_-ghZc3xZ5.mjs → oxc-B3KI3rf_-CHDUXsus.mjs} +0 -0
  136. /package/dist/{read-credential-keys-77a91T8M-B0eiobOd.mjs → read-credential-keys-77a91T8M-CzXPGxdU.mjs} +0 -0
  137. /package/dist/{register.handler-CpP_KB2u.mjs → register.handler-D7ZZAnGP.mjs} +0 -0
  138. /package/dist/{rolldown-runtime-twds-ZHy-RuJszab7.mjs → rolldown-runtime-twds-ZHy-3DMm_Sby.mjs} +0 -0
  139. /package/dist/{run-polling-DDpkIvwy.mjs → run-polling-Cb4ssXIE.mjs} +0 -0
  140. /package/dist/{schema-display-DuWBmkwk.mjs → schema-display-CyCWSgfY.mjs} +0 -0
  141. /package/dist/{skills.handler-CofL4oKs.mjs → skills.handler-C_4VzVmc.mjs} +0 -0
  142. /package/dist/{spinner-progress-Bt8zXPOc.mjs → spinner-progress-CS1BEdNB.mjs} +0 -0
  143. /package/dist/{status.handler-6cuHa0R0.mjs → status.handler-Cm9aNUBn.mjs} +0 -0
  144. /package/dist/{sync-keystroke-agent-skills-D746f2W_.mjs → sync-keystroke-agent-skills-CX9fS5nQ.mjs} +0 -0
  145. /package/dist/{upgrade.handler-DhKeyCy5.mjs → upgrade.handler-C2eZ_tg3.mjs} +0 -0
  146. /package/dist/{upload-C1qFWMm0.mjs → upload-C0kaZu08.mjs} +0 -0
@@ -1,480 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { t as JsonSchemaSchema } from "./common-B3bLe3Mk.mjs";
4
- import { c as optionalDescriptionString, f as trimmedNonEmptyString, h as zodObjectSchema, l as optionalTrimmedNonEmptyString, o as jsonSchemaObject, r as credentialSetIdString, u as resolvedCredentialSetIdString } from "./schema-B-Wgo4rJ.mjs";
5
- import { a as SourceLocationSchema, i as ImportSourceSchema, t as CallKindSchema } from "./source-analysis-CHkWMC40.mjs";
6
- import { z } from "zod";
7
- //#region ../../packages/core/src/credential-set/constants.ts
8
- /**
9
- * Kinds describe what a credential set represents at the platform level.
10
- */
11
- const CREDENTIAL_KINDS = {
12
- "user-connection": "user-connection",
13
- "provider-app": "provider-app"
14
- };
15
- /**
16
- * Visibility determines whether credential values may be injected into user code.
17
- */
18
- const CREDENTIAL_VISIBILITIES = {
19
- "user-visible": "user-visible",
20
- internal: "internal"
21
- };
22
- //#endregion
23
- //#region ../../packages/core/src/credential-set/schemas.ts
24
- const credentialPlatformMetadataSchema = z.object({
25
- kind: z.enum([CREDENTIAL_KINDS["user-connection"], CREDENTIAL_KINDS["provider-app"]]),
26
- visibility: z.enum([CREDENTIAL_VISIBILITIES["user-visible"], CREDENTIAL_VISIBILITIES.internal])
27
- });
28
- const credentialPlatformMetadataJsonSchema = z.object({
29
- kind: z.enum([CREDENTIAL_KINDS["user-connection"], CREDENTIAL_KINDS["provider-app"]]),
30
- visibility: z.enum([CREDENTIAL_VISIBILITIES["user-visible"], CREDENTIAL_VISIBILITIES.internal])
31
- });
32
- const credentialSetProxyInjectionSchema = z.object({
33
- /** Substitute placeholder in HTTP headers (default: true). */
34
- headers: z.boolean().optional(),
35
- /** Substitute placeholder in the HTTP Basic Auth credential (default: true). */
36
- basicAuth: z.boolean().optional(),
37
- /** Substitute placeholder in URL query params (default: false).
38
- * Use for APIs that authenticate via `?api_key=...` (Google Maps, OWM, etc.). */
39
- queryParams: z.boolean().optional(),
40
- /** Substitute placeholder in the HTTP request body (default: false).
41
- * Use for form-encoded auth payloads (Stripe, AWS SigV4 query, etc.). */
42
- body: z.boolean().optional()
43
- });
44
- const credentialSetProxyConfigSchema = z.object({
45
- /** Exact-match host allowlist (forwarded to SecretBuilder.allowHost). */
46
- hosts: z.array(z.string().min(1)).optional(),
47
- /** Wildcard host allowlist (forwarded to SecretBuilder.allowHostPattern).
48
- * Example: `["*.browserbase.com"]` covers any subdomain. */
49
- hostPatterns: z.array(z.string().min(1)).optional(),
50
- /** Per-scope substitution toggles. Omit to use SDK defaults. */
51
- injection: credentialSetProxyInjectionSchema.optional()
52
- });
53
- const onCredentialRevokedSchema = z.enum(["fail", "retry-once"]);
54
- const manualConnectionConfigSchema = z.object({
55
- kind: z.literal("manual"),
56
- instructions: z.string().min(1).optional(),
57
- validate: z.function().optional()
58
- });
59
- const manualConnectionConfigManifestSchema = z.object({
60
- kind: z.literal("manual"),
61
- instructions: z.string().min(1).optional()
62
- });
63
- /** Declarative form of `Vault` — strings typed against the credential set's
64
- * stored/auth schema keys at the {@link CredentialSetConfig} boundary; the Zod
65
- * schema here enforces non-empty strings only. `CredentialSet` itself performs
66
- * the schema-key membership check at construction time. */
67
- const vaultMappingSchema = z.object({
68
- accessToken: z.string().min(1),
69
- instanceUrl: z.string().min(1).optional(),
70
- raw: z.record(z.string().min(1), z.string().min(1)).optional()
71
- });
72
- /** Function form of `Vault` — an object pairing the access-token vault key
73
- * (`accessTokenKey`) with the `build` function that computes the full vault
74
- * write map. The explicit key keeps the disconnect path's revocation read
75
- * reliable even when `build` transforms the access token. */
76
- const vaultMappingFnSchema = z.object({
77
- accessTokenKey: z.string().min(1),
78
- build: z.custom((val) => typeof val === "function", { message: "vault.build must be a function." })
79
- });
80
- /** Runtime shape of `Vault`. Accepts either the declarative mapping or the
81
- * function-form object `{ accessTokenKey, build }`. */
82
- const vaultConfigSchema = z.union([vaultMappingSchema, vaultMappingFnSchema], { error: "vault must be a declarative mapping object or a `{ accessTokenKey, build }` object." });
83
- /** Manifest projection of `Vault` — declarative mappings serialize verbatim;
84
- * function-form mappings serialize as `{ kind: 'function', accessTokenKey }`
85
- * since closures are not manifest-safe but the access-token key is. */
86
- const vaultManifestSchema = z.discriminatedUnion("kind", [z.object({
87
- kind: z.literal("declarative"),
88
- accessToken: z.string().min(1),
89
- instanceUrl: z.string().min(1).optional(),
90
- raw: z.record(z.string().min(1), z.string().min(1)).optional()
91
- }), z.object({
92
- kind: z.literal("function"),
93
- accessTokenKey: z.string().min(1)
94
- })]);
95
- /** Structural check: any object exposing the core {@link AnyCredentialSet}
96
- * shape (id, resolvedCredentialSetId, credentialKeys, platformMetadata).
97
- * The runtime validator inside `CredentialSet.ts` does the deeper
98
- * visibility / key-coverage check.
99
- *
100
- * Intentionally `z.custom` rather than a structural subschema — Zod cannot
101
- * express `z.ZodObject<any>` on the `auth` field, and we only need enough
102
- * structure for the runtime validator to walk the value. */
103
- const oauthClientSourceCredentialSetRef = z.custom((val) => val !== null && typeof val === "object" && "id" in val && "credentialKeys" in val, { message: "oauthClientSource.credentialSet must be a CredentialSet instance." });
104
- const oauthClientSourceSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("keystroke-platform") }), z.object({
105
- kind: z.literal("workspace-provider-app"),
106
- credentialSet: oauthClientSourceCredentialSetRef,
107
- keyMap: z.object({
108
- clientId: z.string().min(1).optional(),
109
- clientSecret: z.string().min(1).optional()
110
- }).optional()
111
- })]);
112
- const oauthClientSourceManifestSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("keystroke-platform") }), z.object({
113
- kind: z.literal("workspace-provider-app"),
114
- credentialSetId: z.string().min(1),
115
- keyMap: z.object({
116
- clientId: z.string().min(1).optional(),
117
- clientSecret: z.string().min(1).optional()
118
- }).optional()
119
- })]);
120
- const oauthConnectionConfigBaseSchema = z.object({
121
- kind: z.literal("oauth"),
122
- authUrl: z.string().url(),
123
- tokenUrl: z.string().url(),
124
- scopes: z.array(z.string()).readonly(),
125
- revokeUrl: z.string().url().nullable().optional(),
126
- tokenType: z.enum(["long-lived", "refreshable"]),
127
- pkce: z.boolean().optional(),
128
- /** Fallback token lifetime when the provider omits `expires_in`. Positive
129
- * integer seconds. Shared between config + manifest schemas (both extend
130
- * this base). */
131
- defaultExpiresInSeconds: z.number().int().positive().optional()
132
- });
133
- const oauthConnectionConfigSchema = oauthConnectionConfigBaseSchema.extend({
134
- vault: vaultConfigSchema,
135
- buildAuthUrl: z.function().optional(),
136
- exchangeCode: z.function().optional(),
137
- refreshToken: z.function().optional(),
138
- extractInstallationInfo: z.function().optional(),
139
- validate: z.function().optional(),
140
- oauthClientSource: oauthClientSourceSchema.optional()
141
- });
142
- const oauthConnectionConfigManifestSchema = oauthConnectionConfigBaseSchema.extend({
143
- vault: vaultManifestSchema,
144
- oauthClientSource: oauthClientSourceManifestSchema.optional()
145
- });
146
- const credentialsExchangeConnectionConfigSchema = z.object({
147
- kind: z.literal("credentials-exchange"),
148
- instructions: z.string().min(1).optional(),
149
- input: zodObjectSchema
150
- }).extend({
151
- exchange: z.function(),
152
- rotate: z.function().optional(),
153
- validate: z.function().optional()
154
- });
155
- /** Manifest projection of `CredentialsExchangeConnectionConfig` — only the
156
- * declarative `input` schema (rendered as JSON Schema) and `instructions`
157
- * copy survive serialization. The three hooks (`exchange`, `rotate`,
158
- * `validate`) are runtime closures and are stripped. */
159
- const credentialsExchangeConnectionConfigManifestSchema = z.object({
160
- kind: z.literal("credentials-exchange"),
161
- instructions: z.string().min(1).optional(),
162
- input: jsonSchemaObject
163
- });
164
- const connectionConfigSchema = z.discriminatedUnion("kind", [
165
- manualConnectionConfigSchema,
166
- oauthConnectionConfigSchema,
167
- credentialsExchangeConnectionConfigSchema
168
- ]);
169
- /** Manifest projection of `ConnectionConfig` — declarative metadata only. */
170
- const connectionConfigManifestSchema = z.discriminatedUnion("kind", [
171
- manualConnectionConfigManifestSchema,
172
- oauthConnectionConfigManifestSchema,
173
- credentialsExchangeConnectionConfigManifestSchema
174
- ]);
175
- const CredentialSetManifestSchema = z.object({
176
- manifestVersion: z.literal(1),
177
- type: z.literal("credentialSet"),
178
- id: credentialSetIdString("Credential set id"),
179
- namespace: credentialSetIdString("Credential set namespace").optional(),
180
- resolvedCredentialSetId: resolvedCredentialSetIdString("Resolved credential set id"),
181
- name: trimmedNonEmptyString("Credential set name"),
182
- description: optionalDescriptionString("Credential set description"),
183
- auth: jsonSchemaObject,
184
- stored: jsonSchemaObject.optional(),
185
- needsResolve: z.boolean().optional(),
186
- /** Run-scoped cache TTL in milliseconds for the credential set's `resolve`
187
- * hook. `0` or absence means no cache hint. Populated from top-level
188
- * `resolveCacheMs` in the authored config. */
189
- resolveCacheMs: z.number().int().nonnegative().optional(),
190
- /** Where the `stored`→`auth` transform runs (cluster 15). `'sandbox'`
191
- * for `resolve`, `'platform'` for `resolveAtPlatform`, `'none'` when
192
- * the credential set has no transform. Omitted in the manifest when
193
- * `'none'` to keep serialized output compact. */
194
- resolveLocation: z.enum(["sandbox", "platform"]).optional(),
195
- /** Platform-side env allowlist (cluster 15). Only meaningful when
196
- * `resolveLocation === 'platform'`. */
197
- platformEnvAllowlist: z.array(z.string().min(1)).optional(),
198
- platformMetadata: credentialPlatformMetadataJsonSchema.optional(),
199
- proxy: credentialSetProxyConfigSchema.optional(),
200
- /** When true, resolved values are passed into execution as raw secrets (no ref-token proxy). */
201
- needsRawSecret: z.boolean().optional(),
202
- /** Policy when a step throws `CredentialRevokedError` against this credential set. */
203
- onCredentialRevoked: onCredentialRevokedSchema.optional(),
204
- connection: connectionConfigManifestSchema.optional()
205
- });
206
- const credentialSetConfigSchema = z.object({
207
- id: credentialSetIdString("Credential set id"),
208
- namespace: credentialSetIdString("Credential set namespace").optional(),
209
- name: optionalTrimmedNonEmptyString("Credential set name"),
210
- description: optionalDescriptionString("Credential set description"),
211
- auth: zodObjectSchema,
212
- stored: zodObjectSchema.optional(),
213
- resolve: z.function().optional(),
214
- /** Run-scoped cache TTL in milliseconds for `resolve` output. Requires `resolve`. */
215
- resolveCacheMs: z.number().int().nonnegative().optional(),
216
- /** Platform-side `stored`→`auth` transform (cluster 15). Runs on the
217
- * trusted host with a scoped fetch + allowlisted env. Mutually
218
- * exclusive with `resolve`. */
219
- resolveAtPlatform: z.function().optional(),
220
- platformEnvAllowlist: z.array(z.string().min(1)).optional(),
221
- platformMetadata: credentialPlatformMetadataSchema.optional(),
222
- proxy: credentialSetProxyConfigSchema.optional(),
223
- /** When true, resolved values are passed into execution as raw secrets (no ref-token proxy). */
224
- needsRawSecret: z.boolean().optional(),
225
- onCredentialRevoked: onCredentialRevokedSchema.optional(),
226
- connection: connectionConfigSchema.optional()
227
- }).refine((c) => !(c.resolve === void 0 && c.resolveCacheMs !== void 0), { message: "`resolveCacheMs` requires `resolve`." }).refine((config) => !(config.namespace === "keystroke" && config.platformMetadata === void 0), { message: "platformMetadata is required when namespace is 'keystroke'" }).refine((config) => !(config.namespace !== "keystroke" && config.connection?.kind === "oauth" && config.connection.oauthClientSource === void 0), { message: "OAuth connections on user-authored (non-keystroke-namespaced) credential sets require `oauthClientSource` to point at a workspace-provider-app credential set. Example: `oauthClientSource: { kind: \"workspace-provider-app\", credentialSet: myClientApp }`." }).refine((config) => {
228
- if (config.connection?.kind !== "oauth") return true;
229
- const source = config.connection.oauthClientSource;
230
- if (!source || source.kind !== "workspace-provider-app") return true;
231
- return source.credentialSet.platformMetadata?.visibility === "internal";
232
- }, { message: "oauthClientSource.credentialSet must be marked `platformMetadata: { visibility: 'internal' }`. This prevents the sandbox from injecting clientSecret into user step code." }).refine((c) => !(c.resolve !== void 0 && c.resolveAtPlatform !== void 0), { message: "`resolve` and `resolveAtPlatform` are mutually exclusive. Pick one: `resolve` for sandbox-side shape transforms, `resolveAtPlatform` for host-side external-secrets calls." }).refine((c) => !(c.platformEnvAllowlist !== void 0 && c.resolveAtPlatform === void 0), { message: "`platformEnvAllowlist` requires `resolveAtPlatform`." });
233
- const IntegrationScopeSchema = z.enum([
234
- "organization",
235
- "project",
236
- "user_provided_credential"
237
- ]);
238
- const IntegrationCredentialRefSchema = z.discriminatedUnion("type", [z.object({
239
- type: z.literal("id"),
240
- id: z.string().startsWith("cset_")
241
- }), z.object({
242
- type: z.literal("name"),
243
- name: z.string().trim().min(1)
244
- })]);
245
- function hasProjectOrOrganizationScope(scope) {
246
- return scope === "organization" || scope === "project";
247
- }
248
- const CredentialRefTokenKeyNameSchema = z.string().regex(/^[A-Za-z0-9_]+$/, "Credential key must contain only letters, digits, and underscores (required for ref-token proxying)");
249
- /** Shared enum for top-level credential-set `onCredentialRevoked` policy. */
250
- const OnCredentialRevokedSchema = z.enum(["fail", "retry-once"]);
251
- /** A credential set after resolution in a built manifest. Contains resolved ID, scope, alias, and credential keys.*/
252
- const ResolvedCredentialSetSchema = z.object({
253
- resolvedId: z.string(),
254
- scope: IntegrationScopeSchema.optional(),
255
- alias: z.string().optional(),
256
- credentialRef: IntegrationCredentialRefSchema.optional(),
257
- /** Auth-shape keys expected post-resolve. */
258
- credentialKeys: z.array(CredentialRefTokenKeyNameSchema),
259
- /** Subset of `credentialKeys` that are optional in the auth shape. */
260
- optionalCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
261
- /** Stored-shape keys required for vault reads and upload flows. */
262
- storedCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
263
- /** Subset of `storedCredentialKeys` that may be absent from the vault without
264
- * failing resolution. Derived from the credential set's `stored` schema:
265
- * a Zod field wrapped in `.optional()` / `.default()` or a JSON Schema
266
- * property not listed in `required` is considered optional. */
267
- optionalStoredCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
268
- proxy: credentialSetProxyConfigSchema.optional(),
269
- /** When true, resolved values are passed raw (no ref-token proxy) for this set. */
270
- needsRawSecret: z.boolean().optional(),
271
- /** When true, the credential set has a user `resolve` callback that runs in
272
- * the sandbox before each step. Routes credentials to env (not Secret.env). */
273
- needsResolve: z.boolean().optional(),
274
- /** Run-scoped cache TTL in milliseconds for the credential set's `resolve`
275
- * hook output. `0` or absence means no cache hint. */
276
- resolveCacheMs: z.number().int().nonnegative().optional(),
277
- /** Policy when a step throws `CredentialRevokedError` against this credential set. */
278
- onCredentialRevoked: OnCredentialRevokedSchema.optional(),
279
- /** Persistence-layer schema fingerprint stamped at build time. The
280
- * resolver's phase 2 compares this against the vault row's stored
281
- * fingerprint and raises `CredentialSchemaMismatchError` on drift.
282
- * Optional here so pre-fingerprint artifacts still parse; the
283
- * workflow builder populates it for every authored credential set
284
- * that has a resolvable fingerprint. */
285
- schemaFingerprint: z.string().optional()
286
- }).superRefine((value, ctx) => {
287
- if (value.credentialRef && !hasProjectOrOrganizationScope(value.scope)) ctx.addIssue({
288
- code: z.ZodIssueCode.custom,
289
- path: ["credentialRef"],
290
- message: "credentialRef requires scope to be \"project\" or \"organization\""
291
- });
292
- });
293
- const DeclaredCredentialRequirementSchema = z.object({
294
- credentialSetId: z.string(),
295
- namespace: z.string().optional(),
296
- resolvedCredentialSetId: z.string(),
297
- /** Auth-shape keys expected post-resolve. */
298
- credentialKeys: z.array(CredentialRefTokenKeyNameSchema),
299
- /** Optional subset of the auth-shape keys. */
300
- optionalCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
301
- /** Stored-shape keys required for vault reads. */
302
- storedCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
303
- /** Optional subset of the stored-shape keys. */
304
- optionalStoredCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
305
- schemaFingerprint: z.string().optional(),
306
- needsResolve: z.boolean().optional(),
307
- /** Run-scoped cache TTL in milliseconds for the credential set's `resolve`
308
- * hook output. `0` or absence means no cache hint. */
309
- resolveCacheMs: z.number().int().nonnegative().optional(),
310
- /** Policy when a step throws `CredentialRevokedError` against this credential set. */
311
- onCredentialRevoked: OnCredentialRevokedSchema.optional(),
312
- proxy: credentialSetProxyConfigSchema.optional(),
313
- needsRawSecret: z.boolean().optional(),
314
- requiredOAuthScopes: z.array(z.string()).optional()
315
- });
316
- const CredentialRequirementEntrySchema = z.object({
317
- credentialSetId: z.string(),
318
- scope: IntegrationScopeSchema.optional(),
319
- alias: z.string().optional(),
320
- credentialRef: IntegrationCredentialRefSchema.optional(),
321
- /** Auth-shape keys expected post-resolve. */
322
- credentialKeys: z.array(CredentialRefTokenKeyNameSchema),
323
- /** Optional subset of the auth-shape keys. */
324
- optionalCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
325
- /** Stored-shape keys required for vault reads. */
326
- storedCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
327
- /** Optional subset of the stored-shape keys. */
328
- optionalStoredCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
329
- schemaFingerprint: z.string().optional(),
330
- proxy: credentialSetProxyConfigSchema.optional(),
331
- needsRawSecret: z.boolean().optional(),
332
- /** When true, the credential set has a user `resolve` callback. Routes
333
- * credentials to env (not Secret.env) so the callback can transform them. */
334
- needsResolve: z.boolean().optional(),
335
- /** Run-scoped cache TTL in milliseconds for the credential set's `resolve`
336
- * hook output. `0` or absence means no cache hint. */
337
- resolveCacheMs: z.number().int().nonnegative().optional(),
338
- /** Policy when a step throws `CredentialRevokedError` against this credential set. */
339
- onCredentialRevoked: OnCredentialRevokedSchema.optional(),
340
- requiredOAuthScopes: z.array(z.string()).optional()
341
- }).superRefine((value, ctx) => {
342
- if (value.credentialRef && !hasProjectOrOrganizationScope(value.scope)) ctx.addIssue({
343
- code: z.ZodIssueCode.custom,
344
- path: ["credentialRef"],
345
- message: "credentialRef requires scope to be \"project\" or \"organization\""
346
- });
347
- });
348
- const CredentialRequirementsSchema = z.object({
349
- required: z.array(z.string()),
350
- byStep: z.record(z.string(), z.array(CredentialRequirementEntrySchema))
351
- });
352
- const TriggerCallbackNameSchema = z.enum([
353
- "filter",
354
- "idempotencyKey",
355
- "verify",
356
- "callback"
357
- ]);
358
- const TriggerCredentialRequirementEntrySchema = CredentialRequirementEntrySchema;
359
- const TriggerCredentialRequirementsSchema = z.object({
360
- required: z.array(z.string()),
361
- byCallback: z.partialRecord(TriggerCallbackNameSchema, z.array(TriggerCredentialRequirementEntrySchema))
362
- });
363
- function buildCredentialRequirementEntryKey(entry) {
364
- const credentialRefKey = entry.credentialRef ? entry.credentialRef.type === "id" ? `id:${entry.credentialRef.id}` : `name:${entry.credentialRef.name}` : "";
365
- return [
366
- entry.credentialSetId,
367
- entry.scope ?? "",
368
- entry.alias ?? "",
369
- credentialRefKey,
370
- entry.schemaFingerprint ?? "",
371
- [...entry.credentialKeys].sort().join(","),
372
- [...entry.optionalCredentialKeys ?? []].sort().join(","),
373
- [...entry.storedCredentialKeys ?? []].sort().join(","),
374
- [...entry.optionalStoredCredentialKeys ?? []].sort().join(","),
375
- entry.needsRawSecret === true ? "1" : "0",
376
- entry.needsResolve === true ? "1" : "0",
377
- typeof entry.resolveCacheMs === "number" ? String(entry.resolveCacheMs) : "",
378
- entry.onCredentialRevoked ?? "",
379
- entry.proxy ? JSON.stringify(entry.proxy) : ""
380
- ].join("|");
381
- }
382
- function deduplicateCredentialRequirementEntries(entries) {
383
- const deduped = /* @__PURE__ */ new Map();
384
- for (const entry of entries) {
385
- const key = buildCredentialRequirementEntryKey(entry);
386
- const existing = deduped.get(key);
387
- if (!existing) deduped.set(key, {
388
- ...entry,
389
- credentialKeys: [...entry.credentialKeys].sort(),
390
- ...entry.optionalCredentialKeys ? { optionalCredentialKeys: [...entry.optionalCredentialKeys].sort() } : {},
391
- ...entry.storedCredentialKeys ? { storedCredentialKeys: [...entry.storedCredentialKeys].sort() } : {},
392
- ...entry.optionalStoredCredentialKeys ? { optionalStoredCredentialKeys: [...entry.optionalStoredCredentialKeys].sort() } : {}
393
- });
394
- else if (entry.requiredOAuthScopes?.length) {
395
- const merged = new Set([...existing.requiredOAuthScopes ?? [], ...entry.requiredOAuthScopes]);
396
- deduped.set(key, {
397
- ...existing,
398
- requiredOAuthScopes: [...merged].sort()
399
- });
400
- }
401
- }
402
- return [...deduped.values()];
403
- }
404
- function collectCredentialRequirementEntries(credentialRequirements) {
405
- if (!credentialRequirements) return [];
406
- return deduplicateCredentialRequirementEntries(Object.values(credentialRequirements.byStep ?? {}).flat());
407
- }
408
- const ExecutionIdentityPolicySchema = z.object({ subjectMode: z.enum(["never", "requiredWhenUserProvidedCredential"]) });
409
- /** A step's entry within a WorkflowManifest. Describes how a step is used in a workflow, not what the step itself is. */
410
- const WorkflowStepEntrySchema = z.object({
411
- nodeId: z.string().min(1),
412
- stepName: z.string().min(1),
413
- label: z.string().min(1),
414
- callKind: CallKindSchema,
415
- stepId: z.string().min(1).optional(),
416
- source: SourceLocationSchema.optional(),
417
- astKind: z.string().min(1).optional(),
418
- importSource: ImportSourceSchema.optional(),
419
- outputBinding: z.string().min(1).optional(),
420
- scopeOverride: IntegrationScopeSchema.optional(),
421
- description: z.string().optional(),
422
- sourceCode: z.string().optional(),
423
- exportName: z.string().optional(),
424
- inputSchema: JsonSchemaSchema.optional(),
425
- outputSchema: JsonSchemaSchema.optional(),
426
- credentialSets: z.array(ResolvedCredentialSetSchema).optional()
427
- });
428
- const TriggerTypeSchema = z.enum([
429
- "webhook",
430
- "cron",
431
- "polling"
432
- ]);
433
- /**
434
- * Persisted on `deployment_triggers.trigger_source`. Mirrors the
435
- * `webhookTrigger({ source: { type } })` discriminator so the server
436
- * can index-filter app-source rows during provider-webhook fanout.
437
- */
438
- const TriggerSourceSchema = z.enum(["custom", "app"]);
439
- const WebhookMethodSchema = z.enum([
440
- "GET",
441
- "POST",
442
- "PUT",
443
- "PATCH"
444
- ]);
445
- const TriggerCallbackBundleUploadSchema = z.object({
446
- code: z.string(),
447
- hash: z.string(),
448
- size: z.number()
449
- });
450
- const TriggerCallbackExportsSchema = z.object({
451
- verify: z.string().min(1).optional(),
452
- filter: z.string().min(1).optional(),
453
- idempotencyKey: z.string().min(1).optional(),
454
- callback: z.string().min(1).optional()
455
- });
456
- const TransformCallbackExportsSchema = z.object({ transform: z.string().min(1).optional() });
457
- const TriggerUploadDataSchema = z.object({
458
- id: z.string(),
459
- type: TriggerTypeSchema,
460
- /**
461
- * Source-of-truth discriminator for webhook triggers. `'custom'` means
462
- * the trigger owns its own HTTP path; `'app'` means it is fanned out by
463
- * a Keystroke-managed provider app. Undefined for non-webhook triggers.
464
- */
465
- triggerSource: TriggerSourceSchema.optional(),
466
- enabled: z.boolean(),
467
- path: z.string().optional(),
468
- method: WebhookMethodSchema.optional(),
469
- schedule: z.string().optional(),
470
- timezone: z.string().optional(),
471
- config: z.record(z.string(), z.unknown()).optional(),
472
- requiredCredentials: TriggerCredentialRequirementsSchema.optional(),
473
- storagePath: z.string().min(1).optional(),
474
- callbackBundle: TriggerCallbackBundleUploadSchema.optional(),
475
- callbackExports: TriggerCallbackExportsSchema.optional(),
476
- transformCallbackBundle: TriggerCallbackBundleUploadSchema.optional(),
477
- transformCallbackExports: TransformCallbackExportsSchema.optional()
478
- });
479
- //#endregion
480
- export { CREDENTIAL_VISIBILITIES as _, ResolvedCredentialSetSchema as a, TriggerTypeSchema as c, WorkflowStepEntrySchema as d, collectCredentialRequirementEntries as f, CREDENTIAL_KINDS as g, credentialSetConfigSchema as h, IntegrationScopeSchema as i, TriggerUploadDataSchema as l, CredentialSetManifestSchema as m, DeclaredCredentialRequirementSchema as n, TriggerCredentialRequirementsSchema as o, deduplicateCredentialRequirementEntries as p, ExecutionIdentityPolicySchema as r, TriggerSourceSchema as s, CredentialRequirementsSchema as t, WebhookMethodSchema as u };