@percher/core 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/dist/ai-files-manifest.d.ts +28 -0
  2. package/dist/ai-files-manifest.d.ts.map +1 -0
  3. package/dist/ai-files-manifest.js +96 -0
  4. package/dist/ai-files-manifest.js.map +1 -0
  5. package/dist/commands/account.d.ts +51 -0
  6. package/dist/commands/account.d.ts.map +1 -0
  7. package/dist/commands/account.js +88 -0
  8. package/dist/commands/account.js.map +1 -0
  9. package/dist/commands/ai-files.d.ts +73 -0
  10. package/dist/commands/ai-files.d.ts.map +1 -0
  11. package/dist/commands/ai-files.js +179 -0
  12. package/dist/commands/ai-files.js.map +1 -0
  13. package/dist/commands/billing.d.ts +1 -1
  14. package/dist/commands/billing.d.ts.map +1 -1
  15. package/dist/commands/billing.js +1 -1
  16. package/dist/commands/billing.js.map +1 -1
  17. package/dist/commands/continue.d.ts +48 -0
  18. package/dist/commands/continue.d.ts.map +1 -0
  19. package/dist/commands/continue.js +121 -0
  20. package/dist/commands/continue.js.map +1 -0
  21. package/dist/commands/create.d.ts +1 -1
  22. package/dist/commands/create.d.ts.map +1 -1
  23. package/dist/commands/create.js +1 -1
  24. package/dist/commands/create.js.map +1 -1
  25. package/dist/commands/dashboard.d.ts +15 -0
  26. package/dist/commands/dashboard.d.ts.map +1 -0
  27. package/dist/commands/dashboard.js +33 -0
  28. package/dist/commands/dashboard.js.map +1 -0
  29. package/dist/commands/data-export.d.ts +21 -0
  30. package/dist/commands/data-export.d.ts.map +1 -0
  31. package/dist/commands/data-export.js +36 -0
  32. package/dist/commands/data-export.js.map +1 -0
  33. package/dist/commands/data.d.ts +1 -1
  34. package/dist/commands/data.d.ts.map +1 -1
  35. package/dist/commands/data.js +1 -1
  36. package/dist/commands/data.js.map +1 -1
  37. package/dist/commands/delete.d.ts +1 -1
  38. package/dist/commands/delete.d.ts.map +1 -1
  39. package/dist/commands/delete.js +1 -1
  40. package/dist/commands/delete.js.map +1 -1
  41. package/dist/commands/deploys.d.ts +2 -2
  42. package/dist/commands/deploys.d.ts.map +1 -1
  43. package/dist/commands/deploys.js +21 -5
  44. package/dist/commands/deploys.js.map +1 -1
  45. package/dist/commands/dev.d.ts +1 -9
  46. package/dist/commands/dev.d.ts.map +1 -1
  47. package/dist/commands/dev.js +77 -23
  48. package/dist/commands/dev.js.map +1 -1
  49. package/dist/commands/diagnose.d.ts +1 -1
  50. package/dist/commands/diagnose.d.ts.map +1 -1
  51. package/dist/commands/diagnose.js +1 -1
  52. package/dist/commands/diagnose.js.map +1 -1
  53. package/dist/commands/doctor.d.ts +63 -1
  54. package/dist/commands/doctor.d.ts.map +1 -1
  55. package/dist/commands/doctor.js +792 -10
  56. package/dist/commands/doctor.js.map +1 -1
  57. package/dist/commands/domains.d.ts +1 -1
  58. package/dist/commands/domains.d.ts.map +1 -1
  59. package/dist/commands/domains.js +1 -1
  60. package/dist/commands/domains.js.map +1 -1
  61. package/dist/commands/env-scan.d.ts +2 -0
  62. package/dist/commands/env-scan.d.ts.map +1 -0
  63. package/dist/commands/env-scan.js +92 -0
  64. package/dist/commands/env-scan.js.map +1 -0
  65. package/dist/commands/env.d.ts +1 -1
  66. package/dist/commands/env.d.ts.map +1 -1
  67. package/dist/commands/env.js +1 -1
  68. package/dist/commands/env.js.map +1 -1
  69. package/dist/commands/export.d.ts +1 -1
  70. package/dist/commands/export.js +1 -1
  71. package/dist/commands/generate.d.ts +1 -1
  72. package/dist/commands/generate.d.ts.map +1 -1
  73. package/dist/commands/generate.js +14 -9
  74. package/dist/commands/generate.js.map +1 -1
  75. package/dist/commands/github.d.ts +60 -0
  76. package/dist/commands/github.d.ts.map +1 -0
  77. package/dist/commands/github.js +112 -0
  78. package/dist/commands/github.js.map +1 -0
  79. package/dist/commands/import-project.d.ts +1 -1
  80. package/dist/commands/import-project.d.ts.map +1 -1
  81. package/dist/commands/import-project.js +1 -1
  82. package/dist/commands/import-project.js.map +1 -1
  83. package/dist/commands/init.d.ts +1 -1
  84. package/dist/commands/init.d.ts.map +1 -1
  85. package/dist/commands/init.js +1 -1
  86. package/dist/commands/init.js.map +1 -1
  87. package/dist/commands/insights.d.ts +1 -1
  88. package/dist/commands/insights.d.ts.map +1 -1
  89. package/dist/commands/insights.js +1 -1
  90. package/dist/commands/insights.js.map +1 -1
  91. package/dist/commands/login.d.ts +1 -1
  92. package/dist/commands/login.d.ts.map +1 -1
  93. package/dist/commands/login.js +1 -1
  94. package/dist/commands/login.js.map +1 -1
  95. package/dist/commands/logs.d.ts +1 -1
  96. package/dist/commands/logs.d.ts.map +1 -1
  97. package/dist/commands/logs.js +1 -1
  98. package/dist/commands/logs.js.map +1 -1
  99. package/dist/commands/mcp.d.ts +1 -1
  100. package/dist/commands/mcp.d.ts.map +1 -1
  101. package/dist/commands/mcp.js +1 -1
  102. package/dist/commands/mcp.js.map +1 -1
  103. package/dist/commands/open.d.ts +1 -1
  104. package/dist/commands/open.d.ts.map +1 -1
  105. package/dist/commands/open.js +1 -1
  106. package/dist/commands/open.js.map +1 -1
  107. package/dist/commands/publish-failure.d.ts +31 -0
  108. package/dist/commands/publish-failure.d.ts.map +1 -0
  109. package/dist/commands/publish-failure.js +142 -0
  110. package/dist/commands/publish-failure.js.map +1 -0
  111. package/dist/commands/publish-node.d.ts +13 -0
  112. package/dist/commands/publish-node.d.ts.map +1 -0
  113. package/dist/commands/publish-node.js +38 -0
  114. package/dist/commands/publish-node.js.map +1 -0
  115. package/dist/commands/publish.d.ts +87 -3
  116. package/dist/commands/publish.d.ts.map +1 -1
  117. package/dist/commands/publish.js +589 -156
  118. package/dist/commands/publish.js.map +1 -1
  119. package/dist/commands/push.d.ts +45 -8
  120. package/dist/commands/push.d.ts.map +1 -1
  121. package/dist/commands/push.js +215 -22
  122. package/dist/commands/push.js.map +1 -1
  123. package/dist/commands/redeploy.d.ts +28 -0
  124. package/dist/commands/redeploy.d.ts.map +1 -0
  125. package/dist/commands/redeploy.js +417 -0
  126. package/dist/commands/redeploy.js.map +1 -0
  127. package/dist/commands/rename.d.ts +1 -1
  128. package/dist/commands/rename.d.ts.map +1 -1
  129. package/dist/commands/rename.js +1 -1
  130. package/dist/commands/rename.js.map +1 -1
  131. package/dist/commands/reproduce.d.ts +64 -0
  132. package/dist/commands/reproduce.d.ts.map +1 -0
  133. package/dist/commands/reproduce.js +211 -0
  134. package/dist/commands/reproduce.js.map +1 -0
  135. package/dist/commands/reset-superuser.d.ts +1 -1
  136. package/dist/commands/reset-superuser.d.ts.map +1 -1
  137. package/dist/commands/reset-superuser.js +1 -1
  138. package/dist/commands/reset-superuser.js.map +1 -1
  139. package/dist/commands/restore.d.ts +79 -0
  140. package/dist/commands/restore.d.ts.map +1 -0
  141. package/dist/commands/restore.js +164 -0
  142. package/dist/commands/restore.js.map +1 -0
  143. package/dist/commands/resume.d.ts +1 -1
  144. package/dist/commands/resume.d.ts.map +1 -1
  145. package/dist/commands/resume.js +1 -1
  146. package/dist/commands/resume.js.map +1 -1
  147. package/dist/commands/rollback.d.ts +20 -8
  148. package/dist/commands/rollback.d.ts.map +1 -1
  149. package/dist/commands/rollback.js +11 -6
  150. package/dist/commands/rollback.js.map +1 -1
  151. package/dist/commands/unsuspend.d.ts +35 -0
  152. package/dist/commands/unsuspend.d.ts.map +1 -0
  153. package/dist/commands/unsuspend.js +27 -0
  154. package/dist/commands/unsuspend.js.map +1 -0
  155. package/dist/commands/versions.d.ts +1 -1
  156. package/dist/commands/versions.d.ts.map +1 -1
  157. package/dist/commands/versions.js +1 -1
  158. package/dist/commands/versions.js.map +1 -1
  159. package/dist/commands/wait-deploy.d.ts +92 -0
  160. package/dist/commands/wait-deploy.d.ts.map +1 -0
  161. package/dist/commands/wait-deploy.js +225 -0
  162. package/dist/commands/wait-deploy.js.map +1 -0
  163. package/dist/env-scan-source.d.ts +39 -0
  164. package/dist/env-scan-source.d.ts.map +1 -0
  165. package/dist/env-scan-source.js +332 -0
  166. package/dist/env-scan-source.js.map +1 -0
  167. package/dist/error-classifier.d.ts.map +1 -1
  168. package/dist/error-classifier.js +67 -4
  169. package/dist/error-classifier.js.map +1 -1
  170. package/dist/errors.d.ts +8 -1
  171. package/dist/errors.d.ts.map +1 -1
  172. package/dist/errors.js +2 -0
  173. package/dist/errors.js.map +1 -1
  174. package/dist/index.d.ts +14 -1
  175. package/dist/index.d.ts.map +1 -1
  176. package/dist/index.js +13 -0
  177. package/dist/index.js.map +1 -1
  178. package/dist/plans.d.ts +11 -0
  179. package/dist/plans.d.ts.map +1 -1
  180. package/dist/plans.js +10 -0
  181. package/dist/plans.js.map +1 -1
  182. package/dist/poll-deployment.d.ts +47 -0
  183. package/dist/poll-deployment.d.ts.map +1 -0
  184. package/dist/poll-deployment.js +57 -0
  185. package/dist/poll-deployment.js.map +1 -0
  186. package/dist/recovery.d.ts +356 -0
  187. package/dist/recovery.d.ts.map +1 -0
  188. package/dist/recovery.js +299 -0
  189. package/dist/recovery.js.map +1 -0
  190. package/dist/stream-utils.d.ts +21 -0
  191. package/dist/stream-utils.d.ts.map +1 -0
  192. package/dist/stream-utils.js +41 -0
  193. package/dist/stream-utils.js.map +1 -0
  194. package/dist/templates/ai-files/claude-md.d.ts +7 -0
  195. package/dist/templates/ai-files/claude-md.d.ts.map +1 -0
  196. package/dist/templates/ai-files/claude-md.js +78 -0
  197. package/dist/templates/ai-files/claude-md.js.map +1 -0
  198. package/dist/templates/ai-files/cursor-percher-mdc.d.ts +7 -0
  199. package/dist/templates/ai-files/cursor-percher-mdc.d.ts.map +1 -0
  200. package/dist/templates/ai-files/cursor-percher-mdc.js +111 -0
  201. package/dist/templates/ai-files/cursor-percher-mdc.js.map +1 -0
  202. package/dist/templates/ai-files/index.d.ts +8 -0
  203. package/dist/templates/ai-files/index.d.ts.map +1 -0
  204. package/dist/templates/ai-files/index.js +4 -0
  205. package/dist/templates/ai-files/index.js.map +1 -0
  206. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1,25 +1,35 @@
