(inputs: SystemInitInputs)
| 51 | * QueryEngine SDKMessage layer |
| 52 | */ |
| 53 | export function buildSystemInitMessage(inputs: SystemInitInputs): SDKMessage { |
| 54 | const settings = getSettings_DEPRECATED() |
| 55 | const outputStyle = settings?.outputStyle ?? DEFAULT_OUTPUT_STYLE_NAME |
| 56 | |
| 57 | const initMessage: SDKMessage = { |
| 58 | type: 'system', |
| 59 | subtype: 'init', |
| 60 | cwd: getCwd(), |
| 61 | session_id: getSessionId(), |
| 62 | tools: inputs.tools.map(tool => sdkCompatToolName(tool.name)), |
| 63 | mcp_servers: inputs.mcpClients.map(client => ({ |
| 64 | name: client.name, |
| 65 | status: client.type, |
| 66 | })), |
| 67 | model: inputs.model, |
| 68 | permissionMode: inputs.permissionMode, |
| 69 | slash_commands: inputs.commands |
| 70 | .filter(c => c.userInvocable !== false) |
| 71 | .map(c => c.name), |
| 72 | apiKeySource: getAnthropicApiKeyWithSource().source as ApiKeySource, |
| 73 | betas: getSdkBetas(), |
| 74 | claude_code_version: MACRO.VERSION, |
| 75 | output_style: outputStyle, |
| 76 | agents: inputs.agents.map(agent => agent.agentType), |
| 77 | skills: inputs.skills |
| 78 | .filter(s => s.userInvocable !== false) |
| 79 | .map(skill => skill.name), |
| 80 | plugins: inputs.plugins.map(plugin => ({ |
| 81 | name: plugin.name, |
| 82 | path: plugin.path, |
| 83 | source: plugin.source, |
| 84 | })), |
| 85 | uuid: randomUUID(), |
| 86 | } |
| 87 | // Hidden from public SDK types — ant-only UDS messaging socket path |
| 88 | if (feature('UDS_INBOX')) { |
| 89 | /* eslint-disable @typescript-eslint/no-require-imports */ |
| 90 | ;(initMessage as Record<string, unknown>).messaging_socket_path = |
| 91 | require('../udsMessaging.js').getUdsMessagingSocketPath() |
| 92 | /* eslint-enable @typescript-eslint/no-require-imports */ |
| 93 | } |
| 94 | initMessage.fast_mode_state = getFastModeState(inputs.model, inputs.fastMode) |
| 95 | return initMessage |
| 96 | } |
| 97 |
no test coverage detected