@lucid-agents/taskmarket 1.18.1 → 1.19.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/dist/agent-compatibility.json +11 -1
- package/dist/{budget-view-JPZ7HWR2.js → budget-view-J6L7X6EY.js} +1 -1
- package/dist/{channels-KCDZ5REF.js → channels-7DEGKHO5.js} +4 -4
- package/dist/{chunk-OKZ2NRYZ.js → chunk-4ZC6SH7H.js} +18 -4
- package/dist/{chunk-RQTJZYFV.js → chunk-AEOZNLZD.js} +1 -1
- package/dist/{chunk-ONYTKAHC.js → chunk-ATHBKQT4.js} +16 -5
- package/dist/{chunk-HEGWADBV.js → chunk-ICT56PNO.js} +15 -3
- package/dist/{chunk-RHUDL5WA.js → chunk-IWZNOYQE.js} +22 -5
- package/dist/{chunk-3LNZ766H.js → chunk-M7WD6A2T.js} +2 -2
- package/dist/{chunk-LEVAZYR5.js → chunk-MZSOLQZB.js} +77 -11
- package/dist/{chunk-5VMWXDNO.js → chunk-NRKTRQEA.js} +26 -16
- package/dist/{chunk-3FF6JAMK.js → chunk-OTXEK6VM.js} +5 -4
- package/dist/{chunk-YB2B5DPR.js → chunk-X7AUWPZV.js} +3641 -3472
- package/dist/{chunk-EB6OJBF5.js → chunk-XJOB4NMV.js} +84 -2
- package/dist/{compatibility-KUYGZSUC.js → compatibility-636WJOEX.js} +1 -1
- package/dist/{doctor-TB3KKAZB.js → doctor-MBM7WQHI.js} +9 -9
- package/dist/index.js +398 -256
- package/dist/{launch-ZV6OLBFM.js → launch-ZSZURLR6.js} +493 -33
- package/dist/pi-extensions/remote-tools.cjs +15 -4
- package/dist/pi-extensions/xgate.cjs +163 -25
- package/dist/{reconcile-UXL65RRT.js → reconcile-4HIIA426.js} +4 -4
- package/dist/{status-FHZ3UGEB.js → status-BXL2F4LY.js} +8 -8
- package/dist/{sync-pull-YECZ4PJA.js → sync-pull-HL2YS3EL.js} +33 -11
- package/package.json +2 -2
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
import { createRequire as __tmCreateRequire } from 'node:module'; import { fileURLToPath as __tmFileURLToPath } from 'node:url'; import { dirname as __tmDirname } from 'node:path'; const require = __tmCreateRequire(import.meta.url); const __tmFilename = __tmFileURLToPath(import.meta.url); const __tmDirnameValue = __tmDirname(__tmFilename);
|
|
2
2
|
|
|
3
|
+
// src/lib/agent/failure-detail.ts
|
|
4
|
+
var MAX_FAILURE_REASON_CHARS = 160;
|
|
5
|
+
var MAX_REASON_BODY_BYTES = 64 * 1024;
|
|
6
|
+
var REDACTIONS = [
|
|
7
|
+
[/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi, "[url]"],
|
|
8
|
+
[/\b(bearer|basic)\s+\S+/gi, "$1 [redacted]"],
|
|
9
|
+
[
|
|
10
|
+
/\b(authorization|cookie|token|secret|password|passphrase|signature|private[-_ ]?key|api[-_ ]?key)\b(\s*[:=]\s*)\S+/gi,
|
|
11
|
+
"$1$2[redacted]"
|
|
12
|
+
],
|
|
13
|
+
[/\b0x[0-9a-f]{16,}\b/gi, "[hex]"],
|
|
14
|
+
[/\b[\w.+-]+@[\w-]+(\.[\w-]+)+\b/g, "[email]"],
|
|
15
|
+
[/[A-Za-z0-9+/_=-]{32,}/g, "[redacted]"]
|
|
16
|
+
];
|
|
17
|
+
function sanitizeFailureReason(text) {
|
|
18
|
+
if (typeof text !== "string") return void 0;
|
|
19
|
+
const line = text.slice(0, 16 * MAX_FAILURE_REASON_CHARS).split(/[\r\n]+/).find((part) => part.trim());
|
|
20
|
+
if (!line) return void 0;
|
|
21
|
+
let reason = line.replace(/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2066-\u2069]/g, " ").replace(/\s+/g, " ").trim();
|
|
22
|
+
for (const [pattern, replacement] of REDACTIONS) reason = reason.replace(pattern, replacement);
|
|
23
|
+
if (!reason) return void 0;
|
|
24
|
+
return reason.length > MAX_FAILURE_REASON_CHARS ? `${reason.slice(0, MAX_FAILURE_REASON_CHARS - 3).trimEnd()}...` : reason;
|
|
25
|
+
}
|
|
26
|
+
function failureDetail(value) {
|
|
27
|
+
if (!value || typeof value !== "object") return void 0;
|
|
28
|
+
const { status, reason } = value;
|
|
29
|
+
const detail = {
|
|
30
|
+
...Number.isInteger(status) && status >= 100 && status <= 599 ? { status } : {}
|
|
31
|
+
};
|
|
32
|
+
const text = sanitizeFailureReason(reason);
|
|
33
|
+
if (text) detail.reason = text;
|
|
34
|
+
return detail.status === void 0 && detail.reason === void 0 ? void 0 : detail;
|
|
35
|
+
}
|
|
36
|
+
function describeFailureDetail(detail) {
|
|
37
|
+
const status = detail.status !== void 0 ? `HTTP ${detail.status}` : "";
|
|
38
|
+
return status && detail.reason ? `${status}: ${detail.reason}` : status || detail.reason || "";
|
|
39
|
+
}
|
|
40
|
+
function responseFailureReason(response) {
|
|
41
|
+
const body = response?.body;
|
|
42
|
+
if (!(body instanceof Uint8Array) || body.byteLength > MAX_REASON_BODY_BYTES) return void 0;
|
|
43
|
+
let value;
|
|
44
|
+
try {
|
|
45
|
+
value = JSON.parse(new TextDecoder().decode(body));
|
|
46
|
+
} catch {
|
|
47
|
+
return void 0;
|
|
48
|
+
}
|
|
49
|
+
const record = value ?? {};
|
|
50
|
+
const error = record.error;
|
|
51
|
+
for (const candidate of [
|
|
52
|
+
typeof error === "string" ? error : error?.message,
|
|
53
|
+
record.message,
|
|
54
|
+
record.detail
|
|
55
|
+
]) {
|
|
56
|
+
const reason = sanitizeFailureReason(candidate);
|
|
57
|
+
if (reason) return reason;
|
|
58
|
+
}
|
|
59
|
+
return void 0;
|
|
60
|
+
}
|
|
61
|
+
function failureDetailOf(error) {
|
|
62
|
+
return error && typeof error === "object" ? failureDetail(error.detail) : void 0;
|
|
63
|
+
}
|
|
64
|
+
function withFailureDetail(error, detail) {
|
|
65
|
+
if (detail && error && typeof error === "object") {
|
|
66
|
+
error.detail = detail;
|
|
67
|
+
}
|
|
68
|
+
return error;
|
|
69
|
+
}
|
|
70
|
+
|
|
3
71
|
// src/lib/agent/budget-view.ts
|
|
4
72
|
var AGENT_VIEW_VERSION = 1;
|
|
5
73
|
var USDC_DECIMALS = 6;
|
|
@@ -154,24 +222,38 @@ var CHARGED_UNDELIVERED = /* @__PURE__ */ new Set([
|
|
|
154
222
|
"invalid_response",
|
|
155
223
|
"response_hook_failed"
|
|
156
224
|
]);
|
|
225
|
+
var REQUEST_FAILED = /* @__PURE__ */ new Set(["request_failed", "request_rejected"]);
|
|
157
226
|
function purchaseFailureNotice(failure) {
|
|
227
|
+
const detail = failureDetail(failure.detail);
|
|
228
|
+
const cause = detail ? `${failure.code}, ${describeFailureDetail(detail)}` : failure.code;
|
|
158
229
|
if (failure.pending) {
|
|
159
230
|
return {
|
|
160
231
|
level: "warning",
|
|
161
|
-
text: uncertainPurchaseMessage(failure.invocationId || "(unknown)")
|
|
232
|
+
text: `${uncertainPurchaseMessage(failure.invocationId || "(unknown)")}${detail ? ` Cause: ${describeFailureDetail(detail)}.` : ""}`
|
|
162
233
|
};
|
|
163
234
|
}
|
|
164
235
|
const charged = failure.payment?.chargedAtomic;
|
|
165
236
|
if (charged !== void 0 || CHARGED_UNDELIVERED.has(failure.code)) {
|
|
166
237
|
return {
|
|
167
238
|
level: "error",
|
|
168
|
-
text: `This turn was paid${charged !== void 0 ? ` (${formatUsdc(charged)})` : ""} but its response was lost (${
|
|
239
|
+
text: `This turn was paid${charged !== void 0 ? ` (${formatUsdc(charged)})` : ""} but its response was lost (${cause}). ${LOST_RESPONSE_TEXT}`
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
if (REQUEST_FAILED.has(failure.code)) {
|
|
243
|
+
return {
|
|
244
|
+
level: "error",
|
|
245
|
+
text: `This turn's request to xgate failed (${cause}). It is not retried automatically; send the prompt again to start a new turn.`
|
|
169
246
|
};
|
|
170
247
|
}
|
|
171
248
|
return void 0;
|
|
172
249
|
}
|
|
173
250
|
|
|
174
251
|
export {
|
|
252
|
+
failureDetail,
|
|
253
|
+
describeFailureDetail,
|
|
254
|
+
responseFailureReason,
|
|
255
|
+
failureDetailOf,
|
|
256
|
+
withFailureDetail,
|
|
175
257
|
AGENT_VIEW_VERSION,
|
|
176
258
|
formatUsdc,
|
|
177
259
|
formatCredits,
|
|
@@ -3,31 +3,31 @@ import {
|
|
|
3
3
|
AGENT_COMPATIBILITY,
|
|
4
4
|
assertAgentCompatibility,
|
|
5
5
|
nodeVersionSupported
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4ZC6SH7H.js";
|
|
7
7
|
import {
|
|
8
8
|
listSandboxes
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-IWZNOYQE.js";
|
|
10
|
+
import "./chunk-OTXEK6VM.js";
|
|
11
|
+
import "./chunk-ATHBKQT4.js";
|
|
12
|
+
import "./chunk-M7WD6A2T.js";
|
|
13
13
|
import {
|
|
14
14
|
channelView,
|
|
15
15
|
loadAgentPolicy,
|
|
16
16
|
openAgentChannels
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MZSOLQZB.js";
|
|
18
18
|
import {
|
|
19
19
|
getX402PolicyPath,
|
|
20
20
|
loadX402Policy,
|
|
21
21
|
rpcUrlForNetwork
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-NRKTRQEA.js";
|
|
23
23
|
import {
|
|
24
24
|
apiUrl,
|
|
25
25
|
keystoreExists,
|
|
26
26
|
loadKeystore
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-X7AUWPZV.js";
|
|
28
28
|
import {
|
|
29
29
|
AGENT_VIEW_VERSION
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-XJOB4NMV.js";
|
|
31
31
|
import "./chunk-YM4S6IE4.js";
|
|
32
32
|
import "./chunk-S7SJMJ2I.js";
|
|
33
33
|
|