@c4roa0/agentpay-user 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) 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 +84 -2
  6. package/SECURITY.md +16 -0
  7. package/doc/README.md +52 -0
  8. package/doc/TODO.md +97 -0
  9. package/doc/architecture.md +96 -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 +67 -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 +89 -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 +178 -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 +1231 -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 +306 -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/readiness-profile.mjs +30 -0
  145. package/src/renew-policy.mjs +605 -0
  146. package/src/repair-market-wallet.mjs +137 -0
  147. package/src/restore-wallet.mjs +255 -0
  148. package/src/result-cache-view.mjs +276 -0
  149. package/src/runtime-client.mjs +1145 -0
  150. package/src/runtime-connection-settings.mjs +101 -0
  151. package/src/runtime-recovery.mjs +667 -0
  152. package/src/runtime-status.mjs +32 -0
  153. package/src/safe-owner-anvil.mjs +115 -0
  154. package/src/safe-policy-plan.mjs +195 -0
  155. package/src/service-reference.mjs +233 -0
  156. package/src/service-url.mjs +52 -0
  157. package/src/settlement-response.mjs +69 -0
  158. package/src/setup-autostart.mjs +197 -0
  159. package/src/setup-demo.mjs +152 -0
  160. package/src/skill-bundle.mjs +142 -0
  161. package/src/skill-client.mjs +198 -0
  162. package/src/skill-install-prompt.mjs +31 -0
  163. package/src/skill-package.mjs +50 -0
  164. package/src/skill-zip.mjs +220 -0
  165. package/src/status-panel.mjs +589 -0
  166. package/src/transport.mjs +48 -0
  167. package/src/uninstall-local.mjs +299 -0
  168. package/src/user-cli.mjs +354 -0
  169. package/src/user-setup-guide.mjs +193 -0
  170. package/src/wallet-control.mjs +182 -0
  171. package/src/wallet-ipc-error.mjs +16 -0
  172. package/src/wallet-package.mjs +22 -0
  173. package/update-pair.json +6 -0
