@c4roa0/agentpay-user 0.0.0-stage → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/AGENTS.md +137 -0
  2. package/CONTRIBUTING.md +16 -0
  3. package/LICENSE +373 -0
  4. package/NOTICE.md +20 -0
  5. package/README.md +85 -2
  6. package/SECURITY.md +16 -0
  7. package/doc/README.md +52 -0
  8. package/doc/TODO.md +107 -0
  9. package/doc/architecture.md +99 -0
  10. package/doc/design.md +60 -0
  11. package/doc/develope.md +68 -0
  12. package/doc/plans/user-wallet-distribution.md +91 -0
  13. package/doc/reference/harness-skill-runtime.md +120 -0
  14. package/doc/reference/local-cache-foundation.md +176 -0
  15. package/doc/reference/local-safe-owner-ui.md +25 -0
  16. package/doc/reference/local-update.md +18 -0
  17. package/doc/reference/multi-service-runtime.md +119 -0
  18. package/doc/reference/npm-integration-verification.md +103 -0
  19. package/doc/reference/onboarding-writing.md +48 -0
  20. package/doc/reference/original-order-recovery.md +97 -0
  21. package/doc/reference/private-anvil-onboarding-config.example.json +18 -0
  22. package/doc/reference/public-deployment-settings.md +56 -0
  23. package/doc/reference/random-skill-contract.md +18 -0
  24. package/doc/reference/result-file-cache.md +166 -0
  25. package/doc/reference/runtime-address-recovery.md +42 -0
  26. package/doc/reference/runtime-result-cache.md +157 -0
  27. package/doc/reference/runtime-startup-recovery.md +141 -0
  28. package/doc/reference/skill-input-output-cache.md +93 -0
  29. package/doc/reference/wallet-identity-policy-history.md +23 -0
  30. package/doc/runbooks/commands.md +103 -0
  31. package/doc/runbooks/deployment-authorization-update.md +42 -0
  32. package/doc/runbooks/emergency-payment-stop.md +80 -0
  33. package/doc/runbooks/local-autostart.md +212 -0
  34. package/doc/runbooks/local-cache.md +115 -0
  35. package/doc/runbooks/local-update.md +84 -0
  36. package/doc/runbooks/market-connection.md +73 -0
  37. package/doc/runbooks/npm-publication.md +56 -0
  38. package/doc/runbooks/official-test-package.md +62 -0
  39. package/doc/runbooks/order-cancellation.md +56 -0
  40. package/doc/runbooks/order-support.md +41 -0
  41. package/doc/runbooks/policy-renewal.md +80 -0
  42. package/doc/runbooks/private-anvil-terminal-setup.md +58 -0
  43. package/doc/runbooks/runtime-skill-client.md +155 -0
  44. package/doc/runbooks/safe-owner-web.md +104 -0
  45. package/doc/runbooks/safe-policy-migration.md +36 -0
  46. package/doc/runbooks/safe-policy-setup.md +52 -0
  47. package/doc/runbooks/terminal-authorization-preview.md +38 -0
  48. package/doc/runbooks/unlock-wallet.md +68 -0
  49. package/doc/runbooks/user-onboarding.md +87 -0
  50. package/doc/runbooks/wallet-identity.md +59 -0
  51. package/doc/security/public-source-review-2026-11-06.md +71 -0
  52. package/doc/usage.md +54 -0
  53. package/package.json +49 -4
  54. package/progress.md +210 -0
  55. package/run +29 -0
  56. package/scripts/agentpay-cli.mjs +11 -0
  57. package/scripts/authorize-existing-safe.mjs +211 -0
  58. package/scripts/autostart.mjs +186 -0
  59. package/scripts/cancel-order.mjs +76 -0
  60. package/scripts/check-installation.mjs +26 -0
  61. package/scripts/check-official-test-package.mjs +35 -0
  62. package/scripts/check-purchase-readiness.mjs +275 -0
  63. package/scripts/configure-runtime-client.mjs +16 -0
  64. package/scripts/guide-policy.mjs +64 -0
  65. package/scripts/initialize-caller-credential.mjs +11 -0
  66. package/scripts/install-skill-bundle.mjs +176 -0
  67. package/scripts/install-user.mjs +24 -0
  68. package/scripts/local-service.mjs +60 -0
  69. package/scripts/lock.mjs +11 -0
  70. package/scripts/login-notify.mjs +39 -0
  71. package/scripts/migrate-safe-policy.mjs +165 -0
  72. package/scripts/official-paid-test.mjs +9 -0
  73. package/scripts/poll-unconfirmed-notice.mjs +75 -0
  74. package/scripts/prepare-onboarding.mjs +33 -0
  75. package/scripts/preview-policy.mjs +65 -0
  76. package/scripts/random-model-ack-smoke.mjs +235 -0
  77. package/scripts/random-reject-smoke.mjs +147 -0
  78. package/scripts/renew.mjs +9 -0
  79. package/scripts/repair.mjs +10 -0
  80. package/scripts/revoke.mjs +9 -0
  81. package/scripts/select-skill-bundle.mjs +39 -0
  82. package/scripts/setup-local.mjs +199 -0
  83. package/scripts/status.mjs +13 -0
  84. package/scripts/test-package.mjs +35 -0
  85. package/scripts/unlock.mjs +13 -0
  86. package/scripts/update.mjs +7 -0
  87. package/scripts/user-setup.mjs +219 -0
  88. package/scripts/verify-npm-release.mjs +32 -0
  89. package/src/active-skill.mjs +160 -0
  90. package/src/anvil-onboarding-state.mjs +96 -0
  91. package/src/anvil-onboarding.mjs +1036 -0
  92. package/src/authorization-question-checkpoint.mjs +114 -0
  93. package/src/autostart-files.mjs +50 -0
  94. package/src/cache-management-cli.mjs +302 -0
  95. package/src/cache-management.mjs +47 -0
  96. package/src/caller-auth.mjs +58 -0
  97. package/src/client-request-lock.mjs +44 -0
  98. package/src/connect-market.mjs +408 -0
  99. package/src/demo-unlock-secret.mjs +64 -0
  100. package/src/deployment-status.mjs +198 -0
  101. package/src/file-cache-cli.mjs +83 -0
  102. package/src/file-cache-owner.mjs +74 -0
  103. package/src/file-cache-settings.mjs +50 -0
  104. package/src/file-cache.mjs +790 -0
  105. package/src/file-download.mjs +281 -0
  106. package/src/finalization-disclosure.mjs +16 -0
  107. package/src/guided-setup.mjs +194 -0
  108. package/src/index.mjs +1233 -0
  109. package/src/install-and-setup.mjs +38 -0
  110. package/src/install-preflight.mjs +201 -0
  111. package/src/install-user.mjs +279 -0
  112. package/src/installation-paths.mjs +31 -0
  113. package/src/invocation-result.mjs +148 -0
  114. package/src/invocation-store.mjs +385 -0
  115. package/src/local-data-directory.mjs +117 -0
  116. package/src/local-info.mjs +181 -0
  117. package/src/local-services.mjs +156 -0
  118. package/src/local-time.mjs +36 -0
  119. package/src/local-update.mjs +316 -0
  120. package/src/local-wallet-ipc.mjs +93 -0
  121. package/src/login-reminder.mjs +28 -0
  122. package/src/market-download-url.mjs +21 -0
  123. package/src/node-version.mjs +12 -0
  124. package/src/npm-update.mjs +126 -0
  125. package/src/official-paid-test.mjs +407 -0
  126. package/src/official-test-package.mjs +41 -0
  127. package/src/official-test-update.mjs +162 -0
  128. package/src/order-cancellation.mjs +241 -0
  129. package/src/order-closure.mjs +42 -0
  130. package/src/order-list-panel.mjs +110 -0
  131. package/src/order-review.mjs +424 -0
  132. package/src/order-status-panel.mjs +65 -0
  133. package/src/order-support.mjs +365 -0
  134. package/src/owner-approval-server.mjs +332 -0
  135. package/src/owner-signer.mjs +67 -0
  136. package/src/policy-info.mjs +38 -0
  137. package/src/policy-migration.mjs +84 -0
  138. package/src/policy-operations.mjs +67 -0
  139. package/src/policy-preview-server.mjs +236 -0
  140. package/src/policy-terminal-guide.mjs +377 -0
  141. package/src/prepare-local-services.mjs +143 -0
  142. package/src/prepare-onboarding.mjs +210 -0
  143. package/src/private-journal-files.mjs +29 -0
  144. package/src/protocol-package.mjs +25 -0
  145. package/src/readiness-profile.mjs +30 -0
  146. package/src/renew-policy.mjs +605 -0
  147. package/src/repair-market-wallet.mjs +137 -0
  148. package/src/restore-wallet.mjs +255 -0
  149. package/src/result-cache-view.mjs +276 -0
  150. package/src/runtime-client.mjs +1145 -0
  151. package/src/runtime-connection-settings.mjs +101 -0
  152. package/src/runtime-recovery.mjs +667 -0
  153. package/src/runtime-status.mjs +32 -0
  154. package/src/safe-owner-anvil.mjs +115 -0
  155. package/src/safe-policy-plan.mjs +195 -0
  156. package/src/service-reference.mjs +233 -0
  157. package/src/service-url.mjs +52 -0
  158. package/src/settlement-response.mjs +69 -0
  159. package/src/setup-autostart.mjs +197 -0
  160. package/src/setup-demo.mjs +152 -0
  161. package/src/skill-bundle.mjs +142 -0
  162. package/src/skill-client.mjs +198 -0
  163. package/src/skill-install-prompt.mjs +31 -0
  164. package/src/skill-package.mjs +50 -0
  165. package/src/skill-zip.mjs +220 -0
  166. package/src/software-versions.mjs +48 -0
  167. package/src/status-panel.mjs +603 -0
  168. package/src/transport.mjs +48 -0
  169. package/src/uninstall-local.mjs +299 -0
  170. package/src/user-cli.mjs +354 -0
  171. package/src/user-setup-guide.mjs +193 -0
  172. package/src/wallet-control.mjs +182 -0
  173. package/src/wallet-ipc-error.mjs +16 -0
  174. package/src/wallet-package.mjs +28 -0
  175. package/update-pair.json +6 -0
