@nextclaw/server 0.12.21 → 0.12.22

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -13
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -4163,9 +4163,8 @@ function applyUiReadAtPatch(metadata, patch) {
4163
4163
  const { ui_last_read_at: _removed, ...nextMetadata } = metadata;
4164
4164
  return nextMetadata;
4165
4165
  }
4166
- async function applyProjectRootPatch(metadata, patch) {
4167
- if (!Object.prototype.hasOwnProperty.call(patch, "projectRoot")) return metadata;
4168
- const projectRoot = await normalizeSessionProjectRoot(patch.projectRoot);
4166
+ function applyProjectRootPatch(metadata, projectRoot) {
4167
+ if (projectRoot === void 0) return metadata;
4169
4168
  if (projectRoot) {
4170
4169
  const { projectRoot: _removed, ...nextMetadata } = metadata;
4171
4170
  return {
@@ -4176,13 +4175,12 @@ async function applyProjectRootPatch(metadata, patch) {
4176
4175
  const { project_root: _projectRoot, projectRoot: _camelProjectRoot, ...nextMetadata } = metadata;
4177
4176
  return nextMetadata;
4178
4177
  }
4179
- async function buildPatchedSessionMetadata(params) {
4180
- const { metadata, patch } = params;
4178
+ function buildPatchedSessionMetadata(metadata, patch, projectRootPatch) {
4181
4179
  return applyProjectRootPatch(applyUiReadAtPatch(applySessionTypePatch(applySessionPreferencePatch({
4182
4180
  metadata: structuredClone(metadata),
4183
4181
  patch,
4184
4182
  createInvalidThinkingError: () => /* @__PURE__ */ new Error("PREFERRED_THINKING_INVALID")
4185
- }), patch), patch), patch);
4183
+ }), patch), patch), projectRootPatch);
4186
4184
  }
4187
4185
  var NcpSessionRoutesController = class {
4188
4186
  sessionSkillsViewBuilder;
@@ -4260,19 +4258,17 @@ var NcpSessionRoutesController = class {
4260
4258
  if (!body.ok || !body.data || typeof body.data !== "object") return c.json(err("INVALID_BODY", "invalid json body"), 400);
4261
4259
  const patch = body.data;
4262
4260
  if (patch.clearHistory) return c.json(err("UNSUPPORTED_PATCH", "clearHistory is not supported for ncp sessions"), 400);
4263
- const metadata = readSessionMetadata((await sessionApi.getSession(sessionId))?.metadata);
4264
- let updated;
4261
+ let patched;
4265
4262
  try {
4266
- const nextMetadata = await buildPatchedSessionMetadata({
4267
- metadata,
4268
- patch
4269
- });
4270
- updated = await sessionApi.updateSession(sessionId, { metadata: nextMetadata });
4263
+ const projectRootPatch = Object.prototype.hasOwnProperty.call(patch, "projectRoot") ? await normalizeSessionProjectRoot(patch.projectRoot) : void 0;
4264
+ patched = await this.options.kernel.sessionRunManager.patchSessionMetadata(sessionId, (metadata) => buildPatchedSessionMetadata(metadata, patch, projectRootPatch));
4271
4265
  } catch (error) {
4272
4266
  if (error instanceof Error && error.message === "PREFERRED_THINKING_INVALID") return c.json(err("PREFERRED_THINKING_INVALID", "preferredThinking must be a supported thinking level"), 400);
4273
4267
  if (isSessionProjectRootValidationError(error)) return c.json(err(error.code, error.message), 400);
4274
4268
  throw error;
4275
4269
  }
4270
+ if (!patched) return c.json(err("NOT_FOUND", `ncp session not found: ${sessionId}`), 404);
4271
+ const updated = await sessionApi.getSession(sessionId);
4276
4272
  if (!updated) return c.json(err("NOT_FOUND", `ncp session not found: ${sessionId}`), 404);
4277
4273
  return c.json(ok(updated));
4278
4274
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/server",
3
- "version": "0.12.21",
3
+ "version": "0.12.22",
4
4
  "private": false,
5
5
  "description": "Nextclaw UI/API server.",
6
6
  "type": "module",
@@ -18,12 +18,12 @@
18
18
  "@hono/node-server": "^1.13.3",
19
19
  "hono": "^4.6.2",
20
20
  "ws": "^8.18.0",
21
- "@nextclaw/core": "0.12.20",
22
- "@nextclaw/kernel": "0.1.10",
23
- "@nextclaw/mcp": "0.1.85",
24
- "@nextclaw/ncp": "0.5.13",
25
- "@nextclaw/openclaw-compat": "1.0.20",
26
- "@nextclaw/runtime": "0.2.52"
21
+ "@nextclaw/kernel": "0.1.11",
22
+ "@nextclaw/openclaw-compat": "1.0.21",
23
+ "@nextclaw/mcp": "0.1.86",
24
+ "@nextclaw/core": "0.12.21",
25
+ "@nextclaw/runtime": "0.2.53",
26
+ "@nextclaw/ncp": "0.5.14"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^20.17.6",