@c4roa0/agentpay-user 0.3.0 → 0.3.2
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.
- package/AGENTS.md +10 -0
- package/README.md +18 -17
- package/doc/TODO.md +39 -4
- package/doc/architecture.md +6 -3
- package/doc/plans/user-wallet-distribution.md +2 -2
- package/doc/reference/npm-integration-verification.md +36 -0
- package/doc/runbooks/commands.md +14 -0
- package/doc/runbooks/npm-publication.md +46 -40
- package/doc/runbooks/official-test-package.md +16 -1
- package/package.json +4 -4
- package/progress.md +151 -7
- package/scripts/install-skill-bundle.mjs +5 -3
- package/src/index.mjs +3 -1
- package/src/local-update.mjs +17 -7
- package/src/market-download-url.mjs +20 -15
- package/src/official-test-package.mjs +2 -2
- package/src/official-test-update.mjs +6 -8
- package/src/protocol-package.mjs +25 -0
- package/src/software-versions.mjs +48 -0
- package/src/status-panel.mjs +14 -0
- package/src/wallet-package.mjs +6 -0
- package/update-pair.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -135,3 +135,13 @@ load Protocol fixtures from the pinned public package, not a source checkout.
|
|
|
135
135
|
Do not remove scripts merely because their name contains smoke or Anvil: some are
|
|
136
136
|
current onboarding entries. Review callers first. Never weaken signer or payment
|
|
137
137
|
boundaries to simplify tests. Keep source maps and behavioral evidence limits current.
|
|
138
|
+
|
|
139
|
+
## Tag-triggered npm releases
|
|
140
|
+
|
|
141
|
+
Package version `X.Y.Z` is released by pushing tag `vX.Y.Z` at the exact reviewed
|
|
142
|
+
source commit. `.github/workflows/publish.yml` validates this match, verifies the
|
|
143
|
+
package, publishes through OIDC and checks registry integrity. Pushing a release
|
|
144
|
+
tag is a publication action and needs maintainer authorization; ordinary branch
|
|
145
|
+
pushes do not publish. Never move an existing release tag. Verify registry state
|
|
146
|
+
before rerunning a failed publication. The `npm-publish` environment must allow
|
|
147
|
+
release tags (for example `v*`), not only the main branch.
|
package/README.md
CHANGED
|
@@ -8,13 +8,14 @@ User is the Agent/Skill runtime, not a Provider server or a general-purpose wall
|
|
|
8
8
|
It retains request identity and local results so interruptions can be recovered
|
|
9
9
|
without silently creating a replacement purchase.
|
|
10
10
|
|
|
11
|
-
## Install
|
|
11
|
+
## Install with npm
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
On Linux, prepare Node.js 22.22.3 or newer, npm and your AgentPay Market address.
|
|
14
|
+
Install User with the command below. It automatically installs the matching Wallet
|
|
15
|
+
and Protocol packages; you do not need to download two repositories:
|
|
15
16
|
|
|
16
17
|
```sh
|
|
17
|
-
npm install --global @c4roa0/agentpay-user
|
|
18
|
+
npm install --global @c4roa0/agentpay-user
|
|
18
19
|
agentpay install --market https://YOUR_MARKET_ORIGIN
|
|
19
20
|
```
|
|
20
21
|
|
|
@@ -22,19 +23,6 @@ Replace the Market URL with your platform's address. Use a user-owned Node/npm
|
|
|
22
23
|
installation with Node and npm's executable directory on PATH. No Wallet checkout,
|
|
23
24
|
Corepack, pnpm or TypeScript build is needed.
|
|
24
25
|
|
|
25
|
-
For contributors or source ZIP users:
|
|
26
|
-
|
|
27
|
-
```sh
|
|
28
|
-
git clone https://github.com/c4rO-0/agentpay-user.git user
|
|
29
|
-
cd user
|
|
30
|
-
npm ci
|
|
31
|
-
npm link
|
|
32
|
-
agentpay help
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
`npm link` exposes the command from your checkout. Without linking, `./run` (or
|
|
36
|
-
`sh run`) provides the same commands; `AGENTPAY_NODE` can select your Node executable.
|
|
37
|
-
|
|
38
26
|
Install verifies dependencies, downloads public settings and continues setup.
|
|
39
27
|
You choose the Safe and spending limits, then approve with its owner wallet.
|
|
40
28
|
The optional official payment test asks before spending. Never enter an owner
|
|
@@ -63,6 +51,19 @@ update their files, run `npm ci`, then `agentpay repair`. [Commands](doc/runbook
|
|
|
63
51
|
|
|
64
52
|
## Develop or integrate
|
|
65
53
|
|
|
54
|
+
For contributors or source ZIP users:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
git clone https://github.com/c4rO-0/agentpay-user.git user
|
|
58
|
+
cd user
|
|
59
|
+
npm ci
|
|
60
|
+
npm link
|
|
61
|
+
agentpay help
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`npm link` exposes the command from your checkout. Without linking, `./run` (or
|
|
65
|
+
`sh run`) provides the same commands; `AGENTPAY_NODE` can select your Node executable.
|
|
66
|
+
|
|
66
67
|
- [Developer guide](doc/develope.md): independent checkout, focused tests and evidence limits.
|
|
67
68
|
- [Architecture](doc/architecture.md): source map and recovery/authorization boundaries.
|
|
68
69
|
- [Skill author guide](doc/runbooks/runtime-skill-client.md): call the shared Runtime client.
|
package/doc/TODO.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# User TODO
|
|
2
2
|
|
|
3
|
+
## Tag-triggered publication
|
|
4
|
+
|
|
5
|
+
- [x] Use matching `vX.Y.Z` tags for npm publication; retain verification gates.
|
|
6
|
+
- [x] Owner confirmed release tags allowed in the GitHub `npm-publish` environment.
|
|
7
|
+
- [ ] Verify the first tag-triggered OIDC publication and registry integrity.
|
|
8
|
+
|
|
9
|
+
## Official package 1.2.1 — 2026-11-08
|
|
10
|
+
|
|
11
|
+
- [x] Review actual published bytes, update the built-in official pin and verify fixed-download checks. Real Market fixed-version download/install repeated successfully in an isolated directory.
|
|
12
|
+
- [x] Inspect this participant installation’s prior-version official tests: saved 1.2.0 record is acknowledged; retained unchanged. This does not assert every user has completed old tests.
|
|
13
|
+
- [x] Load the reviewed User source update and run the normal 1.2.1 payment test with explicit user consent; terminal delivery/result/ack completed.
|
|
14
|
+
- [x] Verify website visibility and independently reconcile Settlement/chain outcome; prepare User 0.3.2 candidate.
|
|
15
|
+
- [x] Pin the verified public Wallet 0.3.2; align package/lockfile/update-pair.
|
|
16
|
+
- [ ] Publish User 0.3.2 through OIDC and verify registry artifact; then accept a real npm update.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Fixed Skill download loop — 2026-11-08
|
|
20
|
+
|
|
21
|
+
- [x] Request the official ZIP by the built-in SHA-256; reject unavailable/substituted versions without fallback.
|
|
22
|
+
- [x] Complete fixed-download regression/type checks and publication/deletion review; the separate Market schema-fixture issue was resolved in its later regression.
|
|
23
|
+
- [ ] After Market API/Web/nginx support is live, publish the next User version (not 0.3.1 again) and verify old pinned ZIP download and participant upgrade.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Running-version release loop — 2026-11-07
|
|
27
|
+
|
|
28
|
+
- [x] Verify User 0.3.0 public-registry publication; Trusted Publisher configured.
|
|
29
|
+
- [x] Verify actual installed Protocol versions from both consumer resolution paths.
|
|
30
|
+
- [x] Add process-start software reporting and status/repair mismatch handling; isolated checks passed.
|
|
31
|
+
- [x] Wallet 0.3.1 published through the configured workflow; public npm version/dependencies verified.
|
|
32
|
+
- [x] Pin User 0.3.1 to published Wallet 0.3.1; pairing metadata/lockfile and standalone archive verification complete.
|
|
33
|
+
- [x] Publish User 0.3.1; verify public npm/latest and successful Wallet/User OIDC runs.
|
|
34
|
+
- [ ] Verify real published-version update/restart on the participant installation.
|
|
35
|
+
|
|
36
|
+
|
|
3
37
|
## npm update follow-up — 2026-11-07
|
|
4
38
|
|
|
5
39
|
- [x] Implement confirmed `agentpay update [-f]`, exact User target and matching Wallet; invoke new repair and pinned official Skill check.
|
|
@@ -15,11 +49,12 @@
|
|
|
15
49
|
- [x] Review step 2: guard normal packing against missing/stale builds, correct public-interface docs and verify a standalone TypeScript consumer.
|
|
16
50
|
- [x] Step 3: migrate User to Wallet npm dependency and `agentpay` entry; remove sibling/build assumptions; isolated tarball/process acceptance passed.
|
|
17
51
|
- [x] Step 4a: exact installed-package checks, service-path/client relocation, installer lock, recovery-safe preparation and explicit uninstall modes.
|
|
18
|
-
- [
|
|
52
|
+
- [x] Step 4b implementation: installed/running version and interface checks.
|
|
53
|
+
- [ ] Step 4b acceptance: participant upgrade/interruption recovery (same gate as the running-version loop above).
|
|
19
54
|
- [ ] Step 5: publish Wallet then User via OIDC; verify registry installs and update Market guides.
|
|
20
55
|
- [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
|
|
22
|
-
- [
|
|
56
|
+
- [x] Owner configured Wallet npm Trusted Publisher; validated by 0.3.1 publication.
|
|
57
|
+
- [x] Wallet and User OIDC validated by 0.3.1 releases; Market guide updates remain pending.
|
|
23
58
|
- [ ] Step 6: participant setup/upgrade/restart/uninstall and official Anvil paid acceptance.
|
|
24
59
|
|
|
25
60
|
|
|
@@ -48,7 +83,7 @@
|
|
|
48
83
|
## Independent distribution (next development loop)
|
|
49
84
|
|
|
50
85
|
- [ ] Define the supported Wallet client/IPC boundary and source/build/running compatibility requirements.
|
|
51
|
-
- [ ]
|
|
86
|
+
- [ ] Optional later: widen exact reviewed dependency pairs only with a verified compatibility matrix; preserve keys, Policies and recovery.
|
|
52
87
|
- [ ] Optional later: combined ZIP/platform assets after primary npm installation acceptance.
|
|
53
88
|
- [ ] Verify fresh Git/ZIP installation and missing/incompatible/stale version recovery; update Market guidance.
|
|
54
89
|
|
package/doc/architecture.md
CHANGED
|
@@ -18,7 +18,7 @@ logic or platform storage. No Settlement checkout or database access is required
|
|
|
18
18
|
## Shared Protocol dependency
|
|
19
19
|
|
|
20
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
|
|
21
|
+
record integrity. The current repair gate still checks the exact package versions
|
|
22
22
|
and shared Protocol dependency in `update-pair.json`; `typesDependency` is the
|
|
23
23
|
retained v1 field name for that npm version. It is not a compatibility range.
|
|
24
24
|
Installation/repair fingerprints cover manifests and lockfiles rather than a vendor
|
|
@@ -85,8 +85,11 @@ verification before binding. A lost response resumes the original plan.
|
|
|
85
85
|
## External dependencies and development boundary
|
|
86
86
|
|
|
87
87
|
User resolves the installed Wallet package through public client, local-administration
|
|
88
|
-
and CLI exports.
|
|
89
|
-
|
|
88
|
+
and CLI exports. `wallet-package.mjs` verifies the exact reviewed pair;
|
|
89
|
+
`protocol-package.mjs` resolves each consumer's actual Protocol installation, including
|
|
90
|
+
nested npm dependencies. `software-versions.mjs` compares process-start reports with
|
|
91
|
+
the installed pair during status/repair. User 0.3.1 pins Wallet 0.3.1 for these checks; broader compatibility ranges remain deferred.
|
|
92
|
+
User imports ethers from its own
|
|
90
93
|
declared dependency. The pinned public Protocol package provides types, hashes and
|
|
91
94
|
fixtures. No Agent, Protocol source checkout or private platform repository is
|
|
92
95
|
required for the local test suite.
|
|
@@ -9,8 +9,8 @@ Repositories, processes and releases remain separate; Node is still required.
|
|
|
9
9
|
Ordinary users install `@c4roa0/agentpay-user` and run `agentpay setup`. User installs
|
|
10
10
|
its reviewed Wallet dependency; both consume public Protocol. No sibling source
|
|
11
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
|
|
13
|
-
|
|
12
|
+
Wallet remains independently installable. Git checkouts are for contributors; the User 0.3.0 release uses the public Wallet package. User 0.3.1 pairs with
|
|
13
|
+
Wallet 0.3.1 for running-version verification; publication remains a separate release step.
|
|
14
14
|
Combined ZIPs and platform binaries are optional later work, not a release prerequisite.
|
|
15
15
|
|
|
16
16
|
npm installation only installs program files. Key creation, background-service
|
|
@@ -65,3 +65,39 @@ The existing official-package tests cover pinned digest rejection and preservati
|
|
|
65
65
|
The updater follows npm's [install](https://docs.npmjs.com/cli/v11/commands/npm-install/)
|
|
66
66
|
and [view](https://docs.npmjs.com/cli/v11/commands/npm-view/) command interfaces.
|
|
67
67
|
A released-version registry upgrade and participant recovery still need acceptance.
|
|
68
|
+
|
|
69
|
+
## Running-process reporting follow-up — 2026-11-07
|
|
70
|
+
|
|
71
|
+
User 0.3.0 first publication was verified against the public registry. User and Wallet
|
|
72
|
+
Trusted Publishers are configured; first OIDC validation is still pending.
|
|
73
|
+
|
|
74
|
+
The next candidate checks process-start package/interface/Protocol metadata during
|
|
75
|
+
status and repair. User regressions: 378 passed; Wallet behavioral suite: 30 passed.
|
|
76
|
+
Wallet tarball consumption passed real CLI/IPC checks. A disposable User install with
|
|
77
|
+
a local Wallet 0.3.1 archive and temporary test-only dependency pin passed real process
|
|
78
|
+
startup/restart and key preservation. Missing/mismatched reports prevent repair from
|
|
79
|
+
recording success. No Policy, Order or participant service was changed.
|
|
80
|
+
|
|
81
|
+
These results do not establish a published-version upgrade: publish Wallet 0.3.1,
|
|
82
|
+
then update User's exact pin, lockfile and pairing metadata and verify its final archive.
|
|
83
|
+
The repository still pins public Wallet 0.3.0 until that release exists.
|
|
84
|
+
|
|
85
|
+
## Actual installed Protocol verification — 2026-11-08
|
|
86
|
+
|
|
87
|
+
Preflight checks resolved package versions from both User and Wallet, including a
|
|
88
|
+
nested Wallet dependency. A mismatched copy is rejected even if both consumer
|
|
89
|
+
manifests declare the expected version. Process reporting records the resolved
|
|
90
|
+
version at startup. Wallet's 30 tests and standalone archive CLI/IPC checks passed;
|
|
91
|
+
User's final 378-test suite passed after updating a dependency-less test fixture.
|
|
92
|
+
This is local compatibility verification, not a guarantee against altered package files.
|
|
93
|
+
Wallet candidate `7e4d4fa` is pushed; OIDC publication and User exact pin/lockfile
|
|
94
|
+
update remain the release gate.
|
|
95
|
+
|
|
96
|
+
## User 0.3.1 final pairing — 2026-11-08
|
|
97
|
+
|
|
98
|
+
User 0.3.1 pins public Wallet 0.3.1 and Protocol 0.14.3. Lockfile integrity came from
|
|
99
|
+
the public registry; no local file dependency or sibling checkout is required.
|
|
100
|
+
The complete suite passed (378 tests). The npm archive installed independently,
|
|
101
|
+
exposed `agentpay`, and started/restarted real disposable Wallet/Runtime processes
|
|
102
|
+
with matching software reports while preserving the key and starting Wallet locked.
|
|
103
|
+
Publication via GitHub OIDC and participant upgrade remain separate pending steps.
|
package/doc/runbooks/commands.md
CHANGED
|
@@ -87,3 +87,17 @@ independently query the chain. If querying fails, the command labels the last
|
|
|
87
87
|
local record and its saved check time. A successful query does not rewrite local
|
|
88
88
|
history; Runtime maintains its own recovery observations. Use
|
|
89
89
|
`agentpay orders details ID` for the saved local record.
|
|
90
|
+
|
|
91
|
+
## Running-version checks (User 0.3.1)
|
|
92
|
+
|
|
93
|
+
`agentpay status` compares the installed User/Wallet pair with the versions reported
|
|
94
|
+
by the running processes. A mismatch leads to `agentpay repair`; missing reporting
|
|
95
|
+
requires a paired package update first. Repair only records success after both
|
|
96
|
+
processes report the expected package, local reporting interface and Protocol versions.
|
|
97
|
+
These checks do not change Policy validity, Order identity or payment permissions.
|
|
98
|
+
User 0.3.1 installs the required Wallet 0.3.1 dependency automatically.
|
|
99
|
+
|
|
100
|
+
Protocol reporting reads the installed package resolved by that process, rather than
|
|
101
|
+
copying its dependency declaration. User preflight checks both User's and Wallet's
|
|
102
|
+
resolved copies against the reviewed exact version, including nested dependencies.
|
|
103
|
+
Package version checks establish compatibility metadata, not file-integrity attestation.
|
|
@@ -1,56 +1,62 @@
|
|
|
1
1
|
# Publish User to npm
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Push a reviewed `vX.Y.Z` tag to publish `@c4roa0/agentpay-user` through GitHub
|
|
4
|
+
Actions. The tag must match `package.json`. Ordinary branch pushes do not publish.
|
|
5
|
+
Keep `update-pair.json`, the lockfile and the reviewed Wallet dependency aligned.
|
|
6
|
+
Publish the required Wallet version before releasing User.
|
|
5
7
|
|
|
6
|
-
##
|
|
8
|
+
## One-time setup
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
In GitHub **Settings → Environments → npm-publish**, allow deployment from tags
|
|
11
|
+
matching `v*`. A rule allowing only the `main` branch will block tag releases.
|
|
12
|
+
Keep required reviewer approval if desired. Restrict creation, update and deletion
|
|
13
|
+
of release tags to maintainers through repository rules.
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
On npm, configure this package's Trusted Publisher:
|
|
16
|
+
|
|
17
|
+
| Field | Value |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Publisher | GitHub Actions |
|
|
20
|
+
| Organization/user | `c4rO-0` |
|
|
21
|
+
| Repository | `agentpay-user` |
|
|
22
|
+
| Workflow filename | `publish.yml` |
|
|
23
|
+
| Environment name | `npm-publish` |
|
|
24
|
+
| Allowed action | Direct publishing |
|
|
15
25
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
for publication; do not rebuild it between verification and upload.
|
|
26
|
+
Existing matching npm trust settings need no change. The first successful OIDC
|
|
27
|
+
publication validates a pending connection; a local token upload does not.
|
|
28
|
+
No stored npm token is needed by this workflow.
|
|
20
29
|
|
|
21
|
-
##
|
|
30
|
+
## Release a version
|
|
22
31
|
|
|
23
|
-
|
|
32
|
+
1. Update `package.json` and the changelog. Review code, documentation, dependencies
|
|
33
|
+
and package contents; complete the repository's verification steps.
|
|
34
|
+
2. Commit and push the reviewed source to main, including the tag-triggered workflow.
|
|
35
|
+
3. Create an annotated tag at that exact commit and push it. Replace `X.Y.Z` and
|
|
36
|
+
`REVIEWED_COMMIT` below with the release version and reviewed commit:
|
|
24
37
|
|
|
25
38
|
```sh
|
|
26
|
-
|
|
27
|
-
|
|
39
|
+
git tag -a vX.Y.Z REVIEWED_COMMIT -m "Release X.Y.Z"
|
|
40
|
+
git push origin vX.Y.Z
|
|
28
41
|
```
|
|
29
42
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
Pushing the tag starts **Publish User to npm** automatically. There is no version
|
|
44
|
+
input or separate Run workflow step. If the environment requires approval, approve
|
|
45
|
+
that deployment in GitHub. The workflow checks the tag against the manifest before
|
|
46
|
+
building, runs the existing verification gates, tests/packs the archive, publishes
|
|
47
|
+
with OIDC and checks public registry integrity. It builds the tagged source, even
|
|
48
|
+
if main advances. No production service or participant Wallet is upgraded.
|
|
35
49
|
|
|
36
|
-
|
|
37
|
-
`main`. Add maintainer approval if desired. In the npm package's Trusted Publisher
|
|
38
|
-
settings, select GitHub Actions and enter:
|
|
50
|
+
## Verify or recover a publication
|
|
39
51
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
| Repository | `agentpay-user` |
|
|
44
|
-
| Workflow filename | `publish.yml` |
|
|
45
|
-
| Environment name | `npm-publish` |
|
|
46
|
-
| Allowed action | Direct publishing |
|
|
52
|
+
Check the run's **Verify public registry integrity** result and the package version
|
|
53
|
+
on npm. Record the tag, source commit and result in progress. Do not claim success
|
|
54
|
+
from tag creation alone. Actual OIDC validation requires the GitHub run.
|
|
47
55
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
does not. Afterwards, disable bypass-2FA tokens and retire unused publishing tokens.
|
|
53
|
-
See [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/).
|
|
56
|
+
If a run fails before upload, investigate before rerunning. If source needs a fix,
|
|
57
|
+
use a new version/tag; never move an existing release tag. If upload may have
|
|
58
|
+
succeeded, check registry state and archive integrity before rerunning; npm versions
|
|
59
|
+
are immutable and an already-published version must not be uploaded again.
|
|
54
60
|
|
|
55
|
-
Publication is not
|
|
56
|
-
|
|
61
|
+
Publication is not participant upgrade acceptance, cross-platform verification or
|
|
62
|
+
real-funds approval.
|
|
@@ -9,9 +9,24 @@ hash reported by the same server that supplies the ZIP.
|
|
|
9
9
|
|
|
10
10
|
This pin applies only to the maintained onboarding test. Generic Runtime calls and
|
|
11
11
|
ordinary Skill installation do not require the random service or this package.
|
|
12
|
-
The current pin is the reviewed random Skill 1.2.
|
|
12
|
+
The current pin is the reviewed random Skill 1.2.1 private rehearsal package;
|
|
13
13
|
it includes its service reference. It is not a production-network release.
|
|
14
14
|
|
|
15
|
+
## Download a fixed Market version
|
|
16
|
+
|
|
17
|
+
Setup and repair derive `/skills/bundles/:serviceId/versions/:sha256/metadata`
|
|
18
|
+
from the saved Market source, using User's built-in ZIP hash. They download the matching
|
|
19
|
+
fixed ZIP on the same origin and retain any `/market` ingress prefix. They no longer
|
|
20
|
+
require Market's current release to match the User release. The ZIP is still hashed
|
|
21
|
+
before parsing or saving; metadata cannot override the pin.
|
|
22
|
+
|
|
23
|
+
Market must retain the approved historical version and permit its public download.
|
|
24
|
+
If it is absent, withdrawn or no longer approved under current checks, preparation
|
|
25
|
+
stops with an unavailable message. No current-version or Provider-hosted fallback is
|
|
26
|
+
used. Existing local packages, requests and spending permission are unchanged.
|
|
27
|
+
This client change requires the Market fixed-version API rollout before distributing
|
|
28
|
+
the next User release; User 0.3.1 and earlier do not use this endpoint.
|
|
29
|
+
|
|
15
30
|
## Before publishing a User update
|
|
16
31
|
|
|
17
32
|
1. Check whether the maintained official Skill has a new published version.
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c4roa0/agentpay-user",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"ethers": "^6.17.0",
|
|
7
|
-
"fs-native-extensions": "1.5.3",
|
|
8
6
|
"@c4roa0/agentpay-protocol": "0.14.3",
|
|
9
|
-
"@c4roa0/agentpay-wallet": "0.3.
|
|
7
|
+
"@c4roa0/agentpay-wallet": "0.3.2",
|
|
8
|
+
"ethers": "^6.17.0",
|
|
9
|
+
"fs-native-extensions": "1.5.3"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"start": "node src/index.mjs",
|
package/progress.md
CHANGED
|
@@ -1,12 +1,156 @@
|
|
|
1
1
|
# AgentPay User progress
|
|
2
2
|
|
|
3
|
-
## User 0.3.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
## User 0.3.2 release pairing — 2026-11-08
|
|
4
|
+
|
|
5
|
+
Candidate now pins the verified public Wallet 0.3.2 with Protocol 0.14.3; package,
|
|
6
|
+
lockfile and update-pair metadata agree. This release includes fixed-version
|
|
7
|
+
Market downloads and the reviewed official Skill 1.2.1 pin. Historical notes
|
|
8
|
+
below describe earlier candidate pairings. Publish through tag `v0.3.2` after
|
|
9
|
+
final suite and standalone archive checks; no automatic new purchase is authorized.
|
|
10
|
+
|
|
11
|
+
## Tag-triggered publication — 2026-11-08
|
|
12
|
+
|
|
13
|
+
Wallet, Protocol and User release workflows now run on pushed `vX.Y.Z` tags.
|
|
14
|
+
Each validates its package version, runs existing verification, publishes with
|
|
15
|
+
OIDC and checks registry integrity. Branch pushes do not publish. No tag was
|
|
16
|
+
pushed or npm version published for this workflow change. Owner confirmed `v*` tags allowed in the GitHub
|
|
17
|
+
`npm-publish` environment; npm trust fields remain unchanged. YAML/shell checks and six executable tag/version guard cases passed
|
|
18
|
+
per repository (matching version, mismatch, branch, prerelease, leading zero and
|
|
19
|
+
newline rejection). Actual GitHub/OIDC execution remains pending.
|
|
20
|
+
|
|
21
|
+
## Official 1.2.1 payment reconciled / User 0.3.2 candidate — 2026-11-08
|
|
22
|
+
|
|
23
|
+
Participant confirmed Market Order visibility. Independent fixed-block chain reads,
|
|
24
|
+
receipts and token transfers match Settlement's finalized release record: paid
|
|
25
|
+
0.7 rUSDC, seller 0.665, platform fee 0.035, no refund, empty Vault. Funding,
|
|
26
|
+
delivery and release events occur once for the verified Order. No further payment.
|
|
27
|
+
This is private Anvil acceptance, not real-network or production approval.
|
|
28
|
+
User 0.3.2 candidate includes fixed-version downloads and the reviewed official
|
|
29
|
+
1.2.1 ZIP pin. Its preliminary package check used Wallet 0.3.1 and Protocol 0.14.3.
|
|
30
|
+
The maintainer requested Wallet 0.3.2 review/publication first; after registry
|
|
31
|
+
verification, update User’s exact dependency and reverify the final package.
|
|
32
|
+
Candidate publication and real npm update acceptance remain pending.
|
|
33
|
+
|
|
34
|
+
## Official Skill 1.2.1 participant payment passed — 2026-11-08
|
|
35
|
+
|
|
36
|
+
Operator ran normal wallet unlock and payment-test commands after source repair.
|
|
37
|
+
The guide quoted a maximum 0.7 rUSDC and 10-minute service limit; the operator
|
|
38
|
+
explicitly confirmed. It reported delivery verification, saved-result verification
|
|
39
|
+
and receipt acknowledgement, then completed successfully. This is private Anvil
|
|
40
|
+
end-to-end participant evidence. The quoted maximum is not independently reconciled
|
|
41
|
+
actual charge; payout/refund terminal chain evidence has not been checked here.
|
|
42
|
+
User remains the 0.3.1-labelled source candidate, not a new published npm release.
|
|
43
|
+
Next: website Order visibility and read-only Settlement/chain reconciliation before
|
|
44
|
+
release closeout. Do not rerun a completed payment test just to inspect the result.
|
|
45
|
+
|
|
46
|
+
## Participant repair completed — 2026-11-08
|
|
47
|
+
|
|
48
|
+
Operator ran the normal source repair entry. Official Skill 1.2.1 passed the
|
|
49
|
+
built-in hash check and was installed. Wallet and Runtime restarted; Wallet is
|
|
50
|
+
locked as expected. Saved Policy and Market connection remain present, and local
|
|
51
|
+
history reports two settled Orders plus one archived record. No purchase occurred.
|
|
52
|
+
This is source-candidate repair acceptance, not publication of a new npm version.
|
|
53
|
+
Next operator step unlocks Wallet and invokes the normal payment test; explicit
|
|
54
|
+
current-price confirmation remains required before creating a paid Order.
|
|
55
|
+
|
|
56
|
+
## Official fixed-download acceptance — 2026-11-08
|
|
57
|
+
|
|
58
|
+
The normal prepareOfficialTestUpdate entry downloaded 1.2.1 twice from the running
|
|
59
|
+
Market fixed-version API into an isolated directory, verified the built-in hash,
|
|
60
|
+
installed successfully and preserved an existing prior-record fixture byte-for-byte.
|
|
61
|
+
The first diagnostic read assumed a flat archive; it was corrected to read the saved
|
|
62
|
+
publisher ZIP through User's parser. No product installation defect was found.
|
|
63
|
+
17 targeted pin/download/update/payment-orchestration/prefix checks passed.
|
|
64
|
+
This proves download/install behavior, not paid invocation. No participant services
|
|
65
|
+
or Wallet data changed. Source repair and explicit payment acceptance are next;
|
|
66
|
+
the candidate is not yet a new npm release.
|
|
67
|
+
|
|
68
|
+
## Official test pin 1.2.1 prepared — 2026-11-08
|
|
69
|
+
|
|
70
|
+
Reviewed the actual Provider ZIP and confirmed it matches the published fixed Market
|
|
71
|
+
download: 4373 bytes, SHA-256
|
|
72
|
+
`20633b314c66166f94dc6e7d7eb5bce54ab5901fb1ed314a04ea3fd49ca8a9a4`.
|
|
73
|
+
The official-test pin now selects 1.2.1; generic Runtime routing is unchanged.
|
|
74
|
+
The package checker and 14 controlled pin/download/update/payment-orchestration
|
|
75
|
+
checks passed. The payment fixture now follows the selected version instead of
|
|
76
|
+
hardcoding 1.2.0. No real payment, service restart or npm release was performed.
|
|
77
|
+
Before participant testing, check for unfinished tests from the previous version:
|
|
78
|
+
records are retained, but the payment-test entry selects a version-specific record.
|
|
79
|
+
Do not treat a new-version test as recovery of an old purchase.
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## Development dependency verification — 2026-11-08
|
|
83
|
+
|
|
84
|
+
Reinstalled dependencies from the unchanged lockfile after a stale local installation
|
|
85
|
+
could not resolve the already-declared Protocol package. Fixed-download/update/prefix
|
|
86
|
+
checks pass 8/8; the cross-repository publication/download/User preview regression
|
|
87
|
+
passes 27/27. No dependency pins, services or user data changed. This is controlled
|
|
88
|
+
verification, not a new npm release or live payment acceptance.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## Fixed historical Skill downloads — 2026-11-08
|
|
92
|
+
|
|
93
|
+
Development adds SHA-256-fixed Market metadata/ZIP routes over retained releases,
|
|
94
|
+
a derived per-listing lookup, website forwarding and User official-test pin selection.
|
|
95
|
+
Current publication replacement no longer changes the requested ZIP. Hidden/deleted
|
|
96
|
+
listings, takedown, stale approval and damaged files remain unavailable. Historical
|
|
97
|
+
internal-version ZIP routes now also respect listing visibility. No DB migration,
|
|
98
|
+
Provider download dependency, service restart or payment was performed.
|
|
99
|
+
Deploy Market API/Web and the nginx route allowlist first, then release the updated User; current published User
|
|
100
|
+
0.3.1 does not use the new fixed-version endpoint. Verification: User 33 targeted checks, Web 7 proxy checks, Deploy 8 route/build checks
|
|
101
|
+
and both Market/Web typechecks passed. Market publication regression: 69/70 passed;
|
|
102
|
+
the remaining pre-existing schema fixture fails with WALLET_MAPPING_SCHEMA_INVALID.
|
|
103
|
+
Controlled scanner/DB fixtures and local HTTP were used; no live database, nginx
|
|
104
|
+
rollout or participant acceptance is claimed.
|
|
105
|
+
|
|
106
|
+
## User 0.3.1 paired release published — 2026-11-08
|
|
107
|
+
|
|
108
|
+
Public npm now contains Wallet 0.3.1 with Protocol 0.14.3. User 0.3.1 pins that
|
|
109
|
+
published Wallet exactly; pairing metadata and lockfile are updated together.
|
|
110
|
+
This release adds actual installed Protocol verification and running-version checks
|
|
111
|
+
for status/repair. Prior release-gate notes below describe earlier checkpoints.
|
|
112
|
+
User 0.3.1 passed 378 behavioral tests and standalone npm archive installation,
|
|
113
|
+
including real Wallet/Runtime restart and matching running-version reports.
|
|
114
|
+
User 0.3.1 is public and npm `latest`, with Wallet 0.3.1 and Protocol 0.14.3.
|
|
115
|
+
[User OIDC publication](https://github.com/c4rO-0/agentpay-user/actions/runs/42440841342)
|
|
116
|
+
passed from `46796ea`; [Wallet OIDC publication](https://github.com/c4rO-0/agentpay-wallet/actions/runs/42440112081)
|
|
117
|
+
passed from `7e4d4fa`. Registry metadata was independently checked.
|
|
118
|
+
Real published-version upgrade/restart acceptance remains pending.
|
|
119
|
+
No participant services, keys, Policies or Orders are changed by package verification.
|
|
120
|
+
|
|
121
|
+
## Historical checkpoints — superseded by the current release status above
|
|
122
|
+
|
|
123
|
+
The dated entries below preserve evidence and earlier decisions. Their pending
|
|
124
|
+
release labels are historical; use current TODO for remaining work.
|
|
125
|
+
|
|
126
|
+
### Installed dependency verification / paired release — 2026-11-08
|
|
127
|
+
|
|
128
|
+
User now checks the actual Protocol package resolved from User and Wallet separately,
|
|
129
|
+
including nested npm copies. Process reports use resolved installed versions, not
|
|
130
|
+
just dependency declarations. Wallet 0.3.1 candidate passed behavioral and independent
|
|
131
|
+
package checks and is pushed as `7e4d4fa`; its OIDC publication is the next operator step.
|
|
132
|
+
User remains pinned to public Wallet 0.3.0 until the new registry release exists;
|
|
133
|
+
then update its exact dependency, lockfile and pairing metadata together. User changes
|
|
134
|
+
remain unreleased. No participant service, key, Policy or Order was changed.
|
|
135
|
+
|
|
136
|
+
## User 0.3.0 published; running-version checks in development — 2026-11-07
|
|
137
|
+
|
|
138
|
+
`@c4roa0/agentpay-user@0.3.0` was published from User `86ee8e7`.
|
|
139
|
+
Public registry version/latest and archive integrity matched the verified artifact.
|
|
140
|
+
User and Wallet Trusted Publishers are configured; first OIDC releases remain pending.
|
|
141
|
+
Earlier candidate sections below are historical, not current publication status.
|
|
142
|
+
|
|
143
|
+
Wallet 0.3.1 candidate reports process-start software metadata. User status and repair
|
|
144
|
+
compare running package/interface/Protocol versions against the installed pair.
|
|
145
|
+
Missing reporting is unknown, never proof of compatibility. Policy format/version,
|
|
146
|
+
identity and transaction authority are unchanged. Wallet behavioral tests (30) and installed-package IPC checks passed. User full
|
|
147
|
+
regressions (378) passed, followed by final status checks and an isolated candidate
|
|
148
|
+
Wallet/User process restart test. The candidate pair used a temporary test-only pin.
|
|
149
|
+
|
|
150
|
+
Release gate: publish verified Wallet 0.3.1 first, then update User's exact Wallet pin,
|
|
151
|
+
lockfile and pairing metadata and verify the combined package before publishing User.
|
|
152
|
+
Current User still pins published Wallet 0.3.0; these development changes are not yet
|
|
153
|
+
an installable verified release pair. No participant services/data were changed.
|
|
10
154
|
|
|
11
155
|
|
|
12
156
|
## npm update and migration review fixes — 2026-11-07
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
verifyOfficialTestBytes,
|
|
8
8
|
verifyOfficialTestDigest,
|
|
9
9
|
} from "../src/official-test-package.mjs";
|
|
10
|
-
import { marketDownloadUrl } from "../src/market-download-url.mjs";
|
|
10
|
+
import { marketDownloadUrl, marketVersionMetadataUrl } from "../src/market-download-url.mjs";
|
|
11
11
|
import { resolve } from "node:path";
|
|
12
12
|
import {
|
|
13
13
|
inspectInstalledBundle,
|
|
@@ -42,7 +42,7 @@ if (
|
|
|
42
42
|
}
|
|
43
43
|
if (mode === "--prepare-official-test" && !marketMode)
|
|
44
44
|
throw Error("OFFICIAL_TEST_MARKET_REQUIRED");
|
|
45
|
-
const url = new URL(source);
|
|
45
|
+
const url = official ? marketVersionMetadataUrl(source, digest) : new URL(source);
|
|
46
46
|
if (
|
|
47
47
|
url.username ||
|
|
48
48
|
url.password ||
|
|
@@ -62,6 +62,8 @@ if (marketMode) {
|
|
|
62
62
|
redirect: "error",
|
|
63
63
|
signal: AbortSignal.timeout(5000),
|
|
64
64
|
});
|
|
65
|
+
if (official && [404, 410].includes(r.status))
|
|
66
|
+
throw Error("This official test version is unavailable in Market. Check for a reviewed User update or contact support; no replacement was selected.");
|
|
65
67
|
if (!r.ok) throw new Error(`MARKET_BUNDLE_METADATA_HTTP_${r.status}`);
|
|
66
68
|
const body = await r.json();
|
|
67
69
|
metadata = body.result;
|
|
@@ -78,7 +80,7 @@ if (marketMode) {
|
|
|
78
80
|
!metadata.publisherId ||
|
|
79
81
|
typeof metadata.marketServiceId !== "string" ||
|
|
80
82
|
metadata.marketDownloadPath !==
|
|
81
|
-
|
|
83
|
+
marketDownloadUrl(url, metadata.marketServiceId).pathname.replace(/^\/market(?=\/skills\/)/, "")
|
|
82
84
|
)
|
|
83
85
|
throw new Error("MARKET_BUNDLE_METADATA_INVALID");
|
|
84
86
|
downloadUrl = marketDownloadUrl(url, metadata.marketServiceId);
|
package/src/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { runtimeSoftware } from "./software-versions.mjs";
|
|
1
2
|
// Authenticated local invocation engine. Preserve durable request/payment checkpoints before
|
|
2
3
|
// network calls; startup reconciliation observes history without creating replacement purchases.
|
|
3
4
|
// SPDX-License-Identifier: MPL-2.0
|
|
@@ -127,6 +128,7 @@ const server = createServer(async (req, res) => {
|
|
|
127
128
|
ok: true,
|
|
128
129
|
result: {
|
|
129
130
|
role: "user-runtime",
|
|
131
|
+
software: runtimeSoftware,
|
|
130
132
|
capabilities: ["agentpay.runtime-call.v1"],
|
|
131
133
|
walletTransport: "unix",
|
|
132
134
|
},
|
|
@@ -144,7 +146,7 @@ const server = createServer(async (req, res) => {
|
|
|
144
146
|
void recovery.refresh();
|
|
145
147
|
return json(res, 200, {
|
|
146
148
|
ok: true,
|
|
147
|
-
result: { role: "user-runtime", ...recovery.status() },
|
|
149
|
+
result: { role: "user-runtime", software: runtimeSoftware, ...recovery.status() },
|
|
148
150
|
});
|
|
149
151
|
}
|
|
150
152
|
if (
|
package/src/local-update.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { requireRunningSoftware } from "./software-versions.mjs";
|
|
1
2
|
import { walletPackage } from "./wallet-package.mjs";
|
|
2
3
|
// Apply installed packages. Preserve identity/history and startup preferences;
|
|
3
4
|
// preparation failure must not enable a mismatched Wallet/Runtime pair.
|
|
@@ -185,12 +186,18 @@ export async function applyLocalUpdate({
|
|
|
185
186
|
applied.inputs === selected.inputs &&
|
|
186
187
|
applied.outputs === selected.outputs
|
|
187
188
|
) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
let runningMatches = false;
|
|
190
|
+
try {
|
|
191
|
+
requireRunningSoftware(await wallet(dataDir, "status"), await runtime(dataDir), { ...pair, protocolVersion: pair.typesDependency });
|
|
192
|
+
runningMatches = true;
|
|
193
|
+
} catch { /* Keep repair available for old, stopped or unreported processes. */ }
|
|
194
|
+
if (runningMatches) {
|
|
195
|
+
await connection({ dataDir, write });
|
|
196
|
+
phase = "unchanged";
|
|
197
|
+
write("Local installation and running versions are up to date. Background services were not changed.");
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
write("Running versions need verification. Repair will restart the paired services.");
|
|
194
201
|
}
|
|
195
202
|
write(
|
|
196
203
|
applied?.status === "pending"
|
|
@@ -257,10 +264,12 @@ export async function applyLocalUpdate({
|
|
|
257
264
|
runtime(dataDir),
|
|
258
265
|
]);
|
|
259
266
|
if (typeof w.locked === "boolean" && r.role === "user-runtime") {
|
|
267
|
+
requireRunningSoftware(w, r, { ...pair, protocolVersion: pair.typesDependency });
|
|
260
268
|
ready = true;
|
|
261
269
|
break;
|
|
262
270
|
}
|
|
263
|
-
} catch {
|
|
271
|
+
} catch (error) {
|
|
272
|
+
if (error.code === "RUNNING_VERSION_UNVERIFIED") throw error;
|
|
264
273
|
/* Startup can take a moment; final failure is reported below. */
|
|
265
274
|
}
|
|
266
275
|
await pause(500);
|
|
@@ -298,6 +307,7 @@ export async function applyLocalUpdate({
|
|
|
298
307
|
write(
|
|
299
308
|
"Service changes could not be confirmed. Check agentpay status and agentpay service logs runtime before retrying.",
|
|
300
309
|
);
|
|
310
|
+
if (error.code === "RUNNING_VERSION_UNVERIFIED") write(error.message);
|
|
301
311
|
const log = error.logPath || logPath;
|
|
302
312
|
if (log) write("Details: " + log);
|
|
303
313
|
write("After resolving the problem, run agentpay repair again.");
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MPL-2.0
|
|
2
2
|
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
3
3
|
// If a copy was not distributed with this file, see https://mozilla.org/MPL/2.0/.
|
|
4
|
-
//
|
|
4
|
+
// The configured origin/prefix owns the download location; metadata cannot change it.
|
|
5
|
+
function metadataLocation(value) {
|
|
6
|
+
const url = new URL(value);
|
|
7
|
+
const match = /^(|\/market)\/skills\/bundles\/([^/]+)(?:\/versions\/([a-f0-9]{64}))?\/metadata$/.exec(url.pathname);
|
|
8
|
+
if (url.username || url.password || url.search || url.hash || !match)
|
|
9
|
+
throw Error('MARKET_METADATA_PATH_MISMATCH');
|
|
10
|
+
return { url, prefix: match[1], service: match[2], digest: match[3] };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function marketVersionMetadataUrl(source, digest) {
|
|
14
|
+
const location = metadataLocation(source);
|
|
15
|
+
if (!/^[a-f0-9]{64}$/.test(digest) || location.digest && location.digest !== digest)
|
|
16
|
+
throw Error('MARKET_PACKAGE_VERSION_MISMATCH');
|
|
17
|
+
location.url.pathname = `${location.prefix}/skills/bundles/${location.service}/versions/${digest}/metadata`;
|
|
18
|
+
return location.url;
|
|
19
|
+
}
|
|
20
|
+
|
|
5
21
|
export function marketDownloadUrl(metadataUrl, serviceId) {
|
|
6
|
-
const url =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
url.username ||
|
|
10
|
-
url.password ||
|
|
11
|
-
url.search ||
|
|
12
|
-
url.hash ||
|
|
13
|
-
!url.pathname.endsWith(suffix)
|
|
14
|
-
)
|
|
15
|
-
throw Error("MARKET_METADATA_PATH_MISMATCH");
|
|
16
|
-
const prefix = url.pathname.slice(0, -suffix.length);
|
|
17
|
-
if (!["", "/market"].includes(prefix))
|
|
18
|
-
throw Error("MARKET_METADATA_PREFIX_INVALID");
|
|
19
|
-
url.pathname = prefix + suffix.replace(/\/metadata$/, "/download");
|
|
22
|
+
const {url, service} = metadataLocation(metadataUrl);
|
|
23
|
+
if (service !== encodeURIComponent(serviceId)) throw Error('MARKET_METADATA_PATH_MISMATCH');
|
|
24
|
+
url.pathname = url.pathname.replace(/\/metadata$/, '/download');
|
|
20
25
|
return url;
|
|
21
26
|
}
|
|
@@ -8,8 +8,8 @@ import { createHash } from "node:crypto";
|
|
|
8
8
|
// This belongs to the official onboarding test, never generic Runtime routing.
|
|
9
9
|
export const OFFICIAL_TEST_PACKAGE = Object.freeze({
|
|
10
10
|
name: "agentpay-random",
|
|
11
|
-
version: "1.2.
|
|
12
|
-
sha256: "
|
|
11
|
+
version: "1.2.1",
|
|
12
|
+
sha256: "20633b314c66166f94dc6e7d7eb5bce54ab5901fb1ed314a04ea3fd49ca8a9a4",
|
|
13
13
|
});
|
|
14
14
|
const mismatch = () =>
|
|
15
15
|
Object.assign(
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
verifyOfficialTestBytes,
|
|
11
11
|
verifyOfficialTestDigest,
|
|
12
12
|
} from "./official-test-package.mjs";
|
|
13
|
-
import { marketDownloadUrl } from "./market-download-url.mjs";
|
|
13
|
+
import { marketDownloadUrl, marketVersionMetadataUrl } from "./market-download-url.mjs";
|
|
14
14
|
|
|
15
15
|
async function localJson(path) {
|
|
16
16
|
let handle;
|
|
@@ -48,6 +48,8 @@ async function download(fetchImpl, address, max) {
|
|
|
48
48
|
redirect: "error",
|
|
49
49
|
signal: AbortSignal.timeout(10000),
|
|
50
50
|
});
|
|
51
|
+
if ([404, 410].includes(response.status))
|
|
52
|
+
throw Object.assign(Error("Official test version unavailable"), {code: "OFFICIAL_TEST_VERSION_UNAVAILABLE"});
|
|
51
53
|
if (!response.ok || !response.body) throw Error("Market request failed");
|
|
52
54
|
let length = 0;
|
|
53
55
|
const chunks = [];
|
|
@@ -99,13 +101,7 @@ export async function prepareOfficialTestUpdate({
|
|
|
99
101
|
);
|
|
100
102
|
return { status: "unconfigured" };
|
|
101
103
|
}
|
|
102
|
-
const metadataUrl = url(source);
|
|
103
|
-
if (
|
|
104
|
-
!/^\/(?:market\/)?skills\/bundles\/[^/]+\/metadata$/.test(
|
|
105
|
-
metadataUrl.pathname,
|
|
106
|
-
)
|
|
107
|
-
)
|
|
108
|
-
throw Error("Invalid package metadata path");
|
|
104
|
+
const metadataUrl = marketVersionMetadataUrl(url(source), OFFICIAL_TEST_PACKAGE.sha256);
|
|
109
105
|
const body = JSON.parse(
|
|
110
106
|
(await download(fetchImpl, metadataUrl, 65536)).toString("utf8"),
|
|
111
107
|
);
|
|
@@ -150,6 +146,8 @@ export async function prepareOfficialTestUpdate({
|
|
|
150
146
|
write(
|
|
151
147
|
"Not updated: the published ZIP does not match this User release. Check for a reviewed User update; do not bypass the file check.",
|
|
152
148
|
);
|
|
149
|
+
else if (error.code === "OFFICIAL_TEST_VERSION_UNAVAILABLE")
|
|
150
|
+
write("This official test version is unavailable in Market. Check for a reviewed User update or contact support; no replacement package was selected.");
|
|
153
151
|
else
|
|
154
152
|
write(
|
|
155
153
|
"Could not prepare the official test Skill. Check your Market connection and retry agentpay repair.",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
|
|
6
|
+
// Resolve from each consumer independently: npm may install a nested Protocol copy.
|
|
7
|
+
// The public schema export works even when package.json is not publicly exported.
|
|
8
|
+
export function installedProtocol(consumerManifest) {
|
|
9
|
+
const require = createRequire(consumerManifest);
|
|
10
|
+
let directory = dirname(require.resolve('@c4roa0/agentpay-protocol/schema'));
|
|
11
|
+
for (;;) {
|
|
12
|
+
try {
|
|
13
|
+
const pkg = JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8'));
|
|
14
|
+
if (pkg.name !== '@c4roa0/agentpay-protocol' || !/^\d+\.\d+\.\d+$/.test(pkg.version)) {
|
|
15
|
+
throw Error('Installed Protocol package identity is invalid.');
|
|
16
|
+
}
|
|
17
|
+
return pkg.version;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error.code !== 'ENOENT') throw error;
|
|
20
|
+
}
|
|
21
|
+
const parent = dirname(directory);
|
|
22
|
+
if (parent === directory) throw Error('Installed Protocol package metadata is missing.');
|
|
23
|
+
directory = parent;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
import { installedProtocol } from './protocol-package.mjs';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
5
|
+
|
|
6
|
+
// Capture once: installed files may be replaced while this process still runs.
|
|
7
|
+
// This local compatibility report is not attestation or payment authority.
|
|
8
|
+
const manifest = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
9
|
+
export const runtimeSoftware = Object.freeze({
|
|
10
|
+
name: '@c4roa0/agentpay-user',
|
|
11
|
+
version: manifest.version,
|
|
12
|
+
interfaceVersion: 1,
|
|
13
|
+
protocolVersion: installedProtocol(fileURLToPath(new URL('../package.json', import.meta.url))),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export function assessRunningSoftware(wallet, runtime, expected = {
|
|
17
|
+
userVersion: manifest.version,
|
|
18
|
+
walletVersion: manifest.dependencies['@c4roa0/agentpay-wallet'],
|
|
19
|
+
protocolVersion: manifest.dependencies['@c4roa0/agentpay-protocol'],
|
|
20
|
+
}) {
|
|
21
|
+
const components = [
|
|
22
|
+
['Wallet', wallet?.software, '@c4roa0/agentpay-wallet', expected.walletVersion],
|
|
23
|
+
['Runtime', runtime?.software, '@c4roa0/agentpay-user', expected.userVersion],
|
|
24
|
+
];
|
|
25
|
+
return components.map(([label, reported, name, version]) => {
|
|
26
|
+
if (!reported) return { label, state: 'unreported', expected: version };
|
|
27
|
+
const matches = reported.name === name && reported.version === version &&
|
|
28
|
+
reported.interfaceVersion === 1 && reported.protocolVersion === expected.protocolVersion;
|
|
29
|
+
return {
|
|
30
|
+
label, state: matches ? 'matched' : 'mismatch', expected: version,
|
|
31
|
+
running: typeof reported.version === 'string' && /^\d+\.\d+\.\d+$/.test(reported.version)
|
|
32
|
+
? reported.version : 'unknown',
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function requireRunningSoftware(wallet, runtime, expected) {
|
|
38
|
+
const checks = assessRunningSoftware(wallet, runtime, expected);
|
|
39
|
+
const bad = checks.find(check => check.state !== 'matched');
|
|
40
|
+
if (bad) {
|
|
41
|
+
const reason = bad.state === 'unreported' ? 'does not report its running version' :
|
|
42
|
+
`does not match the installed package/interface (${bad.expected})`;
|
|
43
|
+
throw Object.assign(Error(`${bad.label} ${reason}. Update the paired packages and run agentpay repair.`), {
|
|
44
|
+
code: 'RUNNING_VERSION_UNVERIFIED',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return checks;
|
|
48
|
+
}
|
package/src/status-panel.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assessRunningSoftware } from "./software-versions.mjs";
|
|
1
2
|
import { walletCliPath } from "./wallet-package.mjs";
|
|
2
3
|
// SPDX-License-Identifier: MPL-2.0
|
|
3
4
|
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
@@ -172,6 +173,7 @@ export async function collectLocalStatus() {
|
|
|
172
173
|
const value = (i) =>
|
|
173
174
|
results[i].status === "fulfilled" ? results[i].value : null;
|
|
174
175
|
return {
|
|
176
|
+
software: assessRunningSoftware(value(0), value(3)),
|
|
175
177
|
deployment: value(6) || { state: "unknown" },
|
|
176
178
|
market: value(5) || { state: "unknown" },
|
|
177
179
|
authorization: value(4),
|
|
@@ -325,6 +327,13 @@ export function renderStatusPanel(
|
|
|
325
327
|
detail =
|
|
326
328
|
"Runtime is running. Order checks will continue when Wallet is available.";
|
|
327
329
|
next = stopped(ws) ? "agentpay service start" : "agentpay service logs wallet";
|
|
330
|
+
} else if (model.software?.some(x => x.state !== "matched")) {
|
|
331
|
+
title = "Running software needs checking";
|
|
332
|
+
level = "wait";
|
|
333
|
+
detail = "Installed files and running processes have not been verified as a matching pair. Your original Orders are kept.";
|
|
334
|
+
next = model.software.some(x => x.state === "unreported")
|
|
335
|
+
? "agentpay update (source checkout: update the paired packages, then agentpay repair)"
|
|
336
|
+
: "agentpay repair";
|
|
328
337
|
} else if (w.policyRenewalPending) {
|
|
329
338
|
title = "Spending permission renewal incomplete";
|
|
330
339
|
level = "wait";
|
|
@@ -422,6 +431,11 @@ export function renderStatusPanel(
|
|
|
422
431
|
"",
|
|
423
432
|
];
|
|
424
433
|
if (!model.configurationError) {
|
|
434
|
+
if (model.software) {
|
|
435
|
+
lines.push("> Software");
|
|
436
|
+
for (const item of model.software) lines.push(` ${badge(item.state === "matched" ? "ok" : "wait", 6)} ${item.label.padEnd(8)} ${item.state === "matched" ? item.running : item.state === "unreported" ? "Running version not reported" : item.running === item.expected ? "Package interface mismatch" : `Running ${item.running} · installed ${item.expected}`}`);
|
|
437
|
+
lines.push("");
|
|
438
|
+
}
|
|
425
439
|
lines.push("> Services");
|
|
426
440
|
const row = (label, text, state) =>
|
|
427
441
|
lines.push(` ${badge(state, 6)} ${label.padEnd(8)} ${text}`);
|
package/src/wallet-package.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MPL-2.0
|
|
2
2
|
// Resolve public Wallet entries from this User installation, never a sibling checkout.
|
|
3
|
+
import { installedProtocol } from './protocol-package.mjs';
|
|
3
4
|
import { createRequire } from 'node:module';
|
|
4
5
|
import { readFileSync } from 'node:fs';
|
|
5
6
|
import { dirname, join } from 'node:path';
|
|
@@ -17,6 +18,11 @@ export function walletPackage(userDir = userPackageDirectory) {
|
|
|
17
18
|
manifest.dependencies?.['@c4roa0/agentpay-protocol'] !== user.dependencies?.['@c4roa0/agentpay-protocol']) {
|
|
18
19
|
throw Error('Installed Wallet does not match this User version. Reinstall the reviewed User version, then run agentpay repair. Your private data is unchanged.');
|
|
19
20
|
}
|
|
21
|
+
const expectedProtocol = user.dependencies['@c4roa0/agentpay-protocol'];
|
|
22
|
+
if (installedProtocol(join(userDir, 'package.json')) !== expectedProtocol ||
|
|
23
|
+
installedProtocol(manifestPath) !== expectedProtocol) {
|
|
24
|
+
throw Error('Installed Protocol does not match the reviewed User/Wallet pair. Reinstall this User version and its dependencies; private data is unchanged.');
|
|
25
|
+
}
|
|
20
26
|
return { directory: dirname(manifestPath), manifest, cli: require.resolve('@c4roa0/agentpay-wallet/cli') };
|
|
21
27
|
}
|
|
22
28
|
export function walletCliPath(userDir) { return walletPackage(userDir).cli; }
|
package/update-pair.json
CHANGED