@c4roa0/agentpay-user 0.3.7 → 0.3.9

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 (46) hide show
  1. package/README.md +3 -1
  2. package/doc/README.md +10 -0
  3. package/doc/TODO.md +43 -3
  4. package/doc/plans/local-instances-and-install-recovery.md +250 -0
  5. package/doc/records/client-isolated-acceptance-2026-11-11.md +37 -0
  6. package/doc/records/dual-install-systemd-2026-11-12.md +40 -0
  7. package/doc/records/historical-request-routing-2026-11-11.md +47 -0
  8. package/doc/records/installation-maintenance-2026-11-11.md +46 -0
  9. package/doc/reference/local-update.md +2 -1
  10. package/doc/runbooks/commands.md +28 -0
  11. package/doc/runbooks/local-update.md +11 -5
  12. package/doc/usage.md +8 -0
  13. package/package.json +1 -1
  14. package/progress.md +114 -6
  15. package/scripts/autostart.mjs +51 -25
  16. package/scripts/install-user.mjs +10 -3
  17. package/scripts/local-service.mjs +1 -1
  18. package/scripts/user-setup.mjs +4 -0
  19. package/src/default-request-owner.mjs +163 -0
  20. package/src/index.mjs +9 -0
  21. package/src/install-and-setup.mjs +6 -1
  22. package/src/install-selection.mjs +41 -0
  23. package/src/install-user.mjs +22 -22
  24. package/src/installation-binding.mjs +62 -0
  25. package/src/installation-operation.mjs +114 -0
  26. package/src/installation-paths.mjs +50 -1
  27. package/src/invocation-store.mjs +1 -1
  28. package/src/local-data-directory.mjs +17 -17
  29. package/src/local-update.mjs +41 -10
  30. package/src/local-wallet-ipc.mjs +2 -2
  31. package/src/npm-update.mjs +66 -23
  32. package/src/official-test-update.mjs +13 -0
  33. package/src/platform-endpoints.mjs +5 -8
  34. package/src/runtime-client.mjs +21 -4
  35. package/src/runtime-connection-settings.mjs +2 -1
  36. package/src/runtime-owner.mjs +22 -0
  37. package/src/runtime-selection-ready.mjs +29 -0
  38. package/src/service-readiness.mjs +29 -0
  39. package/src/service-selection.mjs +189 -0
  40. package/src/setup-autostart.mjs +12 -2
  41. package/src/setup-service-selection.mjs +25 -0
  42. package/src/skill-bundle.mjs +38 -0
  43. package/src/skill-client.mjs +8 -3
  44. package/src/uninstall-local.mjs +69 -15
  45. package/src/user-cli.mjs +1 -2
  46. package/update-pair.json +1 -1
package/README.md CHANGED
@@ -31,7 +31,9 @@ private key into AgentPay. See [installation and first use](doc/runbooks/user-on
31
31
  Program files and private state are separate. Keys, Policies, Orders and cache
32
32
  normally live in `~/.local/share/agentpay/user`; an existing custom data directory
33
33
  is retained. Installation checkpoints use `~/.local/state/agentpay/user` (or
34
- `$XDG_STATE_HOME/agentpay/user`). Upgrading program files does not erase either.
34
+ `$XDG_STATE_HOME/agentpay/user` on first setup). AgentPay remembers that location
35
+ so terminal and background services use the same records. Upgrading program files
36
+ does not erase either.
35
37
 
36
38
  ## Install in a folder instead
37
39
 
package/doc/README.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # User documentation
2
2
 
3
+ - [Real two-installation switching](records/dual-install-systemd-2026-11-12.md): live systemd cancellation, switching, restoration and evidence limits.
4
+
5
+ - [Historical request routing](records/historical-request-routing-2026-11-11.md): switch-time indexing, missing records and conservative recovery limits.
6
+
7
+ - [Local instances and installation recovery](plans/local-instances-and-install-recovery.md): agreed design and implementation sequence.
8
+
9
+ - [Installation maintenance verification](records/installation-maintenance-2026-11-11.md): inactive maintenance and interrupted-writer recovery, with evidence limits.
10
+
11
+ - [Isolated client acceptance](records/client-isolated-acceptance-2026-11-11.md): installation, failure retry, uninstall and the interruption blocker.
12
+
3
13
  - [Existing-installation update acceptance](records/npm-update-participant-2026-11-11.md): participant update to User 0.3.6 / Wallet 0.3.3 and retained records.
4
14
 
5
15
  - [Directory npm update verification](records/local-npm-update-2026-11-08.md): real package update and preflight boundary.
package/doc/TODO.md CHANGED
@@ -1,15 +1,47 @@
1
1
  # User TODO
2
2
 
