failproofai 1.0.4 → 1.0.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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +6 -6
- package/.next/standalone/.next/prerender-manifest.json +4 -4
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +13 -13
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js +4 -4
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +13 -13
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js +2 -2
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +4 -4
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__0-9ti7z._.js → [externals]__1_bftcl._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__0u3wrvq._.js → [externals]__1msfs-h._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__08dchfu._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0faqz9x._.js +22 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zyc_nm._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__1p-qi2t._.js → [root-of-the-server]__112b4go._.js} +22 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1l71g3y._.js +22 -0
- package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
- package/.next/standalone/.next/server/chunks/{_1-akg6w._.js → _1c3k-8x._.js} +2 -2
- package/.next/standalone/.next/server/chunks/_1ek68ln._.js +1 -1
- package/.next/standalone/.next/server/chunks/lib_openclaw-projects_ts_0gc-p24._.js +3 -0
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__00y9ww2._.js +22 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013jr2b._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01wy8d-._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02npjtd._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__09flfsx._.js → [root-of-the-server]__05g1k7_._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da85px._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ftmoxc._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oa1lav._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p-5p8u._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s740oi._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0sz_5na._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ctpynv._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1kaotix._.js +22 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1p2otjt._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1u6sn69._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_02yoeej._.js → _0iv28v5._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_1if9ixi._.js → _14c6q09._.js} +21 -2
- package/.next/standalone/.next/server/chunks/ssr/{_04rbnaq._.js → _17noq1a._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/lib_codex-projects_ts_0pqlw37._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/lib_openclaw-projects_ts_0qxq3bp._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +6 -6
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +19 -19
- package/.next/standalone/.next/static/chunks/{3tjji451hrgc0.js → 074xcclgow3yh.js} +1 -1
- package/.next/standalone/.next/static/chunks/{31u94yukw9fz-.js → 0qytob94jbzs6.js} +1 -1
- package/.next/standalone/.next/static/chunks/25cn9xpv4r1ow.js +1 -0
- package/.next/standalone/.next/static/chunks/{1j6o9min_6qa9.js → 26tf_lpco5n-v.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0-tyrpwuc3lla.js → 2b014kj28p0vz.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2lwipmv5etc8m.js → 3_fnbc-v5r-9e.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1c6aptmytnu6q.js → 3kltzmx9k_t6x.js} +1 -1
- package/.next/standalone/.next/static/chunks/{27cl8h-c2w7cd.js → 3pmi7qhtmniku.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2u8vh73tpw28_.js → 3q1rji38vuvr4.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0ca7octhod0g2.js → 3qxl_gibq3bas.js} +1 -1
- package/.next/standalone/.next/static/chunks/{3p9_8x5ezce-9.js → 3vjaz4hld9oo8.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2zafgs90r_leq.js → 41ejnuj2d9g7_.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-3p73obe0xmrxm.js → turbopack-1xgsp63yhrdu5.js} +1 -1
- package/.next/standalone/fp-cloud-cli/CHANGELOG.md +7 -0
- package/.next/standalone/fp-cloud-cli/fp_cli/_version.py +1 -1
- package/.next/standalone/lib/download-session.ts +58 -13
- package/.next/standalone/lib/openclaw-db.ts +271 -0
- package/.next/standalone/lib/openclaw-projects.ts +54 -18
- package/.next/standalone/lib/openclaw-sessions.ts +75 -17
- package/.next/standalone/package.json +9 -9
- package/.next/standalone/sdk/python/CHANGELOG.md +38 -8
- package/.next/standalone/sdk/python/failproofai_sdk/_events.py +20 -0
- package/.next/standalone/sdk/python/failproofai_sdk/_redact.py +233 -0
- package/.next/standalone/sdk/python/failproofai_sdk/_version.py +1 -1
- package/.next/standalone/sdk/python/failproofai_sdk/_writer.py +4 -1
- package/.next/standalone/sdk/python/failproofai_sdk/integrations/llama_index.py +5 -5
- package/.next/standalone/sdk/python/tests/integrations/test_llama_index.py +2 -2
- package/.next/standalone/sdk/python/tests/test_redaction.py +140 -0
- package/.next/standalone/sdk/python/tests/test_sdk.py +87 -0
- package/.next/standalone/sdk/python/tests/test_server_contract.py +60 -0
- package/.next/standalone/sdk/python/tests/test_site_docs.py +2 -2
- package/.next/standalone/server.js +1 -1
- package/dist/cli.mjs +466 -255
- package/dist/worker.mjs +301 -90
- package/lib/download-session.ts +58 -13
- package/lib/openclaw-db.ts +271 -0
- package/lib/openclaw-projects.ts +54 -18
- package/lib/openclaw-sessions.ts +75 -17
- package/openclaw-plugin/index.js +10 -6
- package/openclaw-plugin/instruct-retry-gate.js +89 -0
- package/package.json +9 -9
- package/src/hooks/policy-evaluator.ts +22 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-219ec._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__04_h-a5._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1le9jqc._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__00-s7h8._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__190won8._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1nq7ivq._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1sc84bb._.js +0 -3
- package/.next/standalone/.next/static/chunks/2pd16tn5qmx13.js +0 -1
- /package/.next/standalone/.next/static/{dg8VQ7Ejlo0Qsh_x92oIt → Qexks15mjEoPt6cN3D2jb}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{dg8VQ7Ejlo0Qsh_x92oIt → Qexks15mjEoPt6cN3D2jb}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{dg8VQ7Ejlo0Qsh_x92oIt → Qexks15mjEoPt6cN3D2jb}/_ssgManifest.js +0 -0
package/lib/openclaw-sessions.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenClaw (openclaw gateway) session transcript loader + parser.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* IGNORE, and a `sessions.json` index keyed by sessionKey. Verified live
|
|
8
|
-
* against openclaw v2026.7.1.
|
|
4
|
+
* Legacy OpenClaw writes one JSONL transcript per session under `sessions/`;
|
|
5
|
+
* 2026.9.2+ stores the same logical records as `event_json` rows in each
|
|
6
|
+
* agent's `agent/openclaw-agent.sqlite`. SQLite is preferred when both exist.
|
|
9
7
|
*
|
|
10
8
|
* The transcript is type-discriminated JSONL:
|
|
11
9
|
* {type:"session", cwd, …} — header (carries cwd)
|
|
@@ -18,8 +16,8 @@
|
|
|
18
16
|
* `toolResult` by `toolCallId` (mirrors lib/hermes-sessions.ts) and is PURE, so
|
|
19
17
|
* it is unit-testable with plain line objects.
|
|
20
18
|
*
|
|
21
|
-
* Home override:
|
|
22
|
-
* gateway config dir).
|
|
19
|
+
* Home override: `OPENCLAW_STATE_DIR`, then `OPENCLAW_HOME` (used by tests /
|
|
20
|
+
* to point at a copied gateway config dir).
|
|
23
21
|
*/
|
|
24
22
|
import { readFile } from "node:fs/promises";
|
|
25
23
|
import { readdirSync, statSync } from "node:fs";
|
|
@@ -39,13 +37,18 @@ import {
|
|
|
39
37
|
type LogSource,
|
|
40
38
|
} from "./log-entries";
|
|
41
39
|
import { formatDuration } from "./format-duration";
|
|
40
|
+
import { readOpenClawSqliteTranscript } from "./openclaw-db";
|
|
42
41
|
|
|
43
42
|
/** OpenClaw sessions are stored under UUID filenames. */
|
|
44
43
|
export const OPENCLAW_SESSION_ID_RE = /^[0-9a-fA-F-]{36}$/;
|
|
45
44
|
|
|
46
|
-
/** Absolute path to OpenClaw's
|
|
45
|
+
/** Absolute path to OpenClaw's state home. */
|
|
47
46
|
export function openclawHome(): string {
|
|
48
|
-
return
|
|
47
|
+
return (
|
|
48
|
+
process.env.OPENCLAW_STATE_DIR ||
|
|
49
|
+
process.env.OPENCLAW_HOME ||
|
|
50
|
+
join(homedir(), ".openclaw")
|
|
51
|
+
);
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
// ── Parsing helpers ──
|
|
@@ -60,7 +63,11 @@ function extractText(content: unknown): string {
|
|
|
60
63
|
if (typeof content === "string") return content;
|
|
61
64
|
if (Array.isArray(content)) {
|
|
62
65
|
return content
|
|
63
|
-
.map((c) =>
|
|
66
|
+
.map((c) =>
|
|
67
|
+
isPlainObject(c) && typeof c.text === "string"
|
|
68
|
+
? (c.text as string)
|
|
69
|
+
: "",
|
|
70
|
+
)
|
|
64
71
|
.filter(Boolean)
|
|
65
72
|
.join("\n");
|
|
66
73
|
}
|
|
@@ -134,7 +141,10 @@ export function openclawLinesToLogEntries(
|
|
|
134
141
|
if (b.type === "text" && typeof b.text === "string") {
|
|
135
142
|
blocks.push({ type: "text", text: b.text });
|
|
136
143
|
} else if (b.type === "toolCall") {
|
|
137
|
-
const id =
|
|
144
|
+
const id =
|
|
145
|
+
typeof b.id === "string"
|
|
146
|
+
? b.id
|
|
147
|
+
: `${String(b.name ?? "tool")}-${blocks.length}`;
|
|
138
148
|
const name = typeof b.name === "string" ? b.name : "tool";
|
|
139
149
|
const input = isPlainObject(b.arguments) ? b.arguments : {};
|
|
140
150
|
const block: ToolUseBlock = { type: "tool_use", id, name, input };
|
|
@@ -151,17 +161,23 @@ export function openclawLinesToLogEntries(
|
|
|
151
161
|
entries.push({
|
|
152
162
|
type: "assistant",
|
|
153
163
|
...base,
|
|
154
|
-
message: {
|
|
164
|
+
message: {
|
|
165
|
+
role: "assistant",
|
|
166
|
+
content: blocks,
|
|
167
|
+
model: typeof m.model === "string" ? m.model : undefined,
|
|
168
|
+
},
|
|
155
169
|
} satisfies AssistantEntry);
|
|
156
170
|
continue;
|
|
157
171
|
}
|
|
158
172
|
|
|
159
173
|
if (role === "toolResult") {
|
|
160
|
-
const callId =
|
|
174
|
+
const callId =
|
|
175
|
+
typeof m.toolCallId === "string" ? m.toolCallId : undefined;
|
|
161
176
|
const block = callId ? toolUseById.get(callId) : undefined;
|
|
162
177
|
if (block) {
|
|
163
178
|
const details = isPlainObject(m.details) ? m.details : undefined;
|
|
164
|
-
const startMs =
|
|
179
|
+
const startMs =
|
|
180
|
+
(callId && toolUseStartMs.get(callId)) || date.getTime();
|
|
165
181
|
const durationMs =
|
|
166
182
|
details && typeof details.durationMs === "number"
|
|
167
183
|
? details.durationMs
|
|
@@ -238,13 +254,20 @@ export function listOpenClawTranscripts(): OpenClawTranscriptFile[] {
|
|
|
238
254
|
}
|
|
239
255
|
for (const file of files) {
|
|
240
256
|
// Only `<uuid>.jsonl` — not `<uuid>.trajectory.jsonl` / `.trajectory-path.json`.
|
|
241
|
-
if (!file.endsWith(".jsonl") || file.endsWith(".trajectory.jsonl"))
|
|
257
|
+
if (!file.endsWith(".jsonl") || file.endsWith(".trajectory.jsonl"))
|
|
258
|
+
continue;
|
|
242
259
|
const sessionId = file.slice(0, -".jsonl".length);
|
|
243
260
|
if (!OPENCLAW_SESSION_ID_RE.test(sessionId)) continue;
|
|
244
261
|
const transcriptPath = join(sessionsDir, file);
|
|
245
262
|
try {
|
|
246
263
|
const st = statSync(transcriptPath);
|
|
247
|
-
out.push({
|
|
264
|
+
out.push({
|
|
265
|
+
agentId,
|
|
266
|
+
sessionId,
|
|
267
|
+
transcriptPath,
|
|
268
|
+
mtimeMs: st.mtimeMs,
|
|
269
|
+
sizeBytes: st.size,
|
|
270
|
+
});
|
|
248
271
|
} catch {
|
|
249
272
|
// skip unreadable
|
|
250
273
|
}
|
|
@@ -276,6 +299,36 @@ export interface OpenClawSessionLogData {
|
|
|
276
299
|
export async function getOpenClawSessionLog(
|
|
277
300
|
sessionId: string,
|
|
278
301
|
): Promise<OpenClawSessionLogData | null> {
|
|
302
|
+
if (!OPENCLAW_SESSION_ID_RE.test(sessionId)) return null;
|
|
303
|
+
|
|
304
|
+
// New OpenClaw versions keep live transcripts in SQLite. Prefer that copy
|
|
305
|
+
// when an archived JSONL with the same UUID also exists.
|
|
306
|
+
const sqlite = await readOpenClawSqliteTranscript(
|
|
307
|
+
openclawHome(),
|
|
308
|
+
listOpenClawAgents(),
|
|
309
|
+
sessionId,
|
|
310
|
+
);
|
|
311
|
+
if (sqlite) {
|
|
312
|
+
const entries = openclawLinesToLogEntries(sqlite.rawLines, "session");
|
|
313
|
+
let cwd: string | undefined;
|
|
314
|
+
for (const line of sqlite.rawLines) {
|
|
315
|
+
if (
|
|
316
|
+
line.type === "session" &&
|
|
317
|
+
typeof line.cwd === "string" &&
|
|
318
|
+
line.cwd.length > 0
|
|
319
|
+
) {
|
|
320
|
+
cwd = line.cwd;
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
entries,
|
|
326
|
+
rawLines: sqlite.rawLines,
|
|
327
|
+
cwd,
|
|
328
|
+
filePath: sqlite.filePath,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
279
332
|
const filePath = findOpenClawTranscript(sessionId);
|
|
280
333
|
if (!filePath) return null;
|
|
281
334
|
let content: string;
|
|
@@ -289,7 +342,12 @@ export async function getOpenClawSessionLog(
|
|
|
289
342
|
// cwd lives on the `type:"session"` header line.
|
|
290
343
|
let cwd: string | undefined;
|
|
291
344
|
for (const line of rawLines) {
|
|
292
|
-
if (
|
|
345
|
+
if (
|
|
346
|
+
isPlainObject(line) &&
|
|
347
|
+
line.type === "session" &&
|
|
348
|
+
typeof line.cwd === "string" &&
|
|
349
|
+
line.cwd.length > 0
|
|
350
|
+
) {
|
|
293
351
|
cwd = line.cwd;
|
|
294
352
|
break;
|
|
295
353
|
}
|
package/openclaw-plugin/index.js
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* file-based "internal hooks" are observation-only — and forwards each to the
|
|
8
8
|
* failproofai binary as `failproofai --hook <event> --cli openclaw`. failproofai
|
|
9
9
|
* prints a flat `{permission, reason}` verdict on stdout; this shim maps it to
|
|
10
|
-
* each hook's native return shape.
|
|
10
|
+
* each hook's native return shape. On before_tool_call, an `instruct` verdict
|
|
11
|
+
* uses a one-shot blockReason as OpenClaw's model-visible instruction channel;
|
|
12
|
+
* retries from the same session/policy are allowed for a short window.
|
|
11
13
|
*
|
|
12
14
|
* Marker comment for failproofai's installer detection (do not remove):
|
|
13
15
|
* __failproofai_hook__: true
|
|
@@ -34,10 +36,12 @@ import { spawn } from "node:child_process";
|
|
|
34
36
|
import { existsSync } from "node:fs";
|
|
35
37
|
import { resolve, dirname } from "node:path";
|
|
36
38
|
import { fileURLToPath } from "node:url";
|
|
39
|
+
import { createInstructRetryGate, mapBeforeToolVerdict } from "./instruct-retry-gate.js";
|
|
37
40
|
|
|
38
41
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
39
42
|
const DIST_BIN = resolve(HERE, "..", "dist", "cli.mjs");
|
|
40
43
|
const SRC_BIN = resolve(HERE, "..", "bin", "failproofai.mjs");
|
|
44
|
+
const instructRetryGate = createInstructRetryGate();
|
|
41
45
|
|
|
42
46
|
function resolveSpawn() {
|
|
43
47
|
if (process.env.FAILPROOFAI_BINARY_OVERRIDE) {
|
|
@@ -136,7 +140,9 @@ export default definePluginEntry({
|
|
|
136
140
|
name: "failproofai",
|
|
137
141
|
description: "Real-time policy enforcement for OpenClaw by failproofai",
|
|
138
142
|
register(api) {
|
|
139
|
-
// before_tool_call → PreToolUse.
|
|
143
|
+
// before_tool_call → PreToolUse. Deny always blocks. Instruct blocks the
|
|
144
|
+
// first matching attempt only, using blockReason to give the model the
|
|
145
|
+
// instruction, then permits retries from that session/policy for 5 minutes.
|
|
140
146
|
api.on(
|
|
141
147
|
"before_tool_call",
|
|
142
148
|
async (payload, ctx) => {
|
|
@@ -147,10 +153,7 @@ export default definePluginEntry({
|
|
|
147
153
|
tool_input: p.params,
|
|
148
154
|
hook_event_name: "before_tool_call",
|
|
149
155
|
});
|
|
150
|
-
|
|
151
|
-
return { block: true, blockReason: verdict.reason || "Blocked by failproofai" };
|
|
152
|
-
}
|
|
153
|
-
return undefined;
|
|
156
|
+
return mapBeforeToolVerdict(verdict, payload, ctx, instructRetryGate);
|
|
154
157
|
},
|
|
155
158
|
{ priority: 100, timeoutMs: 60_000 },
|
|
156
159
|
);
|
|
@@ -214,6 +217,7 @@ export default definePluginEntry({
|
|
|
214
217
|
reason: p.reason,
|
|
215
218
|
hook_event_name: ev,
|
|
216
219
|
});
|
|
220
|
+
if (ev === "session_end") instructRetryGate.clear(payload, ctx);
|
|
217
221
|
return undefined;
|
|
218
222
|
},
|
|
219
223
|
{ priority: 100, timeoutMs: 60_000 },
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw has no non-blocking context channel on before_tool_call. To deliver
|
|
3
|
+
* an instruct verdict to the model, the shim rejects the first matching call
|
|
4
|
+
* with the instruction as blockReason. Calls from the same session and policy
|
|
5
|
+
* are then allowed for a short window so an advisory policy cannot trap the
|
|
6
|
+
* agent in an endless reject/retry loop.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const DEFAULT_INSTRUCT_RETRY_WINDOW_MS = 5 * 60 * 1000;
|
|
10
|
+
|
|
11
|
+
function policyKey(verdict) {
|
|
12
|
+
if (Array.isArray(verdict?.policyNames) && verdict.policyNames.length > 0) {
|
|
13
|
+
return [...verdict.policyNames].map(String).sort().join(",");
|
|
14
|
+
}
|
|
15
|
+
if (verdict?.policyName) return String(verdict.policyName);
|
|
16
|
+
return String(verdict?.reason ?? "instruct");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function identity(payload, ctx) {
|
|
20
|
+
const p = payload || {};
|
|
21
|
+
const c = ctx || {};
|
|
22
|
+
const session = c.sessionKey ?? p.sessionKey ?? c.sessionId ?? p.sessionId;
|
|
23
|
+
const run = c.runId ?? p.runId;
|
|
24
|
+
if (session !== undefined && session !== null && session !== "") {
|
|
25
|
+
return {
|
|
26
|
+
scope: `session:${String(session)}${run ? `:run:${String(run)}` : ""}`,
|
|
27
|
+
sessionPrefix: `session:${String(session)}`,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (run !== undefined && run !== null && run !== "") {
|
|
31
|
+
return { scope: `run:${String(run)}`, sessionPrefix: null };
|
|
32
|
+
}
|
|
33
|
+
return { scope: null, sessionPrefix: null };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function createInstructRetryGate({
|
|
37
|
+
windowMs = DEFAULT_INSTRUCT_RETRY_WINDOW_MS,
|
|
38
|
+
now = () => Date.now(),
|
|
39
|
+
} = {}) {
|
|
40
|
+
const instructedUntil = new Map();
|
|
41
|
+
|
|
42
|
+
function prune(at) {
|
|
43
|
+
for (const [key, expiresAt] of instructedUntil) {
|
|
44
|
+
if (expiresAt <= at) instructedUntil.delete(key);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
/** True means interrupt this attempt and show the instruction to the model. */
|
|
50
|
+
shouldInterrupt(verdict, payload, ctx) {
|
|
51
|
+
const at = now();
|
|
52
|
+
prune(at);
|
|
53
|
+
const { scope } = identity(payload, ctx);
|
|
54
|
+
// Never let one anonymous hook invocation suppress another unrelated
|
|
55
|
+
// session. OpenClaw normally supplies sessionKey/runId; if it does not,
|
|
56
|
+
// fail safe by delivering the instruction on every matching attempt.
|
|
57
|
+
if (!scope) return true;
|
|
58
|
+
const key = `${scope}\0${policyKey(verdict)}`;
|
|
59
|
+
const expiresAt = instructedUntil.get(key);
|
|
60
|
+
if (expiresAt !== undefined && expiresAt > at) return false;
|
|
61
|
+
instructedUntil.set(key, at + windowMs);
|
|
62
|
+
return true;
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
clear(payload, ctx) {
|
|
66
|
+
const { sessionPrefix, scope } = identity(payload, ctx);
|
|
67
|
+
const prefix = sessionPrefix ?? scope;
|
|
68
|
+
if (!prefix) return;
|
|
69
|
+
for (const key of instructedUntil.keys()) {
|
|
70
|
+
if (key.startsWith(`${prefix}\0`) || key.startsWith(`${prefix}:run:`)) {
|
|
71
|
+
instructedUntil.delete(key);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Map failproofai's flat verdict to OpenClaw's before_tool_call result. */
|
|
79
|
+
export function mapBeforeToolVerdict(verdict, payload, ctx, retryGate) {
|
|
80
|
+
if (verdict?.permission === "deny") {
|
|
81
|
+
return { block: true, blockReason: verdict.reason || "Blocked by failproofai" };
|
|
82
|
+
}
|
|
83
|
+
if (verdict?.permission !== "instruct") return undefined;
|
|
84
|
+
if (!retryGate.shouldInterrupt(verdict, payload, ctx)) return undefined;
|
|
85
|
+
return {
|
|
86
|
+
block: true,
|
|
87
|
+
blockReason: verdict.reason || "Instruction from failproofai: reconsider this action before retrying",
|
|
88
|
+
};
|
|
89
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "failproofai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5-beta.1",
|
|
4
4
|
"description": "Observability and enforcement for AI agent harnesses. 39 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"failproofai": "./dist/cli.mjs",
|
|
@@ -121,15 +121,15 @@
|
|
|
121
121
|
"browserslist": "4.28.8"
|
|
122
122
|
},
|
|
123
123
|
"optionalDependencies": {
|
|
124
|
-
"@failproofai/failproofaid-linux-x64": "1.0.
|
|
125
|
-
"@failproofai/failproofaid-linux-arm64": "1.0.
|
|
126
|
-
"@failproofai/failproofaid-darwin-x64": "1.0.
|
|
127
|
-
"@failproofai/failproofaid-darwin-arm64": "1.0.
|
|
124
|
+
"@failproofai/failproofaid-linux-x64": "1.0.5-beta.1",
|
|
125
|
+
"@failproofai/failproofaid-linux-arm64": "1.0.5-beta.1",
|
|
126
|
+
"@failproofai/failproofaid-darwin-x64": "1.0.5-beta.1",
|
|
127
|
+
"@failproofai/failproofaid-darwin-arm64": "1.0.5-beta.1"
|
|
128
128
|
},
|
|
129
129
|
"failproofaidBinaries": {
|
|
130
|
-
"linux-x64": "
|
|
131
|
-
"linux-arm64": "
|
|
132
|
-
"darwin-x64": "
|
|
133
|
-
"darwin-arm64": "
|
|
130
|
+
"linux-x64": "c782c8d7c8522bf8af6f776640cae80fa671affa5b92d8c09e646c8f381d7fd4",
|
|
131
|
+
"linux-arm64": "6e9717ef40872a530501ad17cc6bc9743546968e11acf45f87f35488d1563e28",
|
|
132
|
+
"darwin-x64": "b47adb286e2cf08370ec2e1293ea3ed42891c7d2a8a1bece3da8e3e2b0d72f7a",
|
|
133
|
+
"darwin-arm64": "a5095522dc3f2518fc8177e9e2a3048062540958e3b623b198b401a7d6a2ddd5"
|
|
134
134
|
}
|
|
135
135
|
}
|
|
@@ -798,9 +798,12 @@ export async function evaluatePolicies(
|
|
|
798
798
|
|
|
799
799
|
// OpenClaw: Stop (before_agent_finalize) can force a revise, so we emit the
|
|
800
800
|
// MANDATORY ACTION wording as a flat deny — the shim maps it to
|
|
801
|
-
// {action:"revise", reason}.
|
|
802
|
-
//
|
|
803
|
-
//
|
|
801
|
+
// {action:"revise", reason}. PreToolUse has no non-blocking context channel,
|
|
802
|
+
// but a rejected tool's blockReason is model-visible. Preserve `instruct`
|
|
803
|
+
// in the wire verdict so the shim can interrupt the first matching attempt,
|
|
804
|
+
// deliver the instruction through blockReason, and allow a retry. Other
|
|
805
|
+
// events still degrade to allow + stderr because their return channels
|
|
806
|
+
// cannot carry an instruction to the model.
|
|
804
807
|
if (session?.cli === "openclaw") {
|
|
805
808
|
if (eventType === "Stop") {
|
|
806
809
|
const policyAttribution = policyNames.length === 1
|
|
@@ -817,6 +820,22 @@ export async function evaluatePolicies(
|
|
|
817
820
|
decision: "instruct",
|
|
818
821
|
};
|
|
819
822
|
}
|
|
823
|
+
if (eventType === "PreToolUse") {
|
|
824
|
+
return {
|
|
825
|
+
exitCode: 0,
|
|
826
|
+
stdout: JSON.stringify({
|
|
827
|
+
permission: "instruct",
|
|
828
|
+
reason: `Instruction from failproofai: ${combined}`,
|
|
829
|
+
policyName: policyNames[0],
|
|
830
|
+
policyNames,
|
|
831
|
+
}),
|
|
832
|
+
stderr: "",
|
|
833
|
+
policyName: policyNames[0],
|
|
834
|
+
policyNames,
|
|
835
|
+
reason: combined,
|
|
836
|
+
decision: "instruct",
|
|
837
|
+
};
|
|
838
|
+
}
|
|
820
839
|
const stderrMsg = instructEntries
|
|
821
840
|
.map((e) => `[failproofai] ${e.policyName}: ${e.reason}`)
|
|
822
841
|
.join("\n");
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[2157,(t,e,n)=>{e.exports=t.x("node:fs",()=>require("node:fs"))},60526,(t,e,n)=>{e.exports=t.x("node:os",()=>require("node:os"))},54214,67405,t=>{"use strict";var e=t.i(24868),n=t.i(14747),i=t.i(81580),s=t.i(56936);async function r(t,i,s,r){let a=`agent-${r}.jsonl`;for(let r of[(0,n.join)(t,i,a),(0,n.join)(t,i,s,a),(0,n.join)(t,i,s,"subagents",a)])if(!(0,n.relative)(t,r).startsWith(".."))try{return await (0,e.access)(r),r}catch(t){if("ENOENT"===t.code)continue;break}return null}var a=t.i(83534),o=t.i(71809),u=t.i(28557);function l(t){if(t<1e3)return`${t}ms`;let e=Math.round(t/100);if(e<600)return`${(e/10).toFixed(1)}s`;let n=Math.round(t/1e3);if(n<3600){let t=Math.floor(n/60);return`${t}m ${n%60}s`}let i=Math.round(t/6e4),s=Math.floor(i/60);return`${s}h ${i%60}m`}function m(t){let e=(0,u.formatDate)(t),n=t.getMilliseconds().toString().padStart(3,"0");return`${e}.${n}`}function p(t,e,n,i){return{_source:i,uuid:t.uuid||"",parentUuid:t.parentUuid??null,timestamp:e,timestampMs:n.getTime(),timestampFormatted:m(n)}}async function f(t,e){let n=t.split("\n").filter(t=>""!==t.trim()),i=new Map,s=[],r=[],a=new Set,o=!1;for(let t=0;t<n.length;t++){let u;t>0&&t%200==0&&await new Promise(t=>setImmediate(t));let l=n[t];try{u=JSON.parse(l)}catch{continue}let m={...u,_source:e};r.push(m);let f=u.type,c=u.timestamp;if(!c)continue;let d=new Date(c),y=d.getTime();if("user"===f){let t=u.message;if(Array.isArray(t?.content)){let e=t.content;if(e.some(t=>"tool_result"===t.type)){let t=u.toolUseResult,n="string"==typeof t?.agentId?t.agentId:void 0;for(let t of(n&&/^[a-f0-9]+$/.test(n)&&a.add(n),e)){if("tool_result"!==t.type)continue;let e=t.tool_use_id;if(!e)continue;let{text:s,images:r}=function(t){let e=t.content;if("string"==typeof e)return{text:e};if(Array.isArray(e)){let t=e.filter(t=>"text"===t.type).map(t=>t.text),n=e.filter(t=>"image"===t.type).map(t=>{let e=t.source;return{base64:e.data,mediaType:e.media_type}}).filter(t=>t.base64&&t.mediaType);return{text:t.length>0?t.join("\n"):void 0,images:n.length>0?n:void 0}}return{}}(t);i.set(e,{timestamp:c,timestampMs:y,content:s,images:r,agentId:n})}continue}}let n="string"==typeof t?.content?t.content:"";s.push({type:"user",...p(u,c,d,e),message:{role:"user",content:n}});continue}if("assistant"===f){let t=u.message,n=[];if(Array.isArray(t?.content)&&(n=t.content.filter(t=>["text","tool_use","thinking"].includes(t.type)).map(t=>{if("text"===t.type)return{type:"text",text:t.text};if("tool_use"===t.type){let e=t.input;return{type:"tool_use",id:t.id,name:t.name,input:t.input??{},..."Task"===t.name&&e?{subagentType:e.subagent_type,subagentDescription:e.description}:{}}}return{type:"thinking",thinking:t.thinking,signature:t.signature}})),0===n.length)continue;s.push({type:"assistant",...p(u,c,d,e),message:{role:"assistant",content:n,model:t?.model}});continue}if("file-history-snapshot"===f||"progress"===f||"system"===f){s.push({type:f,...p(u,c,d,e),raw:{...u}});continue}if("queue-operation"===f){let t=o?"Session Resumed":"Session Started";o=!0,s.push({type:"queue-operation",...p(u,c,d,e),label:t});continue}}let u=0;for(let t of s)if("assistant"===t.type)for(let e of(++u%200==0&&await new Promise(t=>setImmediate(t)),t.message.content)){if("tool_use"!==e.type)continue;let n=i.get(e.id);if(!n)continue;let s=new Date(n.timestamp),r=Math.max(0,n.timestampMs-t.timestampMs);e.result={timestamp:n.timestamp,timestampFormatted:m(s),content:n.content,images:n.images,durationMs:r,durationFormatted:l(r)},n.agentId&&(e.subagentId=n.agentId)}return s.length>500&&await new Promise(t=>setImmediate(t)),s.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:s,rawLines:r,subagentIds:Array.from(a)}}async function c(t,e="session"){return(await f(t,e)).entries}async function d(t,a){let u=(0,s.resolveProjectPath)(t),l=(0,i.getClaudeProjectsPath)(),m=(0,n.join)(u,`${a}.jsonl`),p=await (0,e.readFile)(m,"utf-8"),{entries:c,rawLines:d,subagentIds:y}=await f(p,"session");if(0===y.length)return{entries:c,rawLines:d,subagentIds:[]};let g=await (0,o.batchAll)(y.map(n=>async()=>{let i=`agent-${n}`,s=await r(l,t,a,n);if(!s)return null;let o=await (0,e.readFile)(s,"utf-8"),{entries:u,rawLines:m}=await f(o,i);return{entries:u,rawLines:m}}),4),h=[...c],w=[...d];for(let t of g)"fulfilled"===t.status&&t.value&&(h.push(...t.value.entries),w.push(...t.value.rawLines));return h.length>500&&await new Promise(t=>setImmediate(t)),h.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:h,rawLines:w,subagentIds:y}}t.s(["formatDuration",0,l],67405),(0,a.runtimeCache)((t,e)=>d(t,e),60,{maxSize:50}),t.s(["baseEntry",0,p,"formatTimestamp",0,m,"parseLogContent",0,c,"parseRawLines",0,function(t,e){return t.split("\n").filter(t=>""!==t.trim()).flatMap(t=>{try{let n=JSON.parse(t);return void 0!==e&&(n._source=e),[n]}catch{return[]}})}],54214)},64199,t=>{"use strict";var e=t.i(12714),n=t.i(2157),i=t.i(60526),s=t.i(50227),r=t.i(83534),a=t.i(54214),o=t.i(67405);let u=/^[0-9a-fA-F-]{36}$/;function l(){return process.env.OPENCLAW_HOME||(0,s.join)((0,i.homedir)(),".openclaw")}function m(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function p(t){return"string"==typeof t?t:Array.isArray(t)?t.map(t=>m(t)&&"string"==typeof t.text?t.text:"").filter(Boolean).join("\n"):""}function f(){let t,e=(0,s.join)(l(),"agents"),i=[];try{t=(0,n.readdirSync)(e,{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name)}catch{return i}for(let r of t){let t,a=(0,s.join)(e,r,"sessions");try{t=(0,n.readdirSync)(a)}catch{continue}for(let e of t){if(!e.endsWith(".jsonl")||e.endsWith(".trajectory.jsonl"))continue;let t=e.slice(0,-6);if(!u.test(t))continue;let o=(0,s.join)(a,e);try{let e=(0,n.statSync)(o);i.push({agentId:r,sessionId:t,transcriptPath:o,mtimeMs:e.mtimeMs,sizeBytes:e.size})}catch{}}}return i}function c(t){if(!u.test(t))return null;for(let e of f())if(e.sessionId===t)return e.transcriptPath;return null}async function d(t){let n,i,s=c(t);if(!s)return null;try{n=await (0,e.readFile)(s,"utf-8")}catch{return null}let r=(0,a.parseRawLines)(n,"session"),u=function(t,e="session"){let n=[],i=new Map,s=new Map,r=Date.now();for(let u=0;u<t.length;u++){let l=t[u];if(!m(l)||"message"!==l.type)continue;let f=m(l.message)?l.message:void 0;if(!f)continue;let c="string"==typeof f.role?f.role:"system",d=function(t,e){if("number"==typeof t&&Number.isFinite(t)){if(t>1e12)return new Date(t);if(t>1e9)return new Date(1e3*t)}if("string"==typeof t){let e=Date.parse(t);if(!Number.isNaN(e))return new Date(e)}return new Date(e)}(l.timestamp??f.timestamp,r+u),y=d.toISOString(),g={uuid:null!=l.id?String(l.id):`openclaw-${u}`,parentUuid:null!=l.parentId?String(l.parentId):null},h=(0,a.baseEntry)(g,y,d,e);if("user"===c){n.push({type:"user",...h,message:{role:"user",content:p(f.content)}});continue}if("assistant"===c){let t=[],e=f.content;if(Array.isArray(e)){for(let n of e)if(m(n)){if("text"===n.type&&"string"==typeof n.text)t.push({type:"text",text:n.text});else if("toolCall"===n.type){let e="string"==typeof n.id?n.id:`${String(n.name??"tool")}-${t.length}`,r={type:"tool_use",id:e,name:"string"==typeof n.name?n.name:"tool",input:m(n.arguments)?n.arguments:{}};t.push(r),i.set(e,r),s.set(e,d.getTime())}}}else{let n=p(e);n&&t.push({type:"text",text:n})}if(0===t.length)continue;n.push({type:"assistant",...h,message:{role:"assistant",content:t,model:"string"==typeof f.model?f.model:void 0}});continue}if("toolResult"===c){let t="string"==typeof f.toolCallId?f.toolCallId:void 0,e=t?i.get(t):void 0;if(e){let n=m(f.details)?f.details:void 0,i=t&&s.get(t)||d.getTime(),r=n&&"number"==typeof n.durationMs?n.durationMs:Math.max(0,d.getTime()-i);e.result={timestamp:y,timestampFormatted:(0,a.formatTimestamp)(d),content:p(f.content),durationMs:r,durationFormatted:(0,o.formatDuration)(r)};continue}}n.push({type:"system",...h,raw:g})}return n.sort((t,e)=>t.timestampMs-e.timestampMs),n}(r,"session");for(let t of r)if(m(t)&&"session"===t.type&&"string"==typeof t.cwd&&t.cwd.length>0){i=t.cwd;break}return{entries:u,rawLines:r,cwd:i,filePath:s}}(0,r.runtimeCache)(t=>d(t),2,{maxSize:50}),t.s(["findOpenClawTranscript",0,c,"getOpenClawSessionLog",0,d,"listOpenClawAgents",0,function(){try{return(0,n.readdirSync)((0,s.join)(l(),"agents"),{withFileTypes:!0}).filter(t=>t.isDirectory()&&!t.name.startsWith(".")).map(t=>t.name).sort()}catch{return[]}},"listOpenClawTranscripts",0,f,"openclawHome",0,l])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__0-219ec._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[2157,(e,t,n)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},60526,(e,t,n)=>{t.exports=e.x("node:os",()=>require("node:os"))},54214,67405,e=>{"use strict";var t=e.i(24868),n=e.i(14747),i=e.i(81580),s=e.i(56936);async function a(e,i,s,a){let r=`agent-${a}.jsonl`;for(let a of[(0,n.join)(e,i,r),(0,n.join)(e,i,s,r),(0,n.join)(e,i,s,"subagents",r)])if(!(0,n.relative)(e,a).startsWith(".."))try{return await (0,t.access)(a),a}catch(e){if("ENOENT"===e.code)continue;break}return null}var r=e.i(83534),o=e.i(71809),l=e.i(28557);function u(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/100);if(t<600)return`${(t/10).toFixed(1)}s`;let n=Math.round(e/1e3);if(n<3600){let e=Math.floor(n/60);return`${e}m ${n%60}s`}let i=Math.round(e/6e4),s=Math.floor(i/60);return`${s}h ${i%60}m`}function c(e){let t=(0,l.formatDate)(e),n=e.getMilliseconds().toString().padStart(3,"0");return`${t}.${n}`}function p(e,t,n,i){return{_source:i,uuid:e.uuid||"",parentUuid:e.parentUuid??null,timestamp:t,timestampMs:n.getTime(),timestampFormatted:c(n)}}async function f(e,t){let n=e.split("\n").filter(e=>""!==e.trim()),i=new Map,s=[],a=[],r=new Set,o=!1;for(let e=0;e<n.length;e++){let l;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let u=n[e];try{l=JSON.parse(u)}catch{continue}let c={...l,_source:t};a.push(c);let f=l.type,m=l.timestamp;if(!m)continue;let d=new Date(m),g=d.getTime();if("user"===f){let e=l.message;if(Array.isArray(e?.content)){let t=e.content;if(t.some(e=>"tool_result"===e.type)){let e=l.toolUseResult,n="string"==typeof e?.agentId?e.agentId:void 0;for(let e of(n&&/^[a-f0-9]+$/.test(n)&&r.add(n),t)){if("tool_result"!==e.type)continue;let t=e.tool_use_id;if(!t)continue;let{text:s,images:a}=function(e){let t=e.content;if("string"==typeof t)return{text:t};if(Array.isArray(t)){let e=t.filter(e=>"text"===e.type).map(e=>e.text),n=t.filter(e=>"image"===e.type).map(e=>{let t=e.source;return{base64:t.data,mediaType:t.media_type}}).filter(e=>e.base64&&e.mediaType);return{text:e.length>0?e.join("\n"):void 0,images:n.length>0?n:void 0}}return{}}(e);i.set(t,{timestamp:m,timestampMs:g,content:s,images:a,agentId:n})}continue}}let n="string"==typeof e?.content?e.content:"";s.push({type:"user",...p(l,m,d,t),message:{role:"user",content:n}});continue}if("assistant"===f){let e=l.message,n=[];if(Array.isArray(e?.content)&&(n=e.content.filter(e=>["text","tool_use","thinking"].includes(e.type)).map(e=>{if("text"===e.type)return{type:"text",text:e.text};if("tool_use"===e.type){let t=e.input;return{type:"tool_use",id:e.id,name:e.name,input:e.input??{},..."Task"===e.name&&t?{subagentType:t.subagent_type,subagentDescription:t.description}:{}}}return{type:"thinking",thinking:e.thinking,signature:e.signature}})),0===n.length)continue;s.push({type:"assistant",...p(l,m,d,t),message:{role:"assistant",content:n,model:e?.model}});continue}if("file-history-snapshot"===f||"progress"===f||"system"===f){s.push({type:f,...p(l,m,d,t),raw:{...l}});continue}if("queue-operation"===f){let e=o?"Session Resumed":"Session Started";o=!0,s.push({type:"queue-operation",...p(l,m,d,t),label:e});continue}}let l=0;for(let e of s)if("assistant"===e.type)for(let t of(++l%200==0&&await new Promise(e=>setImmediate(e)),e.message.content)){if("tool_use"!==t.type)continue;let n=i.get(t.id);if(!n)continue;let s=new Date(n.timestamp),a=Math.max(0,n.timestampMs-e.timestampMs);t.result={timestamp:n.timestamp,timestampFormatted:c(s),content:n.content,images:n.images,durationMs:a,durationFormatted:u(a)},n.agentId&&(t.subagentId=n.agentId)}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:a,subagentIds:Array.from(r)}}async function m(e,t="session"){return(await f(e,t)).entries}async function d(e,r){let l=(0,s.resolveProjectPath)(e),u=(0,i.getClaudeProjectsPath)(),c=(0,n.join)(l,`${r}.jsonl`),p=await (0,t.readFile)(c,"utf-8"),{entries:m,rawLines:d,subagentIds:g}=await f(p,"session");if(0===g.length)return{entries:m,rawLines:d,subagentIds:[]};let y=await (0,o.batchAll)(g.map(n=>async()=>{let i=`agent-${n}`,s=await a(u,e,r,n);if(!s)return null;let o=await (0,t.readFile)(s,"utf-8"),{entries:l,rawLines:c}=await f(o,i);return{entries:l,rawLines:c}}),4),h=[...m],w=[...d];for(let e of y)"fulfilled"===e.status&&e.value&&(h.push(...e.value.entries),w.push(...e.value.rawLines));return h.length>500&&await new Promise(e=>setImmediate(e)),h.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:h,rawLines:w,subagentIds:g}}e.s(["formatDuration",0,u],67405),(0,r.runtimeCache)((e,t)=>d(e,t),60,{maxSize:50}),e.s(["baseEntry",0,p,"formatTimestamp",0,c,"parseLogContent",0,m,"parseRawLines",0,function(e,t){return e.split("\n").filter(e=>""!==e.trim()).flatMap(e=>{try{let n=JSON.parse(e);return void 0!==t&&(n._source=t),[n]}catch{return[]}})}],54214)},90624,e=>{"use strict";var t=e.i(2157),n=e.i(50227),i=e.i(83534),s=e.i(64199),a=e.i(28557);function r(e){return"string"==typeof e&&e.length>0?e:void 0}async function o(){let e=(0,s.listOpenClawTranscripts)(),i=new Map,a=[];for(let o of e){let e=i.get(o.agentId);e||(e=function(e){let i,a=new Map,o=(0,n.join)((0,s.openclawHome)(),"agents",e,"sessions","sessions.json");try{i=JSON.parse((0,t.readFileSync)(o,"utf-8"))}catch{return a}if(!i||"object"!=typeof i)return a;for(let e of Object.values(i)){if(!e||"object"!=typeof e)continue;let t=r(e.sessionId);if(!t)continue;let n=e.origin&&"object"==typeof e.origin?e.origin:{},i="number"==typeof e.lastInteractionAt?e.lastInteractionAt:"number"==typeof e.updatedAt?e.updatedAt:void 0;a.set(t,{lastMs:i,channel:r(e.lastChannel)??r(n.provider)??r(n.surface),chatType:r(e.chatType)??r(n.chatType),label:r(n.label),chatId:r(e.lastTo)??r(n.from)})}return a}(o.agentId),i.set(o.agentId,e));let l=e.get(o.sessionId);a.push({sessionId:o.sessionId,agentId:o.agentId,channel:l?.channel??"local",label:l?.label,chatType:l?.chatType,chatId:l?.chatId,transcriptPath:o.transcriptPath,mtimeMs:l?.lastMs??o.mtimeMs,sizeBytes:o.sizeBytes})}return a.sort((e,t)=>t.mtimeMs-e.mtimeMs),a}let l=(0,i.runtimeCache)(o,2);function u(e,t){return`openclaw-${e}-${t}`}function c(e,t){return`openclaw:${e}:${t}`}function p(e){if(!e.startsWith("openclaw-"))return[];let t=e.slice(9);if(!t)return[];let n=[];for(let e of(0,s.listOpenClawAgents)().sort((e,t)=>t.length-e.length)){let i=`${e}-`;t.startsWith(i)&&t.length>i.length&&n.push({agentId:e,channel:t.slice(i.length)})}return n.push({agentId:null,channel:t}),n}async function f(){let e=await o(),t=new Map;for(let n of e){let e=JSON.stringify([n.agentId,n.channel]),i=t.get(e);i?(i.latest=Math.max(i.latest,n.mtimeMs),i.count+=1):t.set(e,{agentId:n.agentId,channel:n.channel,latest:n.mtimeMs,count:1})}let n=[];for(let{agentId:e,channel:i,latest:s,count:r}of t.values()){let t=new Date(s);n.push({name:u(e,i),path:c(e,i),isDirectory:!0,lastModified:t,lastModifiedFormatted:(0,a.formatDate)(t),cli:["openclaw"],sessionCount:r})}return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}async function m(e){let t=p(e);if(0===t.length)return{cwd:null,sessions:[]};let n=await o(),i=e=>n.filter(t=>t.channel===e.channel&&(null===e.agentId||t.agentId===e.agentId)),s=t[0],r=i(s);if(0===r.length)for(let e of t.slice(1)){let t=i(e);if(t.length>0){s=e,r=t;break}}let{agentId:l,channel:u}=s;return{cwd:null===l?`openclaw:${u}`:c(l,u),sessions:r.map(e=>{let t=new Date(e.mtimeMs);return{name:e.label??e.chatId??e.sessionId,path:e.sessionId,lastModified:t,lastModifiedFormatted:(0,a.formatDate)(t),sessionId:e.sessionId,cli:"openclaw",channelId:e.chatId,channelType:e.chatType}})}}let d=(0,i.runtimeCache)(f,2),g=(0,i.runtimeCache)(e=>m(e),2,{maxSize:50});e.s(["getCachedOpenClawProjects",0,d,"getCachedOpenClawSessions",0,l,"getCachedOpenClawSessionsByEncodedName",0,g,"getOpenClawProjects",0,f,"getOpenClawSessions",0,o,"getOpenClawSessionsByEncodedName",0,m,"openClawProjectName",0,u,"openClawProjectNameCandidates",0,p,"openClawProjectPath",0,c,"parseOpenClawProjectName",0,function(e){return p(e)[0]??null}])},64199,e=>{"use strict";var t=e.i(12714),n=e.i(2157),i=e.i(60526),s=e.i(50227),a=e.i(83534),r=e.i(54214),o=e.i(67405);let l=/^[0-9a-fA-F-]{36}$/;function u(){return process.env.OPENCLAW_HOME||(0,s.join)((0,i.homedir)(),".openclaw")}function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function p(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>c(e)&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):""}function f(){let e,t=(0,s.join)(u(),"agents"),i=[];try{e=(0,n.readdirSync)(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name)}catch{return i}for(let a of e){let e,r=(0,s.join)(t,a,"sessions");try{e=(0,n.readdirSync)(r)}catch{continue}for(let t of e){if(!t.endsWith(".jsonl")||t.endsWith(".trajectory.jsonl"))continue;let e=t.slice(0,-6);if(!l.test(e))continue;let o=(0,s.join)(r,t);try{let t=(0,n.statSync)(o);i.push({agentId:a,sessionId:e,transcriptPath:o,mtimeMs:t.mtimeMs,sizeBytes:t.size})}catch{}}}return i}function m(e){if(!l.test(e))return null;for(let t of f())if(t.sessionId===e)return t.transcriptPath;return null}async function d(e){let n,i,s=m(e);if(!s)return null;try{n=await (0,t.readFile)(s,"utf-8")}catch{return null}let a=(0,r.parseRawLines)(n,"session"),l=function(e,t="session"){let n=[],i=new Map,s=new Map,a=Date.now();for(let l=0;l<e.length;l++){let u=e[l];if(!c(u)||"message"!==u.type)continue;let f=c(u.message)?u.message:void 0;if(!f)continue;let m="string"==typeof f.role?f.role:"system",d=function(e,t){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return new Date(e);if(e>1e9)return new Date(1e3*e)}if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}return new Date(t)}(u.timestamp??f.timestamp,a+l),g=d.toISOString(),y={uuid:null!=u.id?String(u.id):`openclaw-${l}`,parentUuid:null!=u.parentId?String(u.parentId):null},h=(0,r.baseEntry)(y,g,d,t);if("user"===m){n.push({type:"user",...h,message:{role:"user",content:p(f.content)}});continue}if("assistant"===m){let e=[],t=f.content;if(Array.isArray(t)){for(let n of t)if(c(n)){if("text"===n.type&&"string"==typeof n.text)e.push({type:"text",text:n.text});else if("toolCall"===n.type){let t="string"==typeof n.id?n.id:`${String(n.name??"tool")}-${e.length}`,a={type:"tool_use",id:t,name:"string"==typeof n.name?n.name:"tool",input:c(n.arguments)?n.arguments:{}};e.push(a),i.set(t,a),s.set(t,d.getTime())}}}else{let n=p(t);n&&e.push({type:"text",text:n})}if(0===e.length)continue;n.push({type:"assistant",...h,message:{role:"assistant",content:e,model:"string"==typeof f.model?f.model:void 0}});continue}if("toolResult"===m){let e="string"==typeof f.toolCallId?f.toolCallId:void 0,t=e?i.get(e):void 0;if(t){let n=c(f.details)?f.details:void 0,i=e&&s.get(e)||d.getTime(),a=n&&"number"==typeof n.durationMs?n.durationMs:Math.max(0,d.getTime()-i);t.result={timestamp:g,timestampFormatted:(0,r.formatTimestamp)(d),content:p(f.content),durationMs:a,durationFormatted:(0,o.formatDuration)(a)};continue}}n.push({type:"system",...h,raw:y})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}(a,"session");for(let e of a)if(c(e)&&"session"===e.type&&"string"==typeof e.cwd&&e.cwd.length>0){i=e.cwd;break}return{entries:l,rawLines:a,cwd:i,filePath:s}}(0,a.runtimeCache)(e=>d(e),2,{maxSize:50}),e.s(["findOpenClawTranscript",0,m,"getOpenClawSessionLog",0,d,"listOpenClawAgents",0,function(){try{return(0,n.readdirSync)((0,s.join)(u(),"agents"),{withFileTypes:!0}).filter(e=>e.isDirectory()&&!e.name.startsWith(".")).map(e=>e.name).sort()}catch{return[]}},"listOpenClawTranscripts",0,f,"openclawHome",0,u])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__04_h-a5._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[22734,(e,r,t)=>{r.exports=e.x("fs",()=>require("fs"))},24868,(e,r,t)=>{r.exports=e.x("fs/promises",()=>require("fs/promises"))},70406,(e,r,t)=>{r.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,r,t)=>{r.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},20635,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},56704,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,r,t)=>{r.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,r,t)=>{r.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,r,t)=>{r.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,r,t)=>{r.exports=e.x("node:path",()=>require("node:path"))},81111,(e,r,t)=>{r.exports=e.x("node:stream",()=>require("node:stream"))},46786,(e,r,t)=>{r.exports=e.x("os",()=>require("os"))},14747,(e,r,t)=>{r.exports=e.x("path",()=>require("path"))},91301,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1qb590j._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(30441)))},16341,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1shcqgr._.js"].map(r=>e.l(r))).then(()=>r(93114)))},37352,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1jm9fw6._.js"].map(r=>e.l(r))).then(()=>r(36203)))},18944,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__17g9wh7._.js","server/chunks/src_hooks_fp-home_ts_09kv0bn._.js"].map(r=>e.l(r))).then(()=>r(57232)))},71809,e=>{"use strict";async function r(e,r){let t=Array(e.length),s=0;async function o(){for(;s<e.length;){let r=s++;try{t[r]={status:"fulfilled",value:await e[r]()}}catch(e){t[r]={status:"rejected",reason:e}}}}let a=Array.from({length:Math.min(r,e.length)},()=>o());return await Promise.all(a),t}e.s(["batchAll",0,r])},5807,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1w9zl9-._.js"].map(r=>e.l(r))).then(()=>r(55851)))},21476,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1legmza._.js"].map(r=>e.l(r))).then(()=>r(78166)))},97452,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1ou2ehh._.js"].map(r=>e.l(r))).then(()=>r(46413)))},23414,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0rv7m0k._.js"].map(r=>e.l(r))).then(()=>r(72094)))},52400,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0g6bbuw._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(79364)))},53229,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1ffkmds._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(40375)))},62998,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0q0qzx1._.js"].map(r=>e.l(r))).then(()=>r(69391)))},95231,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0--lkk6._.js"].map(r=>e.l(r))).then(()=>r(28246)))},28557,e=>{"use strict";e.s(["formatDate",0,function(e){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}).format(e)}])},31854,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__08w4wmd._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(69164)))},49081,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1xuedea._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(36618)))},67347,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1anxb5k._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(64828)))},32359,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0zlqo2t._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(3605)))},40911,e=>{"use strict";let r={info:0,warn:1,error:2};function t(e){return r[e]>=r.warn}function s(e){return`[failproofai${new Date().toISOString()}] ${e}`}e.s(["logActivity",0,function(e,r,o){if(!t("info"))return;let a=[`user=${e}`,`action=${r}`];o&&a.push(o),console.log(s("ACTIVITY"),a.join(" "))},"logError",0,function(e,r){void 0!==r?console.error(s("ERROR"),e,r):console.error(s("ERROR"),e)},"logWarn",0,function(e,r){t("warn")&&(void 0!==r?console.warn(s("WARN"),e,r):console.warn(s("WARN"),e))}])},38978,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__04_h-a5._.js"].map(r=>e.l(r))).then(()=>r(90624)))},26435,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0-219ec._.js"].map(r=>e.l(r))).then(()=>r(64199)))},82978,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__03r-lqq._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(35435)))},82859,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__12021ot._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(99440)))},81580,e=>{"use strict";var r=e.i(46786),t=e.i(14747);e.s(["decodeFolderName",0,function(e){return/^[A-Za-z]--/.test(e)?e[0]+":/"+e.slice(3).replace(/-/g,"/"):e.replace(/-/g,"/")},"encodeFolderName",0,function(e){let r=/^([A-Za-z]):[\\/](.*)$/.exec(e);return r?r[1]+"--"+r[2].replace(/[\\/]/g,"-"):e.replace(/[\\/]/g,"-")},"getClaudeProjectsPath",0,function(){let e=process.env.CLAUDE_PROJECTS_PATH;return e||(0,t.join)((0,r.homedir)(),".claude","projects")}])},45093,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0f7mikp._.js"].map(r=>e.l(r))).then(()=>r(19791)))},41330,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0q-v9z2._.js"].map(r=>e.l(r))).then(()=>r(85116)))},56936,e=>{"use strict";var r=e.i(12714),t=e.i(50227),s=e.i(81580),o=e.i(83534),a=e.i(71809),n=e.i(40911),i=e.i(28557);let l=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;async function c(e,t){try{return(await (0,r.stat)(e)).mtime}catch(e){return(0,n.logWarn)(`Failed to stat ${t}:`,e),new Date(0)}}async function u(e){try{if(!(await (0,r.stat)(e)).isDirectory())return null;return await (0,r.readdir)(e,{withFileTypes:!0})}catch{return null}}async function h(){try{let e=(0,s.getClaudeProjectsPath)(),r=await u(e);if(!r)return[];let o=(await (0,a.batchAll)(r.filter(e=>e.isDirectory()).map(r=>async()=>{let s=(0,t.join)(e,r.name),o=await c(s,r.name);return{name:r.name,path:s,isDirectory:!0,lastModified:o,lastModifiedFormatted:(0,i.formatDate)(o),cli:["claude"]}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value);return o.sort((e,r)=>r.lastModified.getTime()-e.lastModified.getTime()),o}catch(e){return(0,n.logError)("Error reading Claude project folders:",e),[]}}async function d(){let[{getCodexProjects:r},{getCopilotProjects:t},{getCursorProjects:s},{getOpenCodeProjects:o},{getPiProjects:a},{getHermesProjects:i},{getOpenClawProjects:l},{getFactoryProjects:c},{getDevinProjects:u},{getAntigravityProjects:d},{getGooseProjects:m}]=await Promise.all([e.A(37352),e.A(5807),e.A(97452),e.A(82978),e.A(45093),e.A(67347),e.A(38978),e.A(62998),e.A(52400),e.A(91301),e.A(31854)]),[f,p,v,_,j,g,x,k,w,y,P,E]=await Promise.all([h(),r().catch(e=>((0,n.logError)("Error reading Codex projects:",e),[])),t().catch(e=>((0,n.logError)("Error reading Copilot projects:",e),[])),s().catch(e=>((0,n.logError)("Error reading Cursor projects:",e),[])),o().catch(e=>((0,n.logError)("Error reading OpenCode projects:",e),[])),a().catch(e=>((0,n.logError)("Error reading Pi projects:",e),[])),i().catch(e=>((0,n.logError)("Error reading Hermes projects:",e),[])),l().catch(e=>((0,n.logError)("Error reading OpenClaw projects:",e),[])),c().catch(e=>((0,n.logError)("Error reading Factory projects:",e),[])),u().catch(e=>((0,n.logError)("Error reading Devin projects:",e),[])),d().catch(e=>((0,n.logError)("Error reading Antigravity projects:",e),[])),m().catch(e=>((0,n.logError)("Error reading Goose projects:",e),[]))]);return function(...e){let r=new Map;for(let t of e)for(let e of t){let t=r.get(e.name);if(!t){r.set(e.name,{...e,cli:[...e.cli]});continue}let s=[...t.cli];for(let r of e.cli)s.includes(r)||s.push(r);let o=e.lastModified.getTime()>t.lastModified.getTime()?e:t;r.set(e.name,{...t,cli:s,lastModified:o.lastModified,lastModifiedFormatted:o.lastModifiedFormatted,sessionCount:void 0===t.sessionCount&&void 0===e.sessionCount?void 0:(t.sessionCount??0)+(e.sessionCount??0)})}let t=Array.from(r.values());return t.sort((e,r)=>r.lastModified.getTime()-e.lastModified.getTime()),t}(f,p,v,_,j,g,x,k,w,y,P,E)}function m(e){if(!e)throw RangeError("Empty project name");if(/^[/\\]/.test(e))throw RangeError("Absolute project name");let r=(0,t.resolve)((0,s.getClaudeProjectsPath)()),o=(0,t.resolve)((0,t.join)(r,e));if(!o.startsWith(r+t.sep))throw RangeError("Project path escapes root");return o}function f(e){let r=e.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i);return r?r[0]:void 0}async function p(e){try{let r=await u(e);if(!r)return[];let s=r.filter(e=>e.isFile()&&e.name.endsWith(".jsonl")&&f(e.name)),o=(await (0,a.batchAll)(s.map(r=>async()=>{let s=(0,t.join)(e,r.name),o=await c(s,r.name);return{name:r.name,path:s,lastModified:o,lastModifiedFormatted:(0,i.formatDate)(o),sessionId:f(r.name),cli:"claude"}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value);return o.sort((e,r)=>r.lastModified.getTime()-e.lastModified.getTime()),o}catch(e){return(0,n.logError)("Error reading session files:",e),[]}}(0,o.runtimeCache)(d,30),(0,o.runtimeCache)(e=>p(e),30),e.s(["UUID_RE",0,l,"resolveProjectPath",0,m,"resolveSessionFilePath",0,function(e,r){if(!l.test(r))throw RangeError("Invalid session ID");let s=m(e);return(0,t.join)(s,`${r}.jsonl`)}])},83534,e=>{"use strict";e.s(["runtimeCache",0,function(e,r,t){let s=new Map,o=new Map,a=t?.maxSize;return async(...t)=>{let n=JSON.stringify(t),i=s.get(n);if(i&&Date.now()<i.expiry)return i.data;let l=o.get(n);if(l)return l;let c=e(...t).then(e=>{if(o.delete(n),a&&s.size>=a){let e=s.keys().next().value;s.delete(e)}return s.set(n,{data:e,expiry:Date.now()+1e3*r}),e},e=>{throw o.delete(n),e});return o.set(n,c),c}}])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__1le9jqc._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},39907,a=>{a.v(a=>Promise.resolve().then(()=>a(96795)))},93658,a=>{a.v(a=>Promise.resolve().then(()=>a(1024)))},60956,a=>{a.v(a=>Promise.resolve().then(()=>a(88890)))},26244,a=>{a.v(a=>Promise.resolve().then(()=>a(93087)))},11848,a=>{a.v(a=>Promise.resolve().then(()=>a(15771)))},71273,a=>{a.v(a=>Promise.resolve().then(()=>a(26732)))},14028,a=>{a.v(a=>Promise.resolve().then(()=>a(81057)))},84789,a=>{a.v(a=>Promise.resolve().then(()=>a(83884)))},74486,a=>{a.v(a=>Promise.resolve().then(()=>a(96877)))},2164,a=>{a.v(a=>Promise.resolve().then(()=>a(64458)))},92351,a=>{a.v(a=>Promise.resolve().then(()=>a(2727)))},39729,a=>{"use strict";var b=a.i(12948),c=a.i(67436),d=a.i(94331);a.i(70408);let e=(0,b.instrumentModuleGetter)(()=>a.r(70864)),f=(0,b.instrumentModuleGetter)(()=>a.r(65897)),g=(0,b.instrumentModuleGetter)(()=>a.r(43619)),h=(0,b.instrumentModuleGetter)(()=>a.r(13718)),i=(0,b.instrumentModuleGetter)(()=>a.r(18198)),j=(0,b.instrumentModuleGetter)(()=>a.r(94367)),k=(0,b.instrumentModuleGetter)(()=>a.r(16733)),l=(0,b.instrumentModuleGetter)(()=>a.r(4466)),m=["",{children:["project",{children:["[name]",{children:["__PAGE__",{},{metadata:{},page:[(0,b.instrumentModuleGetter)(()=>a.r(11363)),"[project]/app/project/[name]/page.tsx"]},[]]},{metadata:{},error:[k,"[project]/app/project/[name]/error.tsx"],loading:[l,"[project]/app/project/[name]/loading.tsx"]},[]]},{metadata:{}},[]]},{layout:[e,"[project]/app/layout.tsx"],error:[f,"[project]/app/error.tsx"],"not-found":[g,"[project]/node_modules/next/dist/client/components/builtin/not-found.js"],forbidden:[h,"[project]/node_modules/next/dist/client/components/builtin/forbidden.js"],unauthorized:[i,"[project]/node_modules/next/dist/client/components/builtin/unauthorized.js"],"global-error":[j,"[project]/app/global-error.tsx"]},[]],n=a.r.bind(a),o=a.l.bind(a),p=(0,c.createAppPageEntrypoint)({tree:m,page:"/project/[name]/page",pathname:"/project/[name]",require:n,loadChunk:o,interopDefault:d.interopDefault}),q=p.__next_app__,r=p.routeModule,s=p.handler;a.s(["__next_app__",0,q,"handler",0,s,"routeModule",0,r],58613),a.i(58613);var t=a.i(22922);a.s(["ClientPageRoot",()=>t.ClientPageRoot,"ClientSegmentRoot",()=>t.ClientSegmentRoot,"Fragment",()=>t.Fragment,"HTTPAccessFallbackBoundary",()=>t.HTTPAccessFallbackBoundary,"InstantValidation",()=>t.InstantValidation,"LayoutRouter",()=>t.LayoutRouter,"LoadingBoundaryProvider",()=>t.LoadingBoundaryProvider,"Postpone",()=>t.Postpone,"RenderFromTemplateContext",()=>t.RenderFromTemplateContext,"RootLayoutBoundary",()=>t.RootLayoutBoundary,"SegmentViewNode",()=>t.SegmentViewNode,"SegmentViewStateNode",()=>t.SegmentViewStateNode,"__next_app__",0,q,"captureOwnerStack",()=>t.captureOwnerStack,"collectPrefetchHints",()=>t.collectPrefetchHints,"collectSegmentData",()=>t.collectSegmentData,"createElement",()=>t.createElement,"createMetadataComponents",()=>t.createMetadataComponents,"createPrerenderParamsForClientSegment",()=>t.createPrerenderParamsForClientSegment,"createPrerenderSearchParamsForClientPage",()=>t.createPrerenderSearchParamsForClientPage,"createServerParamsForServerSegment",()=>t.createServerParamsForServerSegment,"createServerSearchParamsForServerPage",()=>t.createServerSearchParamsForServerPage,"createTemporaryReferenceSet",()=>t.createTemporaryReferenceSet,"decodeAction",()=>t.decodeAction,"decodeFormState",()=>t.decodeFormState,"decodeReply",()=>t.decodeReply,"handler",0,s,"isEmptyHTMLPrelude",()=>t.isEmptyHTMLPrelude,"patchFetch",()=>t.patchFetch,"preconnect",()=>t.preconnect,"preloadFont",()=>t.preloadFont,"preloadStyle",()=>t.preloadStyle,"prerender",()=>t.prerender,"prerenderToNodeStream",()=>t.prerenderToNodeStream,"renderToPipeableStream",()=>t.renderToPipeableStream,"renderToReadableStream",()=>t.renderToReadableStream,"routeModule",0,r,"serverHooks",()=>t.serverHooks,"taintObjectReference",()=>t.taintObjectReference],39729)}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__00-s7h8._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},39907,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_antigravity-projects_ts_0_6zf11._.js"].map(b=>a.l(b))).then(()=>b(96795)))},24282,a=>{"use strict";let b={claude:{id:"claude",label:"Claude Code",badgeClasses:"bg-orange-500/10 text-orange-400 border-orange-500/20"},codex:{id:"codex",label:"OpenAI Codex",badgeClasses:"bg-purple-500/10 text-purple-400 border-purple-500/20"},copilot:{id:"copilot",label:"GitHub Copilot",badgeClasses:"bg-blue-500/10 text-blue-400 border-blue-500/20"},cursor:{id:"cursor",label:"Cursor Agent",badgeClasses:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"},opencode:{id:"opencode",label:"OpenCode",badgeClasses:"bg-amber-500/10 text-amber-400 border-amber-500/20"},pi:{id:"pi",label:"Pi",badgeClasses:"bg-pink-500/10 text-pink-400 border-pink-500/20"},hermes:{id:"hermes",label:"Hermes",badgeClasses:"bg-indigo-500/10 text-indigo-400 border-indigo-500/20"},openclaw:{id:"openclaw",label:"OpenClaw",badgeClasses:"bg-teal-500/10 text-teal-400 border-teal-500/20"},factory:{id:"factory",label:"Factory Droid",badgeClasses:"bg-rose-500/10 text-rose-400 border-rose-500/20"},devin:{id:"devin",label:"Devin CLI",badgeClasses:"bg-violet-500/10 text-violet-400 border-violet-500/20"},antigravity:{id:"antigravity",label:"Antigravity CLI",badgeClasses:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20"},goose:{id:"goose",label:"Goose",badgeClasses:"bg-lime-500/10 text-lime-400 border-lime-500/20"}};a.s(["getCliBadgeClasses",0,function(a){return b[a]?.badgeClasses??b.claude.badgeClasses},"getCliLabel",0,function(a){return b[a]?.label??a}])},93658,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_codex-projects_ts_0pqlw37._.js"].map(b=>a.l(b))).then(()=>b(1024)))},60956,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_copilot-projects_ts_19wl7tp._.js"].map(b=>a.l(b))).then(()=>b(88890)))},26244,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_cursor-projects_ts_18-iwyk._.js"].map(b=>a.l(b))).then(()=>b(93087)))},11848,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_devin-projects_ts_0a64qdy._.js"].map(b=>a.l(b))).then(()=>b(15771)))},71273,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_factory-projects_ts_1uyaahq._.js"].map(b=>a.l(b))).then(()=>b(26732)))},14028,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_goose-projects_ts_0zkscri._.js"].map(b=>a.l(b))).then(()=>b(81057)))},84789,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_hermes-projects_ts_05b8-it._.js"].map(b=>a.l(b))).then(()=>b(83884)))},74486,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_openclaw-projects_ts_0qxq3bp._.js"].map(b=>a.l(b))).then(()=>b(96877)))},2164,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_opencode-projects_ts_15bjxkm._.js"].map(b=>a.l(b))).then(()=>b(64458)))},92351,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_pi-projects_ts_1wikofb._.js"].map(b=>a.l(b))).then(()=>b(2727)))},47105,a=>{"use strict";var b=a.i(12948),c=a.i(67436),d=a.i(94331);a.i(70408);let e=(0,b.instrumentModuleGetter)(()=>a.r(70864)),f=(0,b.instrumentModuleGetter)(()=>a.r(65897)),g=(0,b.instrumentModuleGetter)(()=>a.r(43619)),h=(0,b.instrumentModuleGetter)(()=>a.r(13718)),i=(0,b.instrumentModuleGetter)(()=>a.r(18198)),j=(0,b.instrumentModuleGetter)(()=>a.r(94367)),k=(0,b.instrumentModuleGetter)(()=>a.r(16733)),l=(0,b.instrumentModuleGetter)(()=>a.r(4466)),m=(0,b.instrumentModuleGetter)(()=>a.r(46454)),n=(0,b.instrumentModuleGetter)(()=>a.r(4983)),o=["",{children:["project",{children:["[name]",{children:["session",{children:["[sessionId]",{children:["__PAGE__",{},{metadata:{},page:[(0,b.instrumentModuleGetter)(()=>a.r(87330)),"[project]/app/project/[name]/session/[sessionId]/page.tsx"]},[]]},{metadata:{},error:[m,"[project]/app/project/[name]/session/[sessionId]/error.tsx"],loading:[n,"[project]/app/project/[name]/session/[sessionId]/loading.tsx"]},[]]},{metadata:{}},[]]},{metadata:{},error:[k,"[project]/app/project/[name]/error.tsx"],loading:[l,"[project]/app/project/[name]/loading.tsx"]},[]]},{metadata:{}},[]]},{layout:[e,"[project]/app/layout.tsx"],error:[f,"[project]/app/error.tsx"],"not-found":[g,"[project]/node_modules/next/dist/client/components/builtin/not-found.js"],forbidden:[h,"[project]/node_modules/next/dist/client/components/builtin/forbidden.js"],unauthorized:[i,"[project]/node_modules/next/dist/client/components/builtin/unauthorized.js"],"global-error":[j,"[project]/app/global-error.tsx"]},[]],p=a.r.bind(a),q=a.l.bind(a),r=(0,c.createAppPageEntrypoint)({tree:o,page:"/project/[name]/session/[sessionId]/page",pathname:"/project/[name]/session/[sessionId]",require:p,loadChunk:q,interopDefault:d.interopDefault}),s=r.__next_app__,t=r.routeModule,u=r.handler;a.s(["__next_app__",0,s,"handler",0,u,"routeModule",0,t],68867),a.i(68867);var v=a.i(22922);a.s(["ClientPageRoot",()=>v.ClientPageRoot,"ClientSegmentRoot",()=>v.ClientSegmentRoot,"Fragment",()=>v.Fragment,"HTTPAccessFallbackBoundary",()=>v.HTTPAccessFallbackBoundary,"InstantValidation",()=>v.InstantValidation,"LayoutRouter",()=>v.LayoutRouter,"LoadingBoundaryProvider",()=>v.LoadingBoundaryProvider,"Postpone",()=>v.Postpone,"RenderFromTemplateContext",()=>v.RenderFromTemplateContext,"RootLayoutBoundary",()=>v.RootLayoutBoundary,"SegmentViewNode",()=>v.SegmentViewNode,"SegmentViewStateNode",()=>v.SegmentViewStateNode,"__next_app__",0,s,"captureOwnerStack",()=>v.captureOwnerStack,"collectPrefetchHints",()=>v.collectPrefetchHints,"collectSegmentData",()=>v.collectSegmentData,"createElement",()=>v.createElement,"createMetadataComponents",()=>v.createMetadataComponents,"createPrerenderParamsForClientSegment",()=>v.createPrerenderParamsForClientSegment,"createPrerenderSearchParamsForClientPage",()=>v.createPrerenderSearchParamsForClientPage,"createServerParamsForServerSegment",()=>v.createServerParamsForServerSegment,"createServerSearchParamsForServerPage",()=>v.createServerSearchParamsForServerPage,"createTemporaryReferenceSet",()=>v.createTemporaryReferenceSet,"decodeAction",()=>v.decodeAction,"decodeFormState",()=>v.decodeFormState,"decodeReply",()=>v.decodeReply,"handler",0,u,"isEmptyHTMLPrelude",()=>v.isEmptyHTMLPrelude,"patchFetch",()=>v.patchFetch,"preconnect",()=>v.preconnect,"preloadFont",()=>v.preloadFont,"preloadStyle",()=>v.preloadStyle,"prerender",()=>v.prerender,"prerenderToNodeStream",()=>v.prerenderToNodeStream,"renderToPipeableStream",()=>v.renderToPipeableStream,"renderToReadableStream",()=>v.renderToReadableStream,"routeModule",0,t,"serverHooks",()=>v.serverHooks,"taintObjectReference",()=>v.taintObjectReference],47105)}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__190won8._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[24868,(a,b,c)=>{b.exports=a.x("fs/promises",()=>require("fs/promises"))},83397,92246,a=>{"use strict";var b=a.i(24868),c=a.i(14747),d=a.i(90798),e=a.i(69191);async function f(a,d,e,f){let g=`agent-${f}.jsonl`;for(let f of[(0,c.join)(a,d,g),(0,c.join)(a,d,e,g),(0,c.join)(a,d,e,"subagents",g)])if(!(0,c.relative)(a,f).startsWith(".."))try{return await (0,b.access)(f),f}catch(a){if("ENOENT"===a.code)continue;break}return null}var g=a.i(34900),h=a.i(26192),i=a.i(33432);function j(a){if(a<1e3)return`${a}ms`;let b=Math.round(a/100);if(b<600)return`${(b/10).toFixed(1)}s`;let c=Math.round(a/1e3);if(c<3600){let a=Math.floor(c/60);return`${a}m ${c%60}s`}let d=Math.round(a/6e4),e=Math.floor(d/60);return`${e}h ${d%60}m`}function k(a){let b=(0,i.formatDate)(a),c=a.getMilliseconds().toString().padStart(3,"0");return`${b}.${c}`}function l(a,b,c,d){return{_source:d,uuid:a.uuid||"",parentUuid:a.parentUuid??null,timestamp:b,timestampMs:c.getTime(),timestampFormatted:k(c)}}async function m(a,b){let c=a.split("\n").filter(a=>""!==a.trim()),d=new Map,e=[],f=[],g=new Set,h=!1;for(let a=0;a<c.length;a++){let i;a>0&&a%200==0&&await new Promise(a=>setImmediate(a));let j=c[a];try{i=JSON.parse(j)}catch{continue}let k={...i,_source:b};f.push(k);let m=i.type,n=i.timestamp;if(!n)continue;let o=new Date(n),p=o.getTime();if("user"===m){let a=i.message;if(Array.isArray(a?.content)){let b=a.content;if(b.some(a=>"tool_result"===a.type)){let a=i.toolUseResult,c="string"==typeof a?.agentId?a.agentId:void 0;for(let a of(c&&/^[a-f0-9]+$/.test(c)&&g.add(c),b)){if("tool_result"!==a.type)continue;let b=a.tool_use_id;if(!b)continue;let{text:e,images:f}=function(a){let b=a.content;if("string"==typeof b)return{text:b};if(Array.isArray(b)){let a=b.filter(a=>"text"===a.type).map(a=>a.text),c=b.filter(a=>"image"===a.type).map(a=>{let b=a.source;return{base64:b.data,mediaType:b.media_type}}).filter(a=>a.base64&&a.mediaType);return{text:a.length>0?a.join("\n"):void 0,images:c.length>0?c:void 0}}return{}}(a);d.set(b,{timestamp:n,timestampMs:p,content:e,images:f,agentId:c})}continue}}let c="string"==typeof a?.content?a.content:"";e.push({type:"user",...l(i,n,o,b),message:{role:"user",content:c}});continue}if("assistant"===m){let a=i.message,c=[];if(Array.isArray(a?.content)&&(c=a.content.filter(a=>["text","tool_use","thinking"].includes(a.type)).map(a=>{if("text"===a.type)return{type:"text",text:a.text};if("tool_use"===a.type){let b=a.input;return{type:"tool_use",id:a.id,name:a.name,input:a.input??{},..."Task"===a.name&&b?{subagentType:b.subagent_type,subagentDescription:b.description}:{}}}return{type:"thinking",thinking:a.thinking,signature:a.signature}})),0===c.length)continue;e.push({type:"assistant",...l(i,n,o,b),message:{role:"assistant",content:c,model:a?.model}});continue}if("file-history-snapshot"===m||"progress"===m||"system"===m){e.push({type:m,...l(i,n,o,b),raw:{...i}});continue}if("queue-operation"===m){let a=h?"Session Resumed":"Session Started";h=!0,e.push({type:"queue-operation",...l(i,n,o,b),label:a});continue}}let i=0;for(let a of e)if("assistant"===a.type)for(let b of(++i%200==0&&await new Promise(a=>setImmediate(a)),a.message.content)){if("tool_use"!==b.type)continue;let c=d.get(b.id);if(!c)continue;let e=new Date(c.timestamp),f=Math.max(0,c.timestampMs-a.timestampMs);b.result={timestamp:c.timestamp,timestampFormatted:k(e),content:c.content,images:c.images,durationMs:f,durationFormatted:j(f)},c.agentId&&(b.subagentId=c.agentId)}return e.length>500&&await new Promise(a=>setImmediate(a)),e.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:e,rawLines:f,subagentIds:Array.from(g)}}async function n(a,g){let i=(0,e.resolveProjectPath)(a),j=(0,d.getClaudeProjectsPath)(),k=(0,c.join)(i,`${g}.jsonl`),l=await (0,b.readFile)(k,"utf-8"),{entries:n,rawLines:o,subagentIds:p}=await m(l,"session");if(0===p.length)return{entries:n,rawLines:o,subagentIds:[]};let q=await (0,h.batchAll)(p.map(c=>async()=>{let d=`agent-${c}`,e=await f(j,a,g,c);if(!e)return null;let h=await (0,b.readFile)(e,"utf-8"),{entries:i,rawLines:k}=await m(h,d);return{entries:i,rawLines:k}}),4),r=[...n],s=[...o];for(let a of q)"fulfilled"===a.status&&a.value&&(r.push(...a.value.entries),s.push(...a.value.rawLines));return r.length>500&&await new Promise(a=>setImmediate(a)),r.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:r,rawLines:s,subagentIds:p}}a.s(["formatDuration",0,j],92246);let o=(0,g.runtimeCache)((a,b)=>n(a,b),60,{maxSize:50});a.s(["baseEntry",0,l,"formatTimestamp",0,k,"getCachedSessionLog",0,o,"parseRawLines",0,function(a,b){return a.split("\n").filter(a=>""!==a.trim()).flatMap(a=>{try{let c=JSON.parse(a);return void 0!==b&&(c._source=b),[c]}catch{return[]}})}],83397)},96877,a=>{"use strict";var b=a.i(2157),c=a.i(50227),d=a.i(34900),e=a.i(87488),f=a.i(33432);function g(a){return"string"==typeof a&&a.length>0?a:void 0}async function h(){let a=(0,e.listOpenClawTranscripts)(),d=new Map,f=[];for(let h of a){let a=d.get(h.agentId);a||(a=function(a){let d,f=new Map,h=(0,c.join)((0,e.openclawHome)(),"agents",a,"sessions","sessions.json");try{d=JSON.parse((0,b.readFileSync)(h,"utf-8"))}catch{return f}if(!d||"object"!=typeof d)return f;for(let a of Object.values(d)){if(!a||"object"!=typeof a)continue;let b=g(a.sessionId);if(!b)continue;let c=a.origin&&"object"==typeof a.origin?a.origin:{},d="number"==typeof a.lastInteractionAt?a.lastInteractionAt:"number"==typeof a.updatedAt?a.updatedAt:void 0;f.set(b,{lastMs:d,channel:g(a.lastChannel)??g(c.provider)??g(c.surface),chatType:g(a.chatType)??g(c.chatType),label:g(c.label),chatId:g(a.lastTo)??g(c.from)})}return f}(h.agentId),d.set(h.agentId,a));let i=a.get(h.sessionId);f.push({sessionId:h.sessionId,agentId:h.agentId,channel:i?.channel??"local",label:i?.label,chatType:i?.chatType,chatId:i?.chatId,transcriptPath:h.transcriptPath,mtimeMs:i?.lastMs??h.mtimeMs,sizeBytes:h.sizeBytes})}return f.sort((a,b)=>b.mtimeMs-a.mtimeMs),f}let i=(0,d.runtimeCache)(h,2);function j(a,b){return`openclaw-${a}-${b}`}function k(a,b){return`openclaw:${a}:${b}`}function l(a){if(!a.startsWith("openclaw-"))return[];let b=a.slice(9);if(!b)return[];let c=[];for(let a of(0,e.listOpenClawAgents)().sort((a,b)=>b.length-a.length)){let d=`${a}-`;b.startsWith(d)&&b.length>d.length&&c.push({agentId:a,channel:b.slice(d.length)})}return c.push({agentId:null,channel:b}),c}async function m(){let a=await h(),b=new Map;for(let c of a){let a=JSON.stringify([c.agentId,c.channel]),d=b.get(a);d?(d.latest=Math.max(d.latest,c.mtimeMs),d.count+=1):b.set(a,{agentId:c.agentId,channel:c.channel,latest:c.mtimeMs,count:1})}let c=[];for(let{agentId:a,channel:d,latest:e,count:g}of b.values()){let b=new Date(e);c.push({name:j(a,d),path:k(a,d),isDirectory:!0,lastModified:b,lastModifiedFormatted:(0,f.formatDate)(b),cli:["openclaw"],sessionCount:g})}return c.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),c}async function n(a){let b=l(a);if(0===b.length)return{cwd:null,sessions:[]};let c=await h(),d=a=>c.filter(b=>b.channel===a.channel&&(null===a.agentId||b.agentId===a.agentId)),e=b[0],g=d(e);if(0===g.length)for(let a of b.slice(1)){let b=d(a);if(b.length>0){e=a,g=b;break}}let{agentId:i,channel:j}=e;return{cwd:null===i?`openclaw:${j}`:k(i,j),sessions:g.map(a=>{let b=new Date(a.mtimeMs);return{name:a.label??a.chatId??a.sessionId,path:a.sessionId,lastModified:b,lastModifiedFormatted:(0,f.formatDate)(b),sessionId:a.sessionId,cli:"openclaw",channelId:a.chatId,channelType:a.chatType}})}}let o=(0,d.runtimeCache)(m,2),p=(0,d.runtimeCache)(a=>n(a),2,{maxSize:50});a.s(["getCachedOpenClawProjects",0,o,"getCachedOpenClawSessions",0,i,"getCachedOpenClawSessionsByEncodedName",0,p,"getOpenClawProjects",0,m,"getOpenClawSessions",0,h,"getOpenClawSessionsByEncodedName",0,n,"openClawProjectName",0,j,"openClawProjectNameCandidates",0,l,"openClawProjectPath",0,k,"parseOpenClawProjectName",0,function(a){return l(a)[0]??null}])},87488,a=>{"use strict";var b=a.i(12714),c=a.i(2157),d=a.i(60526),e=a.i(50227),f=a.i(34900),g=a.i(83397),h=a.i(92246);let i=/^[0-9a-fA-F-]{36}$/;function j(){return process.env.OPENCLAW_HOME||(0,e.join)((0,d.homedir)(),".openclaw")}function k(a){return!!a&&"object"==typeof a&&!Array.isArray(a)}function l(a){return"string"==typeof a?a:Array.isArray(a)?a.map(a=>k(a)&&"string"==typeof a.text?a.text:"").filter(Boolean).join("\n"):""}function m(){let a,b=(0,e.join)(j(),"agents"),d=[];try{a=(0,c.readdirSync)(b,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>a.name)}catch{return d}for(let f of a){let a,g=(0,e.join)(b,f,"sessions");try{a=(0,c.readdirSync)(g)}catch{continue}for(let b of a){if(!b.endsWith(".jsonl")||b.endsWith(".trajectory.jsonl"))continue;let a=b.slice(0,-6);if(!i.test(a))continue;let h=(0,e.join)(g,b);try{let b=(0,c.statSync)(h);d.push({agentId:f,sessionId:a,transcriptPath:h,mtimeMs:b.mtimeMs,sizeBytes:b.size})}catch{}}}return d}async function n(a){let c,d,e=function(a){if(!i.test(a))return null;for(let b of m())if(b.sessionId===a)return b.transcriptPath;return null}(a);if(!e)return null;try{c=await (0,b.readFile)(e,"utf-8")}catch{return null}let f=(0,g.parseRawLines)(c,"session"),j=function(a,b="session"){let c=[],d=new Map,e=new Map,f=Date.now();for(let i=0;i<a.length;i++){let j=a[i];if(!k(j)||"message"!==j.type)continue;let m=k(j.message)?j.message:void 0;if(!m)continue;let n="string"==typeof m.role?m.role:"system",o=function(a,b){if("number"==typeof a&&Number.isFinite(a)){if(a>1e12)return new Date(a);if(a>1e9)return new Date(1e3*a)}if("string"==typeof a){let b=Date.parse(a);if(!Number.isNaN(b))return new Date(b)}return new Date(b)}(j.timestamp??m.timestamp,f+i),p=o.toISOString(),q={uuid:null!=j.id?String(j.id):`openclaw-${i}`,parentUuid:null!=j.parentId?String(j.parentId):null},r=(0,g.baseEntry)(q,p,o,b);if("user"===n){c.push({type:"user",...r,message:{role:"user",content:l(m.content)}});continue}if("assistant"===n){let a=[],b=m.content;if(Array.isArray(b)){for(let c of b)if(k(c)){if("text"===c.type&&"string"==typeof c.text)a.push({type:"text",text:c.text});else if("toolCall"===c.type){let b="string"==typeof c.id?c.id:`${String(c.name??"tool")}-${a.length}`,f={type:"tool_use",id:b,name:"string"==typeof c.name?c.name:"tool",input:k(c.arguments)?c.arguments:{}};a.push(f),d.set(b,f),e.set(b,o.getTime())}}}else{let c=l(b);c&&a.push({type:"text",text:c})}if(0===a.length)continue;c.push({type:"assistant",...r,message:{role:"assistant",content:a,model:"string"==typeof m.model?m.model:void 0}});continue}if("toolResult"===n){let a="string"==typeof m.toolCallId?m.toolCallId:void 0,b=a?d.get(a):void 0;if(b){let c=k(m.details)?m.details:void 0,d=a&&e.get(a)||o.getTime(),f=c&&"number"==typeof c.durationMs?c.durationMs:Math.max(0,o.getTime()-d);b.result={timestamp:p,timestampFormatted:(0,g.formatTimestamp)(o),content:l(m.content),durationMs:f,durationFormatted:(0,h.formatDuration)(f)};continue}}c.push({type:"system",...r,raw:q})}return c.sort((a,b)=>a.timestampMs-b.timestampMs),c}(f,"session");for(let a of f)if(k(a)&&"session"===a.type&&"string"==typeof a.cwd&&a.cwd.length>0){d=a.cwd;break}return{entries:j,rawLines:f,cwd:d,filePath:e}}let o=(0,f.runtimeCache)(a=>n(a),2,{maxSize:50});a.s(["getCachedOpenClawSessionLog",0,o,"listOpenClawAgents",0,function(){try{return(0,c.readdirSync)((0,e.join)(j(),"agents"),{withFileTypes:!0}).filter(a=>a.isDirectory()&&!a.name.startsWith(".")).map(a=>a.name).sort()}catch{return[]}},"listOpenClawTranscripts",0,m,"openclawHome",0,j])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__1nq7ivq._.js.map
|