@miruzero/zero-agent 0.3.2 → 0.3.3

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": "@miruzero/zero-agent",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "MiruZero local worker agent for multi-device tool execution.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -3,6 +3,7 @@
3
3
  const crypto = require('node:crypto');
4
4
  const fs = require('node:fs');
5
5
  const path = require('node:path');
6
+ const localTools = require('./local-tools');
6
7
 
7
8
  const defaultMcpRoot = () => path.resolve(__dirname, '../..');
8
9
  const mcpRoot = (env = process.env) => path.resolve(env.ZERO_MCP_ROOT || defaultMcpRoot());
@@ -55,8 +56,17 @@ const safeInternalTools = (provider) => {
55
56
  return [{ name: '__scan_error__', description: error.message, inputSchema: null }];
56
57
  }
57
58
  };
59
+ const builtInLocalProvider = () => ({
60
+ name: 'zero-agent-local',
61
+ type: 'internal',
62
+ description: 'Built-in safe local filesystem tools exposed by zero-agent.',
63
+ status: 'present',
64
+ tools: localTools.listTools(),
65
+ tool_count: localTools.listTools().length
66
+ });
67
+
58
68
  const buildCapabilities = (env = process.env) => {
59
- const providers = manifestProviders(env).map((provider) => {
69
+ const providers = [builtInLocalProvider(), ...manifestProviders(env).map((provider) => {
60
70
  const tools = provider.type === 'internal' ? safeInternalTools(provider) : [];
61
71
  return {
62
72
  name: provider.name,
@@ -67,7 +77,7 @@ const buildCapabilities = (env = process.env) => {
67
77
  tool_count: tools.length,
68
78
  mcp_stdio_live_scan: provider.type === 'mcp-stdio' ? false : undefined
69
79
  };
70
- });
80
+ })];
71
81
  const payload = {
72
82
  agent_version: require('../package.json').version,
73
83
  mcp_root: mcpRoot(env),
@@ -80,4 +90,5 @@ const buildCapabilities = (env = process.env) => {
80
90
  return payload;
81
91
  };
82
92
 
83
- module.exports = { mcpRoot, providersDir, manifestProviders, buildCapabilities };
93
+ const capabilities = { mcpRoot, providersDir, manifestProviders, buildCapabilities };
94
+ Object.assign(exports, capabilities);
@@ -135,11 +135,22 @@ const grepFiles = (args, env) => {
135
135
 
136
136
  const handlers = { listDirectory, getFileInfo, readFile, globFiles, grepFiles };
137
137
 
138
- exports.execute = (tool, args = {}, env = process.env) => {
138
+ const schemaObject = (properties, required = []) => ({ type: 'object', properties, required });
139
+ const toolSchemas = [
140
+ { name: 'listDirectory', description: 'List files and folders inside ZERO_AGENT_ROOTS.', inputSchema: schemaObject({ path: { type: 'string' }, depth: { type: 'number' } }, ['path']) },
141
+ { name: 'getFileInfo', description: 'Get metadata for a file or directory inside ZERO_AGENT_ROOTS.', inputSchema: schemaObject({ path: { type: 'string' } }, ['path']) },
142
+ { name: 'readFile', description: 'Read a UTF-8 text file inside ZERO_AGENT_ROOTS with line pagination.', inputSchema: schemaObject({ path: { type: 'string' }, offset: { type: 'number' }, length: { type: 'number' } }, ['path']) },
143
+ { name: 'globFiles', description: 'Find files by wildcard pattern inside ZERO_AGENT_ROOTS.', inputSchema: schemaObject({ path: { type: 'string' }, pattern: { type: 'string' }, maxResults: { type: 'number' } }, ['path']) },
144
+ { name: 'grepFiles', description: 'Search text files inside ZERO_AGENT_ROOTS.', inputSchema: schemaObject({ path: { type: 'string' }, pattern: { type: 'string' }, literal: { type: 'boolean' }, filePattern: { type: 'string' }, maxResults: { type: 'number' } }, ['path', 'pattern']) }
145
+ ];
146
+
147
+ const execute = (tool, args = {}, env = process.env) => {
139
148
  const cleanTool = String(tool || '').replace(/^command\./, '');
140
149
  const handler = handlers[cleanTool];
141
150
  if (!handler) throw err('UNKNOWN_AGENT_TOOL', 'unknown or unsafe agent tool: ' + tool);
142
151
  return handler(args, env);
143
152
  };
153
+ const listTools = () => toolSchemas.map((tool) => ({ ...tool }));
144
154
 
145
- exports._private = { rootsFor, resolveAllowed, wildcard };
155
+ const localTools = { execute, listTools, _private: { rootsFor, resolveAllowed, wildcard } };
156
+ Object.assign(exports, localTools);