1
1
  export { PercherCoreError, } from "./errors";
2
2
  export { detectFramework } from "./detect";
3
3
  export { createTarball } from "./tarball";
4
+ export { scanSourceForEnvRefs, } from "./env-scan-source";
4
5
  export { readPercherTomlAppName } from "./app-name";
5
6
  export { whoami } from "./commands/whoami";
7
+ export { accountExport, accountDelete, accountExportInputSchema, accountDeleteInputSchema, } from "./commands/account";
6
8
  export { login, loginInputSchema } from "./commands/login";
7
9
  export { init, initInputSchema } from "./commands/init";
8
10
  export { envSet, envUnset, envList, envSetInputSchema, envUnsetInputSchema, envListInputSchema, } from "./commands/env";
9
11
  export { open, openInputSchema } from "./commands/open";
12
+ export { dashboard, dashboardInputSchema } from "./commands/dashboard";
10
13
  export { logs, logsInputSchema } from "./commands/logs";
14
+ export { unsuspend, unsuspendInputSchema, } from "./commands/unsuspend";
11
15
  export { push, pushInputSchema } from "./commands/push";
12
16
  export { publish, publishInputSchema, } from "./commands/publish";
17
+ export { waitForDeploy, waitForDeployInputSchema, } from "./commands/wait-deploy";
18
+ export { redeploy, redeployInputSchema, } from "./commands/redeploy";
19
+ export { reproduce, reproduceInputSchema, } from "./commands/reproduce";
13
20
  export { classifyError, } from "./error-classifier";
