@wildo-ai/wildo-cli 1.1.14 → 1.1.15

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 (142) hide show
  1. package/dist/src/commands/generate/email-command.utils.d.ts +2 -0
  2. package/dist/src/commands/generate/email-command.utils.d.ts.map +1 -1
  3. package/dist/src/commands/generate/email-command.utils.js +5 -0
  4. package/dist/src/commands/generate/email-command.utils.js.map +1 -1
  5. package/dist/src/commands/init.command.d.ts.map +1 -1
  6. package/dist/src/commands/init.command.js +7 -2
  7. package/dist/src/commands/init.command.js.map +1 -1
  8. package/dist/src/commands/local/deregister.command.d.ts.map +1 -1
  9. package/dist/src/commands/local/deregister.command.js +4 -0
  10. package/dist/src/commands/local/deregister.command.js.map +1 -1
  11. package/dist/src/commands/local/dev.command.d.ts +6 -0
  12. package/dist/src/commands/local/dev.command.d.ts.map +1 -1
  13. package/dist/src/commands/local/dev.command.js +72 -0
  14. package/dist/src/commands/local/dev.command.js.map +1 -1
  15. package/dist/src/commands/local/jobs-command.utils.d.ts +24 -0
  16. package/dist/src/commands/local/jobs-command.utils.d.ts.map +1 -0
  17. package/dist/src/commands/local/jobs-command.utils.js +44 -0
  18. package/dist/src/commands/local/jobs-command.utils.js.map +1 -0
  19. package/dist/src/commands/local/jobs-run.command.d.ts +7 -0
  20. package/dist/src/commands/local/jobs-run.command.d.ts.map +1 -0
  21. package/dist/src/commands/local/jobs-run.command.js +92 -0
  22. package/dist/src/commands/local/jobs-run.command.js.map +1 -0
  23. package/dist/src/commands/local/jobs.command.d.ts +7 -0
  24. package/dist/src/commands/local/jobs.command.d.ts.map +1 -0
  25. package/dist/src/commands/local/jobs.command.js +59 -0
  26. package/dist/src/commands/local/jobs.command.js.map +1 -0
  27. package/dist/src/commands/local/tunnel.command.d.ts +84 -0
  28. package/dist/src/commands/local/tunnel.command.d.ts.map +1 -0
  29. package/dist/src/commands/local/tunnel.command.js +274 -0
  30. package/dist/src/commands/local/tunnel.command.js.map +1 -0
  31. package/dist/src/services/application/app-bootstrap.service.d.ts +41 -1
  32. package/dist/src/services/application/app-bootstrap.service.d.ts.map +1 -1
  33. package/dist/src/services/application/app-bootstrap.service.js +49 -3
  34. package/dist/src/services/application/app-bootstrap.service.js.map +1 -1
  35. package/dist/src/services/application/app-runtime-targets.service.d.ts.map +1 -1
  36. package/dist/src/services/application/app-runtime-targets.service.js +9 -1
  37. package/dist/src/services/application/app-runtime-targets.service.js.map +1 -1
  38. package/dist/src/services/application/application-dependency-alignment.service.d.ts +20 -0
  39. package/dist/src/services/application/application-dependency-alignment.service.d.ts.map +1 -1
  40. package/dist/src/services/application/application-dependency-alignment.service.js +32 -2
  41. package/dist/src/services/application/application-dependency-alignment.service.js.map +1 -1
  42. package/dist/src/services/application/local-tunnel.service.d.ts +153 -0
  43. package/dist/src/services/application/local-tunnel.service.d.ts.map +1 -0
  44. package/dist/src/services/application/local-tunnel.service.js +294 -0
  45. package/dist/src/services/application/local-tunnel.service.js.map +1 -0
  46. package/dist/src/services/application/provider-runtime-sync.service.d.ts.map +1 -1
  47. package/dist/src/services/application/provider-runtime-sync.service.js +3 -0
  48. package/dist/src/services/application/provider-runtime-sync.service.js.map +1 -1
  49. package/dist/src/services/application/saas-skeleton.service.d.ts +7 -0
  50. package/dist/src/services/application/saas-skeleton.service.d.ts.map +1 -1
  51. package/dist/src/services/application/saas-skeleton.service.js +2 -0
  52. package/dist/src/services/application/saas-skeleton.service.js.map +1 -1
  53. package/dist/src/services/catalog/service-address-resolver.service.d.ts +7 -1
  54. package/dist/src/services/catalog/service-address-resolver.service.d.ts.map +1 -1
  55. package/dist/src/services/catalog/service-address-resolver.service.js +6 -3
  56. package/dist/src/services/catalog/service-address-resolver.service.js.map +1 -1
  57. package/dist/src/services/credentials/application-secrets.service.d.ts +6 -0
  58. package/dist/src/services/credentials/application-secrets.service.d.ts.map +1 -1
  59. package/dist/src/services/credentials/application-secrets.service.js +1 -1
  60. package/dist/src/services/credentials/application-secrets.service.js.map +1 -1
  61. package/dist/src/services/credentials/provider-env-vars.utils.d.ts.map +1 -1
  62. package/dist/src/services/credentials/provider-env-vars.utils.js +3 -1
  63. package/dist/src/services/credentials/provider-env-vars.utils.js.map +1 -1
  64. package/dist/src/services/credentials/secrets-writer.service.d.ts +11 -2
  65. package/dist/src/services/credentials/secrets-writer.service.d.ts.map +1 -1
  66. package/dist/src/services/credentials/secrets-writer.service.js +12 -3
  67. package/dist/src/services/credentials/secrets-writer.service.js.map +1 -1
  68. package/dist/src/services/deployment/ci-deploy-generator.service.d.ts.map +1 -1
  69. package/dist/src/services/deployment/ci-deploy-generator.service.js +3 -3
  70. package/dist/src/services/deployment/ci-deploy-generator.service.js.map +1 -1
  71. package/dist/src/services/deployment/docker/docker-compose-generator.service.d.ts +3 -3
  72. package/dist/src/services/deployment/docker/docker-compose-generator.service.d.ts.map +1 -1
  73. package/dist/src/services/deployment/docker/docker-compose-generator.service.js +16 -12
  74. package/dist/src/services/deployment/docker/docker-compose-generator.service.js.map +1 -1
  75. package/dist/src/services/deployment/framework-pod-network-membership.d.ts +6 -0
  76. package/dist/src/services/deployment/framework-pod-network-membership.d.ts.map +1 -1
  77. package/dist/src/services/deployment/framework-pod-network-membership.js +12 -3
  78. package/dist/src/services/deployment/framework-pod-network-membership.js.map +1 -1
  79. package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.d.ts +4 -1
  80. package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.d.ts.map +1 -1
  81. package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.js +17 -7
  82. package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.js.map +1 -1
  83. package/dist/src/services/deployment/k8s/k8s-manifest.schemas.d.ts +7 -0
  84. package/dist/src/services/deployment/k8s/k8s-manifest.schemas.d.ts.map +1 -1
  85. package/dist/src/services/deployment/k8s/k8s-manifest.schemas.js.map +1 -1
  86. package/dist/src/services/deployment/k8s/k8s-secrets-generator.service.d.ts.map +1 -1
  87. package/dist/src/services/deployment/k8s/k8s-secrets-generator.service.js +15 -9
  88. package/dist/src/services/deployment/k8s/k8s-secrets-generator.service.js.map +1 -1
  89. package/dist/src/services/deployment/k8s/kind-pod-host-gateway.d.ts +43 -0
  90. package/dist/src/services/deployment/k8s/kind-pod-host-gateway.d.ts.map +1 -0
  91. package/dist/src/services/deployment/k8s/kind-pod-host-gateway.js +12 -0
  92. package/dist/src/services/deployment/k8s/kind-pod-host-gateway.js.map +1 -0
  93. package/dist/src/services/deployment/k8s/off-cluster-backing-services.d.ts +3 -1
  94. package/dist/src/services/deployment/k8s/off-cluster-backing-services.d.ts.map +1 -1
  95. package/dist/src/services/deployment/k8s/off-cluster-backing-services.js.map +1 -1
  96. package/dist/src/services/deployment/local-dev-late-workspace-members.service.d.ts +124 -0
  97. package/dist/src/services/deployment/local-dev-late-workspace-members.service.d.ts.map +1 -0
  98. package/dist/src/services/deployment/local-dev-late-workspace-members.service.js +249 -0
  99. package/dist/src/services/deployment/local-dev-late-workspace-members.service.js.map +1 -0
  100. package/dist/src/services/environment/authored-infra-config.utils.d.ts +9 -0
  101. package/dist/src/services/environment/authored-infra-config.utils.d.ts.map +1 -1
  102. package/dist/src/services/environment/authored-infra-config.utils.js +20 -1
  103. package/dist/src/services/environment/authored-infra-config.utils.js.map +1 -1
  104. package/dist/src/services/environment/container-host-gateway-listen-host.d.ts +6 -0
  105. package/dist/src/services/environment/container-host-gateway-listen-host.d.ts.map +1 -1
  106. package/dist/src/services/environment/container-host-gateway-listen-host.js +6 -0
  107. package/dist/src/services/environment/container-host-gateway-listen-host.js.map +1 -1
  108. package/dist/src/services/environment/env-configuration-generator.service.d.ts +12 -0
  109. package/dist/src/services/environment/env-configuration-generator.service.d.ts.map +1 -1
  110. package/dist/src/services/environment/env-configuration-generator.service.js +37 -5
  111. package/dist/src/services/environment/env-configuration-generator.service.js.map +1 -1
  112. package/dist/src/services/environment/env-vars-builder.service.d.ts +2 -1
  113. package/dist/src/services/environment/env-vars-builder.service.d.ts.map +1 -1
  114. package/dist/src/services/environment/env-vars-builder.service.js +47 -32
  115. package/dist/src/services/environment/env-vars-builder.service.js.map +1 -1
  116. package/dist/src/services/environment/environment-lifecycle.service.d.ts +7 -4
  117. package/dist/src/services/environment/environment-lifecycle.service.d.ts.map +1 -1
  118. package/dist/src/services/environment/environment-lifecycle.service.js +14 -18
  119. package/dist/src/services/environment/environment-lifecycle.service.js.map +1 -1
  120. package/dist/src/services/environment/environment-setup.service.d.ts.map +1 -1
  121. package/dist/src/services/environment/environment-setup.service.js +17 -6
  122. package/dist/src/services/environment/environment-setup.service.js.map +1 -1
  123. package/dist/src/services/environment/environment.service.d.ts +4 -3
  124. package/dist/src/services/environment/environment.service.d.ts.map +1 -1
  125. package/dist/src/services/environment/environment.service.js +0 -1
  126. package/dist/src/services/environment/environment.service.js.map +1 -1
  127. package/dist/src/services/framework/framework-docker-publish.service.d.ts +55 -15
  128. package/dist/src/services/framework/framework-docker-publish.service.d.ts.map +1 -1
  129. package/dist/src/services/framework/framework-docker-publish.service.js +115 -25
  130. package/dist/src/services/framework/framework-docker-publish.service.js.map +1 -1
  131. package/dist/src/services/security/csp-sync.service.d.ts.map +1 -1
  132. package/dist/src/services/security/csp-sync.service.js +21 -2
  133. package/dist/src/services/security/csp-sync.service.js.map +1 -1
  134. package/dist/tsconfig.build.tsbuildinfo +1 -1
  135. package/package.json +19 -19
  136. package/templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs +14 -7
  137. package/templates/infra/k8s/platform/platform-crontabs-batches-manager/deployment.yaml.hbs +13 -0
  138. package/templates/saas/skeleton/.wildo-saas/wildo-dev-companion/scripts/dev-supervised.sh +18 -4
  139. package/templates/saas/skeleton/frontend/nginx-config/default.conf.hbs +1 -1
  140. package/templates/saas/skeleton/frontend/src/generated/csp.generated.json.hbs +4 -4
  141. package/templates/saas/skeleton/infrastructure/local/wildo.infra.local.config.ts.hbs +2 -0
  142. package/wildo-framework.info.json +1 -1
