402mob-runtime 0.2.0 → 0.2.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 +6 -2
- package/dist/runtime/cli.js +51 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,14 +7,14 @@ An owner-controlled Base USDC signer, delegated buyer and text-statistics seller
|
|
|
7
7
|
Use Node.js 24+ on Linux or macOS. Start the signer through npm:
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npm exec --yes --package=402mob-runtime@0.2.
|
|
10
|
+
npm exec --yes --package=402mob-runtime@0.2.1 -- 402mob-runtime wallet web \
|
|
11
11
|
--dir "$HOME/.local/share/402mob/runtime-owner"
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
For a persistent CLI, install into your own prefix:
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
|
-
npm install --prefix "$HOME/.local/share/402mob/runtime-cli" --ignore-scripts 402mob-runtime@0.2.
|
|
17
|
+
npm install --prefix "$HOME/.local/share/402mob/runtime-cli" --ignore-scripts 402mob-runtime@0.2.1
|
|
18
18
|
export PATH="$HOME/.local/share/402mob/runtime-cli/node_modules/.bin:$PATH"
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -52,6 +52,10 @@ These commands enroll a new seller on evidence.contact and publish a text-statis
|
|
|
52
52
|
|
|
53
53
|
Run `402mob-runtime --help` for all commands. Full guides: https://evidence.contact/agent-runtime.md and https://evidence.contact/web-wallet.md.
|
|
54
54
|
|
|
55
|
+
## Startup conflicts
|
|
56
|
+
|
|
57
|
+
`local_port_in_use` means another process already owns the named local port. If it is your signer, press Enter in its original terminal for a new pairing link, or stop it with Ctrl+C and restart with the same `--dir`. Do not start a second signer for the same wallet on different ports. The CLI preserves wallet state and closes any listener opened during a failed startup. Version 0.2.0 reported this condition as `adapter_failure`.
|
|
58
|
+
|
|
55
59
|
## Recovery and custody
|
|
56
60
|
|
|
57
61
|
Retain original private directories, credential and request IDs. Do not copy a wallet ledger for concurrent spending or restore an old snapshot to clear reservations. Revocation stops new authorizations; existing signed payments may still settle. Delegation is enforced by the local owner process, not by USDC's smart contract. Creation and delegation do not fund the wallet. Direct purchases do not provide automatic refunds or certify subjective quality.
|
package/dist/runtime/cli.js
CHANGED
|
@@ -36416,12 +36416,12 @@ var require_wrappy = __commonJS({
|
|
|
36416
36416
|
var require_once = __commonJS({
|
|
36417
36417
|
"node_modules/once/once.js"(exports, module) {
|
|
36418
36418
|
var wrappy = require_wrappy();
|
|
36419
|
-
module.exports = wrappy(
|
|
36419
|
+
module.exports = wrappy(once);
|
|
36420
36420
|
module.exports.strict = wrappy(onceStrict);
|
|
36421
|
-
|
|
36421
|
+
once.proto = once(function() {
|
|
36422
36422
|
Object.defineProperty(Function.prototype, "once", {
|
|
36423
36423
|
value: function() {
|
|
36424
|
-
return
|
|
36424
|
+
return once(this);
|
|
36425
36425
|
},
|
|
36426
36426
|
configurable: true
|
|
36427
36427
|
});
|
|
@@ -36432,7 +36432,7 @@ var require_once = __commonJS({
|
|
|
36432
36432
|
configurable: true
|
|
36433
36433
|
});
|
|
36434
36434
|
});
|
|
36435
|
-
function
|
|
36435
|
+
function once(fn) {
|
|
36436
36436
|
var f = function() {
|
|
36437
36437
|
if (f.called) return f.value;
|
|
36438
36438
|
f.called = true;
|
|
@@ -37517,7 +37517,7 @@ var require_application = __commonJS({
|
|
|
37517
37517
|
var compileQueryParser = require_utils3().compileQueryParser;
|
|
37518
37518
|
var compileTrust = require_utils3().compileTrust;
|
|
37519
37519
|
var resolve3 = __require("node:path").resolve;
|
|
37520
|
-
var
|
|
37520
|
+
var once = require_once();
|
|
37521
37521
|
var Router = require_router();
|
|
37522
37522
|
var slice4 = Array.prototype.slice;
|
|
37523
37523
|
var flatten = Array.prototype.flat;
|
|
@@ -37747,7 +37747,7 @@ var require_application = __commonJS({
|
|
|
37747
37747
|
var server = http2.createServer(this);
|
|
37748
37748
|
var args = slice4.call(arguments);
|
|
37749
37749
|
if (typeof args[args.length - 1] === "function") {
|
|
37750
|
-
var done = args[args.length - 1] =
|
|
37750
|
+
var done = args[args.length - 1] = once(args[args.length - 1]);
|
|
37751
37751
|
server.once("error", done);
|
|
37752
37752
|
}
|
|
37753
37753
|
return server.listen.apply(server, args);
|
|
@@ -40251,7 +40251,6 @@ var require_express2 = __commonJS({
|
|
|
40251
40251
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
40252
40252
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
40253
40253
|
import { dirname, join as join3, resolve as resolve2 } from "node:path";
|
|
40254
|
-
import { once } from "node:events";
|
|
40255
40254
|
import { parseArgs } from "node:util";
|
|
40256
40255
|
|
|
40257
40256
|
// node_modules/zod/v4/classic/external.js
|
|
@@ -65735,6 +65734,42 @@ function createWalletOwnerApp(service, settings = {}) {
|
|
|
65735
65734
|
} };
|
|
65736
65735
|
}
|
|
65737
65736
|
|
|
65737
|
+
// dist/runtime/listener.js
|
|
65738
|
+
var RuntimeListenFault = class extends RuntimeFault {
|
|
65739
|
+
port;
|
|
65740
|
+
constructor(port, code) {
|
|
65741
|
+
super(code);
|
|
65742
|
+
this.port = port;
|
|
65743
|
+
}
|
|
65744
|
+
};
|
|
65745
|
+
function listenLoopback(app, port) {
|
|
65746
|
+
return new Promise((resolve3, reject) => {
|
|
65747
|
+
const server = app.listen(port, "127.0.0.1");
|
|
65748
|
+
const ready = () => {
|
|
65749
|
+
server.off("error", failed);
|
|
65750
|
+
resolve3(server);
|
|
65751
|
+
};
|
|
65752
|
+
const failed = (error62) => {
|
|
65753
|
+
server.off("listening", ready);
|
|
65754
|
+
if (error62.code === "EADDRINUSE")
|
|
65755
|
+
reject(new RuntimeListenFault(port, "local_port_in_use"));
|
|
65756
|
+
else if (error62.code === "EACCES" || error62.code === "EPERM")
|
|
65757
|
+
reject(new RuntimeListenFault(port, "local_port_permission_denied"));
|
|
65758
|
+
else
|
|
65759
|
+
reject(error62);
|
|
65760
|
+
};
|
|
65761
|
+
server.once("error", failed);
|
|
65762
|
+
server.once("listening", ready);
|
|
65763
|
+
});
|
|
65764
|
+
}
|
|
65765
|
+
function listenerDiagnostic(error62) {
|
|
65766
|
+
return {
|
|
65767
|
+
address: "127.0.0.1",
|
|
65768
|
+
port: error62.port,
|
|
65769
|
+
message: error62.code === "local_port_in_use" ? `Port ${error62.port} is already in use. If your signer is running, return to its original terminal and press Enter for a fresh pairing link. To restart it, stop that process with Ctrl+C, then rerun the command with the same --dir. Do not run another signer for the same wallet on different ports.` : `Cannot bind local port ${error62.port}: access was denied. Check local permissions or select an unprivileged port. Keep the same wallet directory and ensure its previous signer is stopped.`
|
|
65770
|
+
};
|
|
65771
|
+
}
|
|
65772
|
+
|
|
65738
65773
|
// dist/runtime/web-launch.js
|
|
65739
65774
|
async function runWalletWeb(store, chain, settings) {
|
|
65740
65775
|
requireThat(settings.port !== settings.webPort, "wallet_ports_must_differ");
|
|
@@ -65743,21 +65778,14 @@ async function runWalletWeb(store, chain, settings) {
|
|
|
65743
65778
|
const owner = createWalletOwnerApp(service, { webOrigin: settings.webOrigin });
|
|
65744
65779
|
const agent = createWalletApp(() => service.runtime);
|
|
65745
65780
|
const servers = [];
|
|
65746
|
-
const listen = (app, port) => new Promise((resolve3, reject) => {
|
|
65747
|
-
const server = app.listen(port, "127.0.0.1");
|
|
65748
|
-
servers.push(server);
|
|
65749
|
-
server.once("error", reject);
|
|
65750
|
-
server.once("listening", () => {
|
|
65751
|
-
server.off("error", reject);
|
|
65752
|
-
resolve3();
|
|
65753
|
-
});
|
|
65754
|
-
server.requestTimeout = 2e4;
|
|
65755
|
-
server.headersTimeout = 1e4;
|
|
65756
|
-
});
|
|
65757
65781
|
let input2;
|
|
65758
65782
|
try {
|
|
65759
|
-
|
|
65760
|
-
|
|
65783
|
+
for (const [app, port] of [[agent, settings.port], [owner.app, settings.webPort]]) {
|
|
65784
|
+
const server = await listenLoopback(app, port);
|
|
65785
|
+
servers.push(server);
|
|
65786
|
+
server.requestTimeout = 2e4;
|
|
65787
|
+
server.headersTimeout = 1e4;
|
|
65788
|
+
}
|
|
65761
65789
|
const pair = () => {
|
|
65762
65790
|
try {
|
|
65763
65791
|
const pending = owner.issuePair(), fragment = new URLSearchParams({ gateway: ownerGateway, pair: pending.code }).toString();
|
|
@@ -66054,8 +66082,7 @@ async function main() {
|
|
|
66054
66082
|
}
|
|
66055
66083
|
requireThat(command === "serve", "unknown_wallet_command");
|
|
66056
66084
|
const port = external_exports.coerce.number().int().min(1).max(65535).parse(v.port ?? "4031");
|
|
66057
|
-
const buyer = new BuyerRuntime(wallet2, fetch, loadModelGate(store, v["model-config"])), server = createWalletApp(buyer)
|
|
66058
|
-
await once(server, "listening");
|
|
66085
|
+
const buyer = new BuyerRuntime(wallet2, fetch, loadModelGate(store, v["model-config"])), server = await listenLoopback(createWalletApp(buyer), port);
|
|
66059
66086
|
print({ gateway: `http://127.0.0.1:${port}`, wallet: wallet2.address, message: "Agents use delegation credentials; keep this directory under owner control." });
|
|
66060
66087
|
try {
|
|
66061
66088
|
while (!stopped) {
|
|
@@ -66074,7 +66101,8 @@ async function main() {
|
|
|
66074
66101
|
}
|
|
66075
66102
|
}
|
|
66076
66103
|
main().catch((e) => {
|
|
66077
|
-
|
|
66104
|
+
const diagnostic = e instanceof RuntimeListenFault ? listenerDiagnostic(e) : { message: "State retained. Keep the original directories and request file; do not reset an unresolved payment." };
|
|
66105
|
+
console.error(JSON.stringify({ error: faultCode(e), ...diagnostic }));
|
|
66078
66106
|
process.exitCode = 1;
|
|
66079
66107
|
});
|
|
66080
66108
|
/*! Bundled license information:
|