21
+ export { RECOVERY_NONE, RECOVERY_NEEDS_LOGIN, recoveryAsk, recoveryDoctor, recoveryEnv, recoveryFixConfig, recoveryFixProblems, recoveryFromErrorClass, recoveryInspectBuildLog, recoveryLogin, recoveryNone, recoveryRetry, recoveryWait, } from "./recovery";
14
22
  export { resetSuperuser, resetSuperuserInputSchema, } from "./commands/reset-superuser";
15
23
  export { rename, renameInputSchema, } from "./commands/rename";
16
24
  export { versions, versionsInputSchema, } from "./commands/versions";
17
25
  export { rollback, rollbackInputSchema, } from "./commands/rollback";
26
+ export { listBackups, listBackupsInputSchema, restore, restoreInputSchema, } from "./commands/restore";
18
27
  export { deploysList, deploysListInputSchema, deploysInspect, deploysInspectInputSchema, } from "./commands/deploys";
19
28
  export { mcp, mcpInputSchema, } from "./commands/mcp";
20
29
  export { doctor, doctorInputSchema, } from "./commands/doctor";
21
30
  export { dev, devInputSchema } from "./commands/dev";
22
31
  export { data, dataInputSchema } from "./commands/data";
32
+ export { dataExport, dataExportInputSchema, } from "./commands/data-export";
23
33
  export { diagnose, diagnoseInputSchema, } from "./commands/diagnose";
24
34
  export { insights, insightsInputSchema, } from "./commands/insights";
25
35
  export { billingUpgrade, billingUpgradeInputSchema, billingPortal, billingPortalInputSchema, } from "./commands/billing";
