@c4roa0/agentpay-user 0.3.4 → 0.3.5

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/doc/TODO.md CHANGED
@@ -2,11 +2,15 @@
2
2
 
3
3
  ## Existing Market address update
4
4
 
5
+ - [x] Allow source-to-npm reconnect without an onboarding draft; verify Policy contracts and preserve missing files.
6
+ - [ ] Publish 0.3.5 and retry the participant address update.
7
+
5
8
  - [x] Reauthenticate and verify original account, Wallet tuple and Policy connection before replacing an address.
6
9
  - [x] Verify unchanged deployment; preserve RPC, key, Policy, history/cache and original cancellation IDs.
7
10
  - [x] Apply under installer lock, restart managed Runtime, retain retry marker and show incomplete update in status.
8
11
  - [x] Full regression (387 checks), followed by targeted reconnect-boundary/transaction checks.
9
- - [ ] Publish a reviewed version and verify the existing participant installation against HTTPS.
12
+ - [x] Publish User 0.3.4 through v0.3.4; workflow and independent registry integrity verification passed.
13
+ - [ ] Verify the existing participant installation and explicit address update against HTTPS.
10
14
 
11
15
  ## Directory npm update, then HTTPS
12
16
 
@@ -46,9 +46,13 @@ lock, confirm no installer is running before following the lock-review guidance;
46
46
  User does not break an unknown live lock automatically. Existing cancellation requests keep their
47
47
  original IDs; recovery checks refresh observations from the new Settlement.
48
48
  Keep any old SSH tunnels until the update succeeds and `status` confirms operation.
49
- This feature requires User 0.3.4 or newer. Updating software does not change
49
+ This feature requires User 0.3.5 or newer. Updating software does not change
50
50
  your saved addresses; run the command above to review the change.
51
51
 
52
+ Older source installations may leave onboarding files outside the npm package.
53
+ Address updates use the saved Wallet Policy and Runtime settings; they do not
54
+ require or recreate an old onboarding draft.
55
+
52
56
  ## Wallet identity and Policy access
53
57
 
54
58
  A Wallet is identified by network + Module + Safe + execution address. Its nickname
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4roa0/agentpay-user",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@c4roa0/agentpay-protocol": "0.14.3",
package/progress.md CHANGED
@@ -1,12 +1,26 @@
1
1
  # AgentPay User progress
2
2
 
3
- ## User 0.3.4 release candidate — 2026-11-09
3
+ ## Missing onboarding draft during npm address update — 2026-11-09
4
+
5
+ Participant 0.3.4 reconnect stopped before address writes because an old onboarding
6
+ file was absent. Address updates now validate the saved Policy and service settings
7
+ without requiring that draft; existing draft/public files are updated only if
8
+ present. No RPC, Policy, test configuration or private history is synthesized.
9
+ 389 full regressions passed, followed by targeted error-guidance checks. Missing
10
+ drafts still reject contract drift; preflight errors explain the stage, preserved
11
+ state and retry action, while interrupted writes warn about partial updates.
12
+ User 0.3.5 publication is pending;
13
+ participant migration remains unverified.
14
+
15
+ ## User 0.3.4 published — 2026-11-09
4
16
 
5
17
  Release the explicit Market address update with unchanged Wallet 0.3.2 and
6
18
  Protocol 0.14.3 pins. No participant data or running services are changed by
7
19
  publication. Independent npm archive installation and real isolated local-service
8
- startup passed; all 388 release regressions passed. Tag publication, registry verification and participant migration
9
- are separate gates; participant acceptance remains pending.
20
+ startup passed; all 388 release regressions passed. Tag v0.3.4 identifies c63ff80.
21
+ GitHub run 42574859894 completed OIDC publication and registry verification.
22
+ Independent registry integrity comparison matched the reviewed local archive.
23
+ Participant address migration remains pending.
10
24
 
11
25
 
12
26
  ## Explicit Market address update — 2026-11-09
@@ -273,7 +273,21 @@ export async function connectMarket(
273
273
  String(p.policyId).toLowerCase() === String(previous.connection.policyId).toLowerCase());
274
274
  if (changingOrigin && !originalConnectionMatches)
275
275
  throw Error("Your original Wallet connection was not found at this address. The previous connection and addresses were kept.");
