@openclaw/acpx 2026.10.10-beta.5 → 2026.11.5-beta.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/.setup/{config-D0ATuiVJ.mjs → config-Cplh34lQ.mjs} +19 -31
- package/dist/.setup/{harness-attempt-lu4_bMfd.mjs → harness-attempt-Co9oLpPg.mjs} +6 -6
- package/dist/.setup/{pi-session-catalog-runtime-BAM1pEMw.mjs → pi-session-catalog-runtime-DgzkbadO.mjs} +39 -65
- package/dist/.setup/{pi-session-paths-CIvyk6KB.mjs → pi-session-paths-pUr6hnVA.mjs} +4 -6
- package/dist/.setup/{runtime-doctor-migrations-hxP-CXX7.mjs → runtime-doctor-migrations-CSvRANPN.mjs} +5 -10
- package/dist/.setup/{service-c789tPe9.mjs → service-DmgP1gPb.mjs} +147 -397
- package/dist/.setup/{session-owner-migration-duvwZfxk.mjs → session-owner-migration-CQA7L68K.mjs} +17 -17
- package/dist/.setup/{session-resource-DKJsUJPu.mjs → session-resource-D_tXKvcv.mjs} +4 -5
- package/dist/.source-module-urls/9369b1b274d2ba70ea21d859abb3415ad8d63d0a1022a301763b953a5798469e.json +1 -0
- package/dist/doctor-contract-api.js +19 -14
- package/dist/index.js +210 -29
- package/dist/setup-api.js +1 -2
- package/openclaw.plugin.json +28 -1
- package/package.json +10 -10
- package/dist/.setup/register.runtime-CVKZRCrC.mjs +0 -197
- package/dist/.source-module-urls/78a9d561eb54d4bf1ca0db6e6d12bb5688647241f2c0b289c611a0effb44d715.json +0 -1
- package/dist/register.runtime.js +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
import { z } from "zod";
|
|
3
2
|
import fs from "node:fs";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
import { fileURLToPath } from "node:url";
|
|
6
5
|
import { formatPluginConfigIssue } from "openclaw/plugin-sdk/extension-shared";
|
|
6
|
+
import { resolvePackageRuntimeProcessEntrypointUrl, resolveRuntimeWorkerArgv } from "openclaw/plugin-sdk/process-runtime";
|
|
7
7
|
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
8
8
|
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
-
|
|
9
|
+
// extensions/acpx/src/config-schema.ts
|
|
10
10
|
/**
|
|
11
11
|
* ACPX plugin configuration schema and public config types. Runtime setup uses
|
|
12
12
|
* this file as the single source of truth for validation and defaulting.
|
|
@@ -32,6 +32,11 @@ const ACPX_PERMISSION_MODES = [
|
|
|
32
32
|
];
|
|
33
33
|
const ACPX_NON_INTERACTIVE_POLICIES = ["deny", "fail"];
|
|
34
34
|
const nonEmptyTrimmedString = (message) => z.string({ error: message }).trim().min(1, { error: message });
|
|
35
|
+
const envNameListSchema = (option) => {
|
|
36
|
+
const message = `${option} must be an array of environment variable names`;
|
|
37
|
+
const name = z.string({ error: message }).regex(/^[^=\s]+$/, { error: message }).refine((value) => !value.includes("\0"), { error: message });
|
|
38
|
+
return z.array(name, { error: message }).optional();
|
|
39
|
+
};
|
|
35
40
|
const McpServerConfigSchema = z.object({
|
|
36
41
|
command: nonEmptyTrimmedString("command must be a non-empty string").describe("Command to run the MCP server"),
|
|
37
42
|
args: z.array(z.string({ error: "args must be an array of strings" }), { error: "args must be an array of strings" }).optional().describe("Arguments to pass to the command"),
|
|
@@ -48,6 +53,8 @@ const AcpxPluginConfigSchema = z.strictObject({
|
|
|
48
53
|
pluginToolsMcpBridge: z.boolean({ error: "pluginToolsMcpBridge must be a boolean" }).optional(),
|
|
49
54
|
openClawToolsMcpBridge: z.boolean({ error: "openClawToolsMcpBridge must be a boolean" }).optional(),
|
|
50
55
|
timeoutSeconds: z.number({ error: "timeoutSeconds must be a number >= 0.001" }).min(.001, { error: "timeoutSeconds must be a number >= 0.001" }).default(120),
|
|
56
|
+
agentProcessEnvAllow: envNameListSchema("agentProcessEnvAllow"),
|
|
57
|
+
agentProcessEnvBlock: envNameListSchema("agentProcessEnvBlock"),
|
|
51
58
|
piSessionCatalog: z.strictObject({ enabled: z.boolean({ error: "piSessionCatalog.enabled must be a boolean" }).default(true) }).optional(),
|
|
52
59
|
mcpServers: z.record(z.string(), McpServerConfigSchema).optional(),
|
|
53
60
|
agents: z.record(z.string(), z.strictObject({
|
|
@@ -55,14 +62,12 @@ const AcpxPluginConfigSchema = z.strictObject({
|
|
|
55
62
|
args: z.array(z.string({ error: "args must be an array of strings" })).optional()
|
|
56
63
|
})).optional()
|
|
57
64
|
});
|
|
58
|
-
|
|
59
|
-
//#region extensions/acpx/src/codex-adapter.ts
|
|
65
|
+
// extensions/acpx/src/codex-adapter.ts
|
|
60
66
|
const CODEX_ACP_PACKAGE = "@agentclientprotocol/codex-acp";
|
|
61
67
|
const CODEX_ACP_BIN = "codex-acp";
|
|
62
68
|
const LEGACY_CODEX_ACP_PACKAGE = "@zed-industries/codex-acp";
|
|
63
69
|
const OPENCLAW_CODEX_CONFIG_ARG = "--openclaw-codex-config";
|
|
64
|
-
|
|
65
|
-
//#region extensions/acpx/src/command-line.ts
|
|
70
|
+
// extensions/acpx/src/command-line.ts
|
|
66
71
|
/** Match ACPX's persisted argv identity; scalar records keep their original bytes. */
|
|
67
72
|
function renderAgentCommand(command) {
|
|
68
73
|
return typeof command === "string" ? command : command.map((part) => /^[A-Za-z0-9_@%+=:,./^~-]+$/.test(part) ? part : JSON.stringify(part)).join(" ");
|
|
@@ -184,18 +189,16 @@ function resolveAgentCommand(params) {
|
|
|
184
189
|
if (!normalizedAgentName) return;
|
|
185
190
|
return splitCommandParts(params.agentRegistry.resolve(normalizedAgentName));
|
|
186
191
|
}
|
|
187
|
-
|
|
188
|
-
//#region extensions/acpx/src/config.ts
|
|
192
|
+
// extensions/acpx/src/config.ts
|
|
189
193
|
const MANAGED_MCP_BRIDGES = [[
|
|
190
194
|
"pluginToolsMcpBridge",
|
|
191
195
|
"openclaw-plugin-tools",
|
|
192
|
-
"
|
|
196
|
+
"pluginToolsServe"
|
|
193
197
|
], [
|
|
194
198
|
"openClawToolsMcpBridge",
|
|
195
199
|
"openclaw-tools",
|
|
196
|
-
"
|
|
200
|
+
"openclawToolsServe"
|
|
197
201
|
]];
|
|
198
|
-
const requireFromHere = createRequire(import.meta.url);
|
|
199
202
|
function isAcpxPluginRoot(dir) {
|
|
200
203
|
return fs.existsSync(path.join(dir, "openclaw.plugin.json")) && fs.existsSync(path.join(dir, "package.json"));
|
|
201
204
|
}
|
|
@@ -266,28 +269,12 @@ function resolveHostPackageRoot(argv1) {
|
|
|
266
269
|
cursor = parent;
|
|
267
270
|
}
|
|
268
271
|
}
|
|
269
|
-
function resolveTsxImportSpecifier() {
|
|
270
|
-
try {
|
|
271
|
-
return requireFromHere.resolve("tsx");
|
|
272
|
-
} catch {
|
|
273
|
-
return "tsx";
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
272
|
function resolveManagedToolsMcpServerConfig(entryPoint, moduleUrl = import.meta.url) {
|
|
277
273
|
const openClawRoot = resolveOpenClawRoot(resolveAcpxPluginRoot(moduleUrl));
|
|
278
|
-
const
|
|
279
|
-
if (fs.existsSync(distEntry)) return {
|
|
280
|
-
command: process.execPath,
|
|
281
|
-
args: [distEntry]
|
|
282
|
-
};
|
|
283
|
-
const sourceEntry = path.join(openClawRoot, "src", "mcp", `${entryPoint}.ts`);
|
|
274
|
+
const entry = resolvePackageRuntimeProcessEntrypointUrl(entryPoint, openClawRoot);
|
|
284
275
|
return {
|
|
285
276
|
command: process.execPath,
|
|
286
|
-
args:
|
|
287
|
-
"--import",
|
|
288
|
-
resolveTsxImportSpecifier(),
|
|
289
|
-
sourceEntry
|
|
290
|
-
]
|
|
277
|
+
args: resolveRuntimeWorkerArgv(entry)
|
|
291
278
|
};
|
|
292
279
|
}
|
|
293
280
|
function resolveConfiguredMcpServers(params) {
|
|
@@ -324,7 +311,7 @@ function resolveAcpxPluginConfig(params) {
|
|
|
324
311
|
moduleUrl: params.moduleUrl
|
|
325
312
|
});
|
|
326
313
|
const agents = Object.fromEntries(Object.entries(normalized.agents ?? {}).map(([name, entry]) => {
|
|
327
|
-
const cmd = entry.command
|
|
314
|
+
const cmd = entry.command;
|
|
328
315
|
const command = path.isAbsolute(cmd) && fs.existsSync(cmd) ? [cmd] : splitCommandParts(cmd);
|
|
329
316
|
return [normalizeLowercaseStringOrEmpty(name), [...command, ...entry.args ?? []]];
|
|
330
317
|
}));
|
|
@@ -337,9 +324,10 @@ function resolveAcpxPluginConfig(params) {
|
|
|
337
324
|
pluginToolsMcpBridge,
|
|
338
325
|
openClawToolsMcpBridge,
|
|
339
326
|
timeoutSeconds: normalized.timeoutSeconds,
|
|
327
|
+
agentProcessEnvAllow: normalized.agentProcessEnvAllow,
|
|
328
|
+
agentProcessEnvBlock: normalized.agentProcessEnvBlock,
|
|
340
329
|
mcpServers,
|
|
341
330
|
agents
|
|
342
331
|
};
|
|
343
332
|
}
|
|
344
|
-
//#endregion
|
|
345
333
|
export { isClaudeAcpCommand as a, renderAgentCommand as c, CODEX_ACP_BIN as d, CODEX_ACP_PACKAGE as f, AcpxNativeAgentsSchema as g, ACPX_NATIVE_AGENT_IDS as h, toAcpMcpServers as i, resolveAgentCommand as l, OPENCLAW_CODEX_CONFIG_ARG as m, resolveAcpxPluginRoot as n, isCodexAcpCommand as o, LEGACY_CODEX_ACP_PACKAGE as p, resolveOpenClawRoot as r, isOpenClawBridgeCommand as s, resolveAcpxPluginConfig as t, splitCommandParts as u };
|
|
@@ -7,7 +7,7 @@ import { DEFAULT_PLUGIN_APPROVAL_TIMEOUT_MS } from "openclaw/plugin-sdk/approval
|
|
|
7
7
|
import { toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
8
8
|
import { resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
9
9
|
import { appendSessionTranscriptMessageByIdentityStrict } from "openclaw/plugin-sdk/session-transcript-runtime";
|
|
10
|
-
|
|
10
|
+
// extensions/acpx/src/harness-attempt.ts
|
|
11
11
|
async function runAcpHarnessAttempt(params) {
|
|
12
12
|
const { input, runtime } = params;
|
|
13
13
|
if (!input.agentId || !input.sessionKey) throw new Error("ACP chat requires an owned OpenClaw session");
|
|
@@ -65,12 +65,12 @@ async function runAcpHarnessAttempt(params) {
|
|
|
65
65
|
sourceReplyDeliveryMode: input.sourceReplyDeliveryMode
|
|
66
66
|
};
|
|
67
67
|
let activeRegistered = false;
|
|
68
|
+
let activeAttachment;
|
|
68
69
|
let timer;
|
|
69
70
|
assertActive();
|
|
70
71
|
try {
|
|
71
|
-
setActiveEmbeddedRun(input.sessionId, activeRun, sessionKey, input.sessionFile, agentId);
|
|
72
|
+
activeAttachment = setActiveEmbeddedRun(input.sessionId, activeRun, sessionKey, input.sessionFile, agentId);
|
|
72
73
|
activeRegistered = true;
|
|
73
|
-
input.replyOperation?.attachBackend(activeRun);
|
|
74
74
|
signal.addEventListener("abort", stopDelivery, { once: true });
|
|
75
75
|
timer = setTimeout(() => {
|
|
76
76
|
timedOut = true;
|
|
@@ -143,7 +143,8 @@ async function runAcpHarnessAttempt(params) {
|
|
|
143
143
|
config: input.config,
|
|
144
144
|
trigger: input.trigger,
|
|
145
145
|
modelProviderId: input.provider,
|
|
146
|
-
modelId: input.modelId
|
|
146
|
+
modelId: input.modelId,
|
|
147
|
+
contextTokenBudget: input.contextTokenBudget ?? input.model.contextWindow
|
|
147
148
|
},
|
|
148
149
|
bootstrapContextRunKind: input.bootstrapContextRunKind
|
|
149
150
|
});
|
|
@@ -315,7 +316,7 @@ async function runAcpHarnessAttempt(params) {
|
|
|
315
316
|
settled = true;
|
|
316
317
|
clearTimeout(timer);
|
|
317
318
|
signal.removeEventListener("abort", stopDelivery);
|
|
318
|
-
if (activeRegistered) clearActiveEmbeddedRun(input.sessionId, activeRun, sessionKey, input.sessionFile);
|
|
319
|
+
if (activeRegistered) clearActiveEmbeddedRun(input.sessionId, activeRun, sessionKey, input.sessionFile, void 0, activeAttachment);
|
|
319
320
|
}
|
|
320
321
|
return {
|
|
321
322
|
terminal: timedOut ? {
|
|
@@ -364,5 +365,4 @@ async function runAcpHarnessAttempt(params) {
|
|
|
364
365
|
}
|
|
365
366
|
};
|
|
366
367
|
}
|
|
367
|
-
//#endregion
|
|
368
368
|
export { runAcpHarnessAttempt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as PI_SESSION_READ_COMMAND, i as PI_LOCAL_SESSION_HOST_ID, l as PI_TERMINAL_RESUME_COMMAND, n as piSessionStore, o as PI_SESSIONS_LIST_COMMAND, r as piSessionStoreAvailable, s as PI_SESSION_ID_PATTERN, t as piAcpSessionStoreRoot } from "./pi-session-paths-
|
|
1
|
+
import { c as PI_SESSION_READ_COMMAND, i as PI_LOCAL_SESSION_HOST_ID, l as PI_TERMINAL_RESUME_COMMAND, n as piSessionStore, o as PI_SESSIONS_LIST_COMMAND, r as piSessionStoreAvailable, s as PI_SESSION_ID_PATTERN, t as piAcpSessionStoreRoot } from "./pi-session-paths-pUr6hnVA.mjs";
|
|
2
2
|
import { parseDateFirstTimestampMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
3
3
|
import { createReadStream } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
@@ -12,9 +12,10 @@ import { createAcpSessionCatalogAdoption, readSessionCatalogJsonlActivity } from
|
|
|
12
12
|
import { sessionCatalogPaging } from "openclaw/plugin-sdk/session-catalog-paging";
|
|
13
13
|
import { safeParseJson, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
14
14
|
import fs$1 from "node:fs/promises";
|
|
15
|
+
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
15
16
|
import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
16
17
|
import { isPathStrictlyInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
17
|
-
|
|
18
|
+
// extensions/acpx/src/pi-session-store.ts
|
|
18
19
|
const MAX_DISCOVERY_FILES = 1e4;
|
|
19
20
|
const SUMMARY_SCAN_BATCH_SIZE = 100;
|
|
20
21
|
const MAX_SUMMARY_CACHE_ENTRIES = 256;
|
|
@@ -131,11 +132,7 @@ async function piFileCandidates(env) {
|
|
|
131
132
|
candidates
|
|
132
133
|
};
|
|
133
134
|
piFileCandidateCache.set(key, entry);
|
|
134
|
-
|
|
135
|
-
const oldest = piFileCandidateCache.keys().next();
|
|
136
|
-
if (oldest.done) break;
|
|
137
|
-
piFileCandidateCache.delete(oldest.value);
|
|
138
|
-
}
|
|
135
|
+
pruneMapToMaxSize(piFileCandidateCache, PI_FILE_CANDIDATE_CACHE_MAX_ENTRIES);
|
|
139
136
|
try {
|
|
140
137
|
return await candidates;
|
|
141
138
|
} catch (error) {
|
|
@@ -150,10 +147,18 @@ function parsePiJsonLines(content) {
|
|
|
150
147
|
return isRecord(value) ? [value] : [];
|
|
151
148
|
});
|
|
152
149
|
}
|
|
153
|
-
function piMessageText(content) {
|
|
150
|
+
function piMessageText(content, includeImages = false) {
|
|
154
151
|
if (typeof content === "string") return content;
|
|
155
152
|
if (!Array.isArray(content)) return "";
|
|
156
|
-
return content.flatMap((part) =>
|
|
153
|
+
return content.flatMap((part) => {
|
|
154
|
+
if (!isRecord(part)) return [];
|
|
155
|
+
if (part.type === "text" && typeof part.text === "string") return [part.text];
|
|
156
|
+
if (includeImages && part.type === "image") {
|
|
157
|
+
const mimeType = normalizeBoundedOptionalString(part.mimeType, 128);
|
|
158
|
+
return [mimeType ? `[image: ${mimeType}]` : "[image]"];
|
|
159
|
+
}
|
|
160
|
+
return [];
|
|
161
|
+
}).join("\n");
|
|
157
162
|
}
|
|
158
163
|
function processSummaryLine(state, line) {
|
|
159
164
|
const entry = parsePiJsonLines((line.at(-1) === 13 ? line.subarray(0, -1) : line).toString("utf8"))[0];
|
|
@@ -214,19 +219,13 @@ async function readPiSessionSummary(candidate) {
|
|
|
214
219
|
let scanState;
|
|
215
220
|
try {
|
|
216
221
|
const resumable = cached?.identity === candidate.identity && cached.size < candidate.size ? cached : void 0;
|
|
217
|
-
scanState = resumable ? {
|
|
218
|
-
...resumable.scanState,
|
|
219
|
-
pending: Buffer.from(resumable.scanState.pending)
|
|
220
|
-
} : {
|
|
222
|
+
scanState = resumable ? { ...resumable.scanState } : {
|
|
221
223
|
pending: Buffer.alloc(0),
|
|
222
224
|
discarding: false,
|
|
223
225
|
invalid: false
|
|
224
226
|
};
|
|
225
227
|
await scanSummaryAppend(candidate, resumable?.size ?? 0, scanState);
|
|
226
|
-
const projectedState = {
|
|
227
|
-
...scanState,
|
|
228
|
-
pending: Buffer.from(scanState.pending)
|
|
229
|
-
};
|
|
228
|
+
const projectedState = { ...scanState };
|
|
230
229
|
if (!projectedState.discarding && projectedState.pending.length > 0) processSummaryLine(projectedState, projectedState.pending);
|
|
231
230
|
const { header, name, firstMessage } = projectedState;
|
|
232
231
|
const version = header?.type === "session" && typeof header.version === "number" ? header.version : 1;
|
|
@@ -254,7 +253,6 @@ async function readPiSessionSummary(candidate) {
|
|
|
254
253
|
} catch {
|
|
255
254
|
return cached?.summary;
|
|
256
255
|
}
|
|
257
|
-
if (cached?.summary?.threadId && cached.summary.threadId !== summary?.threadId) threadFileCache.delete(threadCacheKey(cached.storeRoot, cached.summary.threadId));
|
|
258
256
|
cacheSummary(candidate.file, {
|
|
259
257
|
...candidate,
|
|
260
258
|
summary,
|
|
@@ -269,7 +267,17 @@ function summaryMatches(summary, needle) {
|
|
|
269
267
|
summary.threadId,
|
|
270
268
|
summary.name,
|
|
271
269
|
summary.cwd
|
|
272
|
-
].some((field) => field?.toLocaleLowerCase().includes(needle));
|
|
270
|
+
].some((field) => field?.toLocaleLowerCase().normalize("NFC").includes(needle));
|
|
271
|
+
}
|
|
272
|
+
async function* scanPiSummaries(candidates) {
|
|
273
|
+
for (let index = 0; index < candidates.length; index += SUMMARY_SCAN_BATCH_SIZE) {
|
|
274
|
+
const { results } = await runTasksWithConcurrency({
|
|
275
|
+
tasks: candidates.slice(index, index + SUMMARY_SCAN_BATCH_SIZE).map((candidate) => () => readPiSessionSummary(candidate)),
|
|
276
|
+
limit: IO_CONCURRENCY,
|
|
277
|
+
throwOnError: true
|
|
278
|
+
});
|
|
279
|
+
for (const summary of results) if (summary) yield summary;
|
|
280
|
+
}
|
|
273
281
|
}
|
|
274
282
|
async function listPiSummaryPage(env, params) {
|
|
275
283
|
const candidates = await piFileCandidates(env);
|
|
@@ -277,18 +285,10 @@ async function listPiSummaryPage(env, params) {
|
|
|
277
285
|
for (const file of summaryCache.keys()) if (!activeFiles.has(file)) forgetCachedSummary(file);
|
|
278
286
|
const target = params.offset + params.limit + 1;
|
|
279
287
|
const matches = [];
|
|
280
|
-
const needle = params.searchTerm?.toLocaleLowerCase();
|
|
281
|
-
for (
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
tasks: batch.map((candidate) => () => readPiSessionSummary(candidate)),
|
|
285
|
-
limit: IO_CONCURRENCY,
|
|
286
|
-
throwOnError: true
|
|
287
|
-
});
|
|
288
|
-
for (const summary of summaries) if (summary && summaryMatches(summary, needle)) {
|
|
289
|
-
matches.push(summary);
|
|
290
|
-
if (matches.length >= target) break;
|
|
291
|
-
}
|
|
288
|
+
const needle = params.searchTerm?.toLocaleLowerCase().normalize("NFC");
|
|
289
|
+
for await (const summary of scanPiSummaries(candidates)) if (summaryMatches(summary, needle)) {
|
|
290
|
+
matches.push(summary);
|
|
291
|
+
if (matches.length >= target) break;
|
|
292
292
|
}
|
|
293
293
|
return {
|
|
294
294
|
summaries: matches.slice(params.offset, params.offset + params.limit),
|
|
@@ -296,16 +296,7 @@ async function listPiSummaryPage(env, params) {
|
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
298
|
async function findPiSummary(threadId, env) {
|
|
299
|
-
const
|
|
300
|
-
for (let index = 0; index < candidates.length; index += SUMMARY_SCAN_BATCH_SIZE) {
|
|
301
|
-
const { results: summaries } = await runTasksWithConcurrency({
|
|
302
|
-
tasks: candidates.slice(index, index + SUMMARY_SCAN_BATCH_SIZE).map((candidate) => () => readPiSessionSummary(candidate)),
|
|
303
|
-
limit: IO_CONCURRENCY,
|
|
304
|
-
throwOnError: true
|
|
305
|
-
});
|
|
306
|
-
const match = summaries.find((summary) => summary?.threadId === threadId);
|
|
307
|
-
if (match) return match;
|
|
308
|
-
}
|
|
299
|
+
for await (const summary of scanPiSummaries(await piFileCandidates(env))) if (summary.threadId === threadId) return summary;
|
|
309
300
|
}
|
|
310
301
|
async function readPiSessionFileBaseline(threadId, env) {
|
|
311
302
|
const summary = await findPiSummary(threadId, env);
|
|
@@ -337,23 +328,9 @@ async function readPiSessionById(threadId, env) {
|
|
|
337
328
|
throw new Error("Pi session is unavailable", { cause: error });
|
|
338
329
|
}
|
|
339
330
|
}
|
|
340
|
-
|
|
341
|
-
//#region extensions/acpx/src/pi-session-catalog.ts
|
|
331
|
+
// extensions/acpx/src/pi-session-catalog.ts
|
|
342
332
|
const MAX_SEARCH_LENGTH = 500;
|
|
343
333
|
const isExactPiSessionCursor = sessionCatalogPaging.isExactCursor;
|
|
344
|
-
function textFromContent(content) {
|
|
345
|
-
if (typeof content === "string") return content;
|
|
346
|
-
if (!Array.isArray(content)) return "";
|
|
347
|
-
return content.flatMap((part) => {
|
|
348
|
-
if (!isRecord(part)) return [];
|
|
349
|
-
if (part.type === "text" && typeof part.text === "string") return [part.text];
|
|
350
|
-
if (part.type === "image") {
|
|
351
|
-
const mimeType = normalizeBoundedOptionalString(part.mimeType, 128);
|
|
352
|
-
return [mimeType ? `[image: ${mimeType}]` : "[image]"];
|
|
353
|
-
}
|
|
354
|
-
return [];
|
|
355
|
-
}).join("\n");
|
|
356
|
-
}
|
|
357
334
|
const PI_PARAMETER_MESSAGES = {
|
|
358
335
|
listNotObject: "Pi session list parameters must be an object",
|
|
359
336
|
unknownListParameter: (key) => `unknown Pi session list parameter: ${key}`,
|
|
@@ -420,7 +397,7 @@ function piMessageItems(entry) {
|
|
|
420
397
|
...modelRef ? { model: modelRef } : {}
|
|
421
398
|
};
|
|
422
399
|
if (role === "user") {
|
|
423
|
-
const text =
|
|
400
|
+
const text = piMessageText(message.content, true);
|
|
424
401
|
return text ? [{
|
|
425
402
|
...common,
|
|
426
403
|
type: "userMessage",
|
|
@@ -429,7 +406,7 @@ function piMessageItems(entry) {
|
|
|
429
406
|
}
|
|
430
407
|
if (role === "toolResult") {
|
|
431
408
|
const toolName = normalizeBoundedOptionalString(message.toolName, 256);
|
|
432
|
-
const text =
|
|
409
|
+
const text = piMessageText(message.content, true);
|
|
433
410
|
return [{
|
|
434
411
|
...common,
|
|
435
412
|
type: "toolResult",
|
|
@@ -454,7 +431,7 @@ function piMessageItems(entry) {
|
|
|
454
431
|
if (role === "custom" || role === "hookMessage") {
|
|
455
432
|
if (message.display !== true) return [];
|
|
456
433
|
const customType = normalizeBoundedOptionalString(message.customType, 256);
|
|
457
|
-
const text =
|
|
434
|
+
const text = piMessageText(message.content, true);
|
|
458
435
|
return text ? [{
|
|
459
436
|
...common,
|
|
460
437
|
type: "other",
|
|
@@ -505,7 +482,7 @@ function piTranscriptItems(entries) {
|
|
|
505
482
|
text: entry.summary
|
|
506
483
|
}];
|
|
507
484
|
if (entry.type === "custom_message" && entry.display === true) {
|
|
508
|
-
const text =
|
|
485
|
+
const text = piMessageText(entry.content, true);
|
|
509
486
|
return text ? [{
|
|
510
487
|
...common,
|
|
511
488
|
type: "other",
|
|
@@ -531,8 +508,7 @@ async function readLocalPiTranscriptPage(value) {
|
|
|
531
508
|
...page
|
|
532
509
|
};
|
|
533
510
|
}
|
|
534
|
-
|
|
535
|
-
//#region extensions/acpx/src/pi-session-upstream-activity.ts
|
|
511
|
+
// extensions/acpx/src/pi-session-upstream-activity.ts
|
|
536
512
|
function readFilePath(probe) {
|
|
537
513
|
return isRecord(probe.upstreamRef) && typeof probe.upstreamRef.filePath === "string" ? probe.upstreamRef.filePath : void 0;
|
|
538
514
|
}
|
|
@@ -582,8 +558,7 @@ async function checkPiUpstreamActivity(probes) {
|
|
|
582
558
|
} catch {}
|
|
583
559
|
return outcomes;
|
|
584
560
|
}
|
|
585
|
-
|
|
586
|
-
//#region extensions/acpx/src/pi-session-catalog-runtime.ts
|
|
561
|
+
// extensions/acpx/src/pi-session-catalog-runtime.ts
|
|
587
562
|
const NODE_TIMEOUT_MS = 2e4;
|
|
588
563
|
const ACPX_BACKEND_ID = "acpx";
|
|
589
564
|
const PI_ACP_AGENT_ID = "pi";
|
|
@@ -717,5 +692,4 @@ function createPiSessionCatalogRuntime(api) {
|
|
|
717
692
|
checkUpstreamActivity: (probes, policy) => checkPiUpstreamActivity(probes.filter((probe) => probe.hostId !== "gateway" || policy?.allowProcessHomeFallback !== false || !piSessionStore(process.env).usesProcessHomeFallback))
|
|
718
693
|
}, isExactPiSessionCursor);
|
|
719
694
|
}
|
|
720
|
-
//#endregion
|
|
721
695
|
export { createPiSessionCatalogRuntime, listLocalPiSessionPage as listPiSessions, readLocalPiTranscriptPage as readPiSession, requireLocalPiSession };
|
|
@@ -2,20 +2,19 @@ import { readFileSync, statSync } from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { isRecord, normalizeBoundedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import os from "node:os";
|
|
5
|
-
|
|
5
|
+
// extensions/acpx/src/pi-session-catalog-shared.ts
|
|
6
6
|
const PI_SESSIONS_LIST_COMMAND = "acpx.pi.sessions.list.v1";
|
|
7
7
|
const PI_SESSION_READ_COMMAND = "acpx.pi.sessions.read.v1";
|
|
8
8
|
const PI_TERMINAL_RESUME_COMMAND = "acpx.pi.terminal.resume.v1";
|
|
9
9
|
const PI_SESSIONS_CAPABILITY = "pi-sessions";
|
|
10
10
|
const PI_LOCAL_SESSION_HOST_ID = "gateway";
|
|
11
11
|
const PI_SESSION_ID_PATTERN = /^(?!-)[A-Za-z0-9._:-]{1,256}$/u;
|
|
12
|
-
|
|
13
|
-
//#region extensions/acpx/src/pi-session-paths.ts
|
|
12
|
+
// extensions/acpx/src/pi-session-paths.ts
|
|
14
13
|
function piHome(env) {
|
|
15
14
|
return (process.platform === "win32" ? env.USERPROFILE?.trim() : env.HOME?.trim()) || os.homedir();
|
|
16
15
|
}
|
|
17
|
-
function isPiSessionCatalogPathAbsolute(value
|
|
18
|
-
if (platform !== "win32") return path.posix.isAbsolute(value);
|
|
16
|
+
function isPiSessionCatalogPathAbsolute(value) {
|
|
17
|
+
if (process.platform !== "win32") return path.posix.isAbsolute(value);
|
|
19
18
|
const root = path.win32.parse(value).root;
|
|
20
19
|
return path.win32.isAbsolute(value) && root !== "\\" && root !== "/";
|
|
21
20
|
}
|
|
@@ -80,5 +79,4 @@ function piSessionStoreAvailable(env, store) {
|
|
|
80
79
|
return false;
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
|
-
//#endregion
|
|
84
82
|
export { PI_SESSIONS_CAPABILITY as a, PI_SESSION_READ_COMMAND as c, PI_LOCAL_SESSION_HOST_ID as i, PI_TERMINAL_RESUME_COMMAND as l, piSessionStore as n, PI_SESSIONS_LIST_COMMAND as o, piSessionStoreAvailable as r, PI_SESSION_ID_PATTERN as s, piAcpSessionStoreRoot as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -24,8 +24,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
24
24
|
return to;
|
|
25
25
|
};
|
|
26
26
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
27
|
-
|
|
28
|
-
//#region packages/normalization-core/src/record-coerce.ts
|
|
27
|
+
// packages/normalization-core/src/record-coerce.ts
|
|
29
28
|
/** Type guard for non-array object records at browser-safe boundaries. */
|
|
30
29
|
function isRecord(value) {
|
|
31
30
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -34,8 +33,7 @@ function isRecord(value) {
|
|
|
34
33
|
function asNullableRecord(value) {
|
|
35
34
|
return isRecord(value) ? value : null;
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
//#region src/config/channel-config-normalization.ts
|
|
36
|
+
// src/config/channel-config-normalization.ts
|
|
39
37
|
/** Applies one channel-specific doctor migration to every object-shaped account. */
|
|
40
38
|
function normalizeChannelAccounts(params) {
|
|
41
39
|
const rawAccounts = asNullableRecord(params.entry.accounts);
|
|
@@ -111,8 +109,7 @@ function normalizeChannelConfigEntries(params) {
|
|
|
111
109
|
changes
|
|
112
110
|
};
|
|
113
111
|
}
|
|
114
|
-
|
|
115
|
-
//#region src/plugin-sdk/legacy-webhook-listener-migration.ts
|
|
112
|
+
// src/plugin-sdk/legacy-webhook-listener-migration.ts
|
|
116
113
|
/** Preserve explicitly configured webhook listeners while moving ingress onto Gateway routes. */
|
|
117
114
|
function createLegacyWebhookListenerDoctorContract(params) {
|
|
118
115
|
const portKey = params.portKey ?? "webhookPort";
|
|
@@ -182,10 +179,8 @@ function createLegacyWebhookListenerDoctorContract(params) {
|
|
|
182
179
|
}
|
|
183
180
|
};
|
|
184
181
|
}
|
|
185
|
-
|
|
186
|
-
//#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/runtime-doctor-migrations
|
|
182
|
+
// \0openclaw:bundled-sdk:openclaw/plugin-sdk/runtime-doctor-migrations
|
|
187
183
|
var runtime_doctor_migrations_exports = /* @__PURE__ */ __exportAll({ createLegacyWebhookListenerDoctorContract: () => createLegacyWebhookListenerDoctorContract });
|
|
188
184
|
import * as import_openclaw_plugin_sdk_runtime_doctor_migrations from "openclaw/plugin-sdk/runtime-doctor-migrations";
|
|
189
185
|
__reExport(runtime_doctor_migrations_exports, import_openclaw_plugin_sdk_runtime_doctor_migrations);
|
|
190
|
-
//#endregion
|
|
191
186
|
export { __exportAll as n, runtime_doctor_migrations_exports as t };
|