@@ -28,6 +38,7 @@ export { domainAdd, domainVerify, domainList, domainRemove, domainAddInputSchema
28
38
  export { resume, resumeInputSchema, } from "./commands/resume";
29
39
  export { deleteApp, deleteInputSchema, } from "./commands/delete";
30
40
  export { importProject, importInputSchema, } from "./commands/import-project";
41
+ export { githubConnect, githubConnectInputSchema, githubSetupWebhook, githubSetupWebhookInputSchema, } from "./commands/github";
31
42
  export { generate, generateInputSchema, } from "./commands/generate";
32
43
  export { createWatcher } from "./watcher";
33
44
  export { isBlockedName, BLOCKED_APP_NAMES } from "./validation/blocked-names";
@@ -35,4 +46,6 @@ export { qrToTerminal, qrToDataUri } from "./qr";
35
46
  export { listTemplates, listTemplateMetadata, getTemplateMetadata, scaffoldTemplate, TEMPLATE_CATALOG, } from "./templates";
36
47
  export { INTEGRATIONS, getIntegration, listIntegrationsByCategory, } from "./integrations";
37
48
  export { PLAN_CATALOG, PLAN_IDS, getPlanLimits, getEffectivePlanLimits, getPlanInfo, } from "./plans";
49
+ export { aiFilesInstall, aiFilesUpdate, aiFilesStatus, aiFilesRemove, aiFilesInstallInputSchema, aiFilesUpdateInputSchema, aiFilesStatusInputSchema, aiFilesRemoveInputSchema, } from "./commands/ai-files";
50
+ export { AI_FILE_TEMPLATES } from "./templates/ai-files";
38
51
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,GAGjB,MAAM,U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,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/plans.d.ts CHANGED
@@ -37,6 +37,17 @@ export interface PlanLimits {
37
37
  * outside the cluster and records the result for the Health tab.
38
38
  */
39
39
  uptimeIntervalSec: number;
40
+ /**
41
+ * Fas 4 abuse-mitigation: per-day cap on live deploys per account.
42
+ * Resets at 00:00 UTC. Independent from the per-app sliding-window
43
+ * `deploysPerHour` (Fas 2) — quota is account-wide and daily, rate
44
+ * limit is per-app and short-burst. Quota fires first.
45
+ */
46
+ dailyLiveDeploys: number;
47
+ /** Fas 4: per-day cap on preview deploys (separate counter from live
48
+ * so a paid review cycle cannot eat the live budget, and a runaway
49
+ * agent cannot loop previews to bypass the live cap). */
50
+ dailyPreviewDeploys: number;
40
51
  }
41
52
  export interface PlanInfo {
42
53
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"plans.d.ts","sourceRoot":"","sources":["../src/plans.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1D,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,GAAG,WAAW,CAAC;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,eAAe,EAAE,MAAM,CAAC;IACxB,gCAAgC;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,8BAA8B;IAC9B,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;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,UAAU,CAyBhF"}
package/dist/plans.js CHANGED
@@ -25,6 +25,8 @@ export const PLAN_CATALOG = {
25
25
  supportResponseTime: null,
26
26
  kvStorageMb: 10,
27
27
  uptimeIntervalSec: 0,
28
+ dailyLiveDeploys: 50,
29
+ dailyPreviewDeploys: 25,
28
30
  },
29
31
  },
30
32
  starter: {
@@ -53,6 +55,8 @@ export const PLAN_CATALOG = {
53
55
  supportResponseTime: "72h email",
54
56
  kvStorageMb: 50,
55
57
  uptimeIntervalSec: 300,
58
+ dailyLiveDeploys: 100,
59
+ dailyPreviewDeploys: 50,
56
60
  },
57
61
  },
58
62
  maker: {
@@ -81,6 +85,8 @@ export const PLAN_CATALOG = {
81
85
  supportResponseTime: "24h email",
82
86
  kvStorageMb: 200,
83
87
  uptimeIntervalSec: 60,
88
+ dailyLiveDeploys: 200,
89
+ dailyPreviewDeploys: 100,
84
90
  },
85
91
  },
86
92
  pro: {
@@ -109,6 +115,8 @@ export const PLAN_CATALOG = {
109
115
  supportResponseTime: "8h email + priority Discord",
110
116
  kvStorageMb: 1000,
111
117
  uptimeIntervalSec: 30,
118
+ dailyLiveDeploys: 1000,
119
+ dailyPreviewDeploys: 500,
112
120
  },
113
121
  },
114
122
  };
