@cjhyy/code-shell-server 0.8.11 → 0.8.13

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.
@@ -1,3 +1,3 @@
1
1
  /** Ready-made headless HTTP/WebSocket host and CLI composition helpers. */
2
2
  export * from "./serve/headless-server.js";
3
- export { parseServeArgs, resolveWebAppRoot, resolveWorkerEntry, runServeCli } from "./serve/cli.js";
3
+ export { parseServeArgs, resolveWebAppRoot, resolveWorkerCapabilityModules, resolveWorkerEntry, runServeCli, } from "./serve/cli.js";
@@ -1,3 +1,3 @@
1
1
  /** Ready-made headless HTTP/WebSocket host and CLI composition helpers. */
2
2
  export * from "./serve/headless-server.js";
3
- export { parseServeArgs, resolveWebAppRoot, resolveWorkerEntry, runServeCli } from "./serve/cli.js";
3
+ export { parseServeArgs, resolveWebAppRoot, resolveWorkerCapabilityModules, resolveWorkerEntry, runServeCli, } from "./serve/cli.js";
@@ -9,6 +9,12 @@ interface CliArgs {
9
9
  export declare function parseServeArgs(argv: string[], env?: NodeJS.ProcessEnv): CliArgs;
10
10
  /** Locate the stdio worker entry the same way desktop's AgentBridge does. */
11
11
  export declare function resolveWorkerEntry(): string;
12
+ /**
13
+ * AgentModule spec string for the worker env — headless serve ships the
14
+ * coding module (matches the pre-cutover behavior where the coding bin
15
+ * wrapper registered it; arena/pet stay desktop-only).
16
+ */
17
+ export declare function resolveWorkerCapabilityModules(): string;
12
18
  /** Locate the built browser app (packages/web `app` build), when present. */
13
19
  export declare function resolveWebAppRoot(): string | undefined;
14
20
  export declare function runServeCli(argv?: string[]): Promise<void>;
package/dist/serve/cli.js CHANGED
@@ -64,7 +64,15 @@ export function parseServeArgs(argv, env = process.env) {
64
64
  /** Locate the stdio worker entry the same way desktop's AgentBridge does. */
65
65
  export function resolveWorkerEntry() {
66
66
  const require = createRequire(import.meta.url);
67
- return require.resolve("@cjhyy/code-shell-capability-coding/bin/agent-server-stdio");
67
+ return require.resolve("@cjhyy/code-shell-core/bin/agent-server-stdio");
68
+ }
69
+ /**
70
+ * AgentModule spec string for the worker env — headless serve ships the
71
+ * coding module (matches the pre-cutover behavior where the coding bin
72
+ * wrapper registered it; arena/pet stay desktop-only).
73
+ */
74
+ export function resolveWorkerCapabilityModules() {
75
+ return `${import.meta.resolve("@cjhyy/code-shell-capability-coding")}#createCodingModule`;
68
76
  }
69
77
  /** Locate the built browser app (packages/web `app` build), when present. */
70
78
  export function resolveWebAppRoot() {
@@ -94,6 +102,7 @@ export async function runServeCli(argv = process.argv.slice(2)) {
94
102
  cwd: parsed.cwd,
95
103
  dataDir: parsed.dataDir,
96
104
  workerEntryPath: resolveWorkerEntry(),
105
+ workerCapabilityModules: resolveWorkerCapabilityModules(),
97
106
  ...(staticRootDir ? { staticRootDir } : {}),
98
107
  ...(parsed.passcode ? { passcode: parsed.passcode } : {}),
99
108
  log: (event, data) => console.error(`[serve] ${event}${data ? ` ${JSON.stringify(data)}` : ""}`),
@@ -11,6 +11,8 @@ export interface HeadlessServeOptions {
11
11
  dataDir: string;
12
12
  /** Absolute path of the agent-server-stdio worker entry. */
13
13
  workerEntryPath: string;
14
+ /** CODE_SHELL_CAPABILITY_MODULES spec injected into the worker env. */
15
+ workerCapabilityModules?: string;
14
16
  /** Session root override for tests/relocated workers. Defaults to core's canonical root. */
15
17
  sessionRootDir?: string;
16
18
  /**
@@ -98,7 +98,13 @@ export async function startHeadlessServer(opts) {
98
98
  entryPath: opts.workerEntryPath,
99
99
  execPath: opts.execPath,
100
100
  fallbackCwd: () => opts.cwd,
101
- buildEnv: () => ({ ...process.env, CODE_SHELL_DATA_ROOT: workerDataRoot }),
101
+ buildEnv: () => ({
102
+ ...process.env,
103
+ CODE_SHELL_DATA_ROOT: workerDataRoot,
104
+ ...(opts.workerCapabilityModules
105
+ ? { CODE_SHELL_CAPABILITY_MODULES: opts.workerCapabilityModules }
106
+ : {}),
107
+ }),
102
108
  log,
103
109
  onStderr: (text) => log("worker.stderr", { text: previewLine(text) }),
104
110
  onExit: (info) => {
@@ -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.11",
3
+ "version": "0.8.13",
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.11",
43
- "@cjhyy/code-shell-core": "0.8.11",
44
- "@cjhyy/code-shell-web": "0.8.11",
42
+ "@cjhyy/code-shell-capability-coding": "0.8.13",
43
+ "@cjhyy/code-shell-core": "0.8.13",
44
+ "@cjhyy/code-shell-web": "0.8.13",
45
45
  "@types/ws": "^8.18.1",
46
46
  "ws": "^8.21.0"
47
47
  },