@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,115 @@
1
+ # Manage local cache
2
+
3
+ Current source includes the 2026-11-04 text/file view and generic Provider source.
4
+ Existing file-management APIs are unchanged; this display update alone needs no
5
+ Runtime restart. Machines on older Runtime code still need the coordinated update.
6
+ Wallet unlock is not required. These operations never buy a service or cancel an Order.
7
+
8
+ ```bash
9
+ ./run cache
10
+ ./run cache list
11
+ ./run cache list 1 input
12
+ ./run cache list 1 output --state available
13
+ ./run cache list 1 --order ORDER_ID
14
+ ./run cache list 1 --request REQUEST_ID
15
+ ./run cache details FILE_ID
16
+ ./run cache export FILE_ID /your/folder/report.pdf
17
+ ./run cache clean
18
+ ./run cache settings
19
+ ./run cache settings totalBytes 1073741824
20
+ ```
21
+
22
+ Use the full file ID shown by `list`. Listings have 20 entries per page; `list 2`
23
+ shows the second page. Export verifies the saved bytes and creates a private copy;
24
+ it never opens/executes the file or overwrites an existing destination. Choose a
25
+ path outside the managed cache. Rename the exported copy as needed for your application.
26
+
27
+ `clean` previews up to 100 eligible file copies and their sizes before asking for `confirm`.
28
+ Original links might have expired: deleted files are not guaranteed downloadable
29
+ again. Request/Order history, structured results and protected inputs remain. If
30
+ records changed after preview, review cleanup again. No age-based auto eviction
31
+ exists. Known interrupted temporary writes/deletions are repaired on first use.
32
+
33
+ Inputs stay protected until the shared client and Runtime verify a durable delivered
34
+ result for the original request. Then confirmed cleanup may remove them. Failed release
35
+ checks retain protection and retry with the original call. Do not manually delete
36
+ input records to work around protection.
37
+
38
+ ## Runtime stopped
39
+
40
+ ```bash
41
+ ./run cache --offline
42
+ ./run cache list --offline
43
+ ./run cache clean --offline
44
+ ```
45
+
46
+ Offline mode is explicit; a failed online request does not silently switch to local
47
+ writes. It uses the same OS file lock as Runtime. If Runtime owns the cache, use the
48
+ online command or stop Runtime first. Never delete `owner.lock` to bypass contention.
49
+ Offline settings changes are read at the next Runtime cache initialization; use the
50
+ online settings command for a Runtime that is already managing files.
51
+
52
+ ## Space and limits
53
+
54
+ The view shows text results and files. Text results include both shared-client
55
+ copies and direct Runtime results. Matching Order/service/request/output identities
56
+ are displayed once; storage usage includes all physical result records. Display
57
+ source comes from the saved Provider reference, not installed package guessing.
58
+ A missing historical source is shown as unrecorded. Source labels never authorize
59
+ payments or alter request identity. JSON result cleanup remains disabled.
60
+
61
+ The summary separates text-record storage from attachment storage and reservations.
62
+ Unknown files occupy capacity but are not automatically deleted. Request records,
63
+ pending delivery evidence and other local state are separate; this is not total
64
+ User disk usage.
65
+
66
+ Defaults: 100 MiB per file, 512 MiB managed file bytes, 20 active files per request or
67
+ Order, 2 transfers, 10,000 metadata records and a 15-minute transfer timeout. Supported
68
+ configuration names remain `singleBytes`, `totalBytes`, `filesPerResult`, `concurrent`,
69
+ `records`, `timeoutMs`. Byte/time values use bytes/milliseconds; all are positive
70
+ integers. `filesPerResult` applies separately to each input request or output Order.
71
+ The total counts binary/staging/unknown files; index overhead is separately bounded
72
+ at 8 MiB. These are local resource limits, not business or file-format restrictions.
73
+
74
+ Settings commands validate and apply limits without restarting or locking Wallet.
75
+ Lowering limits never deletes existing files; over-limit storage blocks new allocation
76
+ while keeping inspection, export and cleanup available. Retained removed records
77
+ still count toward metadata limits. Raising `records` cannot bypass the 8 MiB index
78
+ bound. Cache errors do not stop Runtime's independent Order recovery.
79
+
80
+ ## Storage and upgrade
81
+
82
+ Managed files remain under `runtime/invocations.json.files/` in the selected User
83
+ data directory. `./run wallet info` shows that data directory. No file format is executed,
84
+ extracted or converted; extensions and names are descriptive. Original private paths
85
+ and signed URLs are excluded from routine lists but can exist in private metadata.
86
+ Back up the complete User data directory privately to preserve recovery and files.
87
+
88
+ First access upgrades the old version-1 output index atomically to version 2 under
89
+ the store lock. Existing output IDs and binary paths are preserved, with no redownload.
90
+ Old Runtime versions cannot read the new index; stop old writers and coordinate User
91
+ updates before rollout. Do not downgrade/delete the index to fix startup. This is a
92
+ local file metadata upgrade, not an Order, Policy or chain migration.
93
+
94
+ Existing `./run orders files ORDER_ID` and `/files/*` operations remain supported through
95
+ the same store. The new manager adds authenticated `/cache/manage` on the existing
96
+ loopback Runtime; it has no arbitrary file-import/download or financial action.
97
+ The shared Skill client uses the separate authenticated `/files/input` operation
98
+ for explicit input declarations. `/files/input-release` independently verifies durable
99
+ delivery before allowing input cleanup; it does not create, pay or acknowledge Orders.
100
+
101
+ ### Displayed types and sizes
102
+
103
+ Text (JSON) entries show `content` (UTF-8 bytes of the business output serialized as
104
+ JSON) and `cached` (complete saved result records, including internal copies and
105
+ Order/verification metadata). Summary text storage counts those complete records. Attachment entries show
106
+ input/output, the filename extension and cached bytes. Extensions are descriptive,
107
+ not content validation. Zero attachments is expected for JSON-only services. These
108
+ sizes are file lengths, not filesystem allocated blocks or total User disk usage.
109
+
110
+ The standard Runtime result location is `runtime/invocations.json.results/`;
111
+ shared-client results remain in `runtime/client-requests/`. If using a custom
112
+ Runtime state file, set the same `AGENTPAY_USER_STATE_FILE` for cache commands.
113
+ No installed ZIP is scanned for display. Attachment pagination reads only the
114
+ prefix needed for the merged page; text inventory still scans retained result
115
+ metadata and is not a persistent index.
@@ -0,0 +1,84 @@
1
+ # Update User and Wallet
2
+
3
+ Keep your private data when updating program files. Do not uninstall to upgrade.
4
+
5
+ For a global npm installation:
6
+
7
+ ```sh
8
+ agentpay update
9
+ ```
10
+
11
+ It checks the published User version and shows its exact Wallet dependency. Confirm
12
+ to continue, or cancel without changing services. `agentpay update -f` skips only
13
+ this confirmation. The updater checks requirements, stops configured services,
14
+ installs the confirmed version and invokes the new version's repair to refresh
15
+ services and verify its pinned official test Skill. No paid test runs automatically.
16
+ Other installed Skills and original requests are kept. Wallet needs unlocking after
17
+ restart. A current User version still checks the official test Skill.
18
+
19
+ Only genuine global npm installations are updated. A source checkout or `npm link`
20
+ is refused rather than overwritten: update User's files, run `npm ci`, then
21
+ `agentpay repair`. The first User 0.3.0 release establishes the package baseline; a later real
22
+ registry upgrade still needs participant acceptance. The updater uses npm's configured registry, checks
23
+ Node engine requirements and disables package installation hooks; releases must
24
+ ship usable runtime artifacts. It never independently selects the newest Wallet.
25
+
26
+ If npm fails after services stop, keep your private data. Review the shown log;
27
+ reinstall the intended User version with npm if program files are incomplete, then
28
+ run `agentpay repair`. Interrupted installers may leave a lock to inspect. Repair
29
+ failure is not reported as update success. A newer update cannot silently downgrade
30
+ a version changed while you were reviewing the confirmation.
31
+
32
+ For an old custom data location, first note `wallet info` in the old installation.
33
+ Set `AGENTPAY_USER_DATA_DIR` to that same directory when moving to npm; do not
34
+ initialize another Wallet. Source repair can read the old adjacent checkpoint, but
35
+ an unrelated npm installation cannot discover arbitrary old source folders.
36
+
37
+ User supplies its exact reviewed Wallet dependency; do not independently replace it.
38
+ For a source/ZIP
39
+ installation, stop services, update the User files, run `npm ci`, then `agentpay repair`.
40
+ If using the source wrapper instead of `npm link`, replace `agentpay` with `./run`.
41
+
42
+ Repair checks installed versions and asks before restarting changed services.
43
+ `agentpay repair -f` skips that confirmation only. It refreshes the managed systemd
44
+ user units and local client-module path; it preserves the Runtime address, caller
45
+ credential, login startup preference, keys, Policies and original requests.
46
+ Wallet starts locked after restart. No Wallet compilation is required.
47
+
48
+ If preparation fails after stopping services, they remain stopped. Resolve the
49
+ reported cause and repeat repair; the log path is shown. An interrupted run may
50
+ leave an installation lock: inspect it before removing it. There is no automatic
51
+ code rollback. Running-package negotiation is not implemented; complete the managed
52
+ restart before relying on a newly installed version.
53
+
54
+ ## Uninstall
55
+
56
+ `agentpay uninstall` asks before removing background services and keeps private data.
57
+ `agentpay uninstall --delete-data` asks for explicit confirmation before permanently
58
+ removing the selected local keys, configuration, history and cache. A matching old source checkpoint and its saved setup files are also retired during
59
+ explicit data deletion, so later setup cannot import them again. Unrelated source
60
+ installations are preserved. Neither command revokes on-chain permission. Afterwards, remove the program with
61
+ `npm uninstall --global @c4roa0/agentpay-user`, or delete your source folder.
62
+ If you removed npm's program first, reinstall the same reviewed version to run
63
+ cleanup against your existing data. Never erase keys to repair an installation.
64
+
65
+ ## Official test Skill check
66
+
67
+ After a successful software update, the command downloads the published official
68
+ test ZIP using the saved Market source, verifies its bytes against User's built-in
69
+ SHA-256 and saves the new package alongside existing ones. It does not replace the
70
+ selected original test, edit checkpoints, execute package scripts or purchase.
71
+ The same check also runs when local software has no changes. Cancelling an update
72
+ skips it. Missing settings, network errors or a hash mismatch are reported separately;
73
+ they do not turn a successful software update into a failed preparation. Retry `agentpay repair`
74
+ without restarting unchanged software. Local edits in an existing installed copy
75
+ are retained and reported rather than overwritten.
76
+
77
+ ## Missing local Skill connection
78
+
79
+ If a Skill reports a missing Runtime connection while services are running, run
80
+ `agentpay repair`. Preparation restores a missing `runtime/connection.json` from your
81
+ saved service settings, including when local code is unchanged. It keeps caller
82
+ credentials, keys, Policies and request history. A conflicting, malformed or unsafe
83
+ existing connection file is retained and reported for review; do not delete your
84
+ User data or repeat setup to work around it.
@@ -0,0 +1,73 @@
1
+ # Connect a local Wallet to Market
2
+
3
+ Run from User after Wallet setup:
4
+
5
+ ```sh
6
+ ./run market connect
7
+ ```
8
+
9
+ Enter your Market HTTPS address, sign in with your Market account, and choose a
10
+ Wallet nickname. Private rehearsals may use an arranged loopback HTTP address.
11
+ If preparation is needed, the command asks once, verifies the installed Wallet package,
12
+ restarts local services and continues. Unlock when prompted; input is hidden.
13
+ Keys, spending permission and Order records are preserved.
14
+
15
+ Review the account and nickname, then type `confirm`. Use `details` to inspect the
16
+ Safe, network and Policy. Open Market → Account to view your Wallets and Orders.
17
+ A separate browser login may be needed; terminal sign-in does not create browser cookies.
18
+
19
+ ## Wallet identity and Policy access
20
+
21
+ A Wallet is identified by network + Module + Safe + execution address. Its nickname
22
+ belongs to that identity. Each attached Policy is verified separately and grants
23
+ access only to its own Orders. Connecting another Policy with the same identity
24
+ adds it to the existing Wallet group; it does not create a new machine identity or
25
+ inherit unverified Policies. Activity reflects the connected, authorized scopes,
26
+ not every transaction made by the Safe.
27
+
28
+ Two machines using the same key and identity share a Wallet group. Different keys
29
+ are different Wallets even on the same Safe. Choose a nickname distinct from other
30
+ Wallets in your Market account. Names are compared with Unicode normalization and
31
+ without case distinctions. The guide checks availability before confirmation; a
32
+ pending challenge can reserve the name for up to ten minutes. Reconnecting the same
33
+ Wallet can retain its name. Names are labels, not permission to access Orders.
34
+
35
+ Connection adds website Order access/support, not payment permission, receipt
36
+ confirmation, Policy management or platform adjudication. See the
37
+ [identity reference](../reference/wallet-identity-policy-history.md).
38
+
39
+ ## Recovery and disconnect
40
+
41
+ - **Locked:** enter the Wallet password when prompted.
42
+ - **Old or stopped Wallet:** confirm preparation. If it fails, check the displayed
43
+ log and retry. Obtain current source if requested; preparation builds local code.
44
+ - **Interrupted connection:** repeat `./run market connect`. Challenge verification
45
+ is idempotent; an expired challenge needs a fresh proof. No purchase is created.
46
+ - **Expired Policy or disabled Module:** these stop new payments, but do not alone
47
+ prevent connecting the original Policy for its Order history/support. Ownership,
48
+ signatures, Policy existence and Order deadlines are still checked.
49
+ - **Revoked Policy:** new support requests through that Policy are denied. Another
50
+ Policy does not inherit its Orders. Local original-Order reads/recovery have their
51
+ own authorization checks; a denied connection is not a reason to buy again.
52
+ - **Renewal:** successful renewal can continue this connection flow to verify the
53
+ new Policy under the same Wallet. A cancelled connection does not undo renewal;
54
+ retry only `./run market connect`.
55
+ - **Disconnect:** removes the Market association and its pending challenges, not
56
+ on-chain spending permission or a submitted dispute. Separately authorized access
57
+ may still exist. For a compromised key, use the [emergency stop](emergency-payment-stop.md).
58
+
59
+ ## Local administrative boundary
60
+
61
+ Wallet's admin capability signs only a fixed `market.connect` proof. The Agent/Skill
62
+ capability cannot call it. The proof binds Market origin, account, challenge,
63
+ nickname and expiry; it cannot make a payment. Same-user filesystem/code access is
64
+ not isolated by these capabilities. Market does not receive keys, unlock passwords
65
+ or private service results.
66
+
67
+ Normal completion and handled cancellation attempt to revoke the temporary terminal
68
+ login session. A forcibly killed process cannot guarantee logout; unused sessions
69
+ follow platform expiry. Passwords, login tokens and signatures are not saved locally.
70
+ `market-connection.json` in the selected User data directory contains public receipt
71
+ metadata and the saved Market address, protected with private file permissions.
72
+ It is not authority for website access. Local status does not detect a later website
73
+ disconnect or establish current server availability.
@@ -0,0 +1,56 @@
1
+ # Publish User to npm
2
+
3
+ This publishes the User CLI and Runtime, with its exact reviewed Wallet dependency.
4
+ It does not deploy platform services or alter participant keys, Policies or Orders.
5
+
6
+ ## Verify a release
7
+
8
+ From a clean reviewed source checkout, using Node 22.22.3 or newer:
9
+
10
+ ```sh
11
+ npm ci --ignore-scripts
12
+ npm test
13
+ node scripts/test-package.mjs artifacts/npm
14
+ ```
15
+
16
+ Review the package inventory and README. The archive check installs the package in
17
+ an isolated directory, checks the public command and starts disposable Wallet/Runtime
18
+ processes. It never uses a participant's private data. Keep the exact verified archive
19
+ for publication; do not rebuild it between verification and upload.
20
+
21
+ ## First publication
22
+
23
+ Authenticate as the package maintainer, then publish the verified archive:
24
+
25
+ ```sh
26
+ npm publish artifacts/npm/c4roa0-agentpay-user-0.3.0.tgz --access public --ignore-scripts --registry=https://registry.npmjs.org/
27
+ node scripts/verify-npm-release.mjs artifacts/npm/c4roa0-agentpay-user-0.3.0.tgz 0.3.0
28
+ ```
29
+
30
+ Never commit or share a publishing Token. If npm stages the first release, approve
31
+ it on npm before verifying. A timeout is not proof of failure: check the registry
32
+ before retrying publication. Published version numbers cannot be reused.
33
+
34
+ ## GitHub Trusted Publisher
35
+
36
+ Create the GitHub environment `npm-publish` and restrict its deployment branch to
37
+ `main`. Add maintainer approval if desired. In the npm package's Trusted Publisher
38
+ settings, select GitHub Actions and enter:
39
+
40
+ | Field | Value |
41
+ | --- | --- |
42
+ | Organization/user | `c4rO-0` |
43
+ | Repository | `agentpay-user` |
44
+ | Workflow filename | `publish.yml` |
45
+ | Environment name | `npm-publish` |
46
+ | Allowed action | Direct publishing |
47
+
48
+ Run **Publish User to npm** on `main` with a new reviewed package version matching
49
+ `package.json` and `update-pair.json`. It tests, packs, verifies, publishes that exact
50
+ archive through OIDC, and compares registry integrity. No stored npm Token is needed.
51
+ The first successful OIDC release validates the connection; the initial Token upload
52
+ does not. Afterwards, disable bypass-2FA tokens and retire unused publishing tokens.
53
+ See [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/).
54
+
55
+ Publication is not real-network or participant upgrade acceptance. Record the exact
56
+ source revision and verification outcome; test the published installation separately.
@@ -0,0 +1,62 @@
1
+ # Official connectivity-test package
2
+
3
+ The User onboarding installer trusts the ZIP SHA-256 embedded in
4
+ `src/official-test-package.mjs`. Market supplies the download location and metadata;
5
+ neither its response nor a command-line hash can override the official pin. The
6
+ installer hashes downloaded bytes before parsing or saving package contents.
7
+ A mismatched release stops installation. Never bypass this check by accepting the
8
+ hash reported by the same server that supplies the ZIP.
9
+
10
+ This pin applies only to the maintained onboarding test. Generic Runtime calls and
11
+ ordinary Skill installation do not require the random service or this package.
12
+ The current pin is the reviewed random Skill 1.2.0 private rehearsal package;
13
+ it includes its service reference. It is not a production-network release.
14
+
15
+ ## Before publishing a User update
16
+
17
+ 1. Check whether the maintained official Skill has a new published version.
18
+ 2. Review its source and actual ZIP: instructions, scripts, manifest, service
19
+ identity, endpoints and absence of secrets. Do not automatically trust a new
20
+ Market version or copy its reported hash into the code.
21
+ 3. If accepting that release, update the name, version and SHA-256 in
22
+ `src/official-test-package.mjs` as a reviewed code change.
23
+ 4. From the User repository, verify the actual file:
24
+
25
+ ```sh
26
+ node scripts/check-official-test-package.mjs /path/to/reviewed-skill.zip
27
+ ```
28
+
29
+ This checks the hardcoded hash, archive validity and package name/version.
30
+ It does not execute scripts or prove service availability.
31
+ 5. Run the official pin/download and onboarding regression tests, then publish
32
+ the matching User release. Actual paid acceptance remains a separate step.
33
+
34
+ ## Existing installations
35
+
36
+ Market's legacy deployment `bundleSha256` field no longer decides which ZIP may be
37
+ installed for a new official test. User supplies its embedded hash to the installer.
38
+ A changed Market hash alone is not a chain deployment change and never rewrites
39
+ saved configuration, Policy or test history.
40
+
41
+ An installed package used for a new test must match the current User pin and must
42
+ not have local edits. A saved prior test can continue with its original locally
43
+ verified package and saved hash only after its checkpoint is checked against local
44
+ invocation history. This exception cannot select a new package or start a replacement
45
+ purchase. Unknown/conflicting material stops for review. Old files are not deleted.
46
+ Updating User does not restart a completed paid test or renew an expired Policy.
47
+
48
+ For a new private rehearsal after updating User/Wallet and checking the new Policy,
49
+ run `./run payment test`. This uses the installed pinned package directly, without changing
50
+ the old selected package or its completed checkpoint. The first call shows the
51
+ current quote and requires explicit confirmation; after consent it saves a new
52
+ request identifier before invoking the Skill. A retry uses the saved identifier.
53
+ This release's official test is private-Anvil-only and does not install a third-party
54
+ Skill. Once a test has completed, the same command offers a new paid test with a new
55
+ quote and explicit confirmation. The old completed record is archived before a new
56
+ test. Cached replay alone is not a fresh payment-path check. Success confirms delivery
57
+ and receipt acknowledgement; final Provider payout follows the Order schedule.
58
+
59
+ The pin protects against replacement of the test ZIP by Market; it does not protect
60
+ against a compromised User installation, bad code accepted during release review,
61
+ or all risks of a compromised platform. Wallet's independent spending checks and
62
+ explicit confirmation before the paid test remain necessary.
@@ -0,0 +1,56 @@
1
+ # Cancel an unaccepted Order
2
+
3
+ The cancellation client is implemented. Remaining participant and financial
4
+ acceptance is tracked in current TODO. Keep User and Wallet side by side and use
5
+ their declared dependency lockfiles.
6
+
7
+ ## Before you start
8
+
9
+ Wallet must be running, unlocked and bound to the original Buyer Safe/Policy.
10
+ Use the same User data directory and Settlement base URL as the original request.
11
+ Use HTTPS in public deployments; loopback HTTP is permitted for private testing.
12
+ A public reverse-proxy prefix belongs in the base URL, for example
13
+ `https://market.example/settlement`, not the final `/agentpay/wallet` route.
14
+ No access to platform files, databases or Provider credentials is needed.
15
+
16
+ From the User repository, cancel by the original Runtime request ID:
17
+
18
+ ```sh
19
+ node scripts/cancel-order.mjs "$HOME/.local/share/agentpay/user" 'https://market.example/settlement' --request 'YOUR_ORIGINAL_REQUEST_ID'
20
+ ```
21
+
22
+ Replace the example URL and request ID. This reads the existing default
23
+ `runtime/invocations.json` ledger. If Runtime uses a custom state-file path,
24
+ use the original Order ID instead; the command does not search other ledgers:
25
+
26
+ ```sh
27
+ node scripts/cancel-order.mjs "$HOME/.local/share/agentpay/user" 'https://market.example/settlement' '0xYOUR_ORIGINAL_64_HEX_ORDER_ID'
28
+ ```
29
+
30
+ No saved Order means nothing is cancelled. Do not start a replacement payment
31
+ to work around a missing or interrupted request.
32
+
33
+ ## Check or retry
34
+
35
+ Add `--status` to either command to read the original Order without requesting
36
+ cancellation. A request timeout is not a confirmed cancellation: check status,
37
+ then rerun the same cancellation command if needed. The client saves one private
38
+ cancellation identity before sending it and reuses it after response loss or
39
+ process restart. Keep `runtime/order-cancellations/` and invocation history.
40
+
41
+ | Result | Meaning / next action |
42
+ | --- | --- |
43
+ | `requested`, `cancelling`, `refunding` | Still pending. Query the same Order later. |
44
+ | `cancelled` | Unpaid Order closed; no payment was refunded. |
45
+ | `refunded` | Funded principal returned to the original Buyer Safe. Policy cumulative spend is not restored. |
46
+ | `ORDER_ALREADY_ACCEPTED` | Provider acceptance won; existing delivery and timeout rules apply. |
47
+ | `ORDER_CANCEL_FORBIDDEN` | Current Safe/Policy does not own that Order. Restore the original configuration. |
48
+ | `CANCELLATION_STATE_CONFLICT` | Local intent belongs to another Policy/endpoint. Preserve it for recovery review. |
49
+ | `ORDER_CANCELLATION_UNAVAILABLE` | Deployment or original Order does not support this closure flow. Contact the operator. |
50
+
51
+ Settlement decides acceptance/cancellation atomically. A local intent alone does
52
+ not cancel an Order. Runtime reads authoritative closure before further payment
53
+ or service calls and stops on closing/cancelled/refunded Orders; saved, verified
54
+ output can still be recovered. In-flight operations remain subject to Settlement
55
+ and contract race checks. There is no new owner signature, generic signing,
56
+ replacement Order or automatic reuse of refunded budget in this command.
@@ -0,0 +1,41 @@
1
+ # Original results and delivery cases
2
+
3
+ From the User repository, unlock Wallet and use the saved installation:
4
+
5
+ ```bash
6
+ ./run orders list
7
+ ./run orders status ORDER_ID
8
+ ./run orders retrieve ORDER_ID
9
+ ./run orders case ORDER_ID
10
+ ```
11
+
12
+ Use a complete original Order ID from `orders`. Status never initiates a purchase.
13
+ Retrieval uses a short-lived, Order-bound permission, directly contacts the original
14
+ Provider and checks original delivery metadata. It never sends another payment,
15
+ executes service work or confirms receipt. Current-format valid results are saved
16
+ through the existing private result store and reused by the original Skill request.
17
+ Unsupported historical formats need review; they are not silently reinterpreted.
18
+
19
+ Run `./run market connect` once for this Wallet, sign in and choose a nickname.
20
+ Then open Market → Account → Order support and choose the Order. `case` shows this
21
+ guidance; it no longer prints a code for a Buyer page that does not accept one.
22
+ The independent Wallet Case API remains available for API clients.
23
+ See [Market connection](market-connection.md) for scope, privacy and disconnect.
24
+
25
+ Open the case before the displayed filing deadline even if result retrieval is
26
+ still pending. Opening a case does not automatically request or retrieve the
27
+ result; successful retrieval does not withdraw your case or approve early payout.
28
+ Explain the missing delivery and submit relevant evidence. Evidence
29
+ is deliberately shared with the case participants and review service; do not include
30
+ keys, passwords, private payment signatures or unrelated personal information.
31
+
32
+ Receipt confirmation ends the right to open a non-receipt case. Withdrawal does not
33
+ confirm receipt; reopening is allowed before the original cutoff with unchanged
34
+ deadlines. No repeated query, evidence or model retry extends a deadline.
35
+
36
+ New-policy time windows: accepted delivery +7d filing, +10d evidence, +11d latest
37
+ human handoff, +14d decision and +15d ordinary unconfirmed payout. Chain public
38
+ refund opens no earlier than the latest permitted delivery +16d, fixed at creation.
39
+ All days are 24 hours. Existing Orders keep their original policy. Provider-winning
40
+ rulings retain the planned payout; Buyer-winning rulings schedule prompt refunds.
41
+ A completed decision is not proof that a financial transaction has confirmed.
@@ -0,0 +1,80 @@
1
+ # Change or revoke spending permission
2
+
3
+ To stop all payments through an AgentPay Module after a suspected key leak, see [Emergency payment stop](emergency-payment-stop.md). Revoking the current Policy alone may leave other Policies usable.
4
+
5
+ From User, inspect the current permission:
6
+
7
+ ```sh
8
+ ./run policy info
9
+ ```
10
+
11
+ ## Renew or change limits
12
+
13
+ ```sh
14
+ ./run policy renew
15
+ ```
16
+
17
+ New renewal drafts read budget, per-payment limit and validity duration from the
18
+ previous on-chain Policy. Press Enter to keep each displayed value; existing draft
19
+ answers take precedence. Duration starts again from now, not the old expiry date.
20
+ If the previous duration is not a whole number of days, enter days explicitly.
21
+ A previous per-payment limit above a newly reduced budget is not reused.
22
+ Navigation hints appear on a separate line.
23
+
24
+ This works both before and after expiry. Keep the same Safe and Session Key, choose
25
+ new budget/per-purchase limits/validity, then confirm. `back` revisits the draft;
26
+ `q` pauses with answers saved. There is no `-f` bypass for owner approval.
27
+
28
+ Replacement revokes the old Policy before creating the new one. It then asks Wallet
29
+ to independently verify the chain and switch. If creation fails after revocation,
30
+ new payments remain stopped; rerun the same command to continue the saved new Policy.
31
+ Submitted authorization terms cannot be edited as a draft. The new budget is a new
32
+ permission, not an automatic carry-over of old unused allowance.
33
+
34
+ Owner signing follows your explicit local signer selection, independently of the
35
+ network. The default external signer provides a temporary local browser page for
36
+ your Safe owner wallet, including on Anvil. Return to the terminal and enter `check`
37
+ after execution. The guarded Anvil test adapter is available only when explicitly
38
+ selected for the arranged test Safe; chain ID alone never selects it. See
39
+ [browser approval](safe-owner-web.md). No owner private key is requested by AgentPay.
40
+ Implemented signing support does not establish real-network or multisig acceptance.
41
+
42
+ Wallet verifies its existing trusted network/RPC, Safe, Module, key, token, Factory,
43
+ Registry and the new authorization's activation/expiry and unused state. Replacing
44
+ an unexpired Policy requires independent proof that the old one is revoked. The old
45
+ scope is archived before the durable pending/completed binding switch. Retry resumes
46
+ that exact switch and keeps signing blocked while incomplete; unlocking for recovery
47
+ remains possible. No service purchase occurs in this guide.
48
+
49
+ ## Revoke
50
+
51
+ ```sh
52
+ ./run policy revoke
53
+ ```
54
+
55
+ Review the Safe/Policy and type `confirm`. This revokes the current Policy on-chain;
56
+ it keeps the local key and binding for Order history/support. It is different from
57
+ `wallet lock` or `service stop`, which only affect local processes. The command verifies
58
+ revocation after owner approval; repeats detect an already-revoked Policy.
59
+
60
+ `status` and `policy info` show a revocation last verified by these commands. External
61
+ owner revocation is still independently enforced by payment checks; these local
62
+ summaries are not continuous chain monitoring.
63
+
64
+ ## Existing Orders and next step
65
+
66
+ Expiry/revocation stop new spending without cancelling funded Orders. Queries and
67
+ support keep signature, original scope, ownership, replay and business-deadline checks.
68
+ Session Key, local Orders, files and Market connection are retained. After successful
69
+ renewal/binding, a saved Market connection automatically continues into the existing
70
+ connection guide using its saved address. Sign in and confirm to add the new Policy;
71
+ the stable Wallet group and nickname are reused. Without a saved connection, this
72
+ step is skipped. Cancelling or a Market failure does not undo renewal. Retry only
73
+ `./run market connect` to finish website access; do not renew again for this purpose.
74
+ Renewal does not silently broaden Market's authorization scopes.
75
+
76
+ Finish with `./run status`. Its Market section checks the local connection receipt
77
+ against the current Wallet/Policy without contacting Market. A mismatch prompts
78
+ `./run market connect`; a matching receipt does not prove current server availability
79
+ or detect a later website disconnect. Neither renewal nor revocation reruns a completed official
80
+ test or initiates another payment.
@@ -0,0 +1,58 @@
1
+ # Private Anvil terminal onboarding
2
+
3
+ Use this guide with the existing private chain (31337), an operator-reviewed public deployment config, an existing single-owner test Safe and the published official random Skill. User installs Wallet as a reviewed npm dependency; their processes remain separate. User/Wallet access their own files and public or role-authorized APIs.
4
+
5
+ ## Start
6
+
7
+ Build Wallet and install dependencies as described in [User installation](user-onboarding.md). The operator supplies current deployment and package facts using [the config example](../reference/private-anvil-onboarding-config.example.json). Optional `safe` displays the rehearsal Safe as a default. URLs must be loopback addresses; no second Anvil or database is created.
8
+
9
+ Run in an interactive terminal from the User repository:
10
+
11
+ ```bash
12
+ node scripts/user-setup.mjs --anvil /ABSOLUTE/PRIVATE/agentpay-data /ABSOLUTE/PATH/anvil-onboarding.json
13
+ ```
14
+
15
+ The private data directory must be owner-held and outside the User/Wallet repositories. Missing directories are created during initialization. An operator's debug launcher may record terminal output, but must invoke this original command and preserve the terminal needed for hidden password input. It must not automate the participant's answers or replace the User/Wallet operations.
16
+
17
+ ## Four stages
18
+
19
+ | Stage | What you enter | What the guide does |
20
+ | --- | --- | --- |
21
+ | 1. Create local Wallet | Set an unlock secret twice using hidden input | Creates or reuses the encrypted Session Key and local caller credential |
22
+ | 2. Set spending permission | Choose Safe, total budget, per-payment limit and whole days; confirm the final authorization summary once | Saves the exact draft, executes through the selected owner signer, reads back the chain and binds Wallet |
23
+ | 3. Prepare the official test Skill | Unlock Wallet if requested; official package preparation is automatic | Verifies/downloads the package, installs and selects it, starts local processes and checks readiness |
24
+ | 4. Run the paid test | Confirm the displayed maximum cost; verified official-test receipt is acknowledged automatically | Invokes the official service with a durable request identity, verifies delivery and completes the guide |
25
+
26
+ The guide asks for spending authorization and paid-test consent; external owner
27
+ approval also requires the corresponding wallet transactions. Official package preparation and verified test receipt acknowledgement run automatically. Data entry and password prompts remain. At entry or after a pause, choose `continue`, `details` or `q`; successful internal operations advance automatically. Technical substeps remain independently checked and recoverable.
28
+
29
+ Press Enter to use the displayed rehearsal Safe, or enter another Safe account address. Without a Safe, enter `create` for the appropriate guidance. Private Anvil is not available in the official Safe app. Amounts use displayed token units, not atomic integers. Expiry is computed from the selected number of days and displayed in the local timezone.
30
+
31
+ Review the budget carefully: eligible purchases may use the full budget without another owner signature. Qualification verifies identity/control, not service quality. Signer selection is explicit: the default external signer opens the local owner
32
+ approval page, also on Anvil. Only an explicitly selected Anvil adapter uses the
33
+ arranged test owner’s RPC signing operation, with chain and Safe guards. No owner
34
+ private key is entered into AgentPay. See [browser approval](safe-owner-web.md).
35
+
36
+ Deployment and selected-package details are available through `details`. The official-test preparation mode refuses to automatically select local edits; inspect them using the standalone selection command before continuing. `--preview` still provides JSON for technical inspection. New selection cannot abandon existing invocation history.
37
+
38
+ ## Recovery and saved state
39
+
40
+ Reopen the same command with the same directory. The guide reads actual local and chain state, skips completed operations and continues the incomplete stage. A binding failure after successful chain authorization resumes binding; it does not ask you to authorize again. A stopped Wallet must be unlocked after restarting.
41
+
42
+ - `runtime/authorization-fields.json`: validated Safe/budget/per-payment/days, saved by semantic field names with deployment/delegate context. Wording changes do not invalidate saved inputs. No password is stored here.
43
+ - `runtime/authorization-draft.json`: the exact Policy ID and reviewed terms, saved before chain submission. Its presence does not mean authorization succeeded; final consent precedes submission.
44
+ - `runtime/active-skill.json`: selected bundle and file hashes.
45
+ - `runtime/model-ack-smoke.json` and `runtime/invocations.json`: retain both to resume the same test. Conflicting or missing history stops recovery instead of creating a replacement purchase.
46
+
47
+ An older unfinished `authorization-inputs.json` is retained. If no complete draft exists, the guide explains that its old prompt-based answers must be re-entered once; there is no silent migration. Existing complete drafts, Wallet bindings and Order checkpoints continue to be used.
48
+
49
+ Newly started Wallet/Runtime processes remain running after exit. PID/log files are `runtime/wallet-guide.pid`, `runtime/wallet-guide.log`, `runtime/user-runtime-guide.pid` and `runtime/user-runtime-guide.log`. Existing processes are reused only when their checks pass. Stop them through your process manager or verified PID ownership. Binding can start a locked Wallet and does not itself unlock it.
50
+
51
+ A saved confirmed test is revalidated before reporting completion. Automatic receipt acknowledgement for this official test can bring payout forward; connectivity success does not establish terminal financial reconciliation. On completion the guide explicitly ends and directs you to Market to choose other Skills.
52
+
53
+ ## Evidence boundary
54
+
55
+ Focused tests cover orchestration, temporary local IPC/CLI operations and recovery.
56
+ The recorded participant single-owner browser-signing and payment journey passed on
57
+ private Anvil. Neither establishes public-network, multisig or real-funds readiness.
58
+ Current acceptance gaps are tracked in [TODO](../TODO.md).