@keystrokehq/cli 0.0.18 → 0.0.20

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/README.md +1 -1
  2. package/dist/{accept.handler-B7QzdKCh.mjs → accept.handler-CiqqUxKN.mjs} +1 -1
  3. package/dist/{admin-CYpulx_A.mjs → admin-B0U2Aghv.mjs} +9 -9
  4. package/dist/{agent-bundle-package-DWV6B_5q-FPT0bJaA.mjs → agent-bundle-package-DWV6B_5q-BsbCEeMw.mjs} +1 -1
  5. package/dist/{agents-Co6Jy_N8.mjs → agents-DBebUEwk.mjs} +6 -6
  6. package/dist/{api-DsK8M-ZH.mjs → api-BjBpWWlm.mjs} +4 -5
  7. package/dist/{api-keys-BUCLzRv_.mjs → api-keys-BHAgmC4E.mjs} +5 -5
  8. package/dist/{auth-niNm-yNT.mjs → auth-D-PZAjdd.mjs} +6 -6
  9. package/dist/{auth.handler-BTH-Qb00.mjs → auth.handler-CxTDSO6O.mjs} +3 -3
  10. package/dist/{build-agents-DseUtzd4-CthuIecx.mjs → build-agents-DseUtzd4-BNtZrqoY.mjs} +5 -5
  11. package/dist/{build-metadata-C8Ra_Gi--L3l8w0rh.mjs → build-metadata-BB_L45ZS-d5-QLDZ5.mjs} +10 -10
  12. package/dist/{build-progress-AR8xow4_.mjs → build-progress-BVwDg6lC.mjs} +1 -1
  13. package/dist/{build-tasks-GVuMLS0h-CCxCqd02.mjs → build-tasks-C09SdfjC-DxKcmENc.mjs} +4 -4
  14. package/dist/{build-workflows-CV4tBo6S-DhFBlp6m.mjs → build-workflows-BZ_m97Pr-DwcnRlyh.mjs} +9 -10
  15. package/dist/{build.handler-BmlXPhed.mjs → build.handler-CTX80S1K.mjs} +4 -4
  16. package/dist/{chunk-CH6r78ws.mjs → chunk-DYxdGL9S.mjs} +2 -1
  17. package/dist/{clear.handler-BDlwBzX4.mjs → clear.handler-Bksm2HI4.mjs} +1 -1
  18. package/dist/{commander-BE37hxR3.mjs → commander-DQLrBSIW.mjs} +1 -1
  19. package/dist/{connect-C9NMD8Ky.mjs → connect-DV_EztVs.mjs} +2 -2
  20. package/dist/{connect.handler-C7kysvhz.mjs → connect.handler-DbuGt3Xb.mjs} +3 -3
  21. package/dist/{context-Bid-Rqj7.mjs → context-BUzxM3QI.mjs} +2 -2
  22. package/dist/{create.handler-Cp9CV6SN.mjs → create.handler-CQCRk-Na.mjs} +1 -1
  23. package/dist/{credentials-fMfKVlEn.mjs → credentials-m18a1_hw.mjs} +6 -6
  24. package/dist/{credentials-DUkVbhvj.mjs → credentials-xPtLFTjW.mjs} +2 -2
  25. package/dist/{current-deployment-workflow-DiwUcKoB.mjs → current-deployment-workflow-pyBoobIm.mjs} +4 -4
  26. package/dist/{current.handler-eCR4nClu.mjs → current.handler-BJGJgdGP.mjs} +1 -1
  27. package/dist/{default-urls-CTQqM1_A.mjs → default-urls-BoSm4s9C.mjs} +1 -1
  28. package/dist/{delete.handler-D4ElSAcr.mjs → delete.handler-DNoehdOH.mjs} +1 -1
  29. package/dist/{deploy-B7LRWcp6.mjs → deploy-3tHCBGky.mjs} +2 -2
  30. package/dist/{deploy-DyZh--f7.mjs → deploy-BKjcO_sm.mjs} +1 -1
  31. package/dist/{deploy-progress-DK87VKJ-.mjs → deploy-progress-CyolzjRB.mjs} +1 -1
  32. package/dist/{deploy.handler-DVnH-Niv.mjs → deploy.handler-TnPNBYXZ.mjs} +27 -15
  33. package/dist/{detect-env-access-CwkOYeYM-CNTyUzme.mjs → detect-env-access-CwkOYeYM-D8-hxij0.mjs} +2 -2
  34. package/dist/{diff.handler-lIA2pRBX.mjs → diff.handler-DO2WzdGB.mjs} +3 -3
  35. package/dist/{dist-WFPTDQB3.mjs → dist-BGrWr5fp.mjs} +32 -37
  36. package/dist/{env.handler-BIzQLlmo.mjs → env.handler-C5GNyiJt.mjs} +6 -6
  37. package/dist/{error-boundary-B8cmSwJH.mjs → error-boundary-GtRvP2oP.mjs} +1 -1
  38. package/dist/{file-metadata-lrX05iRt.mjs → file-metadata-B8c7Y5yg.mjs} +2 -7
  39. package/dist/{import-module--8x5SLum-D7EiPjwl.mjs → import-module-y0glInUe-CfNsQNia.mjs} +48 -839
  40. package/dist/{init-jaqNLGmB.mjs → init-D9RIT2CY.mjs} +3 -3
  41. package/dist/{init.handler-DamvbPEw.mjs → init.handler-0TJY1YNy.mjs} +2 -2
  42. package/dist/{inspect.handler-_UcN7dxE.mjs → inspect.handler-BrYFfN4H.mjs} +3 -3
  43. package/dist/{integration-catalog-m8tj_XlD.mjs → integration-catalog-BrJsBkfx.mjs} +1 -1
  44. package/dist/integrations-vSyAQ6HA.mjs +185 -0
  45. package/dist/{invites-VntHNMYk.mjs → invites-BASM4PJr.mjs} +4 -4
  46. package/dist/{invites.list.handler-CPl4QHfc.mjs → invites.list.handler-c-aw6g5o.mjs} +1 -1
  47. package/dist/{invites.resend.handler-BAtb3AX4.mjs → invites.resend.handler-MnMEjP_Z.mjs} +1 -1
  48. package/dist/{invites.revoke.handler-qXOF1Vgx.mjs → invites.revoke.handler-CHX6Z8kj.mjs} +1 -1
  49. package/dist/keystroke.mjs +25 -24
  50. package/dist/{list-enrichment-DYvr3XDb.mjs → list-enrichment-DcplcioC.mjs} +1 -1
  51. package/dist/{list.handler-C_iBLBmS.mjs → list.handler-BBzB1_1l.mjs} +1 -1
  52. package/dist/{list.handler-pHnPFep8.mjs → list.handler-BsgCd1oF.mjs} +5 -5
  53. package/dist/{list.handler-BdRsjRlf.mjs → list.handler-CDtjm-6d.mjs} +1 -1
  54. package/dist/{list.handler-DUz1bJ4x.mjs → list.handler-DJNtXw7C.mjs} +1 -1
  55. package/dist/{list.handler-CEjKSezx.mjs → list.handler-DXwKdfIv.mjs} +2 -2
  56. package/dist/{list.handler-CJUFdmaU.mjs → list2.handler-BdE1k2kl.mjs} +3 -3
  57. package/dist/{listen-DLGZEQRL.mjs → listen-Ca9KdiB2.mjs} +2 -2
  58. package/dist/{listen.handler-kaAvYk-B.mjs → listen.handler-KWPN03S8.mjs} +2 -2
  59. package/dist/{logs-CcYqFKRU.mjs → logs-BEDf7hZ0.mjs} +3 -3
  60. package/dist/{logs.handler-lboRKNoE.mjs → logs.handler-mk1lcZbU.mjs} +2 -2
  61. package/dist/{members.add.handler-DBydP0SR.mjs → members.add.handler-CTvlxBZU.mjs} +1 -1
  62. package/dist/{members.invite.handler-D4-7fiYC.mjs → members.invite.handler-wFO0r7Pi.mjs} +1 -1
  63. package/dist/{members.list.handler-Z4cIbcNg.mjs → members.list.handler-PPdqs4nI.mjs} +1 -1
  64. package/dist/{members.remove.handler-J56D83O7.mjs → members.remove.handler-a5WI6zE4.mjs} +1 -1
  65. package/dist/{members.update.handler-B5rBv6dt.mjs → members.update.handler-3xblTzmz.mjs} +1 -1
  66. package/dist/{metadata-layout-Bv-B0nHj-B1c5giJ7.mjs → metadata-layout-Bv-B0nHj-DtMWZ7Cc.mjs} +1 -1
  67. package/dist/{normalize-path-CojS-CgQ-D4wSBHgG.mjs → normalize-path-CojS-CgQ-CRqBc6D6.mjs} +1 -1
  68. package/dist/{org-DGS91uc-.mjs → org-CzLw3neZ.mjs} +15 -15
  69. package/dist/{orgs.create.handler-B4naNUSN.mjs → orgs.create.handler-CcPpDweZ.mjs} +1 -1
  70. package/dist/{orgs.get.handler-Ci_JrT08.mjs → orgs.get.handler-BACPg7vR.mjs} +1 -1
  71. package/dist/{orgs.list.handler-CJ2byIEj.mjs → orgs.list.handler-DEF8OyvM.mjs} +1 -1
  72. package/dist/{paused.handler-BQSQvQhB.mjs → paused.handler-D4j8_Za4.mjs} +1 -1
  73. package/dist/{projects-D90_uEC2.mjs → projects-CJCKxG2u.mjs} +4 -4
  74. package/dist/{projects-fWvIJQ80.mjs → projects-s5ehKLil.mjs} +6 -4
  75. package/dist/{register.handler-CleQJhtQ.mjs → register.handler-CSvlOMF6.mjs} +18 -9
  76. package/dist/{requirements.handler-B51sxQSy.mjs → requirements.handler-Bk-sAE9C.mjs} +5 -5
  77. package/dist/{run-polling-CC6y2XXI.mjs → run-polling-DKclfet-.mjs} +3 -3
  78. package/dist/{run.handler-B31BpZJP.mjs → run.handler-x0B-CjNF.mjs} +4 -4
  79. package/dist/{runs-Bg_qDeQi.mjs → runs-DoMVOCNj.mjs} +2 -2
  80. package/dist/{schemas-B8c7Z5Iy.mjs → schemas-U2OzP9gP.mjs} +3 -2
  81. package/dist/{skills-sync.handler-DOxudKmV.mjs → skills-sync.handler-CYkCeuQn.mjs} +1 -1
  82. package/dist/{skills.command-JwKWpGvU.mjs → skills.command-DeAgMGGw.mjs} +4 -4
  83. package/dist/{source-analysis-BBg2E_6G-Ut7kYHOz.mjs → source-analysis-BBg2E_6G-BJTRqWrQ.mjs} +3 -3
  84. package/dist/{source-analysis-Cs0CTBQk.mjs → source-analysis-BMMPIHN9.mjs} +1 -1
  85. package/dist/src-BHTjsZ9V.mjs +456 -0
  86. package/dist/{src-B0tNjKMg.mjs → src-BYQwp8Ig.mjs} +1 -1
  87. package/dist/{switch.handler-Cu81T2HY.mjs → switch.handler-CV4ZBXAu.mjs} +1 -1
  88. package/dist/{sync-CXNveL61.mjs → sync-KCVM02IY.mjs} +2 -2
  89. package/dist/{sync.handler-7g1yDt0H.mjs → sync.handler-Cuw89341.mjs} +6 -6
  90. package/dist/task-BSCN9cU4.mjs +945 -0
  91. package/dist/{task-target-build-BaMtXnN7.mjs → task-target-build-B0HF2_At.mjs} +41 -55
  92. package/dist/task-target-deploy-ClbwKJ8K.mjs +4 -0
  93. package/dist/{task-target-deploy-CZBGNC0H-I-tvkGCC.mjs → task-target-deploy-dQYnMO8n-CeTmRcDw.mjs} +15 -17
  94. package/dist/task-target-deploy-runner.mjs +6 -6
  95. package/dist/{test-A5hz3c7j.mjs → test-Rm3thni3.mjs} +2 -2
  96. package/dist/{test.handler-CJtaMZVy.mjs → test.handler-CTd-heRS.mjs} +8 -8
  97. package/dist/{test.handler-Cq2l7SAr.mjs → test.handler-DhhcsvHN.mjs} +1 -1
  98. package/dist/{tool.handler-B-mOL128.mjs → tool.handler-C3LNyQbc.mjs} +9 -63
  99. package/dist/{trigger-artifacts-RizI57RC-DjhOsdOm.mjs → trigger-artifacts-BcRScRSp-DqFgzl_B.mjs} +53 -119
  100. package/dist/trigger-manifest-DTni4NaZ.mjs +42 -0
  101. package/dist/{upgrade-DhfpoyRV.mjs → upgrade-Cf7y38xR.mjs} +2 -2
  102. package/dist/{upload-BbcMkyVl.mjs → upload-CJWApEgz.mjs} +1 -1
  103. package/dist/{upload.handler-D3-W_1kq.mjs → upload.handler-BHIWYPph.mjs} +7 -7
  104. package/dist/{users.get.handler-Bd0OBI-E.mjs → users.get.handler-spWaHG8h.mjs} +1 -1
  105. package/dist/{users.list.handler-CacJz6eC.mjs → users.list.handler-DLuU7cd_.mjs} +1 -1
  106. package/dist/{users.set-role.handler-bZMQtUR0.mjs → users.set-role.handler-CojFmpcD.mjs} +1 -1
  107. package/dist/{utils-BMUWnz1P.mjs → utils-Ddltm1sR.mjs} +1 -1
  108. package/dist/{validate.handler-Ccq66ki4.mjs → validate.handler-DIJBuX1P.mjs} +4 -4
  109. package/dist/{workflow-build-_WNsLKwW.mjs → workflow-build-IGYhEC8Y.mjs} +22 -22
  110. package/dist/{workflow-bundler-BzHk73PM-WI31RJjH.mjs → workflow-bundler-BzHk73PM-Cs-4Ml-p.mjs} +2 -2
  111. package/dist/{workflows-Dy2M9bEr.mjs → workflows-MANdvLft.mjs} +19 -21
  112. package/dist/{writer-B-SpZ0G2-tq1MFgid.mjs → writer-byNNUjRm-w5O7-VT_.mjs} +24 -33
  113. package/package.json +11 -11
  114. package/dist/common-AK0q0Oz0.mjs +0 -20
  115. package/dist/credential-requirements-DrrQ9x9P.mjs +0 -250
  116. package/dist/cron-parser-Dw_cWzFu.mjs +0 -393
  117. package/dist/declared-credential-requirements-D6KT-r-e.mjs +0 -103
  118. package/dist/integrations-DRL3JmC8.mjs +0 -85
  119. package/dist/task-BguWXIiH.mjs +0 -486
  120. package/dist/task-target-deploy-DmpCWE3u.mjs +0 -4
  121. package/dist/trigger-manifest-Bq2zRbkV.mjs +0 -29
  122. package/dist/workflow-build-manifest-B2GqHyWE.mjs +0 -259
  123. /package/dist/{agent-manifest-tIsqF2OP.mjs → agent-manifest-CZ7BeUSG.mjs} +0 -0
  124. /package/dist/{browser-BpJ8ut9z.mjs → browser-Cu4k-wT_.mjs} +0 -0
  125. /package/dist/{clear-cache.handler-CTLQ1PIN.mjs → clear-cache.handler-8RFmjHoo.mjs} +0 -0
  126. /package/dist/{clear.handler-C_pXAeBG.mjs → clear.handler-mfNmIUYP.mjs} +0 -0
  127. /package/dist/{concurrency-gXn9Rw8x-BTlfau8D.mjs → concurrency-gXn9Rw8x-BSBbRfVp.mjs} +0 -0
  128. /package/dist/{credential-env-map-BA4LNI7x.mjs → credential-env-map-qLCR_QbO.mjs} +0 -0
  129. /package/dist/{credential-schema-mismatch-z74ud-YZ.mjs → credential-schema-mismatch-BHI_B-U-.mjs} +0 -0
  130. /package/dist/{diff-utils-B0ED-Igv.mjs → diff-utils-x5pi8SrL.mjs} +0 -0
  131. /package/dist/{layout-P1v-Gssz.mjs → layout-DRf9qUf8.mjs} +0 -0
  132. /package/dist/{list.handler-BLkQKiV1.mjs → list.handler-CynN-ezD.mjs} +0 -0
  133. /package/dist/{logs.handler-DyRoevtO.mjs → logs.handler-CcA1UzJm.mjs} +0 -0
  134. /package/dist/{oxc-B3KI3rf_-Cvx4Z-4H.mjs → oxc-B3KI3rf_-Cnk0L10M.mjs} +0 -0
  135. /package/dist/{read-credential-keys-77a91T8M-B0eiobOd.mjs → read-credential-keys-77a91T8M-CzXPGxdU.mjs} +0 -0
  136. /package/dist/{resolve-project-CNQtOWE4.mjs → resolve-project-CWP2fji3.mjs} +0 -0
  137. /package/dist/{rolldown-runtime-twds-ZHy-8uqgIurC.mjs → rolldown-runtime-twds-ZHy-BoF7MLzP.mjs} +0 -0
  138. /package/dist/{run-polling-DARidqo-.mjs → run-polling-CzyVv7Ba.mjs} +0 -0
  139. /package/dist/{schema-BjH_e4Fo.mjs → schema-CvSZqa3t.mjs} +0 -0
  140. /package/dist/{schema-display-NVEl_DFY.mjs → schema-display-DxLA3j5H.mjs} +0 -0
  141. /package/dist/{skill-installer-BBgN2tzW.mjs → skill-installer-CYFshTBy.mjs} +0 -0
  142. /package/dist/{skills.handler-Do9I3dQS.mjs → skills.handler-Bma-MJX-.mjs} +0 -0
  143. /package/dist/{spinner-progress-Bx-fYItP.mjs → spinner-progress-DV28G4tP.mjs} +0 -0
  144. /package/dist/{status.handler-BsVtDW_V.mjs → status.handler-BOV0eX3J.mjs} +0 -0
  145. /package/dist/{types-BMBuhHhW.mjs → types-DamInJD6.mjs} +0 -0
  146. /package/dist/{upgrade.handler-5qSzPC7D.mjs → upgrade.handler-Bz_oQcAw.mjs} +0 -0