3
+ - [x] Verify local official Skill files before downloading and stream update repair progress (2026-11-12; targeted checks).
4
+ - [ ] Publish and verify the local official-Skill check optimization in the next User patch.
5
+
6
+ - [x] Publish User 0.3.8 with matching v0.3.8 tag; full CI, standalone package and public registry integrity passed (2026-11-12).
7
+
8
+ - [x] Recover failed service start/stop without blocking repair; incomplete target unit replacement remains protected (2026-11-12, controlled service-manager verification).
9
+
10
+ - [x] Fix shared-data switch client relocation and retry without a repair deadlock; isolated selection/connection checks pass (2026-11-11).
11
+ - [x] Preserve availability for preference-only operations and require authenticated matching-service readiness before publishing the default; failed readiness permits retry/repair (controlled transport/service verification, 2026-11-11).
12
+ - [x] Stage downloaded settings until switch consent under the shared lock; cancellation preserves prior deployment and avoids binding the new installation.
13
+ - [x] Persist one state-directory locator for CLI, background processes and candidate Skill loaders; cross-environment and concurrent-first-use process tests passed.
14
+
15
+ - [x] Coordinate uninstall with service switching; preserve another installation’s managed pair, recheck confirmed scope and retry partial unit removal (19 targeted checks; systemctl simulated).
16
+ - [x] Implement inactive update/repair and inherited writer exclusion, plus interrupted-update continuation; isolated process/controlled service checks passed.
17
+ - [x] Real A/B/A user-systemd switching, cancellation and same-install start verified (2026-11-12); A restored locked with unchanged key/Policy.
18
+ - [ ] Complete remaining login/reboot and full guided-install acceptance; uninstall still refuses occupied ports of unconfirmed ownership.
19
+
20
+ - [x] Inventory local instance consumers and document the concrete interface/change map (2026-11-11; design only).
21
+ - [x] Align design to multiple installations with one active Runtime/Wallet per OS user; remove mandatory harness launcher (2026-11-11).
22
+ - [x] Persist canonical per-installation data binding and preserve it across shared checkpoint writes; focused regression checks passed (2026-11-11).
23
+ - [x] Implement and check storage-choice module (reuse/new/cancel); public installer selection now connects through a service-switch gate (2026-11-11).
24
+ - [x] Connect installer selection and service-start switching with confirmation, stopped-state/listener checks and Runtime lifetime exclusion; focused checks passed (2026-11-11; systemd results simulated).
25
+ - [x] Correct shared-directory purge, mixed-unit retry, manual setup regression, first-start preparation and startup-preference inheritance; 37 targeted checks pass (2026-11-11).
26
+ - [ ] Complete remaining switch-crash recovery and desktop login acceptance; real A/B/A systemd switching passed; preserve historical request scope across switches. Inactive maintenance isolation is implemented with scoped verification.
27
+
28
+
29
+
30
+ - [x] Isolated public npm fresh install, registry failure/retry and disposable-data uninstall (2026-11-11; no real systemd or financial acceptance).
31
+ - [x] Replace existence-only locking for new operations: inherited native lock survives caller death while writers live, then permits retry. Old unknown locks require review; they are not automatically removed.
32
+ - [x] Publish reviewed folder-local npm uninstall completion guidance in User 0.3.8.
33
+
34
+
3
35
  - [x] Participant directory-local update to User 0.3.6 / Wallet 0.3.3: running versions, original Orders in CLI/Market and available result cache verified (2026-11-11).
4
- - [ ] Fresh-install and interrupted-update acceptance remain separate; discuss scope before execution.
36
+ - [ ] Complete configured multi-instance installation and interrupted-update recovery acceptance after the scoped implementation; isolated fresh npm installation already passed, systemd and recovery gaps remain.
5
37
 
6
38
 
7
39
  - [x] Clarify full Cache IDs and missing details argument; support bounded, unique read-only short-ID lookup (2026-11-11).
8
- - [ ] Publish cache-details guidance with the next reviewed User release.
40
+ - [x] Publish cache-details guidance in User 0.3.7; tag/registry integrity verified (2026-11-11).
9
41
 
10
42
 
11
43
  - [x] Clarify npm update preview with actual installed Wallet versus target, unchanged and unknown states (2026-11-11).
12
- - [ ] Include update-preview wording in the next reviewed User release; no new release was made for this edit.
44
+ - [x] Publish update-preview wording in User 0.3.7 (2026-11-11).
13
45
 
14
46
 
15
47
  - [x] Preserve maintenance error guidance and original request identity; controlled HTTP/IPC verification (2026-11-10).
@@ -168,3 +200,11 @@ investigations remain private operator work, not a public contributor prerequisi
168
200
 
169
201
  Original chronological TODO snapshots are preserved in the private workspace.
170
202
  Consolidation does not turn historical partial evidence into completed acceptance.