@@ -0,0 +1,71 @@
1
+ # Public-source preparation review — 2026-11-06
2
+
3
+ ## Completed cleanup
4
+
5
+ - Original User code and documentation use owner-approved MPL 2.0. LICENSE,
6
+ NOTICE, SECURITY and CONTRIBUTING explain licensing, reporting and contributions.
7
+ The public Protocol artifact and attributed Agent test fixtures retain MIT.
8
+ - Removed eleven historical Protocol archives from the publication tree. The one
9
+ required 0.14.1 archive is rebuilt from public Protocol commit `1c6ffab`, with
10
+ provenance, SHA-256, license and matching package-lock integrity.
11
+ - Privately archived platform/MySQL harnesses, old operational records and previous
12
+ document snapshots. Removed the unused MySQL dependency. Product onboarding
13
+ scripts remain; script names alone were not grounds for removal.
14
+ - Tests use the pinned package's Protocol fixtures and attributed local Skill
15
+ fixtures instead of sibling Agent/Protocol source. User imports its own declared
16
+ ethers dependency; built sibling Wallet remains required.
17
+ - Reorganized current documentation by reader and function, rewrote source maps,
18
+ and separated implemented references from the future distribution plan.
19
+ - Formatted maintained code and added comments explaining trust, persistence and
20
+ recovery boundaries. No payment, authorization or wire-format redesign was made.
21
+
22
+ ## Verification
23
+
24
+ Independent verification uses only a temporary User checkout and the built public
25
+ Wallet, without private Settlement, Agent or Protocol source checkouts. Offline
26
+ `npm ci --ignore-scripts` installed the pinned dependencies successfully.
27
+
28
+ The complete behavioral suite passed all 364 tests, with zero failures or skips.
29
+ Tests exercise controlled local processes, sockets, HTTP boundaries and fixtures;
30
+ these are not evidence of real-network payment, desktop login or participant browser
31
+ acceptance. The portable approval-page test starts the exported server and checks
32
+ actual responses and access restrictions instead of checking source text.
33
+
34
+ Existing timeout tests were corrected to serve the current pre-purchase offer and
35
+ separate status probes from preparation attempts. They still assert bounded timeout,
36
+ lock release, the same request after restart and no Wallet call on invalid history.
37
+ Grouped-command tests now use the current command surface.
38
+
39
+ Syntax-tree comparison of 112 production source/script/browser files before and
40
+ after formatting found no structural changes (comments and redundant parentheses
41
+ excluded). Local Markdown links resolve, and `git diff --check` passes.
42
+
43
+ ## Follow-up documentation review
44
+
45
+ A second pass found stale per-Policy Market grouping and expired-Policy connection
46
+ instructions, along with pre-browser-signing descriptions in several runbooks.
47
+ Those guides now use the implemented Wallet tuple and independently verified Policy
48
+ scopes, explicit signer selection and the current browser approval flow. Implemented
49
+ support remains distinct from uncompleted public-network/multisig acceptance.
50
+ README/onboarding/developer prerequisites explicitly include npm and Corepack.
51
+ The legacy preview's module comment now points to the public guided setup entry.
52
+
53
+ This correction changed documentation and comments only. Local links, obsolete-claim
54
+ search, JavaScript syntax and `git diff --check` passed; the prior behavioral suite
55
+ was not repeated for prose-only edits.
56
+
57
+ ## Security scope and remaining decisions
58
+
59
+ The bounded current-tree inventory found no literal private key, PEM private key
60
+ or GitHub token; credential-bearing URL matches were negative-test fixtures.
61
+ This is not a security audit or a guarantee against every secret format. Historical
62
+ Git objects are outside this review and must not be assumed clean.
63
+
64
+ User still imports Wallet compiled internals and enforces an exact update pair.
65
+ The supported compatibility boundary and combined release archive remain separate
66
+ work in the [distribution plan](../plans/user-wallet-distribution.md).
67
+ The source review itself performed no automatic source download, service change
68
+ or payment. Subsequently, the owner approved a single-commit history baseline
69
+ (`2a80f4a`), force push and removal of old tags, then confirmed public visibility.
70
+ Anonymous remote refs were verified; full fresh-clone/ZIP installation remains
71
+ open in [TODO](../TODO.md).
package/doc/usage.md ADDED
@@ -0,0 +1,54 @@
1
+ # Use AgentPay User
2
+
3
+ The normal entry is `agentpay`; source checkouts also provide `./run`. Start with
4
+ [installation](runbooks/user-onboarding.md); there is no need to run individual
5
+ internal scripts for ordinary setup.
6
+
7
+ | Task | Command / guide |
8
+ | --- | --- |
9
+ | Install or continue setup | `agentpay install --market URL`, then `agentpay setup` when returning |
10
+ | Check local state | `agentpay status` |
11
+ | Unlock / lock | `agentpay wallet unlock`, `agentpay wallet lock` |
12
+ | Start / stop / restart | `agentpay service start`, `stop`, `restart` |
13
+ | Login startup | `agentpay service autostart on` / `off` |
14
+ | Inspect identity / restore | `agentpay wallet info`, `agentpay wallet restore` |
15
+ | Change / revoke permission | `agentpay policy renew`, `agentpay policy revoke` |
16
+ | Connect website support | `agentpay market connect` |
17
+ | Review an Order | `agentpay orders list`, `details ID`, `status ID` |
18
+ | Recover original result | `agentpay orders retrieve ID` |
19
+ | Local files | `agentpay cache help`, `agentpay orders files ID` |
20
+ | Update npm installation | `agentpay update` (confirm, or `-f`) |
21
+ | Repair installed services | `agentpay repair` |
22
+ | Remove services / erase data | `agentpay uninstall` / `agentpay uninstall --delete-data` (confirmation required) |
23
+
24
+ See [full command reference](runbooks/commands.md) for arguments and examples.
25
+ Status distinguishes saved local facts from refreshed observations. It is not a
26
+ promise that a new purchase will be accepted. Online Order status queries go through
27
+ Wallet; a failed query or missing local result does not prove non-payment.
28
+
29
+ ## Authorization and recovery
30
+
31
+ [Browser owner approval](runbooks/safe-owner-web.md) is available for setup,
32
+ renewal and revocation. [Deployment updates](runbooks/deployment-authorization-update.md)
33
+ require deliberate owner approval; neither repair nor Runtime startup may silently
34
+ replace Policy, key or Order identity.
35
+
36
+ Back up the encrypted key and password securely, with the identity displayed by
37
+ `agentpay wallet info`. Preserve the full private User data directory for local request
38
+ and result recovery. A Policy ID alone cannot recover a lost key.
39
+
40
+ ## Local services and Skills
41
+
42
+ The default data directory is `$HOME/.local/share/agentpay/user`, outside the source
43
+ checkout. Runtime listens on loopback and requires a separate caller credential.
44
+ A Skill uses local connection discovery; it must not bundle credentials or bypass
45
+ Wallet. [Skill integration](runbooks/runtime-skill-client.md) explains per-call
46
+ service references and recovery. No global Provider selection is required.
47
+
48
+ `agentpay payment test` is a separate, explicitly paid connectivity check using the
49
+ maintained, digest-pinned official package. Normal Runtime operation is not tied
50
+ to that business example. An interrupted test retains its original request.
51
+
52
+ [Background service guide](runbooks/local-autostart.md) explains Linux user services,
53
+ login reminders and manual startup. A local lock or process stop does not revoke
54
+ permission; follow [emergency stop](runbooks/emergency-payment-stop.md) when needed.
package/package.json CHANGED
@@ -1,6 +1,51 @@
1
1
  {
2
2
  "name": "@c4roa0/agentpay-user",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.1",
4
+ "type": "module",
5
+ "dependencies": {
6
+ "ethers": "^6.17.0",
7
+ "fs-native-extensions": "1.5.3",
8
+ "@c4roa0/agentpay-protocol": "0.14.3",
9
+ "@c4roa0/agentpay-wallet": "0.3.1"
10
+ },
11
+ "scripts": {
12
+ "start": "node src/index.mjs",
13
+ "check": "node --check src/index.mjs",
14
+ "test:unit": "node --test test/*.test.mjs",
15
+ "test:invocation-store": "node --test test/invocation-store.test.mjs",
16
+ "test:prepare-onboarding": "node --test test/prepare-onboarding.test.mjs",
17
+ "test:installation-guide": "node --test test/install-user.test.mjs test/install-and-setup.test.mjs test/guided-setup.test.mjs test/prepare-onboarding.test.mjs",
18
+ "test:market-connection": "node --test test/connect-market.test.mjs test/local-wallet-ipc.test.mjs",
19
+ "test": "node --test --test-concurrency=1 test/*.test.mjs"
20
+ },
21
+ "license": "MPL-2.0",
22
+ "bin": {
23
+ "agentpay": "scripts/agentpay-cli.mjs"
24
+ },
25
+ "engines": {
26
+ "node": ">=22.22.3"
27
+ },
28
+ "files": [
29
+ "src/",
30
+ "scripts/",
31
+ "run",
32
+ "update-pair.json",
33
+ "README.md",
34
+ "LICENSE",
35
+ "NOTICE.md",
36
+ "SECURITY.md",
37
+ "CONTRIBUTING.md",
38
+ "progress.md",
39
+ "AGENTS.md",
40
+ "doc/"
41
+ ],
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/c4rO-0/agentpay-user.git"
45
+ },
46
+ "description": "Local AgentPay Runtime and guided Wallet setup for AI Agents",
47
+ "publishConfig": {
48
+ "access": "public",
49
+ "registry": "https://registry.npmjs.org/"
50
+ }
51
+ }
package/progress.md ADDED
@@ -0,0 +1,210 @@
1
+ # AgentPay User progress
2
+
3
+ ## User 0.3.1 paired release preparation — 2026-11-08
4
+
5
+ Public npm now contains Wallet 0.3.1 with Protocol 0.14.3. User 0.3.1 pins that
6
+ published Wallet exactly; pairing metadata and lockfile are updated together.
7
+ This release adds actual installed Protocol verification and running-version checks
8
+ for status/repair. Prior release-gate notes below describe earlier checkpoints.
9
+ User 0.3.1 passed 378 behavioral tests and standalone npm archive installation,
10
+ including real Wallet/Runtime restart and matching running-version reports.
11
+ User 0.3.1 publication and real published-version upgrade acceptance remain pending.
12
+ No participant services, keys, Policies or Orders are changed by package verification.
13
+
14
+ ## Installed dependency verification / paired release — 2026-11-08
15
+
16
+ User now checks the actual Protocol package resolved from User and Wallet separately,
17
+ including nested npm copies. Process reports use resolved installed versions, not
18
+ just dependency declarations. Wallet 0.3.1 candidate passed behavioral and independent
19
+ package checks and is pushed as `7e4d4fa`; its OIDC publication is the next operator step.
20
+ User remains pinned to public Wallet 0.3.0 until the new registry release exists;
21
+ then update its exact dependency, lockfile and pairing metadata together. User changes
22
+ remain unreleased. No participant service, key, Policy or Order was changed.
23
+
24
+ ## User 0.3.0 published; running-version checks in development — 2026-11-07
25
+
26
+ `@c4roa0/agentpay-user@0.3.0` was published from User `86ee8e7`.
27
+ Public registry version/latest and archive integrity matched the verified artifact.
28
+ User and Wallet Trusted Publishers are configured; first OIDC releases remain pending.
29
+ Earlier candidate sections below are historical, not current publication status.
30
+
31
+ Wallet 0.3.1 candidate reports process-start software metadata. User status and repair
32
+ compare running package/interface/Protocol versions against the installed pair.
33
+ Missing reporting is unknown, never proof of compatibility. Policy format/version,
34
+ identity and transaction authority are unchanged. Wallet behavioral tests (30) and installed-package IPC checks passed. User full
35
+ regressions (378) passed, followed by final status checks and an isolated candidate
36
+ Wallet/User process restart test. The candidate pair used a temporary test-only pin.
37
+
38
+ Release gate: publish verified Wallet 0.3.1 first, then update User's exact Wallet pin,
39
+ lockfile and pairing metadata and verify the combined package before publishing User.
40
+ Current User still pins published Wallet 0.3.0; these development changes are not yet
41
+ an installable verified release pair. No participant services/data were changed.
42
+
43
+
44
+ ## npm update and migration review fixes — 2026-11-07
45
+
46
+ Approved `agentpay update [-f]`: query npm, confirm the exact User release and its
47
+ pinned Wallet, check requirements, stop managed services, install and invoke the new
48
+ repair/official-test digest. Other Skills, original test requests, Policies and keys
49
+ are preserved. No paid test is triggered. Source/npm-link checkouts are not replaced.
50
+
51
+ Review fixes: relocation-aware preparation validates without rewriting the client
52
+ path before services stop; explicit data purge also retires matching legacy source
53
+ checkpoints/configuration; packaged documentation includes its referenced public
54
+ entry files. Independent regression suite: 374 passed; final targeted checks: 35
55
+ passed. Real npm replacement between two local unpublished tarballs and new-process
56
+ repair passed with controlled registry metadata/service readiness. User npm release
57
+ and real published-version upgrade acceptance remain pending; no participant services changed.
58
+
59
+
60
+ ## User npm integration candidate complete — 2026-11-07
61
+
62
+ User 0.3.0 now pins public Wallet 0.3.0 and Protocol 0.14.3, resolves public Wallet
63
+ exports and exposes `agentpay`. Installer/setup, managed service paths, repair and
64
+ explicit uninstall modes no longer require sibling Wallet source or a compiler.
65
+ Private data remains outside program files. Old custom data selections are retained;
66
+ repair can refresh a moved client-module path only with matching URL/credential.
67
+ Service changes are covered by the installer lock.
68
+
69
+ Independent User tests passed (366 in the complete suite, followed by targeted
70
+ migration/concurrency regressions). A packed User installed from its tarball with
71
+ public dependencies and passed real isolated Wallet/Runtime restart checks without
72
+ sibling source. No participant service, Policy, key or Order was changed. User is
73
+ still `private: true`; no User npm upload or Market guide deployment occurred.
74
+ See the [User package integration record](doc/reference/npm-integration-verification.md) for evidence and remaining limits.
75
+
76
+ Next: review the candidate, then participant install/upgrade/restart/uninstall
77
+ acceptance. Running-daemon version negotiation, User OIDC publication and Market
78
+ install instructions remain open. Wallet Trusted Publisher is configured by the
79
+ owner and pending its first OIDC publication. Earlier sections below are historical
80
+ milestones; their sibling-build and unpublished-Wallet statements are superseded.
81
+
82
+
83
+ ## Wallet first npm publication complete — 2026-11-07
84
+
85
+ `@c4roa0/agentpay-wallet@0.3.0` is public; npm `latest` is 0.3.0. The owner
86
+ published the verified artifact using a hidden-input Token. Registry SHA-512
87
+ integrity matches the local artifact. A fresh public-registry installation with
88
+ scripts disabled passed installed CLI and real IPC permission/unlock/restart checks;
89
+ disposable test data was removed. Source revision: Wallet `082a8db`.
90
+
91
+ The publication workflow is on GitHub, but Wallet's npm Trusted Publisher setup
92
+ and first OIDC publication remain unverified. User 0.2.0 still rejects this Wallet
93
+ pair; next development loop is User package adoption. No live Wallet services,
94
+ keys, Policies or Orders were changed. Earlier candidate sections record pre-release
95
+ evidence and are superseded for publication status by this section.
96
+
97
+
98
+ ## Wallet package review follow-up — 2026-11-07
99
+
100
+ Review found a missing prepack build guard and stale internal-path examples in
101
+ packaged documentation. Wallet now rebuilds compiled files before normal npm pack;
102
+ installed tarballs need no build hook. Public client examples and package reading
103
+ paths are corrected. Clean independent pack/install, a TypeScript consumer and real
104
+ CLI/IPC unlock/restart checks passed. User integration remains the next loop;
105
+ Wallet 0.3.0 is still unpublished and intentionally rejected by User 0.2.0 pairing.
106
+
107
+
108
+ ## Wallet npm candidate verified — 2026-11-07
109
+
110
+ Steps 1–2 complete: Protocol migration baseline committed; Wallet 0.3.0 candidate
111
+ provides public client/local-administration/CLI entries and compiled declarations.
112
+ Independent frozen install/build and 29 behavioral tests passed. The packed artifact
113
+ installed without sibling sources; real CLI/IPC checks passed for capability denial,
114
+ no generic signing, unlock and restart preserving the key while locking the service.
115
+ No npm publication, service restart or participant data change was performed.
116
+
117
+ Next: User consumes this reviewed Wallet package and resolves public entries instead
118
+ of sibling `dist/src` files. Current User 0.2.0 pair checks deliberately reject Wallet
119
+ 0.3.0; do not update a participant Wallet alone. Publication remains blocked by
120
+ `private: true`; package and User integration must be completed before synchronization.
121
+
122
+
123
+ ## npm client distribution plan — 2026-11-07
124
+
125
+ Approved npm-first distribution for Protocol, Wallet and User; separate repositories
126
+ and processes remain. Ordinary users will install User, which supplies a reviewed
127
+ compiled Wallet dependency. Combined source ZIP is optional later work. See the
128
+ local distribution plan for public entries, upgrades, service paths, private data
129
+ and uninstall boundaries. Steps 1–2 are authorized: commit the verified Protocol
130
+ dependency baseline, then prepare/test Wallet's public package. User package
131
+ integration and npm uploads are later loops; present sibling installation remains
132
+ until replaced and verified.
133
+
134
+
135
+ ## Public Protocol npm migration verified — 2026-11-06
136
+
137
+ User now pins `@c4roa0/agentpay-protocol@0.14.3`; production imports, test fixtures
138
+ and the public notice use that package. No unrelated locked dependencies changed.
139
+ The v1 update-pair metadata retains its `typesDependency` field and pins 0.14.3;
140
+ checks require both User and Wallet to use the new package at that exact version.
141
+ Old archive-based Wallet and different Protocol versions are rejected. Version-range
142
+ compatibility remains planned; no legacy alias or bypass was added.
143
+
144
+ Installer/repair fingerprints no longer require a vendor directory. Manifests and
145
+ lockfiles still bind dependency changes. Removed the old archive/license/manifest
146
+ after independent verification; historical review records describe the earlier state.
147
+ With only sibling User/Wallet source in a temporary directory, frozen Wallet install,
148
+ Wallet build, User npm ci and all 364 tests passed (zero failures/skips). Real installer
149
+ prepare-only execution also passed twice: first preparation ran the package managers
150
+ and build, unchanged retry skipped them. Actual pair checks/snapshot reads passed
151
+ without vendor directories. This proves preparation and controlled local behavior,
152
+ not participant setup, owner approval or real-network payment acceptance.
153
+ No running services, key files, Policies or Orders were modified.
154
+
155
+
156
+ ## Public-source preparation — 2026-11-06
157
+
158
+ User's original code is MPL 2.0, as selected by the owner; public Protocol and
159
+ attributed reference fixtures retain MIT. Wallet and Protocol are public. User
160
+ history was replaced by the approved single-commit baseline `2a80f4a`; the owner
161
+ confirmed public visibility. Anonymous refs were verified on 2026-11-06. Release
162
+ assets and full anonymous clone/ZIP installation remain separate work.
163
+
164
+ Current preparation removes private platform harnesses and historical dependency
165
+ archives from the public tree, uses the reviewed public Protocol 0.14.1 archive,
166
+ and makes tests independent of sibling Agent/Protocol/private platform checkouts.
167
+ User still requires a built sibling Wallet. The exact version pair and internal
168
+ Wallet imports remain current constraints, not the planned compatibility contract.
169
+ See [source review](doc/security/public-source-review-2026-11-06.md).
170
+
171
+ Current documentation is organized by role and feature. Private chronological records
172
+ and previous TODO snapshots are preserved outside the repository; removing them from
173
+ publication does not cancel outstanding acceptance. Independent User + built public Wallet verification passed all 364 tests with no
174
+ failures or skips. Offline installation, 112-file syntax-tree comparison, local
175
+ Markdown links and whitespace checks passed. This does not establish live-network
176
+ or fresh participant installation acceptance.
177
+
178
+ Follow-up public-document review corrected stale Market per-Policy grouping claims,
179
+ expired-Policy connection guidance and owner-signing descriptions across setup,
180
+ renewal, migration and deployment references. Installation prerequisites now include
181
+ npm/Corepack. The old preview module is labelled as such; executable behavior is
182
+ unchanged. Local links, stale-wording scan, syntax and whitespace checks passed.
183
+
184
+ ## Implemented product scope
185
+
186
+ - One grouped `./run` entry for installation, repair, Wallet/Policy operations,
187
+ Linux user services, Market connection, Orders and local cache management.
188
+ - External-owner browser approval with resumable operation plans; separate guarded
189
+ Anvil signer. Policy renewal/deployment replacement preserves key and Order history.
190
+ - Per-call service-neutral Runtime, private caller authentication, original request
191
+ recovery, durable input/result snapshots and explicitly managed attachment cache.
192
+ - Stable Wallet display identity with individually verified Policy scopes. Local
193
+ status distinguishes saved metadata, live observations and unresolved results.
194
+ - Official digest-pinned paid connectivity test, with explicit price consent and
195
+ original-request continuation after interruption.
196
+
197
+ The recorded private single-owner MetaMask/Anvil authorization and payment journey
198
+ passed, including participant Market Order viewing and independent payout reconciliation.
199
+ This is scoped private evidence, not public-network, multisig, real-funds or production
200
+ approval. Detailed operational records are not distributed in this repository.
201
+
202
+ ## Next work
203
+
204
+ Public source preparation is complete within the recorded review scope. Next is the approved
205
+ [distribution plan](doc/plans/user-wallet-distribution.md): a supported public Wallet
206
+ client/version boundary and combined release archive. No automatic source updater.
207
+
208
+ Official test network mapping, deployment/artifact handoff, complete interrupted owner
209
+ signing and real-network acceptance remain open. macOS and graphical unlock remain
210
+ deferred. [TODO](doc/TODO.md) tracks these gates and the retained acceptance backlog.
package/run ADDED
@@ -0,0 +1,29 @@
1
+ #!/bin/sh
2
+ # SPDX-License-Identifier: MPL-2.0
3
+ # This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ # If a copy was not distributed with this file, see https://mozilla.org/MPL/2.0/.
5
+ # Use an explicit Node installation without requiring a global installation.
6
+ if [ -n "${AGENTPAY_NODE:-}" ]; then
7
+ case "$AGENTPAY_NODE" in
8
+ /*) node_path=$AGENTPAY_NODE ;;
9
+ *) printf '%s\n' 'AGENTPAY_NODE must be the full path to your Node executable.' >&2; exit 1 ;;
10
+ esac
11
+ else
12
+ node_path=$(command -v node) || {
13
+ printf '%s\n' 'Node was not found. Set AGENTPAY_NODE to its full path, then retry.' 'Example: AGENTPAY_NODE=/path/to/node ./run help' >&2
14
+ exit 1
15
+ }
16
+ fi
17
+ if [ ! -f "$node_path" ] || [ ! -x "$node_path" ]; then
18
+ printf '%s\n' 'The selected Node executable does not exist or is not executable. Check AGENTPAY_NODE.' >&2
19
+ exit 1
20
+ fi
21
+ case "$node_path" in
22
+ /*) ;;
23
+ *) node_path="$PWD/$node_path" ;;
24
+ esac
25
+ # npm and its child scripts must see the same selected Node installation.
26
+ PATH="${node_path%/*}:${PATH:-/usr/bin:/bin}"
27
+ export PATH
28
+ run_dir=$(CDPATH= cd -- "${0%/*}" && pwd -P) || exit 1
29
+ exec "$node_path" "$run_dir/scripts/agentpay-cli.mjs" "$@"
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ // SPDX-License-Identifier: MPL-2.0
3
+ // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ // If a copy was not distributed with this file, see https://mozilla.org/MPL/2.0/.
5
+ import { runUserCli } from "../src/user-cli.mjs";
6
+ try {
7
+ process.exitCode = await runUserCli(process.argv.slice(2));
8
+ } catch (error) {
9
+ console.error(error.message || "Local operation failed. Run agentpay help.");
10
+ process.exitCode = 1;
11
+ }
@@ -0,0 +1,211 @@
1
+ #!/usr/bin/env node
2
+ // SPDX-License-Identifier: MPL-2.0
3
+ // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ // If a copy was not distributed with this file, see https://mozilla.org/MPL/2.0/.
5
+ // Private-Anvil existing-Safe authorization. Never accepts an owner key.
6
+ import { readFile, stat } from "node:fs/promises";
7
+ import { join, resolve } from "node:path";
8
+ import { createInterface } from "node:readline/promises";
9
+ import { Contract, getAddress, JsonRpcProvider } from "ethers";
10
+ import { Phase0Wallet } from "@c4roa0/agentpay-wallet/local";
11
+ import {
12
+ buildSafePolicyPlan,
13
+ inspectSafePolicy,
14
+ safeEthSignSignature,
15
+ } from "../src/safe-policy-plan.mjs";
16
+
17
+ const [command, privateDirArg, configArg] = process.argv.slice(2);
18
+ if (
19
+ !["preview", "authorize", "bind", "check"].includes(command) ||
20
+ !privateDirArg ||
21
+ !configArg ||
22
+ process.argv.length !== 5
23
+ )
24
+ throw new Error(
25
+ "usage: authorize-existing-safe.mjs <preview|authorize|bind|check> <private-user-data-dir> <public-policy-config.json>",
26
+ );
27
+ const dataDir = resolve(privateDirArg);
28
+ const config = JSON.parse(await readFile(resolve(configArg), "utf8"));
29
+ const walletDir = join(dataDir, "wallet");
30
+ const wallet = await Phase0Wallet.open(walletDir);
31
+ const delegate = await wallet.address();
32
+ const plan = buildSafePolicyPlan(config, delegate);
33
+ const ownerAddress = getAddress(config.ownerAddress);
34
+ const rpc = new JsonRpcProvider(plan.rpcUrl, plan.chainId, {
35
+ staticNetwork: true,
36
+ });
37
+ try {
38
+ const state = await inspectSafePolicy(rpc, plan);
39
+ if (!state.owners.includes(ownerAddress) || state.threshold !== 1) {
40
+ throw new Error(
41
+ "C6 first rehearsal requires the selected Anvil owner to be the sole Safe signature threshold",
42
+ );
43
+ }
44
+ const publicPlan = {
45
+ chainId: plan.chainId,
46
+ safe: plan.safe,
47
+ ownerAddress,
48
+ delegate: plan.delegate,
49
+ module: plan.module,
50
+ factory: plan.factory,
51
+ registry: plan.registry,
52
+ token: plan.token,
53
+ policyId: plan.policyId,
54
+ maxPerPaymentAtomic: plan.maxPerPayment.toString(),
55
+ totalBudgetAtomic: plan.totalBudget.toString(),
56
+ validAfter: plan.validAfter,
57
+ validUntil: plan.validUntil,
58
+ dynamicQualification:
59
+ "AgentPay Registry at the fixed address; future qualified Skills need no new Policy",
60
+ currentState: state,
61
+ safeCalls: plan.calls,
62
+ };
63
+ if (command === "preview") {
64
+ process.stdout.write(
65
+ `${JSON.stringify({ ok: true, plan: publicPlan }, null, 2)}\n`,
66
+ );
67
+ } else {
68
+ if (command === "authorize") {
69
+ const url = new URL(plan.rpcUrl);
70
+ if (
71
+ plan.chainId !== 31337 ||
72
+ url.protocol !== "http:" ||
73
+ !["127.0.0.1", "localhost", "[::1]"].includes(url.hostname)
74
+ ) {
75
+ throw new Error("ANVIL_OWNER_SIGNING_TEST_ONLY");
76
+ }
77
+ if (state.policyExists && !state.policyMatches)
78
+ throw new Error("EXISTING_POLICY_CONFLICT");
79
+ if (!state.moduleEnabled || !state.policyExists) {
80
+ process.stdout.write(
81
+ `${JSON.stringify({ ok: true, authorizationPreview: publicPlan }, null, 2)}\n`,
82
+ );
83
+ const expected = `AUTHORIZE ${plan.policyId}`;
84
+ if (!process.stdin.isTTY || !process.stderr.isTTY)
85
+ throw new Error("OWNER_AUTHORIZATION_TTY_REQUIRED");
86
+ const prompt = createInterface({
87
+ input: process.stdin,
88
+ output: process.stderr,
89
+ });
90
+ let answer;
91
+ try {
92
+ answer = await prompt.question(
93
+ `Type '${expected}' to submit the displayed Safe calls: `,
94
+ );
95
+ } finally {
96
+ prompt.close();
97
+ }
98
+ if (answer.trim() !== expected)
99
+ throw new Error("OWNER_AUTHORIZATION_NOT_CONFIRMED");
100
+ const calls = [
101
+ ...(!state.moduleEnabled ? [plan.calls[0]] : []),
102
+ ...(!state.policyExists ? [plan.calls[1]] : []),
103
+ ];
104
+ for (const call of calls)
105
+ await executeSafeCall(rpc, plan.safe, ownerAddress, call);
106
+ }
107
+ }
108
+ const final = await inspectSafePolicy(rpc, plan);
109
+ if (!final.moduleEnabled || !final.policyMatches)
110
+ throw new Error("CHAIN_POLICY_NOT_VERIFIED");
111
+ if (command === "bind") {
112
+ if (
113
+ await stat(join(walletDir, "wallet.sock")).then(
114
+ () => true,
115
+ (error) => {
116
+ if (error.code === "ENOENT") return false;
117
+ throw error;
118
+ },
119
+ )
120
+ )
121
+ throw new Error("STOP_WALLET_SERVICE_BEFORE_LOCAL_BIND");
122
+ if (wallet.policy) {
123
+ if (JSON.stringify(wallet.policy) !== JSON.stringify(plan.walletPolicy))
124
+ throw new Error("LOCAL_POLICY_CONFLICT");
125
+ } else await wallet.bindPolicy(plan.walletPolicy);
126
+ }
127
+ process.stdout.write(
128
+ `${JSON.stringify(
129
+ {
130
+ ok: true,
131
+ chainPolicyVerified: true,
132
+ moduleEnabled: final.moduleEnabled,
133
+ policyMatches: final.policyMatches,
134
+ localWalletBound: command === "bind" ? true : wallet.policy !== null,
135
+ remainingBudgetAtomic: (
136
+ plan.totalBudget - BigInt(final.policySpent)
137
+ ).toString(),
138
+ },
139
+ null,
140
+ 2,
141
+ )}\n`,
142
+ );
143
+ }
144
+ } finally {
145
+ rpc.destroy();
146
+ }
147
+
148
+ async function executeSafeCall(rpc, safeAddress, ownerAddress, call) {
149
+ const zero = "0x0000000000000000000000000000000000000000";
150
+ const safe = new Contract(
151
+ safeAddress,
152
+ [
153
+ "function nonce() view returns (uint256)",
154
+ "function getTransactionHash(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce) view returns (bytes32)",
155
+ "function execTransaction(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,bytes signatures) returns (bool)",
156
+ "event ExecutionSuccess(bytes32 indexed txHash,uint256 payment)",
157
+ "event ExecutionFailure(bytes32 indexed txHash,uint256 payment)",
158
+ ],
159
+ await rpc.getSigner(ownerAddress),
160
+ );
161
+ const nonce = await safe.nonce();
162
+ const hash = await safe.getTransactionHash(
163
+ call.to,
164
+ 0,
165
+ call.data,
166
+ 0,
167
+ 0,
168
+ 0,
169
+ 0,
170
+ zero,
171
+ zero,
172
+ nonce,
173
+ );
174
+ const signedMessage = await rpc.send("eth_sign", [ownerAddress, hash]);
175
+ const safeSignature = safeEthSignSignature(hash, signedMessage, ownerAddress);
176
+ const receipt = await (
177
+ await safe.execTransaction(
178
+ call.to,
179
+ 0,
180
+ call.data,
181
+ 0,
182
+ 0,
183
+ 0,
184
+ 0,
185
+ zero,
186
+ zero,
187
+ safeSignature,
188
+ )
189
+ ).wait();
190
+ const events = receipt.logs.map((log) => {
191
+ try {
192
+ return safe.interface.parseLog(log);
193
+ } catch {
194
+ return null;
195
+ }
196
+ });
197
+ if (
198
+ receipt.status !== 1 ||
199
+ !events.some((event) => event?.name === "ExecutionSuccess") ||
200
+ events.some((event) => event?.name === "ExecutionFailure")
201
+ )
202
+ throw new Error("SAFE_OWNER_CALL_FAILED");
203
+ process.stdout.write(
204
+ `${JSON.stringify({
205
+ safeCall: call.purpose,
206
+ transactionHash: receipt.hash,
207
+ safeNonce: nonce.toString(),
208
+ confirmed: true,
209
+ })}\n`,
210
+ );
211
+ }