@@ -0,0 +1,274 @@
1
+ import { existsSync, mkdirSync, utimesSync, writeFileSync } from 'fs';
2
+ import { join, resolve } from 'path';
3
+ import { WorkspaceScope, loadSaasConfig } from '@wildo-ai/platform-config-lib';
4
+ import { AppFrontendType } from '@wildo-ai/saas-models';
5
+ import { BaseCommand } from '../../kernel/base-command.js';
6
+ import { CommandCategory } from '../../kernel/types.js';
7
+ import { ErrorUtils } from '../../infrastructure/errors/error.utils.js';
8
+ import { regenerateEnvFiles, runtimeSignalFiles } from '../../services/credentials/application-secrets.service.js';
9
+ import { buildTunnelIngressYaml, cloudflaredReadiness, credentialsFileOf, ensureNamedTunnel, machineTunnelDirectory, processIsTunnel, readApplicationTunnelState, readMachineTunnelState, removeApplicationTunnelState, routeHostname, systemCloudflaredRunner, tunnelIdOfCredentialsFile, waitForTunnelConnection, waitForTunnelExit, writeApplicationTunnelState, writeMachineTunnelState, } from '../../services/application/local-tunnel.service.js';
10
+ /** The verbs of `wildo local tunnel`. */
11
+ export var LocalTunnelAction;
12
+ (function (LocalTunnelAction) {
13
+ LocalTunnelAction["UP"] = "up";
14
+ LocalTunnelAction["DOWN"] = "down";
15
+ LocalTunnelAction["STATUS"] = "status";
16
+ })(LocalTunnelAction || (LocalTunnelAction = {}));
17
+ export const systemLocalTunnelEnvironment = {
18
+ runner: systemCloudflaredRunner,
19
+ directory: machineTunnelDirectory(),
20
+ isTunnel: processIsTunnel,
21
+ cloudflaredHome: undefined,
22
+ credentialsExist: existsSync,
23
+ waitForConnection: (logPath, pid, configPath) => waitForTunnelConnection(logPath, pid, configPath),
24
+ waitForExit: (pid, configPath) => waitForTunnelExit(pid, configPath),
25
+ loadConfig: async (appRoot) => await loadSaasConfig(join(appRoot, 'wildo.saas.config.ts')),
26
+ regenerate: regenerateEnvFiles,
27
+ async signal(appRoot, runtimes) {
28
+ const now = new Date();
29
+ const signalled = [];
30
+ for (const [folder, file] of await runtimeSignalFiles(appRoot, runtimes)) {
31
+ utimesSync(file, now, now);
32
+ signalled.push(folder);
33
+ }
34
+ return signalled;
35
+ },
36
+ };
37
+ /** The application's backend port and its interactive frontend, from its own `wildo.saas.config.ts`. */
38
+ export function resolveApplicationTargets(config, frontendFlag) {
39
+ const services = Object.values(config.services ?? {});
40
+ const backends = services.filter((service) => service.frontendType === undefined && typeof service.defaultPort === 'number');
41
+ if (backends.length !== 1)
42
+ throw new Error(`Expected one backend service with a defaultPort, found ${backends.length}.`);
43
+ const interactive = services.filter((service) => service.frontendType === AppFrontendType.SAAS_APP && service.serviceName);
44
+ const frontend = frontendFlag
45
+ ? interactive.find((service) => service.serviceName === frontendFlag)
46
+ : interactive.length === 1 ? interactive[0] : undefined;
47
+ if (!frontend?.serviceName) {
48
+ throw new Error(frontendFlag
49
+ ? `No interactive frontend service is named '${frontendFlag}'.`
50
+ : `This application has ${interactive.length} interactive frontends: name the one whose public origin follows the tunnel with --frontend (it must be the backend's default frontend).`);
51
+ }
52
+ return { backendPort: backends[0].defaultPort, frontendServiceName: frontend.serviceName };
53
+ }
54
+ /** `host=url` pairs, each a local service. */
55
+ export function parseTunnelExtras(values) {
56
+ return values.map((value) => {
57
+ const [hostname, service] = value.split('=', 2);
58
+ if (!hostname || !service || !/^http:\/\/127\.0\.0\.1:\d+$/.test(service)) {
59
+ throw new Error(`--extra takes host=http://127.0.0.1:<port>, got '${value}'.`);
60
+ }
61
+ return { hostname, service };
62
+ });
63
+ }
64
+ /**
65
+ * `wildo local tunnel up | down | status` — give this application a public HTTPS origin through this machine's
66
+ * locally-managed Cloudflare tunnel, while it runs (#3907).
67
+ *
68
+ * - `up --hostname <app>-<machine>.wildo.ai [--tunnel <name>] [--frontend <service>] [--extra host=http://127.0.0.1:<port>]`:
69
+ * ensures the named tunnel (created on the first use with this machine's `cloudflared tunnel login`), routes the
70
+ * hostname to it (refusing a hostname whose record points elsewhere), writes the machine's ingress, (re)starts the ONE
71
+ * `cloudflared` process and waits for a registered connection, and only then records the state, regenerates the env
72
+ * files and restarts the backend, minions and workers through their supervisors. The companion is not restarted: its
73
+ * endpoints never follow the tunnel.
74
+ * - `down`: removes this application from the machine's tunnel, stops `cloudflared` when nothing is left (otherwise
75
+ * restarts it with the rest), regenerates and restarts the same runtimes, so the stack is back on localhost.
76
+ * - `status`: the application's and the machine's state, and whether the process is the live tunnel.
77
+ *
78
+ * When the recorded process is not the live tunnel (a crash, a reboot), `up` starts from this application alone: an
79
+ * entry another application left behind is never revived by someone else's `up` (#3907 review F3).
80
+ *
81
+ * Fail closed: only the protocol paths are forwarded (`TUNNEL_FORWARDED_API_PATHS`); everything else answers 404. Nothing
82
+ * here prints a credential. Exit codes: 0 done, 1 refused or failed.
83
+ */
84
+ export default class LocalTunnelCommand extends BaseCommand {
85
+ meta = {
86
+ name: 'local tunnel',
87
+ description: 'Give this application a public HTTPS origin through this machine\'s Cloudflare tunnel (up | down | status)',
88
+ category: CommandCategory.Local,
89
+ minimumScope: WorkspaceScope.SAAS_APP,
90
+ args: [{ name: 'action', description: 'up | down | status', required: true }],
91
+ flags: {
92
+ hostname: { type: 'string', description: 'The application\'s public hostname, e.g. todos-paul.wildo.ai (remembered after the first up)', default: undefined },
93
+ tunnel: { type: 'string', description: 'The machine\'s named tunnel (remembered while it runs)', default: undefined },
94
+ frontend: { type: 'string', description: 'The interactive frontend whose public origin follows the tunnel (needed when there are several)', default: undefined },
95
+ extra: { type: 'string[]', description: 'Another hostname the tunnel serves while it runs: host=http://127.0.0.1:<port> (a test receiver)', default: undefined },
96
+ env: { type: 'string', description: 'The environment whose env files are regenerated', default: 'local' },
97
+ 'credentials-file': {
98
+ type: 'string',
99
+ description: 'Run an existing tunnel from its credentials file, on a machine with no Cloudflare login (the QA VM). Its hostnames must already be routed by the machine that created it.',
100
+ default: undefined,
101
+ },
102
+ },
103
+ };
104
+ /** Overridable for tests. */
105
+ environment = systemLocalTunnelEnvironment;
106
+ async run(ctx) {
107
+ try {
108
+ const appRoot = ctx.cliContext.resolvedHomes.app.declarationRoot;
109
+ if (!appRoot)
110
+ throw new Error('Run `wildo local tunnel` from an application root (a directory with wildo.saas.config.ts).');
111
+ const action = ctx.args.action;
112
+ switch (action) {
113
+ case LocalTunnelAction.UP: return await this.up(ctx, appRoot);
114
+ case LocalTunnelAction.DOWN: return await this.down(ctx, appRoot);
115
+ case LocalTunnelAction.STATUS: return this.status(ctx, appRoot);
116
+ default: throw new Error(`Unknown action '${action ?? ''}': use up, down or status.`);
117
+ }
118
+ }
119
+ catch (error) {
120
+ ctx.log.error(ErrorUtils.extractErrorMessage(error));
121
+ return { success: false, exitCode: 1 };
122
+ }
123
+ }
124
+ /** The machine state, or `null` when its process is not the live tunnel (its entries are then not trusted). */
125
+ liveMachine() {
126
+ const machine = readMachineTunnelState(this.environment.directory);
127
+ return machine && this.environment.isTunnel(machine.pid, machine.configPath) ? machine : null;
128
+ }
129
+ async up(ctx, appRoot) {
130
+ // #3907 item 3: a machine with no Cloudflare login (the QA VM) is GIVEN the tunnel's credentials file. It cannot ask
131
+ // the account for the tunnel nor route a hostname, so both are the creating machine's job, done once; this machine
132
+ // only runs the tunnel. cloudflared needs no login for that: the credentials file names the tunnel (measured
133
+ // 2026-11-17, by id and by name, with an empty home).
134
+ const givenCredentials = ctx.flags['credentials-file'] ?? readMachineTunnelState(this.environment.directory)?.givenCredentialsFile;
135
+ if (!givenCredentials) {
136
+ const notReady = cloudflaredReadiness(this.environment.cloudflaredHome);
137
+ if (notReady)
138
+ throw new Error(notReady);
139
+ }
140
+ const saasConfig = await this.environment.loadConfig(appRoot);
141
+ const previous = readApplicationTunnelState(appRoot);
142
+ const live = this.liveMachine();
143
+ const hostname = ctx.flags.hostname ?? previous?.hostname;
144
+ const tunnelName = ctx.flags.tunnel ?? live?.tunnelName ?? previous?.tunnelName;
145
+ if (!hostname)
146
+ throw new Error('Name the application\'s public hostname with --hostname (e.g. todos-paul.wildo.ai).');
147
+ if (!tunnelName)
148
+ throw new Error('Name this machine\'s tunnel with --tunnel (e.g. wildo-paul).');
149
+ if (live && live.tunnelName !== tunnelName) {
150
+ throw new Error(`This machine's tunnel '${live.tunnelName}' is running for ${Object.values(live.applications).map((app) => app.hostname).join(', ')}; one machine runs one tunnel. Use it, or bring those applications down first.`);
151
+ }
152
+ const { backendPort, frontendServiceName } = resolveApplicationTargets(saasConfig, ctx.flags.frontend);
153
+ const extras = [...(live?.extras ?? []), ...parseTunnelExtras(ctx.flags.extra ?? [])]
154
+ .filter((extra, index, all) => all.findIndex((other) => other.hostname === extra.hostname) === index);
155
+ let credentialsFile;
156
+ if (givenCredentials) {
157
+ credentialsFile = resolve(givenCredentials);
158
+ if (!this.environment.credentialsExist(credentialsFile))
159
+ throw new Error(`No credentials file at ${credentialsFile}.`);
160
+ const id = tunnelIdOfCredentialsFile(credentialsFile);
161
+ ctx.log.info(` Running tunnel ${id} from its credentials file. Its hostnames are routed by the machine that created it; this one does not route ${[hostname, ...extras.map((extra) => extra.hostname)].join(', ')}.`);
162
+ }
163
+ else {
164
+ const { id } = await ensureNamedTunnel(this.environment.runner, tunnelName);
165
+ credentialsFile = credentialsFileOf(id, this.environment.cloudflaredHome);
166
+ if (!this.environment.credentialsExist(credentialsFile)) {
167
+ throw new Error(`The tunnel '${tunnelName}' has no credentials file on this machine (${credentialsFile}): it was created elsewhere. Pass it with --credentials-file, or use a tunnel this machine created.`);
168
+ }
169
+ await routeHostname(this.environment.runner, tunnelName, hostname);
170
+ for (const extra of extras)
171
+ await routeHostname(this.environment.runner, tunnelName, extra.hostname);
172
+ }
173
+ const applications = { ...(live?.applications ?? {}), [appRoot]: { hostname, backendPort } };
174
+ const next = await this.restart(live, { tunnelName, credentialsFile, applications, extras, givenCredentialsFile: givenCredentials ? credentialsFile : undefined });
175
+ writeMachineTunnelState(next, this.environment.directory);
176
+ writeApplicationTunnelState(appRoot, {
177
+ schemaVersion: 1, tunnelName, hostname, publicOrigin: `https://${hostname}`, frontendServiceName, backendPort,
178
+ });
179
+ ctx.log.success(` The tunnel serves https://${hostname} (pid ${next.pid}); its protocol paths reach :${backendPort}, everything else answers 404.`);
180
+ await this.applyToRuntimes(ctx, appRoot, saasConfig);
181
+ return { success: true };
182
+ }
183
+ async down(ctx, appRoot) {
184
+ const saasConfig = await this.environment.loadConfig(appRoot);
185
+ const recorded = readMachineTunnelState(this.environment.directory);
186
+ const live = this.liveMachine();
187
+ removeApplicationTunnelState(appRoot);
188
+ if (recorded) {
189
+ const { [appRoot]: _removed, ...applications } = recorded.applications;
190
+ if (!live || Object.keys(applications).length === 0) {
191
+ if (live?.pid) {
192
+ this.environment.runner.stop(live.pid);
193
+ if (!await this.environment.waitForExit(live.pid, live.configPath)) {
194
+ // Keep the pid on record: a process still forwarding the protocol paths must stay visible to `status`.
195
+ writeMachineTunnelState({ ...recorded, applications: {}, extras: [] }, this.environment.directory);
196
+ ctx.log.warn(` The tunnel process (pid ${live.pid}) did not exit; it may still forward. Stop it yourself, then run \`wildo local tunnel status\`.`);
197
+ await this.applyToRuntimes(ctx, appRoot, saasConfig);
198
+ return { success: false, exitCode: 1 };
199
+ }
200
+ }
201
+ // Nothing left: no application, no extras, no process. The next `up` starts clean.
202
+ writeMachineTunnelState({ ...recorded, pid: null, applications: {}, extras: [] }, this.environment.directory);
203
+ ctx.log.success(' The tunnel is stopped.');
204
+ }
205
+ else {
206
+ const credentialsFile = live.givenCredentialsFile
207
+ ?? credentialsFileOf((await ensureNamedTunnel(this.environment.runner, live.tunnelName)).id, this.environment.cloudflaredHome);
208
+ writeMachineTunnelState(await this.restart(live, { tunnelName: live.tunnelName, credentialsFile, applications, extras: live.extras, givenCredentialsFile: live.givenCredentialsFile }), this.environment.directory);
209
+ ctx.log.success(' This application left the tunnel; the others still use it.');
210
+ }
211
+ }
212
+ await this.applyToRuntimes(ctx, appRoot, saasConfig);
213
+ return { success: true };
214
+ }
215
+ status(ctx, appRoot) {
216
+ const state = readApplicationTunnelState(appRoot);
217
+ const machine = readMachineTunnelState(this.environment.directory);
218
+ const live = machine !== null && this.environment.isTunnel(machine.pid, machine.configPath);
219
+ if (!state)
220
+ ctx.log.info(' This application has no tunnel: its public origin is local.');
221
+ else
222
+ ctx.log.info(` This application's public origin: ${state.publicOrigin} (frontend ${state.frontendServiceName}, backend :${state.backendPort}).`);
223
+ if (machine) {
224
+ ctx.log.info(` Machine tunnel '${machine.tunnelName}': ${live ? `running (pid ${machine.pid})` : 'not running'}, serving ${Object.values(machine.applications).map((app) => app.hostname).join(', ') || 'no application'}${machine.extras.length ? ` and ${machine.extras.map((extra) => extra.hostname).join(', ')}` : ''}.`);
225
+ }
226
+ if (state && !live)
227
+ ctx.log.warn(' The state names a tunnel whose process is not running: env generation ignores it. Run `wildo local tunnel up` or `down`.');
228
+ return { success: true };
229
+ }
230
+ /**
231
+ * Write the ingress and (re)start the machine's one `cloudflared` process: the old one is stopped and has EXITED before
232
+ * the new one starts, so two connectors with different ingress never serve at once (review F12), and the new one has
233
+ * registered a connection before anything is recorded (review F5).
234
+ */
235
+ async restart(live, input) {
236
+ const configPath = join(this.environment.directory, `${input.tunnelName}.yml`);
237
+ const logPath = join(this.environment.directory, 'cloudflared.log');
238
+ const yaml = buildTunnelIngressYaml({ tunnelName: input.tunnelName, credentialsFile: input.credentialsFile, applications: Object.values(input.applications), extras: input.extras });
239
+ if (live?.pid) {
240
+ this.environment.runner.stop(live.pid);
241
+ if (!await this.environment.waitForExit(live.pid, live.configPath)) {
242
+ throw new Error(`The running tunnel (pid ${live.pid}) did not exit; nothing was changed. Stop it, then run this again.`);
243
+ }
244
+ }
245
+ mkdirSync(this.environment.directory, { recursive: true });
246
+ writeFileSync(configPath, yaml);
247
+ const pid = this.environment.runner.startDetached(['tunnel', '--no-autoupdate', '--config', configPath, 'run', input.tunnelName], logPath);
248
+ if (!await this.environment.waitForConnection(logPath, pid, configPath)) {
249
+ this.environment.runner.stop(pid);
250
+ const others = Object.entries(input.applications).filter(([root]) => live?.applications[root]).map(([root, app]) => `${app.hostname} (${root})`);
251
+ throw new Error(`cloudflared registered no connection (see ${logPath}); nothing was recorded and this application's public origin stays local.`
252
+ + (others.length > 0 ? ` The tunnel these applications used is now stopped, and their backends advertise it until they regenerate: ${others.join(', ')}. Run \`wildo local tunnel up\` or \`down\` in each.` : ''));
253
+ }
254
+ return {
255
+ schemaVersion: 1, tunnelName: input.tunnelName, pid, configPath, logPath, applications: input.applications, extras: [...input.extras],
256
+ ...(input.givenCredentialsFile ? { givenCredentialsFile: input.givenCredentialsFile } : {}),
257
+ };
258
+ }
259
+ /** Regenerate the env files and restart every runtime that reads the public origin, never the companion. */
260
+ async applyToRuntimes(ctx, appRoot, config) {
261
+ const env = ctx.flags.env ?? 'local';
262
+ const regeneration = this.environment.regenerate(appRoot, env);
263
+ if (!regeneration.regenerated) {
264
+ ctx.log.warn(` The env files could not be regenerated, so the runtimes still advertise the previous public origin: run \`wildo config sync --domain env-files\`, then restart the backend.${regeneration.failure ? ` (${regeneration.failure})` : ''}`);
265
+ return;
266
+ }
267
+ const runtimes = ['backend', ...Object.keys(config.minions ?? {}).map((key) => `minions.${key}`), ...Object.keys(config.workers ?? {}).map((key) => `workers.${key}`)];
268
+ const signalled = await this.environment.signal(appRoot, runtimes);
269
+ ctx.log.info(signalled.length > 0
270
+ ? ` Restarted through their supervisors: ${signalled.join(', ')}.`
271
+ : ' No supervised runtime is running: the change takes effect at the next `wildo local dev`.');
272
+ }
273
+ }
274
+ //# sourceMappingURL=tunnel.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tunnel.command.js","sourceRoot":"","sources":["../../../../src/commands/local/tunnel.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,g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MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACnE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC;YAC/B,CAAC,CAAC,0CAA0C,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACnE,CAAC,CAAC,4FAA4F,CAAC,CAAC;IACpG,CAAC;CACF","sourcesContent":["import { existsSync, mkdirSync, utimesSync, writeFileSync } from 'fs';\nimport { join, resolve } from 'path';\nimport { WorkspaceScope, loadSaasConfig } from '@wildo-ai/platform-config-lib';\nimport { AppFrontendType } from '@wildo-ai/saas-models';\n\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\nimport { CommandCategory } from '~wildo-cli/kernel/types';\nimport type { CommandContext, CommandMeta, CommandResult } from '~wildo-cli/kernel/types';\nimport { ErrorUtils } from '~wildo-cli/infrastructure/errors/error.utils';\nimport { regenerateEnvFiles, runtimeSignalFiles } from '~wildo-cli/services/credentials/application-secrets.service';\nimport {\n buildTunnelIngressYaml,\n cloudflaredReadiness,\n credentialsFileOf,\n ensureNamedTunnel,\n machineTunnelDirectory,\n processIsTunnel,\n readApplicationTunnelState,\n readMachineTunnelState,\n removeApplicationTunnelState,\n routeHostname,\n systemCloudflaredRunner,\n tunnelIdOfCredentialsFile,\n waitForTunnelConnection,\n waitForTunnelExit,\n writeApplicationTunnelState,\n writeMachineTunnelState,\n type CloudflaredRunner,\n type MachineTunnelState,\n type TunnelExtraRoute,\n} from '~wildo-cli/services/application/local-tunnel.service';\n\n/** The verbs of `wildo local tunnel`. */\nexport enum LocalTunnelAction {\n UP = 'up',\n DOWN = 'down',\n STATUS = 'status',\n}\n\ninterface SaasServices {\n services?: Record<string, { path?: string; serviceName?: string; defaultPort?: number; frontendType?: string }>;\n minions?: Record<string, unknown>;\n workers?: Record<string, unknown>;\n}\n\n/** What the command reaches outside itself, injectable for tests. */\nexport interface LocalTunnelEnvironment {\n readonly runner: CloudflaredRunner;\n readonly directory: string;\n readonly isTunnel: typeof processIsTunnel;\n readonly cloudflaredHome: string | undefined;\n readonly credentialsExist: (path: string) => boolean;\n readonly waitForConnection: (logPath: string, pid: number, configPath: string) => Promise<boolean>;\n readonly waitForExit: (pid: number, configPath: string) => Promise<boolean>;\n readonly loadConfig: (appRoot: string) => Promise<SaasServices>;\n readonly regenerate: (appRoot: string, envName: string) => { readonly regenerated: boolean; readonly failure: string | null };\n readonly signal: (appRoot: string, runtimes: readonly string[]) => Promise<string[]>;\n}\n\nexport const systemLocalTunnelEnvironment: LocalTunnelEnvironment = {\n runner: systemCloudflaredRunner,\n directory: machineTunnelDirectory(),\n isTunnel: processIsTunnel,\n cloudflaredHome: undefined,\n credentialsExist: existsSync,\n waitForConnection: (logPath, pid, configPath) => waitForTunnelConnection(logPath, pid, configPath),\n waitForExit: (pid, configPath) => waitForTunnelExit(pid, configPath),\n loadConfig: async (appRoot) => await loadSaasConfig(join(appRoot, 'wildo.saas.config.ts')) as SaasServices,\n regenerate: regenerateEnvFiles,\n async signal(appRoot, runtimes) {\n const now = new Date();\n const signalled: string[] = [];\n for (const [folder, file] of await runtimeSignalFiles(appRoot, runtimes)) {\n utimesSync(file, now, now);\n signalled.push(folder);\n }\n return signalled;\n },\n};\n\n/** The application's backend port and its interactive frontend, from its own `wildo.saas.config.ts`. */\nexport function resolveApplicationTargets(config: SaasServices, frontendFlag: string | undefined): { backendPort: number; frontendServiceName: string } {\n const services = Object.values(config.services ?? {});\n const backends = services.filter((service) => service.frontendType === undefined && typeof service.defaultPort === 'number');\n if (backends.length !== 1) throw new Error(`Expected one backend service with a defaultPort, found ${backends.length}.`);\n const interactive = services.filter((service) => service.frontendType === AppFrontendType.SAAS_APP && service.serviceName);\n const frontend = frontendFlag\n ? interactive.find((service) => service.serviceName === frontendFlag)\n : interactive.length === 1 ? interactive[0] : undefined;\n if (!frontend?.serviceName) {\n throw new Error(frontendFlag\n ? `No interactive frontend service is named '${frontendFlag}'.`\n : `This application has ${interactive.length} interactive frontends: name the one whose public origin follows the tunnel with --frontend (it must be the backend's default frontend).`);\n }\n return { backendPort: backends[0]!.defaultPort!, frontendServiceName: frontend.serviceName };\n}\n\n/** `host=url` pairs, each a local service. */\nexport function parseTunnelExtras(values: readonly string[]): TunnelExtraRoute[] {\n return values.map((value) => {\n const [hostname, service] = value.split('=', 2) as [string, string | undefined];\n if (!hostname || !service || !/^http:\\/\\/127\\.0\\.0\\.1:\\d+$/.test(service)) {\n throw new Error(`--extra takes host=http://127.0.0.1:<port>, got '${value}'.`);\n }\n return { hostname, service };\n });\n}\n\n/**\n * `wildo local tunnel up | down | status` — give this application a public HTTPS origin through this machine's\n * locally-managed Cloudflare tunnel, while it runs (#3907).\n *\n * - `up --hostname <app>-<machine>.wildo.ai [--tunnel <name>] [--frontend <service>] [--extra host=http://127.0.0.1:<port>]`:\n * ensures the named tunnel (created on the first use with this machine's `cloudflared tunnel login`), routes the\n * hostname to it (refusing a hostname whose record points elsewhere), writes the machine's ingress, (re)starts the ONE\n * `cloudflared` process and waits for a registered connection, and only then records the state, regenerates the env\n * files and restarts the backend, minions and workers through their supervisors. The companion is not restarted: its\n * endpoints never follow the tunnel.\n * - `down`: removes this application from the machine's tunnel, stops `cloudflared` when nothing is left (otherwise\n * restarts it with the rest), regenerates and restarts the same runtimes, so the stack is back on localhost.\n * - `status`: the application's and the machine's state, and whether the process is the live tunnel.\n *\n * When the recorded process is not the live tunnel (a crash, a reboot), `up` starts from this application alone: an\n * entry another application left behind is never revived by someone else's `up` (#3907 review F3).\n *\n * Fail closed: only the protocol paths are forwarded (`TUNNEL_FORWARDED_API_PATHS`); everything else answers 404. Nothing\n * here prints a credential. Exit codes: 0 done, 1 refused or failed.\n */\nexport default class LocalTunnelCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'local tunnel',\n description: 'Give this application a public HTTPS origin through this machine\\'s Cloudflare tunnel (up | down | status)',\n category: CommandCategory.Local,\n minimumScope: WorkspaceScope.SAAS_APP,\n args: [{ name: 'action', description: 'up | down | status', required: true }],\n flags: {\n hostname: { type: 'string', description: 'The application\\'s public hostname, e.g. todos-paul.wildo.ai (remembered after the first up)', default: undefined },\n tunnel: { type: 'string', description: 'The machine\\'s named tunnel (remembered while it runs)', default: undefined },\n frontend: { type: 'string', description: 'The interactive frontend whose public origin follows the tunnel (needed when there are several)', default: undefined },\n extra: { type: 'string[]', description: 'Another hostname the tunnel serves while it runs: host=http://127.0.0.1:<port> (a test receiver)', default: undefined },\n env: { type: 'string', description: 'The environment whose env files are regenerated', default: 'local' },\n 'credentials-file': {\n type: 'string',\n description: 'Run an existing tunnel from its credentials file, on a machine with no Cloudflare login (the QA VM). Its hostnames must already be routed by the machine that created it.',\n default: undefined,\n },\n },\n };\n\n /** Overridable for tests. */\n protected environment: LocalTunnelEnvironment = systemLocalTunnelEnvironment;\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n try {\n const appRoot = ctx.cliContext.resolvedHomes.app.declarationRoot;\n if (!appRoot) throw new Error('Run `wildo local tunnel` from an application root (a directory with wildo.saas.config.ts).');\n const action = ctx.args.action as LocalTunnelAction | undefined;\n switch (action) {\n case LocalTunnelAction.UP: return await this.up(ctx, appRoot);\n case LocalTunnelAction.DOWN: return await this.down(ctx, appRoot);\n case LocalTunnelAction.STATUS: return this.status(ctx, appRoot);\n default: throw new Error(`Unknown action '${action ?? ''}': use up, down or status.`);\n }\n } catch (error) {\n ctx.log.error(ErrorUtils.extractErrorMessage(error));\n return { success: false, exitCode: 1 };\n }\n }\n\n /** The machine state, or `null` when its process is not the live tunnel (its entries are then not trusted). */\n private liveMachine(): MachineTunnelState | null {\n const machine = readMachineTunnelState(this.environment.directory);\n return machine && this.environment.isTunnel(machine.pid, machine.configPath) ? machine : null;\n }\n\n private async up(ctx: CommandContext, appRoot: string): Promise<CommandResult> {\n // #3907 item 3: a machine with no Cloudflare login (the QA VM) is GIVEN the tunnel's credentials file. It cannot ask\n // the account for the tunnel nor route a hostname, so both are the creating machine's job, done once; this machine\n // only runs the tunnel. cloudflared needs no login for that: the credentials file names the tunnel (measured\n // 2026-11-17, by id and by name, with an empty home).\n const givenCredentials = (ctx.flags['credentials-file'] as string | undefined) ?? readMachineTunnelState(this.environment.directory)?.givenCredentialsFile;\n if (!givenCredentials) {\n const notReady = cloudflaredReadiness(this.environment.cloudflaredHome);\n if (notReady) throw new Error(notReady);\n }\n const saasConfig = await this.environment.loadConfig(appRoot);\n const previous = readApplicationTunnelState(appRoot);\n const live = this.liveMachine();\n const hostname = (ctx.flags.hostname as string | undefined) ?? previous?.hostname;\n const tunnelName = (ctx.flags.tunnel as string | undefined) ?? live?.tunnelName ?? previous?.tunnelName;\n if (!hostname) throw new Error('Name the application\\'s public hostname with --hostname (e.g. todos-paul.wildo.ai).');\n if (!tunnelName) throw new Error('Name this machine\\'s tunnel with --tunnel (e.g. wildo-paul).');\n if (live && live.tunnelName !== tunnelName) {\n throw new Error(`This machine's tunnel '${live.tunnelName}' is running for ${Object.values(live.applications).map((app) => app.hostname).join(', ')}; one machine runs one tunnel. Use it, or bring those applications down first.`);\n }\n const { backendPort, frontendServiceName } = resolveApplicationTargets(saasConfig, ctx.flags.frontend as string | undefined);\n const extras = [...(live?.extras ?? []), ...parseTunnelExtras((ctx.flags.extra as string[] | undefined) ?? [])]\n .filter((extra, index, all) => all.findIndex((other) => other.hostname === extra.hostname) === index);\n\n let credentialsFile: string;\n if (givenCredentials) {\n credentialsFile = resolve(givenCredentials);\n if (!this.environment.credentialsExist(credentialsFile)) throw new Error(`No credentials file at ${credentialsFile}.`);\n const id = tunnelIdOfCredentialsFile(credentialsFile);\n ctx.log.info(` Running tunnel ${id} from its credentials file. Its hostnames are routed by the machine that created it; this one does not route ${[hostname, ...extras.map((extra) => extra.hostname)].join(', ')}.`);\n } else {\n const { id } = await ensureNamedTunnel(this.environment.runner, tunnelName);\n credentialsFile = credentialsFileOf(id, this.environment.cloudflaredHome);\n if (!this.environment.credentialsExist(credentialsFile)) {\n throw new Error(`The tunnel '${tunnelName}' has no credentials file on this machine (${credentialsFile}): it was created elsewhere. Pass it with --credentials-file, or use a tunnel this machine created.`);\n }\n await routeHostname(this.environment.runner, tunnelName, hostname);\n for (const extra of extras) await routeHostname(this.environment.runner, tunnelName, extra.hostname);\n }\n\n const applications = { ...(live?.applications ?? {}), [appRoot]: { hostname, backendPort } };\n const next = await this.restart(live, { tunnelName, credentialsFile, applications, extras, givenCredentialsFile: givenCredentials ? credentialsFile : undefined });\n writeMachineTunnelState(next, this.environment.directory);\n writeApplicationTunnelState(appRoot, {\n schemaVersion: 1, tunnelName, hostname, publicOrigin: `https://${hostname}`, frontendServiceName, backendPort,\n });\n ctx.log.success(` The tunnel serves https://${hostname} (pid ${next.pid}); its protocol paths reach :${backendPort}, everything else answers 404.`);\n await this.applyToRuntimes(ctx, appRoot, saasConfig);\n return { success: true };\n }\n\n private async down(ctx: CommandContext, appRoot: string): Promise<CommandResult> {\n const saasConfig = await this.environment.loadConfig(appRoot);\n const recorded = readMachineTunnelState(this.environment.directory);\n const live = this.liveMachine();\n removeApplicationTunnelState(appRoot);\n if (recorded) {\n const { [appRoot]: _removed, ...applications } = recorded.applications;\n if (!live || Object.keys(applications).length === 0) {\n if (live?.pid) {\n this.environment.runner.stop(live.pid);\n if (!await this.environment.waitForExit(live.pid, live.configPath)) {\n // Keep the pid on record: a process still forwarding the protocol paths must stay visible to `status`.\n writeMachineTunnelState({ ...recorded, applications: {}, extras: [] }, this.environment.directory);\n ctx.log.warn(` The tunnel process (pid ${live.pid}) did not exit; it may still forward. Stop it yourself, then run \\`wildo local tunnel status\\`.`);\n await this.applyToRuntimes(ctx, appRoot, saasConfig);\n return { success: false, exitCode: 1 };\n }\n }\n // Nothing left: no application, no extras, no process. The next `up` starts clean.\n writeMachineTunnelState({ ...recorded, pid: null, applications: {}, extras: [] }, this.environment.directory);\n ctx.log.success(' The tunnel is stopped.');\n } else {\n const credentialsFile = live.givenCredentialsFile\n ?? credentialsFileOf((await ensureNamedTunnel(this.environment.runner, live.tunnelName)).id, this.environment.cloudflaredHome);\n writeMachineTunnelState(await this.restart(live, { tunnelName: live.tunnelName, credentialsFile, applications, extras: live.extras, givenCredentialsFile: live.givenCredentialsFile }), this.environment.directory);\n ctx.log.success(' This application left the tunnel; the others still use it.');\n }\n }\n await this.applyToRuntimes(ctx, appRoot, saasConfig);\n return { success: true };\n }\n\n private status(ctx: CommandContext, appRoot: string): CommandResult {\n const state = readApplicationTunnelState(appRoot);\n const machine = readMachineTunnelState(this.environment.directory);\n const live = machine !== null && this.environment.isTunnel(machine.pid, machine.configPath);\n if (!state) ctx.log.info(' This application has no tunnel: its public origin is local.');\n else ctx.log.info(` This application's public origin: ${state.publicOrigin} (frontend ${state.frontendServiceName}, backend :${state.backendPort}).`);\n if (machine) {\n ctx.log.info(` Machine tunnel '${machine.tunnelName}': ${live ? `running (pid ${machine.pid})` : 'not running'}, serving ${Object.values(machine.applications).map((app) => app.hostname).join(', ') || 'no application'}${machine.extras.length ? ` and ${machine.extras.map((extra) => extra.hostname).join(', ')}` : ''}.`);\n }\n if (state && !live) ctx.log.warn(' The state names a tunnel whose process is not running: env generation ignores it. Run `wildo local tunnel up` or `down`.');\n return { success: true };\n }\n\n /**\n * Write the ingress and (re)start the machine's one `cloudflared` process: the old one is stopped and has EXITED before\n * the new one starts, so two connectors with different ingress never serve at once (review F12), and the new one has\n * registered a connection before anything is recorded (review F5).\n */\n private async restart(\n live: MachineTunnelState | null,\n input: { tunnelName: string; credentialsFile: string; applications: MachineTunnelState['applications']; extras: readonly TunnelExtraRoute[]; givenCredentialsFile?: string },\n ): Promise<MachineTunnelState> {\n const configPath = join(this.environment.directory, `${input.tunnelName}.yml`);\n const logPath = join(this.environment.directory, 'cloudflared.log');\n const yaml = buildTunnelIngressYaml({ tunnelName: input.tunnelName, credentialsFile: input.credentialsFile, applications: Object.values(input.applications), extras: input.extras });\n if (live?.pid) {\n this.environment.runner.stop(live.pid);\n if (!await this.environment.waitForExit(live.pid, live.configPath)) {\n throw new Error(`The running tunnel (pid ${live.pid}) did not exit; nothing was changed. Stop it, then run this again.`);\n }\n }\n mkdirSync(this.environment.directory, { recursive: true });\n writeFileSync(configPath, yaml);\n const pid = this.environment.runner.startDetached(['tunnel', '--no-autoupdate', '--config', configPath, 'run', input.tunnelName], logPath);\n if (!await this.environment.waitForConnection(logPath, pid, configPath)) {\n this.environment.runner.stop(pid);\n const others = Object.entries(input.applications).filter(([root]) => live?.applications[root]).map(([root, app]) => `${app.hostname} (${root})`);\n throw new Error(`cloudflared registered no connection (see ${logPath}); nothing was recorded and this application's public origin stays local.`\n + (others.length > 0 ? ` The tunnel these applications used is now stopped, and their backends advertise it until they regenerate: ${others.join(', ')}. Run \\`wildo local tunnel up\\` or \\`down\\` in each.` : ''));\n }\n return {\n schemaVersion: 1, tunnelName: input.tunnelName, pid, configPath, logPath, applications: input.applications, extras: [...input.extras],\n ...(input.givenCredentialsFile ? { givenCredentialsFile: input.givenCredentialsFile } : {}),\n };\n }\n\n /** Regenerate the env files and restart every runtime that reads the public origin, never the companion. */\n private async applyToRuntimes(ctx: CommandContext, appRoot: string, config: SaasServices): Promise<void> {\n const env = (ctx.flags.env as string | undefined) ?? 'local';\n const regeneration = this.environment.regenerate(appRoot, env);\n if (!regeneration.regenerated) {\n ctx.log.warn(` The env files could not be regenerated, so the runtimes still advertise the previous public origin: run \\`wildo config sync --domain env-files\\`, then restart the backend.${regeneration.failure ? ` (${regeneration.failure})` : ''}`);\n return;\n }\n const runtimes = ['backend', ...Object.keys(config.minions ?? {}).map((key) => `minions.${key}`), ...Object.keys(config.workers ?? {}).map((key) => `workers.${key}`)];\n const signalled = await this.environment.signal(appRoot, runtimes);\n ctx.log.info(signalled.length > 0\n ? ` Restarted through their supervisors: ${signalled.join(', ')}.`\n : ' No supervised runtime is running: the change takes effect at the next `wildo local dev`.');\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { RuntimeEnvironment } from '@wildo-ai/saas-models';
2
- import { type AdminAppManagedDeclaration, type AppBootstrapCredentials, type AppBootstrapFirstAdminSeed, type ApplicationBackingServiceAddressing, type ApplicationSigningKeyPromoteRequest, type ApplicationSigningKeyStageRequest, type ApplicationSigningKeyRotationRequest, type ApplicationSigningKeyRotationResponse, type ApplicationSigningKeysStatus, type ApplicationLegacyEnvelopeKeyResponse, type ApplicationLegacyEnvelopeKeyRestoreRequest, type ApplicationLegacyEnvelopeKeyRetirementRequest, type ApplicationLegacyEnvelopeKeyStatus, type KeyringRotationRequest, type KeyringStatus, type RegistryKeyMintRequest, type RegistryKeyListResponse, type RegistryKeyMintResponse, type AdminAppReapplyDeclarationResponse, type ApplicationRuntimePrincipal, DatabaseEngine, AppDatabaseSeedingPhase, AppDatabaseSeedingOutcome, type BackingServiceKind } from '@wildo-ai/platform-config-lib';
2
+ import { type AdminAppManagedDeclaration, type AppBootstrapCredentials, type AppBootstrapFirstAdminSeed, type ApplicationBackingServiceAddressing, type ApplicationSigningKeyPromoteRequest, type ApplicationSigningKeyStageRequest, type ApplicationSigningKeyRotationRequest, type ApplicationSigningKeyRotationResponse, type ApplicationSigningKeysStatus, type ApplicationLegacyEnvelopeKeyResponse, type ApplicationLegacyEnvelopeKeyRestoreRequest, type ApplicationLegacyEnvelopeKeyRetirementRequest, type ApplicationLegacyEnvelopeKeyStatus, type KeyringRotationRequest, type KeyringStatus, type RegistryKeyMintRequest, type RegistryKeyListResponse, type RegistryKeyMintResponse, type AdminAppReapplyDeclarationResponse, type ApplicationScheduledJobsResponse, type ApplicationScheduledJobRunRequest, type ApplicationScheduledJobRunResponse, type ApplicationRuntimePrincipal, DatabaseEngine, AppDatabaseSeedingPhase, AppDatabaseSeedingOutcome, type BackingServiceKind } from '@wildo-ai/platform-config-lib';
3
3
  import type { PlatformEnvSecretsJson } from '../../services/credentials/credentials.schemas';
