@heyanon-arp/cli 0.0.20 → 0.0.21
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/dist/cli.js +24 -47
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -734,7 +734,7 @@ var import_simple_update_notifier = __toESM(require("simple-update-notifier"));
|
|
|
734
734
|
// package.json
|
|
735
735
|
var package_default = {
|
|
736
736
|
name: "@heyanon-arp/cli",
|
|
737
|
-
version: "0.0.
|
|
737
|
+
version: "0.0.21",
|
|
738
738
|
description: "Command-line client for the Agent Relationship Protocol \u2014 register agents, sign envelopes, run escrowed work cycles on Solana.",
|
|
739
739
|
license: "MIT",
|
|
740
740
|
keywords: ["arp", "agent-relationship-protocol", "did", "solana", "escrow", "ed25519", "agents", "a2a", "cli"],
|
|
@@ -832,6 +832,16 @@ function toCliErrorJson(err, includeStack = false) {
|
|
|
832
832
|
if (details !== void 0) out2.details = details;
|
|
833
833
|
return out2;
|
|
834
834
|
}
|
|
835
|
+
if (err instanceof Error && err.code === "OUTBOUND_BLOCKED") {
|
|
836
|
+
const e = err;
|
|
837
|
+
const reasons = e.verdict?.reasons ?? e.reasons;
|
|
838
|
+
const out2 = { code: e.code, message: err.message };
|
|
839
|
+
const details = {};
|
|
840
|
+
if (Array.isArray(reasons) && reasons.length > 0) details.reasons = reasons;
|
|
841
|
+
if (includeStack && err.stack) details.stack = err.stack;
|
|
842
|
+
if (Object.keys(details).length > 0) out2.details = details;
|
|
843
|
+
return out2;
|
|
844
|
+
}
|
|
835
845
|
const message = err instanceof Error ? err.message : String(err);
|
|
836
846
|
const out = { code: "CLI_ERROR", message };
|
|
837
847
|
if (includeStack && err instanceof Error && err.stack) {
|
|
@@ -1780,9 +1790,6 @@ var UNTIL_PHASES = [
|
|
|
1780
1790
|
];
|
|
1781
1791
|
var WAIT_DEFAULT_INTERVAL_SEC = 3;
|
|
1782
1792
|
var WAIT_DEFAULT_TIMEOUT_SEC = 300;
|
|
1783
|
-
var WAIT_ABS_MAX_SEC = 86400;
|
|
1784
|
-
var WAIT_CONTRACT_LAG_MARGIN_SEC = 300;
|
|
1785
|
-
var WAIT_CONTRACT_CAP_FALLBACK_SEC = 3600;
|
|
1786
1793
|
function registerStatusCommand(root) {
|
|
1787
1794
|
root.command("status").description("Where am I in the work cycle? FSM state + next-action hint for ONE relationship (signed reads)").argument("<relationship-id>", "Relationship UUID").option("--server <url>", "Override ARP server base URL").option("--from-did <did>", "Signer DID \u2014 required only if multiple agents are registered against this server").option("--from <name>", "Signer agent NAME (handle) \u2014 alternative to --from-did, resolved against your local agents").option("--json", "Machine-readable: single JSON object with the composed summary. Pipe-safe.", false).option(
|
|
1788
1795
|
"--wait",
|
|
@@ -1790,7 +1797,7 @@ function registerStatusCommand(root) {
|
|
|
1790
1797
|
false
|
|
1791
1798
|
).option(
|
|
1792
1799
|
"--wait-timeout <seconds>",
|
|
1793
|
-
`Max wall-clock seconds to wait when --wait is set (default ${WAIT_DEFAULT_TIMEOUT_SEC}
|
|
1800
|
+
`Max wall-clock seconds to wait when --wait is set (default ${WAIT_DEFAULT_TIMEOUT_SEC}). Process exits code 124 on timeout, matching the unix \`timeout\` convention.`,
|
|
1794
1801
|
String(WAIT_DEFAULT_TIMEOUT_SEC)
|
|
1795
1802
|
).option(
|
|
1796
1803
|
"--wait-interval <seconds>",
|
|
@@ -1826,9 +1833,9 @@ async function runStatus(relationshipId, opts) {
|
|
|
1826
1833
|
console.log(formatStatusReport(summary));
|
|
1827
1834
|
return;
|
|
1828
1835
|
}
|
|
1829
|
-
const
|
|
1836
|
+
const waitTimeout = parseWaitTimeout(opts.waitTimeout);
|
|
1830
1837
|
const waitInterval = parseWaitInterval(opts.waitInterval);
|
|
1831
|
-
const
|
|
1838
|
+
const until = parseUntilPhase(opts.until);
|
|
1832
1839
|
const outcome = await runWaitLoop({
|
|
1833
1840
|
fetchSummary: () => composeStatus(api, sender.did, relationshipId, signer),
|
|
1834
1841
|
waitIntervalSec: waitInterval,
|
|
@@ -1989,31 +1996,8 @@ function parseWaitTimeout(raw) {
|
|
|
1989
1996
|
if (!Number.isFinite(n) || !Number.isInteger(n) || n <= 0) {
|
|
1990
1997
|
throw new Error(`status: --wait-timeout must be a positive integer number of seconds (got '${raw}')`);
|
|
1991
1998
|
}
|
|
1992
|
-
if (n >
|
|
1993
|
-
throw new Error(`status: --wait-timeout must be <=
|
|
1994
|
-
}
|
|
1995
|
-
return n;
|
|
1996
|
-
}
|
|
1997
|
-
function contractWaitCapSec(cfg) {
|
|
1998
|
-
const w = Number(cfg?.workWindowSecs);
|
|
1999
|
-
const r = Number(cfg?.reviewWindowSecs);
|
|
2000
|
-
const d = Number(cfg?.disputeWindowSecs);
|
|
2001
|
-
if (![w, r, d].every((n) => Number.isFinite(n) && n > 0)) return WAIT_CONTRACT_CAP_FALLBACK_SEC;
|
|
2002
|
-
return Math.min(WAIT_ABS_MAX_SEC, w + r + d + WAIT_CONTRACT_LAG_MARGIN_SEC);
|
|
2003
|
-
}
|
|
2004
|
-
async function resolveWaitTimeoutSec(api, raw, opts) {
|
|
2005
|
-
let cap;
|
|
2006
|
-
try {
|
|
2007
|
-
cap = contractWaitCapSec(await api.getEscrowConfig());
|
|
2008
|
-
} catch {
|
|
2009
|
-
cap = WAIT_CONTRACT_CAP_FALLBACK_SEC;
|
|
2010
|
-
}
|
|
2011
|
-
if (raw === void 0) return opts.hasUntil ? cap : WAIT_DEFAULT_TIMEOUT_SEC;
|
|
2012
|
-
const n = parseWaitTimeout(raw);
|
|
2013
|
-
if (n > cap) {
|
|
2014
|
-
throw new Error(
|
|
2015
|
-
`status: --wait-timeout ${n}s exceeds the live on-chain budget of ${cap}s (work+review+dispute windows + ${WAIT_CONTRACT_LAG_MARGIN_SEC}s lag, read from the contract). Nothing stays pending longer; lower it or script a loop around \`heyarp status\`.`
|
|
2016
|
-
);
|
|
1999
|
+
if (n > 3600) {
|
|
2000
|
+
throw new Error(`status: --wait-timeout must be <= 3600 seconds (1h). Got ${n}; if you really need to wait longer, script a loop around \`heyarp status\`.`);
|
|
2017
2001
|
}
|
|
2018
2002
|
return n;
|
|
2019
2003
|
}
|
|
@@ -2975,10 +2959,7 @@ function registerOffer(parent) {
|
|
|
2975
2959
|
).option(
|
|
2976
2960
|
"--wait-until <phase>",
|
|
2977
2961
|
'Block after delivery until the named FSM phase is reached (e.g. delegation.accepted). One of the UNTIL_PHASES from `heyarp status --help`. Exit code 124 on --wait-timeout. Recovers the "sub-agent exits before counterparty accepts" antipattern.'
|
|
2978
|
-
).option(
|
|
2979
|
-
"--wait-timeout <seconds>",
|
|
2980
|
-
"When --wait-until is set: max wall-clock wait. Omitted \u2192 auto-sized to the live on-chain budget (work+review+dispute windows + margin, read from the contract); explicit values are capped at that budget. Exit code 124 on timeout."
|
|
2981
|
-
).option("--wait-interval <seconds>", "When --wait-until is set: poll cadence (default 3, bound [1, 60]).").option(
|
|
2962
|
+
).option("--wait-timeout <seconds>", "When --wait-until is set: max wall-clock wait (default 300). Exit code 124 on timeout.").option("--wait-interval <seconds>", "When --wait-until is set: poll cadence (default 3, bound [1, 60]).").option(
|
|
2982
2963
|
"--wait-verbose",
|
|
2983
2964
|
'When --wait-until is set: emit one dim line per poll tick showing the current FSM state. Useful for "is it alive or stuck?" diagnosis on long blocks.',
|
|
2984
2965
|
false
|
|
@@ -3203,8 +3184,7 @@ After the worker accepts, fund the escrow lock:`));
|
|
|
3203
3184
|
relationshipId: result.relationshipId,
|
|
3204
3185
|
untilPhase,
|
|
3205
3186
|
waitIntervalSec: parseWaitInterval(opts.waitInterval),
|
|
3206
|
-
|
|
3207
|
-
waitTimeoutSec: await resolveWaitTimeoutSec(api, opts.waitTimeout, { hasUntil: true }),
|
|
3187
|
+
waitTimeoutSec: parseWaitTimeout(opts.waitTimeout),
|
|
3208
3188
|
waitVerbose: !!opts.waitVerbose,
|
|
3209
3189
|
json: false
|
|
3210
3190
|
// delegation offer is a human-text command (printIngestResult is human-text); JSON mode would be a follow-up.
|
|
@@ -3228,10 +3208,7 @@ function registerFund(parent) {
|
|
|
3228
3208
|
).option(
|
|
3229
3209
|
"--wait-until <phase>",
|
|
3230
3210
|
"Block after delivery until the named FSM phase is reached (typically delegation.locked \u2014 resolves once the escrow lock confirms on chain). One of the UNTIL_PHASES from `heyarp status --help`. Exit code 124 on --wait-timeout."
|
|
3231
|
-
).option(
|
|
3232
|
-
"--wait-timeout <seconds>",
|
|
3233
|
-
"When --wait-until is set: max wall-clock wait. Omitted \u2192 auto-sized to the live on-chain budget (work+review+dispute windows + margin, read from the contract); explicit values are capped at that budget. Exit code 124 on timeout."
|
|
3234
|
-
).option("--wait-interval <seconds>", "When --wait-until is set: poll cadence (default 3, bound [1, 60]).").option("--wait-verbose", "When --wait-until is set: emit one dim line per poll tick showing the current FSM state.", false).action(async (delegationId, opts) => {
|
|
3211
|
+
).option("--wait-timeout <seconds>", "When --wait-until is set: max wall-clock wait (default 300). Exit code 124 on timeout.").option("--wait-interval <seconds>", "When --wait-until is set: poll cadence (default 3, bound [1, 60]).").option("--wait-verbose", "When --wait-until is set: emit one dim line per poll tick showing the current FSM state.", false).action(async (delegationId, opts) => {
|
|
3235
3212
|
await runFund(delegationId, opts);
|
|
3236
3213
|
});
|
|
3237
3214
|
}
|
|
@@ -3329,11 +3306,11 @@ async function runFund(delegationId, opts) {
|
|
|
3329
3306
|
relationshipId: result.relationshipId,
|
|
3330
3307
|
untilPhase,
|
|
3331
3308
|
waitIntervalSec: parseWaitInterval(opts.waitInterval),
|
|
3332
|
-
// Lock finalization
|
|
3333
|
-
//
|
|
3334
|
-
//
|
|
3335
|
-
//
|
|
3336
|
-
waitTimeoutSec:
|
|
3309
|
+
// Lock finalization on devnet routinely takes 5–12 min
|
|
3310
|
+
// (submit → confirm → indexer projection), so fund gets a
|
|
3311
|
+
// larger default than the generic 300s — a timeout here is
|
|
3312
|
+
// almost never a failure, just a slow chain.
|
|
3313
|
+
waitTimeoutSec: parseWaitTimeout(opts.waitTimeout ?? "1200"),
|
|
3337
3314
|
waitVerbose: !!opts.waitVerbose,
|
|
3338
3315
|
json: false
|
|
3339
3316
|
});
|