@@ -148,6 +156,8 @@ export function getEffectivePlanLimits(plan, isAdmin = false) {
148
156
  apps: INF,
149
157
  deploysPerMonth: "unlimited",
150
158
  deploysPerHour: INF,
159
+ dailyLiveDeploys: INF,
160
+ dailyPreviewDeploys: INF,
151
161
  activePreviewsPerApp: INF,
152
162
  customDomainsPerApp: INF,
153
163
  autoSleep: false,
package/dist/plans.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"plans.js","sourceRoot":"","sources":["../src/plans.ts"],"names":[],"mappings":"AAgDA,MAAM,CAAC,MAAM,YAAY,GAA6B;IACpD,IAAI,EAAE;QACJ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QACxB,eAAe,EAAE,GAAG;QACpB,gBAAgB,EAAE,GAAG;QACrB,qBAAqB,EAAE,GAAG;QAC1B,QAAQ,EAAE,GAAG;QACb,WAAW,EAAE,GAAG;QAChB,mEAAmE;QACnE,gEAAgE;QAChE,2DAA2D;KAC5D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { Context } from "./context";
2
+ export interface DeploymentLike {
3
+ id: string;
4
+ status: string;
5
+ }
6
+ export interface PollDeploymentOptions<D extends DeploymentLike> {
7
+ ctx: Context;
8
+ appId: string;
9
+ initial: D;
10
+ /** Status values that end the loop. Defaults to ["live", "failed"]. */
11
+ terminal?: readonly string[];
12
+ /** Polling interval in ms (default 2000). */
13
+ intervalMs?: number;
14
+ /** Total wall-clock budget in ms (default 5 minutes). */
15
+ timeoutMs?: number;
16
+ /** Callback fired on each successful poll — for status emission. */
17
+ onTick?: (deployment: D) => void;
18
+ /** Hook called when wall-clock timeout is hit. Should throw. */
19
+ onTimeout: (deployment: D) => never;
20
+ /** App display name, used in the network-error hint message. */
21
+ appName: string;
22
+ /** Maximum consecutive transient failures before giving up (default 5). */
23
+ maxRetries?: number;
24
+ /**
25
+ * Backoff (ms) before retry attempt N (1-indexed). Default doubles
26
+ * from 1s: 1000, 2000, 4000, 8000. Tests inject `() => 0` to skip
27
+ * the wait.
28
+ */
29
+ backoffMs?: (attempt: number) => number;
30
+ }
31
+ /**
32
+ * Poll `getDeployment` until the deployment reaches a terminal status.
33
+ *
34
+ * Tolerates transient `network error: …` failures (Http.request wraps
35
+ * fetch failures with that prefix) by retrying with exponential
36
+ * backoff. Live-incident 2026-04-28 dep_lioyh9suzjx9ialtwm5e: a single
37
+ * fetch-failed mid-poll crashed `percher publish`, while the deploy
38
+ * itself completed successfully on the server — the user paid for an
39
+ * entire duplicate build cycle. Same race existed in `percher push`
40
+ * (the agent-facing command) until this helper landed.
41
+ *
42
+ * Caller threads `getDeployment` through ctx.client; we keep this
43
+ * helper free of resource-typing so it can be called for both live
44
+ * and preview deploys without leaking type details.
45
+ */
46
+ export declare function pollDeployment<D extends DeploymentLike>(opts: PollDeploymentOptions<D>): Promise<D>;
47
+ //# sourceMappingURL=poll-deployment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll-deployment.d.ts","sourceRoot":"","sources":["../src/poll-deployment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,cAAc;IAC7D,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;IACX,uEAAuE;IACvE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,IAAI,CAAC;IACjC,gEAAgE;IAChE,SAAS,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,KAAK,CAAC;IACpC,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAAC,CAAC,SAAS,cAAc,EAC3D,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAC7B,OAAO,CAAC,CAAC,CAAC,CAkDZ"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Poll `getDeployment` until the deployment reaches a terminal status.
3
+ *
4
+ * Tolerates transient `network error: …` failures (Http.request wraps
5
+ * fetch failures with that prefix) by retrying with exponential
6
+ * backoff. Live-incident 2026-04-28 dep_lioyh9suzjx9ialtwm5e: a single
7
+ * fetch-failed mid-poll crashed `percher publish`, while the deploy
8
+ * itself completed successfully on the server — the user paid for an
9
+ * entire duplicate build cycle. Same race existed in `percher push`
10
+ * (the agent-facing command) until this helper landed.
11
+ *
12
+ * Caller threads `getDeployment` through ctx.client; we keep this
13
+ * helper free of resource-typing so it can be called for both live
14
+ * and preview deploys without leaking type details.
15
+ */
16
+ export async function pollDeployment(opts) {
17
+ const terminal = opts.terminal ?? ["live", "failed"];
18
+ const intervalMs = opts.intervalMs ?? 2000;
19
+ const timeoutMs = opts.timeoutMs ?? 5 * 60 * 1000;
20
+ const maxRetries = opts.maxRetries ?? 5;
21
+ let deployment = opts.initial;
22
+ const startedAt = Date.now();
23
+ while (!terminal.includes(deployment.status)) {
24
+ if (Date.now() - startedAt > timeoutMs) {
25
+ opts.onTimeout(deployment);
26
+ }
27
+ opts.onTick?.(deployment);
28
+ await new Promise((r) => setTimeout(r, intervalMs));
29
+ let attempt = 0;
30
+ let polled = false;
31
+ while (!polled) {
32
+ try {
33
+ deployment = (await opts.ctx.client.apps.getDeployment(opts.appId, deployment.id));
34
+ polled = true;
35
+ }
36
+ catch (err) {
37
+ attempt++;
38
+ const msg = err.message ?? String(err);
39
+ const isNetwork = msg.startsWith("network error:");
40
+ if (!isNetwork || attempt >= maxRetries) {
41
+ if (isNetwork) {
42
+ // Surface a more helpful message than the bare network
43
+ // error: the deploy may have completed server-side
44
+ // already, and a direct check is one CLI invocation away.
45
+ throw new Error(`${msg}\n\nThe deploy may already be live — your network connection dropped mid-poll. Check with: percher deploys list ${opts.appName}`, { cause: err });
46
+ }
47
+ throw err;
48
+ }
49
+ // Backoff: 1s, 2s, 4s, 8s before next retry by default.
50
+ const backoff = (opts.backoffMs ?? ((n) => 1000 * 2 ** (n - 1)))(attempt);
51
+ await new Promise((r) => setTimeout(r, backoff));
52
+ }
53
+ }
54
+ }
55
+ return deployment;
56
+ }
57
+ //# sourceMappingURL=poll-deployment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll-deployment.js","sourceRoot":"","sources":["../src/poll-deployment.ts"],"names":[],"mappings":"AAiCA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAA8B;IAE9B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IAClD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;IAExC,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7C,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,SAAS,EAAE,CAAC;YACvC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC7B,CAAC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,CAAC;QAC1B,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;QAEpD,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,OAAO,CAAC,MAAM,EAAE,CAAC;YACf,IAAI,CAAC;gBACH,UAAU,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CACpD,IAAI,CAAC,KAAK,EACV,UAAU,CAAC,EAAE,CACd,CAAiB,CAAC;gBACnB,MAAM,GAAG,IAAI,CAAC;YAChB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,EAAE,CAAC;gBACV,MAAM,GAAG,GAAI,GAAa,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;gBAClD,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;gBACnD,IAAI,CAAC,SAAS,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;oBACxC,IAAI,SAAS,EAAE,CAAC;wBACd,uDAAuD;wBACvD,mDAAmD;wBACnD,0DAA0D;wBAC1D,MAAM,IAAI,KAAK,CACb,GAAG,GAAG,mHAAmH,IAAI,CAAC,OAAO,EAAE,EACvI,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAC;oBACJ,CAAC;oBACD,MAAM,GAAG,CAAC;gBACZ,CAAC;gBACD,wDAAwD;gBACxD,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBAClF,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,356 @@
1
+ import type { BuildProblem } from "@percher/client";
2
+ import type { ErrorClass } from "./error-classifier";
3
+ /**
4
+ * Action an AI agent should take after a deploy result.
5
+ *
6
+ * Stable, machine-readable enum. Treat values as a public API: agents will
7
+ * hardcode `===` comparisons against these strings, so removing or renaming
8
+ * a value is a breaking change.
9
+ */
10
+ export type RecoveryAction =
11
+ /** User is unauthenticated; agent should call `percher_login`. */
12
+ "open_login"
13
+ /** Build/runtime is missing env vars; call `percher_env_set`. */
14
+ | "set_env_vars"
15
+ /**
16
+ * FUTURE11 Phase 2 — deploy is in flight (queued/building/deploying);
17
+ * agent should call `percher_wait_for_deploy` to keep checking in
18
+ * short intervals instead of starting a new deploy.
19
+ */
20
+ | "wait_deploy"
21
+ /** Transient infra failure; safe to call `percher_publish` again. */
22
+ | "retry"
23
+ /**
24
+ * FUTURE12 Phase 1a — additive enum value. Reserved for ambiguous
25
+ * failures (generic `build_failed`, stalled deploys, runtime crashes,
26
+ * unclear state) where the right path is to ask `percher_doctor`
27
+ * for a primary recommendation rather than hopping straight to a
28
+ * specific low-level inspector. Phase 4 of FUTURE12 migrates the
29
+ * existing `inspect_build_log` primary cases over to this action.
30
+ */
31
+ | "run_doctor"
32
+ /** Build failed for a code reason; agent should call `percher_deploys_inspect`. */
33
+ | "inspect_build_log"
34
+ /**
35
+ * FUTURE1 Phase 2.3 — build failed and the API extracted at least one
36
+ * structured BuildProblem (file + line + actionable hint). Agent
37
+ * should patch the offending file directly using `problems` rather
38
+ * than fetching/parsing the build log.
39
+ */
40
+ | "fix_problems"
41
+ /**
42
+ * FUTURE1 Phase 4.2 — explicit opt-in path for reproducing a build
43
+ * failure locally. Never auto-suggested as `nextAction`: cloud-side
44
+ * `inspect_build_log` always works while local reproduction needs
45
+ * nixpacks installed AND only ships env *keys* (no values), so it
46
+ * makes recovery WORSE for runtime-secret failures and dockerfile-
47
+ * only flows. Surfaces via `alternativeActions` instead so an agent
48
+ * can opt in after `inspect_build_log` didn't yield a fix.
49
+ */
50
+ | "reproduce_locally"
51
+ /** `percher.toml` is invalid; agent should ask the user or repair the file. */
52
+ | "fix_config"
53
+ /** Plan limits exceeded or otherwise needs human input; agent should ask the user. */
54
+ | "ask_user"
55
+ /** Success path — no further action required. */
56
+ | "none";
57
+ /** MCP tool the agent should invoke for `nextAction`, when applicable. */
58
+ export type SuggestedTool = "percher_login" | "percher_env_set" | "percher_deploys_inspect" | "percher_publish"
59
+ /** FUTURE11 Phase 2 — short-poll a specific deploy without starting a new one. */
60
+ | "percher_wait_for_deploy"
61
+ /**
62
+ * FUTURE12 Phase 1a — pairs with `run_doctor` action. Phase 4 of
63
+ * FUTURE12 migrates publish/wait's generic-failure paths to emit
64
+ * `percher_doctor` instead of `percher_deploys_inspect`.
65
+ */
66
+ | "percher_doctor"
67
+ /** FUTURE1 Phase 3.2 — percher_redeploy tool, used by burst-rate-
68
+ * limit recovery so agents retry the rerun after retryAfterSec
69
+ * instead of hopping to a fresh percher_publish. */
70
+ | "percher_redeploy"
71
+ /** FUTURE1 Phase 4.2 — percher_reproduce tool, surfaced via
72
+ * alternativeActions on build-failure recovery. */
73
+ | "percher_reproduce";
74
+ /**
75
+ * FUTURE12 Phase 1a — stable, enumerated reason an agent or human can
76
+ * branch on. Intentionally orthogonal to `RecoveryAction`: action says
77
+ * *what to do next*, reasonCode says *why we're here*. Two recoveries
78
+ * can share `nextAction` (e.g. both `ask_user`) but emit different
79
+ * reasonCodes (`quota_exceeded` vs `retry_limit_reached`) so the agent
80
+ * can produce a different prompt to the user.
81
+ *
82
+ * **Treat values as a public API.** Agents will hardcode `===` checks.
83
+ */
84
+ export type ReasonCode =
85
+ /** Success or otherwise no specific reason to surface. */
86
+ "none"
87
+ /** User is unauthenticated; needs to log in before any deploy can run. */
88
+ | "auth_required"
89
+ /** App referenced in config doesn't exist (or was deleted). */
90
+ | "app_not_found"
91
+ /** No `percher.toml` in cwd; can't determine app config. */
92
+ | "config_missing"
93
+ /** `percher.toml` parsed but failed schema validation. */
94
+ | "config_invalid"
95
+ /** `[env].required`/`optional`/`ignore` rules conflict (e.g. duplicate key). */
96
+ | "env_contract_invalid"
97
+ /** Source code references env keys that the contract doesn't declare. */
98
+ | "env_key_undeclared"
99
+ /** Reserved alias for `env_contract_invalid` — used when the missing
100
+ * contract block itself is the problem. */
101
+ | "env_contract_missing"
102
+ /** App exists but no deploys have ever run (or all were pruned). */
103
+ | "no_deploys"
104
+ /** Deploy is sitting in the queue, not yet picked up by a worker. */
105
+ | "deploy_queued"
106
+ /** Deploy worker is actively building. */
107
+ | "deploy_building"
108
+ /** Build done; deploy is being swapped in / health-checked. */
109
+ | "deploy_deploying"
110
+ /** Deploy hasn't progressed for longer than the watchdog window. */
111
+ | "deploy_stalled"
112
+ /** Wait window elapsed without terminal status; no stall judgement made. */
113
+ | "deploy_timeout"
114
+ /** Caller tried to publish while another deploy is already in flight. */
115
+ | "deploy_already_in_progress"
116
+ /** This deploy row was superseded by a newer one. */
117
+ | "replaced_by_newer"
118
+ /** Build/runtime needs env keys that aren't set. */
119
+ | "missing_env"
120
+ /** Build itself failed (compile error, missing dep, bad command, etc). */
121
+ | "build_failed"
122
+ /** Container booted but the app crashed at runtime. */
123
+ | "runtime_crashed"
124
+ /** Daily/burst quota hit; not retryable until reset. */
125
+ | "quota_exceeded"
126
+ /** Already retried once after transient infra failure; stop auto-retrying. */
127
+ | "retry_limit_reached"
128
+ /** Likely-transient infra issue (network, image registry, etc). */
129
+ | "infra_transient"
130
+ /** Hard infra outage — Percher can't deploy at all right now. */
131
+ | "infra_unavailable"
132
+ /** Build log isn't in storage yet (deploy too fresh). */
133
+ | "log_unavailable_yet"
134
+ /** Build log fetch errored (transport / encoding / size cap). */
135
+ | "log_fetch_failed"
136
+ /** Deploy died before the build phase started (e.g. tarball validation). */
137
+ | "failed_before_build"
138
+ /** Catch-all for unclassified state — agents should route to doctor. */
139
+ | "unknown";
140
+ /**
141
+ * FUTURE12 Phase 1a — `percher_doctor` mode hint. Public MCP path
142
+ * defaults to `auto`. Other modes exist for CLI `--mode` and for
143
+ * cases where publish/wait can give doctor an exact starting point
144
+ * (e.g. `mode: "deploy"` with a known `deployId`).
145
+ */
146
+ export type DoctorMode = "auto" | "deploy" | "runtime" | "config" | "env" | "account";
147
+ /**
148
+ * FUTURE12 Phase 1a — single source of truth for `PublishResult.status`.
149
+ *
150
+ * `already_in_progress` is reserved for Phase 6's server-side guardrail
151
+ * that short-circuits publish when the app already has an active
152
+ * deploy. Pinning the value here so the CLI/MCP can declare exhaustive
153
+ * switches before the server path lands.
154
+ */
155
+ export type PublishStatus = "live" | "failed" | "needs_login" | "dry_run" | "queued" | "replaced" | "already_in_progress";
156
+ /**
157
+ * Structured problem entry used by `fix_config` and `fix_problems`
158
+ * recoveries. Agents apply file edits directly using these.
159
+ */
160
+ export interface RecoveryProblem {
161
+ file: string;
162
+ line?: number;
163
+ column?: number;
164
+ message: string;
165
+ }
166
+ /** Secondary affordance — see `BaseRecovery.alternativeActions`. */
167
+ export interface RecoveryAlternative {
168
+ action: RecoveryAction;
169
+ suggestedTool?: SuggestedTool;
170
+ args?: Record<string, unknown>;
171
+ /** When this alternative is preferable to `nextAction`. */
172
+ when: string;
173
+ }
174
+ /** Fields shared by every recovery branch. */
175
+ interface BaseRecovery {
176
+ /** True if calling the same tool again with no changes might succeed. */
177
+ retryable: boolean;
178
+ /**
179
+ * FUTURE12 Phase 1b — required, machine-readable reason. Branches
180
+ * orthogonally to `nextAction`: two recoveries can share `nextAction`
181
+ * but emit different `reasonCode`s so an agent can produce a
182
+ * different prompt or telemetry tag.
183
+ */
184
+ reasonCode: ReasonCode;
185
+ /**
186
+ * FUTURE1 Phase 4.2 — optional secondary affordances the agent MAY
187
+ * use after `nextAction` if the primary path didn't yield a fix.
188
+ * Always populated on build-failure paths so the reproduce-locally
189
+ * option is discoverable, but `nextAction` stays at the always-
190
+ * works cloud path so a passive follow-the-arrow agent doesn't get
191
+ * steered into a flow that needs nixpacks installed locally.
192
+ */
193
+ alternativeActions?: RecoveryAlternative[];
194
+ }
195
+ /**
196
+ * Tool-action recovery — `nextAction` maps to a concrete MCP tool and
197
+ * `args` carries everything the agent needs to invoke it. The
198
+ * `inspect_build_log` value is kept here for legacy callers; FUTURE12
199
+ * Phase 4 migrates it to `run_doctor`.
200
+ */
201
+ export interface ToolRecovery extends BaseRecovery {
202
+ nextAction: "open_login" | "wait_deploy" | "run_doctor" | "set_env_vars" | "retry" | "inspect_build_log";
203
+ suggestedTool: SuggestedTool;
204
+ args: Record<string, unknown>;
205
+ }
206
+ /**
207
+ * File-edit recovery — `problems` describes what to fix. The agent
208
+ * applies file edits in its own surface, not via an MCP tool.
209
+ */
210
+ export interface UserRecovery extends BaseRecovery {
211
+ nextAction: "fix_config" | "fix_problems";
212
+ problems: RecoveryProblem[];
213
+ }
214
+ /** Success / no-action recovery. `url` is set when a current live URL is known. */
215
+ export interface NoneRecovery extends BaseRecovery {
216
+ nextAction: "none";
217
+ url?: string;
218
+ }
219
+ /** Human-input recovery — `prompt` is the question the agent should ask the user. */
220
+ export interface AskUserRecovery extends BaseRecovery {
221
+ nextAction: "ask_user";
222
+ prompt: string;
223
+ options?: string[];
224
+ }
225
+ /**
226
+ * Discriminated union over `nextAction`. Agents narrow by checking
227
+ * `nextAction` first, then read the branch-specific fields:
228
+ *
229
+ * - `ask_user` → `prompt`, optional `options`
230
+ * - `none` → optional `url`
231
+ * - `fix_config` / `fix_problems` → `problems`
232
+ * - everything else → `suggestedTool` + `args`
233
+ */
234
+ export type PublishRecovery = ToolRecovery | UserRecovery | NoneRecovery | AskUserRecovery;
235
+ /** Success / no-op recovery. `url` is the current live URL when known. */
236
+ export declare function recoveryNone(opts?: {
237
+ reasonCode?: ReasonCode;
238
+ url?: string;
239
+ }): NoneRecovery;
240
+ /** Authentication required — agent should call `percher_login`. */
241
+ export declare function recoveryLogin(opts?: {
242
+ reasonCode?: ReasonCode;
243
+ }): ToolRecovery;
244
+ /** Wait on an in-flight deploy — agent should call `percher_wait_for_deploy`. */
245
+ export declare function recoveryWait(opts: {
246
+ app: string;
247
+ deployId: string;
248
+ timeoutSeconds?: number;
249
+ reasonCode: ReasonCode;
250
+ }): ToolRecovery;
251
+ /** Route to `percher_doctor` for an ambiguous failure that needs diagnosis. */
252
+ export declare function recoveryDoctor(opts: {
253
+ app?: string;
254
+ deployId?: string;
255
+ mode?: DoctorMode;
256
+ reasonCode: ReasonCode;
257
+ alternativeActions?: RecoveryAlternative[];
258
+ }): ToolRecovery;
259
+ /** Build/runtime needs env keys — agent should call `percher_env_set`. */
260
+ export declare function recoveryEnv(opts: {
261
+ app?: string;
262
+ keys: string[];
263
+ reasonCode?: ReasonCode;
264
+ }): ToolRecovery;
265
+ /**
266
+ * `percher.toml` is invalid or missing — agent should fix the file
267
+ * directly. `problems` carries the structured issue list (file,
268
+ * line/column, message) so the agent can apply edits without parsing
269
+ * a free-text error.
270
+ */
271
+ export declare function recoveryFixConfig(opts: {
272
+ problems: RecoveryProblem[];
273
+ reasonCode?: ReasonCode;
274
+ }): UserRecovery;
275
+ /**
276
+ * Build failed and the API extracted at least one structured problem
277
+ * with file/line data — agent should patch the offending file(s).
278
+ */
279
+ export declare function recoveryFixProblems(opts: {
280
+ problems: RecoveryProblem[];
281
+ reasonCode?: ReasonCode;
282
+ alternativeActions?: RecoveryAlternative[];
283
+ }): UserRecovery;
284
+ /** Transient infra failure — agent can re-issue the same call. */
285
+ export declare function recoveryRetry(opts: {
286
+ suggestedTool: SuggestedTool;
287
+ args: Record<string, unknown>;
288
+ reasonCode: ReasonCode;
289
+ }): ToolRecovery;
290
+ /**
291
+ * Human-input required. `prompt` MUST be a concrete question — agents
292
+ * surface it verbatim, so empty/placeholder strings violate the
293
+ * contract.
294
+ */
295
+ export declare function recoveryAsk(opts: {
296
+ prompt: string;
297
+ options?: string[];
298
+ reasonCode: ReasonCode;
299
+ retryable?: boolean;
300
+ }): AskUserRecovery;
301
+ /**
302
+ * Legacy `inspect_build_log` recovery — kept for the build-failure
303
+ * paths that haven't migrated to `run_doctor` yet. FUTURE12 Phase 4
304
+ * will replace these emit sites with `recoveryDoctor`.
305
+ */
306
+ export declare function recoveryInspectBuildLog(opts: {
307
+ app?: string;
308
+ deployId?: string;
309
+ reasonCode?: ReasonCode;
310
+ alternativeActions?: RecoveryAlternative[];
311
+ }): ToolRecovery;
312
+ /** Recovery on the success path. */
313
+ export declare const RECOVERY_NONE: NoneRecovery;
314
+ /** Recovery for the unauthenticated path. */
315
+ export declare const RECOVERY_NEEDS_LOGIN: ToolRecovery;
316
+ interface FailureContext {
317
+ /** Concrete env var names the classifier extracted, if any. */
318
+ missingEnvVars?: string[];
319
+ /** Deploy id, used to point `percher_deploys_inspect` at the right build. */
320
+ deployId?: string;
321
+ /** App name, optional — `percher_deploys_inspect` defaults to the toml app. */
322
+ appName?: string;
323
+ /**
324
+ * Original publish input, echoed back as `args` for `retry`. Lets an agent
325
+ * re-issue the same call (preview/dryRun/message/force) without re-deriving.
326
+ */
327
+ publishInput?: Record<string, unknown>;
328
+ /**
329
+ * FUTURE1 Phase 2.3 — structured build problems from the API parser.
330
+ * When at least one carries a `file` field, the recovery action
331
+ * upgrades to `fix_problems` with the problems echoed in `args` so
332
+ * agents can issue file edits directly without log archaeology.
333
+ */
334
+ problems?: BuildProblem[];
335
+ }
336
+ /**
337
+ * Convert a `BuildProblem` into the lossless `RecoveryProblem` shape.
338
+ * Drops fields that aren't part of the recovery contract (severity,
339
+ * code) — those still ride on `error.problems` for the CLI's pretty
340
+ * printer. `hint` is folded into the message because it carries the
341
+ * actionable next step (especially for problems without a line, like
342
+ * malformed package.json) and the recovery contract has no separate
343
+ * hint slot.
344
+ *
345
+ * Exported so doctor (Phase 2c fix_problems path) can reuse the
346
+ * same hint-preserving mapping rather than re-implementing it.
347
+ */
348
+ export declare function buildProblemToRecoveryProblem(p: BuildProblem): RecoveryProblem;
349
+ /**
350
+ * Map an `ErrorClass` to a recovery action. Conservative by default —
351
+ * unknown classes resolve to `ask_user` so an agent never blindly retries
352
+ * something we haven't classified.
353
+ */
354
+ export declare function recoveryFromErrorClass(errorClass: ErrorClass, failure?: FailureContext): PublishRecovery;
355
+ export {};
356
+ //# sourceMappingURL=recovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../src/recovery.ts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