@c4roa0/agentpay-user 0.0.0-stage → 0.3.1

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 (175) hide show
  1. package/AGENTS.md +137 -0
  2. package/CONTRIBUTING.md +16 -0
  3. package/LICENSE +373 -0
  4. package/NOTICE.md +20 -0
  5. package/README.md +85 -2
  6. package/SECURITY.md +16 -0
  7. package/doc/README.md +52 -0
  8. package/doc/TODO.md +107 -0
  9. package/doc/architecture.md +99 -0
  10. package/doc/design.md +60 -0
  11. package/doc/develope.md +68 -0
  12. package/doc/plans/user-wallet-distribution.md +91 -0
  13. package/doc/reference/harness-skill-runtime.md +120 -0
  14. package/doc/reference/local-cache-foundation.md +176 -0
  15. package/doc/reference/local-safe-owner-ui.md +25 -0
  16. package/doc/reference/local-update.md +18 -0
  17. package/doc/reference/multi-service-runtime.md +119 -0
  18. package/doc/reference/npm-integration-verification.md +103 -0
  19. package/doc/reference/onboarding-writing.md +48 -0
  20. package/doc/reference/original-order-recovery.md +97 -0
  21. package/doc/reference/private-anvil-onboarding-config.example.json +18 -0
  22. package/doc/reference/public-deployment-settings.md +56 -0
  23. package/doc/reference/random-skill-contract.md +18 -0
  24. package/doc/reference/result-file-cache.md +166 -0
  25. package/doc/reference/runtime-address-recovery.md +42 -0
  26. package/doc/reference/runtime-result-cache.md +157 -0
  27. package/doc/reference/runtime-startup-recovery.md +141 -0
  28. package/doc/reference/skill-input-output-cache.md +93 -0
  29. package/doc/reference/wallet-identity-policy-history.md +23 -0
  30. package/doc/runbooks/commands.md +103 -0
  31. package/doc/runbooks/deployment-authorization-update.md +42 -0
  32. package/doc/runbooks/emergency-payment-stop.md +80 -0
  33. package/doc/runbooks/local-autostart.md +212 -0
  34. package/doc/runbooks/local-cache.md +115 -0
  35. package/doc/runbooks/local-update.md +84 -0
  36. package/doc/runbooks/market-connection.md +73 -0
  37. package/doc/runbooks/npm-publication.md +56 -0
  38. package/doc/runbooks/official-test-package.md +62 -0
  39. package/doc/runbooks/order-cancellation.md +56 -0
  40. package/doc/runbooks/order-support.md +41 -0
  41. package/doc/runbooks/policy-renewal.md +80 -0
  42. package/doc/runbooks/private-anvil-terminal-setup.md +58 -0
  43. package/doc/runbooks/runtime-skill-client.md +155 -0
  44. package/doc/runbooks/safe-owner-web.md +104 -0
  45. package/doc/runbooks/safe-policy-migration.md +36 -0
  46. package/doc/runbooks/safe-policy-setup.md +52 -0
  47. package/doc/runbooks/terminal-authorization-preview.md +38 -0
  48. package/doc/runbooks/unlock-wallet.md +68 -0
  49. package/doc/runbooks/user-onboarding.md +87 -0
  50. package/doc/runbooks/wallet-identity.md +59 -0
  51. package/doc/security/public-source-review-2026-11-06.md +71 -0
  52. package/doc/usage.md +54 -0
  53. package/package.json +49 -4
  54. package/progress.md +210 -0
  55. package/run +29 -0
  56. package/scripts/agentpay-cli.mjs +11 -0
  57. package/scripts/authorize-existing-safe.mjs +211 -0
  58. package/scripts/autostart.mjs +186 -0
  59. package/scripts/cancel-order.mjs +76 -0
  60. package/scripts/check-installation.mjs +26 -0
  61. package/scripts/check-official-test-package.mjs +35 -0
  62. package/scripts/check-purchase-readiness.mjs +275 -0
  63. package/scripts/configure-runtime-client.mjs +16 -0
  64. package/scripts/guide-policy.mjs +64 -0
  65. package/scripts/initialize-caller-credential.mjs +11 -0
  66. package/scripts/install-skill-bundle.mjs +176 -0
  67. package/scripts/install-user.mjs +24 -0
  68. package/scripts/local-service.mjs +60 -0
  69. package/scripts/lock.mjs +11 -0
  70. package/scripts/login-notify.mjs +39 -0
  71. package/scripts/migrate-safe-policy.mjs +165 -0
  72. package/scripts/official-paid-test.mjs +9 -0
  73. package/scripts/poll-unconfirmed-notice.mjs +75 -0
  74. package/scripts/prepare-onboarding.mjs +33 -0
  75. package/scripts/preview-policy.mjs +65 -0
  76. package/scripts/random-model-ack-smoke.mjs +235 -0
  77. package/scripts/random-reject-smoke.mjs +147 -0
  78. package/scripts/renew.mjs +9 -0
  79. package/scripts/repair.mjs +10 -0
  80. package/scripts/revoke.mjs +9 -0
  81. package/scripts/select-skill-bundle.mjs +39 -0
  82. package/scripts/setup-local.mjs +199 -0
  83. package/scripts/status.mjs +13 -0
  84. package/scripts/test-package.mjs +35 -0
  85. package/scripts/unlock.mjs +13 -0
  86. package/scripts/update.mjs +7 -0
  87. package/scripts/user-setup.mjs +219 -0
  88. package/scripts/verify-npm-release.mjs +32 -0
  89. package/src/active-skill.mjs +160 -0
  90. package/src/anvil-onboarding-state.mjs +96 -0
  91. package/src/anvil-onboarding.mjs +1036 -0
  92. package/src/authorization-question-checkpoint.mjs +114 -0
  93. package/src/autostart-files.mjs +50 -0
  94. package/src/cache-management-cli.mjs +302 -0
  95. package/src/cache-management.mjs +47 -0
  96. package/src/caller-auth.mjs +58 -0
  97. package/src/client-request-lock.mjs +44 -0
  98. package/src/connect-market.mjs +408 -0
  99. package/src/demo-unlock-secret.mjs +64 -0
  100. package/src/deployment-status.mjs +198 -0
  101. package/src/file-cache-cli.mjs +83 -0
  102. package/src/file-cache-owner.mjs +74 -0
  103. package/src/file-cache-settings.mjs +50 -0
  104. package/src/file-cache.mjs +790 -0
  105. package/src/file-download.mjs +281 -0
  106. package/src/finalization-disclosure.mjs +16 -0
  107. package/src/guided-setup.mjs +194 -0
  108. package/src/index.mjs +1233 -0
  109. package/src/install-and-setup.mjs +38 -0
  110. package/src/install-preflight.mjs +201 -0
  111. package/src/install-user.mjs +279 -0
  112. package/src/installation-paths.mjs +31 -0
  113. package/src/invocation-result.mjs +148 -0
  114. package/src/invocation-store.mjs +385 -0
  115. package/src/local-data-directory.mjs +117 -0
  116. package/src/local-info.mjs +181 -0
  117. package/src/local-services.mjs +156 -0
  118. package/src/local-time.mjs +36 -0
  119. package/src/local-update.mjs +316 -0
  120. package/src/local-wallet-ipc.mjs +93 -0
  121. package/src/login-reminder.mjs +28 -0
  122. package/src/market-download-url.mjs +21 -0
  123. package/src/node-version.mjs +12 -0
  124. package/src/npm-update.mjs +126 -0
  125. package/src/official-paid-test.mjs +407 -0
  126. package/src/official-test-package.mjs +41 -0
  127. package/src/official-test-update.mjs +162 -0
  128. package/src/order-cancellation.mjs +241 -0
  129. package/src/order-closure.mjs +42 -0
  130. package/src/order-list-panel.mjs +110 -0
  131. package/src/order-review.mjs +424 -0
  132. package/src/order-status-panel.mjs +65 -0
  133. package/src/order-support.mjs +365 -0
  134. package/src/owner-approval-server.mjs +332 -0
  135. package/src/owner-signer.mjs +67 -0
  136. package/src/policy-info.mjs +38 -0
  137. package/src/policy-migration.mjs +84 -0
  138. package/src/policy-operations.mjs +67 -0
  139. package/src/policy-preview-server.mjs +236 -0
  140. package/src/policy-terminal-guide.mjs +377 -0
  141. package/src/prepare-local-services.mjs +143 -0
  142. package/src/prepare-onboarding.mjs +210 -0
  143. package/src/private-journal-files.mjs +29 -0
  144. package/src/protocol-package.mjs +25 -0
  145. package/src/readiness-profile.mjs +30 -0
  146. package/src/renew-policy.mjs +605 -0
  147. package/src/repair-market-wallet.mjs +137 -0
  148. package/src/restore-wallet.mjs +255 -0
  149. package/src/result-cache-view.mjs +276 -0
  150. package/src/runtime-client.mjs +1145 -0
  151. package/src/runtime-connection-settings.mjs +101 -0
  152. package/src/runtime-recovery.mjs +667 -0
  153. package/src/runtime-status.mjs +32 -0
  154. package/src/safe-owner-anvil.mjs +115 -0
  155. package/src/safe-policy-plan.mjs +195 -0
  156. package/src/service-reference.mjs +233 -0
  157. package/src/service-url.mjs +52 -0
  158. package/src/settlement-response.mjs +69 -0
  159. package/src/setup-autostart.mjs +197 -0
  160. package/src/setup-demo.mjs +152 -0
  161. package/src/skill-bundle.mjs +142 -0
  162. package/src/skill-client.mjs +198 -0
  163. package/src/skill-install-prompt.mjs +31 -0
  164. package/src/skill-package.mjs +50 -0
  165. package/src/skill-zip.mjs +220 -0
  166. package/src/software-versions.mjs +48 -0
  167. package/src/status-panel.mjs +603 -0
  168. package/src/transport.mjs +48 -0
  169. package/src/uninstall-local.mjs +299 -0
  170. package/src/user-cli.mjs +354 -0
  171. package/src/user-setup-guide.mjs +193 -0
  172. package/src/wallet-control.mjs +182 -0
  173. package/src/wallet-ipc-error.mjs +16 -0
  174. package/src/wallet-package.mjs +28 -0
  175. package/update-pair.json +6 -0
