my-durable 0.0.5 → 0.0.6

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.
@@ -147,7 +147,27 @@ if (startup.kind === "welcome") {
147
147
  await start(device, client, info);
148
148
  } else {
149
149
  const known = registry.list().map((d) => d.id);
150
- if (!deviceRef) fail(`${USAGE}\n\nKnown devices: ${known.join(", ") || "none"}`);
150
+ if (!deviceRef && (values.pair !== undefined || values.hub !== undefined)) {
151
+ // Fresh-install flow: an explicit --pair (a pasted code, pair URL or offer link IS
152
+ // the whole configuration) must never die on usage text — pair this machine's LOCAL
153
+ // backend first, then the app opens on it. Mirrors the welcome screen's [p] action.
154
+ const { applyBackendEnv } = await import("./welcome.ts");
155
+ applyBackendEnv();
156
+ const { LocalPairing } = await import("./pairing.ts");
157
+ try {
158
+ LocalPairing.fromEnv();
159
+ } catch (e) {
160
+ fail((e as Error).message);
161
+ }
162
+ const port = Number(process.env.DPI_PORT ?? "4780");
163
+ const url = `http://127.0.0.1:${port}`;
164
+ const device: DeviceRef = { id: "local", name: "This machine", url, token: process.env.DPI_TOKEN ?? "" };
165
+ const client = new DpiClient(url, device.token);
166
+ const info = await client.device({ timeoutMs: 8000 }).catch((e: unknown) =>
167
+ fail(`no local dpi-backend on ${url} — start one with: dpi device (${(e as Error).message})`),
168
+ );
169
+ await start(device, client, info);
170
+ } else if (!deviceRef) fail(`${USAGE}\n\nKnown devices: ${known.join(", ") || "none"}`);
151
171
  const row = registry.get(deviceRef);
152
172
  if (!row) fail(`Unknown device "${deviceRef}". Known: ${known.join(", ") || "none (add one to dpi-network.yaml)"}`);
153
173
  if (!row.token) fail(`No token for ${row.id}. Run: just net register ${row.id}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-durable",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Durable Pi — the durable agent network: hub web UI, device backend daemon, TUI admin and the shared SDK, packaged as one runnable monorepo install",
5
5
  "license": "MIT",
6
6
  "repository": {