@cjhyy/code-shell-server 0.8.12 → 0.8.20

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.
@@ -38,8 +38,11 @@ export class TrustedDeviceStore {
38
38
  // Get-or-create by secretHash. A phone's secret is stable per browser
39
39
  // (persisted in localStorage as cs.deviceSecret), so re-scanning the QR
40
40
  // code must reuse its live row rather than accumulating duplicates.
41
- const existing = devices.find((d) => d.secretHash === input.secretHash && !d.revokedAt);
41
+ const existing = devices.find((d) => secretHashEquals(d.secretHash, input.secretHash));
42
42
  if (existing) {
43
+ if (existing.revokedAt) {
44
+ throw new Error("Trusted device was revoked; remove it before pairing again");
45
+ }
43
46
  existing.name = name;
44
47
  existing.lastSeenAt = Date.now();
45
48
  return { result: this.toPublic(existing), changed: true };
@@ -7,9 +7,13 @@ import * as fs from "node:fs/promises";
7
7
  import * as path from "node:path";
8
8
  const SAFE_ID = /^[A-Za-z0-9_.-]+$/;
9
9
  const QUICK_CHAT_SESSION_PREFIX = "qchat-";
10
+ const PANEL_TASK_SESSION_PREFIX = "panel-task-";
10
11
  function isQuickChatSessionId(id) {
11
12
  return id.startsWith(QUICK_CHAT_SESSION_PREFIX);
12
13
  }
14
+ function isInternalEphemeralSessionId(id) {
15
+ return isQuickChatSessionId(id) || id.startsWith(PANEL_TASK_SESSION_PREFIX);
16
+ }
13
17
  export async function listSessions(baseDir = sessionsRoot()) {
14
18
  try {
15
19
  const entries = await fs.readdir(baseDir, { withFileTypes: true });
@@ -20,7 +24,7 @@ export async function listSessions(baseDir = sessionsRoot()) {
20
24
  if (!e.name.endsWith(".jsonl") && !e.name.endsWith(".json"))
21
25
  continue;
22
26
  const id = e.name.replace(/\.jsonl?$/, "");
23
- if (isQuickChatSessionId(id))
27
+ if (isInternalEphemeralSessionId(id))
24
28
  continue;
25
29
  const full = path.join(baseDir, e.name);
26
30
  try {
@@ -162,7 +166,7 @@ export async function listDiskSessions(opts, baseDir = sessionsRoot()) {
162
166
  return { sessions: [], nextCursor: null };
163
167
  throw e;
164
168
  }
165
- const candidates = entries.filter((e) => e.isDirectory() && SAFE_ID.test(e.name) && !isQuickChatSessionId(e.name));
169
+ const candidates = entries.filter((e) => e.isDirectory() && SAFE_ID.test(e.name) && !isInternalEphemeralSessionId(e.name));
166
170
  const stats = await Promise.all(candidates.map(async (e) => {
167
171
  try {
168
172
  return { id: e.name, mtime: (await fs.stat(path.join(baseDir, e.name))).mtimeMs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cjhyy/code-shell-server",
3
- "version": "0.8.12",
3
+ "version": "0.8.20",
4
4
  "description": "CodeShell server transport layer — mobile remote HTTP/WS host, pairing, passcode gate, tunnel, rooms, uploads, and session/attachment services. Electron-free; precursor of the auth gateway.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -39,9 +39,9 @@
39
39
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
40
40
  },
41
41
  "dependencies": {
42
- "@cjhyy/code-shell-capability-coding": "0.8.12",
43
- "@cjhyy/code-shell-core": "0.8.12",
44
- "@cjhyy/code-shell-web": "0.8.12",
42
+ "@cjhyy/code-shell-capability-coding": "0.8.20",
43
+ "@cjhyy/code-shell-core": "0.8.20",
44
+ "@cjhyy/code-shell-web": "0.8.20",
45
45
  "@types/ws": "^8.18.1",
46
46
  "ws": "^8.21.0"
47
47
  },