4
4
  import type { PlatformEnvConfigJson } from '../../services/credentials/credentials.schemas';
5
5
  import type { PlatformEnvironmentConfiguration } from '../../services/environment/environment.schemas';
@@ -96,9 +96,22 @@ export interface PreparedApplicationEnvTargets {
96
96
  * existing `.env` files are left untouched.
97
97
  */
98
98
  unresolvedPrincipals?: string[];
99
+ /**
100
+ * The runtime endpoints the application's runtimes receive. While a local tunnel is live (#3907) the tunnel's frontend
101
+ * has the public origin as its `publicUrl` and its local origin in `additionalBrowserOrigins`.
102
+ */
99
103
  runtimeEndpoints: Record<string, {
100
104
  publicUrl: string;
101
105
  internalUrl: string;
106
+ additionalBrowserOrigins?: string[];
107
+ }>;
108
+ /**
109
+ * The same endpoints WITHOUT the tunnel: the companion's. A tunnel coming up or down must never restart the companion
110
+ * under a live run (#3493), and nothing the companion does needs the public origin.
111
+ */
112
+ companionRuntimeEndpoints: Record<string, {
113
+ publicUrl: string;
114
+ internalUrl: string;
102
115
  }>;
103
116
  /**
104
117
  * The environment resolved during preparation, carried so per-runtime
@@ -170,6 +183,13 @@ export interface ApplicationDeregistrationResponse {
170
183
  withdrawnJobs: number;
171
184
  deletedExecutions: number;
172
185
  revokedCredentials: ApplicationCredentialReportEntry[];
186
+ /**
187
+ * Broker credentials no running broker could revoke (#2303 slice D): minted before the platform moved to a profile that
188
+ * runs no broker. Absent when there are none; each names its remedy.
189
+ */
190
+ unreachableCredentials?: Array<ApplicationCredentialReportEntry & {
191
+ reason: string;
192
+ }>;
173
193
  }
