@masons/agent-network 0.4.25 → 0.5.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.
package/dist/channel.d.ts CHANGED
@@ -1,6 +1,14 @@
1
1
  import type { AgentNetworkAccount } from "./config-schema.js";
2
2
  /** Get the stored owner Passport address (first is_owner visit). */
3
3
  export declare function getOwnerPassportAddress(): string | null;
4
+ /**
5
+ * Consume the identity linking nudge flag. Destructive read — returns true
6
+ * at most once per detection cycle. Called by before_prompt_build on
7
+ * non-Passport owner turns to deliver the nudge where the action is relevant.
8
+ */
9
+ export declare function consumeIdentityLinkingNudge(): boolean;
10
+ /** Test-only: set the nudge flag without going through the detection path. */
11
+ export declare function _setNudgePendingForTesting(value: boolean): void;
4
12
  interface ChannelMeta {
5
13
  name: string;
6
14
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AA2B9D,oEAAoE;AACpE,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAEvD;AAUD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,oBAAoB,CAAC,CAAC;IAC9B,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAAC;IACvD,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;I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Manager } from "./conversation-manager.js";
6
6
  import { clearEnvironmentContext } from "./environment-context.js";
7
7
  import { extractHandleFromAddress } from "./handle-utils.js";
8
- import { ownerNotesQueue } from "./owner-notes.js";
9
8
  import { clearOwnerState, isOwnerAddress, markOwnerAddress, setCurrentTurnIsOwner, } from "./owner-session-state.js";
10
9
  import { setCurrentTurnSender } from "./turn-context.js";
11
10
  import { checkForUpdate } from "./update-check.js";
@@ -14,6 +13,13 @@ const dbg = createDebug("agent-network:channel");
14
13
  // Reset on startAccount(). isIdentityLinksConfigured() provides the
15
14
  // cross-restart idempotency (checks config file).
16
15
  let notificationAttempted = false;
16
+ // Identity linking nudge — set when the owner first visits via Passport and
17
+ // cross-channel linking is available. Delivered on the owner's next
18
+ // non-Passport turn (Telegram/Feishu) where the linking action is relevant.
19
+ // Separate from ownerNotesQueue to avoid the Passport drain deadlock (#1158):
20
+ // the queue drains on ALL owner turns (including Passport), but this nudge
21
+ // only fires on non-Passport owner turns.
22
+ let identityLinkingNudgePending = false;
17
23
  // Owner's Passport address: recorded on first is_owner MESSAGE_RECEIVED.
18
24
  // Used by masons_link_identity tool to auto-include the Passport entry.
19
25
  let storedOwnerPassportAddress = null;
@@ -21,6 +27,21 @@ let storedOwnerPassportAddress = null;
21
27
  export function getOwnerPassportAddress() {
22
28
  return storedOwnerPassportAddress;
23
29
  }
30
+ /**
31
+ * Consume the identity linking nudge flag. Destructive read — returns true
32
+ * at most once per detection cycle. Called by before_prompt_build on
33
+ * non-Passport owner turns to deliver the nudge where the action is relevant.
34
+ */
35
+ export function consumeIdentityLinkingNudge() {
36
+ if (!identityLinkingNudgePending)
37
+ return false;
38
+ identityLinkingNudgePending = false;
39
+ return true;
40
+ }
41
+ /** Test-only: set the nudge flag without going through the detection path. */
42
+ export function _setNudgePendingForTesting(value) {
43
+ identityLinkingNudgePending = value;
44
+ }
24
45
  // --- Sender identity ---
