@c4roa0/agentpay-user 0.3.0 → 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.
- package/README.md +18 -17
- package/doc/TODO.md +11 -1
- 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/package.json +2 -2
- package/progress.md +39 -7
- package/src/index.mjs +3 -1
- package/src/local-update.mjs +17 -7
- 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/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@0.3.
|
|
18
|
+
npm install --global @c4roa0/agentpay-user@0.3.1
|
|
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,15 @@
|
|
|
1
1
|
# User TODO
|
|
2
2
|
|
|
3
|
+
## Running-version release loop — 2026-11-07
|
|
4
|
+
|
|
5
|
+
- [x] Verify User 0.3.0 public-registry publication; Trusted Publisher configured.
|
|
6
|
+
- [x] Verify actual installed Protocol versions from both consumer resolution paths.
|
|
7
|
+
- [x] Add process-start software reporting and status/repair mismatch handling; isolated checks passed.
|
|
8
|
+
- [x] Wallet 0.3.1 published through the configured workflow; public npm version/dependencies verified.
|
|
9
|
+
- [x] Pin User 0.3.1 to published Wallet 0.3.1; pairing metadata/lockfile and standalone archive verification complete.
|
|
10
|
+
- [ ] Publish matching User release; validate User OIDC and real published-version update/restart.
|
|
11
|
+
|
|
12
|
+
|
|
3
13
|
## npm update follow-up — 2026-11-07
|
|
4
14
|
|
|
5
15
|
- [x] Implement confirmed `agentpay update [-f]`, exact User target and matching Wallet; invoke new repair and pinned official Skill check.
|
|
@@ -19,7 +29,7 @@
|
|
|
19
29
|
- [ ] Step 5: publish Wallet then User via OIDC; verify registry installs and update Market guides.
|
|
20
30
|
- [x] Wallet 0.3.0 first Token publication; registry integrity/latest and fresh public install/CLI/IPC verified.
|
|
21
31
|
- [x] Owner configured Wallet npm Trusted Publisher (pending validation).
|
|
22
|
-
- [ ] Validate Wallet OIDC with
|
|
32
|
+
- [ ] Validate Wallet and User OIDC with later reviewed releases. Both 0.3.0 packages are published; Market guide updates remain pending.
|
|
23
33
|
- [ ] Step 6: participant setup/upgrade/restart/uninstall and official Anvil paid acceptance.
|
|
24
34
|
|
|
25
35
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c4roa0/agentpay-user",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"ethers": "^6.17.0",
|
|
7
7
|
"fs-native-extensions": "1.5.3",
|
|
8
8
|
"@c4roa0/agentpay-protocol": "0.14.3",
|
|
9
|
-
"@c4roa0/agentpay-wallet": "0.3.
|
|
9
|
+
"@c4roa0/agentpay-wallet": "0.3.1"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"start": "node src/index.mjs",
|
package/progress.md
CHANGED
|
@@ -1,12 +1,44 @@
|
|
|
1
1
|
# AgentPay User progress
|
|
2
2
|
|
|
3
|
-
## User 0.3.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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.
|
|
10
42
|
|
|
11
43
|
|
|
12
44
|
## npm update and migration review fixes — 2026-11-07
|
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.");
|
|
@@ -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