zk-agent-cli 0.1.0-rc.8 → 1.0.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.
Files changed (3) hide show
  1. package/README.md +72 -26
  2. package/dist/index.js +690 -166
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -8069,6 +8069,15 @@ function buildPaymentSubmitRecommendedCommand(walletName = "main") {
8069
8069
  function buildWorkspaceRecommendedCommand() {
8070
8070
  return "zk-agent workspace";
8071
8071
  }
8072
+ function buildApprovalRecommendedCommand(requestId) {
8073
+ return `zk-agent approval --request-id ${requestId}`;
8074
+ }
8075
+ function buildHandoffRecommendedCommand(requestId) {
8076
+ return `zk-agent handoff --request-id ${requestId}`;
8077
+ }
8078
+ function buildFeedRecommendedCommand() {
8079
+ return "zk-agent feed";
8080
+ }
8072
8081
  function buildPaymentWorkspaceRecommendedCommand() {
8073
8082
  return "zk-agent payment workspace";
8074
8083
  }
@@ -10379,12 +10388,18 @@ function buildSetupHelpText() {
10379
10388
  " Connector URL: http://localhost:4444",
10380
10389
  " Override --default-chain or --connector-url only when you intentionally deviate from that path.",
10381
10390
  "",
10391
+ "After setup, choose the entrypoint that fits:",
10392
+ " zk-agent start -> public first touch",
10393
+ " zk-agent next -> canonical live routing contract",
10394
+ "",
10382
10395
  "Then stay on the default local-first path:",
10383
10396
  " zk-agent next",
10384
10397
  " zk-agent wallet create --await-local",
10385
10398
  " zk-agent next",
10386
10399
  ` ${buildTopLevelPayRecommendedCommand("main")}`,
10387
- " Stop after the first successful workflow pay.",
10400
+ " Stop after the first successful pay.",
10401
+ " Approved wallets auto-sync local smart-account metadata when chain reads are available,",
10402
+ " so the default path does not depend on a separate manual wallet sync.",
10388
10403
  "",
10389
10404
  "Use the remote-browser variant only when the browser cannot return to this terminal:",
10390
10405
  " zk-agent relay baseline --relay-url <url>",
@@ -10974,10 +10989,10 @@ function buildSuiteHandoffPublicJourneyProofPath(journeyId, walletName) {
10974
10989
  return [
10975
10990
  buildSubmitRecommendedCommand(walletName),
10976
10991
  buildPaymentNextRecommendedCommand("<request-id>"),
10977
- buildPaymentApprovalRecommendedCommand("<request-id>"),
10992
+ buildApprovalRecommendedCommand("<request-id>"),
10978
10993
  buildWorkspaceRecommendedCommand(),
10979
- buildPaymentHandoffRecommendedCommand("<request-id>"),
10980
- buildPaymentFeedRecommendedCommand()
10994
+ buildHandoffRecommendedCommand("<request-id>"),
10995
+ buildFeedRecommendedCommand()
10981
10996
  ];
10982
10997
  case "inspect-before-acting":
10983
10998
  case "unstick-a-write":
@@ -11365,6 +11380,7 @@ function buildNextHelpText() {
11365
11380
  return [
11366
11381
  "",
11367
11382
  "Use `start` for public first touch. Keep `next` as the live routing contract.",
11383
+ "If local defaults do not exist yet, the first answer is still `zk-agent setup`.",
11368
11384
  "",
11369
11385
  "Default first-run path:",
11370
11386
  " zk-agent setup",
@@ -11372,7 +11388,9 @@ function buildNextHelpText() {
11372
11388
  " zk-agent wallet create --await-local",
11373
11389
  " zk-agent next",
11374
11390
  ` ${buildTopLevelPayRecommendedCommand("main")}`,
11375
- " Stop after the first successful workflow pay.",
11391
+ " Stop after the first successful pay.",
11392
+ " Approved wallets auto-sync local smart-account metadata when chain reads are available,",
11393
+ " so the default path does not depend on a separate manual wallet sync.",
11376
11394
  "",
11377
11395
  "Before that first success:",
11378
11396
  " Ignore suite, payment, and relay unless the CLI points you there or the browser is remote.",
@@ -11432,6 +11450,7 @@ function buildStartHelpText() {
11432
11450
  "`start` is the shortest public first-touch command.",
11433
11451
  "Use it when you want one obvious entrypoint but still want the same",
11434
11452
  "output contract and runtime behavior as `zk-agent next`.",
11453
+ "On a clean machine, the first answer will usually still be `zk-agent setup`.",
11435
11454
  "",
11436
11455
  "Shortest first proof:",
11437
11456
  " zk-agent setup",
@@ -11439,7 +11458,9 @@ function buildStartHelpText() {
11439
11458
  " zk-agent wallet create --await-local",
11440
11459
  " zk-agent next",
11441
11460
  ` ${buildTopLevelPayRecommendedCommand("main")}`,
11442
- " Stop after the first successful workflow pay.",
11461
+ " Stop after the first successful pay.",
11462
+ " Approved wallets auto-sync local smart-account metadata when chain reads are available,",
11463
+ " so the default path does not depend on a separate manual wallet sync.",
11443
11464
  "",
11444
11465
  "What not to learn first:",
11445
11466
  " Ignore suite, payment, and relay until that baseline path works once,",
@@ -15253,26 +15274,37 @@ function buildPaymentExecuteCommand(plan) {
15253
15274
  paymasterMode: plan.paymasterMode
15254
15275
  });
15255
15276
  }
15256
- function buildPaymentRecommendedCommands(record, executionPlan) {
15277
+ function buildPaymentRecommendedCommands(record, executionPlan, options = {}) {
15278
+ const walletName = executionPlan.walletName;
15279
+ const topLevel = options.topLevel ?? false;
15257
15280
  const markPaidCommand = buildPaymentSetStatusRecommendedCommand(
15258
15281
  record.requestId,
15259
15282
  "paid",
15260
15283
  record.settlement.txHash || "<tx-hash>"
15261
15284
  );
15262
15285
  return {
15263
- submit: buildPaymentSubmitRecommendedCommand(),
15264
- workspace: buildPaymentWorkspaceRecommendedCommand(),
15286
+ submit: topLevel ? buildSubmitRecommendedCommand(walletName) : buildPaymentSubmitRecommendedCommand(walletName),
15287
+ workspace: topLevel ? buildWorkspaceRecommendedCommand() : buildPaymentWorkspaceRecommendedCommand(),
15265
15288
  dashboard: buildPaymentDashboardRecommendedCommand(),
15266
- feed: buildPaymentFeedRecommendedCommand(),
15289
+ feed: topLevel ? buildFeedRecommendedCommand() : buildPaymentFeedRecommendedCommand(),
15267
15290
  queue: buildPaymentQueueRecommendedCommand(),
15268
15291
  report: buildPaymentReportRecommendedCommand(),
15269
- approval: buildPaymentApprovalRecommendedCommand(record.requestId),
15292
+ approval: topLevel ? buildApprovalRecommendedCommand(record.requestId) : buildPaymentApprovalRecommendedCommand(record.requestId),
15293
+ ...topLevel ? {
15294
+ paymentSubmit: buildPaymentSubmitRecommendedCommand(walletName),
15295
+ paymentWorkspace: buildPaymentWorkspaceRecommendedCommand(),
15296
+ paymentFeed: buildPaymentFeedRecommendedCommand(),
15297
+ paymentApproval: buildPaymentApprovalRecommendedCommand(record.requestId)
15298
+ } : {},
15270
15299
  syncApproval: buildPaymentSyncApprovalRecommendedCommand(record.requestId),
15271
15300
  list: buildPaymentListRecommendedCommand(),
15272
15301
  show: buildPaymentShowRecommendedCommand(record.requestId),
15273
15302
  inspect: buildPaymentInspectRecommendedCommand(record.requestId),
15274
15303
  next: buildPaymentNextRecommendedCommand(record.requestId),
15275
- handoff: buildPaymentHandoffRecommendedCommand(record.requestId),
15304
+ handoff: topLevel ? buildHandoffRecommendedCommand(record.requestId) : buildPaymentHandoffRecommendedCommand(record.requestId),
15305
+ ...topLevel ? {
15306
+ paymentHandoff: buildPaymentHandoffRecommendedCommand(record.requestId)
15307
+ } : {},
15276
15308
  intent: buildPaymentIntentRecommendedCommand(record.requestId),
15277
15309
  parties: buildPaymentPartiesRecommendedCommand(record.requestId),
15278
15310
  describe: buildPaymentDescribeRecommendedCommand(record.requestId),
@@ -15531,9 +15563,25 @@ function paymentIntentLines(intent, inspectCommand, handoffCommand, partiesComma
15531
15563
  lines.push(["metadata keys", String(Object.keys(intent.metadata).length)]);
15532
15564
  return lines;
15533
15565
  }
15566
+ function buildAgentPayProductLayer(surface) {
15567
+ return {
15568
+ stage: "local-first-workbench",
15569
+ publicShell: "submit -> next -> approval -> workspace -> handoff -> feed",
15570
+ productClaim: "compact ingress, wallet-aware follow-up, one cross-request workspace, and stable exports",
15571
+ surfaceRole: surface === "workspace" ? "cross-request-workbench" : surface === "handoff" ? "single-request-export" : "cross-request-export",
15572
+ platformDirection: "handoff and feed are already shaped for external dashboards, agents, or backend ingestion",
15573
+ boundary: "local-first only today; not a hosted multi-tenant control plane"
15574
+ };
15575
+ }
15534
15576
  function paymentHandoffLines(handoff, inspectCommand, partiesCommand, shareCommand, settlementCommand) {
15577
+ const productLayer = buildAgentPayProductLayer("handoff");
15535
15578
  const lines = [
15536
15579
  ["request", handoff.requestId],
15580
+ ["product stage", productLayer.stage],
15581
+ ["product claim", productLayer.productClaim],
15582
+ ["surface role", productLayer.surfaceRole],
15583
+ ["platform direction", productLayer.platformDirection],
15584
+ ["boundary", productLayer.boundary],
15537
15585
  ["source", handoff.source],
15538
15586
  ["chain", `${handoff.chain} (${handoff.chainId})`],
15539
15587
  ["status", handoff.summary.settlementStatus],
@@ -15789,21 +15837,27 @@ function paymentIngressLines(input) {
15789
15837
  ["history", input.historyCommand]
15790
15838
  ];
15791
15839
  }
15792
- function paymentWorkspaceLines(workspace, workspaceCommand = buildDefaultPaymentWorkspaceCommand(), submitCommand = buildDefaultPaymentSubmitCommand()) {
15840
+ function paymentWorkspaceLines(workspace, workspaceCommand = buildDefaultPaymentWorkspaceCommand(), submitCommand = buildDefaultPaymentSubmitCommand(), approvalCommand = buildPaymentApprovalRecommendedCommand("<request-id>"), handoffCommand = buildPaymentHandoffRecommendedCommand("<request-id>"), feedCommand = buildPaymentFeedRecommendedCommand()) {
15793
15841
  const walletName = workspace.filters.walletName || "main";
15842
+ const productLayer = buildAgentPayProductLayer("workspace");
15794
15843
  const lines = [
15795
15844
  ["surface", "cross-request Agent Pay workspace"],
15796
15845
  [
15797
15846
  "use when",
15798
15847
  "request capture is no longer enough and you need one current operator view across requests"
15799
15848
  ],
15800
- ["public shell", "submit -> next -> approval -> workspace -> handoff -> feed"],
15849
+ ["product stage", productLayer.stage],
15850
+ ["product claim", productLayer.productClaim],
15851
+ ["surface role", productLayer.surfaceRole],
15852
+ ["public shell", productLayer.publicShell],
15853
+ ["platform direction", productLayer.platformDirection],
15854
+ ["boundary", productLayer.boundary],
15801
15855
  ["generated", workspace.generatedAt],
15802
15856
  ["source", workspace.source],
15803
15857
  ["submit", submitCommand || buildPaymentSubmitRecommendedCommand(walletName)],
15804
15858
  ["payment next", buildPaymentNextRecommendedCommand("<request-id>")],
15805
- ["approval", buildPaymentApprovalRecommendedCommand("<request-id>")],
15806
- ["handoff", buildPaymentHandoffRecommendedCommand("<request-id>")],
15859
+ ["approval", approvalCommand],
15860
+ ["handoff", handoffCommand],
15807
15861
  ["requests", String(workspace.summary.totalRequests)],
15808
15862
  ["wallet groups", String(workspace.summary.distinctWalletCount)],
15809
15863
  ["actionable", String(workspace.summary.actionableRequests)],
@@ -15818,7 +15872,7 @@ function paymentWorkspaceLines(workspace, workspaceCommand = buildDefaultPayment
15818
15872
  ["recent activity", String(workspace.summary.recentActivityCount)],
15819
15873
  ["workspace", workspaceCommand],
15820
15874
  ["dashboard", buildPaymentDashboardRecommendedCommand()],
15821
- ["feed", buildPaymentFeedRecommendedCommand()],
15875
+ ["feed", feedCommand],
15822
15876
  ["queue", buildPaymentQueueRecommendedCommand()],
15823
15877
  ["report", buildPaymentReportRecommendedCommand()]
15824
15878
  ];
@@ -15870,15 +15924,15 @@ function buildWorkspaceSurfaceHelpText(options) {
15870
15924
  " Use this when you already know the current question is the cross-request Agent Pay workbench.",
15871
15925
  " This is the top-level shortcut for `zk-agent payment workspace`.",
15872
15926
  " Stay on `suite` when the question is broader than the Agent Pay workbench.",
15873
- " Stay on `payment next`, `payment approval`, or `payment handoff` when the question is still one request lifecycle.",
15927
+ " Stay on `payment next`, `approval`, or `handoff` when the question is still one request lifecycle.",
15874
15928
  "",
15875
15929
  " Common commands:",
15876
15930
  ` ${options.workspaceCommand}`,
15877
15931
  ` ${options.submitCommand}`,
15878
15932
  " zk-agent payment next --request-id <id>",
15879
- " zk-agent payment approval --request-id <id>",
15880
- " zk-agent payment handoff --request-id <id>",
15881
- " zk-agent payment feed"
15933
+ ` ${options.approvalCommand}`,
15934
+ ` ${options.handoffCommand}`,
15935
+ ` ${options.feedCommand}`
15882
15936
  ].join("\n");
15883
15937
  }
15884
15938
  return [
@@ -15896,7 +15950,7 @@ function buildWorkspaceSurfaceHelpText(options) {
15896
15950
  " zk-agent payment next --request-id <id>",
15897
15951
  " zk-agent payment approval --request-id <id>",
15898
15952
  " zk-agent payment handoff --request-id <id>",
15899
- " zk-agent payment feed"
15953
+ ` ${options.feedCommand}`
15900
15954
  ].join("\n");
15901
15955
  }
15902
15956
  function addWorkspaceSurfaceCommand(command, options) {
@@ -15908,6 +15962,9 @@ function addWorkspaceSurfaceCommand(command, options) {
15908
15962
  buildWorkspaceSurfaceHelpText({
15909
15963
  workspaceCommand: options.workspaceCommand,
15910
15964
  submitCommand: options.submitCommand,
15965
+ approvalCommand: options.approvalCommand,
15966
+ handoffCommand: options.handoffCommand,
15967
+ feedCommand: options.feedCommand,
15911
15968
  topLevel: options.topLevel
15912
15969
  })
15913
15970
  ).action(async (workspaceOptions) => {
@@ -15929,10 +15986,19 @@ function addWorkspaceSurfaceCommand(command, options) {
15929
15986
  });
15930
15987
  const walletName = result.workspace.filters.walletName || "main";
15931
15988
  const submitCommand = options.topLevel ? buildSubmitRecommendedCommand(walletName) : buildPaymentSubmitRecommendedCommand(walletName);
15989
+ const feedCommand = options.topLevel ? buildFeedRecommendedCommand() : buildPaymentFeedRecommendedCommand();
15932
15990
  printResult(
15933
- paymentWorkspaceLines(result.workspace, options.workspaceCommand, submitCommand),
15991
+ paymentWorkspaceLines(
15992
+ result.workspace,
15993
+ options.workspaceCommand,
15994
+ submitCommand,
15995
+ options.topLevel ? buildApprovalRecommendedCommand("<request-id>") : buildPaymentApprovalRecommendedCommand("<request-id>"),
15996
+ options.topLevel ? buildHandoffRecommendedCommand("<request-id>") : buildPaymentHandoffRecommendedCommand("<request-id>"),
15997
+ feedCommand
15998
+ ),
15934
15999
  {
15935
16000
  ok: true,
16001
+ productLayer: buildAgentPayProductLayer("workspace"),
15936
16002
  workspace: {
15937
16003
  ...result.workspace,
15938
16004
  queue: {
@@ -15947,17 +16013,24 @@ function addWorkspaceSurfaceCommand(command, options) {
15947
16013
  recommendedCommands: {
15948
16014
  workspace: options.workspaceCommand,
15949
16015
  ...options.topLevel ? {
16016
+ approval: buildApprovalRecommendedCommand("<request-id>"),
16017
+ paymentApproval: buildPaymentApprovalRecommendedCommand("<request-id>"),
16018
+ handoff: buildHandoffRecommendedCommand("<request-id>"),
16019
+ paymentHandoff: buildPaymentHandoffRecommendedCommand("<request-id>"),
16020
+ feed: buildFeedRecommendedCommand(),
16021
+ paymentFeed: buildPaymentFeedRecommendedCommand(),
15950
16022
  paymentSubmit: buildPaymentSubmitRecommendedCommand(walletName),
15951
16023
  paymentWorkspace: buildPaymentWorkspaceRecommendedCommand()
15952
- } : {},
16024
+ } : {
16025
+ approval: buildPaymentApprovalRecommendedCommand("<request-id>"),
16026
+ handoff: buildPaymentHandoffRecommendedCommand("<request-id>"),
16027
+ feed: buildPaymentFeedRecommendedCommand()
16028
+ },
15953
16029
  dashboard: buildPaymentDashboardRecommendedCommand(),
15954
- feed: buildPaymentFeedRecommendedCommand(),
15955
16030
  queue: buildPaymentQueueRecommendedCommand(),
15956
16031
  report: buildPaymentReportRecommendedCommand(),
15957
16032
  submit: submitCommand,
15958
- next: buildPaymentNextRecommendedCommand("<request-id>"),
15959
- approval: buildPaymentApprovalRecommendedCommand("<request-id>"),
15960
- handoff: buildPaymentHandoffRecommendedCommand("<request-id>")
16033
+ next: buildPaymentNextRecommendedCommand("<request-id>")
15961
16034
  }
15962
16035
  }
15963
16036
  );
@@ -15971,6 +16044,9 @@ function createWorkspaceCommand() {
15971
16044
  {
15972
16045
  workspaceCommand: buildWorkspaceRecommendedCommand(),
15973
16046
  submitCommand: buildSubmitRecommendedCommand(),
16047
+ approvalCommand: buildApprovalRecommendedCommand("<request-id>"),
16048
+ handoffCommand: buildHandoffRecommendedCommand("<request-id>"),
16049
+ feedCommand: buildFeedRecommendedCommand(),
15974
16050
  topLevel: true
15975
16051
  }
15976
16052
  );
@@ -15988,10 +16064,10 @@ function buildSubmitSurfaceHelpText(options) {
15988
16064
  " Common commands:",
15989
16065
  ` ${options.submitCommand}`,
15990
16066
  " zk-agent payment next --request-id <id>",
15991
- " zk-agent payment approval --request-id <id>",
16067
+ " zk-agent approval --request-id <id>",
15992
16068
  " zk-agent workspace",
15993
- " zk-agent payment handoff --request-id <id>",
15994
- " zk-agent payment feed"
16069
+ ` ${options.handoffCommand}`,
16070
+ ` ${options.feedCommand}`
15995
16071
  ].join("\n");
15996
16072
  }
15997
16073
  return [
@@ -16008,7 +16084,7 @@ function buildSubmitSurfaceHelpText(options) {
16008
16084
  " zk-agent payment approval --request-id <id>",
16009
16085
  " zk-agent workspace",
16010
16086
  " zk-agent payment handoff --request-id <id>",
16011
- " zk-agent payment feed"
16087
+ ` ${options.feedCommand}`
16012
16088
  ].join("\n");
16013
16089
  }
16014
16090
  async function executePaymentSubmitSurface(options, topLevel) {
@@ -16042,13 +16118,9 @@ async function executePaymentSubmitSurface(options, topLevel) {
16042
16118
  next: result.next,
16043
16119
  nextCommand,
16044
16120
  recommendedCommands: {
16045
- ...buildPaymentRecommendedCommands(result.paymentRequest, result.executionPlan),
16046
- submit: topLevel ? buildSubmitRecommendedCommand(walletName) : buildPaymentSubmitRecommendedCommand(walletName),
16047
- ...topLevel ? {
16048
- workspace: buildWorkspaceRecommendedCommand(),
16049
- paymentWorkspace: buildPaymentWorkspaceRecommendedCommand(),
16050
- paymentSubmit: buildPaymentSubmitRecommendedCommand(walletName)
16051
- } : {}
16121
+ ...buildPaymentRecommendedCommands(result.paymentRequest, result.executionPlan, {
16122
+ topLevel
16123
+ })
16052
16124
  }
16053
16125
  }
16054
16126
  );
@@ -16061,6 +16133,8 @@ function addSubmitSurfaceCommand(command, options) {
16061
16133
  "after",
16062
16134
  buildSubmitSurfaceHelpText({
16063
16135
  submitCommand: options.submitCommand,
16136
+ handoffCommand: options.handoffCommand,
16137
+ feedCommand: options.feedCommand,
16064
16138
  topLevel: options.topLevel
16065
16139
  })
16066
16140
  ).action(async (submitOptions) => {
@@ -16077,6 +16151,8 @@ function createSubmitCommand() {
16077
16151
  ),
16078
16152
  {
16079
16153
  submitCommand: buildSubmitRecommendedCommand(),
16154
+ handoffCommand: buildHandoffRecommendedCommand("<request-id>"),
16155
+ feedCommand: buildFeedRecommendedCommand(),
16080
16156
  topLevel: true
16081
16157
  }
16082
16158
  );
@@ -16134,8 +16210,16 @@ function paymentDashboardLines(dashboard) {
16134
16210
  }
16135
16211
  return lines;
16136
16212
  }
16137
- function paymentFeedLines(feed) {
16213
+ function paymentFeedLines(feed, options = {}) {
16214
+ const productLayer = buildAgentPayProductLayer("feed");
16215
+ const workspaceCommand = options.workspaceCommand ?? buildPaymentWorkspaceRecommendedCommand();
16216
+ const feedCommand = options.feedCommand ?? buildPaymentFeedRecommendedCommand();
16138
16217
  const lines = [
16218
+ ["product stage", productLayer.stage],
16219
+ ["product claim", productLayer.productClaim],
16220
+ ["surface role", productLayer.surfaceRole],
16221
+ ["platform direction", productLayer.platformDirection],
16222
+ ["boundary", productLayer.boundary],
16139
16223
  ["generated", feed.generatedAt],
16140
16224
  ["source", feed.source],
16141
16225
  ["requests", String(feed.summary.totalRequests)],
@@ -16148,8 +16232,8 @@ function paymentFeedLines(feed) {
16148
16232
  ["awaiting confirmation", String(feed.summary.awaitingConfirmationRequests)],
16149
16233
  ["retryable", String(feed.summary.retryableRequests)],
16150
16234
  ["items shown", String(feed.items.length)],
16151
- ["workspace", buildPaymentWorkspaceRecommendedCommand()],
16152
- ["feed", buildPaymentFeedRecommendedCommand()],
16235
+ ["workspace", workspaceCommand],
16236
+ ["feed", feedCommand],
16153
16237
  ["dashboard", buildPaymentDashboardRecommendedCommand()],
16154
16238
  ["queue", buildPaymentQueueRecommendedCommand()],
16155
16239
  ["report", buildPaymentReportRecommendedCommand()]
@@ -16172,6 +16256,273 @@ function paymentFeedLines(feed) {
16172
16256
  }
16173
16257
  return lines;
16174
16258
  }
16259
+ function buildFeedSurfaceHelpText(options) {
16260
+ if (options.topLevel) {
16261
+ return [
16262
+ "",
16263
+ " Public feed shortcut:",
16264
+ " Use this when the current question is already the integration-ready cross-request Agent Pay export.",
16265
+ " This is the top-level shortcut for `zk-agent payment feed`.",
16266
+ " Stay on `workspace` when you still need the broader cross-request Agent Pay workbench.",
16267
+ " Stay on `handoff` when the current question is still one single-request export.",
16268
+ "",
16269
+ " Common commands:",
16270
+ ` ${options.feedCommand}`,
16271
+ ` ${options.workspaceCommand}`,
16272
+ ` ${options.handoffCommand}`,
16273
+ " zk-agent payment dashboard",
16274
+ " zk-agent payment queue",
16275
+ " zk-agent payment report",
16276
+ ` ${options.submitCommand}`
16277
+ ].join("\n");
16278
+ }
16279
+ return [
16280
+ "",
16281
+ " Integration-ready feed surface:",
16282
+ " Use this when you need the stable cross-request Agent Pay batch export for dashboards, agents, or backend ingestion.",
16283
+ " Public shortcut: zk-agent feed.",
16284
+ " Stay on `payment workspace` when you still need the broader cross-request workbench first.",
16285
+ " Stay on `payment handoff` when the current question is still one single-request export.",
16286
+ "",
16287
+ " Common commands:",
16288
+ ` ${options.feedCommand}`,
16289
+ ` ${options.workspaceCommand}`,
16290
+ " zk-agent payment handoff --request-id <id>",
16291
+ " zk-agent payment dashboard",
16292
+ " zk-agent payment queue",
16293
+ " zk-agent payment report",
16294
+ ` ${options.submitCommand}`
16295
+ ].join("\n");
16296
+ }
16297
+ function addFeedSurfaceCommand(command, options) {
16298
+ return command.option("--wallet <name>", "Optional payer wallet filter").option(
16299
+ "--status <status>",
16300
+ "Optional status filter: draft, approval_pending, ready, paid, failed, expired, or cancelled"
16301
+ ).option("--limit <count>", "Optional maximum number of feed items to return").addHelpText(
16302
+ "after",
16303
+ buildFeedSurfaceHelpText({
16304
+ feedCommand: options.feedCommand,
16305
+ workspaceCommand: options.workspaceCommand,
16306
+ handoffCommand: options.handoffCommand,
16307
+ submitCommand: options.submitCommand,
16308
+ topLevel: options.topLevel
16309
+ })
16310
+ ).action(async (feedOptions) => {
16311
+ const statusFilter = feedOptions.status ? resolvePaymentStatus(feedOptions.status) : void 0;
16312
+ const limit = resolvePositiveInteger(feedOptions.limit, "--limit");
16313
+ const result = await buildStoredPaymentRequestsFeed({
16314
+ walletName: feedOptions.wallet,
16315
+ status: statusFilter,
16316
+ limit
16317
+ });
16318
+ const walletName = result.feed.filters.walletName || "main";
16319
+ const workspaceCommand = options.topLevel ? buildWorkspaceRecommendedCommand() : buildPaymentWorkspaceRecommendedCommand();
16320
+ const feedCommand = options.topLevel ? buildFeedRecommendedCommand() : buildPaymentFeedRecommendedCommand();
16321
+ const submitCommand = options.topLevel ? buildSubmitRecommendedCommand(walletName) : buildPaymentSubmitRecommendedCommand(walletName);
16322
+ printResult(
16323
+ paymentFeedLines(result.feed, { workspaceCommand, feedCommand }),
16324
+ {
16325
+ ok: true,
16326
+ productLayer: buildAgentPayProductLayer("feed"),
16327
+ feed: result.feed,
16328
+ recommendedCommands: {
16329
+ workspace: workspaceCommand,
16330
+ ...options.topLevel ? {
16331
+ handoff: buildHandoffRecommendedCommand("<request-id>"),
16332
+ paymentHandoff: buildPaymentHandoffRecommendedCommand("<request-id>"),
16333
+ feed: buildFeedRecommendedCommand(),
16334
+ paymentFeed: buildPaymentFeedRecommendedCommand(),
16335
+ paymentWorkspace: buildPaymentWorkspaceRecommendedCommand(),
16336
+ paymentSubmit: buildPaymentSubmitRecommendedCommand(walletName)
16337
+ } : {
16338
+ feed: buildPaymentFeedRecommendedCommand()
16339
+ },
16340
+ dashboard: buildPaymentDashboardRecommendedCommand(),
16341
+ queue: buildPaymentQueueRecommendedCommand(),
16342
+ report: buildPaymentReportRecommendedCommand(),
16343
+ submit: submitCommand
16344
+ }
16345
+ }
16346
+ );
16347
+ });
16348
+ }
16349
+ function createFeedCommand() {
16350
+ return addFeedSurfaceCommand(
16351
+ new Command7("feed").description(
16352
+ "Public shortcut for the integration-ready cross-request Agent Pay feed export"
16353
+ ),
16354
+ {
16355
+ feedCommand: buildFeedRecommendedCommand(),
16356
+ workspaceCommand: buildWorkspaceRecommendedCommand(),
16357
+ handoffCommand: buildHandoffRecommendedCommand("<request-id>"),
16358
+ submitCommand: buildSubmitRecommendedCommand(),
16359
+ topLevel: true
16360
+ }
16361
+ );
16362
+ }
16363
+ function buildHandoffSurfaceHelpText(options) {
16364
+ if (options.topLevel) {
16365
+ return [
16366
+ "",
16367
+ " Public handoff shortcut:",
16368
+ " Use this when the current question is already the stable single-request Agent Pay export.",
16369
+ " This is the top-level shortcut for `zk-agent payment handoff`.",
16370
+ " Stay on `workspace` when you still need the broader cross-request Agent Pay workbench.",
16371
+ " Stay on `feed` when the current question has already widened to the cross-request batch export.",
16372
+ "",
16373
+ " Common commands:",
16374
+ ` ${options.handoffCommand}`,
16375
+ ` ${options.workspaceCommand}`,
16376
+ ` ${options.feedCommand}`,
16377
+ " zk-agent payment inspect --request-id <id>",
16378
+ " zk-agent payment parties --request-id <id>",
16379
+ " zk-agent payment share --request-id <id>",
16380
+ " zk-agent payment settlement --request-id <id>"
16381
+ ].join("\n");
16382
+ }
16383
+ return [
16384
+ "",
16385
+ " Integration-ready handoff surface:",
16386
+ " Use this when you need one stable local-first Agent Pay export bundle for an external dashboard, agent, or backend.",
16387
+ " Public shortcut: zk-agent handoff.",
16388
+ " Stay on `payment inspect` when you still need the broader single-request aggregate view.",
16389
+ " Stay on `payment share` or `payment parties` when the question has already narrowed to one projection.",
16390
+ "",
16391
+ " Common commands:",
16392
+ ` ${options.handoffCommand}`,
16393
+ " zk-agent payment inspect --request-id <id>",
16394
+ " zk-agent payment parties --request-id <id>",
16395
+ " zk-agent payment share --request-id <id>",
16396
+ " zk-agent payment settlement --request-id <id>",
16397
+ ` ${options.workspaceCommand}`,
16398
+ ` ${options.feedCommand}`
16399
+ ].join("\n");
16400
+ }
16401
+ async function executePaymentHandoffSurface(requestId, topLevel) {
16402
+ const result = await getStoredPaymentRequestHandoff(requestId);
16403
+ printResult(
16404
+ paymentHandoffLines(
16405
+ result.handoff,
16406
+ buildPaymentInspectRecommendedCommand(result.paymentRequest.requestId),
16407
+ buildPaymentPartiesRecommendedCommand(result.paymentRequest.requestId),
16408
+ buildPaymentShareRecommendedCommand(result.paymentRequest.requestId),
16409
+ buildPaymentSettlementRecommendedCommand(result.paymentRequest.requestId)
16410
+ ),
16411
+ {
16412
+ ok: true,
16413
+ requestId: result.paymentRequest.requestId,
16414
+ productLayer: buildAgentPayProductLayer("handoff"),
16415
+ handoff: result.handoff,
16416
+ recommendedCommands: buildPaymentRecommendedCommands(
16417
+ result.paymentRequest,
16418
+ result.executionPlan,
16419
+ { topLevel }
16420
+ )
16421
+ }
16422
+ );
16423
+ }
16424
+ function addHandoffSurfaceCommand(command, options) {
16425
+ return command.requiredOption("--request-id <id>", "Stored payment request id").addHelpText(
16426
+ "after",
16427
+ buildHandoffSurfaceHelpText({
16428
+ handoffCommand: options.handoffCommand,
16429
+ workspaceCommand: options.workspaceCommand,
16430
+ feedCommand: options.feedCommand,
16431
+ topLevel: options.topLevel
16432
+ })
16433
+ ).action(async (optionsWithRequest) => {
16434
+ await executePaymentHandoffSurface(optionsWithRequest.requestId, options.topLevel);
16435
+ });
16436
+ }
16437
+ function createHandoffCommand() {
16438
+ return addHandoffSurfaceCommand(
16439
+ new Command7("handoff").description(
16440
+ "Public shortcut for the stable single-request Agent Pay export bundle"
16441
+ ),
16442
+ {
16443
+ handoffCommand: buildHandoffRecommendedCommand("<request-id>"),
16444
+ workspaceCommand: buildWorkspaceRecommendedCommand(),
16445
+ feedCommand: buildFeedRecommendedCommand(),
16446
+ topLevel: true
16447
+ }
16448
+ );
16449
+ }
16450
+ function buildApprovalSurfaceHelpText(options) {
16451
+ if (options.topLevel) {
16452
+ return [
16453
+ "",
16454
+ " Public approval shortcut:",
16455
+ " Use this when the current question is approval readiness for one stored Agent Pay request.",
16456
+ " This is the top-level shortcut for `zk-agent payment approval`.",
16457
+ " Stay on `workspace` when the question has widened to the cross-request workbench.",
16458
+ " Stay on `handoff` when you already need the stable single-request export bundle.",
16459
+ "",
16460
+ " Common commands:",
16461
+ ` ${options.approvalCommand}`,
16462
+ " zk-agent payment next --request-id <id>",
16463
+ " zk-agent workspace",
16464
+ " zk-agent handoff --request-id <id>",
16465
+ " zk-agent payment sync-approval --request-id <id>"
16466
+ ].join("\n");
16467
+ }
16468
+ return [
16469
+ "",
16470
+ " Approval readiness surface:",
16471
+ " Use this when you need the request-linked wallet approval state before moving back to execution or export.",
16472
+ " Public shortcut: zk-agent approval.",
16473
+ " Stay on `payment sync-approval` when you want to reconcile the local request status with the current wallet approval state.",
16474
+ "",
16475
+ " Common commands:",
16476
+ ` ${options.approvalCommand}`,
16477
+ " zk-agent payment next --request-id <id>",
16478
+ " zk-agent payment sync-approval --request-id <id>",
16479
+ " zk-agent payment inspect --request-id <id>",
16480
+ " zk-agent payment history --request-id <id>"
16481
+ ].join("\n");
16482
+ }
16483
+ async function executePaymentApprovalSurface(requestId, topLevel) {
16484
+ const result = await getStoredPaymentRequestApproval(requestId);
16485
+ const nextCommand = buildPaymentApprovalCommand(result.approval);
16486
+ printResult(
16487
+ paymentApprovalLines({
16488
+ approval: result.approval,
16489
+ nextCommand
16490
+ }),
16491
+ {
16492
+ ok: true,
16493
+ requestId: result.paymentRequest.requestId,
16494
+ approval: result.approval,
16495
+ nextCommand,
16496
+ recommendedCommands: buildPaymentRecommendedCommands(
16497
+ result.paymentRequest,
16498
+ result.executionPlan,
16499
+ { topLevel }
16500
+ )
16501
+ }
16502
+ );
16503
+ }
16504
+ function addApprovalSurfaceCommand(command, options) {
16505
+ return command.requiredOption("--request-id <id>", "Stored payment request id").addHelpText(
16506
+ "after",
16507
+ buildApprovalSurfaceHelpText({
16508
+ approvalCommand: options.approvalCommand,
16509
+ topLevel: options.topLevel
16510
+ })
16511
+ ).action(async (approvalOptions) => {
16512
+ await executePaymentApprovalSurface(approvalOptions.requestId, options.topLevel);
16513
+ });
16514
+ }
16515
+ function createApprovalCommand() {
16516
+ return addApprovalSurfaceCommand(
16517
+ new Command7("approval").description(
16518
+ "Public shortcut for approval readiness on one stored Agent Pay request"
16519
+ ),
16520
+ {
16521
+ approvalCommand: buildApprovalRecommendedCommand("<request-id>"),
16522
+ topLevel: true
16523
+ }
16524
+ );
16525
+ }
16175
16526
  function paymentReportLines(report) {
16176
16527
  const lines = [
16177
16528
  ["generated", report.generatedAt],
@@ -16390,19 +16741,19 @@ function createPaymentCommand() {
16390
16741
  " Fastest proof path:",
16391
16742
  " zk-agent submit --wallet main --to <address> --amount <amount>",
16392
16743
  " zk-agent payment next --request-id <id>",
16393
- " zk-agent payment approval --request-id <id>",
16744
+ " zk-agent approval --request-id <id>",
16394
16745
  " zk-agent workspace",
16395
- " zk-agent payment handoff --request-id <id>",
16396
- " zk-agent payment feed",
16746
+ " zk-agent handoff --request-id <id>",
16747
+ " zk-agent feed",
16397
16748
  " This proves compact ingress -> wallet-aware follow-up -> approval readiness -> cross-request workspace -> integration-ready export.",
16398
16749
  "",
16399
16750
  " Public start here:",
16400
16751
  " zk-agent submit --wallet main --to <address> --amount <amount>",
16401
16752
  " zk-agent workspace",
16402
- " zk-agent payment feed",
16403
- " zk-agent payment approval --request-id <id>",
16753
+ " zk-agent handoff --request-id <id>",
16754
+ " zk-agent feed",
16755
+ " zk-agent approval --request-id <id>",
16404
16756
  " zk-agent payment next --request-id <id>",
16405
- " zk-agent payment handoff --request-id <id>",
16406
16757
  "",
16407
16758
  " Operator views when the request layer gets broader:",
16408
16759
  " zk-agent payment dashboard",
@@ -16446,10 +16797,10 @@ function createPaymentCommand() {
16446
16797
  " Stored request management:",
16447
16798
  " zk-agent workspace",
16448
16799
  " zk-agent payment dashboard",
16449
- " zk-agent payment feed",
16800
+ " zk-agent feed",
16450
16801
  " zk-agent payment queue",
16451
16802
  " zk-agent payment report",
16452
- " zk-agent payment approval --request-id <id>",
16803
+ " zk-agent approval --request-id <id>",
16453
16804
  " zk-agent payment sync-approval --request-id <id>",
16454
16805
  " zk-agent payment list",
16455
16806
  " zk-agent payment history --request-id <id>",
@@ -16462,6 +16813,8 @@ function createPaymentCommand() {
16462
16813
  ),
16463
16814
  {
16464
16815
  submitCommand: buildPaymentSubmitRecommendedCommand(),
16816
+ handoffCommand: buildPaymentHandoffRecommendedCommand("<request-id>"),
16817
+ feedCommand: buildPaymentFeedRecommendedCommand(),
16465
16818
  topLevel: false
16466
16819
  }
16467
16820
  );
@@ -16532,6 +16885,9 @@ function createPaymentCommand() {
16532
16885
  {
16533
16886
  workspaceCommand: buildPaymentWorkspaceRecommendedCommand(),
16534
16887
  submitCommand: buildPaymentSubmitRecommendedCommand(),
16888
+ approvalCommand: buildPaymentApprovalRecommendedCommand("<request-id>"),
16889
+ handoffCommand: buildPaymentHandoffRecommendedCommand("<request-id>"),
16890
+ feedCommand: buildPaymentFeedRecommendedCommand(),
16535
16891
  topLevel: false
16536
16892
  }
16537
16893
  )
@@ -16569,32 +16925,20 @@ function createPaymentCommand() {
16569
16925
  }
16570
16926
  });
16571
16927
  });
16572
- payment.command("feed").description(
16573
- "Build the integration-ready feed slice inside the cross-request Agent Pay workspace"
16574
- ).option("--wallet <name>", "Optional payer wallet filter").option(
16575
- "--status <status>",
16576
- "Optional status filter: draft, approval_pending, ready, paid, failed, expired, or cancelled"
16577
- ).option("--limit <count>", "Optional maximum number of feed items to return").action(async (options) => {
16578
- const statusFilter = options.status ? resolvePaymentStatus(options.status) : void 0;
16579
- const limit = resolvePositiveInteger(options.limit, "--limit");
16580
- const result = await buildStoredPaymentRequestsFeed({
16581
- walletName: options.wallet,
16582
- status: statusFilter,
16583
- limit
16584
- });
16585
- printResult(paymentFeedLines(result.feed), {
16586
- ok: true,
16587
- feed: result.feed,
16588
- recommendedCommands: {
16589
- workspace: buildPaymentWorkspaceRecommendedCommand(),
16590
- dashboard: buildPaymentDashboardRecommendedCommand(),
16591
- feed: buildPaymentFeedRecommendedCommand(),
16592
- queue: buildPaymentQueueRecommendedCommand(),
16593
- report: buildPaymentReportRecommendedCommand(),
16594
- submit: buildPaymentSubmitRecommendedCommand()
16928
+ payment.addCommand(
16929
+ addFeedSurfaceCommand(
16930
+ new Command7("feed").description(
16931
+ "Build the integration-ready feed slice inside the cross-request Agent Pay workspace"
16932
+ ),
16933
+ {
16934
+ feedCommand: buildPaymentFeedRecommendedCommand(),
16935
+ workspaceCommand: buildPaymentWorkspaceRecommendedCommand(),
16936
+ handoffCommand: buildPaymentHandoffRecommendedCommand("<request-id>"),
16937
+ submitCommand: buildPaymentSubmitRecommendedCommand(),
16938
+ topLevel: false
16595
16939
  }
16596
- });
16597
- });
16940
+ )
16941
+ );
16598
16942
  payment.command("queue").description(
16599
16943
  "Build the wallet-aware queue slice inside the cross-request Agent Pay workspace"
16600
16944
  ).option("--wallet <name>", "Optional payer wallet filter").option(
@@ -16654,26 +16998,17 @@ function createPaymentCommand() {
16654
16998
  }
16655
16999
  });
16656
17000
  });
16657
- payment.command("approval").description("Inspect linked wallet approval readiness for one stored payment request").requiredOption("--request-id <id>", "Stored payment request id").action(async (options) => {
16658
- const result = await getStoredPaymentRequestApproval(options.requestId);
16659
- const nextCommand = buildPaymentApprovalCommand(result.approval);
16660
- printResult(
16661
- paymentApprovalLines({
16662
- approval: result.approval,
16663
- nextCommand
16664
- }),
17001
+ payment.addCommand(
17002
+ addApprovalSurfaceCommand(
17003
+ new Command7("approval").description(
17004
+ "Inspect linked wallet approval readiness for one stored payment request"
17005
+ ),
16665
17006
  {
16666
- ok: true,
16667
- requestId: result.paymentRequest.requestId,
16668
- approval: result.approval,
16669
- nextCommand,
16670
- recommendedCommands: buildPaymentRecommendedCommands(
16671
- result.paymentRequest,
16672
- result.executionPlan
16673
- )
17007
+ approvalCommand: buildPaymentApprovalRecommendedCommand("<request-id>"),
17008
+ topLevel: false
16674
17009
  }
16675
- );
16676
- });
17010
+ )
17011
+ );
16677
17012
  payment.command("sync-approval").description(
16678
17013
  "Synchronize one stored payment request with the linked wallet approval state"
16679
17014
  ).requiredOption("--request-id <id>", "Stored payment request id").action(async (options) => {
@@ -16845,29 +17180,19 @@ function createPaymentCommand() {
16845
17180
  }
16846
17181
  );
16847
17182
  });
16848
- payment.command("handoff").description(
16849
- "Render one stored payment request as an integration-ready bundle for external dashboards, agents, or backend ingestion"
16850
- ).requiredOption("--request-id <id>", "Stored payment request id").action(async (options) => {
16851
- const result = await getStoredPaymentRequestHandoff(options.requestId);
16852
- printResult(
16853
- paymentHandoffLines(
16854
- result.handoff,
16855
- buildPaymentInspectRecommendedCommand(result.paymentRequest.requestId),
16856
- buildPaymentPartiesRecommendedCommand(result.paymentRequest.requestId),
16857
- buildPaymentShareRecommendedCommand(result.paymentRequest.requestId),
16858
- buildPaymentSettlementRecommendedCommand(result.paymentRequest.requestId)
17183
+ payment.addCommand(
17184
+ addHandoffSurfaceCommand(
17185
+ new Command7("handoff").description(
17186
+ "Render one stored payment request as an integration-ready bundle for external dashboards, agents, or backend ingestion"
16859
17187
  ),
16860
17188
  {
16861
- ok: true,
16862
- requestId: result.paymentRequest.requestId,
16863
- handoff: result.handoff,
16864
- recommendedCommands: buildPaymentRecommendedCommands(
16865
- result.paymentRequest,
16866
- result.executionPlan
16867
- )
17189
+ handoffCommand: buildPaymentHandoffRecommendedCommand("<request-id>"),
17190
+ workspaceCommand: buildPaymentWorkspaceRecommendedCommand(),
17191
+ feedCommand: buildPaymentFeedRecommendedCommand(),
17192
+ topLevel: false
16868
17193
  }
16869
- );
16870
- });
17194
+ )
17195
+ );
16871
17196
  payment.command("parties").description("Render one stored payment request as a stable request parties model").requiredOption("--request-id <id>", "Stored payment request id").action(async (options) => {
16872
17197
  const result = await getStoredPaymentRequestParties(options.requestId);
16873
17198
  printResult(
@@ -17369,6 +17694,8 @@ function buildOperatorSuitePayload(options = {}) {
17369
17694
  const paymentCommand = buildPaymentSubmitRecommendedCommand(walletName);
17370
17695
  const publicPaymentCommand = buildSubmitRecommendedCommand(walletName);
17371
17696
  const publicWorkspaceCommand = buildWorkspaceRecommendedCommand();
17697
+ const publicHandoffCommand = buildHandoffRecommendedCommand("<request-id>");
17698
+ const publicFeedCommand = buildFeedRecommendedCommand();
17372
17699
  const paymasterCommand = buildWorkflowPayRecommendedCommand(walletName, "approval-based");
17373
17700
  const fundingCommand = buildWorkflowFundRecommendedCommand(walletName);
17374
17701
  const nextCommand = buildTopLevelNextRecommendedCommand(void 0, void 0, walletName);
@@ -17599,10 +17926,10 @@ function buildOperatorSuitePayload(options = {}) {
17599
17926
  return [
17600
17927
  publicPaymentCommand,
17601
17928
  buildPaymentNextRecommendedCommand("<request-id>"),
17602
- buildPaymentApprovalRecommendedCommand("<request-id>"),
17929
+ buildApprovalRecommendedCommand("<request-id>"),
17603
17930
  publicWorkspaceCommand,
17604
- buildPaymentHandoffRecommendedCommand("<request-id>"),
17605
- buildPaymentFeedRecommendedCommand()
17931
+ publicHandoffCommand,
17932
+ publicFeedCommand
17606
17933
  ];
17607
17934
  case "inspect-before-acting":
17608
17935
  case "unstick-a-write":
@@ -17760,6 +18087,16 @@ function buildOperatorSuitePayload(options = {}) {
17760
18087
  proofPath: slices[4].proofPath ?? [slices[4].primaryCommand]
17761
18088
  }
17762
18089
  ];
18090
+ const platformLayer = {
18091
+ stage: "local-first-product-shell",
18092
+ productClaim: "flagship pay, Agent Pay request routing, and hosted approval recovery already read like one product shell",
18093
+ flagshipSurface: publicFlagshipCommand,
18094
+ agentPaySurface: `${publicPaymentCommand} -> ${buildApprovalRecommendedCommand("<request-id>")} -> ${publicWorkspaceCommand} -> ${publicHandoffCommand} -> ${publicFeedCommand}`,
18095
+ hostedRecoverySurface: hostedRelayBaselineCommand,
18096
+ proofSurfaceIds: proofPaths.map((entry) => entry.id),
18097
+ nextMaturityTarget: "add one stronger hosted/platform-facing proof surface above the current local-first request workbench",
18098
+ boundary: "local-first by default today; Agent Pay is not yet a hosted multi-tenant control plane"
18099
+ };
17763
18100
  return {
17764
18101
  ok: true,
17765
18102
  summary: {
@@ -17779,6 +18116,7 @@ function buildOperatorSuitePayload(options = {}) {
17779
18116
  recommendedOrder: [flagship.id, ...slices.map((entry) => entry.id)],
17780
18117
  nextAction: flagship.primaryCommand
17781
18118
  },
18119
+ platformLayer,
17782
18120
  ...preflight ? { preflight } : {},
17783
18121
  recommendedJourney,
17784
18122
  proofPaths,
@@ -17797,7 +18135,10 @@ function buildOperatorSuitePayload(options = {}) {
17797
18135
  payment: paymentCommand,
17798
18136
  publicFlagship: publicFlagshipCommand,
17799
18137
  publicPayment: publicPaymentCommand,
18138
+ publicApproval: buildApprovalRecommendedCommand("<request-id>"),
17800
18139
  publicWorkspace: publicWorkspaceCommand,
18140
+ publicHandoff: publicHandoffCommand,
18141
+ publicFeed: publicFeedCommand,
17801
18142
  discovery: discoveryCommand,
17802
18143
  paymaster: paymasterCommand,
17803
18144
  funding: fundingCommand,
@@ -17821,7 +18162,7 @@ function operatorSuiteLines(payload) {
17821
18162
  return entry.supportingCommands;
17822
18163
  }
17823
18164
  return entry.supportingCommands.map(
17824
- (command) => command === buildPaymentWorkspaceRecommendedCommand() ? payload.recommendedCommands.publicWorkspace ?? command : command
18165
+ (command) => command === buildPaymentApprovalRecommendedCommand("<request-id>") ? payload.recommendedCommands.publicApproval ?? command : command === buildPaymentWorkspaceRecommendedCommand() ? payload.recommendedCommands.publicWorkspace ?? command : command === buildPaymentHandoffRecommendedCommand("<request-id>") ? payload.recommendedCommands.publicHandoff ?? command : command === buildPaymentFeedRecommendedCommand() ? payload.recommendedCommands.publicFeed ?? command : command
17825
18166
  );
17826
18167
  };
17827
18168
  const renderEntryProofPath = (entry) => {
@@ -17835,9 +18176,18 @@ function operatorSuiteLines(payload) {
17835
18176
  if (command === entry.primaryCommand) {
17836
18177
  return payload.recommendedCommands.publicPayment ?? command;
17837
18178
  }
18179
+ if (command === buildPaymentApprovalRecommendedCommand("<request-id>")) {
18180
+ return payload.recommendedCommands.publicApproval ?? command;
18181
+ }
17838
18182
  if (command === buildPaymentWorkspaceRecommendedCommand()) {
17839
18183
  return payload.recommendedCommands.publicWorkspace ?? command;
17840
18184
  }
18185
+ if (command === buildPaymentHandoffRecommendedCommand("<request-id>")) {
18186
+ return payload.recommendedCommands.publicHandoff ?? command;
18187
+ }
18188
+ if (command === buildPaymentFeedRecommendedCommand()) {
18189
+ return payload.recommendedCommands.publicFeed ?? command;
18190
+ }
17841
18191
  return command;
17842
18192
  });
17843
18193
  };
@@ -17901,6 +18251,14 @@ function operatorSuiteLines(payload) {
17901
18251
  ["chain", payload.summary.chain],
17902
18252
  ["stage", payload.summary.stage],
17903
18253
  ["use when", payload.summary.useWhen],
18254
+ ["platform stage", payload.platformLayer.stage],
18255
+ ["platform claim", payload.platformLayer.productClaim],
18256
+ ["platform flagship surface", payload.platformLayer.flagshipSurface],
18257
+ ["platform agent pay surface", payload.platformLayer.agentPaySurface],
18258
+ ["platform hosted recovery surface", payload.platformLayer.hostedRecoverySurface],
18259
+ ["platform proof surfaces", payload.platformLayer.proofSurfaceIds.join(" -> ")],
18260
+ ["platform next maturity", payload.platformLayer.nextMaturityTarget],
18261
+ ["platform boundary", payload.platformLayer.boundary],
17904
18262
  ["entry modes", payload.summary.entryModes.join(" -> ")],
17905
18263
  ["start here journey", payload.summary.startHereJourneyId],
17906
18264
  ["start here", payload.recommendedJourney.publicStartCommand ?? payload.recommendedJourney.startCommand],
@@ -18000,11 +18358,11 @@ function createSuiteCommand() {
18000
18358
  ` ${buildTopLevelPayRecommendedCommand("main")}`,
18001
18359
  ` ${buildSubmitRecommendedCommand("main")}`,
18002
18360
  " zk-agent payment next --request-id <id>",
18003
- " zk-agent payment approval --request-id <id>",
18361
+ ` ${buildApprovalRecommendedCommand("<id>")}`,
18004
18362
  " zk-agent workspace",
18005
18363
  " zk-agent payment dashboard",
18006
- " zk-agent payment handoff --request-id <id>",
18007
- " zk-agent payment feed",
18364
+ ` ${buildHandoffRecommendedCommand("<id>")}`,
18365
+ ` ${buildFeedRecommendedCommand()}`,
18008
18366
  " zk-agent assets --wallet main",
18009
18367
  ` ${buildTopLevelPayRecommendedCommand("main", "approval-based")}`,
18010
18368
  " zk-agent workflow fund --wallet main",
@@ -18014,7 +18372,7 @@ function createSuiteCommand() {
18014
18372
  " Pass `--include-onboarding` when you want setup, doctor, and wallet bootstrap",
18015
18373
  " guidance in the same packaged readout.",
18016
18374
  "",
18017
- " In JSON mode, `summary.catalogView`, `summary.entryModes`,",
18375
+ " In JSON mode, top-level `platformLayer` plus `summary.catalogView`, `summary.entryModes`,",
18018
18376
  " `summary.startHereJourneyId`, `summary.journeyOrder`,",
18019
18377
  " `summary.surfaceOrder`, top-level `recommendedJourney`, top-level",
18020
18378
  " `proofPaths[]`, top-level `questions[]`, top-level `journeys[]`, top-level `surfaces[]`, `summary.categoryOrder`,",
@@ -18027,14 +18385,14 @@ function createSuiteCommand() {
18027
18385
  " proof routes: flagship pay, Agent Pay, and hosted approval recovery.",
18028
18386
  " Stable machine command fields remain scoped; optional additive",
18029
18387
  " public-read fields may also appear as `publicStartCommand`,",
18030
- " `publicProofPath`, `publicFlagship`, `publicPayment`, and",
18031
- " `publicWorkspace` when the same payload wants a shorter",
18388
+ " `publicProofPath`, `publicFlagship`, `publicPayment`, `publicApproval`, and",
18389
+ " `publicWorkspace`, `publicHandoff`, and `publicFeed` when the same payload wants a shorter",
18032
18390
  " product-facing command layer without breaking the scoped contract.",
18033
18391
  " `proofPath` appears selectively on entries and on the top-level",
18034
18392
  " `recommendedJourney` when one bounded public demo route exists.",
18035
18393
  " `recommendedCommands.workflowSurface|paymentSurface|discoverySurface|relaySurface`",
18036
18394
  " expose the direct deeper-surface entry commands while the optional",
18037
- " `recommendedCommands.publicFlagship|publicPayment|publicWorkspace`",
18395
+ " `recommendedCommands.publicFlagship|publicPayment|publicApproval|publicWorkspace|publicHandoff|publicFeed`",
18038
18396
  " fields expose the shorter public shell."
18039
18397
  ].join("\n")
18040
18398
  ).action((options) => {
@@ -19357,16 +19715,17 @@ function createRelayCommand() {
19357
19715
  [
19358
19716
  "",
19359
19717
  " Relay surface:",
19360
- " Open this layer only when the browser is remote and cannot return to this terminal.",
19718
+ " Use this layer only when the browser is remote and cannot return to this terminal.",
19719
+ " Start with `relay baseline`; open `relay inspect` only when you need the raw public-origin, UI, and hosted-readiness fields directly.",
19361
19720
  " Keep `wallet create|reapprove --await-local` as the default baseline when the browser and terminal are colocated.",
19362
- " Use `relay baseline` for the product-style hosted approval summary; use `relay inspect` when you need the lower-level readiness contract fields directly.",
19363
19721
  "",
19364
- " Fastest hosted recovery proof path:",
19722
+ " Remote-browser fallback:",
19723
+ " existing wallet:",
19365
19724
  " zk-agent relay baseline --relay-url <url>",
19366
19725
  " zk-agent wallet reapprove --name main --relay-url <url> --wait-relay --prompt-code",
19367
19726
  " zk-agent wallet status --name main",
19368
19727
  "",
19369
- " If the wallet does not exist yet:",
19728
+ " no wallet yet:",
19370
19729
  " zk-agent relay baseline --relay-url <url>",
19371
19730
  " zk-agent wallet create --relay-url <url> --wait-relay --prompt-code",
19372
19731
  " zk-agent next",
@@ -19378,11 +19737,7 @@ function createRelayCommand() {
19378
19737
  " one externally reachable public origin",
19379
19738
  " one relay host with same-host file persistence",
19380
19739
  " one same-origin share-link + approval UI surface",
19381
- " Do not assume multi-host or load-balanced durability.",
19382
- "",
19383
- " Use `relay baseline` before sending users to a hosted share link when",
19384
- " you want the packaged public summary and proof paths first.",
19385
- " Use `relay inspect` when the public origin, connector UI, and hosted-readiness contract need direct lower-level inspection."
19740
+ " Not a multi-host or load-balanced service."
19386
19741
  ].join("\n")
19387
19742
  );
19388
19743
  relay.command("baseline").description(
@@ -20206,6 +20561,10 @@ import { Wallet as ZkSyncWallet } from "zksync-ethers";
20206
20561
  var provider3 = new ZkSyncWalletProvider();
20207
20562
  var NATIVE_TOKEN_DECIMALS = 18;
20208
20563
  var LOCAL_APPROVAL_BODY_LIMIT_BYTES = 512 * 1024;
20564
+ var LIVE_RPC_ENV_BY_CHAIN_KEY = {
20565
+ "zksync-era": "ZKSYNC_ERA_RPC_URL",
20566
+ "zksync-sepolia": "ZKSYNC_SEPOLIA_RPC_URL"
20567
+ };
20209
20568
  var WALLET_HELP_COMMAND_ORDER = [
20210
20569
  "create",
20211
20570
  "reapprove",
@@ -21093,16 +21452,16 @@ function applyWalletSyncMetadata(wallet, updates) {
21093
21452
  }
21094
21453
  return nextWallet;
21095
21454
  }
21096
- async function readWalletContract(wallet, data) {
21097
- const result = await provider3.call({
21455
+ async function readWalletContract(wallet, data, syncProvider = provider3) {
21456
+ const result = await syncProvider.call({
21098
21457
  chain: wallet.chain,
21099
21458
  to: wallet.walletAddress,
21100
21459
  data
21101
21460
  });
21102
21461
  return result.result === "0x" ? void 0 : result.result;
21103
21462
  }
21104
- async function syncWalletRecord(wallet, profileOverride) {
21105
- const inspection = await provider3.inspectWallet(wallet);
21463
+ async function syncWalletRecord(wallet, profileOverride, syncProvider = provider3) {
21464
+ const inspection = await syncProvider.inspectWallet(wallet);
21106
21465
  const notes = [];
21107
21466
  const syncedAt = (/* @__PURE__ */ new Date()).toISOString();
21108
21467
  const storedProfileId = tryResolveBuiltinProfileId(wallet.smartAccountProfileId);
@@ -21155,7 +21514,11 @@ async function syncWalletRecord(wallet, profileOverride) {
21155
21514
  notes
21156
21515
  };
21157
21516
  }
21158
- const ownerResult = await readWalletContract(nextWallet, encodeSedLiteOwnerRead());
21517
+ const ownerResult = await readWalletContract(
21518
+ nextWallet,
21519
+ encodeSedLiteOwnerRead(),
21520
+ syncProvider
21521
+ );
21159
21522
  if (!ownerResult) {
21160
21523
  notes.push(`Profile-aware owner read returned empty data for ${profileId}.`);
21161
21524
  } else {
@@ -21164,8 +21527,16 @@ async function syncWalletRecord(wallet, profileOverride) {
21164
21527
  });
21165
21528
  }
21166
21529
  if (profileId === "sed-lite") {
21167
- const validatorResult = await readWalletContract(nextWallet, encodeSedLiteValidatorRead());
21168
- const hooksResult = await readWalletContract(nextWallet, encodeSedLiteValidationHooksRead());
21530
+ const validatorResult = await readWalletContract(
21531
+ nextWallet,
21532
+ encodeSedLiteValidatorRead(),
21533
+ syncProvider
21534
+ );
21535
+ const hooksResult = await readWalletContract(
21536
+ nextWallet,
21537
+ encodeSedLiteValidationHooksRead(),
21538
+ syncProvider
21539
+ );
21169
21540
  nextWallet = applyWalletSyncMetadata(nextWallet, {
21170
21541
  validatorAddress: validatorResult ? decodeSedLiteValidatorRead(validatorResult) : void 0,
21171
21542
  validationHookAddresses: hooksResult ? decodeSedLiteValidationHooksRead(hooksResult) : []
@@ -21191,6 +21562,71 @@ async function syncWalletRecord(wallet, profileOverride) {
21191
21562
  notes
21192
21563
  };
21193
21564
  }
21565
+ function canAutoSyncApprovedWallet(walletRecord, syncProvider) {
21566
+ if (syncProvider && syncProvider !== provider3) {
21567
+ return { ok: true };
21568
+ }
21569
+ let chainKey = walletRecord.chain;
21570
+ try {
21571
+ chainKey = resolveChain(walletRecord.chain).key;
21572
+ } catch {
21573
+ }
21574
+ const envName = LIVE_RPC_ENV_BY_CHAIN_KEY[chainKey];
21575
+ if (!envName) {
21576
+ return {
21577
+ ok: false,
21578
+ reason: "Automatic post-approval wallet sync was skipped because this chain does not have a recognized RPC env override."
21579
+ };
21580
+ }
21581
+ if (!process.env[envName]?.trim()) {
21582
+ return {
21583
+ ok: false,
21584
+ reason: `Automatic post-approval wallet sync was skipped because ${envName} is not configured.`
21585
+ };
21586
+ }
21587
+ return { ok: true };
21588
+ }
21589
+ async function tryAutoSyncApprovedWallet(options) {
21590
+ const eligibility = canAutoSyncApprovedWallet(options.walletRecord, options.syncProvider);
21591
+ if (!eligibility.ok) {
21592
+ return {
21593
+ walletRecord: options.walletRecord,
21594
+ sync: {
21595
+ attempted: false,
21596
+ ok: false,
21597
+ notes: eligibility.reason ? [eligibility.reason] : []
21598
+ }
21599
+ };
21600
+ }
21601
+ try {
21602
+ const result = await syncWalletRecord(
21603
+ options.walletRecord,
21604
+ void 0,
21605
+ options.syncProvider ?? provider3
21606
+ );
21607
+ await saveWalletSession(result.wallet);
21608
+ return {
21609
+ walletRecord: result.wallet,
21610
+ sync: {
21611
+ attempted: true,
21612
+ ok: true,
21613
+ syncedAt: result.wallet.syncedAt,
21614
+ profileId: result.profileId,
21615
+ notes: result.notes
21616
+ }
21617
+ };
21618
+ } catch (error) {
21619
+ return {
21620
+ walletRecord: options.walletRecord,
21621
+ sync: {
21622
+ attempted: true,
21623
+ ok: false,
21624
+ notes: [],
21625
+ error: error instanceof Error && error.message ? error.message : "Automatic post-approval wallet sync failed."
21626
+ }
21627
+ };
21628
+ }
21629
+ }
21194
21630
  function formatDeploymentStatus(inspection) {
21195
21631
  if (inspection.deploymentStatus === "not-applicable") return "n/a";
21196
21632
  return inspection.deploymentStatus;
@@ -21496,6 +21932,7 @@ function buildWalletApprovalLines(status, requestId, walletRecord) {
21496
21932
  ["account", displayAccountKind(walletRecord)],
21497
21933
  ["chain", `${walletRecord.chain} (${walletRecord.chainId})`],
21498
21934
  ["paymaster", displayPaymasterMode(walletRecord)],
21935
+ ...walletRecord.syncedAt ? [["synced", walletRecord.syncedAt]] : [],
21499
21936
  ...sessionPolicyLines(walletRecord.sessionPayload?.permissions),
21500
21937
  ["next", buildWalletNextRecommendedCommand(walletRecord.walletName)],
21501
21938
  ["status command", buildWalletStatusRecommendedCommand(walletRecord.walletName)]
@@ -22005,9 +22442,14 @@ async function finalizePublishedRelayWalletRequest(options) {
22005
22442
  assertApprovedPayloadMatchesRequest(payload, options.walletRequest);
22006
22443
  const walletRecord = await importApprovedWalletSession(options.walletRequest.walletName, payload);
22007
22444
  await deleteWalletRequest(options.walletRequest.requestId);
22445
+ const synced = await tryAutoSyncApprovedWallet({
22446
+ walletRecord,
22447
+ syncProvider: options.syncProvider
22448
+ });
22008
22449
  return {
22009
22450
  payload,
22010
- walletRecord
22451
+ walletRecord: synced.walletRecord,
22452
+ sync: synced.sync
22011
22453
  };
22012
22454
  }
22013
22455
  function writeLocalApprovalJson(response, statusCode, payload) {
@@ -22240,11 +22682,16 @@ async function awaitLocalWalletApproval(options) {
22240
22682
  }, timeoutSeconds * 1e3);
22241
22683
  });
22242
22684
  const { walletRecord, payload } = await Promise.race([completion, timeoutPromise]);
22243
- return {
22685
+ const synced = await tryAutoSyncApprovedWallet({
22244
22686
  walletRecord,
22687
+ syncProvider: options.syncProvider
22688
+ });
22689
+ return {
22690
+ walletRecord: synced.walletRecord,
22245
22691
  payload,
22246
22692
  callbackUrl: callbackUrl.toString(),
22247
- approvalUrl: approvalUrl.toString()
22693
+ approvalUrl: approvalUrl.toString(),
22694
+ sync: synced.sync
22248
22695
  };
22249
22696
  } finally {
22250
22697
  if (timeoutHandle) {
@@ -22537,9 +22984,10 @@ function createWalletCommand(deps) {
22537
22984
  const relayWaitOptions = resolveRelayWaitOptions(options);
22538
22985
  if (options.awaitLocal) {
22539
22986
  const listenerOptions = resolveLocalApprovalListenerOptions(options);
22540
- const { walletRecord, payload, callbackUrl, approvalUrl } = await awaitLocalWalletApproval({
22987
+ const { walletRecord, payload, callbackUrl, approvalUrl, sync } = await awaitLocalWalletApproval({
22541
22988
  walletRequest: request2,
22542
22989
  walletName: request2.walletName,
22990
+ syncProvider: resolvedDeps.provider,
22543
22991
  ...listenerOptions
22544
22992
  });
22545
22993
  printResult(
@@ -22556,6 +23004,7 @@ function createWalletCommand(deps) {
22556
23004
  wallet: sanitizeWalletRecord(walletRecord),
22557
23005
  callbackUrl,
22558
23006
  approvalUrl,
23007
+ sync,
22559
23008
  nextAction: buildWalletFollowUpNextAction(walletRecord),
22560
23009
  recommendedCommands: buildWalletFollowUpRecommendedCommands(walletRecord)
22561
23010
  }
@@ -22581,8 +23030,9 @@ function createWalletCommand(deps) {
22581
23030
  )
22582
23031
  });
22583
23032
  }
22584
- const { payload, walletRecord } = await finalizePublishedRelayWalletRequest({
23033
+ const { payload, walletRecord, sync } = await finalizePublishedRelayWalletRequest({
22585
23034
  walletRequest: request2,
23035
+ syncProvider: resolvedDeps.provider,
22586
23036
  ...relayWaitOptions
22587
23037
  });
22588
23038
  printResult(
@@ -22600,6 +23050,7 @@ function createWalletCommand(deps) {
22600
23050
  wallet: sanitizeWalletRecord(walletRecord),
22601
23051
  relay,
22602
23052
  ...relayOutputAliases(relay),
23053
+ sync,
22603
23054
  nextAction: buildWalletFollowUpNextAction(walletRecord),
22604
23055
  recommendedCommands: buildWalletFollowUpRecommendedCommands(walletRecord)
22605
23056
  }
@@ -22737,9 +23188,10 @@ function createWalletCommand(deps) {
22737
23188
  const relayWaitOptions = resolveRelayWaitOptions(options);
22738
23189
  if (options.awaitLocal) {
22739
23190
  const listenerOptions = resolveLocalApprovalListenerOptions(options);
22740
- const { walletRecord: approvedWallet, payload, callbackUrl, approvalUrl } = await awaitLocalWalletApproval({
23191
+ const { walletRecord: approvedWallet, payload, callbackUrl, approvalUrl, sync } = await awaitLocalWalletApproval({
22741
23192
  walletRequest: request2,
22742
23193
  walletName: request2.walletName,
23194
+ syncProvider: resolvedDeps.provider,
22743
23195
  ...listenerOptions
22744
23196
  });
22745
23197
  printResult(
@@ -22756,6 +23208,7 @@ function createWalletCommand(deps) {
22756
23208
  wallet: sanitizeWalletRecord(approvedWallet),
22757
23209
  callbackUrl,
22758
23210
  approvalUrl,
23211
+ sync,
22759
23212
  nextAction: buildWalletFollowUpNextAction(approvedWallet),
22760
23213
  recommendedCommands: buildWalletFollowUpRecommendedCommands(approvedWallet)
22761
23214
  }
@@ -22781,8 +23234,9 @@ function createWalletCommand(deps) {
22781
23234
  )
22782
23235
  });
22783
23236
  }
22784
- const { payload, walletRecord: approvedWallet } = await finalizePublishedRelayWalletRequest({
23237
+ const { payload, walletRecord: approvedWallet, sync } = await finalizePublishedRelayWalletRequest({
22785
23238
  walletRequest: request2,
23239
+ syncProvider: resolvedDeps.provider,
22786
23240
  ...relayWaitOptions
22787
23241
  });
22788
23242
  printResult(
@@ -22800,6 +23254,7 @@ function createWalletCommand(deps) {
22800
23254
  wallet: sanitizeWalletRecord(approvedWallet),
22801
23255
  relay,
22802
23256
  ...relayOutputAliases(relay),
23257
+ sync,
22803
23258
  nextAction: buildWalletFollowUpNextAction(approvedWallet),
22804
23259
  recommendedCommands: buildWalletFollowUpRecommendedCommands(approvedWallet)
22805
23260
  }
@@ -23236,9 +23691,10 @@ function createWalletCommand(deps) {
23236
23691
  const walletRequest = await requireActiveWalletRequest(options.requestId);
23237
23692
  const walletName = options.name || walletRequest.walletName;
23238
23693
  const listenerOptions = resolveLocalApprovalListenerOptions(options);
23239
- const { walletRecord, payload, callbackUrl, approvalUrl } = await awaitLocalWalletApproval({
23694
+ const { walletRecord, payload, callbackUrl, approvalUrl, sync } = await awaitLocalWalletApproval({
23240
23695
  walletRequest,
23241
23696
  walletName,
23697
+ syncProvider: resolvedDeps.provider,
23242
23698
  ...listenerOptions
23243
23699
  });
23244
23700
  printResult(buildWalletApprovalLines("Wallet request approved via local connector callback", walletRequest.requestId, walletRecord), {
@@ -23249,6 +23705,7 @@ function createWalletCommand(deps) {
23249
23705
  wallet: sanitizeWalletRecord(walletRecord),
23250
23706
  callbackUrl,
23251
23707
  approvalUrl,
23708
+ sync,
23252
23709
  nextAction: buildWalletFollowUpNextAction(walletRecord),
23253
23710
  recommendedCommands: buildWalletFollowUpRecommendedCommands(walletRecord)
23254
23711
  });
@@ -23413,21 +23870,26 @@ function createWalletCommand(deps) {
23413
23870
  assertApprovedPayloadMatchesRequest(payload, walletRequest);
23414
23871
  const walletRecord = await importApprovedWalletSession(walletRequest.walletName, payload);
23415
23872
  await deleteWalletRequest(walletRequest.requestId);
23873
+ const synced = await tryAutoSyncApprovedWallet({
23874
+ walletRecord,
23875
+ syncProvider: resolvedDeps.provider
23876
+ });
23416
23877
  printResult(
23417
23878
  buildWalletApprovalLines(
23418
23879
  options.payload ? "Wallet request approved from connector payload" : "Wallet request approved from encrypted relay payload",
23419
23880
  walletRequest.requestId,
23420
- walletRecord
23881
+ synced.walletRecord
23421
23882
  ),
23422
23883
  {
23423
23884
  ok: true,
23424
23885
  walletRequestId: walletRequest.requestId,
23425
23886
  request: sanitizeWalletRequestRecord(walletRequest),
23426
23887
  payload: sanitizeSessionPayload(payload),
23427
- wallet: sanitizeWalletRecord(walletRecord),
23888
+ wallet: sanitizeWalletRecord(synced.walletRecord),
23428
23889
  approvalSource: options.payload ? "payload" : options.encryptedPayload ? "encrypted-payload" : "relay-url",
23429
- nextAction: buildWalletFollowUpNextAction(walletRecord),
23430
- recommendedCommands: buildWalletFollowUpRecommendedCommands(walletRecord)
23890
+ sync: synced.sync,
23891
+ nextAction: buildWalletFollowUpNextAction(synced.walletRecord),
23892
+ recommendedCommands: buildWalletFollowUpRecommendedCommands(synced.walletRecord)
23431
23893
  }
23432
23894
  );
23433
23895
  });
@@ -23458,16 +23920,25 @@ function createWalletCommand(deps) {
23458
23920
  const walletName = options.name || walletRequest.walletName;
23459
23921
  const walletRecord = await importApprovedWalletSession(walletName, payload);
23460
23922
  await deleteWalletRequest(walletRequest.requestId);
23923
+ const synced = await tryAutoSyncApprovedWallet({
23924
+ walletRecord,
23925
+ syncProvider: resolvedDeps.provider
23926
+ });
23461
23927
  printResult(
23462
- buildWalletApprovalLines("Wallet request approved locally", walletRequest.requestId, walletRecord),
23928
+ buildWalletApprovalLines(
23929
+ "Wallet request approved locally",
23930
+ walletRequest.requestId,
23931
+ synced.walletRecord
23932
+ ),
23463
23933
  {
23464
23934
  ok: true,
23465
23935
  walletRequestId: walletRequest.requestId,
23466
23936
  request: sanitizeWalletRequestRecord(walletRequest),
23467
23937
  payload: sanitizeSessionPayload(payload),
23468
- wallet: sanitizeWalletRecord(walletRecord),
23469
- nextAction: buildWalletFollowUpNextAction(walletRecord),
23470
- recommendedCommands: buildWalletFollowUpRecommendedCommands(walletRecord)
23938
+ wallet: sanitizeWalletRecord(synced.walletRecord),
23939
+ sync: synced.sync,
23940
+ nextAction: buildWalletFollowUpNextAction(synced.walletRecord),
23941
+ recommendedCommands: buildWalletFollowUpRecommendedCommands(synced.walletRecord)
23471
23942
  }
23472
23943
  );
23473
23944
  }
@@ -26046,8 +26517,24 @@ function applyWorkflowPayDefaults(options) {
26046
26517
  createCheckpoint: true,
26047
26518
  executeWhenReady: true,
26048
26519
  ensureWalletSession: true,
26049
- sessionPreset: options.sessionPreset?.trim() || "intent",
26050
- paymasterMode: options.paymasterMode?.trim() || "approval-based"
26520
+ sessionPreset: options.sessionPreset?.trim() || "intent"
26521
+ };
26522
+ }
26523
+ async function applyWorkflowPayRuntimeDefaults(options) {
26524
+ const requestedId = options.requestId?.trim();
26525
+ let walletName = options.wallet;
26526
+ if (requestedId) {
26527
+ const checkpoint = await loadWorkflowCheckpoint(requestedId);
26528
+ if (checkpoint?.walletName) {
26529
+ walletName = checkpoint.walletName;
26530
+ }
26531
+ }
26532
+ const wallet = await requireWalletRecord(walletName || "main");
26533
+ const inheritedPaymasterMode = wallet.sessionPayload?.paymaster?.mode || wallet.paymasterMode || "approval-based";
26534
+ return {
26535
+ ...options,
26536
+ wallet: wallet.walletName,
26537
+ paymasterMode: options.paymasterMode?.trim() || inheritedPaymasterMode
26051
26538
  };
26052
26539
  }
26053
26540
  async function executeWorkflowAutoCommand(options, deps = resolveWorkflowCommandDeps(void 0)) {
@@ -26084,7 +26571,10 @@ async function executeWorkflowAutoCommand(options, deps = resolveWorkflowCommand
26084
26571
  findReusableWalletRequest,
26085
26572
  createWalletReapprovalRequest,
26086
26573
  publishWalletRequestToRelay: deps.publishWalletRequestToRelay,
26087
- awaitLocalWalletApproval,
26574
+ awaitLocalWalletApproval: (options2) => awaitLocalWalletApproval({
26575
+ ...options2,
26576
+ syncProvider: provider4
26577
+ }),
26088
26578
  inspectWorkflowStatus: async (input) => inspectWorkflowStatus(input, {
26089
26579
  provider: provider4,
26090
26580
  defiProvider: defiProvider2
@@ -26711,7 +27201,10 @@ async function inspectWorkflowExecutionState(options, context, deps = resolveWor
26711
27201
  findReusableWalletRequest,
26712
27202
  createWalletReapprovalRequest,
26713
27203
  publishWalletRequestToRelay: deps.publishWalletRequestToRelay,
26714
- awaitLocalWalletApproval,
27204
+ awaitLocalWalletApproval: (approvalOptions) => awaitLocalWalletApproval({
27205
+ ...approvalOptions,
27206
+ syncProvider: provider4
27207
+ }),
26715
27208
  inspectWorkflowStatus: async (input) => inspectWorkflowStatus(input, {
26716
27209
  provider: provider4,
26717
27210
  defiProvider: defiProvider2
@@ -26864,7 +27357,7 @@ function configureWorkflowPayCommand(command, resolvedDeps, surface) {
26864
27357
  includeLocalApproval: true
26865
27358
  }).action(withWorkflowInputErrorHandling(async (options) => {
26866
27359
  const execution = await executeWorkflowAutoCommand(
26867
- applyWorkflowPayDefaults(options),
27360
+ await applyWorkflowPayRuntimeDefaults(applyWorkflowPayDefaults(options)),
26868
27361
  resolvedDeps
26869
27362
  );
26870
27363
  await printWorkflowAutoCommandResult(execution, "pay");
@@ -27543,25 +28036,44 @@ function buildDefaultOperatorPathHelpText() {
27543
28036
  " zkSync-native smart-account and paymaster path centered on sed-lite",
27544
28037
  " Agent Pay request capture and follow-up surface around the same wallet runtime",
27545
28038
  "",
28039
+ "Best fit:",
28040
+ " you want wallet and session control to stay local instead of starting with a managed browser product",
28041
+ " you want a zkSync-native pay and paymaster path instead of a generic multichain wrapper",
28042
+ " you want Agent Pay request capture and a workbench on the same wallet runtime",
28043
+ "",
27546
28044
  "What makes zk-agent-cli different:",
27547
28045
  " local-first by default, with hosted approval only as a fallback path",
27548
28046
  " one zkSync-native path from wallet readiness to paymaster-aware execution",
27549
28047
  " one Agent Pay layer that stays attached to the same wallet runtime instead of splitting into a separate product",
27550
28048
  "",
28049
+ "Current boundary:",
28050
+ " hosted relay is a fallback path, not the default onboarding story",
28051
+ " Agent Pay is a local-first workbench today, not a hosted multi-tenant control plane",
28052
+ "",
28053
+ "First command map:",
28054
+ " clean machine bootstrap -> zk-agent setup",
28055
+ " public first touch after setup -> zk-agent start",
28056
+ " canonical live routing contract -> zk-agent next",
28057
+ " if config is missing, start and next send you back to setup first",
28058
+ "",
27551
28059
  "Why Agent Pay instead of only direct execution:",
27552
28060
  " capture one request before or after the write path",
27553
28061
  " keep a cross-request operator workspace around the same wallet runtime",
27554
28062
  " export stable handoff and feed views for external agents, dashboards, or backends",
27555
28063
  " current request ingress: zk-agent submit",
27556
28064
  " current workbench anchor: zk-agent workspace",
28065
+ " current single-request export: zk-agent handoff --request-id <id>",
28066
+ " current export surface: zk-agent feed",
27557
28067
  "",
27558
- "Start here first:",
28068
+ "First proof from a clean machine:",
27559
28069
  " zk-agent setup",
27560
28070
  " zk-agent next",
27561
28071
  " zk-agent wallet create --await-local",
27562
28072
  " zk-agent next",
27563
28073
  ` ${buildTopLevelPayRecommendedCommand("main")}`,
27564
- " Stop after the first successful workflow pay.",
28074
+ " Stop after the first successful pay.",
28075
+ " Approved wallets auto-sync local smart-account metadata when chain reads are available,",
28076
+ " so the default path does not depend on a separate manual wallet sync.",
27565
28077
  "",
27566
28078
  "Before that first success:",
27567
28079
  " Ignore suite, payment, and relay unless the CLI points you there or the browser is remote.",
@@ -27572,7 +28084,10 @@ function buildDefaultOperatorPathHelpText() {
27572
28084
  " pay -> the wallet is ready and you want the flagship proof path now",
27573
28085
  " submit -> you want to capture one Agent Pay request now",
27574
28086
  " suite -> wallet readiness is clear and the question is broader than one immediate send",
28087
+ " approval -> you need approval readiness for one Agent Pay request",
27575
28088
  " workspace -> you already know you need the current Agent Pay workbench anchor",
28089
+ " handoff -> you already need the stable single-request Agent Pay export",
28090
+ " feed -> you already need the integration-ready cross-request Agent Pay export",
27576
28091
  " payment -> execution is no longer the whole story and you need the Agent Pay request layer or workbench",
27577
28092
  " relay baseline -> the browser is remote and approval must move to the hosted fallback path",
27578
28093
  "",
@@ -27584,10 +28099,10 @@ function buildDefaultOperatorPathHelpText() {
27584
28099
  " Agent Pay requests:",
27585
28100
  ` ${buildSubmitRecommendedCommand("main")}`,
27586
28101
  " zk-agent payment next --request-id <id>",
27587
- " zk-agent payment approval --request-id <id>",
28102
+ ` ${buildApprovalRecommendedCommand("<id>")}`,
27588
28103
  " zk-agent workspace",
27589
- " zk-agent payment handoff --request-id <id>",
27590
- " zk-agent payment feed",
28104
+ " zk-agent handoff --request-id <id>",
28105
+ " zk-agent feed",
27591
28106
  " hosted approval recovery:",
27592
28107
  " zk-agent relay baseline --relay-url <url>",
27593
28108
  " zk-agent wallet reapprove --name main --relay-url <url> --wait-relay --prompt-code",
@@ -27596,7 +28111,10 @@ function buildDefaultOperatorPathHelpText() {
27596
28111
  "Open these only when the default path is no longer the whole question:",
27597
28112
  " zk-agent suite",
27598
28113
  ` ${buildSubmitRecommendedCommand("main")}`,
28114
+ ` ${buildApprovalRecommendedCommand("<id>")}`,
27599
28115
  " zk-agent workspace",
28116
+ " zk-agent handoff --request-id <id>",
28117
+ " zk-agent feed",
27600
28118
  " zk-agent suite --include-onboarding",
27601
28119
  " zk-agent doctor",
27602
28120
  " zk-agent next --request-id <id>",
@@ -27619,12 +28137,15 @@ var ROOT_HELP_COMMAND_ORDER = [
27619
28137
  "next",
27620
28138
  "pay",
27621
28139
  "submit",
28140
+ "approval",
27622
28141
  "doctor",
27623
28142
  "init",
27624
28143
  "wallet",
27625
28144
  "workflow",
27626
28145
  "suite",
27627
28146
  "workspace",
28147
+ "handoff",
28148
+ "feed",
27628
28149
  "payment",
27629
28150
  "assets",
27630
28151
  "balances",
@@ -27669,11 +28190,14 @@ function createProgram() {
27669
28190
  program.addCommand(createNextCommand());
27670
28191
  program.addCommand(createPayCommand());
27671
28192
  program.addCommand(createSubmitCommand());
28193
+ program.addCommand(createApprovalCommand());
27672
28194
  program.addCommand(createDoctorCommand());
27673
28195
  program.addCommand(createAgentCommand());
27674
28196
  program.addCommand(createDefaultsCommand());
27675
28197
  program.addCommand(createSuiteCommand());
27676
28198
  program.addCommand(createWorkspaceCommand());
28199
+ program.addCommand(createHandoffCommand());
28200
+ program.addCommand(createFeedCommand());
27677
28201
  program.addCommand(createPaymentCommand());
27678
28202
  program.addCommand(createTokensCommand());
27679
28203
  program.addCommand(createResolveTokenCommand());