174
194
  /** `POST /admin/apps/:appSlug/restore` — the restore and every credential it re-minted. */
175
195
  export interface ApplicationRestoreResponse {
@@ -201,6 +221,12 @@ export declare class AppBootstrapService {
201
221
  * entry falls back to normal nginx-pod serving (never silently drops a route).
202
222
  */
203
223
  private static cdnFrontendKeys;
224
+ /**
225
+ * The runtime endpoints, and the same endpoints with a live local tunnel applied (#3907). Only a LOCAL environment can
226
+ * have a tunnel; a state file whose process is not running is ignored and named, so a crash or a reboot never leaves a
227
+ * dead issuer advertised. See `local-tunnel.service.ts`.
228
+ */
229
+ private static buildRuntimeEndpointsWithTunnel;
204
230
  private static buildRuntimeEndpoints;
205
231
  /**
206
232
  * serviceHosts-driven ingress routes for the app's public services — the
@@ -478,6 +504,20 @@ export declare class AppBootstrapService {
478
504
  static inspectApplicationResidue(env: PlatformEnvironmentConfiguration, credentials: PlatformEnvSecretsJson, input: {
479
505
  appSlug: string;
480
506
  }): Promise<ApplicationResidueResponse>;
507
+ /**
508
+ * GET /admin/apps/:appSlug/scheduled-jobs (#4006) — the jobs the crontabs manager holds for this application, each with
509
+ * the selector `wildo local jobs run` takes, beside the platform-wide total (an empty list beside a zero total says the
510
+ * scheduler holds nothing for anyone).
511
+ */
512
+ static listApplicationScheduledJobs(env: PlatformEnvironmentConfiguration, credentials: PlatformEnvSecretsJson, appSlug: string): Promise<ApplicationScheduledJobsResponse>;
513
+ /**
514
+ * POST /admin/apps/:appSlug/scheduled-jobs/run (#4006) — run one of the application's jobs now, once. Not re-sent on a
515
+ * failed answer as the signing-key doors are: a manual trigger carries no occurrence id the crontabs manager could
516
+ * deduplicate by, so a re-send whose first attempt landed would run the job twice. One residual, stated rather than
517
+ * hidden: `fetchWithReconnect` re-sends a request whose connection failed, and a connection that drops AFTER apps-manager
518
+ * forwarded the trigger is such a failure, so that rare case can run the job twice (each run is an audit row).
519
+ */
520
+ static runApplicationScheduledJob(env: PlatformEnvironmentConfiguration, credentials: PlatformEnvSecretsJson, appSlug: string, request: ApplicationScheduledJobRunRequest): Promise<ApplicationScheduledJobRunResponse>;
481
521
  /**
482
522
  * POST /admin/apps/:appSlug/deregister
483
523
  *
@@ -1 +1 @@
1
- {"version":3,"file":"app-bootstrap.service.d.ts","sourceRoot":"","sources":["../../../../src/services/application/app-bootstrap.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAmB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAOL,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAE/B,KAAK,mCAAmC,EAYxC,KAAK,mCAAmC,EACxC,KAAK,iCAAiC,EAItC,KAAK,oCAAoC,EACzC,KAAK,qCAAqC,EA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AO,CAAC,mCAAmC,EAAE,CAAC;IAiHlD;;;;;;;OAOG;IACH,MAAM,CAAC,kCAAkC,CAAC,KAAK,EAAE;QAC/C,GAAG,EAAE,gCAAgC,CAAC;QACtC,MAAM,EAAE,qBAAqB,CAAC;QAC9B,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,4BAA4B,EAAE;CAoBnC"}
1
+ {"version":3,"file":"app-bootstrap.service.d.ts","sourceRoot":"","sources":["../../../../src/services/application/app-bootstrap.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAmB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAOL,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAE/B,KAAK,mCAAmC,EAYxC,KAAK,mCAAmC,EACxC,KAAK,iCAAiC,EAItC,KAAK,oCAAoC,EACzC,KAAK,qCAAqC,EAC1C,KAAK,4BAA4B,EAQjC,KAAK,oCAAoC,EACzC,KAAK,0CAA0C,EAC/C,KAAK,6CAA6C,EAClD,KAAK,kCAAkC,EAGvC,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAMlB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,kCAAkC,EAWvC,KAAK,gCAAgC,EACrC,KAAK,iCAAiC,EACtC,KAAK,kCAAkC,EA2BvC,KAAK,2BAA2B,EAChC,cAAc,EAEd,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,kBAAkB,EACxB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAClG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AAE5G,OAAO,KAAK,EACV,2BAA2B,EAC3B,0BAA0B,EAC1B,mCAAmC,EACnC,4BAA4B,EAC5B,0B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CAAC;QACtC,QAAQ,CAAC,EAAE,6BAA6B,CAAC;KAC1C,GAAG,OAAO,CAAC,mCAAmC,EAAE,CAAC;IAiHlD;;;;;;;OAOG;IACH,MAAM,CAAC,kCAAkC,CAAC,KAAK,EAAE;QAC/C,GAAG,EAAE,gCAAgC,CAAC;QACtC,MAAM,EAAE,qBAAqB,CAAC;QAC9B,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,4BAA4B,EAAE;CAoBnC"}
@@ -2,7 +2,7 @@ import { devCompanionRuntimeEndpointKey } from '../../services/environment/platf
2
2
  import { existsSync, readFileSync } from 'fs';
3
3
  import { isAbsolute, join, relative, resolve } from 'path';
4
4
  import { WildoHeaderKeys } from '@wildo-ai/saas-models';
5
- import { buildAppBootstrapCredentialsResponse, APPS_MANAGER_ADMIN_SECRET_HEADER, APPS_MANAGER_API_PREFIX, AppFrontendType, PlatformDocumentationSiteEnvKeys, ApplicationCreationVerificationEnvKey, AdminAppInitializeRequestSchema, AdminAppInitializeResponseSchema, AdminAppReapplyDeclarationRequestSchema, AdminAppReapplyDeclarationResponseSchema, buildRegistryKeyRevokePath, buildAdminKeyringRotationPath, buildAdminApplicationSigningKeyRotationPath, buildAdminApplicationSigningKeysPath, buildAdminApplicationSigningKeyPromotePath, buildAdminApplicationSigningKeyStagePath, ApplicationSigningKeyPromoteRequestSchema, ApplicationSigningKeyStageRequestSchema, ApplicationSigningKeyRotationRequestSchema, ApplicationSigningKeyRotationResponseSchema, ApplicationSigningKeysStatusSchema, buildAdminApplicationLegacyEnvelopeKeyPath, buildAdminApplicationLegacyEnvelopeKeyRestorePath, buildAdminApplicationLegacyEnvelopeKeyRetirePath, ApplicationLegacyEnvelopeKeyResponseSchema, ApplicationLegacyEnvelopeKeyRestoreRequestSchema, ApplicationLegacyEnvelopeKeyRetirementRequestSchema, ApplicationLegacyEnvelopeKeyStatusSchema, KeyringRotationRequestSchema, KeyringRotationResponseSchema, REGISTRY_KEYS_ADMIN_PATH, RegistryKeyListResponseSchema, RegistryKeyMintRequestSchema, RegistryKeyMintResponseSchema, RegistryKeyRevokeRequestSchema, AppBootstrapCredentialsResponseSchema, buildAdminInitializeApplicationPath, buildAdminReapplyDeclarationPath, buildAdminDeregisterApplicationPath, buildAdminApplicationResiduePath, buildAdminRestoreApplicationPath, buildAppBootstrapCredentialsPath, buildLocalhostApplicationRuntimeEndpoints, selectPrimaryBackendService, buildK8sApplicationRuntimeEndpoints, buildComposeApplicationRuntimeEndpoints, buildK8sApplicationIngressRoutes, buildK8sInternalUrl, APP_RUNTIME_SUBDIR_NAMES, loadConfig, resolveAppLayout, WildoDeploymentRuntime, WildoLocationType, WORKSPACE_HOME_NAMES, WORKER_CONFIG_FILENAME, MINION_CONFIG_FILENAME, WildoWorkerConfigSchema, WildoMinionConfigSchema, ApplicationRuntimePrincipalKind, buildMinionRedisKeyPrefix, registerMinionLocalProviders, buildRuntimePrincipalKey, DEVELOPMENT_COMPANION_PRINCIPAL, enumerateRuntimePrincipalsWithBootstrapSecrets, runtimeEnvironmentHostsDevelopmentCompanion, DatabaseEngine, resolveApplicationDatabaseEngine, AppDatabaseSeedingPhase, AppDatabaseSeedingOutcome, } from '@wildo-ai/platform-config-lib';
5
+ import { buildAppBootstrapCredentialsResponse, APPS_MANAGER_ADMIN_SECRET_HEADER, APPS_MANAGER_API_PREFIX, AppFrontendType, PlatformDocumentationSiteEnvKeys, ApplicationCreationVerificationEnvKey, AdminAppInitializeRequestSchema, AdminAppInitializeResponseSchema, AdminAppReapplyDeclarationRequestSchema, AdminAppReapplyDeclarationResponseSchema, buildRegistryKeyRevokePath, buildAdminKeyringRotationPath, buildAdminApplicationSigningKeyRotationPath, buildAdminApplicationSigningKeysPath, buildAdminApplicationSigningKeyPromotePath, buildAdminApplicationSigningKeyStagePath, ApplicationSigningKeyPromoteRequestSchema, ApplicationSigningKeyStageRequestSchema, ApplicationSigningKeyRotationRequestSchema, ApplicationSigningKeyRotationResponseSchema, ApplicationSigningKeysStatusSchema, buildAdminApplicationLegacyEnvelopeKeyPath, buildAdminApplicationLegacyEnvelopeKeyRestorePath, buildAdminApplicationLegacyEnvelopeKeyRetirePath, ApplicationLegacyEnvelopeKeyResponseSchema, ApplicationLegacyEnvelopeKeyRestoreRequestSchema, ApplicationLegacyEnvelopeKeyRetirementRequestSchema, ApplicationLegacyEnvelopeKeyStatusSchema, KeyringRotationRequestSchema, KeyringRotationResponseSchema, REGISTRY_KEYS_ADMIN_PATH, RegistryKeyListResponseSchema, RegistryKeyMintRequestSchema, RegistryKeyMintResponseSchema, RegistryKeyRevokeRequestSchema, AppBootstrapCredentialsResponseSchema, buildAdminInitializeApplicationPath, buildAdminReapplyDeclarationPath, buildAdminDeregisterApplicationPath, buildAdminApplicationResiduePath, buildAdminApplicationScheduledJobsPath, buildAdminApplicationScheduledJobRunPath, ApplicationScheduledJobsResponseSchema, ApplicationScheduledJobRunRequestSchema, ApplicationScheduledJobRunResponseSchema, buildAdminRestoreApplicationPath, buildAppBootstrapCredentialsPath, buildLocalhostApplicationRuntimeEndpoints, selectPrimaryBackendService, buildK8sApplicationRuntimeEndpoints, buildComposeApplicationRuntimeEndpoints, buildK8sApplicationIngressRoutes, buildK8sInternalUrl, APP_RUNTIME_SUBDIR_NAMES, loadConfig, resolveAppLayout, WildoDeploymentRuntime, WildoLocationType, WORKSPACE_HOME_NAMES, WORKER_CONFIG_FILENAME, MINION_CONFIG_FILENAME, WildoWorkerConfigSchema, WildoMinionConfigSchema, ApplicationRuntimePrincipalKind, buildMinionRedisKeyPrefix, registerMinionLocalProviders, buildRuntimePrincipalKey, DEVELOPMENT_COMPANION_PRINCIPAL, enumerateRuntimePrincipalsWithBootstrapSecrets, runtimeEnvironmentHostsDevelopmentCompanion, DatabaseEngine, resolveApplicationDatabaseEngine, AppDatabaseSeedingPhase, AppDatabaseSeedingOutcome, } from '@wildo-ai/platform-config-lib';
6
6
  import { buildWorkerInternalUrl, buildWorkerLocalUrl } from '@wildo-ai/platform-core-shared';
7
7
  import { resolveApplicationBackingServiceAddressing } from '../../services/environment/application-backing-service-addressing.utils.js';
8
8
  import { ApplicationOperatorEnvFileDisposition } from '../../services/environment/env-configuration-generator.service.js';
@@ -12,6 +12,7 @@ import { ErrorUtils } from '../../infrastructure/errors/error.utils.js';
12
12
  import { EnvironmentUtils } from '../../services/environment/environment.service.js';
13
13
  import { AppRuntimeTargetsService } from './app-runtime-targets.service.js';
14
14
  import { applyAppSchemaMigrations, resolveAppMigrationsDirectory } from './app-schema-bootstrap.service.js';
15
+ import { applyTunnelToRuntimeEndpoints, readLiveApplicationTunnel } from './local-tunnel.service.js';
15
16
  /**
16
17
  * Budget for a LIGHT apps-manager call — a read, or an idempotent config re-source.
17
18
  *
@@ -245,6 +246,27 @@ export class AppBootstrapService {
245
246
  .filter(([, cdnConfig]) => cdnConfig.enabled)
246
247
  .map(([serviceKey]) => serviceKey));
247
248
  }
249
+ /**
250
+ * The runtime endpoints, and the same endpoints with a live local tunnel applied (#3907). Only a LOCAL environment can
251
+ * have a tunnel; a state file whose process is not running is ignored and named, so a crash or a reboot never leaves a
252
+ * dead issuer advertised. See `local-tunnel.service.ts`.
253
+ */
254
+ static buildRuntimeEndpointsWithTunnel(runtimeTarget, env) {
255
+ const base = AppBootstrapService.buildRuntimeEndpoints(runtimeTarget, env);
256
+ if (env.locationType === WildoLocationType.REMOTE)
257
+ return { runtimeEndpoints: base, companionRuntimeEndpoints: base };
258
+ const { live, staleReason } = readLiveApplicationTunnel(runtimeTarget.appRoot);
259
+ if (staleReason) {
260
+ // eslint-disable-next-line no-console
261
+ console.warn(` ! The local tunnel state is ignored: ${staleReason}. Run \`wildo local tunnel up\` or \`wildo local tunnel down\`.`);
262
+ }
263
+ const applied = applyTunnelToRuntimeEndpoints(base, live);
264
+ if (applied.skipped) {
265
+ // eslint-disable-next-line no-console
266
+ console.warn(` ! The local tunnel is not applied: ${applied.skipped}.`);
267
+ }
268
+ return { runtimeEndpoints: applied.endpoints, companionRuntimeEndpoints: base };
269
+ }
248
270
  static buildRuntimeEndpoints(runtimeTarget, env) {
249
271
  const primaryBackend = selectPrimaryBackendService(runtimeTarget.backendServices);
250
272
  const primaryBackendPort = primaryBackend?.defaultPort;
@@ -782,7 +804,7 @@ export class AppBootstrapService {
782
804
  degraded,
783
805
  declarationConvergedFields,
784
806
  bootstrapCredentials: bootstrapResponse.credentials,
785
- runtimeEndpoints: AppBootstrapService.buildRuntimeEndpoints(runtimeTarget, input.env),
807
+ ...AppBootstrapService.buildRuntimeEndpointsWithTunnel(runtimeTarget, input.env),
786
808
  runtimeEnvironment,
787
809
  runtimePrincipalCredentials,
788
810
  unresolvedPrincipals,
@@ -1229,6 +1251,29 @@ export class AppBootstrapService {
1229
1251
  static async inspectApplicationResidue(env, credentials, input) {
1230
1252
  return await AppBootstrapService.requestJson(env, credentials, buildAdminApplicationResiduePath(input.appSlug), { method: 'GET' });
1231
1253
  }
1254
+ /**
1255
+ * GET /admin/apps/:appSlug/scheduled-jobs (#4006) — the jobs the crontabs manager holds for this application, each with
1256
+ * the selector `wildo local jobs run` takes, beside the platform-wide total (an empty list beside a zero total says the
1257
+ * scheduler holds nothing for anyone).
1258
+ */
1259
+ static async listApplicationScheduledJobs(env, credentials, appSlug) {
1260
+ const response = await AppBootstrapService.requestJson(env, credentials, buildAdminApplicationScheduledJobsPath(appSlug), { method: 'GET' });
1261
+ return ApplicationScheduledJobsResponseSchema.parse(response);
1262
+ }
1263
+ /**
1264
+ * POST /admin/apps/:appSlug/scheduled-jobs/run (#4006) — run one of the application's jobs now, once. Not re-sent on a
1265
+ * failed answer as the signing-key doors are: a manual trigger carries no occurrence id the crontabs manager could
1266
+ * deduplicate by, so a re-send whose first attempt landed would run the job twice. One residual, stated rather than
1267
+ * hidden: `fetchWithReconnect` re-sends a request whose connection failed, and a connection that drops AFTER apps-manager
1268
+ * forwarded the trigger is such a failure, so that rare case can run the job twice (each run is an audit row).
1269
+ */
1270
+ static async runApplicationScheduledJob(env, credentials, appSlug, request) {
1271
+ const response = await AppBootstrapService.requestJson(env, credentials, buildAdminApplicationScheduledJobRunPath(appSlug), {
1272
+ method: 'POST',
1273
+ body: JSON.stringify(ApplicationScheduledJobRunRequestSchema.parse(request)),
1274
+ });
1275
+ return ApplicationScheduledJobRunResponseSchema.parse(response);
1276
+ }
1232
1277
  /**
1233
1278
  * POST /admin/apps/:appSlug/deregister
1234
1279
  *
@@ -1457,7 +1502,8 @@ export class AppBootstrapService {
1457
1502
  if (!prepared) {
1458
1503
  return [];
1459
1504
  }
1460
- const { runtimeTarget, runtimeEndpoints } = prepared;
1505
+ // The companion's endpoints never follow a local tunnel (#3907): a tunnel coming up must not restart it mid-run.
1506
+ const { runtimeTarget, companionRuntimeEndpoints: runtimeEndpoints } = prepared;
1461
1507
  // A companion runs on a development environment only (#2941): no other platform mints it a secret.
1462
1508
  if (!AppBootstrapService.hostsDevelopmentCompanion(runtimeTarget, prepared.runtimeEnvironment)) {
1463
1509
  return [];