nextclaw 0.17.9 → 0.17.10

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/cli/index.js +43 -57
  2. package/package.json +11 -11
package/dist/cli/index.js CHANGED
@@ -19,7 +19,7 @@ import { request } from "node:http";
19
19
  import { request as request$1 } from "node:https";
20
20
  import { setImmediate as setImmediate$1, setTimeout as setTimeout$1 } from "node:timers/promises";
21
21
  import chokidar from "chokidar";
22
- import { DefaultNcpAgentRuntime, LocalAssetStore, buildAssetContentPath, buildNcpUserContent } from "@nextclaw/ncp-agent-runtime";
22
+ import { DefaultNcpAgentRuntime, LocalAssetStore, buildAssetContentPath, buildNcpUserContent, buildOpenAiFunctionTool } from "@nextclaw/ncp-agent-runtime";
23
23
  import { McpNcpToolRegistryAdapter } from "@nextclaw/ncp-mcp";
24
24
  import { NCP_INTERNAL_VISIBILITY_METADATA_KEY, NcpEventType, readAssistantReasoningNormalizationMode, readAssistantReasoningNormalizationModeFromMetadata, sanitizeAssistantReplyTags, writeAssistantReasoningNormalizationModeToMetadata } from "@nextclaw/ncp";
25
25
  import { DefaultNcpAgentBackend, createAgentClientFromServer } from "@nextclaw/ncp-toolkit";