203
+
204
+ - [x] Update candidate Agent template/default loader; selected storage is pinned for each invocation, unavailable selection has no fallback.
205
+ - [ ] Review/build/deploy candidate Agent template 0.1.2 and official bundle 1.2.2, then update the reviewed User official digest; no publication authorized by source changes.
206
+
207
+ - [x] Protect new default request ownership across data folders; restore selected connection on Runtime bind; persist startup changes and allow Node-path-independent recovery (2026-11-11, scoped tests).
208
+ - [x] Index historical client request identities during confirmed switching; reject missing selection/checkpoints and conflicting owners, preserve startup with an unclassified-history barrier (controlled verification).
209
+ - [ ] Accept historical request routing in the complete two-install public-entry/systemd rehearsal before rollout.
210
+ - [ ] Finish actual login/switch and full public-entry interruption acceptance; isolated inactive maintenance/concurrency verification is complete.
@@ -0,0 +1,250 @@
1
+ # Multiple installations, one active Runtime
2
+
3
+ Status: approved direction, 2026-11-11; partial implementation under verification. This replaces
4
+ concurrent-instance routing and the proposed harness launcher. No live installation
5
+ has been migrated.
6
+
7
+ ## User experience
8
+
9
+ A user can keep a development installation and an everyday installation on the same
10
+ computer, each with separate dependencies and data. Under one OS user, only one
11
+ managed Runtime/Wallet pair runs at a time. Skills use that pair as the default exit.
12
+ The user does not select an instance in every Skill or change the harness launcher.
13
+
14
+ - On installation, existing configuration offers **Use existing / Create separate /
15
+ Cancel**. Creating a separate installation does not activate it automatically.
16
+ - Starting the already active installation is idempotent.
17
+ - Starting a different installation shows the current and target names/data folders
18
+ and asks whether to switch. A noninteractive call cannot silently approve this.
19
+ - Switching stops the original pair, verifies it has stopped, then starts the target.
20
+ Wallet starts locked. It never copies keys, renews Policies or merges Order history.
21
+ - If the original pair cannot be stopped, switching stops there. If the target fails
22
+ to start, show the failure and recovery command; do not silently start another pair.
23
+ - Stopping the active pair leaves the default unavailable until the user starts it
24
+ or explicitly switches. There is no fallback to another Wallet.
25
+
26
+ Keep existing default data in place. Reusing it from another program installation
27
+ requires explicit ownership transfer and stopping the previous writer. A new data
28
+ folder gets a stable local reference and a readable label. Neither is a Market
29
+ Wallet identity, Policy or device identity. Renaming does not change authorization.
30
+
31
+ ## Default Skill connection
32
+
33
+ Shared User client code resolves the single active installation and its connection.
34
+ Skill business code supplies service selection, input/output validation and optional
35
+ file handling. It does not search Wallet directories or choose an installation.
36
+ Internal connection files remain an implementation detail of the shared client.
37
+
38
+ Do not introduce mandatory `agentpay exec` or per-harness environment selection.
39
+ A new `agentpay skill run` command is not required by this design. Preserve the
40
+ existing Skill-facing calling convention where practical and keep a stable shared
41
+ client entry. Runtime upgrades must not require publishing every installed Skill.
42
+
43
+ The current template reads clientModule from connection.json before importing the
44
+ shared client. Implementation must address that bootstrap as well as Runtime URL
45
+ lookup. Inventory source, folder-local npm and global npm resolution before choosing
46
+ the minimal bootstrap change. If template bytes must change, publish a versioned
47
+ migration once; do not silently rewrite immutable packages or claim old downloaded
48
+ Skills already follow the new default. No background package download is allowed
49
+ as a side effect of invoking a Skill.
50
+
51
+ Resolve the active connection once per invocation. A switch while a call is in flight
52
+ must fail or preserve its original request, never retry against the newly active
53
+ Wallet. Saved recovery records retain their originating storage/authorization scope.
54
+ A missing original record must not become a fresh purchase in the other installation.
55
+ Provide a prompt to return to the original installation when that scope is known.
56
+ Port, program path and local label do not enter payment or request identity.
57
+
58
+ This is logical routing under one OS account, not protection against hostile code
59
+ running as that same account. An unavailable default must produce a useful error;
60
+ merely finding an HTTP listener is not proof it is the selected Runtime.
61
+
62
+ ## Installation and active state
63
+
64
+ For the first version, one program installation binds one data instance. Development
65
+ source and everyday folder-local npm installations have independent dependency trees.
66
+ A global npm installation is one installation, not multiple global versions.
67
+
68
+ Maintain private local records of canonical installation roots and bound data folders,
69
+ plus one active selection. Do not store keys in this catalog. Resolve ownership and
70
+ path aliases before claiming storage; two aliases cannot claim the same data twice.
71
+ Read-only commands must not perform adoption or change the active selection.
72
+
73
+ CLI lifecycle/update/uninstall commands operate on their installation's bound data,
74
+ and display when a different installation is active. Skill invocation alone uses the
75
+ default active connection. This distinction prevents a repair in an inactive source
76
+ checkout from taking over the everyday installation.
77
+
78
+ Resolve command context once and pass it to children. Legacy data-directory overrides
79
+ must agree with the bound context or enter explicit adoption; they cannot silently
80
+ retarget services or delete another instance.
81
+
82
+ ## Lifecycle, switching and startup
83
+
84
+ Keep one managed systemd user service pair and one login reminder, targeting the
85
+ active installation. Reuse existing fixed unit names where their ownership can be
86
+ verified; parallel instance-specific units are no longer required. Login startup
87
+ starts only the selected pair. Preserve the existing login-start preference when
88
+ switching, and show it in the switch summary.
89
+
90
+ Serialize switch/start/stop/repair and active endpoint publication. Check real process
91
+ ownership, not only service-manager state: a manually started old process must also
92
+ prevent starting another managed pair. A Runtime lifetime ownership guard must reject
93
+ competing starts from supported product entry points. Arbitrary external programs
94
+ are outside this guarantee; never kill an unrelated process to reclaim a port.
95
+
96
+ During switching the default is unavailable. Publish the new active connection only
97
+ after startup and authentication/readiness verification. Journal switch phases so an
98
+ interruption can report or resume an incomplete transition without running both pairs.
99
+ Do not automatically unlock the new Wallet. Endpoint port conflicts fail explicitly;
100
+ a prior free-port probe is not a reservation. Bind and caller authentication remain
101
+ mandatory. The default is a logical selection, not a promise of a fixed TCP port.
102
+
103
+ Uninstalling or updating an inactive installation must not stop, restart or rewrite
104
+ the active service pair. Updating the active installation may briefly stop it and
105
+ then repair/restart that same pair. Uninstalling it leaves no active default; it does
106
+ not activate a replacement. Confirm local data deletion separately as today, and
107
+ never revoke on-chain authorization as an uninstall side effect.
108
+
109
+ ## Interrupted installation recovery
110
+
111
+ The reproduced failure is recorded in
112
+ [isolated acceptance](../records/client-isolated-acceptance-2026-11-11.md): killing
113
+ all updater writers leaves an empty install.lock and permanently blocks retry.
114
+
115
+ The first implementation serializes maintenance under one shared OS-user operation
116
+ lock. This is deliberately conservative: inactive installations keep running services
117
+ unchanged, but two administration commands do not write concurrently. Finer-grained
118
+ parallel updates are deferred; there is no installation/lifecycle lock ordering cycle.
119
+ Runtime lifetime and request/cache locks remain separate from maintenance.
120
+
121
+ The existing native lock primitive uses open-file-description locks on Linux. npm
122
+ and short-lived administration children inherit the descriptor; a killed caller does
123
+ not free it while the writer lives. Real child-process checks verify this behavior.
124
+ Daemon processes do not inherit it. No PID/age/procfs stale-lock rule is used.
125
+ Recognizable v2 markers can be recovered only after acquiring the OS lock. Unknown
126
+ legacy markers remain blocked for review. npm installation hooks are disabled so
127
+ package scripts cannot leave untracked descendant writers. macOS service acceptance
128
+ remains deferred; raw external npm commands are outside AgentPay's coordination.
129
+
130
+ Persist non-secret checkpoints: selected installation/data, target versions, phase,
131
+ and prior active/service state. Re-entry validates installed dependencies before
132
+ resuming repair. It must not activate a previously inactive installation, resume a
133
+ payment, change Policy, or invent a replacement request. Failure messages distinguish
134
+ active writers, safely recoverable interruption and uncertain ownership.
135
+
136
+ ## Change map
137
+
138
+ | Component | Required change |
139
+ | --- | --- |
140
+ | User installation-paths / local-data-directory | Per-install binding and state, single active selection, explicit adoption |
141
+ | User CLI and command scripts | Resolve context once; show bound/active distinction; confirm switching through service start |
142
+ | User install / npm-update / local-update / uninstall | Scoped exclusion/checkpoints; inactive operations preserve the active services |
143
+ | User autostart / local-service / status / endpoint migration | One managed pair, lifetime ownership, serialized switching, correct status/log targets |
144
+ | User runtime-client / runtime-connection-settings / skill-client | Stable shared bootstrap and default resolution; invocation never reroutes mid-request |
145
+ | Wallet | Verify separate data/socket state and clean stop/start; keep signing and Policy rules unchanged |
146
+ | Agent template / official Skill | Assess minimal shared-bootstrap migration; retain business-only glue and version immutable changes |
147
+ | Market / Settlement / Protocol | No new API or domain model required; existing template and fixed-package distribution remain |
148
+
149
+ Update User README, usage, command guide and installation/recovery docs with the
150
+ actual supported selection behavior. Agent examples must match the shared client.
151
+ Review any official Skill package change before updating User's built-in digest.
152
+
153
+ ## Delivery order and acceptance
154
+
155
+ 1. **Binding and storage:** install two program trees through public entry points;
156
+ reuse/adoption preserves existing identity; separate installation does not copy
157
+ keys or take over the active pair.
158
+ 2. **Single active lifecycle and recovery:** switch both ways; cancellation, failed
159
+ stop/start, concurrent starts and interrupted switch never leave two active pairs.
160
+ Login preference is preserved. Inactive update/uninstall leaves the active pair
161
+ usable. Real SIGKILL tests cover both all writers ended and surviving npm children.
162
+ 3. **Default Skill entry:** same maintained Skill entry reaches the active pair after
163
+ deliberate switching without editing harness configuration. Exercise two controlled
164
+ business payloads. An interrupted old request cannot become a payment by the new
165
+ Wallet. Verify missing default and port collision errors with no fallback.
166
+ 4. **Package and participant checks:** source, folder-local and global npm paths;
167
+ template migration if needed; keys, Policies, original requests and cache preserved.
168
+ Prepare the user rehearsal only after these checks, with explicit release approval.
169
+
170
+ Use maintained fixtures, not third-party Skills or unapproved paid tests. Isolated
171
+ checks do not prove financial acceptance. macOS service integration remains deferred
172
+ until a test machine is available. This design update does not authorize package
173
+ publication, live migration, chain writes or new payments.
174
+
175
+ ### Uninstall implementation checkpoint
176
+
177
+ Removal and service switching use the same lifecycle lock. The confirmation preview
178
+ is revalidated inside the lock; changed targets require another confirmation. Valid
179
+ foreign managed units are left intact, and shared active data cannot be purged.
180
+ A partial unit deletion can be retried. The default selection remains stopped after
181
+ removal, so Skills cannot silently select another Wallet. Unknown occupied ports
182
+ remain a conservative refusal. Installer/update and child-writer exclusion are now integrated. Actual systemd and
183
+ full participant interruption acceptance remain open.
184
+
185
+ ### Historical request implementation checkpoint
186
+
187
+ Confirmed switching imports known client selection/checkpoint scopes and request IDs
188
+ from both involved folders without rewriting history. Runtime-only or unreadable
189
+ history cannot establish the original Skill input; retain a conservative unclassified
190
+ owner barrier. Do not fail Runtime startup solely because old requests need review.
191
+ A different default installation must not automatically invoke a replacement when
192
+ this barrier applies. Explicit `--force` still means a deliberate new purchase.
193
+
194
+ Missing selection/checkpoint files stop automatic recovery; conflicts require the
195
+ original installation and saved `--resume` identifier. New ownership selection and
196
+ local checkpoint creation share the short maintenance lock; payment/network calls
197
+ remain outside it. [Verification and limits](../records/historical-request-routing-2026-11-11.md).
198
+
199
+ ## Readiness and startup preferences — 2026-11-11
200
+
201
+ A successful service-manager start request is not readiness. Before publishing the
202
+ default connection, check the selected data directory's authenticated Wallet status
203
+ and Runtime status, including the installed pair's reported versions. Wallet may be
204
+ locked and historical Order checks may still be running. Neither condition alone
205
+ prevents a running connection from being selected.
206
+
207
+ Preference changes and same-installation preparation preserve availability; they
208
+ do not revive stopped services. Removal closes the default. If unit installation
209
+ succeeds but readiness fails, keep the default closed and allow repair or another
210
+ start. Login startup performs the same checks while holding the selection lock,
211
+ and cannot publish another program/data selection or an unfinished switch.
212
+
213
+ These checks have isolated transport and service-control fixture coverage. Actual
214
+ systemd switch/login acceptance remains a separate gate.
215
+
216
+ ## Confirm before applying settings; keep one state location — 2026-11-11
217
+
218
+ The installer validates downloaded public settings in memory. While holding the
219
+ installation operation lock, it requests the normal setup activation/switch. Only
220
+ successful activation permits writing deployment settings and importing missing
221
+ legacy setup files. Cancellation does not bind the new installation or change the
222
+ old deployment. The activation child inherits the operation lock, so another
223
+ installation cannot switch services between consent and configuration application.
224
+ Dependency preparation may already have completed; cancelling does not roll back
225
+ installed program packages. A failed download never requests a service switch.
226
+
227
+ On first mutation/start, the chosen state directory is recorded in the private
228
+ `~/.local/state/agentpay/state-location.json`. This small file contains only the
229
+ state directory path; Wallet data and its identity stay in their own data folder.
230
+ Existing XDG state directories are retained in place. Subsequent CLI commands,
231
+ background processes and candidate Skill loaders follow this locator even if their
232
+ XDG environment differs. Read-only lookup does not create it. Initial concurrent
233
+ writers publish without overwriting another location; conflicting commands retry.
234
+ Changing XDG is not a state migration or a way to start a second Runtime.
235
+
236
+ The locator is retained when uninstalling an installation because other bindings
237
+ and original-request ownership may still use the shared catalog. Invalid/private-
238
+ permission failures stop lookup instead of silently choosing another directory.
239
+ This is local routing under one OS account, not isolation against hostile code
240
+ running as that user. Existing immutable Skill packages are not rewritten.
241
+
242
+ ## Service command failures — 2026-11-12
243
+
244
+ After verifying all generated target unit files, persist an unavailable default
245
+ before daemon reload or start/stop. A failed command must not be confused with
246
+ unfinished file replacement: stop can be retried, and startup failure permits
247
+ repair. An older preparing/stopping journal can use the same recovery only when
248
+ all exact target units exist and agree. Partial or conflicting files still require
249
+ completing the recorded switch. The unavailable journal phase does not assert
250
+ that the processes have stopped; status and stopped-listener checks remain required.
@@ -0,0 +1,37 @@
1
+ # Isolated client acceptance — 2026-11-11
2
+
3
+ Real public npm packages and public CLI processes were used in temporary homes,
4
+ installation/state/data directories. No real keys, services, Policies or Orders were
5
+ used. Retained sentinel bytes do not establish recovery of a funded transaction.
6
+
7
+ ## Passed
8
+
9
+ - Fresh User 0.3.7 install resolved Wallet 0.3.3 and Protocol 0.14.3 without sibling
10
+ repositories. CLI worked. Already-current update preserved fixture bytes.
11
+ - Unreachable registry stopped before replacing User 0.3.6. Restoring connectivity
12
+ and retrying the same command upgraded to 0.3.7 with fixture bytes intact.
13
+ - Real terminal uninstall: cancellation and default removal preserved data; explicit
14
+ delete confirmation removed only selected disposable data, retaining program files.
15
+ No systemd units existed in this isolated home; their removal was not tested.
16
+ - Completion lacked directory-local npm removal instructions. Added in source;
17
+ uninstall regression passed. Not yet published.
18
+
19
+ ## Blocking finding
20
+
21
+ A real updater process group was killed with SIGKILL after printing
22
+ “1/3 Check the update requirements.” Program replacement had not begun. All
23
+ updater/npm processes in that group ended; fixture bytes remained intact. Retrying
24
+ reported another installation may be running. Empty install.lock persisted and
25
+ blocked progress. The failed scene and logs are retained; no manual lock removal
26
+ was used to pass this check.
27
+
28
+ The exclusive-create lock is shared by install, update, location writes and
29
+ endpoint changes. Repair uses install; uninstall treats lock existence as busy.
30
+ Recovery must cover all consumers. Deleting a lock after a timeout is unsafe:
31
+ a child npm writer can outlive its parent. Old empty locks cannot prove no writer
32
+ exists. Proposed next loop: agree a shared operation-lock lifecycle that preserves
33
+ child-writer exclusion, crash recovery and explicit legacy uncertainty handling;
34
+ then validate through real process interruption and competing commands.
35
+
36
+ Fresh setup/authorization, real systemd uninstall, mid-package-replacement recovery
37
+ and funded-Order recovery are not established. No production state changed.
@@ -0,0 +1,40 @@
1
+ # Two-installation systemd switch — 2026-11-12
2
+
3
+ This rehearsal used actual Linux user systemd services and public User commands.
4
+ Installation A was the source checkout; B was a folder-local npm installation of
5
+ an archive built from the reviewed User commit `a8e3d88`. It carried candidate code
6
+ under the existing 0.3.7 manifest; it was not published to npm. Both used Wallet
7
+ 0.3.3 and Protocol 0.14.3. A's previous 0.3.2 dependency tree was retained for rollback
8
+ before an offline frozen dependency installation.
9
+
10
+ ## Observed behavior
11
+
12
+ - B had separate private storage and a newly initialized, unfunded Wallet with no
13
+ Policy. Its unlock secret was used only to initialize the encrypted key; B was
14
+ never unlocked. Settings and caller credentials were controlled prerequisites.
15
+ - Public `service start` switching required confirmation. Cancelling preserved A's
16
+ Runtime PID. Confirmation stopped A and started B on the same loopback port.
17
+ - B reported matching software versions, a locked Wallet, no Policy and no Orders.
18
+ Its authenticated Runtime status endpoint responded successfully.
19
+ - Starting the selected B again preserved its Runtime PID.
20
+ - Switching back restored A. Its encrypted Session Key and Policy file hashes
21
+ matched the pre-switch values. A's existing Orders and Market connection remained
22
+ visible; this was not a byte-for-byte audit of every historical/cache file.
23
+ - Both services were active at completion and login startup remained enabled.
24
+ Wallet stayed locked. No authorization, purchase, payment or chain write was
25
+ initiated by the test.
26
+
27
+ The first attempt successfully switched to B and restored A, but the harness treated
28
+ B's nonzero status exit (locked/unconfigured Wallet) as an execution failure. The
29
+ harness was corrected to accept that expected status while still requiring real
30
+ service readiness. The subsequent full run passed. No product change was needed
31
+ for that harness correction.
32
+
33
+ ## Evidence limits and retained state
34
+
35
+ This establishes live service switching and cancellation, not desktop login after
36
+ reboot, fresh guided installation/owner authorization, or funded recovery. Existing
37
+ unclassified request warnings remained visible; no third-party Skill or forced new
38
+ purchase was used to bypass them. The dedicated B installation/data and rollback
39
+ dependencies remain private, inactive test material for traceability. The active
40
+ selection is A. Logs/scripts are retained outside the public source tree.
@@ -0,0 +1,47 @@
1
+ # Historical request routing — 2026-11-11
2
+
3
+ Working-tree verification only; no participant history, authorization or payment
4
+ was changed.
5
+
6
+ ## Implemented behavior
7
+
8
+ A confirmed installation switch inventories the previous and selected data folders'
9
+ client request/selection stores and Runtime invocation history. It reads bounded,
10
+ private local files, retaining originals unchanged. The shared routing index stores
11
+ service/input hashes, original request IDs and data-folder ownership, not inputs,
12
+ results, keys or signed payment payloads. No Market or Settlement request is involved.
13
+
14
+ Default Skill calls claim ownership and select a local request under the same short
15
+ maintenance lock used by switching. Network/payment work occurs afterwards against
16
+ the already pinned connection. A matching old request reuses its original ID.
17
+ A request belonging to another installation prompts the caller to return there.
18
+ Conflicting owners require explicit `--resume` in the intended installation.
19
+
20
+ Missing selection or checkpoint files no longer silently create a replacement.
21
+ Known historical IDs constrain selection, and an ID retained in a pending record
22
+ must be resumed from its checkpoint rather than recreated. `--force` remains an
23
+ explicit new-purchase choice; migration does not override that later choice.
24
+
25
+ Runtime-only history cannot establish a Skill's original pre-upload/preparation
26
+ input. Unreadable or unlinked records therefore retain an unclassified-owner barrier.
27
+ They do not prevent Runtime startup or a confirmed switch. Automatic invocation in
28
+ another installation is blocked with review guidance; only deliberate `--force`
29
+ can authorize treating a call as new. Explicit original-request resume remains local.
30
+ This can conservatively block unrelated new inputs after switching from very old
31
+ history; it does not imply every such input previously incurred a payment.
32
+
33
+ ## Evidence and limits
34
+
35
+ Targeted runtime-client, default-runtime-lifecycle, service-selection and
36
+ invocation-store checks passed. The final run, including candidate Skill bootstrap
37
+ and reference-client regressions, passed all 37 checks. Tests exercise the shared Skill entry against
38
+ controlled local HTTP services, preserve IDs for two different JSON business
39
+ payloads, reject replacement before any invocation HTTP call, and cover missing
40
+ selection/checkpoint, conflicting installations, explicit force/retry and malformed
41
+ old history during a switch. Historical-only fixtures prepare missing/old metadata;
42
+ they are not claims of real payment recovery. Service management remains simulated.
43
+
44
+ Only known selected data folders are inventoried; unrelated disks or directories
45
+ are not searched. Older immutable Skill bootstraps do not automatically gain default
46
+ selection. Candidate template publication, complete two-install entry-point/systemd
47
+ acceptance and participant review remain release gates.
@@ -0,0 +1,46 @@
1
+ # Installation maintenance verification — 2026-11-11
2
+
3
+ This record covers working-tree changes; no release or participant service was changed.
4
+
5
+ ## Behavior checked
6
+
7
+ - Inactive npm update and repair preserve the selected service pair and private data.
8
+ Controlled npm metadata and systemctl responses isolate this orchestration check.
9
+ - Independent processes cannot enter maintenance while a writer holds the shared
10
+ lock. Killing the caller with SIGKILL leaves its real child writer protected.
11
+ After that child exits, another process succeeds without manual lock deletion.
12
+ - A short-lived administration child can inherit the lock; unrelated processes
13
+ remain excluded. Command timeout waits for child closure before returning.
14
+ - Interrupted update after npm success still resumes repair. Retry retains the
15
+ confirmed version; successful completion removes the recovery checkpoint.
16
+ - Uninstall preserves another installation's units, rejects shared active data,
17
+ rechecks confirmation, supports partial-unit retry and recognizes v2 recovery.
18
+ - Installation bindings, address updates and service selection use the same
19
+ maintenance boundary. Trailing path separators do not cause a false switch.
20
+
21
+ The final combined run passed 77 targeted checks. A subsequent marker-publication
22
+ interruption check also passed, along with the three existing process-lock checks.
23
+ Targeted suites cover installation-maintenance, npm-update, local-update,
24
+ local-data-directory, uninstall-local, service-selection and platform-endpoints.
25
+ Installation entry suites also cover install-user, install-and-setup,
26
+ install-selection, setup-service-selection and setup-autostart. Tests use private
27
+ throwaway directories; real process-lock evidence does not imply real systemd
28
+ or financial acceptance.
29
+
30
+ An independent offline `npm ci --ignore-scripts --no-audit --no-fund` installed the
31
+ pinned packages. Wallet 0.3.3, Protocol 0.14.3's public ESM entry and native locking
32
+ loaded successfully. The initial diagnostic incorrectly used require/package.json
33
+ against Protocol's ESM export map; the corrected ESM import succeeded. Worktree
34
+ installation tests initially found an older Wallet dependency; they passed in an
35
+ isolated copy using the correct dependencies. Existing worktree dependencies were
36
+ not changed to make tests pass.
37
+
38
+ ## Limits and next gates
39
+
40
+ The maintenance lock serializes administrative writes across installations. Runtime
41
+ service operation continues during inactive maintenance. Unknown legacy installer
42
+ locks remain blocked, not automatically deleted. Direct external npm/file changes
43
+ are outside this coordination. Uninstall still refuses an occupied port whose owner
44
+ cannot be confirmed. Historical Skill requests are not retroactively scoped by this
45
+ work. Complete two-install systemd switching/login, actual package-update interruption
46
+ and participant acceptance remain required before rollout.
@@ -8,7 +8,8 @@ refreshes managed service paths under the installer lock. Existing client connec
8
8
  URLs and caller credentials must match before a client-module path can be refreshed.