276
- const endpoints = previous ? await prepareEndpoints({dataDir,origin,scope,fetchJson,changingOrigin}) : {changed:false,apply:async()=>{}};
276
+ let endpoints;
277
+ try {
278
+ endpoints = previous ? await prepareEndpoints({dataDir,origin,scope,fetchJson,changingOrigin}) : {changed:false,apply:async()=>{}};
279
+ } catch (error) {
280
+ const networkFailure = ["AbortError", "TimeoutError"].includes(error.name) ||
281
+ ["ECONNREFUSED", "ECONNRESET", "ENOTFOUND", "ETIMEDOUT"].includes(error.code || error.cause?.code) || error.message === "fetch failed";
282
+ const reason = networkFailure
283
+ ? "Could not reach the platform to check its settings. Check your network and the Market address."
284
+ : error.message;
285
+ write("\n[!] Platform address check stopped");
286
+ write(reason);
287
+ write("No local settings were changed by this check. Your Wallet and Order records are kept.");
288
+ write("Next: resolve the issue above, then retry this command.");
289
+ return 1;
290
+ }
277
291
  if (endpoints.changed && (previous?.accountId !== signedIn.developer.id || !originalConnectionMatches))
278
292
  throw Error("Platform addresses changed, but your original account and Wallet connection could not be confirmed. Current addresses were kept.");
279
293
  if (existing) write(`Using your Wallet name: ${existing.label}`);
