@causyne/agent 1.20.38 → 1.20.41

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.
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Types and interfaces for PluginsFactory.
3
+ *
4
+ * PluginsFactory empowers Causyne Agent to generate custom plugins, Python bridges,
5
+ * or MCP servers when a requested service/integration does not yet exist.
6
+ *
7
+ * Route Strategy:
8
+ * 1. Native Plugin (HTTP/CLI): Leanest token footprint, lowest cost.
9
+ * 2. Python Bridge: Spawns Python subprocess with JSON protocol for Python-only SDKs.
10
+ * 3. MCP Server: Used when a service strictly permits only MCP or the user explicitly asks for it.
11
+ */
12
+
13
+ export type RouteKind = 'native_plugin' | 'python_bridge' | 'mcp_server';
14
+
15
+ export type ServiceKind = 'http_api' | 'cli' | 'python_sdk' | 'mcp_only' | 'custom';
16
+
17
+ export type CapabilityName = 'workspace:read' | 'workspace:write' | 'network' | 'subprocess';
18
+
19
+ export interface ToolParameterSchema {
20
+ type: 'object';
21
+ properties?: Record<string, {
22
+ type?: string | undefined;
23
+ description?: string | undefined;
24
+ enum?: string[] | undefined;
25
+ default?: unknown;
26
+ items?: Record<string, unknown> | undefined;
27
+ [key: string]: unknown;
28
+ }> | undefined;
29
+ required?: string[] | undefined;
30
+ [key: string]: unknown;
31
+ }
32
+
33
+ export interface ServiceToolDescriptor {
34
+ name: string;
35
+ description: string;
36
+ parameters: ToolParameterSchema;
37
+ httpMethod?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | undefined;
38
+ httpPath?: string | undefined;
39
+ cliSubcommand?: string | undefined;
40
+ pythonMethod?: string | undefined;
41
+ }
42
+
43
+ export interface ServiceDescriptor {
44
+ name: string;
45
+ description: string;
46
+ serviceKind: ServiceKind;
47
+ endpoint?: string | undefined;
48
+ authType?: 'none' | 'bearer' | 'apiKey' | 'basic' | 'env' | undefined;
49
+ authEnvVar?: string | undefined;
50
+ cliBinary?: string | undefined;
51
+ pythonModule?: string | undefined;
52
+ tools: ServiceToolDescriptor[];
53
+ capabilities?: CapabilityName[] | undefined;
54
+ userPreferredRoute?: RouteKind | undefined;
55
+ }
56
+
57
+ export interface CostEstimate {
58
+ route: RouteKind;
59
+ estimatedSchemaTokens: number;
60
+ estimatedPerCallTokens: number;
61
+ isLongRunningProcess: boolean;
62
+ relativeCostMultiplier: number;
63
+ explanation: string;
64
+ }
65
+
66
+ export interface RouteCostComparison {
67
+ nativePlugin: CostEstimate;
68
+ pythonBridge: CostEstimate;
69
+ mcpServer: CostEstimate;
70
+ }
71
+
72
+ export interface FactoryRouteProposal {
73
+ service: ServiceDescriptor;
74
+ recommendedRoute: RouteKind;
75
+ reason: string;
76
+ costComparison: RouteCostComparison;
77
+ mcpDisclosure?: string | undefined;
78
+ userConsentRequired: boolean;
79
+ userConfirmedRoute?: RouteKind | undefined;
80
+ existingCapability?: {
81
+ covered: boolean;
82
+ source?: 'native_tool' | 'plugin' | 'mcp' | undefined;
83
+ matchName?: string | undefined;
84
+ details?: string | undefined;
85
+ } | undefined;
86
+ }
87
+
88
+ export interface ScaffoldOptions {
89
+ force?: boolean | undefined;
90
+ baseDir?: string | undefined;
91
+ dryRun?: boolean | undefined;
92
+ }
93
+
94
+ export interface ScaffoldResult {
95
+ success: boolean;
96
+ route: RouteKind;
97
+ targetDirectory: string;
98
+ createdFiles: string[];
99
+ digest?: string | undefined;
100
+ instructions: string;
101
+ error?: string | undefined;
102
+ }
103
+
104
+ export interface PluginFactoryOptions {
105
+ pluginsDir?: string | undefined;
106
+ mcpServersDir?: string | undefined;
107
+ }
package/src/stallGuard.js CHANGED
@@ -50,6 +50,7 @@ export const MUTATING_TOOL_NAMES = new Set([
50
50
  'archive_extract',
51
51
  'game_build_html5',
52
52
  'tool_forge',
53
+ 'plugins_factory',
53
54
  'create_skill',
54
55
  'manage_local_dependencies',
55
56
  'creative_batch',
package/src/stallGuard.ts CHANGED
@@ -86,6 +86,7 @@ export const MUTATING_TOOL_NAMES = new Set([
86
86
  'archive_extract',
87
87
  'game_build_html5',
88
88
  'tool_forge',
89
+ 'plugins_factory',
89
90
  'create_skill',
90
91
  'manage_local_dependencies',
91
92
  'creative_batch',
package/src/toolPacks.js CHANGED
@@ -108,6 +108,7 @@ export const PACKS = {
108
108
  advanced: [
109
109
  'tool_forge',
110
110
  'plugin_manager',
111
+ 'plugins_factory',
111
112
  'document_forge',
112
113
  'agent_subagent_orchestrate',
113
114
  'peer_agent_delegate',
@@ -333,7 +334,7 @@ const GAME_INTENT = /\b(game|games|gamedev|godot|unity|unreal|ue5|rpg|platformer
333
334
  const WEB_INTENT = /\b(web|webpage|website|frontend|front-end|landing page|homepage|dashboard|portfolio|html|css|scss|tailwind|bootstrap|react|vue|svelte|angular|next\.?js|nuxt|astro|ui|ux|user interface|web app|webapp|spa|dom|responsive|ui forge|component forge|component generation|ui component|three?\.?js|three?js|webgl|canvas|babylon)\b/i;
334
335
  const MEDIA_INTENT = /\b(image|images|picture|photo|photoshop|premiere|after\s*effects|illustrator|indesign|media\s*encoder|uxp|render|3d model|blender|animation|animate|video|movie|film|audio|sound|sfx|music|song|voice|tts|text.to.speech|narration|podcast|thumbnail|poster|illustration|logo)\b|\.(psd|prproj|aep|ai|indd|ccx)\b/i;
335
336
  const SYSTEM_INTENT = /\b(process|processes|pid|kill|port|zip|unzip|tar|archive|compress|extract|clipboard|copy to clipboard|print|printer|open in browser|launch app|computer use|vision grounding|desktop vision|gui agent|coordinate click|desktop control)\b/i;
336
- const ADVANCED_INTENT = /\b(pdf|document|proposal|screenplay|shotlist|shot list|voiceover|dubbing|forge a tool|custom tool|new tool|plugin|plugins|custom plugin|subagent|sub-agent|parallel agent|swarm|ast|symbols|refactor across)\b/i;
337
+ const ADVANCED_INTENT = /\b(pdf|document|proposal|screenplay|shotlist|shot list|voiceover|dubbing|forge a tool|custom tool|new tool|plugin|plugins|custom plugin|plugins? factory|python bridge|mcp|mcp server|subagent|sub-agent|parallel agent|swarm|ast|symbols|refactor across)\b/i;
337
338
  const REVERSE_ENGINEERING_INTENT = /\b(rea|rea-agents|decompile|decompiling|decompilation|disassemble|disassembly|disassembling|binary|binaries|apk|aab|dex|elf|mach-o|pe|coff|reverse[\s_-]?engineer(ing)?|sourcemap|deobfuscate|asar|symbols|ghidra|rizin|radare|hopper|frida|hook script|mitigations|pie|canary|clean[- ]?room)\b|\.(apk|aab|dex|dylib|so|dll|exe|asar)\b/i;
338
339
  const INTENT_MATCHERS = {
339
340
  game: GAME_INTENT,
package/src/toolPacks.ts CHANGED
@@ -134,6 +134,7 @@ export const PACKS: Record<PackName, string[]> = {
134
134
  advanced: [
135
135
  'tool_forge',
136
136
  'plugin_manager',
137
+ 'plugins_factory',
137
138
  'document_forge',
138
139
  'agent_subagent_orchestrate',
139
140
  'peer_agent_delegate',
@@ -377,7 +378,7 @@ const MEDIA_INTENT = /\b(image|images|picture|photo|photoshop|premiere|after\s*e
377
378
 
378
379
  const SYSTEM_INTENT = /\b(process|processes|pid|kill|port|zip|unzip|tar|archive|compress|extract|clipboard|copy to clipboard|print|printer|open in browser|launch app|computer use|vision grounding|desktop vision|gui agent|coordinate click|desktop control)\b/i;
379
380
 
380
- const ADVANCED_INTENT = /\b(pdf|document|proposal|screenplay|shotlist|shot list|voiceover|dubbing|forge a tool|custom tool|new tool|plugin|plugins|custom plugin|subagent|sub-agent|parallel agent|swarm|ast|symbols|refactor across)\b/i;
381
+ const ADVANCED_INTENT = /\b(pdf|document|proposal|screenplay|shotlist|shot list|voiceover|dubbing|forge a tool|custom tool|new tool|plugin|plugins|custom plugin|plugins? factory|python bridge|mcp|mcp server|subagent|sub-agent|parallel agent|swarm|ast|symbols|refactor across)\b/i;
381
382
 
382
383
  const REVERSE_ENGINEERING_INTENT = /\b(rea|rea-agents|decompile|decompiling|decompilation|disassemble|disassembly|disassembling|binary|binaries|apk|aab|dex|elf|mach-o|pe|coff|reverse[\s_-]?engineer(ing)?|sourcemap|deobfuscate|asar|symbols|ghidra|rizin|radare|hopper|frida|hook script|mitigations|pie|canary|clean[- ]?room)\b|\.(apk|aab|dex|dylib|so|dll|exe|asar)\b/i;
383
384
 
@@ -0,0 +1,209 @@
1
+ /**
2
+ * plugins_factory Tool for Causyne Agent.
3
+ *
4
+ * Implements autonomous custom integration evaluation and scaffolding.
5
+ * Recommends token-lean native plugins or Python bridges, while fully respecting
6
+ * user choices if MCP is preferred.
7
+ */
8
+ import { PluginsFactory } from '../pluginsFactory/index.js';
9
+ function normalizeServiceDescriptor(args) {
10
+ const tools = (args.tools || []).map((t, idx) => {
11
+ const rawParams = (t.parameters && typeof t.parameters === 'object') ? t.parameters : {};
12
+ const { type: _discardType, ...restParams } = rawParams;
13
+ const parameters = {
14
+ ...restParams,
15
+ type: 'object',
16
+ properties: (rawParams['properties'] && typeof rawParams['properties'] === 'object')
17
+ ? rawParams['properties']
18
+ : {}
19
+ };
20
+ const tool = {
21
+ name: t.name || `tool_${idx + 1}`,
22
+ description: t.description || `Tool ${t.name || idx + 1}`,
23
+ parameters
24
+ };
25
+ if (t.httpMethod !== undefined)
26
+ tool.httpMethod = t.httpMethod;
27
+ if (t.httpPath !== undefined)
28
+ tool.httpPath = t.httpPath;
29
+ if (t.cliSubcommand !== undefined)
30
+ tool.cliSubcommand = t.cliSubcommand;
31
+ if (t.pythonMethod !== undefined)
32
+ tool.pythonMethod = t.pythonMethod;
33
+ return tool;
34
+ });
35
+ if (tools.length === 0) {
36
+ tools.push({
37
+ name: 'execute',
38
+ description: `Default execution method for ${args.serviceName}`,
39
+ parameters: { type: 'object', properties: {} }
40
+ });
41
+ }
42
+ const desc = {
43
+ name: args.serviceName,
44
+ description: args.serviceDescription || `Custom integration for ${args.serviceName}`,
45
+ serviceKind: args.serviceKind || 'custom',
46
+ tools
47
+ };
48
+ if (args.endpoint !== undefined)
49
+ desc.endpoint = args.endpoint;
50
+ if (args.authType !== undefined)
51
+ desc.authType = args.authType;
52
+ if (args.authEnvVar !== undefined)
53
+ desc.authEnvVar = args.authEnvVar;
54
+ if (args.cliBinary !== undefined)
55
+ desc.cliBinary = args.cliBinary;
56
+ if (args.pythonModule !== undefined)
57
+ desc.pythonModule = args.pythonModule;
58
+ if (args.capabilities !== undefined)
59
+ desc.capabilities = args.capabilities;
60
+ if (args.userPreferredRoute !== undefined)
61
+ desc.userPreferredRoute = args.userPreferredRoute;
62
+ return desc;
63
+ }
64
+ export const pluginsFactoryTool = {
65
+ schema: {
66
+ name: 'plugins_factory',
67
+ description: 'Assess, compare token costs, and scaffold custom plugins, Python bridges, or MCP servers for external services or APIs that are not yet integrated into Causyne. Recommends the leanest, most economical route (Native Plugin or Python Bridge) while honoring user choice if MCP is preferred.',
68
+ parameters: {
69
+ type: 'object',
70
+ properties: {
71
+ action: {
72
+ type: 'string',
73
+ enum: ['assess', 'estimate_cost', 'scaffold'],
74
+ description: 'Action: "assess" evaluates routes and returns proposal with token costs; "estimate_cost" returns detailed token footprint; "scaffold" creates the files in ~/.causyne/.'
75
+ },
76
+ serviceName: {
77
+ type: 'string',
78
+ description: 'Name of the service or plugin (lowercase alphanumeric and hyphens, e.g. "notion-api", "blender-cycles").'
79
+ },
80
+ serviceDescription: {
81
+ type: 'string',
82
+ description: 'Overview of what the external service does and why the integration is needed.'
83
+ },
84
+ serviceKind: {
85
+ type: 'string',
86
+ enum: ['http_api', 'cli', 'python_sdk', 'mcp_only', 'custom'],
87
+ description: 'Nature of the target service.'
88
+ },
89
+ endpoint: {
90
+ type: 'string',
91
+ description: 'Base URL for HTTP APIs (e.g. "https://api.github.com").'
92
+ },
93
+ authType: {
94
+ type: 'string',
95
+ enum: ['none', 'bearer', 'apiKey', 'basic', 'env'],
96
+ description: 'Authentication scheme.'
97
+ },
98
+ authEnvVar: {
99
+ type: 'string',
100
+ description: 'Environment variable name holding the API token (e.g. "NOTION_API_KEY").'
101
+ },
102
+ cliBinary: {
103
+ type: 'string',
104
+ description: 'Binary executable name for CLI plugins (e.g. "ffmpeg", "yt-dlp").'
105
+ },
106
+ pythonModule: {
107
+ type: 'string',
108
+ description: 'Python package/module name for Python bridges (e.g. "bpy", "torch").'
109
+ },
110
+ tools: {
111
+ type: 'array',
112
+ items: {
113
+ type: 'object',
114
+ properties: {
115
+ name: { type: 'string', description: 'Tool name' },
116
+ description: { type: 'string', description: 'What the tool does' },
117
+ parameters: { type: 'object', description: 'JSON schema for tool parameters' },
118
+ httpMethod: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'] },
119
+ httpPath: { type: 'string', description: 'HTTP relative path' },
120
+ cliSubcommand: { type: 'string', description: 'Subcommand for CLI tools' },
121
+ pythonMethod: { type: 'string', description: 'Method name in Python bridge' }
122
+ },
123
+ required: ['name', 'description']
124
+ },
125
+ description: 'List of tools to expose to the agent.'
126
+ },
127
+ capabilities: {
128
+ type: 'array',
129
+ items: {
130
+ type: 'string',
131
+ enum: ['workspace:read', 'workspace:write', 'network', 'subprocess']
132
+ },
133
+ description: 'Host sandbox permissions required.'
134
+ },
135
+ userPreferredRoute: {
136
+ type: 'string',
137
+ enum: ['native_plugin', 'python_bridge', 'mcp_server'],
138
+ description: 'Explicit user route preference (e.g. user insists on MCP).'
139
+ },
140
+ force: {
141
+ type: 'boolean',
142
+ description: 'Overwrite existing directory if present.'
143
+ },
144
+ dryRun: {
145
+ type: 'boolean',
146
+ description: 'Simulate scaffolding without writing files.'
147
+ }
148
+ },
149
+ required: ['action', 'serviceName']
150
+ }
151
+ },
152
+ async execute(args) {
153
+ try {
154
+ if (!args || !args.action || !args.serviceName) {
155
+ return {
156
+ success: false,
157
+ action: args?.action || 'unknown',
158
+ error: 'Missing required arguments: "action" and "serviceName" are required.'
159
+ };
160
+ }
161
+ const factory = new PluginsFactory();
162
+ const service = normalizeServiceDescriptor(args);
163
+ const proposal = factory.assess(service, args.userPreferredRoute);
164
+ if (args.action === 'assess' || args.action === 'estimate_cost') {
165
+ const res = {
166
+ success: true,
167
+ action: args.action,
168
+ proposal,
169
+ message: [
170
+ `Assessment complete for service '${service.name}'.`,
171
+ `Recommended Route: ${proposal.recommendedRoute} (${proposal.reason})`,
172
+ proposal.mcpDisclosure ? `\n${proposal.mcpDisclosure}` : ''
173
+ ].filter(Boolean).join('\n')
174
+ };
175
+ return res;
176
+ }
177
+ if (args.action === 'scaffold') {
178
+ const scaffoldOpts = {};
179
+ if (args.force !== undefined)
180
+ scaffoldOpts.force = args.force;
181
+ if (args.dryRun !== undefined)
182
+ scaffoldOpts.dryRun = args.dryRun;
183
+ const scaffoldResult = await factory.scaffold(proposal, scaffoldOpts);
184
+ const res = {
185
+ success: scaffoldResult.success,
186
+ action: 'scaffold',
187
+ proposal,
188
+ scaffoldResult,
189
+ message: scaffoldResult.instructions
190
+ };
191
+ if (scaffoldResult.error !== undefined)
192
+ res.error = scaffoldResult.error;
193
+ return res;
194
+ }
195
+ return {
196
+ success: false,
197
+ action: args.action,
198
+ error: `Unrecognized action: "${args.action}". Allowed: assess, estimate_cost, scaffold`
199
+ };
200
+ }
201
+ catch (err) {
202
+ return {
203
+ success: false,
204
+ action: args?.action || 'execute',
205
+ error: err instanceof Error ? err.message : String(err)
206
+ };
207
+ }
208
+ }
209
+ };
@@ -0,0 +1,254 @@
1
+ /**
2
+ * plugins_factory Tool for Causyne Agent.
3
+ *
4
+ * Implements autonomous custom integration evaluation and scaffolding.
5
+ * Recommends token-lean native plugins or Python bridges, while fully respecting
6
+ * user choices if MCP is preferred.
7
+ */
8
+
9
+ import {
10
+ PluginsFactory,
11
+ type FactoryRouteProposal,
12
+ type RouteKind,
13
+ type ScaffoldOptions,
14
+ type ScaffoldResult,
15
+ type ServiceDescriptor,
16
+ type ServiceKind,
17
+ type ServiceToolDescriptor,
18
+ type ToolParameterSchema
19
+ } from '../pluginsFactory/index.js';
20
+
21
+ export interface PluginsFactoryArgs {
22
+ action: 'assess' | 'estimate_cost' | 'scaffold';
23
+ serviceName: string;
24
+ serviceDescription?: string | undefined;
25
+ serviceKind?: ServiceKind | undefined;
26
+ endpoint?: string | undefined;
27
+ authType?: 'none' | 'bearer' | 'apiKey' | 'basic' | 'env' | undefined;
28
+ authEnvVar?: string | undefined;
29
+ cliBinary?: string | undefined;
30
+ pythonModule?: string | undefined;
31
+ tools?: Array<{
32
+ name: string;
33
+ description: string;
34
+ parameters?: Record<string, unknown> | undefined;
35
+ httpMethod?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | undefined;
36
+ httpPath?: string | undefined;
37
+ cliSubcommand?: string | undefined;
38
+ pythonMethod?: string | undefined;
39
+ }> | undefined;
40
+ capabilities?: Array<'workspace:read' | 'workspace:write' | 'network' | 'subprocess'> | undefined;
41
+ userPreferredRoute?: RouteKind | undefined;
42
+ force?: boolean | undefined;
43
+ dryRun?: boolean | undefined;
44
+ }
45
+
46
+ export interface PluginsFactoryToolResult {
47
+ success: boolean;
48
+ action: string;
49
+ proposal?: FactoryRouteProposal | undefined;
50
+ scaffoldResult?: ScaffoldResult | undefined;
51
+ message?: string | undefined;
52
+ error?: string | undefined;
53
+ }
54
+
55
+ function normalizeServiceDescriptor(args: PluginsFactoryArgs): ServiceDescriptor {
56
+ const tools: ServiceToolDescriptor[] = (args.tools || []).map((t, idx) => {
57
+ const rawParams = (t.parameters && typeof t.parameters === 'object') ? (t.parameters as Record<string, unknown>) : {};
58
+ const { type: _discardType, ...restParams } = rawParams;
59
+ const parameters: ToolParameterSchema = {
60
+ ...restParams,
61
+ type: 'object',
62
+ properties: (rawParams['properties'] && typeof rawParams['properties'] === 'object')
63
+ ? (rawParams['properties'] as ToolParameterSchema['properties'])
64
+ : {}
65
+ };
66
+ const tool: ServiceToolDescriptor = {
67
+ name: t.name || `tool_${idx + 1}`,
68
+ description: t.description || `Tool ${t.name || idx + 1}`,
69
+ parameters
70
+ };
71
+ if (t.httpMethod !== undefined) tool.httpMethod = t.httpMethod;
72
+ if (t.httpPath !== undefined) tool.httpPath = t.httpPath;
73
+ if (t.cliSubcommand !== undefined) tool.cliSubcommand = t.cliSubcommand;
74
+ if (t.pythonMethod !== undefined) tool.pythonMethod = t.pythonMethod;
75
+ return tool;
76
+ });
77
+
78
+ if (tools.length === 0) {
79
+ tools.push({
80
+ name: 'execute',
81
+ description: `Default execution method for ${args.serviceName}`,
82
+ parameters: { type: 'object', properties: {} }
83
+ });
84
+ }
85
+
86
+ const desc: ServiceDescriptor = {
87
+ name: args.serviceName,
88
+ description: args.serviceDescription || `Custom integration for ${args.serviceName}`,
89
+ serviceKind: args.serviceKind || 'custom',
90
+ tools
91
+ };
92
+
93
+ if (args.endpoint !== undefined) desc.endpoint = args.endpoint;
94
+ if (args.authType !== undefined) desc.authType = args.authType;
95
+ if (args.authEnvVar !== undefined) desc.authEnvVar = args.authEnvVar;
96
+ if (args.cliBinary !== undefined) desc.cliBinary = args.cliBinary;
97
+ if (args.pythonModule !== undefined) desc.pythonModule = args.pythonModule;
98
+ if (args.capabilities !== undefined) desc.capabilities = args.capabilities;
99
+ if (args.userPreferredRoute !== undefined) desc.userPreferredRoute = args.userPreferredRoute;
100
+
101
+ return desc;
102
+ }
103
+
104
+ export const pluginsFactoryTool = {
105
+ schema: {
106
+ name: 'plugins_factory',
107
+ description:
108
+ 'Assess, compare token costs, and scaffold custom plugins, Python bridges, or MCP servers for external services or APIs that are not yet integrated into Causyne. Recommends the leanest, most economical route (Native Plugin or Python Bridge) while honoring user choice if MCP is preferred.',
109
+ parameters: {
110
+ type: 'object',
111
+ properties: {
112
+ action: {
113
+ type: 'string',
114
+ enum: ['assess', 'estimate_cost', 'scaffold'],
115
+ description:
116
+ 'Action: "assess" evaluates routes and returns proposal with token costs; "estimate_cost" returns detailed token footprint; "scaffold" creates the files in ~/.causyne/.'
117
+ },
118
+ serviceName: {
119
+ type: 'string',
120
+ description: 'Name of the service or plugin (lowercase alphanumeric and hyphens, e.g. "notion-api", "blender-cycles").'
121
+ },
122
+ serviceDescription: {
123
+ type: 'string',
124
+ description: 'Overview of what the external service does and why the integration is needed.'
125
+ },
126
+ serviceKind: {
127
+ type: 'string',
128
+ enum: ['http_api', 'cli', 'python_sdk', 'mcp_only', 'custom'],
129
+ description: 'Nature of the target service.'
130
+ },
131
+ endpoint: {
132
+ type: 'string',
133
+ description: 'Base URL for HTTP APIs (e.g. "https://api.github.com").'
134
+ },
135
+ authType: {
136
+ type: 'string',
137
+ enum: ['none', 'bearer', 'apiKey', 'basic', 'env'],
138
+ description: 'Authentication scheme.'
139
+ },
140
+ authEnvVar: {
141
+ type: 'string',
142
+ description: 'Environment variable name holding the API token (e.g. "NOTION_API_KEY").'
143
+ },
144
+ cliBinary: {
145
+ type: 'string',
146
+ description: 'Binary executable name for CLI plugins (e.g. "ffmpeg", "yt-dlp").'
147
+ },
148
+ pythonModule: {
149
+ type: 'string',
150
+ description: 'Python package/module name for Python bridges (e.g. "bpy", "torch").'
151
+ },
152
+ tools: {
153
+ type: 'array',
154
+ items: {
155
+ type: 'object',
156
+ properties: {
157
+ name: { type: 'string', description: 'Tool name' },
158
+ description: { type: 'string', description: 'What the tool does' },
159
+ parameters: { type: 'object', description: 'JSON schema for tool parameters' },
160
+ httpMethod: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'] },
161
+ httpPath: { type: 'string', description: 'HTTP relative path' },
162
+ cliSubcommand: { type: 'string', description: 'Subcommand for CLI tools' },
163
+ pythonMethod: { type: 'string', description: 'Method name in Python bridge' }
164
+ },
165
+ required: ['name', 'description']
166
+ },
167
+ description: 'List of tools to expose to the agent.'
168
+ },
169
+ capabilities: {
170
+ type: 'array',
171
+ items: {
172
+ type: 'string',
173
+ enum: ['workspace:read', 'workspace:write', 'network', 'subprocess']
174
+ },
175
+ description: 'Host sandbox permissions required.'
176
+ },
177
+ userPreferredRoute: {
178
+ type: 'string',
179
+ enum: ['native_plugin', 'python_bridge', 'mcp_server'],
180
+ description: 'Explicit user route preference (e.g. user insists on MCP).'
181
+ },
182
+ force: {
183
+ type: 'boolean',
184
+ description: 'Overwrite existing directory if present.'
185
+ },
186
+ dryRun: {
187
+ type: 'boolean',
188
+ description: 'Simulate scaffolding without writing files.'
189
+ }
190
+ },
191
+ required: ['action', 'serviceName']
192
+ }
193
+ },
194
+
195
+ async execute(args: PluginsFactoryArgs): Promise<PluginsFactoryToolResult> {
196
+ try {
197
+ if (!args || !args.action || !args.serviceName) {
198
+ return {
199
+ success: false,
200
+ action: args?.action || 'unknown',
201
+ error: 'Missing required arguments: "action" and "serviceName" are required.'
202
+ };
203
+ }
204
+
205
+ const factory = new PluginsFactory();
206
+ const service = normalizeServiceDescriptor(args);
207
+ const proposal = factory.assess(service, args.userPreferredRoute);
208
+
209
+ if (args.action === 'assess' || args.action === 'estimate_cost') {
210
+ const res: PluginsFactoryToolResult = {
211
+ success: true,
212
+ action: args.action,
213
+ proposal,
214
+ message: [
215
+ `Assessment complete for service '${service.name}'.`,
216
+ `Recommended Route: ${proposal.recommendedRoute} (${proposal.reason})`,
217
+ proposal.mcpDisclosure ? `\n${proposal.mcpDisclosure}` : ''
218
+ ].filter(Boolean).join('\n')
219
+ };
220
+ return res;
221
+ }
222
+
223
+ if (args.action === 'scaffold') {
224
+ const scaffoldOpts: ScaffoldOptions = {};
225
+ if (args.force !== undefined) scaffoldOpts.force = args.force;
226
+ if (args.dryRun !== undefined) scaffoldOpts.dryRun = args.dryRun;
227
+
228
+ const scaffoldResult = await factory.scaffold(proposal, scaffoldOpts);
229
+
230
+ const res: PluginsFactoryToolResult = {
231
+ success: scaffoldResult.success,
232
+ action: 'scaffold',
233
+ proposal,
234
+ scaffoldResult,
235
+ message: scaffoldResult.instructions
236
+ };
237
+ if (scaffoldResult.error !== undefined) res.error = scaffoldResult.error;
238
+ return res;
239
+ }
240
+
241
+ return {
242
+ success: false,
243
+ action: args.action,
244
+ error: `Unrecognized action: "${args.action}". Allowed: assess, estimate_cost, scaffold`
245
+ };
246
+ } catch (err) {
247
+ return {
248
+ success: false,
249
+ action: args?.action || 'execute',
250
+ error: err instanceof Error ? err.message : String(err)
251
+ };
252
+ }
253
+ }
254
+ };
@@ -44,6 +44,7 @@ import { memoryRecall } from './memoryRecall.js';
44
44
  import { printerPrint, printerList, printerStatus } from './printer.js';
45
45
  import { toolForgeTool } from './toolForge.js';
46
46
  import { pluginManagerTool } from './pluginManager.js';
47
+ import { pluginsFactoryTool } from './pluginsFactory.js';
47
48
  import { astryxOracle } from './astryxOracle.js';
48
49
  import { pdfRead } from './pdfReader.js';
49
50
  import { codeVerifySyntax, codeListSymbols } from './codeTools.js';
@@ -120,7 +121,7 @@ const TOOL_MODULES = [
120
121
  codebaseSearch, browserAct, viewImage, webSearch,
121
122
  updatePlan, requestDecision, clipboard, screenshot, axSnapshot, desktopAct, archive,
122
123
  checkSystemSpecs, executeProceduralMedia, manageLocalAiDependencies,
123
- generateMediaViaApi, memoryWrite, memoryRecall, printerPrint, printerList, printerStatus, toolForgeTool, pluginManagerTool,
124
+ generateMediaViaApi, memoryWrite, memoryRecall, printerPrint, printerList, printerStatus, toolForgeTool, pluginManagerTool, pluginsFactoryTool,
124
125
  astryxOracle, pdfRead, codeVerifySyntax, codeListSymbols, blenderAct, resolveAutomator, palmierAutomator,
125
126
  codeSearchAst, codeSearcher, persistentShell, subagentOrchestrator, deferredMcpSearch, visionInspector,
126
127
  godotAutomator, gameBuilder, gameAssetFetcher,
package/src/toolsList.js CHANGED
@@ -84,6 +84,7 @@ const CATALOGUE = {
84
84
  advanced: {
85
85
  tool_forge: 'create a custom tool',
86
86
  plugin_manager: 'manage plugins',
87
+ plugins_factory: 'assess and scaffold custom plugins or Python bridges',
87
88
  pdf_read: 'read PDF text',
88
89
  code_list_symbols: 'list symbols in a file',
89
90
  code_search_ast: 'AST definition search',
package/src/toolsList.ts CHANGED
@@ -98,6 +98,7 @@ const CATALOGUE: Readonly<Record<Exclude<ToolGroup, 'custom'>, Readonly<Record<s
98
98
  advanced: {
99
99
  tool_forge: 'create a custom tool',
100
100
  plugin_manager: 'manage plugins',
101
+ plugins_factory: 'assess and scaffold custom plugins or Python bridges',
101
102
  pdf_read: 'read PDF text',
102
103
  code_list_symbols: 'list symbols in a file',
103
104
  code_search_ast: 'AST definition search',
@@ -15,6 +15,7 @@ export class ChatRenderer {
15
15
  handle(message: { type: string; [key: string]: unknown }): boolean;
16
16
  resetTurn(): void;
17
17
  onAgentReasoning(message: { content?: string; streaming?: boolean; elapsedMs?: number }): void;
18
+ renderReasoning(content: string, options?: { streaming?: boolean; durationText?: string; collapsed?: boolean }): void;
18
19
  stopSpinner(): void;
19
20
  frame(kind: string, produce: () => void, meta?: Record<string, unknown> | null): void;
20
21
  updateTailFrame(kind: string, produce: () => void, meta?: Record<string, unknown> | null): void;