Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
'use strict';
const { schemaToJson } = require('./schema-to-json.cjs');
const { projectToolInput } = require('./tool-input-compat.cjs');
/** Unknown envelope fields are ignored; declared fields retain Zod validation. */
exports.bridgeToolInput = (z, description, shape, handler, compatibilityFields = []) => {
const fields = [...Object.keys(shape), ...compatibilityFields];
const inputSchema = z.object(shape).passthrough();
let inputJson;
let outputJson;
// SDK v2 consumes Standard Schema. Keep discovery's optional defaults and
// preferred numeric bounds aligned with the existing execution contract.
inputSchema['~standard'] = {
...inputSchema['~standard'],
jsonSchema: {
input: () => inputJson ||= schemaToJson(inputSchema),
output: () => outputJson ||= schemaToJson(inputSchema),
},
};
return [{
description,
inputSchema,
}, async (input, extra) => {
const { input: effective, receipt } = projectToolInput(input, fields);
let result;
try { result = await handler(effective, extra); }
catch (error) {
// Match the MCP server's existing thrown-error envelope.
result = { content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }], isError: true };
}
if (!receipt) return result;
return { ...result, content: [...(result.content || []), { type: 'text', text: JSON.stringify(receipt) }] };
}];
};