@@ -10409,48 +10409,39 @@ var AssetPutTool = class {
10409
10409
  description = "Put a normal file path or base64 bytes into the managed asset store.";
10410
10410
  parameters = {
10411
10411
  type: "object",
10412
- oneOf: [{
10413
- type: "object",
10414
- properties: {
10415
- path: {
10416
- type: "string",
10417
- description: "Existing local file path to put into the asset store."
10418
- },
10419
- fileName: {
10420
- type: "string",
10421
- description: "Optional asset file name override."
10422
- },
10423
- mimeType: {
10424
- type: "string",
10425
- description: "Optional mime type override."
10426
- }
10412
+ properties: {
10413
+ path: {
10414
+ type: "string",
10415
+ description: "Existing local file path to put into the asset store."
10427
10416
  },
10428
- required: ["path"],
10429
- additionalProperties: false
10430
- }, {
10431
- type: "object",
10432
- properties: {
10433
- bytesBase64: {
10434
- type: "string",
10435
- description: "Base64 file bytes. Use together with fileName when no source path exists."
10436
- },
10437
- fileName: {
10438
- type: "string",
10439
- description: "Asset file name. Required when using bytesBase64."
10440
- },
10441
- mimeType: {
10442
- type: "string",
10443
- description: "Optional mime type override."
10444
- }
10417
+ bytesBase64: {
10418
+ type: "string",
10419
+ description: "Base64 file bytes. Use together with fileName when no source path exists."
10420
+ },
10421
+ fileName: {
10422
+ type: "string",
10423
+ description: "Optional asset file name override. Required when using bytesBase64."
10445
10424
  },
10446
- required: ["bytesBase64", "fileName"],
10447
- additionalProperties: false
10448
- }]
10425
+ mimeType: {
10426
+ type: "string",
10427
+ description: "Optional mime type override."
10428
+ }
10429
+ },
10430
+ additionalProperties: false
10449
10431
  };
10450
10432
  constructor(assetStore, contentBasePath) {
10451
10433
  this.assetStore = assetStore;
10452
10434
  this.contentBasePath = contentBasePath;
10453
10435
  }
10436
+ validateArgs = (args) => {
10437
+ const path = readOptionalString$5(args.path);
10438
+ const bytesBase64 = readOptionalString$5(args.bytesBase64);
10439
+ const fileName = readOptionalString$5(args.fileName);
10440
+ if (path && bytesBase64) return ["Provide either path, or bytesBase64 + fileName, not both."];
10441
+ if (path) return [];
10442
+ if (bytesBase64) return fileName ? [] : ["fileName is required when using bytesBase64."];
10443
+ return ["Provide either path, or bytesBase64 + fileName."];
10444
+ };
10454
10445
  execute = async (args) => {
10455
10446
  const path = readOptionalString$5(args?.path);
10456
10447
  const fileName = readOptionalString$5(args?.fileName);
@@ -10541,11 +10532,12 @@ var AssetStatTool = class {
10541
10532
  };
10542
10533
  };
10543
10534
  function createAssetTools(params) {
10535
+ const { assetStore } = params;
10544
10536
  const contentBasePath = params.contentBasePath ?? "/api/ncp/assets/content";
10545
10537
  return [
10546
- new AssetPutTool(params.assetStore, contentBasePath),
10547
- new AssetExportTool(params.assetStore),
10548
- new AssetStatTool(params.assetStore, contentBasePath)
10538
+ new AssetPutTool(assetStore, contentBasePath),
10539
+ new AssetExportTool(assetStore),
10540
+ new AssetStatTool(assetStore, contentBasePath)
10549
10541
  ];
10550
10542
  }
10551
10543
  //#endregion
@@ -11247,19 +11239,20 @@ function readRequestedAgentId(metadata) {
11247
11239
  return normalizeString(metadata.agent_id)?.toLowerCase() ?? normalizeString(metadata.agentId)?.toLowerCase() ?? null;
11248
11240
  }
11249
11241
  function resolveAgentProfile(params) {
11250
- const defaultAgentId = resolveDefaultAgentProfileId(params.config);
11251
- const candidateAgentId = normalizeString(params.storedAgentId)?.toLowerCase() ?? readRequestedAgentId(params.requestMetadata) ?? defaultAgentId;
11252
- const profile = findEffectiveAgentProfile(params.config, candidateAgentId) ?? findEffectiveAgentProfile(params.config, defaultAgentId);
11242
+ const { config, requestMetadata, storedAgentId } = params;
11243
+ const { agents: { defaults }, search: searchConfig, tools: { restrictToWorkspace, exec: { timeout: execTimeoutSeconds } } } = config;
11244
+ const defaultAgentId = resolveDefaultAgentProfileId(config);
11245
+ const profile = findEffectiveAgentProfile(config, normalizeString(storedAgentId)?.toLowerCase() ?? readRequestedAgentId(requestMetadata) ?? defaultAgentId) ?? findEffectiveAgentProfile(config, defaultAgentId);
11253
11246
  if (!profile) throw new Error(`default agent profile not found: ${defaultAgentId}`);
11254
11247
  return {
11255
11248
  agentId: profile.id,
11256
- workspace: getWorkspacePath(profile.workspace ?? params.config.agents.defaults.workspace),
11257
- model: profile.model ?? params.config.agents.defaults.model,
11258
- maxIterations: profile.maxToolIterations ?? params.config.agents.defaults.maxToolIterations,
11259
- contextTokens: profile.contextTokens ?? params.config.agents.defaults.contextTokens,
11260
- restrictToWorkspace: params.config.tools.restrictToWorkspace,
11261
- searchConfig: params.config.search,
11262
- execTimeoutSeconds: params.config.tools.exec.timeout
11249
+ workspace: getWorkspacePath(profile.workspace ?? defaults.workspace),
11250
+ model: profile.model ?? defaults.model,
11251
+ maxIterations: profile.maxToolIterations ?? defaults.maxToolIterations,
11252
+ contextTokens: profile.contextTokens ?? defaults.contextTokens,
11253
+ restrictToWorkspace,
11254
+ searchConfig,
11255
+ execTimeoutSeconds
11263
11256
  };
11264
11257
  }
11265
11258
  function shouldAppendTimeHint(content) {
@@ -11307,14 +11300,7 @@ function filterTools(toolDefinitions, requestedToolNames) {
11307
11300
  return filtered.length > 0 ? filtered : void 0;
11308
11301
  }
11309
11302
  function buildRequestedOpenAiTools(toolDefinitions, requestedToolNames) {
11310
- return filterTools(toolDefinitions.map((tool) => ({
11311
- type: "function",
11312
- function: {
11313
- name: tool.name,
11314
- description: tool.description,
11315
- parameters: tool.parameters
11316
- }
11317
- })), requestedToolNames);
11303
+ return filterTools(toolDefinitions.map(buildOpenAiFunctionTool), requestedToolNames);
11318
11304
  }
11319
11305
  var NextclawNcpContextBuilder = class {
11320
11306
  inputBudgetPruner = new InputBudgetPruner();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextclaw",
3
- "version": "0.17.9",
3
+ "version": "0.17.10",
4
4
  "description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -40,16 +40,16 @@
40
40
  "chokidar": "^3.6.0",
41
41
  "commander": "^12.1.0",
42
42
  "yaml": "^2.8.1",
43
+ "@nextclaw/core": "0.12.5",
44
+ "@nextclaw/ncp-agent-runtime": "0.3.10",
43
45
  "@nextclaw/ncp": "0.5.0",
44
- "@nextclaw/ncp-agent-runtime": "0.3.9",
45
- "@nextclaw/core": "0.12.4",
46
- "@nextclaw/ncp-mcp": "0.1.71",
47
- "@nextclaw/ncp-toolkit": "0.5.4",
48
- "@nextclaw/mcp": "0.1.69",
49
- "@nextclaw/openclaw-compat": "1.0.4",
50
- "@nextclaw/server": "0.12.4",
51
- "@nextclaw/remote": "0.1.81",
52
- "@nextclaw/runtime": "0.2.36"
46
+ "@nextclaw/openclaw-compat": "1.0.5",
47
+ "@nextclaw/mcp": "0.1.70",
48
+ "@nextclaw/ncp-toolkit": "0.5.5",
49
+ "@nextclaw/ncp-mcp": "0.1.72",
50
+ "@nextclaw/server": "0.12.5",
51
+ "@nextclaw/remote": "0.1.82",
52
+ "@nextclaw/runtime": "0.2.37"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/node": "^20.17.6",
@@ -57,7 +57,7 @@
57
57
  "tsx": "^4.19.2",
58
58
  "typescript": "^5.6.3",
59
59
  "vitest": "^4.1.2",
60
- "@nextclaw/ui": "0.12.6"
60
+ "@nextclaw/ui": "0.12.7"
61
61
  },
62
62
  "scripts": {
63
63
  "dev": "tsx watch --tsconfig tsconfig.json src/cli/index.ts",