@@ -0,0 +1,155 @@
1
+ # Call paid services from a Skill
2
+
3
+ Audience: Skill authors and local Agent integrators. Use the common per-call
4
+ Runtime contract; no process-wide Skill selection or business adapter is needed.
5
+ See [service contract](../reference/multi-service-runtime.md). Actual DeepSeek
6
+ Harness/Claude Code discovery and execution remain separate acceptance.
7
+
8
+ ## Local setup
9
+
10
+ Complete User/Wallet setup. The guide saves runtime/connection.json in the private
11
+ User data directory: loopback Runtime URL, caller token file path and installed
12
+ User module location. The token itself never enters a package or model message.
13
+ The default is $HOME/.local/share/agentpay/user; set AGENTPAY_USER_DATA_DIR for a
14
+ custom directory. Keep User installed at its recorded location.
15
+
16
+ Existing developer installations can save discovery from the User repository:
17
+
18
+ ```bash
19
+ node scripts/configure-runtime-client.mjs "$HOME/.local/share/agentpay/user" http://127.0.0.1:6490
20
+ ```
21
+
22
+ This writes local connection metadata only; it does not authorize spending.
23
+
24
+ ## Author package
25
+
26
+ Download Market's Skill template. Fill package identity, copy registered service
27
+ references into services.main and additional aliases, and implement business input
28
+ validation and result interpretation in the wrapper. Keep payment/credentials in
29
+ the installed shared User client. The template text parameter is only an example.
30
+
31
+ ```bash
32
+ node scripts/call-runtime.mjs --check
33
+ node scripts/call-runtime.mjs --invoke '{"text":"hello"}' --units 1
34
+ node scripts/call-runtime.mjs --service second --invoke '{"text":"hello"}'
35
+ ```
36
+
37
+ --check verifies local interface/reference matching; it does not reserve a Quote or
38
+ establish purchase readiness. --units is a maximum, not a price or actual usage.
39
+ Provider business output is application-owned. Verify delivery using the agreed
40
+ evidence contract; do not invent a new output shape or hashing requirement.
41
+
42
+ ## Recovery and explicit new purchase
43
+
44
+ Retry the same input normally. Matching calls recover the same request or reuse
45
+ saved verified output. Use --force only for an explicitly intended additional
46
+ purchase. It never bypasses Policy. Diagnostic --resume <request-id> selects an
47
+ existing request when several unfinished forced calls make automatic selection
48
+ ambiguous. Preserve private checkpoints and invocation history. A lock left during
49
+ local request selection fails closed for inspection; do not delete purchase state
50
+ or automatically force a new request to work around it.
51
+
52
+ ## Release and acceptance
53
+
54
+ The installed User and Wallet dependencies must match their shipped lockfiles.
55
+ Preserve older request identities during upgrades; never reinterpret their routing
56
+ or create replacement purchases. The official paid connectivity suite remains the
57
+ installation acceptance test. Other business payloads are tested with maintained
58
+ controlled fixtures, not third-party Skills.
59
+
60
+ Runtime starts with retained older requests and performs read-only self-checks.
61
+ Unsupported or unknown original scopes remain visible for review; they do not
62
+ become eligible for replacement purchases. Use `./run orders list` and the suggested
63
+ `details`, `status` or `archive` actions. Archiving preserves the request and does
64
+ not establish its financial state. See [original Order recovery](../reference/original-order-recovery.md).
65
+
66
+ ## Optional result files
67
+
68
+ Runtime preserves received structured results; a URL in a result is not a saved
69
+ file. Skills can explicitly cache selected files through the installed client.
70
+ Use the [file-cache interface](../reference/result-file-cache.md) for API examples,
71
+ limits and digest semantics. Users inspect copies with `./run orders files ORDER_ID`.
72
+ File operations never start a new purchase or confirm receipt.
73
+
74
+ ## Transport failures
75
+
76
+ `RUNTIME_TIMEOUT` means the response deadline elapsed; an Order may still be running.
77
+ `RUNTIME_RESPONSE_TOO_LARGE` means the bounded JSON response was exceeded.
78
+ `RUNTIME_RESPONSE_INVALID` means unreadable JSON or failed delivery verification.
79
+ `RUNTIME_UNAVAILABLE` means communication could not finish. Check local status/logs
80
+ as directed and resume the original request. None of these proves non-payment or
81
+ allows replacing a purchase. Binary files use the separate explicit file interface.
82
+
83
+ Provider profiles may use HTTP or HTTPS. Existing requests retain their exact
84
+ registered endpoint/profile. HTTP provides no transport confidentiality; use HTTPS
85
+ when the service requires it. This does not change local Runtime loopback or
86
+ Market/Settlement credential requirements, or package-download validation.
87
+
88
+ ## File inputs and outputs
89
+
90
+ The current installed client provides `skillClientCapabilities` including
91
+ `input-snapshots-v1`. The official Agent template distributed by Market checks it before running. Upgrade User
92
+ and restart Runtime together; older Runtime versions lack original-request recovery.
93
+
94
+ The optional hooks are:
95
+
96
+ ```js
97
+ await runSkill({
98
+ service,
99
+ validateRequest: validateYourBusinessInput,
100
+ inputFiles(input) {
101
+ return [{fileKey: 'document', sourcePath: input.absoluteFilePath,
102
+ filename: 'document.pdf'}];
103
+ },
104
+ async prepareRequest({request, files, requestId}) {
105
+ // Implement YOUR Provider's upload/reference contract using files[].localPath.
106
+ // Use requestId/fileKey to make preparatory uploads idempotent where supported.
107
+ // Return bounded business JSON, not an embedded large binary or a local path
108
+ // that the remote Provider cannot access. Never create/pay Orders here.
109
+ return prepareYourProviderInput(request, files, requestId);
110
+ },
111
+ outputFiles(output) {
112
+ return [{fileKey: 'report', url: output.reportUrl, filename: 'report.pdf'}];
113
+ }
114
+ });
115
+ ```
116
+
117
+ These illustrative business functions are author code, not built-in APIs. JSON-only
118
+ Skills omit the hooks. Input declarations accept either an absolute `sourcePath` or
119
+ an HTTP/HTTPS `url`, plus unique `fileKey`, optional `filename` and SHA-256 `sha256`.
120
+ At most 20 declarations are allowed; local resource limits also apply. No automatic
121
+ path/URL discovery, archive extraction or format restriction is added.
122
+
123
+ The common client saves declarations, snapshots and the final adapted request before
124
+ paid invocation. Retrying after source changes uses original copies. `--resume` never
125
+ reinterprets a submitted request through newly edited business preparation code.
126
+ Use `--force` only for an intentional additional purchase/new input snapshot.
127
+
128
+ Output download failure preserves the verified result and request ID. The command
129
+ returns nonzero with `ok: true` delivery and `fileCache.state: incomplete`; retry the
130
+ same call to finish downloading, not `--force`. Saved files are optional local copies,
131
+ not a new delivery-proof format. View/manage copies with `./run cache`.
132
+
133
+ Once Runtime verifies durable delivery, original inputs become eligible for confirmed
134
+ cleanup. If release cannot be checked, they remain protected; retry the original call.
135
+ A saved Runtime result can restore missing client results even after input cleanup.
136
+
137
+ Runtime port changes do not change the request. A possibly submitted request requires
138
+ matching Runtime history and atomic existing-only continuation. Missing history stops
139
+ with `ORIGINAL_REQUEST_NOT_FOUND`: preserve local files and review with support; do
140
+ not delete checkpoints, change IDs or force another purchase to recover it.
141
+
142
+ ## Service and package addresses
143
+
144
+ Service references must conform to the existing Protocol v1 profile: the challenged
145
+ MCP endpoint and payment endpoint have the canonical service-specific suffixes.
146
+ An allowed deployment prefix is supported. Do not derive or change these identities
147
+ inside a Skill to bypass validation. These rules apply to all service businesses.
148
+
149
+ The ZIP download URL is independent: use the publisher's explicit full URL plus a
150
+ trusted expected SHA-256, or Market's metadata/download link. The direct installer
151
+ does not derive the ZIP path from `/invoke` and does not require a `main` service
152
+ alias. Multiple service aliases may point to independently registered services.
153
+ Generic `--preview`/`--execute` install without global selection; official test
154
+ selection remains scoped to the maintained connectivity suite. Transport safety,
155
+ archive structure, digest and service-profile validation still apply.
@@ -0,0 +1,104 @@
1
+ # Approve Safe operations in your browser
2
+
3
+ The external owner signer now opens a temporary local authorization website during
4
+ setup, Policy renewal and Policy revocation. It requires an injected browser owner
5
+ wallet (window.ethereum) and a validated Safe version: currently 1.3.0 or 1.4.1.
6
+ Other Safe versions stop explicitly. WalletConnect/QR is not implemented.
7
+
8
+ ## Local computer
9
+
10
+ The terminal prints a loopback address and attempts to open the system browser
11
+ when a desktop environment is detected. Open that address manually if needed.
12
+ Review the network, Safe, operation and limits. Connect a Safe owner wallet on the
13
+ matching network. The page cannot access your local Wallet IPC or Session Key.
14
+
15
+ For a single-owner Safe, choose the named operation button and confirm in the owner wallet.
16
+ For a multisig Safe, other owners can open the same plan and use Approve operation.
17
+ Approvals use Safe approveHash transactions and require network fees; approvals
18
+ remain valid for that transaction hash. Once enough owners are available, execute.
19
+ The connected executing owner can count toward the threshold without a separate
20
+ approveHash transaction. Other owners' approvals are read from the chain, so no
21
+ hosted transaction service or shared signature clipboard is required.
22
+
23
+ Operations are sequential. For example, enable the Module, check approvals again,
24
+ then create the Policy. The page checks completed effects before offering execution.
25
+ A changed Safe nonce pauses the saved operation for reconciliation. Approval alone
26
+ does not mean execution; a successful Safe ExecutionSuccess and chain state are
27
+ required. Expired or conflicting Policy drafts stop.
28
+
29
+ Return to the terminal and enter check. The local process independently verifies
30
+ chain effects, then continues binding. Enter q to pause; the original draft remains.
31
+
32
+ ## Server without a desktop
33
+
34
+ The local service still listens only on 127.0.0.1. The terminal prints its actual
35
+ port and an SSH command such as:
36
+
37
+ ```sh
38
+ ssh -N -L PORT:127.0.0.1:PORT USER@SERVER
39
+ ```
40
+
41
+ Run that on your own computer, replacing the placeholders with the printed port and
42
+ your server login. Open the terminal's printed URL in your local browser with the
43
+ owner wallet extension. Forward the same port; Host validation deliberately rejects
44
+ other origins. Do not expose this temporary service publicly.
45
+
46
+ ## Portable fallback
47
+
48
+ Enter export in the terminal. Copy the entire printed directory to a trusted computer.
49
+ It contains only the public fixed plan, HTML, bundled ethers/browser code and a
50
+ minimal Node server. It does not include RPC credentials, local session tokens or
51
+ Wallet keys. From that directory run:
52
+
53
+ ```sh
54
+ node serve.mjs
55
+ ```
56
+
57
+ Open the address it prints. Alternatively:
58
+
59
+ ```sh
60
+ python3 -m http.server 8765 --bind 127.0.0.1
61
+ ```
62
+
63
+ Then open http://127.0.0.1:8765. Direct file:// opening is not a supported wallet
64
+ connection method. Keep the files while approval is pending, then remove that
65
+ exported directory. Each export is separate and preserved until you remove it.
66
+ The static page uses the browser wallet's network provider, not the original
67
+ computer's local API. That wallet must have access to the correct network RPC.
68
+ For Anvil, configure your browser wallet with the arranged RPC forwarding.
69
+
70
+ Return to the original terminal and enter check (or resume the original command).
71
+ A copied page cannot bind the original computer's Wallet by itself.
72
+
73
+ ## Evidence limits
74
+
75
+ Controlled HTTP, export and mocked browser/contract tests pass. Actual browser
76
+ extension signatures, desktop launch, SSH forwarding, multi-owner chain execution
77
+ and transaction fees remain participant acceptance. No real-network authorization
78
+ has been performed by implementing this page.
79
+
80
+ ## Recovery after interruption
81
+
82
+ The local guide saves pending public transaction references and checks their receipts
83
+ before another submission. Reopen the original guide and connect the owner wallet.
84
+ If another Safe transaction used the nonce, check approvals again and review the new
85
+ nonce. Prior approvals do not carry over. Keep exported pages in the same trusted
86
+ browser; portable mode uses browser storage rather than the original machine's journal.
87
+ Do not clear storage or switch browsers while a transaction is pending. Verify its
88
+ original transaction and effects first. Expiry checks use chain time.
89
+
90
+ ## Renewal interaction
91
+
92
+ Renewal reuses the bound Safe. Deployment updates label the default budget as remaining
93
+ allowance and preserve the original expiry when its default is retained. One webpage
94
+ runs the fixed revoke/optional Module enable/create plan. Connect once, then confirm
95
+ each named operation in the owner wallet. The page verifies each effect before showing
96
+ the next action. Return to the terminal and enter `check` once after all operations.
97
+ The independent terminal/Wallet checks still gate binding. Type `help` in the terminal
98
+ for SSH forwarding instructions; `export` provides the portable fallback.
99
+
100
+ The complete renewal plan stays fixed when you pause and reopen it; completed
101
+ operations are skipped after chain checks. Revoking the old permission alone does
102
+ not prevent returning to edit the new draft. Once creation approval/execution has
103
+ been prepared for the wallet, the draft is protected against changes; verify the
104
+ original operation instead. Exporting the portable page also protects its draft.
@@ -0,0 +1,36 @@
1
+ # Deployment migration and advanced Policy tools
2
+
3
+ For normal deployment changes, use `./run setup` or `./run policy renew`.
4
+ The guide explains the mismatch, preserves your Safe and Session Key, and prepares
5
+ owner-approved replacement permission. Follow
6
+ [deployment authorization update](deployment-authorization-update.md) for supported
7
+ changes, defaults, signing and recovery. Ordinary software repair or a newly
8
+ qualified service does not by itself require a new Policy.
9
+
10
+ The external signer serves the [browser approval page](safe-owner-web.md), including
11
+ on Anvil. Signing support is implemented; public-network, multisig and complete
12
+ interruption acceptance remain separate gates. Never use an unlocked test account
13
+ as a substitute for a real owner's approval.
14
+
15
+ ## Advanced migration script
16
+
17
+ `scripts/migrate-safe-policy.mjs` exposes `preview`, `prepare`, `status`, `export`,
18
+ `complete`, `refresh` and `cancel` for an explicitly managed migration. It is a
19
+ low-level tool, not the normal installation or renewal entry. Inspect its usage
20
+ before supplying paths or arguments.
21
+
22
+ Review the target Safe, network, token, delegate, Registry, budget, expiry and
23
+ Module/Factory. `prepare` saves recoverable migration state and blocks new signing.
24
+ The owner revokes the old Policy before creating its replacement; `export` provides
25
+ the next operation. `complete` switches the local binding only after Wallet checks
26
+ actual chain state. `authorize-test` is restricted to private Anvil test use.
27
+
28
+ If interrupted, inspect `status` and resume the original migration. Do not remove
29
+ local files, generate a new key or create a replacement payment. Confirmed on-chain
30
+ revocation cannot be reversed by restoring an old local file. Cancel only while
31
+ its state and chain checks permit it.
32
+
33
+ After completion, verify the binding, restart/unlock services and check readiness.
34
+ Migration does not purchase a service, and the platform need not wait for every
35
+ user to migrate before resuming new Orders. Original Orders retain their original
36
+ rules and independently verified authorization scopes.
@@ -0,0 +1,52 @@
1
+ # First spending authorization
2
+
3
+ Start with `./run install --market YOUR_MARKET_ORIGIN`, or return with `./run setup`.
4
+ Follow [installation](user-onboarding.md) for prerequisites. Wallet holds an encrypted
5
+ Session Key locally; the Safe enforces the approved spending limits. Market login or
6
+ Wallet connection does not create spending permission.
7
+
8
+ ## What you review
9
+
10
+ 1. Initialize Wallet and keep its encrypted Session Key and password securely.
11
+ Neither is your Safe owner's private key. Never give keys to a Skill or platform.
12
+ 2. Use a Safe on the configured network. Check the Safe address, owners, signature
13
+ threshold, token and balance. An ordinary owner address is not a Safe address.
14
+ 3. Choose a total budget, per-purchase limit and expiry. Eligible purchases can use
15
+ the full budget without another owner signature. Registry qualification verifies
16
+ identity/control, not service quality. New qualified services satisfying the rule
17
+ do not require a new Policy.
18
+ 4. Review the exact draft and operation list. `details` shows deployment and identity;
19
+ `back` edits unsubmitted terms. Editing a draft does not grant permission.
20
+ 5. Approve the operations with the selected owner signer. First setup may require
21
+ enabling the Module before creating the Policy. With the default external signer,
22
+ use the [local browser page](safe-owner-web.md), then return and enter `check`.
23
+ 6. Wallet independently verifies chain state before binding. Start/unlock local
24
+ services and, if desired, confirm the cost of the official payment test.
25
+
26
+ If restoring an existing authorization, use [Wallet restoration](wallet-identity.md)
27
+ with the original key and Policy. Do not create a replacement purchase to recover
28
+ an interrupted Order.
29
+
30
+ ## Signer and evidence boundaries
31
+
32
+ Signer selection is explicit. The external signer also works on Anvil; a private
33
+ chain ID does not automatically select a test account. The guarded Anvil adapter is
34
+ only for an explicitly selected, arranged single-owner test Safe. The advanced
35
+ `authorize-existing-safe.mjs` test script is not the normal user entry.
36
+
37
+ An owner approval or submitted transaction is not proof of successful execution.
38
+ The guide checks chain effects and retains unfinished plans. Resume the same flow
39
+ rather than deleting state. Multi-owner approval requires the Safe's actual threshold.
40
+ The recorded private single-owner journey does not establish public-network,
41
+ multisig or real-funds readiness. Safe creation is not performed by this guide.
42
+
43
+ ## Daily use and recovery
44
+
45
+ Wallet starts locked after restart; `./run wallet unlock` unlocks it locally.
46
+ Locking it does not revoke on-chain permission. Use [renewal/revocation](policy-renewal.md)
47
+ or [emergency payment stop](emergency-payment-stop.md) for owner-authorized changes.
48
+
49
+ Insufficient funds, exhausted budgets, expiry and unavailable services do not allow
50
+ silent increases in authority. Interrupted requests keep their original identity.
51
+ For a changed deployment, use [authorization update](deployment-authorization-update.md)
52
+ without reinitializing the Session Key.
@@ -0,0 +1,38 @@
1
+ # Terminal authorization preview
2
+
3
+ Use Linux with compatible Node installed. Prompts are English. This page covers
4
+ the demo/preview entries only; ordinary setup supports external owner signing.
5
+ macOS startup and public-network acceptance remain separate release gates.
6
+
7
+ ## Choose an entry
8
+
9
+ For the complete four-stage UI simulation, run from User:
10
+
11
+ ```bash
12
+ node scripts/user-setup.mjs --demo
13
+ ```
14
+
15
+ Choose `continue` once. The demo advances through Wallet initialization, spending permission, official Skill preparation and paid test. It asks for two confirmations: spending permission and test payment. Official Skill preparation and acknowledgement of verified test receipt are simulated automatically. Hidden practice-secret entry and spending-limit fields remain. It never creates keys, connects to a chain, installs files or pays. Simulation progress survives a pause in the same process, not process exit. It ends after the test and points to Market.
16
+
17
+ To preview only the spending parameters:
18
+
19
+ ```bash
20
+ node scripts/guide-policy.mjs --demo
21
+ ```
22
+
23
+ Enter the Safe (or press Enter for the fictional example), total budget, per-payment limit and duration in whole days. `details` shows deployment information; `create` at the Safe prompt explains where to obtain the correct Safe. One final confirmation completes this read-only preview, without granting permission. Expiry is displayed in the local timezone. No inputs are persisted by this standalone preview.
24
+
25
+ For actual read-only deployment checks:
26
+
27
+ ```bash
28
+ node scripts/guide-policy.mjs PUBLIC_DEPLOYMENT_JSON WALLET_DELEGATE
29
+ ```
30
+
31
+ The public config supplies `chainId`, `rpcUrl`, `module`, `token`, `factory`, `registry`, `tokenDecimals` and `source`; optional `tokenSymbol` labels amounts. Use trusted deployment data and the public Wallet execution address. The command checks chain identity, contract presence, Safe owners/threshold, Module and Policy state. It cannot sign or bind. Contract presence alone is not proof of trusted semantics. Never enter an owner private key, Session Key or unlock secret into these fields.
32
+
33
+ ## Actual setup and owner signing
34
+
35
+ This guide describes the explicit demo/preview path only. Ordinary setup supports external-owner approval; see [browser signing](safe-owner-web.md). Private Anvil can use an explicitly selected guarded test signer.
36
+
37
+ On a supported real network the owner must execute the reviewed Safe operations: enable the trusted AgentPay Module if absent, then create the bounded Policy. The application must verify actual chain results and the Safe's signature threshold; a user clicking confirm is not chain evidence. Reducing guide confirmations does not merge contract operations or imply a real-wallet batch-signing implementation. [Safe authorization](safe-policy-setup.md) explains the authority and release boundaries. The demo does not open an owner-signing browser page. Actual setup attempts to
38
+ open its local approval page on a desktop and always prints the address.
@@ -0,0 +1,68 @@
1
+ # Lock and unlock Wallet from User
2
+
3
+ From the User repository, run:
4
+
5
+ ```bash
6
+ ./run wallet unlock
7
+ ```
8
+
9
+ Enter the Wallet unlock secret in the terminal. Input is hidden. The Wallet service
10
+ must already be running; this command does not start services, create a key or change
11
+ spending permission. Runtime itself does not need unlocking.
12
+
13
+ Install and successful local initialization remember your User data directory in
14
+ `.agentpay-install/state.json` beside the User and Wallet repositories. Lock/unlock
15
+ use that location automatically. If no installation location exists, they use
16
+ `$HOME/.local/share/agentpay/user`. To temporarily select another:
17
+
18
+ ```bash
19
+ ./run wallet unlock '/your/User data directory'
20
+ ```
21
+
22
+ Selection order: explicit argument, `AGENTPAY_USER_DATA_DIR`, remembered installation,
23
+ standard default. A one-off lock/unlock argument does not change the saved location.
24
+ Install also reuses the saved location, so retrying Install does not silently switch
25
+ back to the standard directory. The record contains only the path and existing
26
+ installer checkpoints, never a password. Do not delete this file to recover a Wallet.
27
+ Pass the User data directory, not its `wallet` subdirectory. Keep the User and Wallet
28
+ repositories side by side and complete installation/build first.
29
+
30
+ After successful unlock, resume the original Skill request. Do not create a replacement
31
+ payment to work around an interrupted request. Existing Policy limits, expiry and
32
+ revocation still apply. Unlock success alone does not prove purchase readiness.
33
+
34
+ Passwords must not appear in command arguments, environment variables or files.
35
+ The command inherits your interactive terminal; Wallet owns hidden input and its
36
+ existing authenticated local administration call. Runtime does not receive the secret.
37
+
38
+ ## Restart support status
39
+
40
+ Linux automatic startup and best-effort desktop reminders now have a separate
41
+ [management command](local-autostart.md). The terminal installer now offers to enable them after the connectivity test;
42
+ real desktop/login/reboot acceptance remains pending. No saved auto-unlock material.
43
+
44
+ ## Lock Wallet
45
+
46
+ From the User repository:
47
+
48
+ ```bash
49
+ ./run wallet lock
50
+ ```
51
+
52
+ Use the same optional User directory or `AGENTPAY_USER_DATA_DIR` as unlock. Lock
53
+ clears the decrypted signing key from Wallet memory. It does not revoke the on-chain
54
+ Policy, cancel Orders or reverse already signed/submitted payments.
55
+
56
+ Both commands check local setup, ownership/permissions and socket presence first.
57
+ A leftover socket still may not have a running process; a failed connection remains
58
+ an error, not proof that the password is wrong. Wallet public results are rendered
59
+ as short messages rather than raw JSON. Unknown failures retain a safe error code.
60
+
61
+ ## Check before unlocking
62
+
63
+ Run `node scripts/status.mjs` to inspect the running local Wallet without a password.
64
+ The same remembered directory and optional override apply. Lock/unlock/status now
65
+ probe the socket connection, not only the socket file. A stale file reports that
66
+ Wallet is not running before asking for a secret; no socket or data is deleted.
67
+ A successful connection does not by itself prove authenticated IPC works; later
68
+ Wallet errors remain visible as concise results with a safe error code.
@@ -0,0 +1,87 @@
1
+ # Install and use AgentPay User
2
+
3
+ Use Linux with Node.js 22.22.3 or newer and npm. Have your platform's Market
4
+ address and a Safe on its supported network, controlled by your owner wallet.
5
+ AgentPay does not need your owner private key. macOS startup remains unverified.
6
+
7
+ ## 1. Install program files
8
+
9
+ Install User with `npm install --global @c4roa0/agentpay-user@0.3.0`.
10
+ Its reviewed Wallet dependency is included. Source/ZIP alternatives are in
11
+ [README](../../README.md). No separate Wallet checkout or build is needed.
12
+ Keep private data outside the program folder.
13
+
14
+ ## 2. Configure
15
+
16
+ ```sh
17
+ agentpay install --market https://YOUR_MARKET_ORIGIN
18
+ ```
19
+
20
+ Use your platform's actual HTTPS origin; private rehearsals may use loopback HTTP.
21
+ Without `npm link`, run `./run install --market ...` from User instead. For a ZIP
22
+ without executable permissions use `sh run`; `AGENTPAY_NODE` can select Node.
23
+
24
+ Install verifies installed dependencies and downloads public deployment
25
+ settings, then continues into local setup. Read each prompt: setup prepares an
26
+ encrypted Session Key, spending limits, owner approval and local services. Existing
27
+ keys, histories and saved drafts are retained on retry. Approve only the intended
28
+ network, Safe, amounts and expiry in your owner wallet. See
29
+ [browser approval](safe-owner-web.md).
30
+
31
+ The official connectivity test asks for its maximum price before making a paid
32
+ Order. It uses a reviewed package digest pinned in User. Download/install alone
33
+ must not be mistaken for spending permission or payment.
34
+
35
+ ## Resume and operate
36
+
37
+ Run the same Install command if preparation failed, or `agentpay setup` to return to
38
+ a prepared installation. Read its saved log when dependency preparation fails;
39
+ do not delete Wallet state to bypass an error. Deployment changes are handled by
40
+ [authorization update](deployment-authorization-update.md).
41
+
42
+ ```sh
43
+ agentpay status
44
+ agentpay wallet unlock
45
+ agentpay market connect
46
+ agentpay payment test
47
+ ```
48
+
49
+ Runtime and Wallet run locally. On Linux, the guide can configure systemd user
50
+ services. Wallet starts locked after a restart; [service commands](local-autostart.md)
51
+ control startup and background operation. Keep the Node installation used by those
52
+ service files available.
53
+
54
+ The default data location is `$HOME/.local/share/agentpay/user`. Install also stores
55
+ private preparation checkpoints/logs under `.agentpay-install/` beside the repositories.
56
+ `agentpay wallet info` shows resolved identity and paths. Follow
57
+ [backup and restore](wallet-identity.md) before replacing a computer or deleting data.
58
+
59
+ ## Private Anvil and other deployment settings
60
+
61
+ Anvil uses the same authorization/payment code with explicit configuration. Select
62
+ external-owner signing for browser-wallet testing; the guarded test signer is only
63
+ for the arranged private rehearsal. Network ID alone does not authorize a test signer.
64
+
65
+ If a rehearsal configuration publishes server loopback URLs, they refer to that
66
+ server and need arranged SSH forwarding from another computer. Ask the operator
67
+ for the endpoints in that configuration; there is no universal public port list.
68
+ Supported public deployment configuration should expose reachable public APIs and
69
+ RPC, while your Runtime remains local. See [deployment settings](../reference/public-deployment-settings.md).
70
+
71
+ The [advanced private test guide](private-anvil-terminal-setup.md) is not a requirement
72
+ for an ordinary public-network user. Source support is not real-network acceptance.
73
+
74
+ ## Edit an authorization draft
75
+
76
+ Type `back` to revisit the previous editable question. Earlier answers are retained;
77
+ dependent later choices may need review. `q` pauses with saved progress. An operation
78
+ already submitted on-chain cannot be changed by editing a local draft: resume its
79
+ original verification first.
80
+
81
+ ## Update or uninstall
82
+
83
+ Download compatible User and Wallet code, then run `agentpay repair`. It applies local
84
+ code and preserves keys and requests. See [updates](local-update.md).
85
+ `agentpay uninstall` requires confirmation before removing local data. It does not
86
+ revoke on-chain permission; use the appropriate owner-authorized revocation or
87
+ [emergency stop](emergency-payment-stop.md) when needed.
@@ -0,0 +1,59 @@
1
+ # Find your Wallet identity and keep a backup
2
+
3
+ From the User repository, run:
4
+
5
+ ```bash
6
+ ./run wallet info
7
+ ```
8
+
9
+ This reads saved local information without starting/unlocking Wallet or contacting
10
+ Market or the chain. It shows your Safe, network, Module, Policy ID, Wallet execution
11
+ address, file locations and any saved Market connection. It does not confirm that
12
+ an authorization is still valid or a saved website connection is still active.
13
+ Missing or unsafe files are reported rather than replaced.
14
+
15
+ Keep the encrypted Session Key file shown by the command in a secure backup, and
16
+ keep its unlock password. A password alone cannot recover a lost Session Key.
17
+ Also keep the Safe/network/Module/Policy ID. Back up the full User data directory
18
+ to retain private results and transaction recovery records; protect it as sensitive
19
+ data. Do not upload key files, passwords or data-directory backups to Market or
20
+ send them to support. The command never displays their contents.
21
+
22
+ On Market, your Wallet cards in Account and Settings provide a Policy ID row.
23
+ Use the eye button to show the full value or the copy button to copy it. If browser
24
+ clipboard access fails, the value is shown for manual copying. A Policy ID is a
25
+ public identifier, not proof of control or spending authority.
26
+
27
+ ## Restore the original identity
28
+
29
+ After installing compatible User and Wallet code, run from User:
30
+
31
+ ```bash
32
+ ./run wallet restore
33
+ ```
34
+
35
+ If no key is present, choose your original encrypted Session Key backup and enter
36
+ its password in Wallet's hidden prompt. For a raw original Session Key, type `key`
37
+ and enter it only in the subsequent hidden Wallet prompt; choose a new local unlock
38
+ password. Never paste a key into a file-path, website, command argument or support
39
+ message. Encrypted backups must be private files owned by you (mode 0600); only the
40
+ Wallet's bounded scrypt backup format is supported, not arbitrary wallet exports.
41
+
42
+ Enter the original network, RPC, Module, Safe and Policy ID from your saved settings.
43
+ Wallet checks the chain and original key. Review the identity and confirm to save
44
+ its local binding. Existing limits, spent amount and expiry are unchanged. No
45
+ owner signature, chain transaction or payment is made. An exhausted Policy may be
46
+ restored for identity but cannot fund new purchases.
47
+
48
+ Existing keys are preserved; another local Policy is never overwritten. A failed
49
+ or interrupted bind can be retried with the same command and ID. Missing, revoked,
50
+ expired or not-yet-active Policies do not become a fresh authorization automatically.
51
+ Use `./run status` afterward, then `./run market connect` if you need website access.
52
+ Restoration does not recover lost private results or missing transaction records.
53
+
54
+ During initial setup, choose `restore` before creating a key. Before budget entry,
55
+ press Enter for new spending permission or enter your original Policy ID. A saved
56
+ restore draft stays a restore draft; failures cannot submit a new authorization.
57
+ The official connectivity purchase is a separate, explicitly confirmed step.
58
+
59
+ Source verification is complete; participant restoration acceptance is pending.