9
9
  A mismatch stops preparation rather than rewriting transaction identity.
10
10
 
11
- Installation checkpoints live in XDG state storage; old source-install checkpoints
11
+ Installation checkpoints use the saved per-user state location, initially chosen
12
+ from XDG state storage; old source-install checkpoints
12
13
  are read to preserve a custom data-directory selection. Deployment settings are
13
14
  copied into private User data only when no canonical file exists. Neither path
14
15
  changes keys, Policies, requests or recovery records.
@@ -102,3 +102,31 @@ Protocol reporting reads the installed package resolved by that process, rather
102
102
  copying its dependency declaration. User preflight checks both User's and Wallet's
103
103
  resolved copies against the reviewed exact version, including nested dependencies.
104
104
  Package version checks establish compatibility metadata, not file-integrity attestation.
105
+
106
+ ## Multiple installations (unreleased working tree)
107
+
108
+ Run `agentpay service start` from the installation you want to use. When another
109
+ installation owns the background services, the command shows both data folders and
110
+ asks for `confirm` before stopping the old pair. Cancellation keeps the old services.
111
+ Noninteractive commands cannot approve a switch. Wallet and Order data stay in their
112
+ own folders; unlock the selected Wallet after starting it.
113
+
114
+ Install now offers reuse, separate data or cancellation when it finds existing data.
115
+ The setup guide checks service ownership before continuing. A separate data folder
116
+ starts empty; it does not copy a Session Key or spending permission.
117
+
118
+ These changes are under development. Actual systemd switching and login behavior have
119
+ not yet been accepted; default Skill discovery and interrupted-switch recovery remain
120
+ open. Do not use these working-tree changes as a released multi-installation guide.
121
+
122
+ ### Original requests after switching installations
123
+
124
+ If a Skill says a request belongs to another installation, return to that installation
125
+ and inspect `agentpay orders list`. Use the Skill's `--resume REQUEST_ID` option with
126
+ its original request identifier. An Order ID and a Skill request ID are different.
127
+
128
+ Missing or conflicting history is kept for review; switching does not recreate a
129
+ purchase. Very old records may prevent automatic invocation in another installation
130
+ because the original input cannot be identified. `--force` is only for an intentional
131
+ new purchase, never a way to recover an old result. Read-only status, order inspection
132
+ and service startup remain available.
@@ -27,10 +27,13 @@ registry dependency, not a transitive dependency or a linked/custom-source packa
27
27
 