@@ -0,0 +1,89 @@
1
+ # User command reference
2
+
3
+ Use `agentpay` after installing the package or linking a source checkout with
4
+ `npm link`. From a source folder, `./run` is the same entry; it uses Node on PATH
5
+ or `AGENTPAY_NODE`.
6
+
7
+ ```sh
8
+ agentpay help
9
+ agentpay status
10
+ ```
11
+
12
+ Top-level operations are `install --market URL`, `setup`, `repair [-f]`,
13
+ `update [-f]`, `uninstall [--delete-data]` and `status`.
14
+ Update checks npm and installs User with its pinned Wallet, then checks the official
15
+ test Skill. It asks before changes unless `-f` is given. Source/npm-link installations
16
+ use manual source updates followed by repair. Repair checks installed packages and
17
+ confirms service interruption; `-f` skips that prompt only. Uninstall removes
18
+ services and keeps data unless `--delete-data` is explicitly confirmed. Neither
19
+ operation revokes on-chain permission.
20
+
21
+ | Group | Operations |
22
+ | --- | --- |
23
+ | `wallet` | `info`, `unlock`, `lock`, `restore` |
24
+ | `policy` | `info`, `renew`, `revoke` |
25
+ | `service` | `start`, `stop`, `restart`, `autostart on/off`, `logs wallet/runtime` |
26
+ | `market` | `connect [--market URL]` |
27
+ | `orders` | `list`, `details ID`, `status ID`, `retrieve ID`, `case ID`, `archive ID`, `unarchive ID`, `files ID [remove KEY]` |
28
+ | `cache` | `info`, `list`, `details ID`, `export ID PATH`, `clean`, `settings [KEY VALUE]` |
29
+ | `payment` | `test` |
30
+
31
+ A group without an action shows help; it never unlocks, revokes or changes files.
32
+ Use `<group> help`, or `service autostart help`, to see focused instructions. Old
33
+ flat commands such as `unlock`, `renew`, `connect-market`, `order ID details` are
34
+ no longer accepted; use the grouped forms shown here.
35
+
36
+ ## Common tasks
37
+
38
+ ```sh
39
+ agentpay service start
40
+ agentpay wallet unlock
41
+ agentpay status
42
+ agentpay payment test
43
+
44
+ agentpay policy renew
45
+ agentpay policy revoke
46
+
47
+ agentpay orders list
48
+ agentpay orders details ORDER_ID
49
+ agentpay orders retrieve ORDER_ID
50
+
51
+ agentpay service autostart off
52
+ agentpay service stop
53
+ agentpay service logs runtime
54
+ ```
55
+
56
+ `policy renew` covers expired renewal and active replacement. Revoking permission
57
+ requires owner confirmation, and existing Orders retain their support rules.
58
+ Service stop/Wallet lock do not revoke permission. Archive hides a local warning;
59
+ it does not cancel or settle an Order. Retrieve requests the original result and
60
+ never buys a replacement. Cache removal only removes local copies.
61
+
62
+ Online Order operations require an unlocked Wallet. Start/unlock instructions and
63
+ `status` guide you to the next action; setup renews expired authorization first.
64
+
65
+ `status` includes a Policy section and expiry. “Within saved validity period” describes
66
+ local saved validity, not a new chain/payment-readiness check. Revocation records
67
+ are the last verification by this command suite. Unknown or conflicting scope is
68
+ shown as unconfirmed; use `policy info` for saved details.
69
+
70
+ `payment test` is the maintained end-to-end purchase check. In this release it uses
71
+ the reviewed private-Anvil official Skill. It shows the current price and service
72
+ time and asks before every new paid Order. If a test is unfinished, the same command
73
+ resumes its saved request instead of starting another purchase. Completed test records
74
+ are archived before a new one; the original onboarding test and Skill selection stay
75
+ untouched. After verified delivery, Wallet acknowledges receipt, which can bring
76
+ forward Provider payout.
77
+
78
+ The command checks payment, delivery and receipt acknowledgement. Provider payout
79
+ follows the Order’s settlement schedule; success does not claim final payout.
80
+
81
+
82
+ ### Order status sources
83
+
84
+ `agentpay orders status ID` reads the current Settlement record through Wallet.
85
+ It displays retrieval time and the record update time when available; it does not
86
+ independently query the chain. If querying fails, the command labels the last
87
+ local record and its saved check time. A successful query does not rewrite local
88
+ history; Runtime maintains its own recovery observations. Use
89
+ `agentpay orders details ID` for the saved local record.
@@ -0,0 +1,42 @@
1
+ # Update spending permission after contract changes
2
+
3
+ Run `./run setup` or `./run policy renew`. Both check the published deployment and
4
+ explain a mismatch before owner transactions. An existing Market connection supplies
5
+ the HTTPS (or private loopback) configuration source. Without one, the guide can
6
+ use the public deployment file downloaded by installation. `status` labels this
7
+ as downloaded evidence rather than a current platform check.
8
+
9
+ Review updated permission, using `details` to inspect old/new contracts. Factory and
10
+ Module changes are supported within the same network, Safe, execution key, token,
11
+ Registry and RPC. Network/token/Registry moves require separate review. Removing a
12
+ Module as an emergency stop is not silently undone by an ordinary renewal.
13
+
14
+ An update defaults to unspent allowance. Exhausted allowance has no automatic new
15
+ budget default. Remaining validity supplies the duration default; retaining that
16
+ default preserves the original expiry. Editing budget or duration deliberately
17
+ requests new limits, which the owner reviews before signing. Ordinary renewal
18
+ continues to offer a new budget and duration. No service-specific logic is involved.
19
+
20
+ Owner approval revokes the original Policy before creating its replacement, enabling
21
+ the destination Module if required. Wallet independently checks original revocation,
22
+ matching identity, destination chain data and zero destination spend before binding.
23
+ Original Policy scope and Orders remain in history. Temporary failure or leaving the
24
+ webpage resumes the saved plan; do not delete records or create replacement purchases.
25
+ A completed chain/binding operation with unfinished local synchronization retries
26
+ that synchronization before a subsequent fresh renewal.
27
+
28
+ After successful binding, setup settings/public Policy/draft projections are updated.
29
+ Previous setup/draft files are retained privately. Existing Market connection flow
30
+ continues; failure there does not undo authorization. No automatic login or new
31
+ spending authority is granted by merely downloading deployment settings.
32
+
33
+ `./run status` shares a 60-second success/error cache for deployment checks. A changed
34
+ deployment takes priority over local missing-result warnings; Orders retain their
35
+ warnings below. A failed check is unavailable, never healthy or proof of revocation.
36
+ Matching deployment does not guarantee a particular service or Order can be bought.
37
+
38
+ Development checks use controlled RPC/IPC fixtures. The recorded private participant
39
+ MetaMask renewal, payment journey and historical Order viewing passed within their
40
+ recorded scope. Full interruption/multisig and public-network acceptance remain
41
+ separate tasks in [TODO](../TODO.md); viewing history does not prove every support
42
+ mutation. No real-network compatibility is claimed by Anvil tests.
@@ -0,0 +1,80 @@
1
+ # Emergency stop: disable AgentPay payments from your Safe
2
+
3
+ Use this procedure if your computer or Wallet Session Key may be compromised.
4
+ Use another trusted device and your Safe owner wallet. Do not enter owner keys,
5
+ Session Keys or unlock passwords into Market or send them to support.
6
+
7
+ This procedure assumes the Safe owner signers remain under your control.
8
+ A compromised owner signer requires a separate Safe account recovery response;
9
+ disabling a Module alone is not sufficient if an attacker can enable it again.
10
+
11
+ ## What disabling the Module means
12
+
13
+ Your Safe permits the AgentPay Spending Module to execute bounded payments.
14
+ Removing that Module from this Safe stops all new payments through that Module,
15
+ across all its Policies and Wallet execution addresses. It does not disable the
16
+ Module for other users' Safes or shut down AgentPay.
17
+
18
+ A copied Session Key cannot bypass this stop: AgentPay funding calls the Safe's
19
+ module execution function, which requires the Module to remain enabled.
20
+ The stop takes effect only when the disabling transaction executes successfully
21
+ on-chain. A pending proposal or owner signature is not a completed stop; payments
22
+ may still execute before it.
23
+
24
+ ## Stop payments from a trusted device
25
+
26
+ 1. Open [Safe Wallet](https://app.safe.global/), select the correct network and Safe.
27
+ 2. Open Settings and find Modules (under advanced settings in some versions).
28
+ Identify the AgentPay Spending Module by its exact address, not only its label.
29
+ Your saved setup and `./run wallet info` expose that address, but information
30
+ displayed on the compromised computer must be independently checked.
31
+ 3. Select removal for that Module. Review the Safe, network and target Module.
32
+ Obtain the Safe's required owner approvals and execute the transaction.
33
+ 4. Confirm a successful chain receipt and verify
34
+ `isModuleEnabled(moduleAddress) == false` on the correct Safe.
35
+ 5. Check for other enabled AgentPay Module versions on this Safe, and repeat if
36
+ necessary. Each network and Safe must be handled separately.
37
+
38
+ Safe exposes this through `disableModule(prevModule, module)`, called by a Safe
39
+ transaction targeting the Safe itself. `prevModule` is the predecessor in its
40
+ enabled-module linked list, not a previous AgentPay release. Do not guess this
41
+ address or submit a direct owner-account call as a substitute for a Safe transaction.
42
+
43
+ Official references:
44
+ [Managing Modules](https://help.safe.global/articles/7039805766-add-a-module),
45
+ [disableModule](https://docs.safe.global/reference-smart-account/modules/disableModule).
46
+
47
+ ## What remains unchanged
48
+
49
+ - Safe owner operations remain available. Other unrelated enabled modules are not removed.
50
+ - Already-funded Order Vaults retain their delivery, cancellation, dispute, payout
51
+ and refund rules. This operation does not refund them.
52
+ - Policy records remain on-chain. Disabling does not revoke or delete them.
53
+ - Market Disconnect, sign-out, stopping Runtime or locking Wallet do not replace
54
+ this chain operation. An attacker may hold a copied key elsewhere.
55
+ - This is a payment stop, not revocation of every history/support credential.
56
+ Do not assume copied credentials lose all non-payment access.
57
+
58
+ ## Before restoring payments
59
+
60
+ Keep the Module disabled while investigating. Replace the compromised execution
61
+ key and revoke its still-valid Policies through the Safe owner before re-enabling
62
+ the Module. Review all relevant Policies, including ones absent from Market's
63
+ connected list. Re-enabling without this cleanup can restore an attacker's
64
+ remaining spending permission.
65
+
66
+ Use a trusted installation for the replacement Wallet. Do not restore a suspected
67
+ leaked key as a security remedy. Keep Order history and incident evidence; do not
68
+ repeat paid requests to recover missing results.
69
+
70
+ ## Current product and rehearsal limits
71
+
72
+ Market currently provides connection management and revocation documentation;
73
+ it does not execute this emergency Safe transaction. `./run policy revoke`
74
+ addresses the locally selected Policy, not every Policy or the entire Module.
75
+ See [Policy renewal and revocation](policy-renewal.md).
76
+
77
+ The private Anvil rehearsal is not available through the hosted Safe Wallet.
78
+ It needs a separately prepared owner-authorized Safe transaction and independent
79
+ chain checks. No emergency Module-disable rehearsal has been completed by writing
80
+ this guide. Do not send private rehearsal transactions to a real network.
@@ -0,0 +1,212 @@
1
+ # Local automatic startup (Linux)
2
+
3
+ Wallet and Runtime can start as systemd user services when you log in. Wallet starts
4
+ locked. Your Session Key and existing Safe Policy are reused; no password is saved.
5
+ This does not enable startup before login or require administrator access/linger.
6
+
7
+ ## Enable during setup
8
+
9
+ After the official connectivity test succeeds, the Linux terminal guide asks once
10
+ whether Wallet and Runtime should start automatically when you log in. Choosing yes
11
+ installs/enables the services and reminder without restarting current processes.
12
+ Choosing no keeps manual startup. Your choice is remembered; q leaves it undecided.
13
+ A saved yes is retried after partial installation failure without repeating consent
14
+ or creating another payment. Manual enable/disable updates the same preference.
15
+
16
+ The installer verifies that existing listeners belong to its matching guide processes
17
+ or existing user services. Missing/stale PID records, mismatched arguments/data paths,
18
+ and system-managed processes block automatic adoption. It never kills a PID from a
19
+ saved file. On the private shared host, operator services remain operator-managed.
20
+
21
+ ## Manage after setup
22
+
23
+ The terminal setup start step saves your public Runtime/Settlement addresses in
24
+ `runtime/local-services.json` under your remembered User data directory. From User:
25
+
26
+ ```bash
27
+ ./run service autostart on
28
+ ```
29
+
30
+ This installs and enables the services for the next login. It does not replace or
31
+ stop current terminal-started or operator-managed processes. Current guide processes are left running; the handoff is deferred until they exit
32
+ or the computer restarts. Do not run two managers for the same Wallet.
33
+ If a login happens while old processes still run, managed startup refuses the occupied
34
+ socket/port; inspect status and explicitly stop the old processes before using start.
35
+ After a clean login, use `./run wallet unlock` to resume signing.
36
+
37
+ If you completed setup before this feature, an operator can save the matching public
38
+ addresses once with `node scripts/autostart.mjs configure RUNTIME_URL SETTLEMENT_URL`.
39
+ Use your existing deployment, not arbitrary endpoints. This saves settings only.
40
+ Do not change endpoints to work around an incomplete request or Policy migration.
41
+
42
+ ## Manage
43
+
44
+ From User, `./run status` shows the services. Use `start` or
45
+ `stop` for these managed processes. Before manually starting them, stop any existing
46
+ terminal/operator-managed instance explicitly. A live Wallet socket or Runtime port
47
+ is rejected; it is never removed to take over an existing process.
48
+
49
+ `./run service autostart off` disables login startup without stopping current processes.
50
+ `./run service stop` stops them now without changing the login preference.
51
+ `./run service start` starts them manually; `./run service restart` restarts them locked.
52
+ `./run service logs runtime` shows recent Runtime service errors. Wallet data and history remain.
53
+ This is not on-chain revocation, deletion of the installation, or Order cancellation.
54
+
55
+ Files are installed under `~/.config/systemd/user/`: agentpay-local-wallet.service,
56
+ agentpay-local-runtime.service and agentpay-wallet-reminder.service. The installer
57
+ does not use or change `~/.config/autostart`, including its permissions or contents.
58
+ A conflicting existing file is preserved and reported. Services use absolute Node
59
+ and source paths; do not move/delete those paths before disabling/reconfiguring.
60
+ The current implementation uses the standard ~/.config location.
61
+
62
+ ## Login reminder
63
+
64
+ A systemd user oneshot, enabled for graphical-session.target, checks Wallet status
65
+ and sends one best-effort notification
66
+ if it is locked. It does not unlock, prompt for a password, open a terminal or make
67
+ a payment. The notification tells you to open User and run `./run wallet unlock`.
68
+ There is no click-to-unlock action in this first version.
69
+
70
+ Linux needs a desktop environment that starts systemd graphical-session.target and
71
+ imports its display/session environment, a notification service, and `notify-send`.
72
+ The reminder stays active until graphical logout (PartOf + RemainAfterExit) so normal
73
+ Wallet restarts do not repeat it. Manual service start starts only Wallet/Runtime. With SSH/headless
74
+ sessions, missing notification support or an already unlocked Wallet, no popup is
75
+ sent. Runtime/Skill locked errors still show the unlock command. A missed notification
76
+ does not grant authority or block service startup. If Wallet does not become available
77
+ during bounded checking, inspect service status; notification is not a health monitor.
78
+
79
+ ## Acceptance scope
80
+
81
+ Isolated process tests verify locked Wallet/Runtime startup, duplicate Wallet refusal,
82
+ stop/restart with unchanged test key and no invocation. Unit/CLI tests and systemd
83
+ file validation passed. The terminal installer now offers deferred automatic startup after its successful
84
+ connectivity test; it does not immediately replace guide processes. The participant reported successful Wallet restart/lock/unlock and a manually triggered
85
+ desktop reminder. Runtime exited with status 1; its journal is still required. Actual
86
+ login/reboot and complete Runtime recovery acceptance remain pending. macOS launchd support is pending.
87
+ Do not manually enable these user services on the shared rehearsal host while its operator
88
+ services use the same data/socket/port. No existing rehearsal service was changed.
89
+
90
+ The `startupChoice` field in local-services.json records the requested preference,
91
+ not proof that systemd enable/start succeeded. Use status to inspect actual services.
92
+ If setup reports automatic startup pending, current processes remain in place and
93
+ local keys/Policy/history remain unchanged; retry enable after correcting the problem.
94
+
95
+ Desktop environments without that systemd session integration may not show a reminder;
96
+ Wallet/Runtime still start through the user default target and locked-call guidance
97
+ remains available. No password is collected through the notification. The former
98
+ prototype desktop entry is not generated or automatically deleted by this version.
99
+
100
+ ## Uninstall
101
+
102
+ Run `./run uninstall` in an interactive terminal. It lists the selected local
103
+ installation and requires the exact phrase `DELETE LOCAL AGENTPAY DATA`.
104
+ Confirmation stops/removes its managed services and permanently deletes its local
105
+ Session Key, credentials, installed Skills, recovery history and installer settings.
106
+ It preserves the source repositories and tells you to delete User and Wallet folders
107
+ once cleanup succeeds. Other installations and unrelated startup files are preserved.
108
+ Unknown service definitions, active external listeners or unsafe paths block cleanup.
109
+
110
+ Uninstall does **not** revoke Safe authorization or cancel Orders. Resolve pending
111
+ Orders and revoke permission separately before retiring an installation. Reinstalling
112
+ cannot recover deleted keys or request history. Neither `stop` nor `autostart-off`
113
+ deletes data. Graphical password input is deferred; unlock remains a terminal command.
114
+
115
+ ## Private rehearsal networking
116
+
117
+ Current Anvil settings contain loopback RPC, Settlement and package URLs, and the
118
+ published reference package still uses a loopback Provider URL. A desktop using those
119
+ settings needs the arranged SSH tunnels. Existing nginx routes do not rewrite saved
120
+ configuration or package identities. Keep Anvil and local Wallet/Runtime private.
121
+ A production installation must use public HTTPS Market/Settlement/Provider URLs and
122
+ an appropriate chain RPC; SSH forwarding is not a normal user installation step.
123
+ Public settings/package handoff and production owner signing remain release work.
124
+
125
+ ## Startup self-check and historical Orders
126
+
127
+ Runtime starts its authenticated local listener before checking business history.
128
+ `./run status` shows process state, local inventory, Wallet availability and Order
129
+ check counts separately. A running process is not proof that a purchase is eligible.
130
+ The local `/status` endpoint requires the existing caller credential; `/health`
131
+ remains a minimal liveness endpoint.
132
+
133
+ The background task only reads Wallet status and original Settlement Orders. Locked
134
+ Wallets wait for unlock; unavailable services are retried with bounded backoff.
135
+ It does not create Orders, send payments, execute Provider work, confirm receipt or
136
+ cancel Orders. Existing Settlement workers retain their automatic refund duties.
137
+
138
+ Old invocation records stay unchanged. Known legacy requests cannot be replayed as
139
+ new purchases. Valid inventory permits unrelated requests through ordinary checks;
140
+ unreadable/missing/conflicting history or failed recovery-state writes pause new
141
+ paid calls without stopping the status listener. Missing caller authentication or
142
+ an occupied port still prevents unsafe startup.
143
+
144
+ Financial state and verified result availability are separate. A settled Order with
145
+ no verified local output is reported explicitly; Runtime will not re-execute that
146
+ settled service request to replace missing output. Unknown IDs, mismatched identities,
147
+ legacy output formats and unavailable original deployment access require review.
148
+ Do not delete history or add routing-version fields to bypass those protections.
149
+
150
+ Observations are saved privately beside `runtime/invocations.json` in
151
+ `runtime/invocations.json.recovery.json`; the original history, signed payloads and
152
+ result files are not migrated or erased. The observation file contains identifiers,
153
+ check times and conclusions, not private inputs, outputs or signatures. It is part
154
+ of the selected local data removed only by confirmed uninstall. Cached observations
155
+ are not a substitute for the Wallet/Settlement checks on each actual invocation.
156
+
157
+ The queue handles at most 4 records per pass, one read at a time. The IPC timeout allows Wallet's
158
+ 30-second HTTP deadline to finish before the next read. Passes wait about
159
+ 10–11 seconds after the previous pass; pending Orders are rechecked after 30 seconds, failed reads use
160
+ backoff up to five minutes, and terminal observations at most hourly. `./run status`
161
+ wakes a pass without bypassing per-Order backoff. Large inventories can take several
162
+ passes. All observed times are Unix milliseconds internally.
163
+
164
+ ### Reading status
165
+
166
+ `./run status` groups services, Orders and one suggested next command. A live Wallet
167
+ read takes precedence over an older background observation when describing lock state.
168
+ Green `[OK]`, yellow `[WAIT]` and red `[!]` distinguish normal, waiting and blocked
169
+ conditions in interactive terminals. Redirected output is plain text; `NO_COLOR` or
170
+ `TERM=dumb` also disables color. Labels remain readable without color.
171
+
172
+ Status layout wraps explanations for terminals of at least 40 columns, keeps service
173
+ columns aligned with or without color, and does not show zero Orders when inventory
174
+ is unavailable. A successful summary says local checks passed, not payment approved.
175
+
176
+ Login startup reports Enabled/Disabled only when systemd confirms that setting.
177
+ Not configured for this user means the corresponding user unit is absent; it does
178
+ not describe administrator-managed services. Could not check means the query did
179
+ not establish the setting. Temporary enablement and masking are shown separately.
180
+ Start/restart output confirms that systemd accepted a request, not that Runtime
181
+ finished self-check; use status next. Stop/off remain separate operations.
182
+
183
+ ### What to do next
184
+
185
+ | Status | Action |
186
+ | --- | --- |
187
+ | Runtime/Wallet stopped | Use the displayed start command, then check status. |
188
+ | Status unavailable | Inspect the indicated service log; do not reset history. |
189
+ | Locked | Run `./run wallet unlock`; background Order checks resume. |
190
+ | Permission missing | Run `./run setup`. An existing migration must follow its original update instructions instead. |
191
+ | Initial checks in progress | Leave services running; check after about 15 seconds. Large histories take longer. |
192
+ | Order check temporarily unavailable | Automatic backoff continues. If persistent, check network and Runtime logs. |
193
+ | Orders in progress | Keep services running and use the original Agent conversation. Only resume supported original requests with their original identifiers. |
194
+ | Identity/state/result conflict, unknown Order or missing Order ID | Preserve history; ask AgentPay support to review the Order/status. Do not share secrets or signed payloads. |
195
+ | Payment complete; local result unavailable | Check the original conversation, then ask the Provider using the Order ID. Repeated status checks cannot reconstruct the result; do not pay again to recover it. |
196
+ | Local checks passed | This check is finished. Normal checks still apply to each purchase. |
197
+
198
+ Mixed histories retain per-Order explanations; pending Orders continue automatic
199
+ checks even when another Order needs review. Background terminal-state rechecks
200
+ remain enabled; the guidance does not change recovery scheduling.
201
+
202
+ ## Missing startup settings
203
+
204
+ `./run service start` prepares missing user-service configuration for an initialized Wallet.
205
+ It reuses private User settings and asks for any missing endpoint in the terminal.
206
+ It never reads platform secret configuration or changes your Policy.
207
+ `./run market connect` uses the same preparation before rebuilding/restarting when
208
+ needed. Preparing services does not turn on login startup. Conflicting saved
209
+ addresses stop the flow for review; no new identity is generated.
210
+
211
+ An old system-level installation requires an operator handoff first; User does not
212
+ stop root services. Do not initialize another Wallet to fix process management.
@@ -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.