@tomflow/proflow-dev-tunnel 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @tomflow/proflow-dev-tunnel
2
2
 
3
+ ## 0.1.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Add professional setup orchestration, Provider FAST/THINK input, recoverable managed Dev Tunnel provisioning, Browser installation guidance, and precise status diagnostics.
8
+
9
+ ## 0.1.16
10
+
11
+ ### Patch Changes
12
+
13
+ - Retire the obsolete Carrier package and Browser standalone management CLI, make Platform setup/status preserve owner and dependency semantics, and enforce read-only status observation across the final Real-3 deployment closeout.
14
+
3
15
  ## 0.1.15
4
16
 
5
17
  ### Patch Changes
@@ -1,9 +1,13 @@
1
1
  import { type ModuleCommandContext } from "@tomflow/proflow-module-contract";
2
2
  import { type DevTunnelAutomation, type DevTunnelRuntime } from "../src/resource-adapter.ts";
3
+ type SetupPhase = "PENDING_CREATED" | "PORT_READY" | "HOST_READY" | "READY";
3
4
  type SetupState = {
4
- contract: "proflow.dev-tunnel-setup.v1";
5
+ contract: "proflow.dev-tunnel-setup.v2";
5
6
  tunnelId: string;
6
- publicBaseUrl: string;
7
+ phase: SetupPhase;
8
+ gatewayPort?: number;
9
+ publicBaseUrl?: string;
10
+ cliPath?: string;
7
11
  };
