pinokiod 6.0.20 → 6.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "6.0.20",
3
+ "version": "6.0.21",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -6948,31 +6948,38 @@ class Server {
6948
6948
  }
6949
6949
  seenNodes.add(candidate)
6950
6950
  const localCodexHint = inheritedHint || recordHasCodexHint(candidate, 2, 50)
6951
- const sessionField = findSessionField(candidate)
6951
+ const candidateType = typeof candidate.type === "string" ? candidate.type.toLowerCase() : ""
6952
+ // OpenClaw session logs include many message/tool-call ids. Only treat top-level
6953
+ // session envelopes as resumable session sources.
6954
+ const isOpenClawSessionEnvelope = candidateType === "session" || candidateType === "session_meta"
6955
+ const sessionField = isOpenClawSessionEnvelope ? findSessionField(candidate) : null
6952
6956
  if (sessionField && isCodexFieldAllowed(sessionField, candidate, filePath, localCodexHint)) {
6953
6957
  const sessionId = sessionField.value
6954
6958
  if (!seenIds.has(sessionId)) {
6955
- seenIds.add(sessionId)
6956
- const summary = normalizeDiscoveredSessionSummary(buildSessionSummary(candidate) || buildSessionSummary(record))
6957
- const cwd = extractWorkingDirectory(candidate) || extractWorkingDirectory(record)
6958
- const timestamp = parseSessionTimestamp(
6959
- candidate.timestamp
6960
- || candidate.ts
6961
- || candidate.updated_at
6962
- || candidate.created_at
6963
- || record.timestamp
6964
- || record.ts
6965
- || record.updated_at
6966
- || record.created_at
6967
- )
6968
- results.push({
6969
- id: sessionId,
6970
- cwd,
6971
- summary,
6972
- timestamp,
6973
- source: filePath,
6974
- metadata: candidate
6975
- })
6959
+ const cwdValue = extractWorkingDirectory(candidate) || extractWorkingDirectory(record)
6960
+ const cwd = typeof cwdValue === "string" ? cwdValue.trim() : ""
6961
+ if (cwd) {
6962
+ seenIds.add(sessionId)
6963
+ const summary = normalizeDiscoveredSessionSummary(buildSessionSummary(candidate) || buildSessionSummary(record))
6964
+ const timestamp = parseSessionTimestamp(
6965
+ candidate.timestamp
6966
+ || candidate.ts
6967
+ || candidate.updated_at
6968
+ || candidate.created_at
6969
+ || record.timestamp
6970
+ || record.ts
6971
+ || record.updated_at
6972
+ || record.created_at
6973
+ )
6974
+ results.push({
6975
+ id: sessionId,
6976
+ cwd,
6977
+ summary,
6978
+ timestamp,
6979
+ source: filePath,
6980
+ metadata: candidate
6981
+ })
6982
+ }
6976
6983
  }
6977
6984
  }
6978
6985
  if (depth >= maxDepth) {
@@ -8257,6 +8264,10 @@ class Server {
8257
8264
  }
8258
8265
 
8259
8266
  return Array.from(discoveredEntries || [])
8267
+ .filter((entry) => {
8268
+ const workingDirectory = entry && typeof entry.cwd === "string" ? entry.cwd.trim() : ""
8269
+ return workingDirectory.length > 0
8270
+ })
8260
8271
  .sort((a, b) => {
8261
8272
  const aOnline = isDiscoveredEntryOnline(a) ? 1 : 0
8262
8273
  const bOnline = isDiscoveredEntryOnline(b) ? 1 : 0
@@ -8311,8 +8322,8 @@ class Server {
8311
8322
  if (entry.provider === "gemini" && typeof entry.source === "string" && entry.source.length > 0) {
8312
8323
  forkCapable = Boolean(entry.fork_capable)
8313
8324
  if (forkCapable) {
8314
- const geminiForkScript = path.resolve(__dirname, "scripts", "fork_gemini_session.js")
8315
- const cloneAndResume = `FORK_SESSION_ID=$(node ${JSON.stringify(geminiForkScript)} ${JSON.stringify(entry.source)} ${JSON.stringify(entry.id)}) && ${resumeBaseCommand} --resume "$FORK_SESSION_ID"`
8325
+ const geminiForkResumeScript = path.resolve(__dirname, "scripts", "gemini_fork_and_resume.js")
8326
+ const cloneAndResume = `node ${JSON.stringify(geminiForkResumeScript)} ${JSON.stringify(entry.source)} ${JSON.stringify(entry.id)}`
8316
8327
  forkCommand = cloneAndResume
8317
8328
  } else {
8318
8329
  forkCommand = ""
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("path");
5
+ const { execFileSync, spawn } = require("child_process");
6
+
7
+ const sourcePath = process.argv[2];
8
+ const expectedSessionId = process.argv[3];
9
+
10
+ if (!sourcePath) {
11
+ process.exit(1);
12
+ }
13
+
14
+ const forkScriptPath = path.resolve(__dirname, "fork_gemini_session.js");
15
+
16
+ let forkedSessionId = "";
17
+ try {
18
+ forkedSessionId = execFileSync(
19
+ process.execPath,
20
+ [forkScriptPath, sourcePath, expectedSessionId || ""],
21
+ {
22
+ encoding: "utf8",
23
+ stdio: ["ignore", "pipe", "inherit"]
24
+ }
25
+ ).trim();
26
+ } catch (error) {
27
+ if (typeof error.status === "number") {
28
+ process.exit(error.status);
29
+ }
30
+ process.exit(1);
31
+ }
32
+
33
+ if (!forkedSessionId) {
34
+ process.exit(1);
35
+ }
36
+
37
+ const npxBinary = process.platform === "win32" ? "npx.cmd" : "npx";
38
+ const child = spawn(
39
+ npxBinary,
40
+ ["-y", "@google/gemini-cli@latest", "--resume", forkedSessionId],
41
+ { stdio: "inherit" }
42
+ );
43
+
44
+ child.on("error", () => {
45
+ process.exit(1);
46
+ });
47
+
48
+ child.on("exit", (code) => {
49
+ process.exit(typeof code === "number" ? code : 1);
50
+ });