@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
package/doc/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # User documentation
2
+
3
+ ## Start by role
4
+
5
+ | Reader | Start here |
6
+ | --- | --- |
7
+ | Installing User | [README](../README.md), [installation](runbooks/user-onboarding.md), [usage](usage.md) |
8
+ | Managing an existing installation | [Commands](runbooks/commands.md), [updates](runbooks/local-update.md), [background services](runbooks/local-autostart.md) |
9
+ | Skill author / Agent integrator | [Shared Runtime client](runbooks/runtime-skill-client.md), [invocation contract](reference/multi-service-runtime.md), [file cache](reference/result-file-cache.md) |
10
+ | Contributor | [Developer guide](develope.md), [source map](architecture.md), [design](design.md), [tests](../test/README.md) |
11
+ | Security reviewer | [Reporting](../SECURITY.md), [owner page boundary](reference/local-safe-owner-ui.md), [recovery](reference/original-order-recovery.md) |
12
+ | Maintainer | [Progress](../progress.md), [TODO](TODO.md), [public-source review](security/public-source-review-2026-11-06.md) |
13
+ | AI contributor | [AGENTS](../AGENTS.md), then current progress and affected interfaces |
14
+
15
+ ## User guides
16
+
17
+ - [Owner browser approval](runbooks/safe-owner-web.md)
18
+ - [Renew or revoke permission](runbooks/policy-renewal.md)
19
+ - [Deployment authorization update](runbooks/deployment-authorization-update.md)
20
+ - [Wallet backup and restoration](runbooks/wallet-identity.md)
21
+ - [Market connection](runbooks/market-connection.md)
22
+ - [Order support](runbooks/order-support.md) and [cancellation](runbooks/order-cancellation.md)
23
+ - [Cache management](runbooks/local-cache.md)
24
+ - [Emergency payment stop](runbooks/emergency-payment-stop.md)
25
+
26
+ ## Implementation references
27
+
28
+ - [Public deployment settings and signer selection](reference/public-deployment-settings.md)
29
+ - [Wallet identity and Policy history](reference/wallet-identity-policy-history.md)
30
+ - [Startup and Order recovery](reference/runtime-startup-recovery.md)
31
+ - [Runtime address recovery](reference/runtime-address-recovery.md)
32
+ - [Cache foundation](reference/local-cache-foundation.md), [input/output snapshots](reference/skill-input-output-cache.md), [result persistence](reference/runtime-result-cache.md)
33
+ - [Harness integration](reference/harness-skill-runtime.md)
34
+ - [Local repair](reference/local-update.md)
35
+ - [Onboarding writing rules](reference/onboarding-writing.md)
36
+
37
+ ## Scoped development / advanced procedures
38
+
39
+ - [Official package maintenance](runbooks/official-test-package.md), [random test example](reference/random-skill-contract.md)
40
+ - [Terminal demo preview](runbooks/terminal-authorization-preview.md)
41
+ - [Private Anvil setup](runbooks/private-anvil-terminal-setup.md)
42
+ - [Initial Safe authorization](runbooks/safe-policy-setup.md), [advanced migration](runbooks/safe-policy-migration.md)
43
+ - [Unlock instructions](runbooks/unlock-wallet.md)
44
+
45
+ The [User/Wallet distribution plan](plans/user-wallet-distribution.md) describes future
46
+ compatibility and combined packaging work. `reference/` describes implemented design;
47
+ `runbooks/` provides operation steps; `security/` records boundaries and review scope.
48
+ Private platform histories and harnesses are retained outside this public tree.
49
+
50
+ - [User npm integration verification](reference/npm-integration-verification.md): candidate installation, repair and evidence limits.
51
+
52
+ - [npm publication](runbooks/npm-publication.md): archive checks, initial upload and GitHub Trusted Publisher.
package/doc/TODO.md ADDED
@@ -0,0 +1,97 @@
1
+ # User TODO
2
+
3
+ ## npm update follow-up — 2026-11-07
4
+
5
+ - [x] Implement confirmed `agentpay update [-f]`, exact User target and matching Wallet; invoke new repair and pinned official Skill check.
6
+ - [x] Fix relocation preparation ordering, matching legacy purge and packaged document links.
7
+ - [x] Complete update/migration regressions (374 full-suite and 35 final targeted checks) and real npm replacement of local candidate artifacts; controlled service/registry dependencies.
8
+ - [ ] After User release, verify a real published-version npm upgrade and participant service recovery.
9
+
10
+ ## npm client distribution — 2026-11-07
11
+
12
+ - [x] Record npm-first plan; combined source ZIP is optional, not the primary installer.
13
+ - [x] Step 1: commit verified User/Wallet Protocol dependency migration baseline.
14
+ - [x] Step 2: prepare Wallet public entry points, compiled npm artifact and standalone acceptance (29 behavioral tests plus installed-package CLI/IPC lifecycle).
15
+ - [x] Review step 2: guard normal packing against missing/stale builds, correct public-interface docs and verify a standalone TypeScript consumer.
16
+ - [x] Step 3: migrate User to Wallet npm dependency and `agentpay` entry; remove sibling/build assumptions; isolated tarball/process acceptance passed.
17
+ - [x] Step 4a: exact installed-package checks, service-path/client relocation, installer lock, recovery-safe preparation and explicit uninstall modes.
18
+ - [ ] Step 4b: running-daemon version/interface negotiation and participant upgrade/interruption acceptance.
19
+ - [ ] Step 5: publish Wallet then User via OIDC; verify registry installs and update Market guides.
20
+ - [x] Wallet 0.3.0 first Token publication; registry integrity/latest and fresh public install/CLI/IPC verified.
21
+ - [x] Owner configured Wallet npm Trusted Publisher (pending validation).
22
+ - [ ] Validate Wallet OIDC with a later reviewed release. User publication and Market guide updates remain pending.
23
+ - [ ] Step 6: participant setup/upgrade/restart/uninstall and official Anvil paid acceptance.
24
+
25
+
26
+ ## Public npm Protocol dependency
27
+
28
+ - [x] Pin npm core 0.14.3; migrate imports, fixtures, lockfile and notices.
29
+ - [x] Update exact User/Wallet pair checks; reject mixed archive/npm or mismatched dependencies.
30
+ - [x] Remove vendor-directory assumptions from install/repair fingerprints.
31
+ - [x] Verify isolated sibling install/build, all 364 tests and real prepare-only retry; remove old archives.
32
+ - [ ] Commit/push the matching User and Wallet revisions together before participant synchronization.
33
+
34
+
35
+ ## Public-source preparation
36
+
37
+ - [x] Inventory current source, archives, private harnesses and contributor prerequisites.
38
+ - [x] Select MPL 2.0 for original User code; preserve separate third-party licenses.
39
+ - [x] Privately archive old Protocol packages, platform-only scripts and operational history.
40
+ - [x] Use the reviewed public Protocol artifact; remove unused MySQL dependency.
41
+ - [x] Replace sibling Agent/Protocol test dependencies with attributed local/public-package fixtures.
42
+ - [x] Rewrite current entry guides and source map; separate implemented references from future plans.
43
+ - [x] Finish behavioral test review, code readability checks and isolated User + Wallet verification: 364 tests passed, no failures or skips.
44
+ - [x] Correct follow-up review findings: identity/support instructions, explicit signer flow, installation prerequisites and legacy-preview comments.
45
+ - [x] Owner approved history reset/public visibility; anonymous main ref verified, with no published tags.
46
+ - [ ] Verify full anonymous clone and ZIP installation independently of source-ref access.
47
+
48
+ ## Independent distribution (next development loop)
49
+
50
+ - [ ] Define the supported Wallet client/IPC boundary and source/build/running compatibility requirements.
51
+ - [ ] Replace exact version pairing with reviewed compatibility checks; preserve keys, Policies and recovery.
52
+ - [ ] Optional later: combined ZIP/platform assets after primary npm installation acceptance.
53
+ - [ ] Verify fresh Git/ZIP installation and missing/incompatible/stale version recovery; update Market guidance.
54
+
55
+ See [distribution plan](plans/user-wallet-distribution.md). These changes are not
56
+ implemented by the current source cleanup. Repair still applies downloaded local code.
57
+
58
+ ## Network and owner approval gates
59
+
60
+ - [ ] Design official test package/network mapping (N4), keeping release-pinned executable SHA checks.
61
+ - [ ] Finish general deployment/artifact output and coherent confirmation settings (N5/N7).
62
+ - [ ] Finish public URL/settings handoff (N8); ordinary public-network users must not need private rehearsal tunnels.
63
+ - [ ] After the official domain is chosen, define the default HTTPS Market address.
64
+ - [ ] Accept multisig, interrupted owner signing, headless tunnel and portable-page recovery with participants.
65
+ - [ ] Verify browser RPC reachability/CORS and approved Safe versions on the selected network.
66
+ - [ ] Run explicitly scoped same-code public-testnet acceptance; no real funds/reset is implied by these tasks.
67
+ - [ ] Evaluate WalletConnect/QR only if required; current browser flow uses an injected wallet.
68
+
69
+ ## Retained participant and recovery acceptance
70
+
71
+ - [ ] Complete original-key/Policy restore on an isolated installation, including invalid/absent/expired/revoked scope and unavailable RPC; never fall back to a new purchase.
72
+ - [ ] Complete post-renewal Market reconnection cancellation/failure checks and grouped old/new Policy Order/case access; viewing Orders alone does not prove support mutation.
73
+ - [ ] Verify case evidence, original-result retrieval, withdrawal/reopening and deadlines through participant entry points.
74
+ - [ ] Complete remaining real Runtime interruption and late-funding recovery acceptance with authoritative financial reconciliation.
75
+ - [ ] Verify full desktop login/reboot, reminder failure/dismissal, wrong-password recovery and deferred service handoff.
76
+ - [ ] Verify confirmed uninstall on disposable local data and no change to on-chain permission.
77
+ - [ ] Verify detailed status/cache/owner-page presentation and narrow-terminal readability with participants.
78
+ - [ ] Verify maintained Skill discovery, tool permission and execution in supported Agent harnesses.
79
+ - [ ] Define maintenance-response handling (503/Retry-After) while retaining original request identity.
80
+ - [ ] Complete official package release/configuration handoff, installation and endpoint/settings refresh for release.
81
+ - [ ] Inspect implicit address, service, platform and repository assumptions during each change.
82
+
83
+ Prior Market schema/cutover, nickname and display tasks are platform-owned; they must
84
+ not turn into User database access. Existing source now implements key restore/info,
85
+ Policy renewal/revoke, user service startup and deployment-mismatch guidance. Their
86
+ older unchecked implementation labels are superseded by current code; remaining
87
+ participant/recovery acceptance is retained above. Historical one-off request
88
+ investigations remain private operator work, not a public contributor prerequisite.
89
+
90
+ ## Deferred / release gates
91
+
92
+ - [ ] Independent security review, supported-version policy and release provenance before real funds.
93
+ - [ ] macOS startup, graphical unlock and embedded-Node/multi-platform packaging remain separately scoped.
94
+ - [ ] Broader business/harness acceptance uses maintained fixtures; do not require third-party Skills for installation verification.
95
+
96
+ Original chronological TODO snapshots are preserved in the private workspace.
97
+ Consolidation does not turn historical partial evidence into completed acceptance.
@@ -0,0 +1,96 @@
1
+ # User Runtime architecture
2
+
3
+ ## Processes and authority
4
+
5
+ ```text
6
+ Human / Agent
7
+ ├─ ./run → local administration, owner browser approval, service management
8
+ └─ installed Skill → shared client → authenticated loopback Runtime
9
+ ├─ narrow Wallet IPC → bounded signatures
10
+ └─ Provider HTTP → private input/output
11
+ Wallet / User participant clients → public Settlement and Market APIs
12
+ ```
13
+
14
+ Wallet runs separately and holds the encrypted Session Key. Safe/Module enforce
15
+ on-chain permission. User owns orchestration and recovery, not Provider business
16
+ logic or platform storage. No Settlement checkout or database access is required.
17
+
18
+ ## Shared Protocol dependency
19
+
20
+ User and Wallet pin `@c4roa0/agentpay-protocol@0.14.3` from npm. Their lockfiles
21
+ record integrity. The current repair gate still checks the exact repository versions
22
+ and shared Protocol dependency in `update-pair.json`; `typesDependency` is the
23
+ retained v1 field name for that npm version. It is not a compatibility range.
24
+ Installation/repair fingerprints cover manifests and lockfiles rather than a vendor
25
+ folder. Policy, Order and cached request identities are independent of this package
26
+ name change. Independent-version compatibility remains a separate planned feature.
27
+
28
+ ## Source map
29
+
30
+ | Area | Main files | Responsibility |
31
+ | --- | --- | --- |
32
+ | CLI | `run`, `scripts/agentpay-cli.mjs`, `src/user-cli.mjs` | Node discovery, grouped commands and help |
33
+ | Install / repair | `install-user.mjs`, `install-and-setup.mjs`, `install-preflight.mjs`, `local-update.mjs` | Dependency/build preparation, checkpoints, downloaded settings and safe restart |
34
+ | Setup | `guided-setup.mjs`, `user-setup-guide.mjs`, `anvil-onboarding.mjs` | Terminal sequence and saved-step continuation; explicit signer mode |
35
+ | Permission | `policy-terminal-guide.mjs`, `safe-policy-plan.mjs`, `renew-policy.mjs`, `policy-operations.mjs`, `policy-migration.mjs` | Drafts, approved operations and verified local binding |
36
+ | Owner signing | `owner-signer.mjs`, `owner-approval-server.mjs`, `web/owner-approval.js`, `safe-owner-anvil.mjs` | Fixed browser approval plans or guarded explicit test signer |
37
+ | Local services | `local-services.mjs`, `autostart-files.mjs`, `setup-autostart.mjs`, `scripts/local-service.mjs` | Linux user services, startup preferences and locked Wallet restart |
38
+ | Runtime | `index.mjs`, `caller-auth.mjs`, `transport.mjs`, `service-reference.mjs`, `service-url.mjs` | Caller authentication, per-call routing, payment and evidence orchestration |
39
+ | Durable request / result | `invocation-store.mjs`, `invocation-result.mjs`, `runtime-recovery.mjs` | Original identities/checkpoints, provisional versus verified output, read-only startup checks |
40
+ | Skill client | `runtime-client.mjs`, `skill-client.mjs`, `client-request-lock.mjs` | Local discovery, input snapshots, original-request selection and replay |
41
+ | Files / cache | `file-cache.mjs`, `file-download.mjs`, `file-cache-owner.mjs`, `cache-management.mjs`, `result-cache-view.mjs` | Explicit transfers, integrity/limits, provenance, cleanup and display |
42
+ | Orders | `order-support.mjs`, `order-cancellation.mjs`, `order-closure.mjs`, `order-review.mjs` | Original result retrieval, cases, cancellation and local review/archive |
43
+ | Market | `connect-market.mjs`, `local-wallet-ipc.mjs` | Deliberate account connection and fixed Wallet proof |
44
+ | Presentation | `status-panel.mjs`, `order-list-panel.mjs`, `order-status-panel.mjs`, `local-info.mjs` | Human-readable local/remote observations and next actions |
45
+ | Packages | `skill-bundle.mjs`, `skill-zip.mjs`, `active-skill.mjs` | ZIP boundaries, installation and official material selection |
46
+ | Official test | `official-paid-test.mjs`, `official-test-package.mjs`, `official-test-update.mjs` | Reviewed package digest, explicit price consent and test recovery |
47
+
48
+ Unless a path starts with `scripts/` or `web/`, filenames in this table are under
49
+ `src/`. Most scripts are thin command entries. `anvil-onboarding.mjs` retains its
50
+ historical filename but supports explicit external-owner signing as well; do not
51
+ infer permission to choose a test signer from the filename.
52
+
53
+ ## Purchase and recovery path
54
+
55
+ 1. Skill code calls the shared client with a service reference and validated input.
56
+ The client saves request/input identity before contacting Runtime.
57
+ 2. Runtime authenticates the local caller, resolves or resumes the durable request,
58
+ obtains terms through Wallet and preserves the accepted transaction conditions.
59
+ 3. Wallet prepares/reads the Order and signs only within its verified boundaries.
60
+ Runtime forwards payment material through the defined Provider protocol; no
61
+ Session Key is exposed.
62
+ 4. Provider input/output remain on the private service path. Runtime stores received
63
+ output separately from its verified result and checks matching delivery evidence.
64
+ 5. Repeated calls reuse original checkpoints. Startup reconciliation observes Order
65
+ state; it does not create replacement purchases or automatically acknowledge
66
+ receipt. Only a completed verified result is eligible for normal cached replay.
67
+
68
+ The startup checker and local result store track different facts: an Order may be
69
+ paid out while its result is missing locally. Keep this visible and offer original
70
+ result recovery; do not charge again to hide the inconsistency.
71
+
72
+ ## Local state
73
+
74
+ The selected private User data directory defaults to
75
+ `$HOME/.local/share/agentpay/user`. `local-data-directory.mjs` resolves it; do not
76
+ hard-code an operator's historical directory. Important state includes Wallet's
77
+ keystore/Policy, Runtime caller credential and connection locator, invocation
78
+ history, input/result caches, owner-operation journals and Market connection receipt.
79
+ The receipt is local convenience metadata, not live website authorization.
80
+
81
+ Owner approval pages receive only fixed public operation plans. They cannot access
82
+ Wallet IPC or keys. Successful browser execution is followed by local chain
83
+ verification before binding. A lost response resumes the original plan.
84
+
85
+ ## External dependencies and development boundary
86
+
87
+ User resolves the installed Wallet package through public client, local-administration
88
+ and CLI exports. Exact reviewed dependency versions are checked; independent
89
+ running-process compatibility negotiation remains planned. User imports ethers from its own
90
+ declared dependency. The pinned public Protocol package provides types, hashes and
91
+ fixtures. No Agent, Protocol source checkout or private platform repository is
92
+ required for the local test suite.
93
+
94
+ Tests use public interfaces and controlled remote responses. The explicit fault
95
+ loader only instruments a spawned test Runtime; production startup contains no
96
+ crash-test switch. See [test guide](https://github.com/c4rO-0/agentpay-user/blob/main/test/README.md) for evidence limits.
package/doc/design.md ADDED
@@ -0,0 +1,60 @@
1
+ # User Runtime design
2
+
3
+ ## Bounded purchases, separate authority
4
+
5
+ The human grants bounded Safe spending permission once. Normal eligible Skill
6
+ calls use that permission without repeated owner signatures. User coordinates the
7
+ interaction; Wallet owns the Session Key and only exposes bounded operations.
8
+ Neither Skill code nor Runtime receives generic owner signing authority.
9
+
10
+ A Skill may use local logic and zero, one or multiple services. Each paid call
11
+ carries its own registered service reference and private JSON input. Business
12
+ validation belongs to the Skill/Provider. Runtime validates common identities,
13
+ amount/usage bounds, delivery evidence and recovery state. The official random
14
+ service is only the installation payment test, not a global service requirement.
15
+
16
+ ## Preserve one purchase attempt
17
+
18
+ Request identity binds the service, input and accepted conditions, not the local
19
+ Runtime port. Retry resumes the original attempt or returns its verified saved
20
+ result. Ambiguous or incomplete history pauses for review; it must not become a
21
+ new paid attempt. A deliberate new purchase requires explicit new-request intent.
22
+
23
+ User persists private input snapshots, request/payment checkpoints and results.
24
+ Received output is not a verified result until its evidence is checked. Binary
25
+ attachments are explicitly cached, bounded and integrity checked; arbitrary output
26
+ links are not downloaded automatically. See [cache reference](reference/result-file-cache.md).
27
+
28
+ ## Authority is not display grouping
29
+
30
+ Market groups Wallets by network, Module, Safe and execution address. Each verified
31
+ Policy still bounds access to its original Orders. A nickname is display metadata,
32
+ not a machine identity. Renewing permission preserves local history and does not
33
+ implicitly grant access to another delegate's Orders. See
34
+ [Wallet identity](reference/wallet-identity-policy-history.md).
35
+
36
+ Expiry stops new spending, while original-Order support follows its own verified
37
+ rules and deadlines. Revocation, Module disablement, process stop and local lock
38
+ are different operations. A saved binding alone does not establish current chain
39
+ readiness. Historical reads never silently switch the active spending Policy.
40
+
41
+ ## Network and operator boundaries
42
+
43
+ Anvil and supported public EVM deployments use the same product flow with explicit
44
+ validated configuration and signer selection. Anvil chain ID is not permission to
45
+ use unlocked test accounts. External-owner signing must work on Anvil too.
46
+ Deployment changes require deliberate authorization review; they do not rewrite
47
+ saved requests or grant arbitrary signing.
48
+
49
+ User accesses Market and Settlement through public participant APIs, not their
50
+ databases or private files. Local caller authentication is not OS sandboxing against
51
+ code running as the same user. Logs and public services must not receive private
52
+ inputs, result bodies, keys or bearer credentials.
53
+
54
+ ## Remaining product work
55
+
56
+ User consumes a pinned public Wallet package without sibling source assumptions.
57
+ Running-process compatibility negotiation and optional combined installers remain
58
+ [planned](plans/user-wallet-distribution.md). Real-network, multisig and additional
59
+ platform acceptance remain explicit gates in [TODO](TODO.md); private results do
60
+ not establish production safety.
@@ -0,0 +1,68 @@
1
+ # Develop AgentPay User
2
+
3
+ ## Independent checkout
4
+
5
+ Read [README](../README.md). Use Node.js 22.22.3 or newer and npm in User:
6
+
7
+ ```sh
8
+ npm ci
9
+ npm test
10
+ ```
11
+
12
+ The test command runs files sequentially to limit resource use. It uses disposable
13
+ files, keys, subprocesses and loopback endpoints. No private Settlement/Market source,
14
+ database, live chain or Provider checkout is needed. Protocol fixtures are loaded
15
+ from the pinned package; reference Skill fixtures live under `test/fixtures/`.
16
+ Some tests use real Wallet IPC; others deliberately simulate upstream interfaces.
17
+
18
+ For focused iteration:
19
+
20
+ ```sh
21
+ node --check src/runtime-client.mjs
22
+ node --test test/runtime-client.test.mjs
23
+ node --test test/multi-service-runtime.test.mjs
24
+ ```
25
+
26
+ Do not use `./run payment test` as an unattended unit test: it requires configured
27
+ services and explicit consent for a real paid Order on the configured test network.
28
+ Do not run install/setup against your personal state to prepare unit-test fixtures.
29
+
30
+ ## Reading order
31
+
32
+ 1. [Architecture/source map](architecture.md) and [design rationale](design.md).
33
+ 2. `src/user-cli.mjs` for command routing; setup/repair modules for human flows.
34
+ 3. `src/runtime-client.mjs` and `src/skill-client.mjs` for the Skill boundary.
35
+ 4. `src/index.mjs`, `invocation-store.mjs` and `runtime-recovery.mjs` for one request
36
+ from preparation through delivery and restart observation.
37
+ 5. `owner-signer.mjs`, `safe-policy-plan.mjs` and the browser page before changing
38
+ owner approval; inspect Wallet's authority checks separately.
39
+
40
+ Use [documentation by role](README.md) and the [test map](https://github.com/c4rO-0/agentpay-user/blob/main/test/README.md) to find
41
+ more focused material. Plans describe future work; local reference documents and
42
+ current source describe implemented behavior.
43
+
44
+ ## Verification rules
45
+
46
+ Test user-observable outcomes through product entries. Keep exact signature/hash,
47
+ amount, expiry, capability and cross-Order rejection tests where they protect a
48
+ specific boundary. A mocked package manager tests orchestration, not installation;
49
+ a mocked Provider cannot prove funding or actual delivery. Recorded private
50
+ acceptance is not public-network or production approval.
51
+
52
+ Fault injection belongs only to the explicit test loader. If source layout changes,
53
+ update its anchors to the same durable boundary and rerun process recovery tests.
54
+ Never add test-only branches to normal Runtime or change request identity to make
55
+ recovery pass. At least two controlled business payloads must use the same engine;
56
+ normal operation must not depend on the random example.
57
+
58
+ ## Maintainability and scope
59
+
60
+ Keep code multiline and comment trust decisions, saved-state transitions and
61
+ recovery ordering. Avoid comments that repeat statements. Preserve canonical bytes,
62
+ wire names and public errors during formatting. Prefer one focused regression over
63
+ several assertions about implementation shape.
64
+
65
+ User consumes Wallet through its public package exports and exact reviewed version.
66
+ Running-process compatibility negotiation remains in the
67
+ [distribution plan](plans/user-wallet-distribution.md). No automatic source downloads are
68
+ introduced by repair. Keep private platform experiments outside this repository.
@@ -0,0 +1,91 @@
1
+ # Independent User and Wallet distribution
2
+
3
+ Updated 2026-11-07. The approved primary distribution direction is npm for Protocol,
4
+ Wallet and User. This replaces the 2026-11-06 combined-source-ZIP-first plan.
5
+ Repositories, processes and releases remain separate; Node is still required.
6
+
7
+ ## Intended user experience
8
+
9
+ Ordinary users install `@c4roa0/agentpay-user` and run `agentpay setup`. User installs
10
+ its reviewed Wallet dependency; both consume public Protocol. No sibling source
11
+ folders, pnpm or local TypeScript build are required for the published User path.
12
+ Wallet remains independently installable. Git checkouts are for contributors; the User 0.3.0 candidate now uses the same
13
+ public Wallet package. User npm publication remains a separate release step.
14
+ Combined ZIPs and platform binaries are optional later work, not a release prerequisite.
15
+
16
+ npm installation only installs program files. Key creation, background-service
17
+ configuration, owner approval and payments require explicit product commands.
18
+ No postinstall hook may initialize keys, register services or authorize spending.
19
+ Keys, Policies, request history and cache stay outside package installation paths.
20
+
21
+ ## Dependency and authority boundaries
22
+
23
+ User -> Wallet -> Protocol, and User -> Protocol. Publish only reviewed runtime
24
+ files, public declarations, documentation and licenses. Wallet ships compiled JS.
25
+ Use exact reviewed dependency versions initially; independent compatibility ranges
26
+ are a later step. Versions need not have the same number across repositories.
27
+
28
+ Replace User imports of Wallet internals with documented IPC-client and local
29
+ administration entry points, and resolve the CLI through the installed package.
30
+ Normal service calls remain capability-scoped IPC; trusted local administration is
31
+ not an Agent API. Do not expose generic signing or let a package dependency move
32
+ Session Key ownership into Runtime. Generic private-file helpers belong to User's
33
+ own storage boundary, not a new public Wallet API solely to preserve an old import.
34
+
35
+ Check installed interface requirements and running Wallet identity before enabling
36
+ incompatible operations. Installation/version metadata alone is not proof that the
37
+ current daemon matches. Preserve diagnostic and recovery access on mismatch; never
38
+ replace purchases, Policy identity or keys to resolve an upgrade failure.
39
+
40
+ ## Upgrade and uninstall
41
+
42
+ Review -> confirm -> stop services -> install update -> repair executable paths ->
43
+ start and self-check -> request unlock. Do not let an arbitrary latest-version
44
+ lookup replace executable code. `repair` repairs installed files; downloading an
45
+ update is a distinct action. Failed/interrupted updates retain private data and
46
+ must give a concrete recovery path. Moving npm/Node installations must not leave
47
+ systemd pointing silently to a missing or older executable.
48
+
49
+ Distinguish program removal (stop/remove services, retain private data) from explicit
50
+ confirmed deletion of local keys/history/configuration. Document recovery if npm is
51
+ uninstalled first. Do not rely on npm lifecycle hooks for sensitive cleanup.
52
+
53
+ ## Closed loops and acceptance
54
+
55
+ 1. Commit the verified Protocol npm migration for User and Wallet as a baseline.
56
+ 2. Prepare Wallet public package entry points and compiled artifact. Inventory User
57
+ consumers; test installed tarball CLI and real IPC/key lifecycle independently.
58
+ No npm upload or User package migration in this loop.
59
+ 3. Integrate User with the Wallet package; remove sibling source/build assumptions;
60
+ expose `agentpay`, align service paths, installer, repair and uninstall.
61
+ 4. Verify version/interface and running-process compatibility, update interruption,
62
+ data preservation and bounded mismatch handling. Keep exact pins until ranges
63
+ and their negative tests are explicitly designed.
64
+ 5. Configure independent OIDC release workflows. Publish Wallet first, then User;
65
+ verify public registry installs. Update Market and human guides to tested commands.
66
+ 6. Accept fresh install, restart/unlock, upgrade, uninstall and the official paid
67
+ connectivity test through the same product path on Anvil. Multi-service behavior
68
+ uses maintained controlled fixtures. Real-network acceptance remains separate.
69
+
70
+ Current scope update — 2026-11-07: owner authorized User package adoption and
71
+ installer/service/repair/uninstall integration in sequence. Implemented and tested
72
+ with public Wallet 0.3.0. User 0.3.0 remains private/unpublished pending review and
73
+ participant acceptance. Exact installed versions are checked; running-daemon version
74
+ negotiation is still a separate compatibility task. No participant services, keys,
75
+ Policies or Orders were changed in this development loop.
76
+
77
+ ## Approved npm update — 2026-11-07
78
+
79
+ `agentpay update` queries the configured npm registry for User, displays the exact
80
+ release and pinned Wallet version, and asks before changing services. `-f` bypasses
81
+ only that confirmation. Target installation is exact, engine-strict and skips
82
+ lifecycle hooks; artifacts must already be runnable. Global npm installs are
83
+ supported; source/npm-link checkouts use their own source updates and repair.
84
+
85
+ The installer lock protects requirements/stop/package replacement. Release it before
86
+ the new version's repair acquires it; contention refuses safely with a retry rather
87
+ than bypassing the lock. Repair runs in a new process, so it uses the new official
88
+ Skill digest and package interfaces. Other Skills and original test requests remain.
89
+ No paid test, Policy renewal or key initialization is implicit in update. Failed
90
+ installation/repair preserves private data and provides a repair/reinstall path.
91
+ Unconfigured installs continue through explicit setup after software update.
@@ -0,0 +1,120 @@
1
+ # Harness Skill and local payment integration
2
+
3
+ Implemented design reference. Current release/participant gates are tracked in
4
+ [TODO](../TODO.md); this document is not new deployment or payment authorization.
5
+
6
+ ## User journey and responsibilities
7
+
8
+ 1. Install/configure local AgentPay once. The human grants bounded Safe spending
9
+ permission; Wallet independently verifies and binds it. Owner signing on real
10
+ networks remains separate pending work.
11
+ 2. Install a Skill in the selected harness through its supported discovery path.
12
+ Package installation is distinct from Safe authorization and does not pay.
13
+ 3. The harness reads SKILL.md and executes the package's thin business wrapper.
14
+ 4. The wrapper uses a shared local AgentPay client to discover local connection
15
+ settings, authenticate to Runtime, submit input and resume the same invocation.
16
+ 5. Runtime orchestrates the purchase through Wallet's narrow APIs and Provider;
17
+ Wallet owns keys and independent checks. Results return to the harness.
18
+
19
+ SKILL.md explains when to call, arguments, expected results and recovery actions.
20
+ The wrapper handles business input/output. The shared client owns local discovery,
21
+ transport/authentication and retry identity handling; it must not implement a
22
+ second payment engine. Runtime retains durable Order/payment recovery. Payment
23
+ admission and authoritative price/identity are checked by Settlement/Wallet, not
24
+ accepted from untrusted package text.
25
+
26
+ A new eligible service satisfying the existing dynamic Registry Policy needs no
27
+ new owner signature. Several Skills using the same Policy share that Policy's
28
+ budget; installing a Skill does not create an additional allowance. Harness tool
29
+ execution permission is separate from spending authority. A local caller token
30
+ allows requests within existing bounds; it is not a key or generic signer.
31
+
32
+ ## Current source and concrete gaps
33
+
34
+ - The official reference package candidate 1.1.0 contains SKILL.md and a thin random.mjs
35
+ bootstrap. It loads the installed User client from private connection.json.
36
+ Setup publishes this connection; default/custom data directory discovery and
37
+ explicit URL/credential-file overrides are implemented. Release and actual
38
+ harness discovery remain pending.
39
+ - Runtime routes per-call registered references through a common JSON transport.
40
+ It starts without a selected package. Business validation lives in the Skill and
41
+ Provider. active-skill.json is retained only for official test material; it is
42
+ not process-wide service configuration. Generic package saving and harness
43
+ discovery remain separate operations.
44
+ - SKILL.md instructs resolving commands from the installed package. Actual
45
+ harness execution must
46
+ resolve the installed Skill's directory without assuming the current workspace.
47
+ - Installer download transport requires HTTPS or loopback HTTP. A Market page on
48
+ public-IP HTTP cannot be used as an installer URL; do not weaken the
49
+ transport rule to make that command work. The Market Web source now omits this
50
+ rehearsal-only command from the public Skill guide (deployment pending).
51
+
52
+ ## First implementation loop
53
+
54
+ The reusable local client and random wrapper now call the common Runtime
55
+ endpoint. They resolve settings from the user's installed AgentPay state;
56
+ keep credentials outside the Skill and read them only in the local process. Keep
57
+ explicit configuration available for non-default directories. Do not load scripts
58
+ or shell fragments from connection files or infer a different paid service.
59
+
60
+ Expose a non-paying connection/identity check and invocation with structured
61
+ results/errors. Distinguish connectivity, unlocked Wallet/Policy readiness and
62
+ actual delivery; a successful /health read does not establish payment readiness.
63
+ Document that prerequisite errors need human setup/unlock; the model must not be
64
+ asked for passwords, private keys or owner signing secrets.
65
+
66
+ The implemented interface is --invoke <min> <max> [--force]. Matching calls
67
+ resume unfinished work or reuse verified output; only --force deliberately creates
68
+ another request with the same input. The diagnostic --resume <request-id> remains
69
+ for selecting a specific record when forced calls create ambiguity. New calls
70
+ generate a UUID; checkpoints retain original input, service and Runtime URL before
71
+ POST. Transport does not retry or create replacement purchases automatically.
72
+
73
+ Generate a sufficiently long request identifier once per deliberate invocation
74
+ and durably retain it before sending. Retry of an uncertain request keeps that
75
+ identifier and identical input. The client must not invent a replacement purchase
76
+ on timeout. Keep Runtime's existing conflict detection and recovery authoritative;
77
+ default recovery and diagnostic selection are implemented.
78
+
79
+ Acceptance: missing/wrong settings, unavailable Runtime, invalid credential,
80
+ service mismatch and timeout-after-acceptance retain correct outcomes and request
81
+ identity. No secret should enter model-visible output. Use focused local-process
82
+ fixtures first; actual paid harness tests need a separately agreed payment scope.
83
+ The selected distribution is a local module in the installed User repository,
84
+ located through an owner-held connection file. No dependency download occurs
85
+ at invocation. Candidate 1.1.0 needs the updated User installation. Existing
86
+ published 1.0.1 bytes remain available but are not accepted as this new
87
+ service-reference format; no compatibility translation or rewrite is provided.
88
+ Release/deployment and actual harness execution remain unverified.
89
+
90
+ ## Following loops
91
+
92
+ - Deploy the reviewed common Runtime contract and per-request state after checking
93
+ older pending requests, matching dependencies and the official package.
94
+ Preserve wire skillId meanings and private input/output boundaries. Supporting
95
+ many installed Skills must not require global active-Skill replacement per call.
96
+ - Package the wrapper/client integration for both harnesses. Verify discovery,
97
+ script-path resolution, local configuration access and tool permissions in each.
98
+ Shared file conventions do not prove identical permission or sandbox behavior.
99
+ - Update Market installation copy and repository guides to show harness installation
100
+ and the one-time Wallet prerequisite. Keep the specialized rehearsal installer in
101
+ developer instructions. Do not advertise generic execution before it works.
102
+ - Run actual first-use and resume scenarios in both harnesses; retain exact private
103
+ payment/reconciliation evidence separately from source/HTTP tests.
104
+
105
+ ## Security and ownership
106
+
107
+ Session Keys, owner keys, unlock secrets and caller tokens never enter published
108
+ packages or model prompts. Local credential access is not OS isolation: a harness
109
+ with the user's filesystem permissions may read files that account can read.
110
+ Use narrow execution permissions where available; do not claim SKILL.md itself
111
+ is a security boundary. Private results stay on the local client/Runtime/Provider
112
+ path. Installation never expands Policy limits or grants arbitrary signing.
113
+
114
+ ## Official reference surfaces
115
+
116
+ - [Claude Code Skills](https://code.claude.com/docs/en/skills)
117
+ - [DeepSeek Harness Skills](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/skills.md)
118
+
119
+ These establish discovery/instruction mechanisms; they are not AgentPay compatibility
120
+ results. Verify exact supported versions and directories during implementation.