25
46
  /**
26
47
  * Extract a human-readable name from the sender's metadata.
@@ -98,24 +119,17 @@ async function handleAddressedMessage(event, conversationManager, client, ctx) {
98
119
  storedOwnerPassportAddress = fromAddress;
99
120
  dbg("recorded owner Passport address: %s", fromAddress);
100
121
  }
101
- // --- dmScope-aware notification (2026-03-26, #986 redesign) ---
102
- // Notify the owner about cross-channel identity linking availability.
103
- // Notification is:
104
- // - Skipped in "main" mode (linking has no effect — Gateway skips resolveLinkedPeerId)
105
- // - Skipped if identityLinks already configured (already linked)
106
- // - Sent once per startAccount lifecycle (in-memory idempotency)
107
- // Content is channel-agnostic and language-neutral (semantic event, not identity claim).
122
+ // --- dmScope-aware identity linking nudge (#986 redesign, #1158 fix) ---
123
+ // Detect that identity linking is available but not configured.
124
+ // Sets a flag (NOT enqueued into ownerNotesQueue) for delivery on the
125
+ // owner's next non-Passport turn, where the linking action is relevant.
126
+ // Separated from the queue to avoid the Passport drain deadlock (#1158).
108
127
  if (getDmScope() !== "main" &&
109
128
  !isIdentityLinksConfigured() &&
110
129
  !notificationAttempted) {
111
130
  notificationAttempted = true;
112
- ownerNotesQueue.enqueue({
113
- content: "Owner visited via Passport (verified). " +
114
- "Cross-channel identity linking is available but not configured. " +
115
- "The owner can link their identity across channels so conversations share context.",
116
- timestamp: Date.now(),
117
- });
118
- dbg("queued identity linking notification (dmScope=%s)", getDmScope());
131
+ identityLinkingNudgePending = true;
132
+ dbg("identity linking nudge pending (dmScope=%s)", getDmScope());
119
133
  }
120
134
  }
121
135
  setCurrentTurnIsOwner(isOwnerAddress(fromAddress));
@@ -294,6 +308,7 @@ export const agentNetworkChannel = {
294
308
  dbg("starting account %s", ctx.accountId);
295
309
  // Reset per-session state
296
310
  notificationAttempted = false;
311
+ identityLinkingNudgePending = false;
297
312
  storedOwnerPassportAddress = null;
298
313
  // Defensive: clear stale singletons from a previous cycle.
299
314
  // The abort handler intentionally leaves them alive for in-flight tool
@@ -1,13 +1,27 @@
1
1
  /**
2
- * CLI Setup Path — Device Code Flow via terminal prompts.
2
+ * CLI Setup Path — OAuth 2.0 Device Authorization Grant (RFC 8628).
3
3
  *
4
4
  * Implements `configureInteractive()` hook for OpenClaw's
5
5
  * `openclaw channels login --channel agent-network` command.
6
6
  *
7
- * Follows the WhatsApp channel pattern: CLI displays a code,
8
- * user authorizes in browser, credentials are returned to OpenClaw
9
- * which persists them to openclaw.json.
7
+ * Flow:
8
+ * 1. POST {idpBaseUrl}/api/auth/device/code with client_id + scope
9
+ * display user_code + verification_uri to the user
10
+ * 2. Poll {idpBaseUrl}/api/auth/device/token until access_token issued
11
+ * → handles `expired_token`, `authorization_pending`, `slow_down`
12
+ * 3. POST {apiHost}/runtime/v1/onboard with Bearer access_token
13
+ * → list / select existing agent / create new (terminal prompter)
14
+ * 4. Return credentials → OpenClaw CLI persists them to openclaw.json
10
15
  *
16
+ * Pre-migration this file existed as a `setup_codes`-based bespoke flow
17
+ * (deleted in fd5568e8). This re-implementation is purely standards-based:
18
+ * the IdP is Better Auth's `deviceAuthorization` plugin, which speaks
19
+ * RFC 8628; the onboard step is a thin MASONS-specific shim that exchanges
20
+ * the user-scope access_token for an agent-scope api_key.
21
+ *
22
+ * See #1264 for the design rationale (in particular the "single-driver
23
+ * Node semantic" — re-running this flow rotates the api_key and evicts
24
+ * any previously-connected Runtime).
11
25
  */