28
28
  It checks the published User version and shows its exact Wallet dependency. Confirm
29
29
  to continue, or cancel without changing services. `agentpay update -f` skips only
30
- this confirmation. The updater checks requirements in a temporary installation directory, stops configured services,
30
+ this confirmation. The updater checks requirements in a temporary installation directory, stops this installation’s selected services,
31
31
  installs the confirmed version and invokes the new version's repair to refresh
32
32
  services and verify its pinned official test Skill. No paid test runs automatically.
33
- Other installed Skills and original requests are kept. Wallet needs unlocking after
33
+ An inactive installation stays inactive: updating or repairing it does not stop the
34
+ selected Wallet/Runtime. Use `agentpay service start` from that installation when you
35
+ want to switch. Another command changing services or program files will ask you to
36
+ wait and retry. Other installed Skills and original requests are kept. Wallet needs unlocking after
34
37
  restart. A current User version still checks the official test Skill.
35
38
 
36
39
  Only genuine npm installations are updated. A source checkout or `npm link`
@@ -42,7 +45,8 @@ ship usable runtime artifacts. It never independently selects the newest Wallet.
42
45
 
43
46
  If npm fails after services stop, keep your private data. Review the shown log;
44
47
  reinstall the intended User version with npm if program files are incomplete, then