@@ -0,0 +1,945 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { n as __exportAll } from "./chunk-DYxdGL9S.mjs";
4
+ import { a as descriptionString, c as optionalDescriptionString, d as trimmedNonEmptyStringUnbounded, i as createStructuralSchema, n as credentialSetProxyConfigSchema, o as idNoSpacesString, s as jsonSchemaObject, t as CredentialSetManifestSchema, u as trimmedNonEmptyString } from "./schemas-U2OzP9gP.mjs";
5
+ import { z } from "zod";
6
+ import "node:crypto";
7
+ const SHA256HashSchema = z.string().length(64, "Must be 64 characters").regex(/^[a-f0-9]{64}$/i, "Must be hexadecimal").transform((value) => value);
8
+ const JsonSchemaSchema = z.record(z.string(), z.unknown());
9
+ z.object({
10
+ constant: z.object({
11
+ attempts: z.number().int().min(1).max(10),
12
+ seconds: z.number().positive()
13
+ }).optional(),
14
+ exponential: z.object({
15
+ attempts: z.number().int().min(1).max(10),
16
+ base: z.number().min(1).optional(),
17
+ multiplier: z.number().positive().optional()
18
+ }).optional()
19
+ }).refine((data) => {
20
+ return data.constant !== void 0 !== (data.exponential !== void 0);
21
+ }, { error: "Retry config must specify exactly one of constant or exponential strategy" });
22
+ //#endregion
23
+ //#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/utils.js
24
+ function extractDateElements(date) {
25
+ return {
26
+ second: date.getSeconds(),
27
+ minute: date.getMinutes(),
28
+ hour: date.getHours(),
29
+ day: date.getDate(),
30
+ month: date.getMonth(),
31
+ weekday: date.getDay(),
32
+ year: date.getFullYear()
33
+ };
34
+ }
35
+ function getDaysInMonth(year, month) {
36
+ return new Date(year, month + 1, 0).getDate();
37
+ }
38
+ function getDaysBetweenWeekdays(weekday1, weekday2) {
39
+ if (weekday1 <= weekday2) return weekday2 - weekday1;
40
+ return 6 - weekday1 + weekday2 + 1;
41
+ }
42
+ //#endregion
43
+ //#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/cron.js
44
+ var Cron = class {
45
+ constructor({ seconds, minutes, hours, days, months, weekdays }) {
46
+ if (!seconds || seconds.size === 0) throw new Error("There must be at least one allowed second.");
47
+ if (!minutes || minutes.size === 0) throw new Error("There must be at least one allowed minute.");
48
+ if (!hours || hours.size === 0) throw new Error("There must be at least one allowed hour.");
49
+ if (!months || months.size === 0) throw new Error("There must be at least one allowed month.");
50
+ if ((!weekdays || weekdays.size === 0) && (!days || days.size === 0)) throw new Error("There must be at least one allowed day or weekday.");
51
+ this.seconds = Array.from(seconds).sort((a, b) => a - b);
52
+ this.minutes = Array.from(minutes).sort((a, b) => a - b);
53
+ this.hours = Array.from(hours).sort((a, b) => a - b);
54
+ this.days = Array.from(days).sort((a, b) => a - b);
55
+ this.months = Array.from(months).sort((a, b) => a - b);
56
+ this.weekdays = Array.from(weekdays).sort((a, b) => a - b);
57
+ const validateData = (name, data, constraint) => {
58
+ if (data.some((x) => typeof x !== "number" || x % 1 !== 0 || x < constraint.min || x > constraint.max)) throw new Error(`${name} must only consist of integers which are within the range of ${constraint.min} and ${constraint.max}`);
59
+ };
60
+ validateData("seconds", this.seconds, {
61
+ min: 0,
62
+ max: 59
63
+ });
64
+ validateData("minutes", this.minutes, {
65
+ min: 0,
66
+ max: 59
67
+ });
68
+ validateData("hours", this.hours, {
69
+ min: 0,
70
+ max: 23
71
+ });
72
+ validateData("days", this.days, {
73
+ min: 1,
74
+ max: 31
75
+ });
76
+ validateData("months", this.months, {
77
+ min: 0,
78
+ max: 11
79
+ });
80
+ validateData("weekdays", this.weekdays, {
81
+ min: 0,
82
+ max: 6
83
+ });
84
+ this.reversed = {
85
+ seconds: this.seconds.map((x) => x).reverse(),
86
+ minutes: this.minutes.map((x) => x).reverse(),
87
+ hours: this.hours.map((x) => x).reverse(),
88
+ days: this.days.map((x) => x).reverse(),
89
+ months: this.months.map((x) => x).reverse(),
90
+ weekdays: this.weekdays.map((x) => x).reverse()
91
+ };
92
+ }
93
+ /**
94
+ * Find the next or previous hour, starting from the given start hour that matches the hour constraint.
95
+ * startHour itself might also be allowed.
96
+ */
97
+ findAllowedHour(dir, startHour) {
98
+ return dir === "next" ? this.hours.find((x) => x >= startHour) : this.reversed.hours.find((x) => x <= startHour);
99
+ }
100
+ /**
101
+ * Find the next or previous minute, starting from the given start minute that matches the minute constraint.
102
+ * startMinute itself might also be allowed.
103
+ */
104
+ findAllowedMinute(dir, startMinute) {
105
+ return dir === "next" ? this.minutes.find((x) => x >= startMinute) : this.reversed.minutes.find((x) => x <= startMinute);
106
+ }
107
+ /**
108
+ * Find the next or previous second, starting from the given start second that matches the second constraint.
109
+ * startSecond itself IS NOT allowed.
110
+ */
111
+ findAllowedSecond(dir, startSecond) {
112
+ return dir === "next" ? this.seconds.find((x) => x > startSecond) : this.reversed.seconds.find((x) => x < startSecond);
113
+ }
114
+ /**
115
+ * Find the next or previous time, starting from the given start time that matches the hour, minute
116
+ * and second constraints. startTime itself might also be allowed.
117
+ */
118
+ findAllowedTime(dir, startTime) {
119
+ let hour = this.findAllowedHour(dir, startTime.hour);
120
+ if (hour !== void 0) if (hour === startTime.hour) {
121
+ let minute = this.findAllowedMinute(dir, startTime.minute);
122
+ if (minute !== void 0) if (minute === startTime.minute) {
123
+ const second = this.findAllowedSecond(dir, startTime.second);
124
+ if (second !== void 0) return {
125
+ hour,
126
+ minute,
127
+ second
128
+ };
129
+ minute = this.findAllowedMinute(dir, dir === "next" ? startTime.minute + 1 : startTime.minute - 1);
130
+ if (minute !== void 0) return {
131
+ hour,
132
+ minute,
133
+ second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
134
+ };
135
+ } else return {
136
+ hour,
137
+ minute,
138
+ second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
139
+ };
140
+ hour = this.findAllowedHour(dir, dir === "next" ? startTime.hour + 1 : startTime.hour - 1);
141
+ if (hour !== void 0) return {
142
+ hour,
143
+ minute: dir === "next" ? this.minutes[0] : this.reversed.minutes[0],
144
+ second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
145
+ };
146
+ } else return {
147
+ hour,
148
+ minute: dir === "next" ? this.minutes[0] : this.reversed.minutes[0],
149
+ second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
150
+ };
151
+ }
152
+ /**
153
+ * Find the next or previous day in the given month, starting from the given startDay
154
+ * that matches either the day or the weekday constraint. startDay itself might also be allowed.
155
+ */
156
+ findAllowedDayInMonth(dir, year, month, startDay) {
157
+ var _a, _b;
158
+ if (startDay < 1) throw new Error("startDay must not be smaller than 1.");
159
+ const daysInMonth = getDaysInMonth(year, month);
160
+ const daysRestricted = this.days.length !== 31;
161
+ const weekdaysRestricted = this.weekdays.length !== 7;
162
+ if (!daysRestricted && !weekdaysRestricted) {
163
+ if (startDay > daysInMonth) return dir === "next" ? void 0 : daysInMonth;
164
+ return startDay;
165
+ }
166
+ let allowedDayByDays;
167
+ if (daysRestricted) {
168
+ allowedDayByDays = dir === "next" ? this.days.find((x) => x >= startDay) : this.reversed.days.find((x) => x <= startDay);
169
+ if (allowedDayByDays !== void 0 && allowedDayByDays > daysInMonth) allowedDayByDays = void 0;
170
+ }
171
+ let allowedDayByWeekdays;
172
+ if (weekdaysRestricted) {
173
+ const startWeekday = new Date(year, month, startDay).getDay();
174
+ const nearestAllowedWeekday = dir === "next" ? (_a = this.weekdays.find((x) => x >= startWeekday)) !== null && _a !== void 0 ? _a : this.weekdays[0] : (_b = this.reversed.weekdays.find((x) => x <= startWeekday)) !== null && _b !== void 0 ? _b : this.reversed.weekdays[0];
175
+ if (nearestAllowedWeekday !== void 0) {
176
+ const daysBetweenWeekdays = dir === "next" ? getDaysBetweenWeekdays(startWeekday, nearestAllowedWeekday) : getDaysBetweenWeekdays(nearestAllowedWeekday, startWeekday);
177
+ allowedDayByWeekdays = dir === "next" ? startDay + daysBetweenWeekdays : startDay - daysBetweenWeekdays;
178
+ if (allowedDayByWeekdays > daysInMonth || allowedDayByWeekdays < 1) allowedDayByWeekdays = void 0;
179
+ }
180
+ }
181
+ if (allowedDayByDays !== void 0 && allowedDayByWeekdays !== void 0) return dir === "next" ? Math.min(allowedDayByDays, allowedDayByWeekdays) : Math.max(allowedDayByDays, allowedDayByWeekdays);
182
+ if (allowedDayByDays !== void 0) return allowedDayByDays;
183
+ if (allowedDayByWeekdays !== void 0) return allowedDayByWeekdays;
184
+ }
185
+ /** Gets the next date starting from the given start date or now. */
186
+ getNextDate(startDate = /* @__PURE__ */ new Date()) {
187
+ const startDateElements = extractDateElements(startDate);
188
+ let minYear = startDateElements.year;
189
+ let startIndexMonth = this.months.findIndex((x) => x >= startDateElements.month);
190
+ if (startIndexMonth === -1) {
191
+ startIndexMonth = 0;
192
+ minYear++;
193
+ }
194
+ const maxIterations = this.months.length * 5;
195
+ for (let i = 0; i < maxIterations; i++) {
196
+ const year = minYear + Math.floor((startIndexMonth + i) / this.months.length);
197
+ const month = this.months[(startIndexMonth + i) % this.months.length];
198
+ const isStartMonth = year === startDateElements.year && month === startDateElements.month;
199
+ let day = this.findAllowedDayInMonth("next", year, month, isStartMonth ? startDateElements.day : 1);
200
+ let isStartDay = isStartMonth && day === startDateElements.day;
201
+ if (day !== void 0 && isStartDay) {
202
+ const nextTime = this.findAllowedTime("next", startDateElements);
203
+ if (nextTime !== void 0) return new Date(year, month, day, nextTime.hour, nextTime.minute, nextTime.second);
204
+ day = this.findAllowedDayInMonth("next", year, month, day + 1);
205
+ isStartDay = false;
206
+ }
207
+ if (day !== void 0 && !isStartDay) return new Date(year, month, day, this.hours[0], this.minutes[0], this.seconds[0]);
208
+ }
209
+ throw new Error("No valid next date was found.");
210
+ }
211
+ /** Gets the specified amount of future dates starting from the given start date or now. */
212
+ getNextDates(amount, startDate) {
213
+ const dates = [];
214
+ let nextDate;
215
+ for (let i = 0; i < amount; i++) {
216
+ nextDate = this.getNextDate(nextDate !== null && nextDate !== void 0 ? nextDate : startDate);
217
+ dates.push(nextDate);
218
+ }
219
+ return dates;
220
+ }
221
+ /**
222
+ * Get an ES6 compatible iterator which iterates over the next dates starting from startDate or now.
223
+ * The iterator runs until the optional endDate is reached or forever.
224
+ */
225
+ *getNextDatesIterator(startDate, endDate) {
226
+ let nextDate;
227
+ while (true) {
228
+ nextDate = this.getNextDate(nextDate !== null && nextDate !== void 0 ? nextDate : startDate);
229
+ if (endDate && endDate.getTime() < nextDate.getTime()) return;
230
+ yield nextDate;
231
+ }
232
+ }
233
+ /** Gets the previous date starting from the given start date or now. */
234
+ getPrevDate(startDate = /* @__PURE__ */ new Date()) {
235
+ const startDateElements = extractDateElements(startDate);
236
+ let maxYear = startDateElements.year;
237
+ let startIndexMonth = this.reversed.months.findIndex((x) => x <= startDateElements.month);
238
+ if (startIndexMonth === -1) {
239
+ startIndexMonth = 0;
240
+ maxYear--;
241
+ }
242
+ const maxIterations = this.reversed.months.length * 5;
243
+ for (let i = 0; i < maxIterations; i++) {
244
+ const year = maxYear - Math.floor((startIndexMonth + i) / this.reversed.months.length);
245
+ const month = this.reversed.months[(startIndexMonth + i) % this.reversed.months.length];
246
+ const isStartMonth = year === startDateElements.year && month === startDateElements.month;
247
+ let day = this.findAllowedDayInMonth("prev", year, month, isStartMonth ? startDateElements.day : getDaysInMonth(year, month));
248
+ let isStartDay = isStartMonth && day === startDateElements.day;
249
+ if (day !== void 0 && isStartDay) {
250
+ const prevTime = this.findAllowedTime("prev", startDateElements);
251
+ if (prevTime !== void 0) return new Date(year, month, day, prevTime.hour, prevTime.minute, prevTime.second);
252
+ if (day > 1) {
253
+ day = this.findAllowedDayInMonth("prev", year, month, day - 1);
254
+ isStartDay = false;
255
+ }
256
+ }
257
+ if (day !== void 0 && !isStartDay) return new Date(year, month, day, this.reversed.hours[0], this.reversed.minutes[0], this.reversed.seconds[0]);
258
+ }
259
+ throw new Error("No valid previous date was found.");
260
+ }
261
+ /** Gets the specified amount of previous dates starting from the given start date or now. */
262
+ getPrevDates(amount, startDate) {
263
+ const dates = [];
264
+ let prevDate;
265
+ for (let i = 0; i < amount; i++) {
266
+ prevDate = this.getPrevDate(prevDate !== null && prevDate !== void 0 ? prevDate : startDate);
267
+ dates.push(prevDate);
268
+ }
269
+ return dates;
270
+ }
271
+ /**
272
+ * Get an ES6 compatible iterator which iterates over the previous dates starting from startDate or now.
273
+ * The iterator runs until the optional endDate is reached or forever.
274
+ */
275
+ *getPrevDatesIterator(startDate, endDate) {
276
+ let prevDate;
277
+ while (true) {
278
+ prevDate = this.getPrevDate(prevDate !== null && prevDate !== void 0 ? prevDate : startDate);
279
+ if (endDate && endDate.getTime() > prevDate.getTime()) return;
280
+ yield prevDate;
281
+ }
282
+ }
283
+ /** Returns true when there is a cron date at the given date. */
284
+ matchDate(date) {
285
+ const { second, minute, hour, day, month, weekday } = extractDateElements(date);
286
+ if (this.seconds.indexOf(second) === -1 || this.minutes.indexOf(minute) === -1 || this.hours.indexOf(hour) === -1 || this.months.indexOf(month) === -1) return false;
287
+ if (this.days.length !== 31 && this.weekdays.length !== 7) return this.days.indexOf(day) !== -1 || this.weekdays.indexOf(weekday) !== -1;
288
+ return this.days.indexOf(day) !== -1 && this.weekdays.indexOf(weekday) !== -1;
289
+ }
290
+ };
291
+ //#endregion
292
+ //#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/cron-parser.js
293
+ const secondConstraint = {
294
+ min: 0,
295
+ max: 59
296
+ };
297
+ const minuteConstraint = {
298
+ min: 0,
299
+ max: 59
300
+ };
301
+ const hourConstraint = {
302
+ min: 0,
303
+ max: 23
304
+ };
305
+ const dayConstraint = {
306
+ min: 1,
307
+ max: 31
308
+ };
309
+ const monthConstraint = {
310
+ min: 1,
311
+ max: 12,
312
+ aliases: {
313
+ jan: "1",
314
+ feb: "2",
315
+ mar: "3",
316
+ apr: "4",
317
+ may: "5",
318
+ jun: "6",
319
+ jul: "7",
320
+ aug: "8",
321
+ sep: "9",
322
+ oct: "10",
323
+ nov: "11",
324
+ dec: "12"
325
+ }
326
+ };
327
+ const weekdayConstraint = {
328
+ min: 0,
329
+ max: 7,
330
+ aliases: {
331
+ mon: "1",
332
+ tue: "2",
333
+ wed: "3",
334
+ thu: "4",
335
+ fri: "5",
336
+ sat: "6",
337
+ sun: "7"
338
+ }
339
+ };
340
+ const timeNicknames = {
341
+ "@yearly": "0 0 1 1 *",
342
+ "@annually": "0 0 1 1 *",
343
+ "@monthly": "0 0 1 * *",
344
+ "@weekly": "0 0 * * 0",
345
+ "@daily": "0 0 * * *",
346
+ "@hourly": "0 * * * *",
347
+ "@minutely": "* * * * *"
348
+ };
349
+ function parseElement(element, constraint) {
350
+ const result = /* @__PURE__ */ new Set();
351
+ if (element === "*") {
352
+ for (let i = constraint.min; i <= constraint.max; i = i + 1) result.add(i);
353
+ return result;
354
+ }
355
+ const listElements = element.split(",");
356
+ if (listElements.length > 1) {
357
+ for (const listElement of listElements) {
358
+ const parsedListElement = parseElement(listElement, constraint);
359
+ for (const x of parsedListElement) result.add(x);
360
+ }
361
+ return result;
362
+ }
363
+ const parseSingleElement = (singleElement) => {
364
+ var _a, _b;
365
+ singleElement = (_b = (_a = constraint.aliases) === null || _a === void 0 ? void 0 : _a[singleElement.toLowerCase()]) !== null && _b !== void 0 ? _b : singleElement;
366
+ const parsedElement = Number.parseInt(singleElement, 10);
367
+ if (Number.isNaN(parsedElement)) throw new Error(`Failed to parse ${element}: ${singleElement} is NaN.`);
368
+ if (parsedElement < constraint.min || parsedElement > constraint.max) throw new Error(`Failed to parse ${element}: ${singleElement} is outside of constraint range of ${constraint.min} - ${constraint.max}.`);
369
+ return parsedElement;
370
+ };
371
+ const rangeSegments = /^(([0-9a-zA-Z]+)-([0-9a-zA-Z]+)|\*)(\/([0-9]+))?$/.exec(element);
372
+ if (rangeSegments === null) {
373
+ result.add(parseSingleElement(element));
374
+ return result;
375
+ }
376
+ let parsedStart = rangeSegments[1] === "*" ? constraint.min : parseSingleElement(rangeSegments[2]);
377
+ const parsedEnd = rangeSegments[1] === "*" ? constraint.max : parseSingleElement(rangeSegments[3]);
378
+ if (constraint === weekdayConstraint && parsedStart === 7 && parsedEnd !== 7) parsedStart = 0;
379
+ if (parsedStart > parsedEnd) throw new Error(`Failed to parse ${element}: Invalid range (start: ${parsedStart}, end: ${parsedEnd}).`);
380
+ const step = rangeSegments[5];
381
+ let parsedStep = 1;
382
+ if (step !== void 0) {
383
+ parsedStep = Number.parseInt(step, 10);
384
+ if (Number.isNaN(parsedStep)) throw new Error(`Failed to parse step: ${step} is NaN.`);
385
+ if (parsedStep < 1) throw new Error(`Failed to parse step: Expected ${step} to be greater than 0.`);
386
+ }
387
+ for (let i = parsedStart; i <= parsedEnd; i = i + parsedStep) result.add(i);
388
+ return result;
389
+ }
390
+ /** Parses a cron expression into a Cron instance. */
391
+ function parseCronExpression(cronExpression) {
392
+ var _a;
393
+ if (typeof cronExpression !== "string") throw new TypeError("Invalid cron expression: must be of type string.");
394
+ cronExpression = (_a = timeNicknames[cronExpression.toLowerCase()]) !== null && _a !== void 0 ? _a : cronExpression;
395
+ const elements = cronExpression.split(" ").filter((elem) => elem.length > 0);
396
+ if (elements.length < 5 || elements.length > 6) throw new Error("Invalid cron expression: expected 5 or 6 elements.");
397
+ const rawSeconds = elements.length === 6 ? elements[0] : "0";
398
+ const rawMinutes = elements.length === 6 ? elements[1] : elements[0];
399
+ const rawHours = elements.length === 6 ? elements[2] : elements[1];
400
+ const rawDays = elements.length === 6 ? elements[3] : elements[2];
401
+ const rawMonths = elements.length === 6 ? elements[4] : elements[3];
402
+ const rawWeekdays = elements.length === 6 ? elements[5] : elements[4];
403
+ return new Cron({
404
+ seconds: parseElement(rawSeconds, secondConstraint),
405
+ minutes: parseElement(rawMinutes, minuteConstraint),
406
+ hours: parseElement(rawHours, hourConstraint),
407
+ days: parseElement(rawDays, dayConstraint),
408
+ months: new Set(Array.from(parseElement(rawMonths, monthConstraint)).map((x) => x - 1)),
409
+ weekdays: new Set(Array.from(parseElement(rawWeekdays, weekdayConstraint)).map((x) => x % 7))
410
+ });
411
+ }
412
+ //#endregion
413
+ //#region ../../packages/core/src/shared/schedule.ts
414
+ /**
415
+ * shared/schedule.ts
416
+ *
417
+ * Unified schedule type that supports both simple intervals and cron expressions.
418
+ * Can be used in both cron and polling triggers for maximum flexibility.
419
+ *
420
+ * Template literal types provide compile-time type safety.
421
+ * Zod schemas with refinements provide runtime validation.
422
+ */
423
+ const DurationSchema = z.union([z.number().int().positive().finite(), z.string().regex(/^[1-9]\d*[smhdwy]$/)]);
424
+ const DurationStringSchema = z.string().refine((val) => /^\d+[smhdwy]$/.test(val), { message: "Invalid duration format. Must be a positive integer followed by s, m, h, d, w, or y (e.g., \"5m\", \"1h\")" }).refine((val) => {
425
+ const match = val.match(/^(\d+)[smhdwy]$/);
426
+ if (!match?.[1]) return false;
427
+ const num = Number.parseInt(match[1], 10);
428
+ return num > 0 && Number.isFinite(num);
429
+ }, { message: "Duration value must be a positive integer greater than 0" });
430
+ const CronExpressionSchema = z.string().superRefine((val, ctx) => {
431
+ try {
432
+ parseCronExpression(val);
433
+ } catch (error) {
434
+ const errorMessage = error instanceof Error ? error.message : "Invalid cron expression format";
435
+ ctx.addIssue({
436
+ code: "custom",
437
+ message: `Invalid cron expression: ${errorMessage}. Must be a valid 5-field cron: minute hour day month weekday (e.g., "0 9 * * *", "*/15 * * * *")`
438
+ });
439
+ }
440
+ });
441
+ z.union([
442
+ z.number().refine((val) => val > 0, { message: "Duration in milliseconds must be positive" }).refine(Number.isFinite, { message: "Duration in milliseconds must be finite" }).refine(Number.isInteger, { message: "Duration in milliseconds must be an integer" }),
443
+ DurationStringSchema,
444
+ CronExpressionSchema
445
+ ]);
446
+ z.enum([
447
+ "UTC",
448
+ "GMT",
449
+ "Etc/UTC",
450
+ "Etc/GMT",
451
+ "America/New_York",
452
+ "America/Chicago",
453
+ "America/Denver",
454
+ "America/Los_Angeles",
455
+ "America/Phoenix",
456
+ "America/Anchorage",
457
+ "America/Toronto",
458
+ "America/Vancouver",
459
+ "America/Mexico_City",
460
+ "America/Sao_Paulo",
461
+ "America/Buenos_Aires",
462
+ "Europe/London",
463
+ "Europe/Paris",
464
+ "Europe/Berlin",
465
+ "Europe/Rome",
466
+ "Europe/Madrid",
467
+ "Europe/Amsterdam",
468
+ "Europe/Stockholm",
469
+ "Europe/Vienna",
470
+ "Europe/Zurich",
471
+ "Europe/Moscow",
472
+ "Europe/Athens",
473
+ "Europe/Dublin",
474
+ "Asia/Tokyo",
475
+ "Asia/Shanghai",
476
+ "Asia/Hong_Kong",
477
+ "Asia/Singapore",
478
+ "Asia/Seoul",
479
+ "Asia/Dubai",
480
+ "Asia/Kolkata",
481
+ "Asia/Bangkok",
482
+ "Asia/Jakarta",
483
+ "Asia/Manila",
484
+ "Asia/Taipei",
485
+ "Australia/Sydney",
486
+ "Australia/Melbourne",
487
+ "Australia/Brisbane",
488
+ "Australia/Perth",
489
+ "Australia/Adelaide",
490
+ "Pacific/Auckland",
491
+ "Pacific/Honolulu",
492
+ "Africa/Cairo",
493
+ "Africa/Johannesburg",
494
+ "Africa/Lagos",
495
+ "Africa/Nairobi",
496
+ "Asia/Riyadh",
497
+ "Asia/Tehran",
498
+ "Asia/Jerusalem",
499
+ "Asia/Doha"
500
+ ]);
501
+ //#endregion
502
+ //#region ../../packages/core/src/artifacts/source-analysis.ts
503
+ const SourceLocationSchema = z.object({
504
+ filePath: z.string().min(1),
505
+ absoluteFilePath: z.string().min(1).optional(),
506
+ line: z.number().int().positive(),
507
+ column: z.number().int().positive(),
508
+ position: z.number().int().nonnegative().optional(),
509
+ endLine: z.number().int().positive(),
510
+ endColumn: z.number().int().positive(),
511
+ endPosition: z.number().int().nonnegative().optional(),
512
+ synthetic: z.boolean().optional()
513
+ });
514
+ z.string().min(1);
515
+ const ImportSourceSchema = z.object({
516
+ kind: z.enum([
517
+ "local",
518
+ "module-import",
519
+ "namespace-import",
520
+ "dynamic"
521
+ ]),
522
+ moduleSpecifier: z.string().min(1).optional(),
523
+ importName: z.string().min(1).optional(),
524
+ localName: z.string().min(1).optional(),
525
+ resolvedPath: z.string().min(1).optional()
526
+ });
527
+ const CallKindSchema = z.enum([
528
+ "workflow-step",
529
+ "agent",
530
+ "tool",
531
+ "hook",
532
+ "child-workflow",
533
+ "function-call",
534
+ "method-call",
535
+ "dynamic-call",
536
+ "parallel-call",
537
+ "process-exit",
538
+ "iife",
539
+ "expression"
540
+ ]);
541
+ const CapturedVariableSourceKindSchema = z.enum([
542
+ "local-const",
543
+ "relative-import",
544
+ "package-import"
545
+ ]);
546
+ const CapturedVariableValueTypeSchema = z.enum([
547
+ "string",
548
+ "number",
549
+ "boolean",
550
+ "object",
551
+ "array",
552
+ "function",
553
+ "unknown"
554
+ ]);
555
+ z.object({
556
+ name: z.string().min(1),
557
+ value: z.union([
558
+ z.string(),
559
+ z.number(),
560
+ z.boolean()
561
+ ]).optional(),
562
+ sourceText: z.string().optional(),
563
+ valueType: CapturedVariableValueTypeSchema,
564
+ resolvable: z.boolean(),
565
+ source: CapturedVariableSourceKindSchema,
566
+ importPath: z.string().optional(),
567
+ declaration: z.object({
568
+ filePath: z.string().min(1),
569
+ line: z.number().int().positive()
570
+ })
571
+ });
572
+ const IntegrationScopeSchema = z.enum([
573
+ "organization",
574
+ "project",
575
+ "user_provided_credential"
576
+ ]);
577
+ const IntegrationCredentialRefSchema = z.discriminatedUnion("type", [z.object({
578
+ type: z.literal("id"),
579
+ id: z.string().startsWith("cset_")
580
+ }), z.object({
581
+ type: z.literal("name"),
582
+ name: z.string().trim().min(1)
583
+ })]);
584
+ function hasProjectOrOrganizationScope(scope) {
585
+ return scope === "organization" || scope === "project";
586
+ }
587
+ const CredentialRefTokenKeyNameSchema = z.string().regex(/^[A-Za-z0-9_]+$/, "Credential key must contain only letters, digits, and underscores (required for ref-token proxying)");
588
+ /** Shared enum for top-level credential-set `onCredentialRevoked` policy. */
589
+ const OnCredentialRevokedSchema = z.enum(["fail", "retry-once"]);
590
+ /** A credential set after resolution in a built manifest. Contains definition id, scope, alias, and credential keys.*/
591
+ const ResolvedCredentialSetSchema = z.object({
592
+ resolvedId: z.string(),
593
+ scope: IntegrationScopeSchema.optional(),
594
+ alias: z.string().optional(),
595
+ credentialRef: IntegrationCredentialRefSchema.optional(),
596
+ /** Auth-shape keys expected post-resolve. */
597
+ credentialKeys: z.array(CredentialRefTokenKeyNameSchema),
598
+ /** Subset of `credentialKeys` that are optional in the auth shape. */
599
+ optionalCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
600
+ /** Auth-shaped vault keys required for vault reads and upload flows. */
601
+ storedCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
602
+ /** Subset of auth-shaped vault keys that may be absent from the vault without
603
+ * failing resolution. Derived from the credential set's `auth` schema. */
604
+ optionalStoredCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
605
+ proxy: credentialSetProxyConfigSchema.optional(),
606
+ /** When true, resolved values are passed raw (no ref-token proxy) for this set. */
607
+ needsRawSecret: z.boolean().optional(),
608
+ /** When true, this requirement uses a registered dynamic resolver phase. */
609
+ needsDynamicResolution: z.boolean().optional(),
610
+ /** Cache TTL in milliseconds for registered dynamic resolver output.
611
+ * `0` or absence means no cache hint. */
612
+ dynamicResolutionCacheMs: z.number().int().nonnegative().optional(),
613
+ /** Policy when a step throws `CredentialRevokedError` against this credential set. */
614
+ onCredentialRevoked: OnCredentialRevokedSchema.optional(),
615
+ /** Persistence-layer schema fingerprint stamped at build time. The
616
+ * resolver's phase 2 compares this against the vault row's stored
617
+ * fingerprint and raises `CredentialSchemaMismatchError` on drift.
618
+ * Optional here so pre-fingerprint artifacts still parse; the
619
+ * workflow builder populates it for every authored credential set
620
+ * that has a resolvable fingerprint. */
621
+ schemaFingerprint: z.string().optional()
622
+ }).superRefine((value, ctx) => {
623
+ if (value.credentialRef && !hasProjectOrOrganizationScope(value.scope)) ctx.addIssue({
624
+ code: z.ZodIssueCode.custom,
625
+ path: ["credentialRef"],
626
+ message: "credentialRef requires scope to be \"project\" or \"organization\""
627
+ });
628
+ });
629
+ z.object({
630
+ credentialSetId: z.string(),
631
+ /** Auth-shape keys expected post-resolve. */
632
+ credentialKeys: z.array(CredentialRefTokenKeyNameSchema),
633
+ /** Optional subset of the auth-shape keys. */
634
+ optionalCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
635
+ /** Stored-shape keys required for vault reads. */
636
+ storedCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
637
+ /** Optional subset of the stored-shape keys. */
638
+ optionalStoredCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
639
+ schemaFingerprint: z.string().optional(),
640
+ needsDynamicResolution: z.boolean().optional(),
641
+ /** Cache TTL in milliseconds for registered dynamic resolver output.
642
+ * `0` or absence means no cache hint. */
643
+ dynamicResolutionCacheMs: z.number().int().nonnegative().optional(),
644
+ /** Policy when a step throws `CredentialRevokedError` against this credential set. */
645
+ onCredentialRevoked: OnCredentialRevokedSchema.optional(),
646
+ proxy: credentialSetProxyConfigSchema.optional(),
647
+ needsRawSecret: z.boolean().optional(),
648
+ requiredOAuthScopes: z.array(z.string()).optional()
649
+ });
650
+ const CredentialRequirementEntrySchema = z.object({
651
+ credentialSetId: z.string(),
652
+ scope: IntegrationScopeSchema.optional(),
653
+ alias: z.string().optional(),
654
+ credentialRef: IntegrationCredentialRefSchema.optional(),
655
+ /** Auth-shape keys expected post-resolve. */
656
+ credentialKeys: z.array(CredentialRefTokenKeyNameSchema),
657
+ /** Optional subset of the auth-shape keys. */
658
+ optionalCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
659
+ /** Auth-shaped vault keys required for vault reads. */
660
+ storedCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
661
+ /** Optional subset of the stored-shape keys. */
662
+ optionalStoredCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
663
+ schemaFingerprint: z.string().optional(),
664
+ proxy: credentialSetProxyConfigSchema.optional(),
665
+ needsRawSecret: z.boolean().optional(),
666
+ /** When true, this requirement uses a registered dynamic resolver phase. */
667
+ needsDynamicResolution: z.boolean().optional(),
668
+ /** Cache TTL in milliseconds for registered dynamic resolver output.
669
+ * `0` or absence means no cache hint. */
670
+ dynamicResolutionCacheMs: z.number().int().nonnegative().optional(),
671
+ /** Policy when a step throws `CredentialRevokedError` against this credential set. */
672
+ onCredentialRevoked: OnCredentialRevokedSchema.optional(),
673
+ requiredOAuthScopes: z.array(z.string()).optional()
674
+ }).superRefine((value, ctx) => {
675
+ if (value.credentialRef && !hasProjectOrOrganizationScope(value.scope)) ctx.addIssue({
676
+ code: z.ZodIssueCode.custom,
677
+ path: ["credentialRef"],
678
+ message: "credentialRef requires scope to be \"project\" or \"organization\""
679
+ });
680
+ });
681
+ z.object({
682
+ required: z.array(z.string()),
683
+ byStep: z.record(z.string(), z.array(CredentialRequirementEntrySchema))
684
+ });
685
+ const TriggerPollExportNameSchema = z.enum(["poll"]);
686
+ const TriggerCredentialRequirementEntrySchema = CredentialRequirementEntrySchema;
687
+ const TriggerCredentialRequirementsSchema = z.object({
688
+ required: z.array(z.string()),
689
+ byPollExport: z.partialRecord(TriggerPollExportNameSchema, z.array(TriggerCredentialRequirementEntrySchema))
690
+ });
691
+ const ExecutionIdentityPolicySchema = z.object({ subjectMode: z.enum(["never", "requiredWhenUserProvidedCredential"]) });
692
+ z.object({
693
+ nodeId: z.string().min(1),
694
+ stepName: z.string().min(1),
695
+ label: z.string().min(1),
696
+ callKind: CallKindSchema,
697
+ stepId: z.string().min(1).optional(),
698
+ source: SourceLocationSchema.optional(),
699
+ astKind: z.string().min(1).optional(),
700
+ importSource: ImportSourceSchema.optional(),
701
+ outputBinding: z.string().min(1).optional(),
702
+ scopeOverride: IntegrationScopeSchema.optional(),
703
+ description: z.string().optional(),
704
+ sourceCode: z.string().optional(),
705
+ exportName: z.string().optional(),
706
+ inputSchema: JsonSchemaSchema.optional(),
707
+ outputSchema: JsonSchemaSchema.optional(),
708
+ credentialSets: z.array(ResolvedCredentialSetSchema).optional()
709
+ });
710
+ const TriggerTypeSchema = z.enum([
711
+ "webhook",
712
+ "cron",
713
+ "polling"
714
+ ]);
715
+ /**
716
+ * Persisted on `deployment_triggers.trigger_source`. Mirrors the
717
+ * `webhookTrigger({ source: { type } })` discriminator so the server
718
+ * can index-filter app-source rows during provider-webhook fanout.
719
+ */
720
+ const TriggerSourceSchema = z.enum(["custom", "app"]);
721
+ z.enum([
722
+ "GET",
723
+ "POST",
724
+ "PUT",
725
+ "PATCH"
726
+ ]);
727
+ const TriggerPollBundleUploadSchema = z.object({
728
+ code: z.string(),
729
+ hash: z.string(),
730
+ size: z.number()
731
+ });
732
+ /** Declarative idempotency-key spec resolved server-side (no VM). */
733
+ const IdempotencyKeyConfigSchema = z.union([
734
+ z.object({
735
+ from: z.literal("payload"),
736
+ strategy: z.literal("hash")
737
+ }),
738
+ z.object({
739
+ from: z.literal("payload"),
740
+ path: z.string().trim().min(1)
741
+ }),
742
+ z.object({
743
+ from: z.literal("header"),
744
+ strategy: z.literal("hash")
745
+ }),
746
+ z.object({
747
+ from: z.literal("header"),
748
+ name: z.string().trim().min(1)
749
+ })
750
+ ]);
751
+ const TriggerPollExportsSchema = z.object({ poll: z.string().min(1).optional() });
752
+ z.object({
753
+ id: z.string(),
754
+ /**
755
+ * Authored trigger name from `xxxTrigger({ name: ... })`. Used by the workflow
756
+ * VM to look up the bound `transform`. Follows the `authoredWorkflowId` /
757
+ * `authoredAgentId` naming convention.
758
+ */
759
+ authoredTriggerId: z.string().min(1),
760
+ type: TriggerTypeSchema,
761
+ /**
762
+ * Source-of-truth discriminator for webhook triggers. `'custom'` means
763
+ * the trigger owns its own HTTP path; `'app'` means it is fanned out by
764
+ * a Keystroke-managed provider app. Undefined for non-webhook triggers.
765
+ */
766
+ triggerSource: TriggerSourceSchema.optional(),
767
+ /**
768
+ * Root-trigger name for `.narrow()` lineage so narrowed custom webhooks share
769
+ * the same `webhookSecretHash`/`webhookPublicId`. Equals `authoredTriggerId`
770
+ * for root triggers. Omitted for non-webhook triggers.
771
+ */
772
+ webhookAuthGroupKey: z.string().min(1).optional(),
773
+ enabled: z.boolean(),
774
+ schedule: z.string().optional(),
775
+ timezone: z.string().optional(),
776
+ config: z.record(z.string(), z.unknown()).optional(),
777
+ requiredCredentials: TriggerCredentialRequirementsSchema.optional(),
778
+ /** Hex-encoded sha-256 of the Keystroke-issued webhook secret. */
779
+ webhookSecretHash: z.string().min(1).optional(),
780
+ /** Public id surfaced in the webhook URL (header-mode auth). */
781
+ webhookPublicId: z.string().min(1).optional(),
782
+ /** JSON Schema applied at the server before any VM hop. Built from a
783
+ * pure Zod schema declared on the trigger primitive. */
784
+ filterSchema: JsonSchemaSchema.optional(),
785
+ /** Declarative idempotency-key resolver. Webhook-only. */
786
+ idempotencyConfig: IdempotencyKeyConfigSchema.optional(),
787
+ pollStoragePath: z.string().min(1).optional(),
788
+ pollBundle: TriggerPollBundleUploadSchema.optional(),
789
+ pollExports: TriggerPollExportsSchema.optional()
790
+ });
791
+ //#endregion
792
+ //#region ../../packages/core/src/trigger/shared/idempotency-config.ts
793
+ const trimmedString = z.string().trim().min(1);
794
+ const payloadHashSchema = z.object({
795
+ from: z.literal("payload"),
796
+ strategy: z.literal("hash")
797
+ });
798
+ const payloadPathSchema = z.object({
799
+ from: z.literal("payload"),
800
+ path: trimmedString
801
+ });
802
+ const headerHashSchema = z.object({
803
+ from: z.literal("header"),
804
+ strategy: z.literal("hash")
805
+ });
806
+ const headerNameSchema = z.object({
807
+ from: z.literal("header"),
808
+ name: trimmedString
809
+ });
810
+ const idempotencyKeyConfigSchema = z.union([
811
+ payloadHashSchema,
812
+ payloadPathSchema,
813
+ headerHashSchema,
814
+ headerNameSchema
815
+ ]);
816
+ //#endregion
817
+ //#region ../../packages/core/src/trigger/schemas.ts
818
+ const credentialSetInstanceSchema = createStructuralSchema([
819
+ "id",
820
+ "auth",
821
+ "connections"
822
+ ], "a CredentialSet instance");
823
+ const TriggerModeDefaultSchema = z.enum(["managed", "subscribable"]);
824
+ const TriggerRuntimeDescriptorSchema = z.object({
825
+ /**
826
+ * True when this trigger bundles a `poll` export executed inside a
827
+ * microsandbox VM at trigger time. Polling-only — webhook/cron always
828
+ * leave this undefined. Replaces the legacy `callbacks: { poll, ... }`
829
+ * descriptor (the other callbacks are gone now that filter/idempotency/
830
+ * verify/transform are declarative or run in the workflow VM).
831
+ */
832
+ poll: z.boolean().optional(),
833
+ filterSchema: jsonSchemaObject.optional(),
834
+ /** Webhook-only declarative idempotency-key resolver. */
835
+ idempotencyConfig: idempotencyKeyConfigSchema.optional()
836
+ });
837
+ const TriggerManifestSchema = z.object({
838
+ manifestVersion: z.literal(1),
839
+ type: z.literal("trigger"),
840
+ triggerType: TriggerTypeSchema,
841
+ id: trimmedNonEmptyString("Trigger id"),
842
+ description: descriptionString("Trigger description"),
843
+ enabled: z.boolean(),
844
+ modeDefault: TriggerModeDefaultSchema,
845
+ executionIdentityPolicy: ExecutionIdentityPolicySchema.optional(),
846
+ credentialSets: z.array(CredentialSetManifestSchema).optional(),
847
+ runtime: TriggerRuntimeDescriptorSchema
848
+ });
849
+ z.object({
850
+ credentialSets: z.array(credentialSetInstanceSchema).optional(),
851
+ description: descriptionString("Trigger description"),
852
+ enabled: z.boolean().default(true),
853
+ executionIdentityPolicy: ExecutionIdentityPolicySchema.optional(),
854
+ modeDefault: TriggerModeDefaultSchema.default("managed"),
855
+ id: trimmedNonEmptyString("Trigger id")
856
+ });
857
+ //#endregion
858
+ //#region ../../packages/core/src/task/schemas.ts
859
+ const agentInstanceSchema = createStructuralSchema([
860
+ "id",
861
+ "name",
862
+ "systemPrompt",
863
+ "model",
864
+ "input",
865
+ "output",
866
+ "workflowSafeReference"
867
+ ], "an Agent instance");
868
+ const triggerInstanceSchema = createStructuralSchema([
869
+ "isTrigger",
870
+ "id",
871
+ "description",
872
+ "enabled"
873
+ ], "a trigger instance (use cronTrigger(), pollingTrigger(), or webhookTrigger())");
874
+ const taskLifecycleSchema = z.object({
875
+ maxExecutions: z.number().int().positive().optional(),
876
+ expiresAt: z.union([z.date(), z.string().datetime()]).optional(),
877
+ expiresAfter: DurationSchema.optional()
878
+ }).strict();
879
+ z.object({
880
+ id: idNoSpacesString("Task ID"),
881
+ name: trimmedNonEmptyString("Task name"),
882
+ description: optionalDescriptionString("Task description"),
883
+ agent: agentInstanceSchema,
884
+ prompt: trimmedNonEmptyStringUnbounded("Task prompt"),
885
+ triggers: z.array(triggerInstanceSchema).min(1, { message: "At least one trigger is required" }),
886
+ lifecycle: taskLifecycleSchema.optional(),
887
+ tags: z.array(z.string()).optional()
888
+ }).strict();
889
+ const WorkflowSafeAgentReferenceSchema = z.object({
890
+ kind: z.literal("agent"),
891
+ authoredAgentId: z.string(),
892
+ displayName: z.string(),
893
+ runtimeKind: z.enum(["declarative", "runnable"]),
894
+ inputSchema: jsonSchemaObject.optional(),
895
+ outputSchema: jsonSchemaObject.optional(),
896
+ authoredExport: z.object({
897
+ exportName: z.string().optional(),
898
+ filePath: z.string().optional()
899
+ }).optional(),
900
+ metadata: jsonSchemaObject.optional()
901
+ }).strict();
902
+ const TaskBuildInfoStubSchema = z.object({
903
+ hash: SHA256HashSchema.optional(),
904
+ size: z.number().optional(),
905
+ metadata: jsonSchemaObject.optional()
906
+ }).strict();
907
+ /**
908
+ * Extended trigger manifest schema for tasks.
909
+ * Preserves runtime fields (schedule, timezone, path, method) that the base
910
+ * TriggerManifestSchema strips. Tasks need these for trigger evaluation at runtime.
911
+ */
912
+ const TaskTriggerManifestSchema = TriggerManifestSchema.extend({
913
+ runtime: TriggerRuntimeDescriptorSchema.extend({
914
+ schedule: z.string().optional(),
915
+ timezone: z.string().optional(),
916
+ path: z.string().optional(),
917
+ method: z.string().optional(),
918
+ input: z.unknown().optional(),
919
+ payloadMode: z.string().optional()
920
+ }),
921
+ /** Static payload for cron triggers */
922
+ payload: z.unknown().optional()
923
+ });
924
+ const TaskBuildManifestSchema = z.object({
925
+ manifestVersion: z.literal(1),
926
+ type: z.literal("task"),
927
+ id: z.string().min(1),
928
+ name: z.string().min(1),
929
+ description: z.string().optional(),
930
+ agentRef: WorkflowSafeAgentReferenceSchema,
931
+ prompt: z.string().min(1),
932
+ triggers: z.array(TaskTriggerManifestSchema),
933
+ lifecycle: z.object({
934
+ maxExecutions: z.number().int().positive().optional(),
935
+ expiresAt: z.string().optional(),
936
+ expiresAfter: z.string().optional()
937
+ }).strict().optional(),
938
+ tags: z.array(z.string()).optional(),
939
+ buildInfo: TaskBuildInfoStubSchema
940
+ }).strict();
941
+ //#endregion
942
+ //#region ../../packages/core/src/task/index.ts
943
+ var task_exports = /* @__PURE__ */ __exportAll({ TaskBuildManifestSchema: () => TaskBuildManifestSchema });
944
+ //#endregion
945
+ export { TaskBuildManifestSchema as n, task_exports as t };