zk-agent-cli 0.1.0-rc.2 → 0.1.0-rc.3

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 (3) hide show
  1. package/README.md +81 -31
  2. package/dist/index.js +539 -75
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7823,7 +7823,7 @@ function appendPaymasterMode(command, paymasterMode) {
7823
7823
  function buildDefaultsRecommendedCommand() {
7824
7824
  return "zk-agent defaults";
7825
7825
  }
7826
- function buildSuiteRecommendedCommand(walletName = "main", chain = "zksync-sepolia") {
7826
+ function buildSuiteRecommendedCommand(walletName = "main", chain = "zksync-sepolia", options = {}) {
7827
7827
  const flags = [];
7828
7828
  if (walletName !== "main") {
7829
7829
  flags.push(`--wallet ${walletName}`);
@@ -7831,14 +7831,18 @@ function buildSuiteRecommendedCommand(walletName = "main", chain = "zksync-sepol
7831
7831
  if (chain !== "zksync-sepolia") {
7832
7832
  flags.push(`--chain ${chain}`);
7833
7833
  }
7834
+ if (options.includeOnboarding) {
7835
+ flags.push("--include-onboarding");
7836
+ }
7834
7837
  return flags.length > 0 ? `zk-agent suite ${flags.join(" ")}` : "zk-agent suite";
7835
7838
  }
7836
- function buildTopLevelNextRecommendedCommand(requestId, paymasterMode) {
7837
- const command = requestId ? `zk-agent next --request-id ${requestId}` : "zk-agent next";
7839
+ function buildTopLevelNextRecommendedCommand(requestId, paymasterMode, walletName = "main") {
7840
+ const command = requestId ? `zk-agent next --request-id ${requestId}` : walletName !== "main" ? `zk-agent next --wallet ${walletName}` : "zk-agent next";
7838
7841
  return appendPaymasterMode(command, paymasterMode);
7839
7842
  }
7840
- function buildWalletCreateRecommendedCommand(paymasterMode) {
7841
- return appendPaymasterMode("zk-agent wallet create --await-local", paymasterMode);
7843
+ function buildWalletCreateRecommendedCommand(paymasterMode, walletName = "main") {
7844
+ const command = walletName !== "main" ? `zk-agent wallet create --name ${walletName} --await-local` : "zk-agent wallet create --await-local";
7845
+ return appendPaymasterMode(command, paymasterMode);
7842
7846
  }
7843
7847
  function buildRelayInspectRecommendedCommand(relayUrl = "<url>") {
7844
7848
  return `zk-agent relay inspect --relay-url ${relayUrl}`;
@@ -10175,28 +10179,28 @@ function recommendedPathLines(paths) {
10175
10179
  ...paths.remoteBrowser?.length ? [["path (remote-browser)", formatRecommendedPath(paths.remoteBrowser)]] : []
10176
10180
  ];
10177
10181
  }
10178
- function buildSetupRecommendedPaths(relayUrl = "<url>", paymasterMode) {
10179
- const next = buildTopLevelNextRecommendedCommand(void 0, paymasterMode);
10182
+ function buildSetupRecommendedPaths(relayUrl = "<url>", paymasterMode, walletName = "main") {
10183
+ const next = buildTopLevelNextRecommendedCommand(void 0, paymasterMode, walletName);
10180
10184
  return {
10181
10185
  local: [
10182
10186
  "zk-agent setup",
10183
10187
  next,
10184
- buildWalletCreateRecommendedCommand(paymasterMode),
10188
+ buildWalletCreateRecommendedCommand(paymasterMode, walletName),
10185
10189
  next
10186
10190
  ],
10187
10191
  remoteBrowser: [
10188
10192
  "zk-agent setup",
10189
10193
  next,
10190
10194
  buildRelayInspectRecommendedCommand(relayUrl),
10191
- buildWalletCreateRemoteRecommendedCommand(relayUrl, paymasterMode),
10195
+ buildWalletCreateRemoteRecommendedCommand(relayUrl, paymasterMode, walletName),
10192
10196
  next
10193
10197
  ]
10194
10198
  };
10195
10199
  }
10196
10200
  function buildWalletBootstrapRecommendedPaths(relayUrl = "<url>", paymasterMode, walletName = "main") {
10197
- const next = buildTopLevelNextRecommendedCommand(void 0, paymasterMode);
10201
+ const next = buildTopLevelNextRecommendedCommand(void 0, paymasterMode, walletName);
10198
10202
  return {
10199
- local: [buildWalletCreateRecommendedCommand(paymasterMode), next],
10203
+ local: [buildWalletCreateRecommendedCommand(paymasterMode, walletName), next],
10200
10204
  remoteBrowser: [
10201
10205
  buildRelayInspectRecommendedCommand(relayUrl),
10202
10206
  buildWalletCreateRemoteRecommendedCommand(relayUrl, paymasterMode, walletName),
@@ -10205,7 +10209,7 @@ function buildWalletBootstrapRecommendedPaths(relayUrl = "<url>", paymasterMode,
10205
10209
  };
10206
10210
  }
10207
10211
  function buildWalletReapprovalRecommendedPaths(walletName, relayUrl = "<url>", paymasterMode) {
10208
- const next = buildTopLevelNextRecommendedCommand(void 0, paymasterMode);
10212
+ const next = buildTopLevelNextRecommendedCommand(void 0, paymasterMode, walletName);
10209
10213
  return {
10210
10214
  local: [buildWalletReapproveRecommendedCommand(walletName), next],
10211
10215
  remoteBrowser: [
@@ -10219,7 +10223,7 @@ function buildSignerRecoveryRecommendedPaths(walletName, paymasterMode) {
10219
10223
  return {
10220
10224
  local: [
10221
10225
  buildWalletSignerAttachRecommendedCommand(walletName),
10222
- buildTopLevelNextRecommendedCommand(void 0, paymasterMode)
10226
+ buildTopLevelNextRecommendedCommand(void 0, paymasterMode, walletName)
10223
10227
  ]
10224
10228
  };
10225
10229
  }
@@ -10698,11 +10702,139 @@ function agentProfileLines(summary) {
10698
10702
  return lines;
10699
10703
  }
10700
10704
 
10705
+ // src/lib/product-entry-summary.ts
10706
+ function buildProductEntrySummary(input) {
10707
+ const currentSurface = input.currentSurface ?? "next";
10708
+ switch (input.stage) {
10709
+ case "setup":
10710
+ return {
10711
+ view: "product-entry",
10712
+ currentSurface,
10713
+ stage: input.stage,
10714
+ category: "bootstrap",
10715
+ recommendedMode: "local-first",
10716
+ nextSurface: input.nextSurface ?? "setup",
10717
+ nextAction: input.nextAction ?? null,
10718
+ suiteAvailable: false,
10719
+ note: input.note ?? "Start with setup first. The operator path is still in first-run bootstrap."
10720
+ };
10721
+ case "wallet-bootstrap":
10722
+ return {
10723
+ view: "product-entry",
10724
+ currentSurface,
10725
+ stage: input.stage,
10726
+ category: "bootstrap",
10727
+ recommendedMode: "local-first",
10728
+ nextSurface: input.nextSurface ?? "wallet",
10729
+ nextAction: input.nextAction ?? null,
10730
+ suiteAvailable: false,
10731
+ note: input.note ?? "Local defaults exist, but wallet bootstrap is still the current product question."
10732
+ };
10733
+ case "wallet-recovery":
10734
+ return {
10735
+ view: "product-entry",
10736
+ currentSurface,
10737
+ stage: input.stage,
10738
+ category: "recover",
10739
+ recommendedMode: "local-first",
10740
+ nextSurface: input.nextSurface ?? "wallet",
10741
+ nextAction: input.nextAction ?? null,
10742
+ suiteAvailable: false,
10743
+ note: input.note ?? "Stay on wallet recovery until approval or local signer readiness stops being the blocker."
10744
+ };
10745
+ case "wallet-ready":
10746
+ return {
10747
+ view: "product-entry",
10748
+ currentSurface,
10749
+ stage: input.stage,
10750
+ category: "operate",
10751
+ recommendedMode: "local-first",
10752
+ nextSurface: input.nextSurface ?? (currentSurface === "doctor" ? "next" : "workflow"),
10753
+ nextAction: input.nextAction ?? null,
10754
+ suiteAvailable: input.suiteAvailable === true,
10755
+ note: input.note ?? (currentSurface === "doctor" ? "Local readiness is clear. Return to zk-agent next when you want the live operator path instead of a local-only diagnosis." : "The default product action is now the flagship workflow path. Switch to suite when the question becomes broader than one flagship pay step.")
10756
+ };
10757
+ case "workflow":
10758
+ return {
10759
+ view: "product-entry",
10760
+ currentSurface,
10761
+ stage: input.stage,
10762
+ category: "workflow",
10763
+ recommendedMode: "workflow-followup",
10764
+ nextSurface: input.nextSurface ?? "workflow",
10765
+ nextAction: input.nextAction ?? null,
10766
+ suiteAvailable: input.suiteAvailable === true,
10767
+ note: input.note ?? "A stored workflow checkpoint is now the active product context. Stay on workflow follow-up until the question is no longer workflow-specific."
10768
+ };
10769
+ default: {
10770
+ const exhaustive = input.stage;
10771
+ throw new Error(`Unsupported product entry stage: ${String(exhaustive)}`);
10772
+ }
10773
+ }
10774
+ }
10775
+ function productEntrySummaryLines(summary) {
10776
+ return [
10777
+ ["entry view", summary.view],
10778
+ ["entry category", summary.category],
10779
+ ["recommended mode", summary.recommendedMode],
10780
+ ["next surface", summary.nextSurface],
10781
+ ["suite available", summary.suiteAvailable ? "yes" : "no"],
10782
+ ["entry note", summary.note]
10783
+ ];
10784
+ }
10785
+
10701
10786
  // src/lib/suite-handoff.ts
10787
+ function buildSuiteHandoffJourney(journeyId, walletName) {
10788
+ switch (journeyId) {
10789
+ case "send-value-now":
10790
+ return {
10791
+ id: journeyId,
10792
+ title: "Send Value Now",
10793
+ command: buildWorkflowPayRecommendedCommand(walletName)
10794
+ };
10795
+ case "inspect-before-acting":
10796
+ return {
10797
+ id: journeyId,
10798
+ title: "Inspect Before Acting",
10799
+ command: buildAssetsRecommendedCommand(walletName)
10800
+ };
10801
+ case "unstick-a-write":
10802
+ return {
10803
+ id: journeyId,
10804
+ title: "Unstick a Write",
10805
+ command: buildWorkflowPayRecommendedCommand(walletName, "approval-based")
10806
+ };
10807
+ case "recover-remote-approval":
10808
+ return {
10809
+ id: journeyId,
10810
+ title: "Recover Remote Approval",
10811
+ command: buildRelayInspectRecommendedCommand("<url>")
10812
+ };
10813
+ case null:
10814
+ case void 0:
10815
+ return null;
10816
+ default: {
10817
+ const exhaustive = journeyId;
10818
+ throw new Error(`Unsupported suite handoff journey: ${String(exhaustive)}`);
10819
+ }
10820
+ }
10821
+ }
10702
10822
  function buildSuiteHandoffSummary(input) {
10823
+ const walletName = input.walletName?.trim() || "main";
10703
10824
  const command = buildSuiteRecommendedCommand(input.walletName, input.chain);
10704
- const useWhen = "Use suite once wallet approval and local signer readiness are no longer the blocker and you want one packaged surface for flagship pay plus the current post-flagship discovery, paymaster, and funding slices.";
10825
+ const recommendedJourney = input.recommendedNow === true ? buildSuiteHandoffJourney(input.recommendedJourneyId ?? null, walletName) : null;
10826
+ const useWhen = "Use suite once wallet approval and local signer readiness are no longer the blocker and you want one packaged surface for flagship pay plus the current post-flagship discovery, paymaster, funding, and hosted recovery slices.";
10705
10827
  switch (input.currentSurface) {
10828
+ case "doctor":
10829
+ return {
10830
+ currentSurface: input.currentSurface,
10831
+ recommendedNow: input.recommendedNow,
10832
+ command,
10833
+ useWhen,
10834
+ stayOnCurrentSurfaceWhen: "Stay on doctor when local config, approval metadata, or local signer state is still unclear and you need a local-only diagnosis before choosing the live path.",
10835
+ note: input.recommendedNow ? "Local readiness is clear. Return to zk-agent next for the shortest live path, or start with the suggested suite journey when the operator question is broader than one immediate flagship workflow step." : "Suite is not the current recommendation because doctor is still diagnosing a local setup or wallet-readiness blocker.",
10836
+ recommendedJourney
10837
+ };
10706
10838
  case "next":
10707
10839
  return {
10708
10840
  currentSurface: input.currentSurface,
@@ -10710,7 +10842,8 @@ function buildSuiteHandoffSummary(input) {
10710
10842
  command,
10711
10843
  useWhen,
10712
10844
  stayOnCurrentSurfaceWhen: "Stay on next when you still need the CLI to choose across setup, wallet readiness, and the shortest flagship workflow entry.",
10713
- note: input.recommendedNow ? "Wallet readiness is no longer the blocker. The default shortest action can still be workflow pay, while suite is the broader packaged follow-up surface." : "Suite is not the current recommendation because next is still steering setup or wallet remediation."
10845
+ note: input.recommendedNow ? "Wallet readiness is no longer the blocker. The default shortest action can still be workflow pay, while suite is the broader packaged follow-up surface. Start with the suggested suite journey when the question is broader than one immediate workflow pay step." : "Suite is not the current recommendation because next is still steering setup or wallet remediation.",
10846
+ recommendedJourney
10714
10847
  };
10715
10848
  case "wallet":
10716
10849
  return {
@@ -10719,7 +10852,8 @@ function buildSuiteHandoffSummary(input) {
10719
10852
  command,
10720
10853
  useWhen,
10721
10854
  stayOnCurrentSurfaceWhen: "Stay on wallet status or wallet next when approval, signer attach, deployment sync, or wallet-specific remediation is still the blocker.",
10722
- note: input.recommendedNow ? "Wallet readiness is no longer the blocker, so suite is available as the broader packaged surface." : "Suite is not the current recommendation because wallet-specific remediation is still the blocker."
10855
+ note: input.recommendedNow ? "Wallet readiness is no longer the blocker, so suite is available as the broader packaged surface. Start with the suggested suite journey when the operator question is broader than one wallet-status remediation step." : "Suite is not the current recommendation because wallet-specific remediation is still the blocker.",
10856
+ recommendedJourney
10723
10857
  };
10724
10858
  case "workflow":
10725
10859
  return {
@@ -10728,7 +10862,8 @@ function buildSuiteHandoffSummary(input) {
10728
10862
  command,
10729
10863
  useWhen,
10730
10864
  stayOnCurrentSurfaceWhen: "Stay on workflow when you already have an explicit workflow question, checkpoint, or execution state to inspect, continue, or resume.",
10731
- note: "This workflow surface stays authoritative for the current workflow. Switch to suite only after the question is no longer workflow-specific."
10865
+ note: "This workflow surface stays authoritative for the current workflow. Switch to suite only after the question is no longer workflow-specific.",
10866
+ recommendedJourney
10732
10867
  };
10733
10868
  default: {
10734
10869
  const exhaustive = input.currentSurface;
@@ -10741,6 +10876,13 @@ function suiteHandoffLines(summary) {
10741
10876
  ["suite", summary.command],
10742
10877
  ["suite ready", summary.recommendedNow ? "yes" : "no"],
10743
10878
  ["suite when", summary.useWhen],
10879
+ ...summary.recommendedJourney ? [
10880
+ [
10881
+ "suite journey",
10882
+ `${summary.recommendedJourney.id} (${summary.recommendedJourney.title})`
10883
+ ],
10884
+ ["suite journey start", summary.recommendedJourney.command]
10885
+ ] : [],
10744
10886
  [`stay on ${summary.currentSurface} when`, summary.stayOnCurrentSurfaceWhen],
10745
10887
  ["suite note", summary.note]
10746
10888
  ];
@@ -10866,8 +11008,8 @@ function resolveNextCommandDeps(deps) {
10866
11008
  function buildSetupCommand() {
10867
11009
  return "zk-agent setup";
10868
11010
  }
10869
- function buildTopLevelNextRecommendedCommand2(requestId) {
10870
- return requestId ? `zk-agent next --request-id ${requestId}` : "zk-agent next";
11011
+ function buildTopLevelNextRecommendedCommand2(requestId, walletName = "main") {
11012
+ return requestId ? `zk-agent next --request-id ${requestId}` : walletName !== "main" ? `zk-agent next --wallet ${walletName}` : "zk-agent next";
10871
11013
  }
10872
11014
  function buildTopLevelWorkflowSummary(result, nextCommand) {
10873
11015
  return {
@@ -10888,10 +11030,11 @@ function appendPaymasterMode2(command, paymasterMode) {
10888
11030
  if (!paymasterMode) return command;
10889
11031
  return `${command} --paymaster-mode ${paymasterMode}`;
10890
11032
  }
10891
- function topLevelNextLines(scope, lines, onboardingSummary) {
11033
+ function topLevelNextLines(scope, lines, onboardingSummary, productEntrySummary) {
10892
11034
  return [
10893
11035
  ["scope", scope],
10894
11036
  ...onboardingSummary ? onboardingSummaryLines(onboardingSummary) : [],
11037
+ ...productEntrySummary ? productEntrySummaryLines(productEntrySummary) : [],
10895
11038
  ...lines
10896
11039
  ];
10897
11040
  }
@@ -10901,6 +11044,13 @@ function buildNextHelpText() {
10901
11044
  "Use `next` as the product entrypoint:",
10902
11045
  " Stay on `next` until it points you at a wallet-specific or workflow-specific blocker.",
10903
11046
  "",
11047
+ " What `next` answers right now:",
11048
+ " bootstrap: config or wallet bootstrap is still the current blocker",
11049
+ " recover: wallet approval or local signer readiness still needs repair",
11050
+ " operate: wallet readiness is clear, so the flagship workflow path is next",
11051
+ " workflow: a stored checkpoint is already the active question",
11052
+ " suite: switch only when the question becomes broader than one immediate next step",
11053
+ "",
10904
11054
  " Fresh local-first routing:",
10905
11055
  " zk-agent setup",
10906
11056
  " zk-agent next",
@@ -10999,6 +11149,11 @@ function createNextCommand(deps) {
10999
11149
  walletName: wallet2.walletName,
11000
11150
  walletExists: true
11001
11151
  });
11152
+ const productEntrySummary2 = buildProductEntrySummary({
11153
+ stage: "workflow",
11154
+ nextAction: nextCommand2,
11155
+ suiteAvailable: false
11156
+ });
11002
11157
  printResult(
11003
11158
  topLevelNextLines("workflow", [
11004
11159
  ["workflow request", requestId],
@@ -11017,7 +11172,7 @@ function createNextCommand(deps) {
11017
11172
  ["funding txHash", result.fundingProgress.txHash],
11018
11173
  ["funding status", result.fundingProgress.status]
11019
11174
  ] : []
11020
- ]),
11175
+ ], void 0, productEntrySummary2),
11021
11176
  {
11022
11177
  ok: true,
11023
11178
  scope: "workflow",
@@ -11025,6 +11180,7 @@ function createNextCommand(deps) {
11025
11180
  workflowRequestId: requestId,
11026
11181
  walletName: wallet2.walletName,
11027
11182
  nextCommand: nextCommand2,
11183
+ productEntrySummary: productEntrySummary2,
11028
11184
  agentProfile: workflowAgentProfile,
11029
11185
  agentFollowup: agentFollowup2,
11030
11186
  summary: buildTopLevelWorkflowSummary(result, nextCommand2),
@@ -11041,10 +11197,10 @@ function createNextCommand(deps) {
11041
11197
  if (!config) {
11042
11198
  const recommendedCommands2 = {
11043
11199
  setup: buildSetupCommand(),
11044
- afterSetup: buildTopLevelNextRecommendedCommand2(),
11200
+ afterSetup: buildTopLevelNextRecommendedCommand2(void 0, walletName),
11045
11201
  inspectDefaults: buildDefaultsRecommendedCommand()
11046
11202
  };
11047
- const recommendedPaths2 = buildSetupRecommendedPaths("<url>", paymasterMode);
11203
+ const recommendedPaths2 = buildSetupRecommendedPaths("<url>", paymasterMode, walletName);
11048
11204
  const onboardingSummary2 = buildOnboardingSummary({
11049
11205
  stage: "setup",
11050
11206
  localOnly: true,
@@ -11056,6 +11212,10 @@ function createNextCommand(deps) {
11056
11212
  "This scope is local-only and does not require live RPC reads."
11057
11213
  ]
11058
11214
  });
11215
+ const productEntrySummary2 = buildProductEntrySummary({
11216
+ stage: "setup",
11217
+ nextAction: recommendedCommands2.setup
11218
+ });
11059
11219
  printResult(
11060
11220
  topLevelNextLines("setup", [
11061
11221
  ["status", "No local config found"],
@@ -11065,12 +11225,13 @@ function createNextCommand(deps) {
11065
11225
  ["next", recommendedCommands2.setup],
11066
11226
  ["after setup", recommendedCommands2.afterSetup],
11067
11227
  ["inspect defaults", recommendedCommands2.inspectDefaults]
11068
- ], onboardingSummary2),
11228
+ ], onboardingSummary2, productEntrySummary2),
11069
11229
  {
11070
11230
  ok: true,
11071
11231
  scope: "setup",
11072
11232
  status: "action-required",
11073
11233
  nextCommand: recommendedCommands2.setup,
11234
+ productEntrySummary: productEntrySummary2,
11074
11235
  onboardingSummary: onboardingSummary2,
11075
11236
  recommendedPaths: recommendedPaths2,
11076
11237
  agentProfile,
@@ -11084,15 +11245,19 @@ function createNextCommand(deps) {
11084
11245
  if (!wallet) {
11085
11246
  const recommendedCommands2 = {
11086
11247
  createWallet: appendPaymasterMode2(
11087
- buildWalletCreateRecommendedCommand(),
11248
+ buildWalletCreateRecommendedCommand(void 0, walletName),
11088
11249
  paymasterMode
11089
11250
  ),
11090
11251
  relayInspect: buildRelayInspectRecommendedCommand(),
11091
11252
  createWalletRemote: buildWalletCreateRemoteRecommendedCommand(
11092
11253
  "<url>",
11254
+ paymasterMode,
11255
+ walletName
11256
+ ),
11257
+ afterApproval: appendPaymasterMode2(
11258
+ buildTopLevelNextRecommendedCommand2(void 0, walletName),
11093
11259
  paymasterMode
11094
11260
  ),
11095
- afterApproval: appendPaymasterMode2(buildTopLevelNextRecommendedCommand2(), paymasterMode),
11096
11261
  inspectDefaults: buildDefaultsRecommendedCommand()
11097
11262
  };
11098
11263
  const recommendedPaths2 = buildWalletBootstrapRecommendedPaths(
@@ -11113,6 +11278,10 @@ function createNextCommand(deps) {
11113
11278
  "Use the remote approval fallback only when the browser is not colocated with this terminal."
11114
11279
  ]
11115
11280
  });
11281
+ const productEntrySummary2 = buildProductEntrySummary({
11282
+ stage: "wallet-bootstrap",
11283
+ nextAction: recommendedCommands2.createWallet
11284
+ });
11116
11285
  printResult(
11117
11286
  topLevelNextLines("wallet-bootstrap", [
11118
11287
  ["status", `Wallet not found: ${walletName}`],
@@ -11126,13 +11295,14 @@ function createNextCommand(deps) {
11126
11295
  ["remote fallback", recommendedCommands2.createWalletRemote],
11127
11296
  ["after approval", recommendedCommands2.afterApproval],
11128
11297
  ["inspect defaults", recommendedCommands2.inspectDefaults]
11129
- ], onboardingSummary2),
11298
+ ], onboardingSummary2, productEntrySummary2),
11130
11299
  {
11131
11300
  ok: true,
11132
11301
  scope: "wallet-bootstrap",
11133
11302
  walletName,
11134
11303
  config,
11135
11304
  nextCommand: recommendedCommands2.createWallet,
11305
+ productEntrySummary: productEntrySummary2,
11136
11306
  onboardingSummary: onboardingSummary2,
11137
11307
  recommendedPaths: recommendedPaths2,
11138
11308
  agentProfile,
@@ -11216,11 +11386,14 @@ function createNextCommand(deps) {
11216
11386
  reapprove: buildWalletReapproveRecommendedCommand(wallet.walletName),
11217
11387
  relayInspect: buildRelayInspectRecommendedCommand(),
11218
11388
  reapproveRemote: buildWalletReapproveRemoteRecommendedCommand(wallet.walletName),
11219
- afterRecovery: appendPaymasterMode2(buildTopLevelNextRecommendedCommand2(), paymasterMode)
11389
+ afterRecovery: appendPaymasterMode2(
11390
+ buildTopLevelNextRecommendedCommand2(void 0, wallet.walletName),
11391
+ paymasterMode
11392
+ )
11220
11393
  } : !inspection.localExecutionKeyStored ? {
11221
11394
  attachSigner: buildWalletSignerAttachRecommendedCommand(wallet.walletName),
11222
11395
  afterRecovery: appendPaymasterMode2(
11223
- buildTopLevelNextRecommendedCommand2(),
11396
+ buildTopLevelNextRecommendedCommand2(void 0, wallet.walletName),
11224
11397
  paymasterMode
11225
11398
  )
11226
11399
  } : {};
@@ -11242,7 +11415,13 @@ function createNextCommand(deps) {
11242
11415
  currentSurface: "next",
11243
11416
  recommendedNow: summary.status === "ready",
11244
11417
  walletName: wallet.walletName,
11245
- chain: wallet.chain
11418
+ chain: wallet.chain,
11419
+ recommendedJourneyId: summary.status === "ready" ? "send-value-now" : null
11420
+ });
11421
+ const productEntrySummary = buildProductEntrySummary({
11422
+ stage: onboardingSummary.stage,
11423
+ nextAction: nextCommand,
11424
+ suiteAvailable: summary.status === "ready"
11246
11425
  });
11247
11426
  printResult(
11248
11427
  topLevelNextLines("wallet", [
@@ -11263,11 +11442,12 @@ function createNextCommand(deps) {
11263
11442
  ...mergedRecommendedCommands.inspectPaymasterToken ? [["inspect paymaster token", mergedRecommendedCommands.inspectPaymasterToken]] : [],
11264
11443
  ["inspect token", mergedRecommendedCommands.inspectToken],
11265
11444
  ["inspect defaults", mergedRecommendedCommands.inspectDefaults]
11266
- ], onboardingSummary),
11445
+ ], onboardingSummary, productEntrySummary),
11267
11446
  {
11268
11447
  ok: true,
11269
11448
  scope: "wallet",
11270
11449
  walletName: wallet.walletName,
11450
+ productEntrySummary,
11271
11451
  onboardingSummary,
11272
11452
  recommendedPaths,
11273
11453
  agentProfile,
@@ -11299,10 +11479,18 @@ function buildDoctorHelpText() {
11299
11479
  " zk-agent doctor --wallet main",
11300
11480
  " zk-agent doctor --wallet main --relay-url https://relay.example.com",
11301
11481
  "",
11482
+ " What `doctor` answers right now:",
11483
+ " bootstrap: local config or wallet bootstrap is still missing",
11484
+ " recover: local approval or signer state still needs repair",
11485
+ " operate: local readiness is clear, so return to `zk-agent next` for the live path",
11486
+ " suite: once readiness is clear, the broader packaged post-flagship surface is available too",
11487
+ "",
11302
11488
  "Default behavior:",
11303
11489
  " Inspects saved config, local wallet approval metadata, local signer state,",
11304
11490
  " and the shortest next command without requiring live RPC reads.",
11305
11491
  " Run this before guessing whether the blocker is setup, wallet approval, or local signer state.",
11492
+ " When doctor shows local readiness is clear and the question is broader than one next step:",
11493
+ " zk-agent suite",
11306
11494
  "",
11307
11495
  "Remote-browser variant:",
11308
11496
  " Pass --relay-url when you want the remote approval fallback commands",
@@ -11328,25 +11516,25 @@ function summarizeLocalWalletState(wallet) {
11328
11516
  signerSource: wallet.localExecutionAuthority?.source || (wallet.sessionPayload?.sessionPrivateKey ? "legacy-session-payload" : null)
11329
11517
  };
11330
11518
  }
11331
- function buildSetupRecommendedCommands() {
11519
+ function buildSetupRecommendedCommands(walletName) {
11332
11520
  return {
11333
11521
  setup: "zk-agent setup",
11334
- next: buildTopLevelNextRecommendedCommand(),
11522
+ next: buildTopLevelNextRecommendedCommand(void 0, void 0, walletName),
11335
11523
  inspectDefaults: buildDefaultsRecommendedCommand()
11336
11524
  };
11337
11525
  }
11338
11526
  function buildWalletBootstrapRecommendedCommands(walletName, relayUrl) {
11339
11527
  return {
11340
- next: buildTopLevelNextRecommendedCommand(),
11528
+ next: buildTopLevelNextRecommendedCommand(void 0, void 0, walletName),
11341
11529
  inspectDefaults: buildDefaultsRecommendedCommand(),
11342
- createWallet: buildWalletCreateRecommendedCommand(),
11530
+ createWallet: buildWalletCreateRecommendedCommand(void 0, walletName),
11343
11531
  relayInspect: buildRelayInspectRecommendedCommand(relayUrl),
11344
11532
  createWalletRemote: buildWalletCreateRemoteRecommendedCommand(relayUrl, void 0, walletName)
11345
11533
  };
11346
11534
  }
11347
11535
  function buildWalletRecoveryRecommendedCommands(wallet, relayUrl) {
11348
11536
  const shared = {
11349
- next: buildTopLevelNextRecommendedCommand(),
11537
+ next: buildTopLevelNextRecommendedCommand(void 0, void 0, wallet.walletName),
11350
11538
  walletStatus: buildWalletStatusRecommendedCommand(wallet.walletName),
11351
11539
  walletNext: buildWalletNextRecommendedCommand(wallet.walletName),
11352
11540
  signerShow: buildWalletSignerShowRecommendedCommand(wallet.walletName),
@@ -11367,7 +11555,8 @@ function buildWalletRecoveryRecommendedCommands(wallet, relayUrl) {
11367
11555
  }
11368
11556
  function buildWalletReadyRecommendedCommands(wallet) {
11369
11557
  return {
11370
- next: buildTopLevelNextRecommendedCommand(),
11558
+ next: buildTopLevelNextRecommendedCommand(void 0, void 0, wallet.walletName),
11559
+ suite: buildSuiteRecommendedCommand(wallet.walletName, wallet.chain),
11371
11560
  walletStatus: buildWalletStatusRecommendedCommand(wallet.walletName),
11372
11561
  walletNext: buildWalletNextRecommendedCommand(wallet.walletName),
11373
11562
  workflowPay: buildWorkflowPayRecommendedCommand(wallet.walletName),
@@ -11376,7 +11565,7 @@ function buildWalletReadyRecommendedCommands(wallet) {
11376
11565
  }
11377
11566
  function buildDoctorResult(options) {
11378
11567
  if (!options.config) {
11379
- const recommendedCommands2 = buildSetupRecommendedCommands();
11568
+ const recommendedCommands2 = buildSetupRecommendedCommands(options.walletName);
11380
11569
  const onboardingSummary2 = buildOnboardingSummary({
11381
11570
  stage: "setup",
11382
11571
  localOnly: true,
@@ -11391,10 +11580,16 @@ function buildDoctorResult(options) {
11391
11580
  "Doctor is local-only by default and does not require live RPC reads."
11392
11581
  ]
11393
11582
  });
11583
+ const productEntrySummary2 = buildProductEntrySummary({
11584
+ currentSurface: "doctor",
11585
+ stage: "setup",
11586
+ nextAction: recommendedCommands2.setup
11587
+ });
11394
11588
  return {
11395
11589
  scope: "setup",
11396
11590
  nextAction: recommendedCommands2.setup,
11397
- recommendedPaths: buildSetupRecommendedPaths(options.relayUrl),
11591
+ recommendedPaths: buildSetupRecommendedPaths(options.relayUrl, void 0, options.walletName),
11592
+ productEntrySummary: productEntrySummary2,
11398
11593
  onboardingSummary: onboardingSummary2,
11399
11594
  summary: {
11400
11595
  stage: "setup",
@@ -11432,10 +11627,16 @@ function buildDoctorResult(options) {
11432
11627
  "Use the remote relay path only when the browser is not colocated with this terminal."
11433
11628
  ]
11434
11629
  });
11630
+ const productEntrySummary2 = buildProductEntrySummary({
11631
+ currentSurface: "doctor",
11632
+ stage: "wallet-bootstrap",
11633
+ nextAction: recommendedCommands2.createWallet
11634
+ });
11435
11635
  return {
11436
11636
  scope: "wallet-bootstrap",
11437
11637
  nextAction: recommendedCommands2.createWallet,
11438
11638
  recommendedPaths: buildWalletBootstrapRecommendedPaths(options.relayUrl, void 0, options.walletName),
11639
+ productEntrySummary: productEntrySummary2,
11439
11640
  onboardingSummary: onboardingSummary2,
11440
11641
  summary: {
11441
11642
  stage: "wallet-bootstrap",
@@ -11475,6 +11676,11 @@ function buildDoctorResult(options) {
11475
11676
  "Use the remote reapproval path only when the browser cannot return directly to this terminal."
11476
11677
  ]
11477
11678
  });
11679
+ const productEntrySummary2 = buildProductEntrySummary({
11680
+ currentSurface: "doctor",
11681
+ stage: "wallet-recovery",
11682
+ nextAction: recommendedCommands2.reapprove
11683
+ });
11478
11684
  return {
11479
11685
  scope: "wallet-recovery",
11480
11686
  nextAction: recommendedCommands2.reapprove,
@@ -11482,6 +11688,7 @@ function buildDoctorResult(options) {
11482
11688
  options.wallet.walletName,
11483
11689
  options.relayUrl
11484
11690
  ),
11691
+ productEntrySummary: productEntrySummary2,
11485
11692
  onboardingSummary: onboardingSummary2,
11486
11693
  summary: {
11487
11694
  stage: "wallet-recovery",
@@ -11522,10 +11729,16 @@ function buildDoctorResult(options) {
11522
11729
  "Doctor is local-only: it confirms stored signer state, not live chain deployment or gas balance."
11523
11730
  ]
11524
11731
  });
11732
+ const productEntrySummary2 = buildProductEntrySummary({
11733
+ currentSurface: "doctor",
11734
+ stage: "wallet-recovery",
11735
+ nextAction: attachSigner
11736
+ });
11525
11737
  return {
11526
11738
  scope: "wallet-recovery",
11527
11739
  nextAction: attachSigner,
11528
11740
  recommendedPaths: buildSignerRecoveryRecommendedPaths(options.wallet.walletName),
11741
+ productEntrySummary: productEntrySummary2,
11529
11742
  onboardingSummary: onboardingSummary2,
11530
11743
  summary: {
11531
11744
  stage: "wallet-recovery",
@@ -11561,13 +11774,29 @@ function buildDoctorResult(options) {
11561
11774
  "Run zk-agent next for the current shortest live path; doctor does not confirm RPC reachability, deployment state, or funding."
11562
11775
  ]
11563
11776
  });
11777
+ const productEntrySummary = buildProductEntrySummary({
11778
+ currentSurface: "doctor",
11779
+ stage: "wallet-ready",
11780
+ nextAction: recommendedCommands.next,
11781
+ suiteAvailable: true,
11782
+ nextSurface: "next"
11783
+ });
11784
+ const suiteHandoffSummary = buildSuiteHandoffSummary({
11785
+ currentSurface: "doctor",
11786
+ recommendedNow: true,
11787
+ walletName: options.wallet.walletName,
11788
+ chain: options.wallet.chain,
11789
+ recommendedJourneyId: "send-value-now"
11790
+ });
11564
11791
  return {
11565
11792
  scope: "wallet-ready",
11566
11793
  nextAction: recommendedCommands.next,
11567
11794
  recommendedPaths: {
11568
11795
  local: [recommendedCommands.next]
11569
11796
  },
11797
+ productEntrySummary,
11570
11798
  onboardingSummary,
11799
+ suiteHandoffSummary,
11571
11800
  summary: {
11572
11801
  stage: "wallet-ready",
11573
11802
  configExists: true,
@@ -11589,6 +11818,7 @@ function buildDoctorLines(input) {
11589
11818
  const lines = [
11590
11819
  ["scope", input.scope],
11591
11820
  ...onboardingSummaryLines(input.onboardingSummary),
11821
+ ...productEntrySummaryLines(input.productEntrySummary),
11592
11822
  ["config", input.config ? "present" : "missing"]
11593
11823
  ];
11594
11824
  if (input.config) {
@@ -11625,6 +11855,9 @@ function buildDoctorLines(input) {
11625
11855
  }
11626
11856
  lines.push(["next", input.nextAction]);
11627
11857
  lines.push(...recommendedPathLines(input.recommendedPaths));
11858
+ if (input.suiteHandoffSummary) {
11859
+ lines.push(...suiteHandoffLines(input.suiteHandoffSummary));
11860
+ }
11628
11861
  if (input.recommendedCommands.createWallet) {
11629
11862
  lines.push(["create wallet (local)", input.recommendedCommands.createWallet]);
11630
11863
  }
@@ -11637,6 +11870,9 @@ function buildDoctorLines(input) {
11637
11870
  if (input.recommendedCommands.workflowPay) {
11638
11871
  lines.push(["workflow pay", input.recommendedCommands.workflowPay]);
11639
11872
  }
11873
+ if (input.recommendedCommands.suite) {
11874
+ lines.push(["suite command", input.recommendedCommands.suite]);
11875
+ }
11640
11876
  if (input.recommendedCommands.relayInspect) {
11641
11877
  lines.push(["relay inspect", input.recommendedCommands.relayInspect]);
11642
11878
  }
@@ -11679,7 +11915,9 @@ function createDoctorCommand() {
11679
11915
  config,
11680
11916
  wallet,
11681
11917
  onboardingSummary: result.onboardingSummary,
11918
+ productEntrySummary: result.productEntrySummary,
11682
11919
  summary: result.summary,
11920
+ suiteHandoffSummary: "suiteHandoffSummary" in result ? result.suiteHandoffSummary : void 0,
11683
11921
  recommendedPaths: result.recommendedPaths,
11684
11922
  recommendedCommands: result.recommendedCommands,
11685
11923
  nextAction: result.nextAction
@@ -11700,8 +11938,10 @@ function createDoctorCommand() {
11700
11938
  exists: false
11701
11939
  },
11702
11940
  wallet,
11941
+ productEntrySummary: result.productEntrySummary,
11703
11942
  onboardingSummary: result.onboardingSummary,
11704
11943
  summary: result.summary,
11944
+ ..."suiteHandoffSummary" in result ? { suiteHandoffSummary: result.suiteHandoffSummary } : {},
11705
11945
  agentProfile,
11706
11946
  agentFollowup,
11707
11947
  nextAction: result.nextAction,
@@ -11805,7 +12045,11 @@ function createAgentCommand() {
11805
12045
  "after",
11806
12046
  [
11807
12047
  "",
11808
- " Agent identity path:",
12048
+ " Agent profile surface:",
12049
+ " Use this layer only when you want explicit local operator identity metadata on top of the wallet path.",
12050
+ " Wallet approval and workflow execution still work without a saved local agent profile.",
12051
+ "",
12052
+ " Basic local identity path:",
11809
12053
  " zk-agent agent status",
11810
12054
  ' zk-agent agent set --name "SED Operator" --wallet main',
11811
12055
  " zk-agent agent show",
@@ -11814,12 +12058,9 @@ function createAgentCommand() {
11814
12058
  " zk-agent agent export",
11815
12059
  " zk-agent agent import --payload @agent-profile.json --overwrite",
11816
12060
  "",
11817
- " Remove the saved local profile:",
12061
+ " Clear the saved local profile:",
11818
12062
  " zk-agent agent clear",
11819
12063
  "",
11820
- " This profile is optional. Wallet approval and workflow execution still work",
11821
- " without a saved local agent profile.",
11822
- "",
11823
12064
  "Examples:",
11824
12065
  " zk-agent agent status",
11825
12066
  ' zk-agent agent set --name "SED Operator" --wallet main',
@@ -12796,27 +13037,61 @@ import { Command as Command8 } from "commander";
12796
13037
  function buildOperatorSuitePayload(options = {}) {
12797
13038
  const walletName = options.walletName?.trim() || "main";
12798
13039
  const chain = options.chain?.trim() || "zksync-sepolia";
13040
+ const includeOnboarding = options.includeOnboarding === true;
12799
13041
  const flagshipCommand = buildWorkflowPayRecommendedCommand(walletName);
12800
13042
  const inspectDefaults = buildDefaultsRecommendedCommand();
13043
+ const workflowSurfaceCommand = "zk-agent workflow --help";
13044
+ const relaySurfaceCommand = "zk-agent relay --help";
12801
13045
  const discoveryCommand = buildAssetsRecommendedCommand(walletName);
12802
13046
  const paymasterCommand = buildWorkflowPayRecommendedCommand(walletName, "approval-based");
12803
13047
  const fundingCommand = buildWorkflowFundRecommendedCommand(walletName);
13048
+ const nextCommand = buildTopLevelNextRecommendedCommand(void 0, void 0, walletName);
13049
+ const hostedRelayInspectCommand = buildRelayInspectRecommendedCommand("<url>");
13050
+ const hostedCreateWalletCommand = buildWalletCreateRemoteRecommendedCommand(
13051
+ "<url>",
13052
+ void 0,
13053
+ walletName
13054
+ );
13055
+ const hostedReapproveCommand = buildWalletReapproveRemoteRecommendedCommand(
13056
+ walletName,
13057
+ "<url>"
13058
+ );
13059
+ const suiteCommand = buildSuiteRecommendedCommand(walletName, chain, {
13060
+ includeOnboarding
13061
+ });
13062
+ const preflightPaths = includeOnboarding ? buildSetupRecommendedPaths("<url>", void 0, walletName) : void 0;
13063
+ const preflight = preflightPaths ? {
13064
+ id: "first-run-preflight",
13065
+ title: "First-Run Preflight",
13066
+ goal: "Start from a fresh install, write local defaults, and bootstrap a writable wallet session before using the packaged operator surface.",
13067
+ useWhen: "Use this when the machine is new, the wallet is not ready yet, or you want the full operator map before choosing local-first versus remote-browser approval.",
13068
+ diagnosticCommand: walletName === "main" ? "zk-agent doctor" : `zk-agent doctor --wallet ${walletName}`,
13069
+ localPath: preflightPaths.local,
13070
+ remoteBrowserPath: preflightPaths.remoteBrowser,
13071
+ afterWalletReady: buildSuiteRecommendedCommand(walletName, chain)
13072
+ } : void 0;
12804
13073
  const flagship = {
13074
+ category: "operate",
13075
+ surface: "workflow",
12805
13076
  id: "flagship-pay",
12806
13077
  title: "Flagship Pay",
12807
13078
  goal: "Run the default zkSync-native native-send path through the workflow layer.",
12808
13079
  useWhen: "Start here when the wallet is already ready and the next real goal is a native send.",
12809
13080
  primaryCommand: flagshipCommand,
12810
- supportingCommands: ["zk-agent next", buildWalletStatusRecommendedCommand(walletName), inspectDefaults],
13081
+ surfaceCommand: workflowSurfaceCommand,
13082
+ supportingCommands: [nextCommand, buildWalletStatusRecommendedCommand(walletName), inspectDefaults],
12811
13083
  skillPath: "skills/zk-aa/SKILL.md"
12812
13084
  };
12813
13085
  const slices = [
12814
13086
  {
13087
+ category: "discover",
13088
+ surface: "discovery",
12815
13089
  id: "discovery-defaults",
12816
13090
  title: "Discovery / Defaults",
12817
13091
  goal: "Discover owned assets, tracked defaults, and symbol-first token resolution before acting.",
12818
13092
  useWhen: "Use this before tokenized actions or whenever asset/default context is unclear.",
12819
13093
  primaryCommand: discoveryCommand,
13094
+ surfaceCommand: inspectDefaults,
12820
13095
  supportingCommands: [
12821
13096
  inspectDefaults,
12822
13097
  `zk-agent tokens --chain ${chain}`,
@@ -12826,11 +13101,14 @@ function buildOperatorSuitePayload(options = {}) {
12826
13101
  smokeCommand: `pnpm smoke:discovery -- --wallet ${walletName}`
12827
13102
  },
12828
13103
  {
13104
+ category: "pay",
13105
+ surface: "workflow",
12829
13106
  id: "paymaster-readiness",
12830
13107
  title: "Paymaster Readiness",
12831
13108
  goal: "Stay on the approval-based flagship path and recover the exact fee-token/default metadata when needed.",
12832
13109
  useWhen: "Use this when approval-based pay or another sponsored write needs fee-token/default recovery.",
12833
13110
  primaryCommand: paymasterCommand,
13111
+ surfaceCommand: workflowSurfaceCommand,
12834
13112
  supportingCommands: [
12835
13113
  inspectDefaults,
12836
13114
  buildPaymasterFeeTokensRecommendedCommand(chain),
@@ -12840,11 +13118,14 @@ function buildOperatorSuitePayload(options = {}) {
12840
13118
  smokeCommand: `pnpm smoke:paymaster-success -- --wallet ${walletName}`
12841
13119
  },
12842
13120
  {
13121
+ category: "fund",
13122
+ surface: "workflow",
12843
13123
  id: "funding-readiness",
12844
13124
  title: "Funding Readiness",
12845
13125
  goal: "Ask the workflow layer for the exact funding route before executing bridge/deposit follow-up.",
12846
13126
  useWhen: "Use this when the workflow path is blocked on gas or the CLI says funding is required.",
12847
13127
  primaryCommand: fundingCommand,
13128
+ surfaceCommand: workflowSurfaceCommand,
12848
13129
  supportingCommands: [
12849
13130
  buildWorkflowFundRunRecommendedCommand(walletName),
12850
13131
  `zk-agent fund --wallet ${walletName} --amount <amount>`,
@@ -12852,48 +13133,184 @@ function buildOperatorSuitePayload(options = {}) {
12852
13133
  ],
12853
13134
  skillPath: "skills/zk-funding/SKILL.md",
12854
13135
  smokeCommand: `pnpm smoke:funding-readiness -- --wallet ${walletName}`
13136
+ },
13137
+ {
13138
+ category: "recover",
13139
+ surface: "relay",
13140
+ id: "hosted-approval-recovery",
13141
+ title: "Hosted Approval Recovery",
13142
+ goal: "Validate a hosted relay URL and switch to the remote approval path when the browser is not colocated or a writable session must be reapproved remotely.",
13143
+ useWhen: "Use this when local callback is not viable, the browser is remote, or an expired writable session must be recovered through the single-host hosted relay baseline.",
13144
+ primaryCommand: hostedRelayInspectCommand,
13145
+ surfaceCommand: relaySurfaceCommand,
13146
+ supportingCommands: [
13147
+ hostedCreateWalletCommand,
13148
+ hostedReapproveCommand,
13149
+ `pnpm smoke:hosted-operated-baseline -- --wallet ${walletName} --relay-url <url> --reapprove --prompt-code --plan`
13150
+ ],
13151
+ skillPath: "skills/zk-relay/SKILL.md"
13152
+ }
13153
+ ];
13154
+ const surfaces = [
13155
+ {
13156
+ surface: "workflow",
13157
+ title: "Workflow Surface",
13158
+ useWhen: "Use this when the question is already about execution, approval-based pay, or funding recovery after suite has identified the right slice.",
13159
+ command: workflowSurfaceCommand,
13160
+ categoryIds: ["operate", "pay", "fund"],
13161
+ entryIds: [flagship.id, "paymaster-readiness", "funding-readiness"]
13162
+ },
13163
+ {
13164
+ surface: "discovery",
13165
+ title: "Discovery Surface",
13166
+ useWhen: "Use this when the question is about assets, defaults, token ownership, or symbol-first inspection after suite has identified the discovery slice.",
13167
+ command: inspectDefaults,
13168
+ categoryIds: ["discover"],
13169
+ entryIds: ["discovery-defaults"]
13170
+ },
13171
+ {
13172
+ surface: "relay",
13173
+ title: "Relay Surface",
13174
+ useWhen: "Use this when the browser is remote or hosted approval readiness must be checked before wallet recovery can continue.",
13175
+ command: relaySurfaceCommand,
13176
+ categoryIds: ["recover"],
13177
+ entryIds: ["hosted-approval-recovery"]
13178
+ }
13179
+ ];
13180
+ const journeys = [
13181
+ {
13182
+ id: "send-value-now",
13183
+ title: "Send Value Now",
13184
+ operatorQuestion: "I already have a ready wallet and want the shortest path to send native value now.",
13185
+ useWhen: "Use this when the wallet is already ready and the operator wants the flagship zkSync-native pay path first.",
13186
+ startCommand: flagshipCommand,
13187
+ surface: "workflow",
13188
+ categoryIds: ["operate"],
13189
+ entryIds: [flagship.id]
13190
+ },
13191
+ {
13192
+ id: "inspect-before-acting",
13193
+ title: "Inspect Before Acting",
13194
+ operatorQuestion: "I need to inspect assets, defaults, or token metadata before I choose a tokenized action.",
13195
+ useWhen: "Use this when asset visibility, defaults, or symbol-first token inspection is still the real blocker.",
13196
+ startCommand: discoveryCommand,
13197
+ surface: "discovery",
13198
+ categoryIds: ["discover"],
13199
+ entryIds: ["discovery-defaults"]
13200
+ },
13201
+ {
13202
+ id: "unstick-a-write",
13203
+ title: "Unstick a Write",
13204
+ operatorQuestion: "The write path is blocked on fee-token/default state or funding, and I need the shortest recovery route.",
13205
+ useWhen: "Use this when approval-based pay or a workflow write is blocked and the CLI needs to recover paymaster or funding readiness.",
13206
+ startCommand: paymasterCommand,
13207
+ surface: "workflow",
13208
+ categoryIds: ["pay", "fund"],
13209
+ entryIds: ["paymaster-readiness", "funding-readiness"]
13210
+ },
13211
+ {
13212
+ id: "recover-remote-approval",
13213
+ title: "Recover Remote Approval",
13214
+ operatorQuestion: "The browser is remote or local callback is not viable, so approval must move to the hosted relay path.",
13215
+ useWhen: "Use this when a writable session must be recovered through the single-host hosted relay baseline.",
13216
+ startCommand: hostedRelayInspectCommand,
13217
+ surface: "relay",
13218
+ categoryIds: ["recover"],
13219
+ entryIds: ["hosted-approval-recovery"]
12855
13220
  }
12856
13221
  ];
12857
13222
  return {
12858
13223
  ok: true,
12859
13224
  summary: {
12860
13225
  suiteId: "zk-agent-operator-suite",
13226
+ catalogView: "operator-catalog",
12861
13227
  walletName,
12862
13228
  chain,
12863
13229
  stage: "wallet-ready-post-flagship",
12864
- useWhen: "Use suite after wallet readiness when you want one packaged surface for flagship pay plus the current post-flagship discovery, paymaster, and funding slices.",
13230
+ useWhen: "Use suite after wallet readiness when you want one packaged surface for flagship pay plus the current post-flagship discovery, paymaster, funding, and hosted recovery slices.",
13231
+ entryModes: ["local-first", "hosted-recovery"],
13232
+ journeyOrder: journeys.map((entry) => entry.id),
13233
+ surfaceOrder: ["workflow", "discovery", "relay"],
13234
+ categoryOrder: [flagship.category, ...slices.map((entry) => entry.category)],
12865
13235
  flagshipId: flagship.id,
12866
13236
  postFlagshipSliceIds: slices.map((entry) => entry.id),
12867
13237
  recommendedOrder: [flagship.id, ...slices.map((entry) => entry.id)],
12868
13238
  nextAction: flagship.primaryCommand
12869
13239
  },
13240
+ ...preflight ? { preflight } : {},
13241
+ journeys,
13242
+ surfaces,
12870
13243
  flagship,
12871
13244
  slices,
12872
13245
  recommendedCommands: {
12873
- suite: buildSuiteRecommendedCommand(walletName, chain),
13246
+ suite: suiteCommand,
12874
13247
  flagship: flagshipCommand,
13248
+ workflowSurface: workflowSurfaceCommand,
13249
+ discoverySurface: inspectDefaults,
13250
+ relaySurface: relaySurfaceCommand,
12875
13251
  discovery: discoveryCommand,
12876
13252
  paymaster: paymasterCommand,
12877
13253
  funding: fundingCommand,
13254
+ hostedApproval: hostedRelayInspectCommand,
12878
13255
  inspectDefaults
12879
13256
  }
12880
13257
  };
12881
13258
  }
12882
13259
  function operatorSuiteLines(payload) {
13260
+ const preflightLines = payload.preflight ? [
13261
+ ["preflight", formatRecommendedPath(payload.preflight.localPath)],
13262
+ ...payload.preflight.remoteBrowserPath?.length ? [["preflight (remote-browser)", formatRecommendedPath(payload.preflight.remoteBrowserPath)]] : [],
13263
+ ["preflight when", payload.preflight.useWhen],
13264
+ ["preflight diagnose", payload.preflight.diagnosticCommand],
13265
+ ["preflight handoff", payload.preflight.afterWalletReady]
13266
+ ] : [];
13267
+ const journeyLines = payload.journeys.flatMap((journey) => [
13268
+ [`journey ${journey.id}`, journey.startCommand],
13269
+ [`journey ${journey.id} surface`, journey.surface],
13270
+ [`journey ${journey.id} categories`, journey.categoryIds.join(" -> ")],
13271
+ [`journey ${journey.id} entries`, journey.entryIds.join(" -> ")],
13272
+ [`journey ${journey.id} when`, journey.useWhen]
13273
+ ]);
12883
13274
  const sliceLines = payload.slices.flatMap((entry) => [
13275
+ [`${entry.title.toLowerCase()} category`, entry.category],
13276
+ [`${entry.title.toLowerCase()} surface`, entry.surface],
13277
+ [`${entry.title.toLowerCase()} surface command`, entry.surfaceCommand],
12884
13278
  [entry.title.toLowerCase(), formatRecommendedPath([entry.primaryCommand, ...entry.supportingCommands])],
12885
13279
  [`${entry.title.toLowerCase()} when`, entry.useWhen],
12886
13280
  [`${entry.title.toLowerCase()} skill`, entry.skillPath],
12887
13281
  ...entry.smokeCommand ? [[`${entry.title.toLowerCase()} smoke`, entry.smokeCommand]] : []
12888
13282
  ]);
13283
+ const surfaceLines = payload.surfaces.flatMap((surface) => [
13284
+ [`${surface.surface} surface`, surface.command],
13285
+ [`${surface.surface} surface categories`, surface.categoryIds.join(" -> ")],
13286
+ [`${surface.surface} surface entries`, surface.entryIds.join(" -> ")],
13287
+ [`${surface.surface} surface when`, surface.useWhen]
13288
+ ]);
12889
13289
  return [
12890
13290
  ["suite", payload.summary.suiteId],
13291
+ ["catalog", payload.summary.catalogView],
12891
13292
  ["wallet", payload.summary.walletName],
12892
13293
  ["chain", payload.summary.chain],
12893
13294
  ["stage", payload.summary.stage],
12894
13295
  ["use when", payload.summary.useWhen],
13296
+ ["entry modes", payload.summary.entryModes.join(" -> ")],
13297
+ ["journey order", payload.summary.journeyOrder.join(" -> ")],
13298
+ ["surface order", payload.summary.surfaceOrder.join(" -> ")],
13299
+ ["category order", payload.summary.categoryOrder.join(" -> ")],
13300
+ ...preflightLines,
13301
+ ...journeyLines,
13302
+ ...surfaceLines,
12895
13303
  ["recommended order", payload.summary.recommendedOrder.join(" -> ")],
12896
- [payload.flagship.title.toLowerCase(), formatRecommendedPath([payload.flagship.primaryCommand, "zk-agent next"])],
13304
+ [`${payload.flagship.title.toLowerCase()} category`, payload.flagship.category],
13305
+ [`${payload.flagship.title.toLowerCase()} surface`, payload.flagship.surface],
13306
+ [`${payload.flagship.title.toLowerCase()} surface command`, payload.flagship.surfaceCommand],
13307
+ [
13308
+ payload.flagship.title.toLowerCase(),
13309
+ formatRecommendedPath([
13310
+ payload.flagship.primaryCommand,
13311
+ buildTopLevelNextRecommendedCommand(void 0, void 0, payload.summary.walletName)
13312
+ ])
13313
+ ],
12897
13314
  [`${payload.flagship.title.toLowerCase()} when`, payload.flagship.useWhen],
12898
13315
  [`${payload.flagship.title.toLowerCase()} skill`, payload.flagship.skillPath],
12899
13316
  ...sliceLines,
@@ -12903,28 +13320,59 @@ function operatorSuiteLines(payload) {
12903
13320
 
12904
13321
  // src/commands/suite.ts
12905
13322
  function createSuiteCommand() {
12906
- return new Command8("suite").description("Show the flagship and post-flagship zkSync-native operator suite").option("--wallet <name>", "Wallet name used in example commands", "main").option("--chain <chain>", "Chain key used in example commands", "zksync-sepolia").addHelpText(
13323
+ return new Command8("suite").description("Show the flagship and post-flagship zkSync-native operator suite").option("--wallet <name>", "Wallet name used in example commands", "main").option("--chain <chain>", "Chain key used in example commands", "zksync-sepolia").option("--include-onboarding", "Include the first-run preflight and wallet-bootstrap map", false).addHelpText(
12907
13324
  "after",
12908
13325
  [
12909
13326
  "",
12910
13327
  " Use `suite` after wallet readiness when you want one packaged surface",
12911
13328
  " for flagship pay plus the current post-flagship slices.",
12912
13329
  "",
13330
+ " What `suite` answers right now:",
13331
+ " operate: send native value through the flagship workflow path",
13332
+ " discover: inspect owned assets and defaults before tokenized actions",
13333
+ " pay: stay on the approval-based paymaster path with exact fee-token follow-up",
13334
+ " fund: recover from gas/funding blockers without guessing the route",
13335
+ " recover: switch to hosted relay approval when the browser is remote",
13336
+ "",
13337
+ " Most common operator journeys:",
13338
+ " send value now: go straight to the flagship pay path",
13339
+ " inspect before acting: open assets/defaults/token inspection first",
13340
+ " unstick a write: recover paymaster/funding readiness on the workflow path",
13341
+ " recover remote approval: move approval to the hosted relay path",
13342
+ "",
13343
+ " Where `suite` hands you off next:",
13344
+ " workflow: flagship pay, approval-based pay, and funding recovery",
13345
+ " discovery: assets, defaults, and token inspection",
13346
+ " relay: hosted approval recovery and relay readiness",
13347
+ "",
13348
+ " For the full first-run to post-flagship map:",
13349
+ " zk-agent suite --include-onboarding",
13350
+ "",
12913
13351
  " Recommended order inside the suite:",
12914
13352
  " zk-agent workflow pay --wallet main --to <address> --amount <amount>",
12915
13353
  " zk-agent assets --wallet main",
12916
13354
  " zk-agent workflow pay --wallet main --to <address> --amount <amount> --paymaster-mode approval-based",
12917
13355
  " zk-agent workflow fund --wallet main",
13356
+ " zk-agent relay inspect --relay-url <url>",
12918
13357
  "",
12919
13358
  " Pass `--wallet` or `--chain` to retarget the entire suite contract.",
13359
+ " Pass `--include-onboarding` when you want setup, doctor, and wallet bootstrap",
13360
+ " guidance in the same packaged readout.",
12920
13361
  "",
12921
- " In JSON mode, `summary.useWhen`, `summary.recommendedOrder`, and each",
12922
- " entry `useWhen` field explain when to stay on one slice instead of guessing."
13362
+ " In JSON mode, `summary.catalogView`, `summary.entryModes`,",
13363
+ " `summary.journeyOrder`, `summary.surfaceOrder`, top-level `journeys[]`,",
13364
+ " top-level `surfaces[]`, `summary.categoryOrder`, `summary.recommendedOrder`,",
13365
+ " optional `preflight`, and each entry `category` + `surface` +",
13366
+ " `surfaceCommand` + `useWhen` field explain which slice to choose",
13367
+ " and which deeper surface owns it next.",
13368
+ " `recommendedCommands.workflowSurface|discoverySurface|relaySurface`",
13369
+ " expose the direct deeper-surface entry commands."
12923
13370
  ].join("\n")
12924
13371
  ).action((options) => {
12925
13372
  const payload = buildOperatorSuitePayload({
12926
13373
  walletName: options.wallet,
12927
- chain: options.chain
13374
+ chain: options.chain,
13375
+ includeOnboarding: options.includeOnboarding
12928
13376
  });
12929
13377
  printResult(operatorSuiteLines(payload), payload);
12930
13378
  });
@@ -14138,7 +14586,11 @@ function createRelayCommand() {
14138
14586
  "after",
14139
14587
  [
14140
14588
  "",
14141
- " Hosted remote-approval path:",
14589
+ " Relay surface:",
14590
+ " Use this layer only when approval must happen through a publicly reachable hosted path.",
14591
+ " Keep `wallet create|reapprove --await-local` as the default baseline when the browser and terminal are colocated.",
14592
+ "",
14593
+ " Hosted remote-approval path today:",
14142
14594
  " zk-agent relay serve --public-origin https://relay.example.com",
14143
14595
  " zk-agent relay inspect --relay-url <url>",
14144
14596
  " zk-agent wallet create --relay-url <url> --wait-relay --prompt-code",
@@ -14150,9 +14602,6 @@ function createRelayCommand() {
14150
14602
  " one same-origin share-link + approval UI surface",
14151
14603
  " Do not assume multi-host or load-balanced durability.",
14152
14604
  "",
14153
- " Keep `wallet create|reapprove --await-local` as the default baseline when",
14154
- " the browser and terminal are colocated.",
14155
- "",
14156
14605
  " Use `relay inspect` before sending operators to a hosted share link so",
14157
14606
  " the public origin, connector UI, and hosted-readiness contract are visible."
14158
14607
  ].join("\n")
@@ -17091,30 +17540,30 @@ function createWalletCommand(deps) {
17091
17540
  "after",
17092
17541
  [
17093
17542
  "",
17094
- "Local-first wallet path:",
17095
- " Use this layer when the blocker is specifically about wallet approval or signer state.",
17096
- " Otherwise start with `zk-agent next` or `zk-agent doctor`.",
17543
+ "Wallet surface:",
17544
+ " Use this layer when the blocker is specifically wallet approval, signer state, or session recovery.",
17545
+ " If the CLI still needs to decide whether the problem is setup, wallet readiness, or workflow continuation, start with `zk-agent next` or `zk-agent doctor`.",
17097
17546
  "",
17098
- " First bootstrap:",
17547
+ " First local-first bootstrap:",
17099
17548
  " zk-agent wallet create --await-local",
17100
17549
  " zk-agent next",
17101
17550
  "",
17102
- " Restore approval metadata for an existing wallet:",
17551
+ " Repair an existing wallet session:",
17103
17552
  " zk-agent wallet reapprove --name main --await-local",
17104
17553
  " zk-agent next",
17105
17554
  "",
17106
- " Attach a local signer when approval is still present:",
17555
+ " Repair signer-only local execution state:",
17107
17556
  " zk-agent wallet signer attach --name main --private-key <hex>",
17108
17557
  " zk-agent next",
17109
17558
  "",
17110
- " Wallet-layer inspection:",
17559
+ " Wallet-scoped diagnosis:",
17111
17560
  " zk-agent wallet status --name main",
17112
17561
  " zk-agent wallet next --name main",
17113
17562
  "",
17114
- " When wallet readiness is no longer the blocker and you want the packaged surface:",
17563
+ " Switch to the packaged catalog after wallet readiness:",
17115
17564
  " zk-agent suite",
17116
17565
  "",
17117
- " Hosted remote approval path:",
17566
+ " Hosted remote approval only when the browser is remote:",
17118
17567
  " zk-agent relay inspect --relay-url <url>",
17119
17568
  " zk-agent wallet create --relay-url <url> --wait-relay --prompt-code",
17120
17569
  " zk-agent wallet reapprove --name main --relay-url <url> --wait-relay --prompt-code",
@@ -17713,7 +18162,8 @@ function createWalletCommand(deps) {
17713
18162
  currentSurface: "wallet",
17714
18163
  recommendedNow: summary.status === "ready",
17715
18164
  walletName: walletRecord.walletName,
17716
- chain: summary.chain
18165
+ chain: summary.chain,
18166
+ recommendedJourneyId: summary.status === "ready" ? "send-value-now" : null
17717
18167
  });
17718
18168
  printResult(
17719
18169
  [
@@ -17756,7 +18206,8 @@ function createWalletCommand(deps) {
17756
18206
  currentSurface: "wallet",
17757
18207
  recommendedNow: summary.status === "ready",
17758
18208
  walletName: walletRecord.walletName,
17759
- chain: summary.chain
18209
+ chain: summary.chain,
18210
+ recommendedJourneyId: summary.status === "ready" ? "send-value-now" : null
17760
18211
  });
17761
18212
  printResult(
17762
18213
  [
@@ -21438,25 +21889,26 @@ function assertWorkflowResumeReady(result) {
21438
21889
  function buildWorkflowHelpText() {
21439
21890
  return [
21440
21891
  "",
21441
- " Flagship native pay path:",
21892
+ " Workflow surface:",
21893
+ " Use this layer when the question is already an explicit workflow, checkpoint, or execution state.",
21894
+ " If the CLI still needs to choose across setup, wallet readiness, or recovery, go back to `zk-agent next` or `zk-agent doctor`.",
21895
+ "",
21896
+ " Fastest flagship pay path:",
21442
21897
  " zk-agent workflow pay --wallet main --to <address> --amount <amount>",
21443
21898
  "",
21444
- " Broader multi-intent guided path:",
21899
+ " Multi-intent guided path:",
21445
21900
  " zk-agent workflow auto --wallet main --intent <intent> [goal flags] --create-checkpoint --execute-when-ready",
21446
21901
  "",
21447
- " Checkpointed execution:",
21902
+ " Checkpoint lifecycle when you want explicit control:",
21448
21903
  " zk-agent workflow start --wallet main --intent <intent> [goal flags]",
21449
21904
  " zk-agent workflow status --request-id <id>",
21450
21905
  " zk-agent workflow next --request-id <id>",
21451
21906
  " zk-agent workflow resume --request-id <id> [--broadcast]",
21452
21907
  "",
21453
- " When the explicit workflow is no longer the real question and you want the broader packaged surface:",
21454
- " zk-agent suite",
21455
- "",
21456
- " Funding-only step:",
21908
+ " Funding-only recovery when execution is blocked on gas:",
21457
21909
  " zk-agent workflow fund --wallet main --amount <amount> --execute",
21458
21910
  "",
21459
- " Token/discovery recovery path:",
21911
+ " Discovery / token recovery before the workflow can continue:",
21460
21912
  " zk-agent assets --wallet main",
21461
21913
  " zk-agent tokens --wallet main --owned",
21462
21914
  " zk-agent tokens --chain zksync-sepolia",
@@ -21467,6 +21919,9 @@ function buildWorkflowHelpText() {
21467
21919
  " zk-agent resolve-token --chain zksync-sepolia --symbol <symbol> --role paymaster-fee-token",
21468
21920
  " zk-agent defaults",
21469
21921
  "",
21922
+ " When the question becomes broader than one explicit workflow:",
21923
+ " zk-agent suite",
21924
+ "",
21470
21925
  " Lower-level one-shot escape hatch:",
21471
21926
  " zk-agent workflow run --wallet main --intent <intent> [goal flags]"
21472
21927
  ].join("\n");
@@ -22187,6 +22642,15 @@ function buildDefaultOperatorPathHelpText() {
22187
22642
  "",
22188
22643
  "Operator suite beyond flagship pay:",
22189
22644
  " zk-agent suite",
22645
+ " zk-agent suite --include-onboarding",
22646
+ "",
22647
+ "Product routing by operator question:",
22648
+ " next -> bootstrap | recover | operate | workflow",
22649
+ " suite -> operate | discover | pay | fund | recover",
22650
+ "",
22651
+ "Use `next` while the CLI still needs to choose across setup, wallet readiness, or stored workflow continuation.",
22652
+ "Use `suite` once wallet readiness is no longer the blocker and you want the packaged post-flagship surface.",
22653
+ "Use `zk-agent suite --include-onboarding` when you want one readout from first-run bootstrap through the packaged operator catalog.",
22190
22654
  "",
22191
22655
  "Validated first-run baseline:",
22192
22656
  " setup defaults to zksync-sepolia and the local connector at http://localhost:4444",