402mob-runtime 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dist/runtime/cli.js +53 -24
- 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.2 -- 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.2
|
|
18
18
|
export PATH="$HOME/.local/share/402mob/runtime-cli/node_modules/.bin:$PATH"
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -52,6 +52,12 @@ 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
|
+
|
|
59
|
+
If the local console page returns `adapter_failure` while the hosted console works, upgrade from 0.2.0 or 0.2.1 to 0.2.2. Those versions incorrectly blocked page assets beneath hidden installation directories such as `.npm` and `.local`. Stop the old signer, restart the upgraded version with the same wallet `--dir`, and use its new pairing link.
|
|
60
|
+
|
|
55
61
|
## Recovery and custody
|
|
56
62
|
|
|
57
63
|
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
|
|
@@ -65556,6 +65555,7 @@ var assets = /* @__PURE__ */ new Map([
|
|
|
65556
65555
|
["/style.css", ["style.css", "text/css"]],
|
|
65557
65556
|
["/favicon.svg", ["favicon.svg", "image/svg+xml"]]
|
|
65558
65557
|
]);
|
|
65558
|
+
var assetRoot = fileURLToPath(new URL("../../public/wallet/", import.meta.url));
|
|
65559
65559
|
var secret = (prefix) => prefix + randomBytes4(32).toString("hex");
|
|
65560
65560
|
var loopback = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
|
|
65561
65561
|
function createWalletOwnerApp(service, settings = {}) {
|
|
@@ -65646,7 +65646,7 @@ function createWalletOwnerApp(service, settings = {}) {
|
|
|
65646
65646
|
});
|
|
65647
65647
|
for (const [path, [file2, type]] of assets)
|
|
65648
65648
|
app.get(path, (_req, res) => {
|
|
65649
|
-
res.type(type).sendFile(
|
|
65649
|
+
res.type(type).sendFile(file2, { root: assetRoot, dotfiles: "deny" });
|
|
65650
65650
|
});
|
|
65651
65651
|
app.use(import_express2.default.json({ limit: "16kb", strict: true, inflate: false }));
|
|
65652
65652
|
app.get("/api/healthz", (_req, res) => {
|
|
@@ -65735,6 +65735,42 @@ function createWalletOwnerApp(service, settings = {}) {
|
|
|
65735
65735
|
} };
|
|
65736
65736
|
}
|
|
65737
65737
|
|
|
65738
|
+
// dist/runtime/listener.js
|
|
65739
|
+
var RuntimeListenFault = class extends RuntimeFault {
|
|
65740
|
+
port;
|
|
65741
|
+
constructor(port, code) {
|
|
65742
|
+
super(code);
|
|
65743
|
+
this.port = port;
|
|
65744
|
+
}
|
|
65745
|
+
};
|
|
65746
|
+
function listenLoopback(app, port) {
|
|
65747
|
+
return new Promise((resolve3, reject) => {
|
|
65748
|
+
const server = app.listen(port, "127.0.0.1");
|
|
65749
|
+
const ready = () => {
|
|
65750
|
+
server.off("error", failed);
|
|
65751
|
+
resolve3(server);
|
|
65752
|
+
};
|
|
65753
|
+
const failed = (error62) => {
|
|
65754
|
+
server.off("listening", ready);
|
|
65755
|
+
if (error62.code === "EADDRINUSE")
|
|
65756
|
+
reject(new RuntimeListenFault(port, "local_port_in_use"));
|
|
65757
|
+
else if (error62.code === "EACCES" || error62.code === "EPERM")
|
|
65758
|
+
reject(new RuntimeListenFault(port, "local_port_permission_denied"));
|
|
65759
|
+
else
|
|
65760
|
+
reject(error62);
|
|
65761
|
+
};
|
|
65762
|
+
server.once("error", failed);
|
|
65763
|
+
server.once("listening", ready);
|
|
65764
|
+
});
|
|
65765
|
+
}
|
|
65766
|
+
function listenerDiagnostic(error62) {
|
|
65767
|
+
return {
|
|
65768
|
+
address: "127.0.0.1",
|
|
65769
|
+
port: error62.port,
|
|
65770
|
+
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.`
|
|
65771
|
+
};
|
|
65772
|
+
}
|
|
65773
|
+
|
|
65738
65774
|
// dist/runtime/web-launch.js
|
|
65739
65775
|
async function runWalletWeb(store, chain, settings) {
|
|
65740
65776
|
requireThat(settings.port !== settings.webPort, "wallet_ports_must_differ");
|
|
@@ -65743,21 +65779,14 @@ async function runWalletWeb(store, chain, settings) {
|
|
|
65743
65779
|
const owner = createWalletOwnerApp(service, { webOrigin: settings.webOrigin });
|
|
65744
65780
|
const agent = createWalletApp(() => service.runtime);
|
|
65745
65781
|
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
65782
|
let input2;
|
|
65758
65783
|
try {
|
|
65759
|
-
|
|
65760
|
-
|
|
65784
|
+
for (const [app, port] of [[agent, settings.port], [owner.app, settings.webPort]]) {
|
|
65785
|
+
const server = await listenLoopback(app, port);
|
|
65786
|
+
servers.push(server);
|
|
65787
|
+
server.requestTimeout = 2e4;
|
|
65788
|
+
server.headersTimeout = 1e4;
|
|
65789
|
+
}
|
|
65761
65790
|
const pair = () => {
|
|
65762
65791
|
try {
|
|
65763
65792
|
const pending = owner.issuePair(), fragment = new URLSearchParams({ gateway: ownerGateway, pair: pending.code }).toString();
|
|
@@ -66054,8 +66083,7 @@ async function main() {
|
|
|
66054
66083
|
}
|
|
66055
66084
|
requireThat(command === "serve", "unknown_wallet_command");
|
|
66056
66085
|
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");
|
|
66086
|
+
const buyer = new BuyerRuntime(wallet2, fetch, loadModelGate(store, v["model-config"])), server = await listenLoopback(createWalletApp(buyer), port);
|
|
66059
66087
|
print({ gateway: `http://127.0.0.1:${port}`, wallet: wallet2.address, message: "Agents use delegation credentials; keep this directory under owner control." });
|
|
66060
66088
|
try {
|
|
66061
66089
|
while (!stopped) {
|
|
@@ -66074,7 +66102,8 @@ async function main() {
|
|
|
66074
66102
|
}
|
|
66075
66103
|
}
|
|
66076
66104
|
main().catch((e) => {
|
|
66077
|
-
|
|
66105
|
+
const diagnostic = e instanceof RuntimeListenFault ? listenerDiagnostic(e) : { message: "State retained. Keep the original directories and request file; do not reset an unresolved payment." };
|
|
66106
|
+
console.error(JSON.stringify({ error: faultCode(e), ...diagnostic }));
|
|
66078
66107
|
process.exitCode = 1;
|
|
66079
66108
|
});
|
|
66080
66109
|
/*! Bundled license information:
|