12
26
  interface Prompter {
13
27
  text(label: string, opts?: {
@@ -31,7 +45,9 @@ type SetupResult = "skip" | {
31
45
  /**
32
46
  * Interactive Device Code Flow for OpenClaw CLI.
33
47
  *
34
- * Called by `openclaw channels login --channel agent-network` or the onboarding wizard.
48
+ * Called by `openclaw channels login --channel agent-network` (wired via
49
+ * `setup: { configureInteractive }` on the channel registration in plugin.ts).
50
+ *
35
51
  * Returns `{ cfg, accountId }` — OpenClaw CLI handles writing to openclaw.json.
36
52
  */
37
53
  export declare function configureInteractive(ctx: ChannelSetupContext): Promise<SetupResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"cli-setup.d.ts","sourceRoot":"","sources":["../src/cli-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAkB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,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3D;AAED,UAAU,mBAAmB;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,KAAK,WAAW,GACZ,MAAM,GACN;IAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA0XzD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,mBAAmB,GACvB,OAAO,CAAC,WAAW,CAAC,CA+CtB"}
package/dist/cli-setup.js CHANGED
@@ -1,145 +1,325 @@
1
1
  /**
2
- * CLI Setup Path — Device Code Flow via terminal prompts.
2
+ * CLI Setup Path — OAuth 2.0 Device Authorization Grant (RFC 8628).
3
3
  *
4
4
  * Implements `configureInteractive()` hook for OpenClaw's
5
5
  * `openclaw channels login --channel agent-network` command.
6
6
  *
7
- * Follows the WhatsApp channel pattern: CLI displays a code,
8
- * user authorizes in browser, credentials are returned to OpenClaw
9
- * which persists them to openclaw.json.
7
+ * Flow:
8
+ * 1. POST {idpBaseUrl}/api/auth/device/code with client_id + scope
9
+ * display user_code + verification_uri to the user
10
+ * 2. Poll {idpBaseUrl}/api/auth/device/token until access_token issued
11
+ * → handles `expired_token`, `authorization_pending`, `slow_down`
12
+ * 3. POST {apiHost}/runtime/v1/onboard with Bearer access_token
13
+ * → list / select existing agent / create new (terminal prompter)
14
+ * 4. Return credentials → OpenClaw CLI persists them to openclaw.json
10
15
  *
16
+ * Pre-migration this file existed as a `setup_codes`-based bespoke flow
17
+ * (deleted in fd5568e8). This re-implementation is purely standards-based:
18
+ * the IdP is Better Auth's `deviceAuthorization` plugin, which speaks
19
+ * RFC 8628; the onboard step is a thin MASONS-specific shim that exchanges
20
+ * the user-scope access_token for an agent-scope api_key.
21
+ *
22
+ * See #1264 for the design rationale (in particular the "single-driver
23
+ * Node semantic" — re-running this flow rotates the api_key and evicts
24
+ * any previously-connected Runtime).
11
25
  */
12
- import { DEFAULT_API_HOST, initSetup, listAgents, onboard, PlatformApiError, pollSetup, reconnect, SetupExpiredError, SetupPendingError, } from "./platform-client.js";
26
+ import { DEFAULT_API_HOST, onboard, PlatformApiError, } from "./platform-client.js";
13
27
  // ---------------------------------------------------------------------------
14
28
  // Constants
15
29
  // ---------------------------------------------------------------------------
16
- const CREATE_NEW_OPTION = "Create new agent";
17
- // ---------------------------------------------------------------------------
18
- // Implementation
19
- // ---------------------------------------------------------------------------
20
30
  /**
21
- * Interactive Device Code Flow for OpenClaw CLI.
31
+ * Better Auth IdP base URL. Default targets the preview environment.
22
32
  *
23
- * Called by `openclaw channels login --channel agent-network` or the onboarding wizard.
24
- * Returns `{ cfg, accountId }` OpenClaw CLI handles writing to openclaw.json.
33
+ * TODO: flip to the production URL when W8 (api.masons.ai consolidation)
34
+ * lands. Plugins shipped with this default before that flip will still
35
+ * work — the user can override by setting `idpBaseUrl` in their
36
+ * `openclaw.json` channel config (or by re-running setup which writes
37
+ * whatever is current).
25
38
  */
26
- export async function configureInteractive(ctx) {
27
- const { prompter } = ctx;
28
- // Resolve API host from existing config or default
29
- const apiHost = typeof ctx.cfg.apiHost === "string" ? ctx.cfg.apiHost : DEFAULT_API_HOST;
30
- const cfg = { apiHost };
31
- // --- Phase 1: Device Code Flow (init + authorize + poll) ---
32
- const setupToken = await deviceCodeFlow(cfg, prompter);
33
- // --- Phase 2: Agent selection or creation ---
34
- const finalCreds = await agentSetup(cfg, setupToken, prompter);
35
- return buildResult(finalCreds.connectorUrl, finalCreds.token, apiHost);
39
+ const DEFAULT_IDP_BASE_URL = "https://preview.masons.ai";
40
+ /**
41
+ * OAuth client_id registered for OpenClaw at the IdP — see
42
+ * `apps/web/scripts/seed.ts`. Hardcoded because there's only one OpenClaw
43
+ * client today; if multiple wrappers (e.g. self-hosted vs Claude Desktop
44
+ * variant) ever need distinct client_ids, expose this via the channel
45
+ * config schema.
46
+ */
47
+ const OAUTH_CLIENT_ID = "openclaw";
48
+ /**
49
+ * Scopes requested at device-flow initiation. `openid` + `profile` + `email`
50
+ * are the standard OIDC scopes; `offline_access` requests a refresh token
51
+ * (Better Auth uses session tokens here, not OAuth opaque tokens — the
52
+ * scope is mostly indicative). Stays in sync with the scopes registered on
53
+ * the `oauthProvider` plugin at apps/web/lib/auth.ts.
54
+ */
55
+ const SCOPE = "openid profile email offline_access";
56
+ /** Default polling interval if the IdP does not return one. */
57
+ const DEFAULT_POLL_INTERVAL_S = 5;
58
+ const CREATE_NEW_OPTION = "Create new agent";
59
+ // Handle pre-validation regex — strict subset of the server's authoritative
60
+ // `validateHandle` (packages/db/src/utils/handle-validation.ts:3). Used to
61
+ // fail-fast in the terminal before round-tripping the server. Kept inline
62
+ // because the published npm plugin can't import @workspace/db.
63
+ //
64
+ // Server contract: `/^[a-z][a-z0-9_-]{2,14}$/` against the lowercased input.
65
+ // MUST be a strict subset (false-negatives OK, false-positives forbidden) —
66
+ // otherwise the user sees "passed client check" then "server rejected" for
67
+ // the same input, which is confusing.
68
+ //
69
+ // Reserved-handle check (e.g., "masons", "openclaw") is server-only — too
70
+ // volatile for the plugin to track; the round-trip is acceptable for that.
71
+ const HANDLE_REGEX = /^[a-z][a-z0-9_-]{2,14}$/;
72
+ class DeviceFlowError extends Error {
73
+ }
74
+ class DeviceFlowExpired extends Error {
36
75
  }
37
- // ---------------------------------------------------------------------------
38
- // Device Code Flow
39
- // ---------------------------------------------------------------------------
40
76
  /**
41
- * Run the Device Code Flow loop. Returns an authorized setup token.
42
- * Handles code expiration by restarting with a fresh init.
77
+ * Run the RFC 8628 device flow loop. Returns the access_token on success.
78
+ * On expiration, restarts the loop transparently (user gets a fresh code).
43
79
  */
44
- async function deviceCodeFlow(cfg, prompter) {
80
+ async function deviceCodeFlow(idpBaseUrl, prompter) {
45
81
  for (;;) {
46
- const initResult = await initSetup(cfg);
47
- // Display setup code and authorization link.
48
- // Uses prompter.text() as a "press Enter to continue" prompt —
49
- // OpenClaw's prompter has no display-only method, so text() with
50
- // discarded input is the established pattern (see WhatsApp channel).
82
+ const init = await initDeviceCode(idpBaseUrl);
51
83
  await prompter.text([
52
84
  "",
53
- `Setup code: ${initResult.setup_code}`,
85
+ `Setup code: ${init.user_code}`,
54
86
  "",
55
- `Open this link to authorize: ${initResult.verification_uri}`,
87
+ `Open this link to authorize: ${init.verification_uri_complete ?? `${init.verification_uri}?user_code=${init.user_code}`}`,
56
88
  "",
57
89
  "Press Enter after you've authorized in the browser",
58
90
  ].join("\n"));
59
- // Poll until authorized or expired
60
- const pollResult = await pollUntilAuthorized(cfg, initResult.setup_token, prompter);
61
- if (pollResult === "expired") {
62
- continue;
91
+ try {
92
+ const accessToken = await pollUntilAuthorized(idpBaseUrl, init.device_code, init.interval ?? DEFAULT_POLL_INTERVAL_S, prompter);
93
+ return accessToken;
94
+ }
95
+ catch (err) {
96
+ if (err instanceof DeviceFlowExpired) {
97
+ await prompter.text("Setup code expired. Press Enter for a new one.");
98
+ continue;
99
+ }
100
+ throw err;
63
101
  }
64
- return pollResult.setup_token;
65
102
  }
66
103
  }
67
- async function pollUntilAuthorized(cfg, setupToken, prompter) {
104
+ async function initDeviceCode(idpBaseUrl) {
105
+ const params = new URLSearchParams();
106
+ params.set("client_id", OAUTH_CLIENT_ID);
107
+ params.set("scope", SCOPE);
108
+ const res = await fetch(`${idpBaseUrl}/api/auth/device/code`, {
109
+ method: "POST",
110
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
111
+ body: params.toString(),
112
+ });
113
+ if (!res.ok) {
114
+ // 4xx at initiation → likely a misconfigured client_id or scope. Surface
115
+ // a clear message rather than retrying — this is a setup error, not a
116
+ // transient one.
117
+ const body = (await res.json().catch(() => ({})));
118
+ const code = typeof body.error === "string" ? body.error : "unknown";
119
+ const description = typeof body.error_description === "string"
120
+ ? body.error_description
121
+ : `IdP returned ${res.status}`;
122
+ throw new DeviceFlowError(`Device code initiation failed (${code}): ${description}. ` +
123
+ `Verify that "${OAUTH_CLIENT_ID}" is registered with the device_code grant ` +
124
+ `and is in the deviceAuthorization plugin's allowlist at the IdP.`);
125
+ }
126
+ return (await res.json());
127
+ }
128
+ async function pollUntilAuthorized(idpBaseUrl, deviceCode, intervalSeconds, prompter) {
129
+ let interval = intervalSeconds;
68
130
  for (;;) {
69
- try {
70
- const result = await pollSetup(cfg, setupToken);
71
- return result;
131
+ const params = new URLSearchParams();
132
+ params.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
133
+ params.set("device_code", deviceCode);
134
+ params.set("client_id", OAUTH_CLIENT_ID);
135
+ const res = await fetch(`${idpBaseUrl}/api/auth/device/token`, {
136
+ method: "POST",
137
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
138
+ body: params.toString(),
139
+ });
140
+ if (res.ok) {
141
+ const success = (await res.json());
142
+ return success.access_token;
72
143
  }
73
- catch (err) {
74
- if (err instanceof SetupExpiredError) {
75
- await prompter.text("Setup code expired. Press Enter to generate a new one.");
76
- return "expired";
77
- }
78
- if (err instanceof SetupPendingError) {
79
- const retry = await prompter.confirm("Not authorized yet. Have you entered the code in your browser?");
80
- if (!retry) {
81
- return "expired"; // User gave up treat as restart
82
- }
83
- continue;
144
+ const body = (await res.json().catch(() => ({})));
145
+ if (body.error === "authorization_pending") {
146
+ // User hasn't approved yet wait and ask if they want to continue.
147
+ const retry = await prompter.confirm("Not authorized yet. Have you entered the code in your browser?");
148
+ if (!retry) {
149
+ // User gave up on this code — same recovery as expiration: ask
150
+ // the outer loop to restart with a fresh code. Throwing
151
+ // DeviceFlowExpired (rather than a separate "abandoned" sentinel)
152
+ // is intentionalboth paths recover identically.
153
+ throw new DeviceFlowExpired();
84
154
  }
85
- throw err; // Unexpected error — propagate
155
+ await sleep(interval * 1000);
156
+ continue;
157
+ }
158
+ if (body.error === "slow_down") {
159
+ // RFC 8628 §3.5 — server requests we slow down. Bump interval +5s.
160
+ interval += 5;
161
+ await sleep(interval * 1000);
162
+ continue;
86
163
  }
164
+ if (body.error === "expired_token") {
165
+ throw new DeviceFlowExpired();
166
+ }
167
+ if (body.error === "access_denied") {
168
+ throw new DeviceFlowError("Authorization was denied. Re-run setup if this was a mistake.");
169
+ }
170
+ // Unknown error — bail with whatever we got from the server.
171
+ throw new DeviceFlowError(`Device token poll failed: ${body.error ?? "unknown"} ` +
172
+ `(${body.error_description ?? "no description"})`);
87
173
  }
88
174
  }
89
- async function agentSetup(cfg, setupToken, prompter) {
90
- const { agents } = await listAgents(cfg, setupToken);
91
- if (agents.length > 0) {
92
- // User has existing agents — let them choose or create new
175
+ function sleep(ms) {
176
+ return new Promise((resolve) => {
177
+ setTimeout(resolve, ms);
178
+ });
179
+ }
180
+ // ---------------------------------------------------------------------------
181
+ // Onboard (agent select / create)
182
+ // ---------------------------------------------------------------------------
183
+ async function agentSetup(apiHost, accessToken, prompter) {
184
+ const platformCfg = { apiHost };
185
+ // First call: empty body. The server's list mode is intentionally
186
+ // non-mutating — it returns 412 (no agents) or 422 (here are your agents,
187
+ // pick one). Rotation only happens on the explicit `{agentId}` call after
188
+ // the user picks. Even with a single agent, the picker shows so the user
189
+ // explicitly confirms before any existing Runtime is evicted.
190
+ const listResult = await onboard(platformCfg, accessToken, {});
191
+ if (listResult.kind === "ok") {
192
+ // List mode never returns 200 by contract. If a future server version
193
+ // changes that, surface explicitly rather than silently accepting a
194
+ // rotation the user didn't confirm.
195
+ throw new DeviceFlowError("Server returned an unexpected 200 from the list call — refusing " +
196
+ "to use it without explicit user selection. Please report this.");
197
+ }
198
+ if (listResult.data.code === "no_agents") {
199
+ // Zero agents — prompt for handle to create one.
200
+ return await createAgentLoop(platformCfg, accessToken, prompter);
201
+ }
202
+ if (listResult.data.code === "agent_required") {
203
+ // Show picker. Single-agent case still goes through the picker (one
204
+ // agent + "Create new" choice) so the user explicitly confirms which
205
+ // agent this Runtime is claiming. The selection triggers api_key
206
+ // rotation — see "single-driver Node semantic" in CHANGELOG.
207
+ const agents = listResult.data.agents;
93
208
  const choices = [
94
- ...agents.map((a) => `${a.handle} (${a.address})`),
209
+ ...agents.map((a) => a.name ? `@${a.handle} (${a.name})` : `@${a.handle}`),
95
210
  CREATE_NEW_OPTION,
96
211
  ];
97
- const selected = await prompter.select("You already have agent(s). Choose one to reconnect or create new:", choices);
98
- if (selected !== CREATE_NEW_OPTION) {
99
- // Find the selected agent and reconnect
100
- const idx = choices.indexOf(selected);
101
- const agent = agents[idx];
102
- if (agent) {
103
- const result = await reconnect(cfg, setupToken, agent.id);
104
- return { connectorUrl: result.connectorUrl, token: result.token };
105
- }
212
+ const promptLabel = agents.length === 1
213
+ ? "You have one agent. Confirm to claim it for this Runtime " +
214
+ "(its api_key will be rotated; any previously-connected Runtime " +
215
+ "for this agent will be disconnected):"
216
+ : "You have multiple agents. Pick one to claim for this Runtime " +
217
+ "(its api_key will be rotated; any previously-connected Runtime " +
218
+ "for the chosen agent will be disconnected):";
219
+ const selected = await prompter.select(promptLabel, choices);
220
+ if (selected === CREATE_NEW_OPTION) {
221
+ return await createAgentLoop(platformCfg, accessToken, prompter);
106
222
  }
223
+ const idx = choices.indexOf(selected);
224
+ const agent = agents[idx];
225
+ if (!agent) {
226
+ throw new DeviceFlowError("Picker returned an unrecognized choice. Please re-run setup.");
227
+ }
228
+ const selectResult = await onboard(platformCfg, accessToken, {
229
+ agentId: agent.id,
230
+ });
231
+ if (selectResult.kind !== "ok") {
232
+ throw new DeviceFlowError(`Agent selection failed: ${selectResult.data.code}`);
233
+ }
234
+ return selectResult.data;
107
235
  }
108
- // Create new agent
109
- return createAgent(cfg, setupToken, prompter);
236
+ // invalid_handle / handle_taken can only happen on a `create` call —
237
+ // not from an empty `{}` first call.
238
+ throw new DeviceFlowError(`Unexpected onboard error on initial list call: ${listResult.data.code}`);
110
239
  }
111
- async function createAgent(cfg, setupToken, prompter) {
240
+ async function createAgentLoop(platformCfg, accessToken, prompter) {
112
241
  for (;;) {
113
- const handle = await prompter.text("Choose a handle for your Agent (3-15 chars, lowercase letters, numbers, hyphens, underscores):");
114
- try {
115
- const result = await onboard(cfg, setupToken, { handle: handle.trim() });
116
- return { connectorUrl: result.connectorUrl, token: result.token };
242
+ const handle = await prompter.text("Choose a handle for your Agent (3-15 chars, start with a letter, then letters/numbers/hyphens/underscores):");
243
+ // Lowercase + trim mirrors the server's normalizeHandle step. If the user
244
+ // typed "Alice", we test "alice" against the regex — same outcome the
245
+ // server would produce. Prevents the false-negative case where a valid
246
+ // handle is rejected client-side just for case.
247
+ const normalized = handle.trim().toLowerCase();
248
+ // Client-side fail-fast — saves a server round-trip on obvious mistakes.
249
+ // Server's validateHandle is the authoritative source for both format
250
+ // and the reserved-handle list.
251
+ if (!HANDLE_REGEX.test(normalized)) {
252
+ await prompter.text(`"${handle}" must be 3-15 chars, start with a letter, then only letters/numbers/hyphens/underscores. Press Enter to try again.`);
253
+ continue;
117
254
  }
118
- catch (err) {
119
- if (err instanceof PlatformApiError) {
120
- if (err.code === "handle_taken") {
121
- await prompter.text(`"${handle}" is already taken. Press Enter to try another.`);
122
- continue;
123
- }
124
- if (err.code === "invalid_handle") {
125
- await prompter.text(`"${handle}" is not valid. Use 3-15 lowercase letters, numbers, hyphens, or underscores. Press Enter to try again.`);
126
- continue;
127
- }
128
- }
129
- throw err; // Unexpected error — propagate
255
+ const result = await onboard(platformCfg, accessToken, {
256
+ create: { handle: normalized },
257
+ });
258
+ if (result.kind === "ok") {
259
+ return result.data;
260
+ }
261
+ if (result.data.code === "handle_taken") {
262
+ await prompter.text(`"${normalized}" is already taken. Press Enter to try another.`);
263
+ continue;
130
264
  }
265
+ if (result.data.code === "invalid_handle") {
266
+ await prompter.text(`"${normalized}" failed server validation: ${result.data.message}. Press Enter to try again.`);
267
+ continue;
268
+ }
269
+ // Other structured errors shouldn't reach here on a create call —
270
+ // surface with whatever we got.
271
+ throw new DeviceFlowError(`Unexpected onboard error on create: ${result.data.code}`);
131
272
  }
132
273
  }
133
274
  // ---------------------------------------------------------------------------
134
- // Result builder
275
+ // Public hook
135
276
  // ---------------------------------------------------------------------------
136
- function buildResult(connectorUrl, token, apiHost) {
277
+ /**
278
+ * Interactive Device Code Flow for OpenClaw CLI.
279
+ *
280
+ * Called by `openclaw channels login --channel agent-network` (wired via
281
+ * `setup: { configureInteractive }` on the channel registration in plugin.ts).
282
+ *
283
+ * Returns `{ cfg, accountId }` — OpenClaw CLI handles writing to openclaw.json.
284
+ */
285
+ export async function configureInteractive(ctx) {
286
+ const { prompter } = ctx;
287
+ // Channel-level config (`cfg.apiHost`, `cfg.idpBaseUrl`) — both have
288
+ // defaults. Existing values from openclaw.json are preserved on re-run.
289
+ const apiHost = typeof ctx.cfg.apiHost === "string" ? ctx.cfg.apiHost : DEFAULT_API_HOST;
290
+ const idpBaseUrl = typeof ctx.cfg.idpBaseUrl === "string"
291
+ ? ctx.cfg.idpBaseUrl
292
+ : DEFAULT_IDP_BASE_URL;
293
+ let creds;
294
+ try {
295
+ const accessToken = await deviceCodeFlow(idpBaseUrl, prompter);
296
+ creds = await agentSetup(apiHost, accessToken, prompter);
297
+ }
298
+ catch (err) {
299
+ if (err instanceof DeviceFlowError) {
300
+ // Human-friendly surface — user reads this and re-runs setup.
301
+ await prompter.text(`${err.message}\n\nPress Enter to exit.`);
302
+ return "skip";
303
+ }
304
+ if (err instanceof PlatformApiError) {
305
+ await prompter.text(`Onboard failed (HTTP ${err.status} ${err.code}): ${err.message}. ` +
306
+ "Press Enter to exit.");
307
+ return "skip";
308
+ }
309
+ throw err;
310
+ }
311
+ // The openclaw.json schema for an account is { connectorUrl, token }
312
+ // (see config-schema.ts). On the wire the field is called `apiKey` to
313
+ // disambiguate from "session token" / "JWT" — but locally on disk it's
314
+ // persisted as `token` for backward compatibility with existing OpenClaw
315
+ // configs and the channel.resolveAccount() reader at channel.ts:485.
137
316
  return {
138
317
  cfg: {
139
318
  accounts: {
140
- default: { connectorUrl, token },
319
+ default: { connectorUrl: creds.connectorUrl, token: creds.apiKey },
141
320
  },
142
321
  apiHost,
322
+ idpBaseUrl,
143
323
  },
144
324
  accountId: "default",
145
325
  };
@@ -1 +1 @@
1
- {"version":3,"file":"connector-client.d.ts","sourceRoot":"","sources":["../src/connector-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,EAEL,KAAK,qBAAqB,EAI1B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAWxB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AAepB;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;gBACT,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM;CAMvD;AAID,KAAK,qBAAqB,GAAG;IAC3B,gBAAgB,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACzD,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,gBAAgB,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACxD,eAAe,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACtD,gBAAgB,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACxD,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,EAAE,MAAM,IAAI,CAAC;CA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