hoomanjs 1.11.0 → 1.11.1

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": "hoomanjs",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Bun-powered local AI agent CLI with chat, exec, ACP, MCP, and skills support.",
5
5
  "author": {
6
6
  "name": "Vaibhav Pandey",
@@ -3,7 +3,8 @@ import type { Config } from "../core/config.ts";
3
3
  import type { Manager as McpManager } from "../core/mcp/index.ts";
4
4
  import { INTERNAL_ALWAYS_ALLOWED } from "../acp/utils/tool-kind.ts";
5
5
 
6
- const INPUT_PREVIEW_LIMIT = 1_024;
6
+ const TOOL_DESCRIPTION_PREVIEW_LIMIT = 50;
7
+ const TOOL_ARGS_PREVIEW_LIMIT = 50;
7
8
 
8
9
  type ChannelOrigin = {
9
10
  server?: string;
@@ -17,14 +18,24 @@ function randomRequestId(): string {
17
18
  return crypto.randomUUID();
18
19
  }
19
20
 
21
+ function truncateWithEllipsis(text: string, max: number): string {
22
+ return text.length > max ? `${text.slice(0, max)}…` : text;
23
+ }
24
+
25
+ function truncateWithHiddenCharCount(text: string, max: number): string {
26
+ if (text.length <= max) {
27
+ return text;
28
+ }
29
+ const hidden = text.length - max;
30
+ return `${text.slice(0, max)}…(${hidden} chars)`;
31
+ }
32
+
20
33
  function inputPreview(input: unknown): string {
21
34
  try {
22
- const text = JSON.stringify(input, null, 2) ?? "null";
23
- return text.length > INPUT_PREVIEW_LIMIT
24
- ? `${text.slice(0, INPUT_PREVIEW_LIMIT)}\n... (truncated)`
25
- : text;
35
+ const text = JSON.stringify(input) ?? "null";
36
+ return truncateWithHiddenCharCount(text, TOOL_ARGS_PREVIEW_LIMIT);
26
37
  } catch {
27
- return String(input);
38
+ return truncateWithHiddenCharCount(String(input), TOOL_ARGS_PREVIEW_LIMIT);
28
39
  }
29
40
  }
30
41
 
@@ -85,9 +96,11 @@ export function createDaemonApprovalHandler(
85
96
  behavior = await manager.requestChannelPermission(origin.server, {
86
97
  requestId: randomRequestId(),
87
98
  tool: name,
88
- description:
99
+ description: truncateWithEllipsis(
89
100
  event.tool?.description?.trim() ??
90
- `Run tool "${name}" in daemon mode.`,
101
+ `Run tool "${name}" in daemon mode.`,
102
+ TOOL_DESCRIPTION_PREVIEW_LIMIT,
103
+ ),
91
104
  preview: inputPreview(event.toolUse.input),
92
105
  source: origin.source,
93
106
  user: origin.user,