8
12
  type RuntimeFactory = (input: {
9
13
  command?: string;
@@ -15,6 +19,7 @@ export declare function createDevTunnelBehaviorAdapter(dependencies?: {
15
19
  automation?: DevTunnelAutomation;
16
20
  createRuntime?: RuntimeFactory;
17
21
  verifyPublicBaseUrl?: (publicBaseUrl: string) => Promise<void>;
22
+ resolveCli?: (workspaceRoot: string) => Promise<string>;
18
23
  }): {
19
24
  readonly install: (context: ModuleCommandContext) => Promise<{
20
25
  result: {
@@ -22,7 +27,7 @@ export declare function createDevTunnelBehaviorAdapter(dependencies?: {
22
27
  readonly ok: true;
23
28
  readonly status: "SUCCEEDED";
24
29
  readonly moduleRef: "dev-tunnel";
25
- readonly moduleVersion: "0.1.15";
30
+ readonly moduleVersion: "0.1.17";
26
31
  };
27
32
  observedEffects: never[];
28
33
  }>;
@@ -32,14 +37,14 @@ export declare function createDevTunnelBehaviorAdapter(dependencies?: {
32
37
  readonly ok: true;
33
38
  readonly status: "SUCCEEDED";
34
39
  readonly moduleRef: "dev-tunnel";
35
- readonly moduleVersion: "0.1.15";
40
+ readonly moduleVersion: "0.1.17";
36
41
  };
37
42
  observedEffects: string[];
38
43
  } | {
39
44
  result: {
40
45
  contract: "deployment.result.v1";
41
46
  moduleRef: "dev-tunnel";
42
- moduleVersion: "0.1.15";
47
+ moduleVersion: "0.1.17";
43
48
  ok: false;
44
49
  status: "FAILED";
45
50
  error: {
@@ -56,7 +61,7 @@ export declare function createDevTunnelBehaviorAdapter(dependencies?: {
56
61
  ok: true;
57
62
  status: "SUCCEEDED";
58
63
  moduleRef: "dev-tunnel";
59
- moduleVersion: "0.1.15";
64
+ moduleVersion: "0.1.17";
60
65
  data: {
61
66
  setupStatus: "ACTION_REQUIRED" | "READY";
62
67
  runtimeStatus: "FAILED" | "RUNNING" | "STOPPED";
@@ -83,7 +88,7 @@ export declare function createDevTunnelBehaviorAdapter(dependencies?: {
83
88
  ok: true;
84
89
  status: "SUCCEEDED";
85
90
  moduleRef: "dev-tunnel";
86
- moduleVersion: "0.1.15";
91
+ moduleVersion: "0.1.17";
87
92
  data: {
88
93
  docs: string;
89
94
  };
@@ -94,7 +99,7 @@ export declare function createDevTunnelBehaviorAdapter(dependencies?: {
94
99
  result: {
95
100
  contract: "deployment.result.v1";
96
101
  moduleRef: "dev-tunnel";
97
- moduleVersion: "0.1.15";
102
+ moduleVersion: "0.1.17";
98
103
  ok: false;
99
104
  status: "FAILED";
100
105
  error: {
@@ -110,7 +115,7 @@ export declare function createDevTunnelBehaviorAdapter(dependencies?: {
110
115
  ok: true;
111
116
  status: "SUCCEEDED";
112
117
  moduleRef: "dev-tunnel";
113
- moduleVersion: "0.1.15";
118
+ moduleVersion: "0.1.17";
114
119
  data: import("../src/resource-adapter.ts").DevTunnelObservation;
115
120
  };
116
121
  observedEffects: string[];
@@ -121,14 +126,14 @@ export declare function createDevTunnelBehaviorAdapter(dependencies?: {
121
126
  readonly ok: true;
122
127
  readonly status: "SUCCEEDED";
123
128
  readonly moduleRef: "dev-tunnel";
124
- readonly moduleVersion: "0.1.15";
129
+ readonly moduleVersion: "0.1.17";
125
130
  };
126
131
  observedEffects: string[];
127
132
  } | {
128
133
  result: {
129
134
  contract: "deployment.result.v1";
130
135
  moduleRef: "dev-tunnel";
131
- moduleVersion: "0.1.15";
136
+ moduleVersion: "0.1.17";
132
137
  ok: false;
133
138
  status: "FAILED";
134
139
  error: {
@@ -143,7 +148,7 @@ export declare function createDevTunnelBehaviorAdapter(dependencies?: {
143
148
  result: {
144
149
  contract: "deployment.result.v1";
145
150
  moduleRef: "dev-tunnel";
146
- moduleVersion: "0.1.15";
151
+ moduleVersion: "0.1.17";
147
152
  ok: false;
148
153
  status: "FAILED";
149
154
  error: {
@@ -159,7 +164,7 @@ export declare function createDevTunnelBehaviorAdapter(dependencies?: {
159
164
  ok: true;
160
165
  status: "SUCCEEDED";
161
166
  moduleRef: "dev-tunnel";
162
- moduleVersion: "0.1.15";
167
+ moduleVersion: "0.1.17";
163
168
  data: SetupState;
164
169
  };
165
170
  observedEffects: string[];
@@ -172,7 +177,7 @@ export declare const behaviorAdapter: {
172
177
  readonly ok: true;
173
178
  readonly status: "SUCCEEDED";
174
179
  readonly moduleRef: "dev-tunnel";
175
- readonly moduleVersion: "0.1.15";
180
+ readonly moduleVersion: "0.1.17";
176
181
  };
177
182
  observedEffects: never[];
178
183
  }>;
@@ -182,14 +187,14 @@ export declare const behaviorAdapter: {
182
187
  readonly ok: true;
183
188
  readonly status: "SUCCEEDED";
184
189
  readonly moduleRef: "dev-tunnel";
185
- readonly moduleVersion: "0.1.15";
190
+ readonly moduleVersion: "0.1.17";
186
191
  };
187
192
  observedEffects: string[];
188
193
  } | {
189
194
  result: {
190
195
  contract: "deployment.result.v1";
191
196
  moduleRef: "dev-tunnel";
192
- moduleVersion: "0.1.15";
197
+ moduleVersion: "0.1.17";
193
198
  ok: false;
194
199
  status: "FAILED";
195
200
  error: {
@@ -206,7 +211,7 @@ export declare const behaviorAdapter: {
206
211
  ok: true;
207
212
  status: "SUCCEEDED";
208
213
  moduleRef: "dev-tunnel";
209
- moduleVersion: "0.1.15";
214
+ moduleVersion: "0.1.17";
210
215
  data: {
211
216
  setupStatus: "ACTION_REQUIRED" | "READY";
212
217
  runtimeStatus: "FAILED" | "RUNNING" | "STOPPED";
@@ -233,7 +238,7 @@ export declare const behaviorAdapter: {
233
238
  ok: true;
234
239
  status: "SUCCEEDED";
235
240
  moduleRef: "dev-tunnel";
236
- moduleVersion: "0.1.15";
241
+ moduleVersion: "0.1.17";
237
242
  data: {
238
243
  docs: string;
239
244
  };
@@ -244,7 +249,7 @@ export declare const behaviorAdapter: {
244
249
  result: {
245
250
  contract: "deployment.result.v1";
246
251
  moduleRef: "dev-tunnel";
247
- moduleVersion: "0.1.15";
252
+ moduleVersion: "0.1.17";
248
253
  ok: false;
249
254
  status: "FAILED";
250
255
  error: {
@@ -260,7 +265,7 @@ export declare const behaviorAdapter: {
260
265
  ok: true;
261
266
  status: "SUCCEEDED";
262
267
  moduleRef: "dev-tunnel";
263
- moduleVersion: "0.1.15";
268
+ moduleVersion: "0.1.17";
264
269
  data: import("../src/resource-adapter.ts").DevTunnelObservation;
265
270
  };
266
271
  observedEffects: string[];
@@ -271,14 +276,14 @@ export declare const behaviorAdapter: {
271
276
  readonly ok: true;
272
277
  readonly status: "SUCCEEDED";
273
278
  readonly moduleRef: "dev-tunnel";
274
- readonly moduleVersion: "0.1.15";
279
+ readonly moduleVersion: "0.1.17";
275
280
  };
276
281
  observedEffects: string[];
277
282
  } | {
278
283
  result: {
279
284
  contract: "deployment.result.v1";
280
285
  moduleRef: "dev-tunnel";
281
- moduleVersion: "0.1.15";
286
+ moduleVersion: "0.1.17";
282
287
  ok: false;
283
288
  status: "FAILED";
284
289
  error: {
@@ -293,7 +298,7 @@ export declare const behaviorAdapter: {
293
298
  result: {
294
299
  contract: "deployment.result.v1";
295
300
  moduleRef: "dev-tunnel";
296
- moduleVersion: "0.1.15";
301
+ moduleVersion: "0.1.17";
297
302
  ok: false;
298
303
  status: "FAILED";
299
304
  error: {
@@ -309,7 +314,7 @@ export declare const behaviorAdapter: {
309
314
  ok: true;
310
315
  status: "SUCCEEDED";
311
316
  moduleRef: "dev-tunnel";
312
- moduleVersion: "0.1.15";
317
+ moduleVersion: "0.1.17";
313
318
  data: SetupState;
314
319
  };
315
320
  observedEffects: string[];
@@ -1,6 +1,7 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
3
3
  import { join, resolve } from "node:path";
4
+ import { resolveDevTunnelCli } from "@tomflow/proflow-devtunnel-cli";
4
5
  import { readModuleSharedFacts, writeModuleSharedFacts, } from "@tomflow/proflow-module-contract";
5
6
  import { createDevTunnelAutomation, createDevTunnelRuntime, verifyProvisionedPublicBaseUrl, } from "../src/resource-adapter.js";
6
7
  import { descriptor } from "./descriptor.js";
@@ -18,15 +19,50 @@ const processFile = (context) => join(stateDir(context), "process.json");
18
19
  async function readState(context) {
19
20
  try {
20
21
  const raw = JSON.parse(await readFile(stateFile(context), "utf8"));
21
- if (raw.contract !== "proflow.dev-tunnel-setup.v1" ||
22
- typeof raw.tunnelId !== "string" ||
23
- !raw.tunnelId ||
24
- typeof raw.publicBaseUrl !== "string")
22
+ if (typeof raw.tunnelId !== "string" || !raw.tunnelId)
25
23
  return undefined;
26
- const url = new URL(raw.publicBaseUrl);
27
- if (url.protocol !== "https:")
24
+ if (raw.contract === "proflow.dev-tunnel-setup.v1" &&
25
+ typeof raw.publicBaseUrl === "string") {
26
+ const url = new URL(raw.publicBaseUrl);
27
+ if (url.protocol !== "https:")
28
+ return undefined;
29
+ return {
30
+ contract: "proflow.dev-tunnel-setup.v2",
31
+ tunnelId: raw.tunnelId,
32
+ phase: "READY",
33
+ publicBaseUrl: url.href,
34
+ };
35
+ }
36
+ if (raw.contract !== "proflow.dev-tunnel-setup.v2")
37
+ return undefined;
38
+ if (raw.phase !== "PENDING_CREATED" &&
39
+ raw.phase !== "PORT_READY" &&
40
+ raw.phase !== "HOST_READY" &&
41
+ raw.phase !== "READY")
28
42
  return undefined;
29
- return raw;
43
+ const gatewayPort = raw.gatewayPort;
44
+ if (gatewayPort !== undefined &&
45
+ (!Number.isInteger(gatewayPort) ||
46
+ Number(gatewayPort) < 1 ||
47
+ Number(gatewayPort) > 65_535))
48
+ return undefined;
49
+ const publicBaseUrl = raw.publicBaseUrl;
50
+ const cliPath = raw.cliPath;
51
+ if (raw.phase === "READY") {
52
+ if (typeof publicBaseUrl !== "string")
53
+ return undefined;
54
+ const url = new URL(publicBaseUrl);
55
+ if (url.protocol !== "https:")
56
+ return undefined;
57
+ }
58
+ return {
59
+ contract: "proflow.dev-tunnel-setup.v2",
60
+ tunnelId: raw.tunnelId,
61
+ phase: raw.phase,
62
+ ...(typeof gatewayPort === "number" ? { gatewayPort } : {}),
63
+ ...(typeof publicBaseUrl === "string" ? { publicBaseUrl } : {}),
64
+ ...(typeof cliPath === "string" ? { cliPath } : {}),
65
+ };
30
66
  }
31
67
  catch {
32
68
  return undefined;
@@ -41,6 +77,7 @@ async function writeState(context, state) {
41
77
  }
42
78
  function runtime(context, state) {
43
79
  return createDevTunnelRuntime({
80
+ ...(state?.cliPath ? { command: state.cliPath } : {}),
44
81
  ...(state
45
82
  ? { tunnelId: state.tunnelId, publicBaseUrl: state.publicBaseUrl }
46
83
  : {}),
@@ -51,7 +88,7 @@ const baseBehaviorAdapter = {
51
88
  install: async (context) => {
52
89
  await mkdir(stateDir(context), { recursive: true, mode: 0o700 });
53
90
  const state = await readState(context);
54
- if (state)
91
+ if (state?.phase === "READY" && state.publicBaseUrl)
55
92
  await writeModuleSharedFacts(context, descriptor.moduleRef, {
56
93
  tunnelId: state.tunnelId,
57
94
  publicBaseUrl: state.publicBaseUrl,
@@ -121,14 +158,12 @@ const baseBehaviorAdapter = {
121
158
  observedEffects: [],
122
159
  };
123
160
  }
124
- await writeModuleSharedFacts(context, descriptor.moduleRef, {
125
- tunnelId: state.tunnelId,
126
- publicBaseUrl: state.publicBaseUrl,
127
- });
128
161
  const rt = runtime(context, state);
129
162
  const login = await rt.loginStatus();
130
163
  const observed = await rt.status();
131
- const configured = state !== undefined && login === "LOGGED_IN";
164
+ const configured = state?.phase === "READY" &&
165
+ typeof state.publicBaseUrl === "string" &&
166
+ login === "LOGGED_IN";
132
167
  const runtimeStatus = observed.state === "RUNNING"
133
168
  ? "RUNNING"
134
169
  : observed.state === "STOPPED"
@@ -152,7 +187,9 @@ const baseBehaviorAdapter = {
152
187
  {
153
188
  scope: "SETUP",
154
189
  code: "TUNNEL_LOGIN_REQUIRED",
155
- message: "Dev Tunnel CLI 尚未登录或配置未保存",
190
+ message: state && state.phase !== "READY"
191
+ ? `远程连接配置已保存,当前阶段 ${state.phase};重新运行 Platform setup 将从此处恢复`
192
+ : "Dev Tunnel CLI 尚未登录或配置未保存",
156
193
  relatedModuleRefs: [],
157
194
  nextCommand: "platform setup --module dev-tunnel",
158
195
  },
@@ -188,7 +225,7 @@ const baseBehaviorAdapter = {
188
225
  }),
189
226
  start: async (context) => {
190
227
  const state = await readState(context);
191
- if (!state)
228
+ if (state?.phase !== "READY" || !state.publicBaseUrl)
192
229
  return {
193
230
  result: {
194
231
  ...base,
@@ -325,18 +362,23 @@ const setupFailed = (error) => ({
325
362
  observedEffects: [],
326
363
  });
327
364
  export function createDevTunnelBehaviorAdapter(dependencies) {
328
- const automation = dependencies?.automation ??
329
- createDevTunnelAutomation({ command: "devtunnel" });
330
365
  const createRuntime = dependencies?.createRuntime ?? createDevTunnelRuntime;
331
366
  const verifyPublicBaseUrl = dependencies?.verifyPublicBaseUrl ?? verifyProvisionedPublicBaseUrl;
332
367
  return {
333
368
  ...baseBehaviorAdapter,
334
369
  setup: async (context) => {
335
370
  try {
371
+ const previous = await readState(context);
372
+ const cliPath = previous?.cliPath ??
373
+ (dependencies?.automation
374
+ ? "devtunnel"
375
+ : await (dependencies?.resolveCli ??
376
+ (async (workspaceRoot) => (await resolveDevTunnelCli({ workspaceRoot })).command))(context.workspaceRoot));
377
+ const automation = dependencies?.automation ??
378
+ createDevTunnelAutomation({ command: cliPath });
336
379
  await mkdir(stateDir(context), { recursive: true, mode: 0o700 });
337
380
  const port = gatewayPort(await readModuleSharedFacts(context, "agent-gateway"));
338
381
  await automation.ensureLogin();
339
- const previous = await readState(context);
340
382
  let tunnelId;
341
383
  let safeToStartNewHost = false;
342
384
  const createAndVerifyTunnel = async () => {
@@ -344,6 +386,13 @@ export function createDevTunnelBehaviorAdapter(dependencies) {
344
386
  const created = await automation.inspectTunnel(createdTunnelId);
345
387
  if (created.state !== "EXISTS")
346
388
  throw new Error("new Dev Tunnel could not be verified by show --json");
389
+ await writeState(context, {
390
+ contract: "proflow.dev-tunnel-setup.v2",
391
+ tunnelId: createdTunnelId,
392
+ phase: "PENDING_CREATED",
393
+ gatewayPort: port,
394
+ cliPath,
395
+ });
347
396
  return createdTunnelId;
348
397
  };
349
398
  if (previous) {
@@ -364,6 +413,13 @@ export function createDevTunnelBehaviorAdapter(dependencies) {
364
413
  safeToStartNewHost = true;
365
414
  }
366
415
  await automation.ensurePort(tunnelId, port);
416
+ await writeState(context, {
417
+ contract: "proflow.dev-tunnel-setup.v2",
418
+ tunnelId,
419
+ phase: "PORT_READY",
420
+ gatewayPort: port,
421
+ cliPath,
422
+ });
367
423
  const host = createRuntime({
368
424
  tunnelId,
369
425
  processStateFile: processFile(context),
@@ -378,15 +434,25 @@ export function createDevTunnelBehaviorAdapter(dependencies) {
378
434
  throw new Error("Dev Tunnel host did not reach RUNNING");
379
435
  started = true;
380
436
  }
437
+ await writeState(context, {
438
+ contract: "proflow.dev-tunnel-setup.v2",
439
+ tunnelId,
440
+ phase: "HOST_READY",
441
+ gatewayPort: port,
442
+ cliPath,
443
+ });
381
444
  const publicBaseUrl = await automation.discoverPublicBaseUrl(tunnelId, port);
382
445
  const url = new URL(publicBaseUrl);
383
446
  if (url.protocol !== "https:")
384
447
  throw new Error("discovered publicBaseUrl must be HTTPS");
385
448
  await verifyPublicBaseUrl(url.href);
386
449
  const state = {
387
- contract: "proflow.dev-tunnel-setup.v1",
450
+ contract: "proflow.dev-tunnel-setup.v2",
388
451
  tunnelId,
452
+ phase: "READY",
453
+ gatewayPort: port,
389
454
  publicBaseUrl: url.href,
455
+ cliPath,
390
456
  };
391
457
  await writeState(context, state);
392
458
  await writeModuleSharedFacts(context, descriptor.moduleRef, {
@@ -3,7 +3,7 @@ export declare const descriptor: {
3
3
  readonly contractVersion: "1.0.0";
4
4
  readonly moduleRef: "dev-tunnel";
5
5
  readonly packageName: "@tomflow/proflow-dev-tunnel";
6
- readonly moduleVersion: "0.1.15";
6
+ readonly moduleVersion: "0.1.17";
7
7
  readonly kind: "external-resource";
8
8
  readonly templateVersion: "1.0.0";
9
9
  readonly platformCompatibility: ">=1.0.0 <2.0.0";
@@ -3,7 +3,7 @@ export const descriptor = {
3
3
  contractVersion: "1.0.0",
4
4
  moduleRef: "dev-tunnel",
5
5
  packageName: "@tomflow/proflow-dev-tunnel",
6
- moduleVersion: "0.1.15",
6
+ moduleVersion: "0.1.17",
7
7
  kind: "external-resource",
8
8
  templateVersion: "1.0.0",
9
9
  platformCompatibility: ">=1.0.0 <2.0.0",
@@ -94,6 +94,9 @@ function parsePorts(input) {
94
94
  if (Array.isArray(input))
95
95
  return z.array(tunnelPortSchema).parse(input);
96
96
  if (typeof input === "object" && input !== null) {
97
+ const warning = Reflect.get(input, "warning");
98
+ if (typeof warning === "string" && /\bno ports found\b/i.test(warning))
99
+ return [];
97
100
  const ports = Reflect.get(input, "ports");
98
101
  if (Array.isArray(ports))
99
102
  return z.array(tunnelPortSchema).parse(ports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/proflow-dev-tunnel",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,10 +23,11 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "zod": "4.1.12",
26
- "@tomflow/proflow-module-contract": "^0.1.13"
26
+ "@tomflow/proflow-module-contract": "^0.1.13",
27
+ "@tomflow/proflow-devtunnel-cli": "^0.1.0"
27
28
  },
28
29
  "devDependencies": {
29
- "@tomflow/proflow-deployment-conformance": "^0.1.11"
30
+ "@tomflow/proflow-deployment-conformance": "^0.1.13"
30
31
  },
31
32
  "description": "Governs the Microsoft Dev Tunnel public HTTPS ingress resource and its managed local host process.",
32
33
  "keywords": [
@@ -3,7 +3,7 @@
3
3
  "contractVersion": "1.0.0",
4
4
  "moduleRef": "dev-tunnel",
5
5
  "packageName": "@tomflow/proflow-dev-tunnel",
6
- "moduleVersion": "0.1.15",
6
+ "moduleVersion": "0.1.17",
7
7
  "kind": "external-resource",
8
8
  "templateVersion": "1.0.0",
9
9
  "platformCompatibility": ">=1.0.0 <2.0.0",