@@ -63,25 +63,32 @@ export async function preparePlatformEndpoints({dataDir,origin,scope,userDir=ins
63
63
  // changed origin or an interrupted update owns transport changes.
64
64
  if(!changingOrigin&&!pending)return {changed:false,apply:async()=>{}};
65
65
  const setup=await readPrivateJson(await deploymentFilePath(dataDir,userDir,'anvil-onboarding.json'));
66
- if(!setup)throw Error('Local setup settings are missing. Run agentpay setup before connecting Market.');
66
+ // A source-to-npm installation may have no copied onboarding draft. The
67
+ // bound Policy and live service settings remain the authoritative local state.
68
+ // Never synthesize a draft or replace its RPC/test configuration from Market.
67
69
  const policy=await readPrivateJson(join(dataDir,'wallet/policy.json'));
70
+ if(!policy)throw Error('Saved spending permission is missing (wallet/policy.json). Check your data folder with agentpay wallet info and restore its backup before retrying. Do not create a replacement Policy to fix this.');
68
71
  if(!policy||policy.policyId?.toLowerCase()!==scope.policyId?.toLowerCase()||policy.safe?.toLowerCase()!==scope.safe?.toLowerCase()||`eip155:${policy.chainId}`!==scope.network||policy.module?.toLowerCase()!==scope.module?.toLowerCase())
69
72
  throw Error('Wallet authorization changed. Run agentpay market connect again.');
70
73
  const connectionBefore=await readPrivateJson(join(dataDir,'market-connection.json'));
71
74
  if(pending&&(pending.version!==1||pending.origin!==origin||pending.policyId!==policy.policyId))
72
75
  throw Error('Finish the pending address update with the same Policy. Retry: agentpay market connect --market '+pending.origin);
73
76
  const {response,result}=await fetchJson(origin+'/market/web/onboarding/user-config',{method:'GET'},15000);
74
- if(!response.ok)throw Error('Market settings could not be checked. Your current addresses are kept.');
77
+ if(!response.ok)throw Error('Market deployment settings are unavailable. Check the website address and your connection, then retry.');
75
78
  const proposed=validatePublicDeployment(result);
76
- const settings=await readServiceSettings(dataDir);
79
+ let settings;
80
+ try{settings=await readServiceSettings(dataDir);}catch(e){
81
+ if(e.code==='ENOENT')throw Error('Runtime settings are missing (runtime/local-services.json). Run agentpay repair, then retry this command.');
82
+ throw Error('Runtime settings could not be read safely. Check the selected data folder with agentpay wallet info before retrying.');
83
+ }
77
84
  const urls={settlementUrl:proposed.settlementUrl,marketBundleMetadataUrl:proposed.marketBundleMetadataUrl};
78
- const changed=Object.keys(urls).some(key=>normalize(setup[key])!==normalize(urls[key]))||normalize(settings.settlementUrl)!==normalize(urls.settlementUrl)||!!pending;
85
+ const changed=!!setup&&Object.keys(urls).some(key=>normalize(setup[key])!==normalize(urls[key]))||normalize(settings.settlementUrl)!==normalize(urls.settlementUrl)||!!pending;
79
86
  // RPC is participant-owned: a different local tunnel must never be overwritten.
80
87
  // A Market connection alone is not authority to rotate contracts or test packages.
81
88
  const publicPath=await deploymentFilePath(dataDir,userDir,'user-deployment.json');
82
89
  const previousPublic=await readPrivateJson(publicPath);
83
90
  if(!changed&&!changingOrigin)return {changed:false,apply:async()=>{}};
84
- if(deploymentChanges(policy,proposed).length||deploymentChanges(setup,proposed).length||setup.mode!==proposed.mode||setup.tokenDecimals!==proposed.tokenDecimals||setup.tokenSymbol!==proposed.tokenSymbol)
91
+ if(deploymentChanges(policy,proposed).length||(setup&&(deploymentChanges(setup,proposed).length||setup.mode!==proposed.mode||setup.tokenDecimals!==proposed.tokenDecimals||setup.tokenSymbol!==proposed.tokenSymbol)))
85
92
  throw Error('This Market uses different network or contract settings. Address update stopped; your current Policy and Orders are kept.');
86
93
 
87
94
  // Query an unknown service to inspect deployment identity without depending on
@@ -101,6 +108,7 @@ export async function preparePlatformEndpoints({dataDir,origin,scope,userDir=ins
101
108
  if(!stat.isDirectory()||stat.isSymbolicLink()||stat.uid!==process.getuid()||(stat.mode&0o077))throw Error('Unsafe installation state directory.');
102
109
  const lockPath=join(stateDir,'install.lock');let lock;
103
110
  try{lock=await open(lockPath,'wx',0o600);}catch(e){if(e.code==='EEXIST')throw Error('Another setup or update is running. Retry market connect when it finishes.');throw e;}
111
+ let updating=false;
104
112
  try{
105
113
  if(!same(await readPrivateJson(join(dataDir,'market-connection.json')),connectionBefore)||!same(await readPrivateJson(join(dataDir,'wallet/policy.json')),policy)||!same(await readServiceSettings(dataDir),settings)||!same(await readPrivateJson(publicPath),previousPublic)||!same(await readPrivateJson(await deploymentFilePath(dataDir,userDir,'anvil-onboarding.json')),setup))
106
114
  throw Error('Local settings changed during connection. Retry market connect; no addresses were changed.');
@@ -114,16 +122,17 @@ export async function preparePlatformEndpoints({dataDir,origin,scope,userDir=ins
114
122
  // A durable marker makes interruptions retryable even after settings are written.
115
123
  // Write the alias before the new active address; never mutate cancellation IDs.
116
124
  await durableJson(pendingPath(dataDir),{version:1,origin,policyId:policy.policyId});
125
+ updating=true;
117
126
  await saveConnection();
118
127
  await manage('stop',{dataDir,settings});
119
128
  await durableJson(aliasesPath(dataDir),aliases);
120
129
  if(previousPublic)await durableJson(join(dataDir,'user-deployment.json'),{...previousPublic,...urls});
121
- await durableJson(join(dataDir,'anvil-onboarding.json'),{...setup,...urls});
130
+ if(setup)await durableJson(join(dataDir,'anvil-onboarding.json'),{...setup,...urls});
122
131
  await durableJson(join(dataDir,'runtime/local-services.json'),{...settings,settlementUrl:normalize(urls.settlementUrl)});
123
132
  await manage('start',{dataDir,settings:{...settings,settlementUrl:normalize(urls.settlementUrl)}});
124
133
  await unlink(pendingPath(dataDir));
125
134
  write('Platform addresses updated. Your Wallet, permission and Order records were kept.');
126
- }catch(e){throw Error('Address update did not finish. Run agentpay market connect --market '+origin+' again. '+e.message);}
135
+ }catch(e){throw Error('Address update did not finish.\n'+e.message+'\n'+(updating?'Some connection settings may already be saved. Wallet keys, Policies and Orders were kept.':'No connection addresses were changed.')+'\nNext: agentpay market connect --market '+origin);}
127
136
  finally{await lock.close();await unlink(lockPath);}
128
137
  }};
129
138
  }
package/update-pair.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "format": "agentpay.local-update-pair.v1",
3
- "userVersion": "0.3.4",
3
+ "userVersion": "0.3.5",
4
4
  "walletVersion": "0.3.2",
5
5
  "typesDependency": "0.14.3"
6
6
  }