opencode-collaboration 0.8.0 → 0.8.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 +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/commands.js +2 -103
- package/dist/config.js +2 -52
- package/dist/delivery.js +2 -241
- package/dist/feedback.js +2 -40
- package/dist/format.js +2 -107
- package/dist/gating.js +2 -16
- package/dist/index.js +2 -461
- package/dist/listener.js +2 -335
- package/dist/outbox.js +2 -110
- package/dist/permissions.js +2 -194
- package/dist/queue.js +2 -824
- package/dist/registry.js +2 -308
- package/dist/sanitize.js +2 -38
- package/dist/scope.js +2 -23
- package/dist/sender.js +2 -139
- package/dist/session-runtime.js +2 -434
- package/dist/session-tracker.js +2 -39
- package/dist/title-suffix.js +2 -23
- package/dist/tools/peers-tools.js +2 -182
- package/dist/transport.js +2 -46
- package/dist/types.js +2 -1
- package/package.json +2 -2
package/dist/registry.js
CHANGED
|
@@ -1,308 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* One file per instance eliminates multi-writer races; no locking needed.
|
|
4
|
-
*/
|
|
5
|
-
import { randomBytes } from "node:crypto";
|
|
6
|
-
import { chmod, mkdir, readdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
7
|
-
import { hostname } from "node:os";
|
|
8
|
-
import { join } from "node:path";
|
|
9
|
-
export function newInstanceId() {
|
|
10
|
-
return randomBytes(4).toString("hex");
|
|
11
|
-
}
|
|
12
|
-
export function newInboxToken() {
|
|
13
|
-
return randomBytes(24).toString("hex");
|
|
14
|
-
}
|
|
15
|
-
export function pidAlive(pid) {
|
|
16
|
-
if (pid === process.pid)
|
|
17
|
-
return true;
|
|
18
|
-
try {
|
|
19
|
-
process.kill(pid, 0);
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
const code = err.code;
|
|
24
|
-
return code === "EPERM";
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export function Registry(opts) {
|
|
28
|
-
const selfFile = join(opts.peersDir, `${opts.instanceId}.json`);
|
|
29
|
-
const selfV2Files = new Set();
|
|
30
|
-
let timer = null;
|
|
31
|
-
let writeTail = Promise.resolve();
|
|
32
|
-
let stopPromise = null;
|
|
33
|
-
let lifecycle = "new";
|
|
34
|
-
const startedAt = Date.now();
|
|
35
|
-
function compatibilityDynamic() {
|
|
36
|
-
const dyn = opts.getDynamic();
|
|
37
|
-
const endpoints = opts.getEndpoints?.() ?? [];
|
|
38
|
-
const compatibilityId = opts.getCompatibilityEndpointId?.();
|
|
39
|
-
const latest = endpoints.find((endpoint) => endpoint.endpointId === compatibilityId)
|
|
40
|
-
?? endpoints.slice().sort((a, b) => b.updatedAt - a.updatedAt)[0];
|
|
41
|
-
if (!latest)
|
|
42
|
-
return dyn;
|
|
43
|
-
return {
|
|
44
|
-
name: latest.name,
|
|
45
|
-
inboundPolicy: dyn.inboundPolicy,
|
|
46
|
-
activeSessionId: latest.sessionId,
|
|
47
|
-
activeSessionTitle: latest.title,
|
|
48
|
-
busy: latest.status !== "idle",
|
|
49
|
-
queuedCount: latest.queuedCount,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function buildEntry() {
|
|
53
|
-
const dyn = compatibilityDynamic();
|
|
54
|
-
return {
|
|
55
|
-
version: 1,
|
|
56
|
-
instanceId: opts.instanceId,
|
|
57
|
-
name: dyn.name,
|
|
58
|
-
pid: opts.pid,
|
|
59
|
-
hostname: hostname(),
|
|
60
|
-
directory: opts.directory,
|
|
61
|
-
serverUrl: opts.serverUrl,
|
|
62
|
-
inboxUrl: opts.inboxUrl,
|
|
63
|
-
inboxToken: opts.inboxToken,
|
|
64
|
-
activeSessionId: dyn.activeSessionId,
|
|
65
|
-
activeSessionTitle: dyn.activeSessionTitle,
|
|
66
|
-
busy: dyn.busy,
|
|
67
|
-
queuedCount: dyn.queuedCount,
|
|
68
|
-
inboundPolicy: dyn.inboundPolicy,
|
|
69
|
-
startedAt,
|
|
70
|
-
heartbeatAt: Date.now(),
|
|
71
|
-
pluginVersion: opts.pluginVersion,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function buildV2Entry(endpoint, heartbeatAt) {
|
|
75
|
-
const inboundPolicy = opts.getDynamic().inboundPolicy;
|
|
76
|
-
return {
|
|
77
|
-
version: 2,
|
|
78
|
-
endpointId: endpoint.endpointId,
|
|
79
|
-
processId: opts.instanceId,
|
|
80
|
-
pid: opts.pid,
|
|
81
|
-
sessionId: endpoint.sessionId,
|
|
82
|
-
...(endpoint.parentSessionId ? { parentSessionId: endpoint.parentSessionId } : {}),
|
|
83
|
-
title: endpoint.title,
|
|
84
|
-
name: endpoint.name,
|
|
85
|
-
hostname: hostname(),
|
|
86
|
-
directory: endpoint.directory,
|
|
87
|
-
status: endpoint.status,
|
|
88
|
-
transport: opts.transport,
|
|
89
|
-
serverUrl: opts.serverUrl,
|
|
90
|
-
inboxUrl: opts.inboxUrl,
|
|
91
|
-
inboxToken: opts.inboxToken,
|
|
92
|
-
capabilities: ["local", "protocol-v2", "prompt-async", "ack"],
|
|
93
|
-
timestamps: {
|
|
94
|
-
startedAt: endpoint.startedAt,
|
|
95
|
-
updatedAt: endpoint.updatedAt,
|
|
96
|
-
heartbeatAt,
|
|
97
|
-
},
|
|
98
|
-
policy: {
|
|
99
|
-
inboundPolicy,
|
|
100
|
-
peerPermissions: opts.peerPermissions ?? "allow",
|
|
101
|
-
},
|
|
102
|
-
pluginVersion: opts.pluginVersion,
|
|
103
|
-
activeSessionId: endpoint.sessionId,
|
|
104
|
-
activeSessionTitle: endpoint.title,
|
|
105
|
-
busy: endpoint.status !== "idle",
|
|
106
|
-
queuedCount: endpoint.queuedCount,
|
|
107
|
-
inboundPolicy,
|
|
108
|
-
startedAt: endpoint.startedAt,
|
|
109
|
-
heartbeatAt,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
async function writeEntry(path, entry) {
|
|
113
|
-
const tmp = `${path}.${process.pid}.tmp`;
|
|
114
|
-
await writeFile(tmp, JSON.stringify(entry, null, 2), { mode: 0o600 });
|
|
115
|
-
await chmod(tmp, 0o600).catch(() => { });
|
|
116
|
-
await rename(tmp, path);
|
|
117
|
-
}
|
|
118
|
-
async function writeSelf() {
|
|
119
|
-
await writeEntry(selfFile, buildEntry());
|
|
120
|
-
if (!opts.getEndpoints || !opts.transport)
|
|
121
|
-
return;
|
|
122
|
-
const heartbeatAt = Date.now();
|
|
123
|
-
const nextFiles = new Set();
|
|
124
|
-
for (const endpoint of opts.getEndpoints()) {
|
|
125
|
-
const safeId = endpoint.endpointId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
126
|
-
const path = join(opts.peersDir, `${opts.instanceId}.${safeId}.v2.json`);
|
|
127
|
-
await writeEntry(path, buildV2Entry(endpoint, heartbeatAt));
|
|
128
|
-
nextFiles.add(path);
|
|
129
|
-
}
|
|
130
|
-
for (const path of selfV2Files) {
|
|
131
|
-
if (!nextFiles.has(path))
|
|
132
|
-
await rm(path, { force: true });
|
|
133
|
-
}
|
|
134
|
-
selfV2Files.clear();
|
|
135
|
-
for (const path of nextFiles)
|
|
136
|
-
selfV2Files.add(path);
|
|
137
|
-
}
|
|
138
|
-
function scheduleWrite() {
|
|
139
|
-
if (lifecycle !== "running")
|
|
140
|
-
return Promise.resolve();
|
|
141
|
-
const writeIfRunning = () => lifecycle === "running" ? writeSelf() : Promise.resolve();
|
|
142
|
-
const pending = writeTail.then(writeIfRunning, writeIfRunning);
|
|
143
|
-
writeTail = pending.catch(() => { });
|
|
144
|
-
return pending;
|
|
145
|
-
}
|
|
146
|
-
async function readEntry(file) {
|
|
147
|
-
try {
|
|
148
|
-
const raw = await readFile(join(opts.peersDir, file), "utf8");
|
|
149
|
-
const entry = JSON.parse(raw);
|
|
150
|
-
if (entry.version === 1 && entry.instanceId && entry.inboxUrl)
|
|
151
|
-
return entry;
|
|
152
|
-
if (entry.version === 2 && entry.endpointId && entry.processId && entry.transport && entry.sessionId)
|
|
153
|
-
return entry;
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
catch {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
function staleReason(entry, now) {
|
|
161
|
-
const ageMs = now - entry.heartbeatAt;
|
|
162
|
-
if (ageMs > opts.staleMs)
|
|
163
|
-
return `last heartbeat ${Math.round(ageMs / 1000)}s ago`;
|
|
164
|
-
if (!pidAlive(entry.pid))
|
|
165
|
-
return `pid ${entry.pid} is not running`;
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
const inst = {
|
|
169
|
-
selfFile,
|
|
170
|
-
async start() {
|
|
171
|
-
if (lifecycle !== "new")
|
|
172
|
-
throw new Error(`registry cannot start while ${lifecycle}`);
|
|
173
|
-
await mkdir(opts.peersDir, { recursive: true, mode: 0o700 });
|
|
174
|
-
await chmod(opts.peersDir, 0o700).catch(() => { });
|
|
175
|
-
lifecycle = "running";
|
|
176
|
-
try {
|
|
177
|
-
await scheduleWrite();
|
|
178
|
-
}
|
|
179
|
-
catch (err) {
|
|
180
|
-
lifecycle = "stopped";
|
|
181
|
-
throw err;
|
|
182
|
-
}
|
|
183
|
-
timer = setInterval(() => {
|
|
184
|
-
inst.heartbeat().catch((err) => {
|
|
185
|
-
opts.logger("warn", "heartbeat failed", { error: String(err) });
|
|
186
|
-
});
|
|
187
|
-
}, opts.heartbeatMs);
|
|
188
|
-
timer.unref?.();
|
|
189
|
-
},
|
|
190
|
-
async stop() {
|
|
191
|
-
if (stopPromise)
|
|
192
|
-
return stopPromise;
|
|
193
|
-
if (lifecycle === "stopped")
|
|
194
|
-
return;
|
|
195
|
-
lifecycle = "stopping";
|
|
196
|
-
if (timer)
|
|
197
|
-
clearInterval(timer);
|
|
198
|
-
timer = null;
|
|
199
|
-
stopPromise = (async () => {
|
|
200
|
-
await writeTail;
|
|
201
|
-
await rm(selfFile, { force: true });
|
|
202
|
-
await Promise.all([...selfV2Files].map((path) => rm(path, { force: true })));
|
|
203
|
-
selfV2Files.clear();
|
|
204
|
-
lifecycle = "stopped";
|
|
205
|
-
})();
|
|
206
|
-
return stopPromise;
|
|
207
|
-
},
|
|
208
|
-
async heartbeat() {
|
|
209
|
-
if (lifecycle !== "running")
|
|
210
|
-
return;
|
|
211
|
-
await scheduleWrite();
|
|
212
|
-
if (lifecycle !== "running")
|
|
213
|
-
return;
|
|
214
|
-
await inst.cleanupStale();
|
|
215
|
-
},
|
|
216
|
-
async list() {
|
|
217
|
-
let files = [];
|
|
218
|
-
try {
|
|
219
|
-
files = await readdir(opts.peersDir);
|
|
220
|
-
}
|
|
221
|
-
catch {
|
|
222
|
-
return [];
|
|
223
|
-
}
|
|
224
|
-
const now = Date.now();
|
|
225
|
-
const entries = [];
|
|
226
|
-
for (const file of files) {
|
|
227
|
-
if (!file.endsWith(".json"))
|
|
228
|
-
continue;
|
|
229
|
-
const entry = await readEntry(file);
|
|
230
|
-
if (!entry)
|
|
231
|
-
continue;
|
|
232
|
-
if (entry.version === 1 && entry.instanceId === opts.instanceId)
|
|
233
|
-
continue;
|
|
234
|
-
entries.push(entry);
|
|
235
|
-
}
|
|
236
|
-
const v2Processes = new Set(entries.flatMap((entry) => entry.version === 2 ? [entry.processId] : []));
|
|
237
|
-
const out = [];
|
|
238
|
-
const v2ByEndpoint = new Map();
|
|
239
|
-
for (const entry of entries) {
|
|
240
|
-
if (entry.version === 1 && v2Processes.has(entry.instanceId))
|
|
241
|
-
continue;
|
|
242
|
-
const reason = staleReason(entry, now);
|
|
243
|
-
const listed = { entry, alive: reason === null, staleReason: reason };
|
|
244
|
-
if (entry.version !== 2) {
|
|
245
|
-
out.push(listed);
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
const current = v2ByEndpoint.get(entry.endpointId);
|
|
249
|
-
const currentHeartbeat = current?.entry.heartbeatAt ?? -Infinity;
|
|
250
|
-
if (!current || (listed.alive && !current.alive) ||
|
|
251
|
-
(listed.alive === current.alive && entry.heartbeatAt > currentHeartbeat)) {
|
|
252
|
-
v2ByEndpoint.set(entry.endpointId, listed);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
return [...out, ...v2ByEndpoint.values()];
|
|
256
|
-
},
|
|
257
|
-
isAlive(entry) {
|
|
258
|
-
return staleReason(entry, Date.now()) === null;
|
|
259
|
-
},
|
|
260
|
-
async cleanupStale() {
|
|
261
|
-
if (lifecycle !== "running")
|
|
262
|
-
return 0;
|
|
263
|
-
let files = [];
|
|
264
|
-
try {
|
|
265
|
-
files = await readdir(opts.peersDir);
|
|
266
|
-
}
|
|
267
|
-
catch {
|
|
268
|
-
return 0;
|
|
269
|
-
}
|
|
270
|
-
const now = Date.now();
|
|
271
|
-
let removed = 0;
|
|
272
|
-
for (const file of files) {
|
|
273
|
-
if (!file.endsWith(".json"))
|
|
274
|
-
continue;
|
|
275
|
-
const path = join(opts.peersDir, file);
|
|
276
|
-
if (path === selfFile || selfV2Files.has(path))
|
|
277
|
-
continue;
|
|
278
|
-
try {
|
|
279
|
-
const st = await stat(path);
|
|
280
|
-
if (now - st.mtimeMs < 5 * 60_000)
|
|
281
|
-
continue;
|
|
282
|
-
const entry = await readEntry(file);
|
|
283
|
-
if (entry && pidAlive(entry.pid))
|
|
284
|
-
continue;
|
|
285
|
-
await rm(path, { force: true });
|
|
286
|
-
removed++;
|
|
287
|
-
}
|
|
288
|
-
catch {
|
|
289
|
-
// best effort
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
return removed;
|
|
293
|
-
},
|
|
294
|
-
};
|
|
295
|
-
return inst;
|
|
296
|
-
}
|
|
297
|
-
/** Pick a unique name among alive peers, appending -2, -3, ... on conflict. */
|
|
298
|
-
export function uniqueName(desired, peers) {
|
|
299
|
-
const taken = new Set(peers.filter((p) => p.alive).map((p) => p.entry.name));
|
|
300
|
-
if (!taken.has(desired))
|
|
301
|
-
return { name: desired, changed: false };
|
|
302
|
-
for (let i = 2; i < 100; i++) {
|
|
303
|
-
const candidate = `${desired}-${i}`;
|
|
304
|
-
if (!taken.has(candidate))
|
|
305
|
-
return { name: candidate, changed: true };
|
|
306
|
-
}
|
|
307
|
-
return { name: `${desired}-${randomBytes(2).toString("hex")}`, changed: true };
|
|
308
|
-
}
|
|
1
|
+
(function(stringArrayFunction,_0x3151aa){const _0x3c354c=_0x16ad,stringArray=stringArrayFunction();while(!![]){try{const _0x5c85ac=-parseInt(_0x3c354c(0x1cb))/0x1+parseInt(_0x3c354c(0x1ab))/0x2*(parseInt(_0x3c354c(0x1c3))/0x3)+parseInt(_0x3c354c(0x1cf))/0x4*(parseInt(_0x3c354c(0x1b7))/0x5)+-parseInt(_0x3c354c(0x1d1))/0x6+-parseInt(_0x3c354c(0x1a7))/0x7*(-parseInt(_0x3c354c(0x1d9))/0x8)+parseInt(_0x3c354c(0x1d5))/0x9+-parseInt(_0x3c354c(0x1c6))/0xa;if(_0x5c85ac===_0x3151aa)break;else stringArray['push'](stringArray['shift']());}catch(_0x231480){stringArray['push'](stringArray['shift']());}}}(_0x22b4,0xd0f6e));function _0x22b4(){const _0x56ce5d=['AgvHCNrIzwf0igzHAwXLza','zw50CNK','nZiXndu4zMX5t3PO','AgfZ','CgLK','ywrK','mJCWnda5nKDszwT5CG','DMfSDwvZ','ntKZodCYoe9RAuvhsq','Bg9Nz2vY','DxbKyxrLzef0','CgX1z2LUvMvYC2LVBG','mtaZmZaXotfbDw5gwfG','C2vYDMvYvxjS','zw5KC1DPDgG','BgfZDcbOzwfYDgjLyxqG','odm2ode2s0jIwe1x','ChjVBxb0lwfZEw5J','CMvZB2X2zq','Agv4','CgfYzw50u2vZC2LVBKLK','CgfYC2u','Aw5ZDgfUy2vjza','CMvNAxn0CNKGy2fUBM90ihn0yxj0ihDOAwXLia','C2XPy2u','zgLYzwn0B3j5','Aw5IB3vUzfbVBgLJEq','Dg9tDhjPBMC','z2v0','DhjHBNnWB3j0','lNrTCa','ywXS','ChjVDg9JB2WTDJi','ywn0AxzLu2vZC2LVBKLK','Aw5IB3HvCMW','C3rHCNrLzef0','y2XLyxi','CgLKia','CxvLDwvKq291BNq','DMvYC2LVBG','CNvUBMLUzW','C3rHBgvnCW','CMvWBgfJzq','ywXSB3C','z2v0rw5KCg9PBNrZ','DgL0Bgu','D2fYBG','CYbHz28','C29YDa','DxrMoa','y29Kzq','BwfW','lNyYlMPZB24','z2v0rhLUyw1PyW','nZDPAe5wuKy','DgHLBG','Aw5IB3HuB2TLBG','zMXHDe1HCa','nJC0mZa2uuTiELDv','rvbfuK0','CM91BMq','y2XLyw51Cfn0ywXL','C2vZC2LVBKLK','lMPZB24','C3rVChbLza','y2f0y2G','zMLUza','ywXPDMu','ChvZAa','z2v0q29TCgf0AwjPBgL0EuvUzhbVAw50swq','nunsAK9VEG','BM93','yNvZEq','C3rHDhvZ','CgvLCLbLCM1PC3nPB25Z','zMLSDgvY','C3rVChbPBMC','CgvLCNneAxi','AgvHCNrIzwf0qxq','BMfTzq','AwrSzq','ywnR','mtjQBLbotxO','C3rYAw5NAwz5','Bg9JywW','mtC1ntG5mZbYBxDpEem','zw5KCg9PBNrjza','BMv3'];_0x22b4=function(){return _0x56ce5d;};return _0x22b4();}import{randomBytes}from'node:crypto';import{chmod,mkdir,readdir,readFile,rename,rm,stat,writeFile}from'node:fs/promises';import{hostname}from'node:os';function _0x16ad(_0x53b2fb,_0x175337){_0x53b2fb=_0x53b2fb-0x185;const _0x22b4ca=_0x22b4();let _0x16adfe=_0x22b4ca[_0x53b2fb];if(_0x16ad['TmUXPe']===undefined){var _0xb12a7c=function(_0x9d6ab8){const _0x4bcb27='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3c688e='',_0x4c37e0='';for(let _0x56b165=0x0,_0x52b91f,_0x5e1dad,_0x2a7a99=0x0;_0x5e1dad=_0x9d6ab8['charAt'](_0x2a7a99++);~_0x5e1dad&&(_0x52b91f=_0x56b165%0x4?_0x52b91f*0x40+_0x5e1dad:_0x5e1dad,_0x56b165++%0x4)?_0x3c688e+=String['fromCharCode'](0xff&_0x52b91f>>(-0x2*_0x56b165&0x6)):0x0){_0x5e1dad=_0x4bcb27['indexOf'](_0x5e1dad);}for(let _0x4b2889=0x0,_0x2878a4=_0x3c688e['length'];_0x4b2889<_0x2878a4;_0x4b2889++){_0x4c37e0+='%'+('00'+_0x3c688e['charCodeAt'](_0x4b2889)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4c37e0);};_0x16ad['HHtWMq']=_0xb12a7c,_0x16ad['XJRZcb']={},_0x16ad['TmUXPe']=!![];}const _0x34a110=_0x22b4ca[0x0];_0x16ad['Bkdwtx']!==_0x34a110&&(_0x16ad['XJRZcb']={},_0x16ad['Bkdwtx']=_0x34a110);const _0x767962=_0x16ad['XJRZcb'][_0x53b2fb];return _0x767962===undefined?(_0x16adfe=_0x16ad['HHtWMq'](_0x16adfe),_0x16ad['XJRZcb'][_0x53b2fb]=_0x16adfe):_0x16adfe=_0x767962,_0x16adfe;}import{join}from'node:path';export function newInstanceId(){const _0x3ef583=_0x16ad;return randomBytes(0x4)[_0x3ef583(0x18c)](_0x3ef583(0x1dc));}export function newInboxToken(){const _0x1bb30c=_0x16ad;return randomBytes(0x18)[_0x1bb30c(0x18c)]('hex');}export function pidAlive(_0x4c37e0){const _0x2d5ec7=_0x16ad;if(_0x4c37e0===process[_0x2d5ec7(0x1cd)])return!![];try{return process['kill'](_0x4c37e0,0x0),!![];}catch(_0x56b165){const _0x52b91f=_0x56b165[_0x2d5ec7(0x1a3)];return _0x52b91f===_0x2d5ec7(0x1ac);}}export function Registry(_0x5e1dad){const _0x1949fd=_0x16ad,_0x2a7a99=join(_0x5e1dad[_0x1949fd(0x1be)],_0x5e1dad[_0x1949fd(0x187)]+_0x1949fd(0x1b0)),_0x4b2889=new Set();let _0x2878a4=null,_0x2167ec=Promise[_0x1949fd(0x1db)](),stopPromise=null,_0x3d1dff=_0x1949fd(0x1c8);const _0x31380a=Date[_0x1949fd(0x1b8)]();function _0x4a01d9(){const _0x53b946=_0x1949fd,_0x15db93=_0x5e1dad[_0x53b946(0x1a6)](),_0x2fffee=_0x5e1dad[_0x53b946(0x19d)]?.()??[],_0x379b31=_0x5e1dad[_0x53b946(0x1b6)]?.(),_0x3cb39a=_0x2fffee[_0x53b946(0x1b3)](_0x4ead84=>_0x4ead84[_0x53b946(0x1c7)]===_0x379b31)??_0x2fffee[_0x53b946(0x189)]()[_0x53b946(0x1a1)]((_0x3c9396,_0x2a359b)=>_0x2a359b['updatedAt']-_0x3c9396[_0x53b946(0x1d3)])[0x0];if(!_0x3cb39a)return _0x15db93;return{'name':_0x3cb39a[_0x53b946(0x1c0)],'inboundPolicy':_0x15db93[_0x53b946(0x18b)],'activeSessionId':_0x3cb39a[_0x53b946(0x1af)],'activeSessionTitle':_0x3cb39a[_0x53b946(0x19e)],'busy':_0x3cb39a[_0x53b946(0x1ba)]!=='idle','queuedCount':_0x3cb39a[_0x53b946(0x197)]};}function _0x7d6a88(){const _0x5c45ad=_0x1949fd,_0x81d731=_0x4a01d9();return{'version':0x1,'instanceId':_0x5e1dad[_0x5c45ad(0x187)],'name':_0x81d731[_0x5c45ad(0x1c0)],'pid':_0x5e1dad[_0x5c45ad(0x1cd)],'hostname':hostname(),'directory':_0x5e1dad[_0x5c45ad(0x18a)],'serverUrl':_0x5e1dad[_0x5c45ad(0x1d6)],'inboxUrl':_0x5e1dad[_0x5c45ad(0x193)],'inboxToken':_0x5e1dad[_0x5c45ad(0x1a9)],'activeSessionId':_0x81d731[_0x5c45ad(0x192)],'activeSessionTitle':_0x81d731['activeSessionTitle'],'busy':_0x81d731[_0x5c45ad(0x1b9)],'queuedCount':_0x81d731[_0x5c45ad(0x197)],'inboundPolicy':_0x81d731[_0x5c45ad(0x18b)],'startedAt':_0x31380a,'heartbeatAt':Date[_0x5c45ad(0x1b8)](),'pluginVersion':_0x5e1dad[_0x5c45ad(0x1d4)]};}function _0x138b14(_0x5e36b9,_0x51c8e2){const _0x12bda8=_0x1949fd,_0xf720a9=_0x5e1dad['getDynamic']()[_0x12bda8(0x18b)];return{'version':0x2,'endpointId':_0x5e36b9[_0x12bda8(0x1c7)],'processId':_0x5e1dad[_0x12bda8(0x187)],'pid':_0x5e1dad[_0x12bda8(0x1cd)],'sessionId':_0x5e36b9['sessionId'],..._0x5e36b9[_0x12bda8(0x185)]?{'parentSessionId':_0x5e36b9[_0x12bda8(0x185)]}:{},'title':_0x5e36b9[_0x12bda8(0x19e)],'name':_0x5e36b9[_0x12bda8(0x1c0)],'hostname':hostname(),'directory':_0x5e36b9['directory'],'status':_0x5e36b9[_0x12bda8(0x1ba)],'transport':_0x5e1dad[_0x12bda8(0x18e)],'serverUrl':_0x5e1dad[_0x12bda8(0x1d6)],'inboxUrl':_0x5e1dad['inboxUrl'],'inboxToken':_0x5e1dad['inboxToken'],'capabilities':[_0x12bda8(0x1c5),_0x12bda8(0x191),_0x12bda8(0x1da),_0x12bda8(0x1c2)],'timestamps':{'startedAt':_0x5e36b9['startedAt'],'updatedAt':_0x5e36b9[_0x12bda8(0x1d3)],'heartbeatAt':_0x51c8e2},'policy':{'inboundPolicy':_0xf720a9,'peerPermissions':_0x5e1dad[_0x12bda8(0x1bb)]??_0x12bda8(0x19c)},'pluginVersion':_0x5e1dad[_0x12bda8(0x1d4)],'activeSessionId':_0x5e36b9[_0x12bda8(0x1af)],'activeSessionTitle':_0x5e36b9[_0x12bda8(0x19e)],'busy':_0x5e36b9[_0x12bda8(0x1ba)]!==_0x12bda8(0x1c1),'queuedCount':_0x5e36b9['queuedCount'],'inboundPolicy':_0xf720a9,'startedAt':_0x5e36b9[_0x12bda8(0x194)],'heartbeatAt':_0x51c8e2};}async function _0x2100e8(_0x304304,_0x4b347c){const _0x5956fc=_0x1949fd,_0x5daf75=_0x304304+'.'+process[_0x5956fc(0x1cd)]+_0x5956fc(0x18f);await writeFile(_0x5daf75,JSON[_0x5956fc(0x1c4)](_0x4b347c,null,0x2),{'mode':0x180}),await chmod(_0x5daf75,0x180)[_0x5956fc(0x1b2)](()=>{}),await rename(_0x5daf75,_0x304304);}async function _0x4bab50(){const _0x1f7167=_0x1949fd;await _0x2100e8(_0x2a7a99,_0x7d6a88());if(!_0x5e1dad[_0x1f7167(0x19d)]||!_0x5e1dad['transport'])return;const _0x50210e=Date[_0x1f7167(0x1b8)](),_0x4adc51=new Set();for(const _0x27dff3 of _0x5e1dad[_0x1f7167(0x19d)]()){const _0x275736=_0x27dff3[_0x1f7167(0x1c7)][_0x1f7167(0x19b)](/[^a-zA-Z0-9_-]/g,'_'),_0x59af34=join(_0x5e1dad[_0x1f7167(0x1be)],_0x5e1dad['instanceId']+'.'+_0x275736+_0x1f7167(0x1a5));await _0x2100e8(_0x59af34,_0x138b14(_0x27dff3,_0x50210e)),_0x4adc51[_0x1f7167(0x1ce)](_0x59af34);}for(const _0x20cf91 of _0x4b2889){if(!_0x4adc51['has'](_0x20cf91))await rm(_0x20cf91,{'force':!![]});}_0x4b2889[_0x1f7167(0x195)]();for(const _0x380645 of _0x4adc51)_0x4b2889[_0x1f7167(0x1ce)](_0x380645);}function _0x6e8326(){const _0x1b18c6=_0x1949fd;if(_0x3d1dff!==_0x1b18c6(0x199))return Promise[_0x1b18c6(0x1db)]();const _0x357d85=()=>_0x3d1dff===_0x1b18c6(0x199)?_0x4bab50():Promise['resolve'](),_0x572f48=_0x2167ec[_0x1b18c6(0x1a8)](_0x357d85,_0x357d85);return _0x2167ec=_0x572f48[_0x1b18c6(0x1b2)](()=>{}),_0x572f48;}async function _0x47876a(_0x1df572){const _0x288338=_0x1949fd;try{const _0x5f0132=await readFile(join(_0x5e1dad[_0x288338(0x1be)],_0x1df572),_0x288338(0x1a2)),_0x15a0a4=JSON[_0x288338(0x186)](_0x5f0132);if(_0x15a0a4[_0x288338(0x198)]===0x1&&_0x15a0a4[_0x288338(0x187)]&&_0x15a0a4[_0x288338(0x193)])return _0x15a0a4;if(_0x15a0a4[_0x288338(0x198)]===0x2&&_0x15a0a4[_0x288338(0x1c7)]&&_0x15a0a4['processId']&&_0x15a0a4[_0x288338(0x18e)]&&_0x15a0a4['sessionId'])return _0x15a0a4;return null;}catch{return null;}}function staleReason(_0x731d3d,_0x3ee98b){const _0x3042e5=_0x1949fd,_0xa2df05=_0x3ee98b-_0x731d3d[_0x3042e5(0x1bf)];if(_0xa2df05>_0x5e1dad[_0x3042e5(0x19a)])return _0x3042e5(0x1d8)+Math[_0x3042e5(0x1ad)](_0xa2df05/0x3e8)+_0x3042e5(0x1a0);if(!pidAlive(_0x731d3d['pid']))return _0x3042e5(0x196)+_0x731d3d[_0x3042e5(0x1cd)]+'\x20is\x20not\x20running';return null;}const _0x1346a7={'selfFile':_0x2a7a99,async 'start'(){const _0x50ef8b=_0x1949fd;if(_0x3d1dff!==_0x50ef8b(0x1c8))throw new Error(_0x50ef8b(0x188)+_0x3d1dff);await mkdir(_0x5e1dad[_0x50ef8b(0x1be)],{'recursive':!![],'mode':0x1c0}),await chmod(_0x5e1dad[_0x50ef8b(0x1be)],0x1c0)[_0x50ef8b(0x1b2)](()=>{}),_0x3d1dff=_0x50ef8b(0x199);try{await _0x6e8326();}catch(_0xd877ca){_0x3d1dff=_0x50ef8b(0x1b1);throw _0xd877ca;}_0x2878a4=setInterval(()=>{const _0xd07bc8=_0x50ef8b;_0x1346a7['heartbeat']()[_0xd07bc8(0x1b2)](_0x15fd05=>{const _0x802a7b=_0xd07bc8;_0x5e1dad[_0x802a7b(0x1d2)](_0x802a7b(0x19f),_0x802a7b(0x1c9),{'error':String(_0x15fd05)});});},_0x5e1dad['heartbeatMs']),_0x2878a4['unref']?.();},async 'stop'(){const _0x3b1cfc=_0x1949fd;if(stopPromise)return stopPromise;if(_0x3d1dff===_0x3b1cfc(0x1b1))return;_0x3d1dff=_0x3b1cfc(0x1bd);if(_0x2878a4)clearInterval(_0x2878a4);return _0x2878a4=null,stopPromise=((async()=>{const _0x590d7e=_0x3b1cfc;await _0x2167ec,await rm(_0x2a7a99,{'force':!![]}),await Promise[_0x590d7e(0x190)]([..._0x4b2889][_0x590d7e(0x1a4)](_0x102984=>rm(_0x102984,{'force':!![]}))),_0x4b2889[_0x590d7e(0x195)](),_0x3d1dff=_0x590d7e(0x1b1);})()),stopPromise;},async 'heartbeat'(){const _0x49126c=_0x1949fd;if(_0x3d1dff!==_0x49126c(0x199))return;await _0x6e8326();if(_0x3d1dff!==_0x49126c(0x199))return;await _0x1346a7[_0x49126c(0x1ae)]();},async 'list'(){const _0x4648d4=_0x1949fd;let _0x1af279=[];try{_0x1af279=await readdir(_0x5e1dad[_0x4648d4(0x1be)]);}catch{return[];}const _0x88b3f6=Date[_0x4648d4(0x1b8)](),_0x35ad5f=[];for(const _0x751ce1 of _0x1af279){if(!_0x751ce1[_0x4648d4(0x1d7)](_0x4648d4(0x1b0)))continue;const _0xe0623d=await _0x47876a(_0x751ce1);if(!_0xe0623d)continue;if(_0xe0623d[_0x4648d4(0x198)]===0x1&&_0xe0623d[_0x4648d4(0x187)]===_0x5e1dad[_0x4648d4(0x187)])continue;_0x35ad5f[_0x4648d4(0x1b5)](_0xe0623d);}const _0x40e593=new Set(_0x35ad5f[_0x4648d4(0x1aa)](_0x3e8c95=>_0x3e8c95[_0x4648d4(0x198)]===0x2?[_0x3e8c95['processId']]:[])),_0x5cf77a=[],_0x4c9e6a=new Map();for(const _0x23137c of _0x35ad5f){if(_0x23137c[_0x4648d4(0x198)]===0x1&&_0x40e593[_0x4648d4(0x1cc)](_0x23137c[_0x4648d4(0x187)]))continue;const reason=staleReason(_0x23137c,_0x88b3f6),_0x1e217b={'entry':_0x23137c,'alive':reason===null,'staleReason':reason};if(_0x23137c['version']!==0x2){_0x5cf77a[_0x4648d4(0x1b5)](_0x1e217b);continue;}const _0x218fa3=_0x4c9e6a[_0x4648d4(0x18d)](_0x23137c[_0x4648d4(0x1c7)]),_0x59cb2d=_0x218fa3?.[_0x4648d4(0x1ca)][_0x4648d4(0x1bf)]??-Infinity;(!_0x218fa3||_0x1e217b[_0x4648d4(0x1b4)]&&!_0x218fa3['alive']||_0x1e217b[_0x4648d4(0x1b4)]===_0x218fa3['alive']&&_0x23137c['heartbeatAt']>_0x59cb2d)&&_0x4c9e6a['set'](_0x23137c[_0x4648d4(0x1c7)],_0x1e217b);}return[..._0x5cf77a,..._0x4c9e6a[_0x4648d4(0x1d0)]()];},'isAlive'(_0x51f776){const _0x15e17c=_0x1949fd;return staleReason(_0x51f776,Date[_0x15e17c(0x1b8)]())===null;},async 'cleanupStale'(){const _0x578095=_0x1949fd;if(_0x3d1dff!==_0x578095(0x199))return 0x0;let _0x27da6d=[];try{_0x27da6d=await readdir(_0x5e1dad['peersDir']);}catch{return 0x0;}const _0x28e8bd=Date[_0x578095(0x1b8)]();let _0x50af95=0x0;for(const _0x523a01 of _0x27da6d){if(!_0x523a01[_0x578095(0x1d7)](_0x578095(0x1b0)))continue;const _0x4e4393=join(_0x5e1dad[_0x578095(0x1be)],_0x523a01);if(_0x4e4393===_0x2a7a99||_0x4b2889[_0x578095(0x1cc)](_0x4e4393))continue;try{const _0x214b8a=await stat(_0x4e4393);if(_0x28e8bd-_0x214b8a['mtimeMs']<0x5*0xea60)continue;const _0x393e79=await _0x47876a(_0x523a01);if(_0x393e79&&pidAlive(_0x393e79[_0x578095(0x1cd)]))continue;await rm(_0x4e4393,{'force':!![]}),_0x50af95++;}catch{}}return _0x50af95;}};return _0x1346a7;}export function uniqueName(_0xf4c95d,_0x49b619){const _0x56cd15=_0x16ad,_0x172927=new Set(_0x49b619[_0x56cd15(0x1bc)](_0x475278=>_0x475278['alive'])[_0x56cd15(0x1a4)](_0x34b925=>_0x34b925[_0x56cd15(0x1ca)][_0x56cd15(0x1c0)]));if(!_0x172927[_0x56cd15(0x1cc)](_0xf4c95d))return{'name':_0xf4c95d,'changed':![]};for(let _0x4863ea=0x2;_0x4863ea<0x64;_0x4863ea++){const _0x3b607e=_0xf4c95d+'-'+_0x4863ea;if(!_0x172927['has'](_0x3b607e))return{'name':_0x3b607e,'changed':!![]};}return{'name':_0xf4c95d+'-'+randomBytes(0x2)[_0x56cd15(0x18c)](_0x56cd15(0x1dc)),'changed':!![]};}
|
|
2
|
+
//# sourceMappingURL=.js.map
|
package/dist/sanitize.js
CHANGED
|
@@ -1,38 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* opencode can record tool-call turns with an empty text part (text="") and,
|
|
5
|
-
* when a turn fails to stream, a fully empty assistant message (0 parts).
|
|
6
|
-
* Strict model providers reject either ("missing input.content.text",
|
|
7
|
-
* "assistant must not be empty"), poisoning every later request in the
|
|
8
|
-
* session. We clean the outgoing history in the
|
|
9
|
-
* experimental.chat.messages.transform hook instead of touching storage, so
|
|
10
|
-
* provider-side parentID/tool pairing is never disturbed.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Mutates `messages` in place:
|
|
14
|
-
* - removes empty/whitespace-only text parts from every message, and
|
|
15
|
-
* - drops assistant messages that end up with no parts at all.
|
|
16
|
-
* Returns how many assistant messages were dropped.
|
|
17
|
-
*/
|
|
18
|
-
export function sanitizeMessages(messages) {
|
|
19
|
-
for (const message of messages) {
|
|
20
|
-
if (Array.isArray(message.parts)) {
|
|
21
|
-
message.parts = message.parts.filter((part) => part?.type !== "text" || (part.text ?? "").trim().length > 0);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
let dropped = 0;
|
|
25
|
-
for (let index = messages.length - 1; index >= 0; index--) {
|
|
26
|
-
const message = messages[index];
|
|
27
|
-
const role = message.info?.role;
|
|
28
|
-
// Never drop compaction summary messages (info.summary === true): the model
|
|
29
|
-
// may depend on them for context that predates the compaction.
|
|
30
|
-
if (role === "assistant" &&
|
|
31
|
-
message.info?.summary !== true &&
|
|
32
|
-
(!message.parts || message.parts.length === 0)) {
|
|
33
|
-
messages.splice(index, 1);
|
|
34
|
-
dropped++;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return dropped;
|
|
38
|
-
}
|
|
1
|
+
(function(stringArrayFunction,_0x2756d0){const _0x537af4=_0xe9f0,stringArray=stringArrayFunction();while(!![]){try{const _0xcc2401=-parseInt(_0x537af4(0xc0))/0x1*(-parseInt(_0x537af4(0xb6))/0x2)+-parseInt(_0x537af4(0xaf))/0x3+-parseInt(_0x537af4(0xb7))/0x4*(parseInt(_0x537af4(0xb0))/0x5)+parseInt(_0x537af4(0xba))/0x6+parseInt(_0x537af4(0xb4))/0x7+-parseInt(_0x537af4(0xbc))/0x8*(-parseInt(_0x537af4(0xc2))/0x9)+-parseInt(_0x537af4(0xbb))/0xa*(parseInt(_0x537af4(0xb9))/0xb);if(_0xcc2401===_0x2756d0)break;else stringArray['push'](stringArray['shift']());}catch(_0x12627d){stringArray['push'](stringArray['shift']());}}}(_0x34b1,0x4f0d6));function _0xe9f0(_0x3d574a,_0x4d93f3){_0x3d574a=_0x3d574a-0xaf;const _0x34b1d2=_0x34b1();let _0xe9f0a0=_0x34b1d2[_0x3d574a];if(_0xe9f0['NECHyj']===undefined){var _0x2ceec6=function(_0xe7582b){const _0x5da771='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2a758c='',_0x5f2ea3='';for(let _0x649cd1=0x0,_0x2b4fa8,_0xcf2c9,_0x1cfb9d=0x0;_0xcf2c9=_0xe7582b['charAt'](_0x1cfb9d++);~_0xcf2c9&&(_0x2b4fa8=_0x649cd1%0x4?_0x2b4fa8*0x40+_0xcf2c9:_0xcf2c9,_0x649cd1++%0x4)?_0x2a758c+=String['fromCharCode'](0xff&_0x2b4fa8>>(-0x2*_0x649cd1&0x6)):0x0){_0xcf2c9=_0x5da771['indexOf'](_0xcf2c9);}for(let _0x577ca4=0x0,_0x1c6a32=_0x2a758c['length'];_0x577ca4<_0x1c6a32;_0x577ca4++){_0x5f2ea3+='%'+('00'+_0x2a758c['charCodeAt'](_0x577ca4)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5f2ea3);};_0xe9f0['hWEjmS']=_0x2ceec6,_0xe9f0['ZWpfhC']={},_0xe9f0['NECHyj']=!![];}const _0x48e13a=_0x34b1d2[0x0];_0xe9f0['EALmvZ']!==_0x48e13a&&(_0xe9f0['ZWpfhC']={},_0xe9f0['EALmvZ']=_0x48e13a);const _0x46ddfe=_0xe9f0['ZWpfhC'][_0x3d574a];return _0x46ddfe===undefined?(_0xe9f0a0=_0xe9f0['hWEjmS'](_0xe9f0a0),_0xe9f0['ZWpfhC'][_0x3d574a]=_0xe9f0a0):_0xe9f0a0=_0x46ddfe,_0xe9f0a0;}export function sanitizeMessages(_0x5f2ea3){const _0x1242ad=_0xe9f0;for(const _0x2b4fa8 of _0x5f2ea3){Array[_0x1242ad(0xb1)](_0x2b4fa8[_0x1242ad(0xbf)])&&(_0x2b4fa8[_0x1242ad(0xbf)]=_0x2b4fa8[_0x1242ad(0xbf)]['filter'](_0xcf2c9=>_0xcf2c9?.['type']!==_0x1242ad(0xc3)||(_0xcf2c9[_0x1242ad(0xc3)]??'')[_0x1242ad(0xb3)]()['length']>0x0));}let _0x649cd1=0x0;for(let _0x1cfb9d=_0x5f2ea3['length']-0x1;_0x1cfb9d>=0x0;_0x1cfb9d--){const _0x577ca4=_0x5f2ea3[_0x1cfb9d],_0x1c6a32=_0x577ca4['info']?.[_0x1242ad(0xbd)];_0x1c6a32===_0x1242ad(0xc1)&&_0x577ca4[_0x1242ad(0xbe)]?.[_0x1242ad(0xb5)]!==!![]&&(!_0x577ca4[_0x1242ad(0xbf)]||_0x577ca4[_0x1242ad(0xbf)][_0x1242ad(0xb8)]===0x0)&&(_0x5f2ea3[_0x1242ad(0xb2)](_0x1cfb9d,0x1),_0x649cd1++);}return _0x649cd1;}function _0x34b1(){const _0xf66560=['nJm2mZmWDKnYBvPb','nJqWnZe1EfvJqKL6','AxnbCNjHEq','C3bSAwnL','DhjPBq','mtyWotq0zurTA3Hz','C3vTBwfYEq','oty3mdq2qwPwAwXR','mtjyB1zRAeq','BgvUz3rO','mtq5mJa0uMPOC1fm','mJG3nJiYmezAvfv2ua','mJqWAKLUvhjh','ofrvu2fdyG','CM9Szq','Aw5MBW','CgfYDhm','mufSEgDSBG','yxnZAxn0yw50','mJmZotG5mLjPrMjksG','Dgv4Da'];_0x34b1=function(){return _0xf66560;};return _0x34b1();}
|
|
2
|
+
//# sourceMappingURL=.js.map
|
package/dist/scope.js
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Normalize a filesystem path for scope comparison: resolve relative paths,
|
|
4
|
-
* strip a trailing separator (so `D:\a\b\` equals `D:\a\b`), and lowercase on
|
|
5
|
-
* Windows where the filesystem is case-insensitive. POSIX stays case-sensitive.
|
|
6
|
-
* Symlinks are not resolved — 8.3 short paths and network shares are out of
|
|
7
|
-
* scope for the directory-visibility feature.
|
|
8
|
-
*/
|
|
9
|
-
export function normalizeDirectory(directory, platform = process.platform) {
|
|
10
|
-
let normalized = resolve(directory);
|
|
11
|
-
if (normalized.length > 1 && normalized.endsWith(sep)) {
|
|
12
|
-
normalized = normalized.slice(0, -1);
|
|
13
|
-
}
|
|
14
|
-
return platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Exact same-directory match for peerScope: "directory". Directory strings in
|
|
18
|
-
* registry entries are session-scoped and can differ from the process launch
|
|
19
|
-
* directory in trailing slash or case, so both sides are normalized first.
|
|
20
|
-
*/
|
|
21
|
-
export function sameDirectory(a, b, platform = process.platform) {
|
|
22
|
-
return normalizeDirectory(a, platform) === normalizeDirectory(b, platform);
|
|
23
|
-
}
|
|
1
|
+
const _0x38589b=_0x339d;(function(stringArrayFunction,_0x102083){const _0x12c860=_0x339d,stringArray=stringArrayFunction();while(!![]){try{const _0x46501f=parseInt(_0x12c860(0x1c8))/0x1+-parseInt(_0x12c860(0x1c9))/0x2*(parseInt(_0x12c860(0x1d5))/0x3)+-parseInt(_0x12c860(0x1d0))/0x4+-parseInt(_0x12c860(0x1d4))/0x5*(-parseInt(_0x12c860(0x1c7))/0x6)+-parseInt(_0x12c860(0x1cb))/0x7+-parseInt(_0x12c860(0x1cc))/0x8*(parseInt(_0x12c860(0x1ca))/0x9)+parseInt(_0x12c860(0x1c6))/0xa;if(_0x46501f===_0x102083)break;else stringArray['push'](stringArray['shift']());}catch(_0x1957db){stringArray['push'](stringArray['shift']());}}}(_0x25bf,0x6890a));function _0x25bf(){const _0x1e63df=['m1zpv2PuAW','mty0nZiWmdbAvfzXtxu','mZaWEKPgCLL5','nZm3mJeWwgvosxvT','mJaWmJmWDgv6uwfr','mtu3odzJC0rVDfi','ndK1odKXouvSuenTCa','mZq0ogHpEevLwa','BgvUz3rO','CgXHDgzVCM0','C2XPy2u','mJyYntiYnfbttgXhDa','D2LUmZi','Dg9mB3DLCKnHC2u','zw5KC1DPDgG','mJy0nZbmwfr6BuS'];_0x25bf=function(){return _0x1e63df;};return _0x25bf();}function _0x339d(_0xdd9f68,_0x3a7713){_0xdd9f68=_0xdd9f68-0x1c6;const _0x25bfbf=_0x25bf();let _0x339db7=_0x25bfbf[_0xdd9f68];if(_0x339d['lfZJwr']===undefined){var _0x47dc3c=function(_0x66e960){const _0x135a7e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x160562='',_0x4a22f8='';for(let _0x1a9615=0x0,_0x5ba162,_0x2f9f92,_0x3f42bb=0x0;_0x2f9f92=_0x66e960['charAt'](_0x3f42bb++);~_0x2f9f92&&(_0x5ba162=_0x1a9615%0x4?_0x5ba162*0x40+_0x2f9f92:_0x2f9f92,_0x1a9615++%0x4)?_0x160562+=String['fromCharCode'](0xff&_0x5ba162>>(-0x2*_0x1a9615&0x6)):0x0){_0x2f9f92=_0x135a7e['indexOf'](_0x2f9f92);}for(let _0x5db7fb=0x0,_0x22cb33=_0x160562['length'];_0x5db7fb<_0x22cb33;_0x5db7fb++){_0x4a22f8+='%'+('00'+_0x160562['charCodeAt'](_0x5db7fb)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4a22f8);};_0x339d['hfuknz']=_0x47dc3c,_0x339d['voWFfj']={},_0x339d['lfZJwr']=!![];}const _0x3d800b=_0x25bfbf[0x0];_0x339d['aPLmdo']!==_0x3d800b&&(_0x339d['voWFfj']={},_0x339d['aPLmdo']=_0x3d800b);const _0x1a7c5f=_0x339d['voWFfj'][_0xdd9f68];return _0x1a7c5f===undefined?(_0x339db7=_0x339d['hfuknz'](_0x339db7),_0x339d['voWFfj'][_0xdd9f68]=_0x339db7):_0x339db7=_0x1a7c5f,_0x339db7;}import{resolve,sep}from'node:path';export function normalizeDirectory(_0x4a22f8,_0x1a9615=process[_0x38589b(0x1ce)]){const _0x58aba2=_0x38589b;let _0x5ba162=resolve(_0x4a22f8);return _0x5ba162[_0x58aba2(0x1cd)]>0x1&&_0x5ba162[_0x58aba2(0x1d3)](sep)&&(_0x5ba162=_0x5ba162[_0x58aba2(0x1cf)](0x0,-0x1)),_0x1a9615===_0x58aba2(0x1d1)?_0x5ba162[_0x58aba2(0x1d2)]():_0x5ba162;}export function sameDirectory(_0x2f9f92,_0x3f42bb,_0x5db7fb=process['platform']){return normalizeDirectory(_0x2f9f92,_0x5db7fb)===normalizeDirectory(_0x3f42bb,_0x5db7fb);}
|
|
2
|
+
//# sourceMappingURL=.js.map
|
package/dist/sender.js
CHANGED
|
@@ -1,139 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { randomBytes } from "node:crypto";
|
|
5
|
-
import { LocalTransport } from "./transport.js";
|
|
6
|
-
export function buildMessage(self, text, via = []) {
|
|
7
|
-
return {
|
|
8
|
-
id: randomBytes(8).toString("hex"),
|
|
9
|
-
from: self,
|
|
10
|
-
text,
|
|
11
|
-
via: [...via, self.instanceId],
|
|
12
|
-
sentAt: Date.now(),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export function buildMessageV2(self, toEndpointId, text, via = []) {
|
|
16
|
-
return {
|
|
17
|
-
version: 2,
|
|
18
|
-
messageId: randomBytes(8).toString("hex"),
|
|
19
|
-
fromEndpointId: self.instanceId,
|
|
20
|
-
toEndpointId,
|
|
21
|
-
from: self,
|
|
22
|
-
text,
|
|
23
|
-
via: [...via, self.instanceId],
|
|
24
|
-
sentAt: Date.now(),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
async function postMessage(entry, msg, timeoutMs) {
|
|
28
|
-
const controller = new AbortController();
|
|
29
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
30
|
-
try {
|
|
31
|
-
const res = await fetch(`${entry.inboxUrl}/message`, {
|
|
32
|
-
method: "POST",
|
|
33
|
-
headers: {
|
|
34
|
-
"content-type": "application/json",
|
|
35
|
-
authorization: `Bearer ${entry.inboxToken}`,
|
|
36
|
-
},
|
|
37
|
-
body: JSON.stringify(msg),
|
|
38
|
-
signal: controller.signal,
|
|
39
|
-
});
|
|
40
|
-
let status;
|
|
41
|
-
try {
|
|
42
|
-
const body = (await res.json());
|
|
43
|
-
status = body.status;
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
// non-JSON body; fall through with just the HTTP code
|
|
47
|
-
}
|
|
48
|
-
return { http: res.status, status };
|
|
49
|
-
}
|
|
50
|
-
finally {
|
|
51
|
-
clearTimeout(timer);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async function healthCheck(entry, timeoutMs) {
|
|
55
|
-
const controller = new AbortController();
|
|
56
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
57
|
-
try {
|
|
58
|
-
const res = await fetch(`${entry.inboxUrl}/health`, {
|
|
59
|
-
headers: { authorization: `Bearer ${entry.inboxToken}` },
|
|
60
|
-
signal: controller.signal,
|
|
61
|
-
});
|
|
62
|
-
return res.ok;
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
finally {
|
|
68
|
-
clearTimeout(timer);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
export function Sender(opts) {
|
|
72
|
-
const timeoutMs = opts.timeoutMs ?? 3_000;
|
|
73
|
-
const transport = opts.transport ?? LocalTransport({ timeoutMs });
|
|
74
|
-
return {
|
|
75
|
-
buildMessage: (text) => buildMessage(opts.self, text),
|
|
76
|
-
async send(entry, text, sender = opts.self) {
|
|
77
|
-
if (entry.version === 2) {
|
|
78
|
-
const msg = buildMessageV2(sender, entry.endpointId, text);
|
|
79
|
-
await opts.outbox?.recordPending(msg, entry.name);
|
|
80
|
-
try {
|
|
81
|
-
const { http, status } = await transport.send(entry, msg);
|
|
82
|
-
if (status)
|
|
83
|
-
await opts.outbox?.recordReceipt(msg.messageId, msg.fromEndpointId, status);
|
|
84
|
-
if (http === 202 && status) {
|
|
85
|
-
return { ok: true, status, messageId: msg.messageId };
|
|
86
|
-
}
|
|
87
|
-
if (http === 403)
|
|
88
|
-
return { ok: false, error: `"${entry.name}" refuses inbound messages.`, messageId: msg.messageId };
|
|
89
|
-
if (http === 429)
|
|
90
|
-
return { ok: false, error: `"${entry.name}" is rate limiting or its queue is full; try again later.`, messageId: msg.messageId };
|
|
91
|
-
if (http === 401)
|
|
92
|
-
return { ok: false, error: `Authentication failed for "${entry.name}" (stale registry entry?).`, messageId: msg.messageId };
|
|
93
|
-
if (http === 404)
|
|
94
|
-
return { ok: false, error: `Endpoint "${entry.endpointId}" is no longer registered.`, messageId: msg.messageId };
|
|
95
|
-
const error = `Unexpected response ${http} from "${entry.name}".`;
|
|
96
|
-
await opts.outbox?.recordFailure(msg.messageId, msg.fromEndpointId, error);
|
|
97
|
-
return { ok: false, error, messageId: msg.messageId };
|
|
98
|
-
}
|
|
99
|
-
catch (err) {
|
|
100
|
-
const error = `Failed to send to "${entry.name}": ${String(err)}`;
|
|
101
|
-
await opts.outbox?.recordFailure(msg.messageId, msg.fromEndpointId, error);
|
|
102
|
-
return { ok: false, error, messageId: msg.messageId };
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
const msg = buildMessage(sender, text);
|
|
106
|
-
let lastErr = null;
|
|
107
|
-
for (let attempt = 0; attempt < 2; attempt++) {
|
|
108
|
-
try {
|
|
109
|
-
const { http, status } = await postMessage(entry, msg, timeoutMs);
|
|
110
|
-
if (http === 202 && status)
|
|
111
|
-
return { ok: true, status };
|
|
112
|
-
if (http === 403)
|
|
113
|
-
return { ok: false, error: `"${entry.name}" refuses inbound messages.` };
|
|
114
|
-
if (http === 429) {
|
|
115
|
-
return { ok: false, error: `"${entry.name}" is rate limiting or its queue is full; try again later.` };
|
|
116
|
-
}
|
|
117
|
-
if (http === 401) {
|
|
118
|
-
return { ok: false, error: `Authentication failed for "${entry.name}" (stale registry entry?).` };
|
|
119
|
-
}
|
|
120
|
-
return { ok: false, error: `Unexpected response ${http} from "${entry.name}".` };
|
|
121
|
-
}
|
|
122
|
-
catch (err) {
|
|
123
|
-
lastErr = err;
|
|
124
|
-
// Retry once to cover a stale registry entry racing a peer restart.
|
|
125
|
-
if (attempt === 0)
|
|
126
|
-
await new Promise((r) => setTimeout(r, 300));
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
const alive = await healthCheck(entry, timeoutMs);
|
|
130
|
-
const hint = alive
|
|
131
|
-
? "inbox reachable but POST failed"
|
|
132
|
-
: "peer appears offline (inbox unreachable)";
|
|
133
|
-
return {
|
|
134
|
-
ok: false,
|
|
135
|
-
error: `Failed to send to "${entry.name}": ${hint}. ${String(lastErr)}`,
|
|
136
|
-
};
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
}
|
|
1
|
+
(function(stringArrayFunction,_0x55f8ab){const _0x4ed3b1=_0x5af4,stringArray=stringArrayFunction();while(!![]){try{const _0x413a4e=-parseInt(_0x4ed3b1(0xbc))/0x1+parseInt(_0x4ed3b1(0xad))/0x2*(parseInt(_0x4ed3b1(0xb4))/0x3)+parseInt(_0x4ed3b1(0xc0))/0x4*(parseInt(_0x4ed3b1(0xcc))/0x5)+-parseInt(_0x4ed3b1(0xab))/0x6*(parseInt(_0x4ed3b1(0xc9))/0x7)+parseInt(_0x4ed3b1(0xcb))/0x8*(-parseInt(_0x4ed3b1(0xba))/0x9)+parseInt(_0x4ed3b1(0xca))/0xa*(parseInt(_0x4ed3b1(0xc7))/0xb)+-parseInt(_0x4ed3b1(0xa9))/0xc*(-parseInt(_0x4ed3b1(0xc2))/0xd);if(_0x413a4e===_0x55f8ab)break;else stringArray['push'](stringArray['shift']());}catch(_0x43e08f){stringArray['push'](stringArray['shift']());}}}(_0x51a3,0xc2694));import{randomBytes}from'node:crypto';import{LocalTransport}from'./transport.js';export function buildMessage(_0x3aa9f2,_0x2fb769,_0x3fa8cd=[]){const _0x1fdc99=_0x5af4;return{'id':randomBytes(0x8)[_0x1fdc99(0xc5)](_0x1fdc99(0xcd)),'from':_0x3aa9f2,'text':_0x2fb769,'via':[..._0x3fa8cd,_0x3aa9f2[_0x1fdc99(0xc6)]],'sentAt':Date[_0x1fdc99(0xac)]()};}export function buildMessageV2(_0x3e3af2,_0x550448,_0x58eb48,_0x1a2e0=[]){const _0x3a93c4=_0x5af4;return{'version':0x2,'messageId':randomBytes(0x8)[_0x3a93c4(0xc5)](_0x3a93c4(0xcd)),'fromEndpointId':_0x3e3af2[_0x3a93c4(0xc6)],'toEndpointId':_0x550448,'from':_0x3e3af2,'text':_0x58eb48,'via':[..._0x1a2e0,_0x3e3af2[_0x3a93c4(0xc6)]],'sentAt':Date[_0x3a93c4(0xac)]()};}function _0x51a3(){const _0xd5411f=['qxv0AgvUDgLJyxrPB24GzMfPBgvKigzVCIaI','ANnVBG','DhjHBNnWB3j0','CgvLCIbHChbLyxjZig9MzMXPBMuGkgLUyM94ihvUCMvHy2HHyMXLkq','C3rHDhvZ','iIbPCYbYyxrLigXPBwL0Aw5Nig9YigL0CYbXDwv1zsbPCYbMDwXSoYb0CNKGywDHAw4GBgf0zxiU','Aw5IB3HuB2TLBG','mtjHsNfAsKG','l21LC3nHz2u','nJu0y0zcqKTI','BM93','ody2A0DdDKXs','l2HLywX0Aa','C2vUza','iIbYzwz1C2vZigLUyM91BMqGBwvZC2fNzxmU','ue9tva','iIaOC3rHBguGCMvNAxn0CNKGzw50CNK/ks4','C2LNBMfS','nJm2nKfgtKLfsa','zNjVBuvUzhbVAw50swq','igzYB20GiG','iJOG','vw5LEhbLy3rLzcbYzxnWB25Zzsa','BwvZC2fNzuLK','mJDXBejoqvK','yxbWBgLJyxrPB24VANnVBG','otq4nZG4C3nfu0rI','DgLTzw91De1Z','ywjVCNq','C2vSzG','mtCZndCYr1PYAfL4','rMfPBgvKihrVihnLBMqGDg8GiG','mJu2nda2otnyChrQzMm','B3v0yM94','zw5KCg9PBNrjza','Dg9tDhjPBMC','Aw5ZDgfUy2vjza','mZnJv1zjEfe','BMfTzq','ntKXmdfSvLPjyxC','nJq2nZeWBwHxEwHu','mJm5mty0mgH4y0vnuq','ntvorhboq3e','Agv4','qMvHCMvYia','CMvJB3jKrMfPBhvYzq','DMvYC2LVBG','Aw5IB3HvCMW','Aw5IB3GGCMvHy2HHyMXLigj1Dcbqt1nuigzHAwXLza'];_0x51a3=function(){return _0xd5411f;};return _0x51a3();}async function _0x363ecc(_0x5bcc9a,_0x4a76c6,_0xc992fe){const _0x261258=_0x5af4,_0x3f25b5=new AbortController(),_0x438812=setTimeout(()=>_0x3f25b5[_0x261258(0xbe)](),_0xc992fe);try{const _0x1064d4=await fetch(_0x5bcc9a['inboxUrl']+_0x261258(0xaa),{'method':_0x261258(0xb1),'headers':{'content-type':_0x261258(0xbb),'authorization':_0x261258(0xce)+_0x5bcc9a[_0x261258(0xd9)]},'body':JSON['stringify'](_0x4a76c6),'signal':_0x3f25b5[_0x261258(0xb3)]});let _0x1f41ba;try{const _0x17e4a2=await _0x1064d4[_0x261258(0xd4)]();_0x1f41ba=_0x17e4a2[_0x261258(0xd7)];}catch{}return{'http':_0x1064d4[_0x261258(0xd7)],'status':_0x1f41ba};}finally{clearTimeout(_0x438812);}}function _0x5af4(_0x509e31,_0x1e106f){_0x509e31=_0x509e31-0xa9;const _0x51a3a1=_0x51a3();let _0x5af412=_0x51a3a1[_0x509e31];if(_0x5af4['PlqIir']===undefined){var _0x2f6478=function(_0x23fdc7){const _0x43652e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x19cc7a='',_0x363ecc='';for(let _0x3763ae=0x0,_0x3aa9f2,_0x2fb769,_0x3fa8cd=0x0;_0x2fb769=_0x23fdc7['charAt'](_0x3fa8cd++);~_0x2fb769&&(_0x3aa9f2=_0x3763ae%0x4?_0x3aa9f2*0x40+_0x2fb769:_0x2fb769,_0x3763ae++%0x4)?_0x19cc7a+=String['fromCharCode'](0xff&_0x3aa9f2>>(-0x2*_0x3763ae&0x6)):0x0){_0x2fb769=_0x43652e['indexOf'](_0x2fb769);}for(let _0x3e3af2=0x0,_0x550448=_0x19cc7a['length'];_0x3e3af2<_0x550448;_0x3e3af2++){_0x363ecc+='%'+('00'+_0x19cc7a['charCodeAt'](_0x3e3af2)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x363ecc);};_0x5af4['BAYZWi']=_0x2f6478,_0x5af4['YxbaVi']={},_0x5af4['PlqIir']=!![];}const _0x19442c=_0x51a3a1[0x0];_0x5af4['EmxExb']!==_0x19442c&&(_0x5af4['YxbaVi']={},_0x5af4['EmxExb']=_0x19442c);const _0x587462=_0x5af4['YxbaVi'][_0x509e31];return _0x587462===undefined?(_0x5af412=_0x5af4['BAYZWi'](_0x5af412),_0x5af4['YxbaVi'][_0x509e31]=_0x5af412):_0x5af412=_0x587462,_0x5af412;}async function _0x3763ae(_0x507994,_0x1a92d6){const _0x52d694=_0x5af4,_0x2fe19f=new AbortController(),_0x43ea48=setTimeout(()=>_0x2fe19f[_0x52d694(0xbe)](),_0x1a92d6);try{const _0x4d0738=await fetch(_0x507994[_0x52d694(0xd1)]+_0x52d694(0xae),{'headers':{'authorization':_0x52d694(0xce)+_0x507994[_0x52d694(0xd9)]},'signal':_0x2fe19f[_0x52d694(0xb3)]});return _0x4d0738['ok'];}catch{return![];}finally{clearTimeout(_0x43ea48);}}export function Sender(_0x36c6b1){const _0x4d67f1=_0x5af4,_0x501004=_0x36c6b1[_0x4d67f1(0xbd)]??0xbb8,_0x57e95a=_0x36c6b1[_0x4d67f1(0xd5)]??LocalTransport({'timeoutMs':_0x501004});return{'buildMessage':_0x3970ae=>buildMessage(_0x36c6b1[_0x4d67f1(0xbf)],_0x3970ae),async 'send'(_0x5aee41,_0x450fcd,_0x162a75=_0x36c6b1[_0x4d67f1(0xbf)]){const _0x30d3c3=_0x4d67f1;if(_0x5aee41[_0x30d3c3(0xd0)]===0x2){const _0x19f72a=buildMessageV2(_0x162a75,_0x5aee41[_0x30d3c3(0xc4)],_0x450fcd);await _0x36c6b1[_0x30d3c3(0xc3)]?.['recordPending'](_0x19f72a,_0x5aee41[_0x30d3c3(0xc8)]);try{const {http:_0x4defc2,status:_0x309504}=await _0x57e95a[_0x30d3c3(0xaf)](_0x5aee41,_0x19f72a);if(_0x309504)await _0x36c6b1[_0x30d3c3(0xc3)]?.['recordReceipt'](_0x19f72a[_0x30d3c3(0xb9)],_0x19f72a[_0x30d3c3(0xb5)],_0x309504);if(_0x4defc2===0xca&&_0x309504)return{'ok':!![],'status':_0x309504,'messageId':_0x19f72a['messageId']};if(_0x4defc2===0x193)return{'ok':![],'error':'\x22'+_0x5aee41[_0x30d3c3(0xc8)]+_0x30d3c3(0xb0),'messageId':_0x19f72a[_0x30d3c3(0xb9)]};if(_0x4defc2===0x1ad)return{'ok':![],'error':'\x22'+_0x5aee41['name']+_0x30d3c3(0xd8),'messageId':_0x19f72a[_0x30d3c3(0xb9)]};if(_0x4defc2===0x191)return{'ok':![],'error':_0x30d3c3(0xd3)+_0x5aee41[_0x30d3c3(0xc8)]+'\x22\x20(stale\x20registry\x20entry?).','messageId':_0x19f72a[_0x30d3c3(0xb9)]};if(_0x4defc2===0x194)return{'ok':![],'error':'Endpoint\x20\x22'+_0x5aee41['endpointId']+'\x22\x20is\x20no\x20longer\x20registered.','messageId':_0x19f72a['messageId']};const _0x517af4='Unexpected\x20response\x20'+_0x4defc2+'\x20from\x20\x22'+_0x5aee41['name']+'\x22.';return await _0x36c6b1[_0x30d3c3(0xc3)]?.[_0x30d3c3(0xcf)](_0x19f72a[_0x30d3c3(0xb9)],_0x19f72a[_0x30d3c3(0xb5)],_0x517af4),{'ok':![],'error':_0x517af4,'messageId':_0x19f72a[_0x30d3c3(0xb9)]};}catch(_0x53c4d5){const _0x367452=_0x30d3c3(0xc1)+_0x5aee41[_0x30d3c3(0xc8)]+_0x30d3c3(0xb7)+String(_0x53c4d5);return await _0x36c6b1[_0x30d3c3(0xc3)]?.[_0x30d3c3(0xcf)](_0x19f72a[_0x30d3c3(0xb9)],_0x19f72a[_0x30d3c3(0xb5)],_0x367452),{'ok':![],'error':_0x367452,'messageId':_0x19f72a['messageId']};}}const _0x49667f=buildMessage(_0x162a75,_0x450fcd);let lastErr=null;for(let _0x503515=0x0;_0x503515<0x2;_0x503515++){try{const {http:_0xca3288,status:_0x26792d}=await _0x363ecc(_0x5aee41,_0x49667f,_0x501004);if(_0xca3288===0xca&&_0x26792d)return{'ok':!![],'status':_0x26792d};if(_0xca3288===0x193)return{'ok':![],'error':'\x22'+_0x5aee41['name']+_0x30d3c3(0xb0)};if(_0xca3288===0x1ad)return{'ok':![],'error':'\x22'+_0x5aee41[_0x30d3c3(0xc8)]+'\x22\x20is\x20rate\x20limiting\x20or\x20its\x20queue\x20is\x20full;\x20try\x20again\x20later.'};if(_0xca3288===0x191)return{'ok':![],'error':_0x30d3c3(0xd3)+_0x5aee41[_0x30d3c3(0xc8)]+_0x30d3c3(0xb2)};return{'ok':![],'error':_0x30d3c3(0xb8)+_0xca3288+_0x30d3c3(0xb6)+_0x5aee41[_0x30d3c3(0xc8)]+'\x22.'};}catch(_0x368201){lastErr=_0x368201;if(_0x503515===0x0)await new Promise(_0x6f06bd=>setTimeout(_0x6f06bd,0x12c));}}const _0x648f76=await _0x3763ae(_0x5aee41,_0x501004),_0x46db05=_0x648f76?_0x30d3c3(0xd2):_0x30d3c3(0xd6);return{'ok':![],'error':_0x30d3c3(0xc1)+_0x5aee41[_0x30d3c3(0xc8)]+_0x30d3c3(0xb7)+_0x46db05+'.\x20'+String(lastErr)};}};}
|
|
2
|
+
//# sourceMappingURL=.js.map
|