@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,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).
@@ -0,0 +1,155 @@
1
+ # Call paid services from a Skill
2
+
3
+ Audience: Skill authors and local Agent integrators. Use the common per-call
4
+ Runtime contract; no process-wide Skill selection or business adapter is needed.
5
+ See [service contract](../reference/multi-service-runtime.md). Actual DeepSeek
6
+ Harness/Claude Code discovery and execution remain separate acceptance.
7
+
8
+ ## Local setup
9
+
10
+ Complete User/Wallet setup. The guide saves runtime/connection.json in the private
11
+ User data directory: loopback Runtime URL, caller token file path and installed
12
+ User module location. The token itself never enters a package or model message.
13
+ The default is $HOME/.local/share/agentpay/user; set AGENTPAY_USER_DATA_DIR for a
14
+ custom directory. Keep User installed at its recorded location.
15
+
16
+ Existing developer installations can save discovery from the User repository:
17
+
18
+ ```bash
19
+ node scripts/configure-runtime-client.mjs "$HOME/.local/share/agentpay/user" http://127.0.0.1:6490
20
+ ```
21
+
22
+ This writes local connection metadata only; it does not authorize spending.
23
+
24
+ ## Author package
25
+
26
+ Download Market's Skill template. Fill package identity, copy registered service
27
+ references into services.main and additional aliases, and implement business input
28
+ validation and result interpretation in the wrapper. Keep payment/credentials in
29
+ the installed shared User client. The template text parameter is only an example.
30
+
31
+ ```bash
32
+ node scripts/call-runtime.mjs --check
33
+ node scripts/call-runtime.mjs --invoke '{"text":"hello"}' --units 1
34
+ node scripts/call-runtime.mjs --service second --invoke '{"text":"hello"}'
35
+ ```
36
+
37
+ --check verifies local interface/reference matching; it does not reserve a Quote or
38
+ establish purchase readiness. --units is a maximum, not a price or actual usage.
39
+ Provider business output is application-owned. Verify delivery using the agreed
40
+ evidence contract; do not invent a new output shape or hashing requirement.
41
+
42
+ ## Recovery and explicit new purchase
43
+
44
+ Retry the same input normally. Matching calls recover the same request or reuse
45
+ saved verified output. Use --force only for an explicitly intended additional
46
+ purchase. It never bypasses Policy. Diagnostic --resume <request-id> selects an
47
+ existing request when several unfinished forced calls make automatic selection
48
+ ambiguous. Preserve private checkpoints and invocation history. A lock left during
49
+ local request selection fails closed for inspection; do not delete purchase state
50
+ or automatically force a new request to work around it.
51
+
52
+ ## Release and acceptance
53
+
54
+ The installed User and Wallet dependencies must match their shipped lockfiles.
55
+ Preserve older request identities during upgrades; never reinterpret their routing
56
+ or create replacement purchases. The official paid connectivity suite remains the
57
+ installation acceptance test. Other business payloads are tested with maintained
58
+ controlled fixtures, not third-party Skills.
59
+
60
+ Runtime starts with retained older requests and performs read-only self-checks.
61
+ Unsupported or unknown original scopes remain visible for review; they do not
62
+ become eligible for replacement purchases. Use `./run orders list` and the suggested
63
+ `details`, `status` or `archive` actions. Archiving preserves the request and does
64
+ not establish its financial state. See [original Order recovery](../reference/original-order-recovery.md).
65
+
66
+ ## Optional result files
67
+
68
+ Runtime preserves received structured results; a URL in a result is not a saved
69
+ file. Skills can explicitly cache selected files through the installed client.
70
+ Use the [file-cache interface](../reference/result-file-cache.md) for API examples,
71
+ limits and digest semantics. Users inspect copies with `./run orders files ORDER_ID`.
72
+ File operations never start a new purchase or confirm receipt.
73
+
74
+ ## Transport failures
75
+
76
+ `RUNTIME_TIMEOUT` means the response deadline elapsed; an Order may still be running.
77
+ `RUNTIME_RESPONSE_TOO_LARGE` means the bounded JSON response was exceeded.
78
+ `RUNTIME_RESPONSE_INVALID` means unreadable JSON or failed delivery verification.
79
+ `RUNTIME_UNAVAILABLE` means communication could not finish. Check local status/logs
80
+ as directed and resume the original request. None of these proves non-payment or
81
+ allows replacing a purchase. Binary files use the separate explicit file interface.
82
+
83
+ Provider profiles may use HTTP or HTTPS. Existing requests retain their exact
84
+ registered endpoint/profile. HTTP provides no transport confidentiality; use HTTPS
85
+ when the service requires it. This does not change local Runtime loopback or
86
+ Market/Settlement credential requirements, or package-download validation.
87
+
88
+ ## File inputs and outputs
89
+
90
+ The current installed client provides `skillClientCapabilities` including
91
+ `input-snapshots-v1`. The official Agent template distributed by Market checks it before running. Upgrade User
92
+ and restart Runtime together; older Runtime versions lack original-request recovery.
93
+
94
+ The optional hooks are:
95
+
96
+ ```js
97
+ await runSkill({
98
+ service,
99
+ validateRequest: validateYourBusinessInput,
100
+ inputFiles(input) {
101
+ return [{fileKey: 'document', sourcePath: input.absoluteFilePath,
102
+ filename: 'document.pdf'}];
103
+ },
104
+ async prepareRequest({request, files, requestId}) {
105
+ // Implement YOUR Provider's upload/reference contract using files[].localPath.
106
+ // Use requestId/fileKey to make preparatory uploads idempotent where supported.
107
+ // Return bounded business JSON, not an embedded large binary or a local path
108
+ // that the remote Provider cannot access. Never create/pay Orders here.
109
+ return prepareYourProviderInput(request, files, requestId);
110
+ },
111
+ outputFiles(output) {
112
+ return [{fileKey: 'report', url: output.reportUrl, filename: 'report.pdf'}];
113
+ }
114
+ });
115
+ ```
116
+
117
+ These illustrative business functions are author code, not built-in APIs. JSON-only
118
+ Skills omit the hooks. Input declarations accept either an absolute `sourcePath` or
119
+ an HTTP/HTTPS `url`, plus unique `fileKey`, optional `filename` and SHA-256 `sha256`.
120
+ At most 20 declarations are allowed; local resource limits also apply. No automatic
121
+ path/URL discovery, archive extraction or format restriction is added.
122
+
123
+ The common client saves declarations, snapshots and the final adapted request before
124
+ paid invocation. Retrying after source changes uses original copies. `--resume` never
125
+ reinterprets a submitted request through newly edited business preparation code.
126
+ Use `--force` only for an intentional additional purchase/new input snapshot.
127
+
128
+ Output download failure preserves the verified result and request ID. The command
129
+ returns nonzero with `ok: true` delivery and `fileCache.state: incomplete`; retry the
130
+ same call to finish downloading, not `--force`. Saved files are optional local copies,
131
+ not a new delivery-proof format. View/manage copies with `./run cache`.
132
+
133
+ Once Runtime verifies durable delivery, original inputs become eligible for confirmed
134
+ cleanup. If release cannot be checked, they remain protected; retry the original call.
135
+ A saved Runtime result can restore missing client results even after input cleanup.
136
+
137
+ Runtime port changes do not change the request. A possibly submitted request requires
138
+ matching Runtime history and atomic existing-only continuation. Missing history stops
139
+ with `ORIGINAL_REQUEST_NOT_FOUND`: preserve local files and review with support; do
140
+ not delete checkpoints, change IDs or force another purchase to recover it.
141
+
142
+ ## Service and package addresses
143
+
144
+ Service references must conform to the existing Protocol v1 profile: the challenged
145
+ MCP endpoint and payment endpoint have the canonical service-specific suffixes.
146
+ An allowed deployment prefix is supported. Do not derive or change these identities
147
+ inside a Skill to bypass validation. These rules apply to all service businesses.
148
+
149
+ The ZIP download URL is independent: use the publisher's explicit full URL plus a
150
+ trusted expected SHA-256, or Market's metadata/download link. The direct installer
151
+ does not derive the ZIP path from `/invoke` and does not require a `main` service
152
+ alias. Multiple service aliases may point to independently registered services.
153
+ Generic `--preview`/`--execute` install without global selection; official test
154
+ selection remains scoped to the maintained connectivity suite. Transport safety,
155
+ archive structure, digest and service-profile validation still apply.