@openape/apes 1.7.0 → 1.8.0
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/dist/{auth-lock-4IRWI3ED.js → auth-lock-BBSP72GH.js} +2 -1
- package/dist/{auth-lock-4IRWI3ED.js.map → auth-lock-BBSP72GH.js.map} +1 -1
- package/dist/chunk-7OCVIDC7.js +12 -0
- package/dist/{chunk-N3THIFIS.js → chunk-QJJ7DG5C.js} +3 -3
- package/dist/chunk-WGF3SPIH.js +3598 -0
- package/dist/chunk-WGF3SPIH.js.map +1 -0
- package/dist/cli.js +1383 -334
- package/dist/cli.js.map +1 -1
- package/dist/{config-MOB5DJ6H.js → config-DA2L3XOV.js} +2 -1
- package/dist/{http-5F7FX4V7.js → http-JWS5LV2U.js} +3 -2
- package/dist/index.js +2 -1
- package/dist/multipart-parser-FVZBRBXW.js +182 -0
- package/dist/multipart-parser-FVZBRBXW.js.map +1 -0
- package/dist/{orchestrator-EH6V5ATG.js → orchestrator-2QS5KXFL.js} +3 -2
- package/dist/{orchestrator-EH6V5ATG.js.map → orchestrator-2QS5KXFL.js.map} +1 -1
- package/dist/{server-BSBIEKFK.js → server-6B26NNLZ.js} +4 -3
- package/dist/{server-BSBIEKFK.js.map → server-6B26NNLZ.js.map} +1 -1
- package/dist/{ssh-key-YBNNG5K5.js → ssh-key-6X3YZXSD.js} +2 -1
- package/dist/ssh-key-6X3YZXSD.js.map +1 -0
- package/package.json +1 -1
- /package/dist/{config-MOB5DJ6H.js.map → chunk-7OCVIDC7.js.map} +0 -0
- /package/dist/{chunk-N3THIFIS.js.map → chunk-QJJ7DG5C.js.map} +0 -0
- /package/dist/{http-5F7FX4V7.js.map → config-DA2L3XOV.js.map} +0 -0
- /package/dist/{ssh-key-YBNNG5K5.js.map → http-JWS5LV2U.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/mcp/server.ts","../src/commands/mcp/tools.ts","../src/commands/mcp/adapter-tools.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js'\nimport { createServer } from 'node:http'\nimport consola from 'consola'\nimport { registerAdapterTools, registerStaticTools } from './tools'\n\ndeclare const __VERSION__: string\n\nexport async function startMcpServer(transport: 'stdio' | 'sse', port: number) {\n const server = new McpServer({\n name: 'apes',\n version: typeof __VERSION__ !== 'undefined' ? __VERSION__ : '0.1.0',\n })\n\n // Register static tools\n registerStaticTools(server)\n\n // Register adapter-derived tools\n registerAdapterTools(server)\n\n if (transport === 'stdio') {\n const stdioTransport = new StdioServerTransport()\n await server.connect(stdioTransport)\n }\n else if (transport === 'sse') {\n const httpServer = createServer(async (req, res) => {\n if (req.url === '/sse' && req.method === 'GET') {\n const sseTransport = new SSEServerTransport('/messages', res)\n await server.connect(sseTransport)\n }\n else if (req.url === '/messages' && req.method === 'POST') {\n // SSE message handling is done by the transport\n res.writeHead(200)\n res.end()\n }\n else {\n res.writeHead(404)\n res.end('Not found')\n }\n })\n\n httpServer.listen(port, () => {\n consola.info(`MCP SSE server listening on http://localhost:${port}/sse`)\n })\n }\n}\n","import { hostname } from 'node:os'\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport {\n createShapesGrant,\n fetchGrantToken,\n loadAdapter,\n resolveCommand,\n verifyAndExecute,\n} from '../../shapes/index.js'\nimport { z } from 'zod'\nimport { getAuthToken, getIdpUrl, getRequesterIdentity } from '../../config'\nimport { apiFetch, getGrantsEndpoint } from '../../http'\nimport { loadAdapterTools } from './adapter-tools'\n\nexport function registerStaticTools(server: McpServer) {\n server.registerTool('apes.grants.list', {\n description: 'List grants',\n inputSchema: {\n status: z.string().optional().describe('Filter by status: pending, approved, denied, revoked, used'),\n limit: z.string().optional().describe('Max results'),\n },\n }, async ({ status, limit }) => {\n const idp = getIdpUrl()\n if (!idp)\n return { content: [{ type: 'text' as const, text: 'Not configured. Run `apes login` first.' }] }\n\n const grantsUrl = await getGrantsEndpoint(idp)\n const params = new URLSearchParams()\n if (status)\n params.set('status', status)\n if (limit)\n params.set('limit', limit)\n const query = params.toString() ? `?${params.toString()}` : ''\n const response = await apiFetch(`${grantsUrl}${query}`)\n return { content: [{ type: 'text' as const, text: JSON.stringify(response, null, 2) }] }\n })\n\n server.registerTool('apes.grants.request', {\n description: 'Request a grant for a command',\n inputSchema: {\n command: z.string().describe('Command to request permission for'),\n audience: z.string().describe('Service identifier (e.g. escapes, proxy, shapes)'),\n approval: z.string().optional().describe('once, timed, or always'),\n reason: z.string().optional().describe('Reason for the request'),\n },\n }, async ({ command, audience, approval, reason }) => {\n const idp = getIdpUrl()\n const requester = getRequesterIdentity()\n if (!idp || !requester)\n return { content: [{ type: 'text' as const, text: 'Not authenticated. Run `apes login` first.' }] }\n\n const grantsUrl = await getGrantsEndpoint(idp)\n const cmdParts = command.split(' ')\n const grant = await apiFetch<{ id: string, status: string }>(grantsUrl, {\n method: 'POST',\n body: {\n requester,\n target_host: hostname(),\n audience,\n grant_type: approval || 'once',\n command: cmdParts,\n reason: reason || command,\n },\n })\n\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n status: 'pending_approval',\n grant_id: grant.id,\n approve_url: `${idp}/grant-approval?grant_id=${grant.id}`,\n message: 'Grant needs approval. Approve via URL or `apes grants approve <id>`, then retry with grant_id.',\n }, null, 2),\n }],\n }\n })\n\n server.registerTool('apes.config.get', {\n description: 'Get apes configuration value',\n inputSchema: {\n key: z.string().describe('Config key: idp, email'),\n },\n }, ({ key }) => {\n if (key === 'idp') {\n const idp = getIdpUrl()\n return { content: [{ type: 'text' as const, text: idp || 'Not configured' }] }\n }\n if (key === 'email') {\n const email = getRequesterIdentity()\n return { content: [{ type: 'text' as const, text: email || 'Not logged in' }] }\n }\n return { content: [{ type: 'text' as const, text: `Unknown key: ${key}` }] }\n })\n\n server.registerTool('apes.explain', {\n description: 'Show what permissions a command would need',\n inputSchema: {\n command: z.array(z.string()).describe('Command as array of strings (e.g. [\"gh\", \"repo\", \"list\"])'),\n adapter: z.string().optional().describe('Explicit adapter TOML path'),\n },\n }, async ({ command, adapter }) => {\n try {\n const loaded = loadAdapter(command[0]!, adapter)\n const resolved = await resolveCommand(loaded, command)\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n adapter: resolved.adapter.cli.id,\n operation: resolved.detail.operation_id,\n display: resolved.detail.display,\n permission: resolved.permission,\n resource_chain: resolved.detail.resource_chain,\n exact_command: resolved.detail.constraints?.exact_command ?? false,\n adapter_digest: resolved.digest,\n }, null, 2),\n }],\n }\n }\n catch (err) {\n return { content: [{ type: 'text' as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }], isError: true }\n }\n })\n\n server.registerTool('apes.adapter.list', {\n description: 'List installed CLI adapters',\n }, () => {\n const tools = loadAdapterTools()\n const adapters = [...new Set(tools.map(t => t.adapterId))]\n return {\n content: [{\n type: 'text' as const,\n text: adapters.length > 0\n ? `Installed adapters: ${adapters.join(', ')}`\n : 'No adapters installed.',\n }],\n }\n })\n\n server.registerTool('apes.fetch', {\n description: 'Make an authenticated HTTP request',\n inputSchema: {\n method: z.string().describe('HTTP method (GET, POST, PUT, DELETE)'),\n url: z.string().describe('URL to fetch'),\n body: z.string().optional().describe('Request body (JSON string)'),\n },\n }, async ({ method, url, body }) => {\n const token = getAuthToken()\n if (!token)\n return { content: [{ type: 'text' as const, text: 'Not authenticated. Run `apes login` first.' }], isError: true }\n\n const response = await fetch(url, {\n method,\n headers: {\n 'Authorization': `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: body || undefined,\n })\n const text = await response.text()\n try {\n return { content: [{ type: 'text' as const, text: JSON.stringify(JSON.parse(text), null, 2) }] }\n }\n catch {\n return { content: [{ type: 'text' as const, text }] }\n }\n })\n}\n\nexport function registerAdapterTools(server: McpServer) {\n const adapterTools = loadAdapterTools()\n\n for (const tool of adapterTools) {\n // Build Zod schema from adapter operation\n const schemaShape: Record<string, z.ZodType> = {\n grant_id: z.string().optional().describe('Grant ID from a previous pending_approval response'),\n }\n\n if (tool.inputSchema && typeof tool.inputSchema === 'object') {\n const props = (tool.inputSchema as { properties?: Record<string, { description?: string }> }).properties\n if (props) {\n for (const [key, val] of Object.entries(props)) {\n schemaShape[key] = z.string().optional().describe(val.description || key)\n }\n }\n }\n\n server.registerTool(tool.name, {\n description: tool.description,\n inputSchema: schemaShape,\n }, async (args) => {\n const idp = getIdpUrl()\n if (!idp)\n return { content: [{ type: 'text' as const, text: 'Not configured. Run `apes login` first.' }], isError: true }\n\n try {\n const loaded = loadAdapter(tool.adapterId)\n const op = loaded.adapter.operations.find(o => o.id === tool.operationId)\n if (!op)\n return { content: [{ type: 'text' as const, text: `Operation ${tool.operationId} not found` }], isError: true }\n\n const argv = [loaded.adapter.cli.executable, ...op.command]\n if (op.positionals) {\n for (const pos of op.positionals) {\n if (args[pos])\n argv.push(String(args[pos]))\n }\n }\n if (op.required_options) {\n for (const opt of op.required_options) {\n const name = opt.replace(/^--/, '')\n if (args[name])\n argv.push(opt, String(args[name]))\n }\n }\n\n const resolved = await resolveCommand(loaded, argv)\n\n if (args.grant_id) {\n const token = await fetchGrantToken(idp, String(args.grant_id))\n await verifyAndExecute(token, resolved)\n return { content: [{ type: 'text' as const, text: 'Command executed successfully.' }] }\n }\n\n const grant = await createShapesGrant(resolved, { idp, approval: 'once' })\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n status: 'pending_approval',\n grant_id: grant.id,\n approve_url: `${idp}/grant-approval?grant_id=${grant.id}`,\n message: 'Grant needs approval. Approve, then call this tool again with grant_id.',\n }, null, 2),\n }],\n }\n }\n catch (err) {\n return { content: [{ type: 'text' as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }], isError: true }\n }\n })\n }\n}\n","import { readdirSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\nimport { loadAdapter } from '../../shapes/index.js'\nimport type { ShapesOperation } from '../../shapes/index.js'\n\nexport interface AdapterToolDef {\n name: string\n description: string\n inputSchema: Record<string, unknown>\n adapterId: string\n operationId: string\n}\n\nfunction operationToInputSchema(op: ShapesOperation): Record<string, unknown> {\n const properties: Record<string, unknown> = {}\n const required: string[] = []\n\n if (op.positionals) {\n for (const pos of op.positionals) {\n properties[pos] = { type: 'string', description: `Positional argument: ${pos}` }\n required.push(pos)\n }\n }\n\n if (op.required_options) {\n for (const opt of op.required_options) {\n const name = opt.replace(/^--/, '')\n properties[name] = { type: 'string', description: `Required option: ${opt}` }\n required.push(name)\n }\n }\n\n return {\n type: 'object',\n properties,\n required: required.length > 0 ? required : undefined,\n }\n}\n\nfunction scanAdapterDir(dir: string): string[] {\n try {\n return readdirSync(dir)\n .filter(f => f.endsWith('.toml'))\n .map(f => f.replace('.toml', ''))\n }\n catch {\n return []\n }\n}\n\nexport function loadAdapterTools(): AdapterToolDef[] {\n const tools: AdapterToolDef[] = []\n const seen = new Set<string>()\n\n const adapterDirs = [\n join(process.cwd(), '.openape', 'shapes', 'adapters'),\n join(homedir(), '.openape', 'shapes', 'adapters'),\n '/etc/openape/shapes/adapters',\n ]\n\n for (const dir of adapterDirs) {\n for (const id of scanAdapterDir(dir)) {\n if (seen.has(id))\n continue\n seen.add(id)\n\n try {\n const loaded = loadAdapter(id)\n for (const op of loaded.adapter.operations) {\n tools.push({\n name: `apes.run.${id}.${op.id}`,\n description: op.display || `${id}: ${op.id}`,\n inputSchema: operationToInputSchema(op),\n adapterId: id,\n operationId: op.id,\n })\n }\n }\n catch {\n // Skip adapters that fail to load\n }\n }\n }\n\n return tools\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,OAAO,aAAa;;;ACJpB,SAAS,gBAAgB;AASzB,SAAS,SAAS;;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,UAAU,IAAI,WAAW,OAAO;AAC9C,cAAM,eAAe,IAAI,mBAAmB,aAAa,GAAG;AAC5D,cAAM,OAAO,QAAQ,YAAY;AAAA,MACnC,WACS,IAAI,QAAQ,eAAe,IAAI,WAAW,QAAQ;AAEzD,YAAI,UAAU,GAAG;AACjB,YAAI,IAAI;AAAA,MACV,OACK;AACH,YAAI,UAAU,GAAG;AACjB,YAAI,IAAI,WAAW;AAAA,MACrB;AAAA,IACF,CAAC;AAED,eAAW,OAAO,MAAM,MAAM;AAC5B,cAAQ,KAAK,gDAAgD,IAAI,MAAM;AAAA,IACzE,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/commands/mcp/server.ts","../src/commands/mcp/tools.ts","../src/commands/mcp/adapter-tools.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js'\nimport { createServer } from 'node:http'\nimport consola from 'consola'\nimport { registerAdapterTools, registerStaticTools } from './tools'\n\ndeclare const __VERSION__: string\n\nexport async function startMcpServer(transport: 'stdio' | 'sse', port: number) {\n const server = new McpServer({\n name: 'apes',\n version: typeof __VERSION__ !== 'undefined' ? __VERSION__ : '0.1.0',\n })\n\n // Register static tools\n registerStaticTools(server)\n\n // Register adapter-derived tools\n registerAdapterTools(server)\n\n if (transport === 'stdio') {\n const stdioTransport = new StdioServerTransport()\n await server.connect(stdioTransport)\n }\n else if (transport === 'sse') {\n const httpServer = createServer(async (req, res) => {\n if (req.url === '/sse' && req.method === 'GET') {\n const sseTransport = new SSEServerTransport('/messages', res)\n await server.connect(sseTransport)\n }\n else if (req.url === '/messages' && req.method === 'POST') {\n // SSE message handling is done by the transport\n res.writeHead(200)\n res.end()\n }\n else {\n res.writeHead(404)\n res.end('Not found')\n }\n })\n\n httpServer.listen(port, () => {\n consola.info(`MCP SSE server listening on http://localhost:${port}/sse`)\n })\n }\n}\n","import { hostname } from 'node:os'\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport {\n createShapesGrant,\n fetchGrantToken,\n loadAdapter,\n resolveCommand,\n verifyAndExecute,\n} from '../../shapes/index.js'\nimport { z } from 'zod'\nimport { getAuthToken, getIdpUrl, getRequesterIdentity } from '../../config'\nimport { apiFetch, getGrantsEndpoint } from '../../http'\nimport { loadAdapterTools } from './adapter-tools'\n\nexport function registerStaticTools(server: McpServer) {\n server.registerTool('apes.grants.list', {\n description: 'List grants',\n inputSchema: {\n status: z.string().optional().describe('Filter by status: pending, approved, denied, revoked, used'),\n limit: z.string().optional().describe('Max results'),\n },\n }, async ({ status, limit }) => {\n const idp = getIdpUrl()\n if (!idp)\n return { content: [{ type: 'text' as const, text: 'Not configured. Run `apes login` first.' }] }\n\n const grantsUrl = await getGrantsEndpoint(idp)\n const params = new URLSearchParams()\n if (status)\n params.set('status', status)\n if (limit)\n params.set('limit', limit)\n const query = params.toString() ? `?${params.toString()}` : ''\n const response = await apiFetch(`${grantsUrl}${query}`)\n return { content: [{ type: 'text' as const, text: JSON.stringify(response, null, 2) }] }\n })\n\n server.registerTool('apes.grants.request', {\n description: 'Request a grant for a command',\n inputSchema: {\n command: z.string().describe('Command to request permission for'),\n audience: z.string().describe('Service identifier (e.g. escapes, proxy, shapes)'),\n approval: z.string().optional().describe('once, timed, or always'),\n reason: z.string().optional().describe('Reason for the request'),\n },\n }, async ({ command, audience, approval, reason }) => {\n const idp = getIdpUrl()\n const requester = getRequesterIdentity()\n if (!idp || !requester)\n return { content: [{ type: 'text' as const, text: 'Not authenticated. Run `apes login` first.' }] }\n\n const grantsUrl = await getGrantsEndpoint(idp)\n const cmdParts = command.split(' ')\n const grant = await apiFetch<{ id: string, status: string }>(grantsUrl, {\n method: 'POST',\n body: {\n requester,\n target_host: hostname(),\n audience,\n grant_type: approval || 'once',\n command: cmdParts,\n reason: reason || command,\n },\n })\n\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n status: 'pending_approval',\n grant_id: grant.id,\n approve_url: `${idp}/grant-approval?grant_id=${grant.id}`,\n message: 'Grant needs approval. Approve via URL or `apes grants approve <id>`, then retry with grant_id.',\n }, null, 2),\n }],\n }\n })\n\n server.registerTool('apes.config.get', {\n description: 'Get apes configuration value',\n inputSchema: {\n key: z.string().describe('Config key: idp, email'),\n },\n }, ({ key }) => {\n if (key === 'idp') {\n const idp = getIdpUrl()\n return { content: [{ type: 'text' as const, text: idp || 'Not configured' }] }\n }\n if (key === 'email') {\n const email = getRequesterIdentity()\n return { content: [{ type: 'text' as const, text: email || 'Not logged in' }] }\n }\n return { content: [{ type: 'text' as const, text: `Unknown key: ${key}` }] }\n })\n\n server.registerTool('apes.explain', {\n description: 'Show what permissions a command would need',\n inputSchema: {\n command: z.array(z.string()).describe('Command as array of strings (e.g. [\"gh\", \"repo\", \"list\"])'),\n adapter: z.string().optional().describe('Explicit adapter TOML path'),\n },\n }, async ({ command, adapter }) => {\n try {\n const loaded = loadAdapter(command[0]!, adapter)\n const resolved = await resolveCommand(loaded, command)\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n adapter: resolved.adapter.cli.id,\n operation: resolved.detail.operation_id,\n display: resolved.detail.display,\n permission: resolved.permission,\n resource_chain: resolved.detail.resource_chain,\n exact_command: resolved.detail.constraints?.exact_command ?? false,\n adapter_digest: resolved.digest,\n }, null, 2),\n }],\n }\n }\n catch (err) {\n return { content: [{ type: 'text' as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }], isError: true }\n }\n })\n\n server.registerTool('apes.adapter.list', {\n description: 'List installed CLI adapters',\n }, () => {\n const tools = loadAdapterTools()\n const adapters = [...new Set(tools.map(t => t.adapterId))]\n return {\n content: [{\n type: 'text' as const,\n text: adapters.length > 0\n ? `Installed adapters: ${adapters.join(', ')}`\n : 'No adapters installed.',\n }],\n }\n })\n\n server.registerTool('apes.fetch', {\n description: 'Make an authenticated HTTP request',\n inputSchema: {\n method: z.string().describe('HTTP method (GET, POST, PUT, DELETE)'),\n url: z.string().describe('URL to fetch'),\n body: z.string().optional().describe('Request body (JSON string)'),\n },\n }, async ({ method, url, body }) => {\n const token = getAuthToken()\n if (!token)\n return { content: [{ type: 'text' as const, text: 'Not authenticated. Run `apes login` first.' }], isError: true }\n\n const response = await fetch(url, {\n method,\n headers: {\n 'Authorization': `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: body || undefined,\n })\n const text = await response.text()\n try {\n return { content: [{ type: 'text' as const, text: JSON.stringify(JSON.parse(text), null, 2) }] }\n }\n catch {\n return { content: [{ type: 'text' as const, text }] }\n }\n })\n}\n\nexport function registerAdapterTools(server: McpServer) {\n const adapterTools = loadAdapterTools()\n\n for (const tool of adapterTools) {\n // Build Zod schema from adapter operation\n const schemaShape: Record<string, z.ZodType> = {\n grant_id: z.string().optional().describe('Grant ID from a previous pending_approval response'),\n }\n\n if (tool.inputSchema && typeof tool.inputSchema === 'object') {\n const props = (tool.inputSchema as { properties?: Record<string, { description?: string }> }).properties\n if (props) {\n for (const [key, val] of Object.entries(props)) {\n schemaShape[key] = z.string().optional().describe(val.description || key)\n }\n }\n }\n\n server.registerTool(tool.name, {\n description: tool.description,\n inputSchema: schemaShape,\n }, async (args) => {\n const idp = getIdpUrl()\n if (!idp)\n return { content: [{ type: 'text' as const, text: 'Not configured. Run `apes login` first.' }], isError: true }\n\n try {\n const loaded = loadAdapter(tool.adapterId)\n const op = loaded.adapter.operations.find(o => o.id === tool.operationId)\n if (!op)\n return { content: [{ type: 'text' as const, text: `Operation ${tool.operationId} not found` }], isError: true }\n\n const argv = [loaded.adapter.cli.executable, ...op.command]\n if (op.positionals) {\n for (const pos of op.positionals) {\n if (args[pos])\n argv.push(String(args[pos]))\n }\n }\n if (op.required_options) {\n for (const opt of op.required_options) {\n const name = opt.replace(/^--/, '')\n if (args[name])\n argv.push(opt, String(args[name]))\n }\n }\n\n const resolved = await resolveCommand(loaded, argv)\n\n if (args.grant_id) {\n const token = await fetchGrantToken(idp, String(args.grant_id))\n await verifyAndExecute(token, resolved)\n return { content: [{ type: 'text' as const, text: 'Command executed successfully.' }] }\n }\n\n const grant = await createShapesGrant(resolved, { idp, approval: 'once' })\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n status: 'pending_approval',\n grant_id: grant.id,\n approve_url: `${idp}/grant-approval?grant_id=${grant.id}`,\n message: 'Grant needs approval. Approve, then call this tool again with grant_id.',\n }, null, 2),\n }],\n }\n }\n catch (err) {\n return { content: [{ type: 'text' as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }], isError: true }\n }\n })\n }\n}\n","import { readdirSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\nimport { loadAdapter } from '../../shapes/index.js'\nimport type { ShapesOperation } from '../../shapes/index.js'\n\nexport interface AdapterToolDef {\n name: string\n description: string\n inputSchema: Record<string, unknown>\n adapterId: string\n operationId: string\n}\n\nfunction operationToInputSchema(op: ShapesOperation): Record<string, unknown> {\n const properties: Record<string, unknown> = {}\n const required: string[] = []\n\n if (op.positionals) {\n for (const pos of op.positionals) {\n properties[pos] = { type: 'string', description: `Positional argument: ${pos}` }\n required.push(pos)\n }\n }\n\n if (op.required_options) {\n for (const opt of op.required_options) {\n const name = opt.replace(/^--/, '')\n properties[name] = { type: 'string', description: `Required option: ${opt}` }\n required.push(name)\n }\n }\n\n return {\n type: 'object',\n properties,\n required: required.length > 0 ? required : undefined,\n }\n}\n\nfunction scanAdapterDir(dir: string): string[] {\n try {\n return readdirSync(dir)\n .filter(f => f.endsWith('.toml'))\n .map(f => f.replace('.toml', ''))\n }\n catch {\n return []\n }\n}\n\nexport function loadAdapterTools(): AdapterToolDef[] {\n const tools: AdapterToolDef[] = []\n const seen = new Set<string>()\n\n const adapterDirs = [\n join(process.cwd(), '.openape', 'shapes', 'adapters'),\n join(homedir(), '.openape', 'shapes', 'adapters'),\n '/etc/openape/shapes/adapters',\n ]\n\n for (const dir of adapterDirs) {\n for (const id of scanAdapterDir(dir)) {\n if (seen.has(id))\n continue\n seen.add(id)\n\n try {\n const loaded = loadAdapter(id)\n for (const op of loaded.adapter.operations) {\n tools.push({\n name: `apes.run.${id}.${op.id}`,\n description: op.display || `${id}: ${op.id}`,\n inputSchema: operationToInputSchema(op),\n adapterId: id,\n operationId: op.id,\n })\n }\n }\n catch {\n // Skip adapters that fail to load\n }\n }\n }\n\n return tools\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,OAAO,aAAa;;;ACJpB,SAAS,gBAAgB;AASzB,SAAS,SAAS;;;ACTlB,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,YAAY;AAYrB,SAAS,uBAAuB,IAA8C;AAC5E,QAAM,aAAsC,CAAC;AAC7C,QAAM,WAAqB,CAAC;AAE5B,MAAI,GAAG,aAAa;AAClB,eAAW,OAAO,GAAG,aAAa;AAChC,iBAAW,GAAG,IAAI,EAAE,MAAM,UAAU,aAAa,wBAAwB,GAAG,GAAG;AAC/E,eAAS,KAAK,GAAG;AAAA,IACnB;AAAA,EACF;AAEA,MAAI,GAAG,kBAAkB;AACvB,eAAW,OAAO,GAAG,kBAAkB;AACrC,YAAM,OAAO,IAAI,QAAQ,OAAO,EAAE;AAClC,iBAAW,IAAI,IAAI,EAAE,MAAM,UAAU,aAAa,oBAAoB,GAAG,GAAG;AAC5E,eAAS,KAAK,IAAI;AAAA,IACpB;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA,UAAU,SAAS,SAAS,IAAI,WAAW;AAAA,EAC7C;AACF;AAEA,SAAS,eAAe,KAAuB;AAC7C,MAAI;AACF,WAAO,YAAY,GAAG,EACnB,OAAO,OAAK,EAAE,SAAS,OAAO,CAAC,EAC/B,IAAI,OAAK,EAAE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AAI,UAAU,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,KAAK;AAAA,MACnI;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;AD1OA,eAAsB,eAAe,WAA4B,MAAc;AAC7E,QAAM,SAAS,IAAI,UAAU;AAAA,IAC3B,MAAM;AAAA,IACN,SAAS,OAAqC,UAAc;AAAA,EAC9D,CAAC;AAGD,sBAAoB,MAAM;AAG1B,uBAAqB,MAAM;AAE3B,MAAI,cAAc,SAAS;AACzB,UAAM,iBAAiB,IAAI,qBAAqB;AAChD,UAAM,OAAO,QAAQ,cAAc;AAAA,EACrC,WACS,cAAc,OAAO;AAC5B,UAAM,aAAa,aAAa,OAAO,KAAK,QAAQ;AAClD,UAAI,IAAI,QAAQ,UAAU,IAAI,WAAW,OAAO;AAC9C,cAAM,eAAe,IAAI,mBAAmB,aAAa,GAAG;AAC5D,cAAM,OAAO,QAAQ,YAAY;AAAA,MACnC,WACS,IAAI,QAAQ,eAAe,IAAI,WAAW,QAAQ;AAEzD,YAAI,UAAU,GAAG;AACjB,YAAI,IAAI;AAAA,MACV,OACK;AACH,YAAI,UAAU,GAAG;AACjB,YAAI,IAAI,WAAW;AAAA,MACrB;AAAA,IACF,CAAC;AAED,eAAW,OAAO,MAAM,MAAM;AAC5B,cAAQ,KAAK,gDAAgD,IAAI,MAAM;AAAA,IACzE,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
loadEd25519PrivateKey,
|
|
4
4
|
readPublicKeyComment
|
|
5
5
|
} from "./chunk-ION3CWD5.js";
|
|
6
|
+
import "./chunk-7OCVIDC7.js";
|
|
6
7
|
export {
|
|
7
8
|
loadEd25519PrivateKey,
|
|
8
9
|
readPublicKeyComment
|
|
9
10
|
};
|
|
10
|
-
//# sourceMappingURL=ssh-key-
|
|
11
|
+
//# sourceMappingURL=ssh-key-6X3YZXSD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|