45
- run `agentpay repair`. Interrupted installers may leave a lock to inspect. Repair
48
+ run `agentpay repair`. If the updater was interrupted, rerun `agentpay update`: it retains the confirmed
49
+ version and finishes repair even if npm already installed it. Repair
46
50
  failure is not reported as update success. A newer update cannot silently downgrade
47
51
  a version changed while you were reviewing the confirmation.
48
52
 
@@ -64,8 +68,10 @@ Wallet starts locked after restart. No Wallet compilation is required.
64
68
 
65
69
  If preparation fails after stopping services, they remain stopped. Resolve the
66
70
  reported cause and repeat repair; the log path is shown. An interrupted run may
67
- leave an installation lock: inspect it before removing it. There is no automatic
68
- code rollback. Running-package negotiation is not implemented; complete the managed
71
+ leave a lock marker. New-format operations allow retry after all writer processes
72
+ exit; while a writer is alive, wait for it to finish. Do not delete a lock to bypass
73
+ that check. An older lock whose writer cannot be identified is preserved for review.
74
+ There is no automatic code rollback. Running-package negotiation is not implemented; complete the managed
69
75
  restart before relying on a newly installed version.
70
76
 
71
77
  ## Uninstall
package/doc/usage.md CHANGED
@@ -52,3 +52,11 @@ to that business example. An interrupted test retains its original request.
52
52
  [Background service guide](runbooks/local-autostart.md) explains Linux user services,
53
53
  login reminders and manual startup. A local lock or process stop does not revoke
54
54
  permission; follow [emergency stop](runbooks/emergency-payment-stop.md) when needed.
55
+
56
+ ### Official test Skill checks during updates
57
+
58
+ Update and repair verify the official test ZIP against the version pinned by User,
59
+ then compare its installed files. Matching local files need no download. Missing
60
+ archives trigger a download; changed or incomplete extracted files are kept and
61
+ reported for review. These checks do not start a payment or select a newer Skill
62
+ from Market. Software updates display repair progress while it runs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4roa0/agentpay-user",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@c4roa0/agentpay-protocol": "0.14.3",