@mastra/code-sdk 1.15.1-alpha.3 → 1.15.1-alpha.5

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.
Files changed (208) hide show
  1. package/dist/acp/agent.js +1 -2
  2. package/dist/acp/errors.js +1 -2
  3. package/dist/acp/event-mapper.js +1 -2
  4. package/dist/acp/index.js +1 -2
  5. package/dist/acp/runtime.js +1 -2
  6. package/dist/acp/server.js +1 -2
  7. package/dist/acp/skills.js +1 -2
  8. package/dist/agent-connections/messaging-processor.js +1 -2
  9. package/dist/agent-connections/ownership.js +1 -2
  10. package/dist/agent-connections/registry.js +1 -2
  11. package/dist/agent-connections/session-advertisement.js +1 -2
  12. package/dist/agent-connections/signal-provider.js +1 -2
  13. package/dist/agent-connections/state-processor.js +1 -2
  14. package/dist/agent-connections/thread-state.js +1 -2
  15. package/dist/agent-connections/tools.js +1 -2
  16. package/dist/agent-connections/types.js +1 -2
  17. package/dist/agent-connections/untrusted-text.js +1 -2
  18. package/dist/agents/background-completion-events.js +1 -2
  19. package/dist/agents/background-completion.js +1 -2
  20. package/dist/agents/context-audit.js +1 -2
  21. package/dist/agents/credential-resolver.js +1 -2
  22. package/dist/agents/custom-provider-source.js +1 -2
  23. package/dist/agents/instructions.js +1 -2
  24. package/dist/agents/mastracode-gateway.d.ts.map +1 -1
  25. package/dist/agents/mastracode-gateway.js +6 -5
  26. package/dist/agents/mastracode-gateway.js.map +1 -1
  27. package/dist/agents/memory.js +1 -2
  28. package/dist/agents/model.js +1 -2
  29. package/dist/agents/modes/build.js +1 -2
  30. package/dist/agents/modes/explore.js +1 -2
  31. package/dist/agents/modes/plan.js +1 -2
  32. package/dist/agents/prompts/agent-instructions.js +1 -2
  33. package/dist/agents/prompts/build.js +1 -2
  34. package/dist/agents/prompts/fast.js +1 -2
  35. package/dist/agents/prompts/index.js +1 -2
  36. package/dist/agents/prompts/model.js +1 -2
  37. package/dist/agents/prompts/plan.js +1 -2
  38. package/dist/agents/prompts/tool-guidance.js +1 -2
  39. package/dist/agents/sandbox-filesystem.d.ts.map +1 -1
  40. package/dist/agents/sandbox-filesystem.js +9 -7
  41. package/dist/agents/sandbox-filesystem.js.map +1 -1
  42. package/dist/agents/subagents/execute.js +1 -2
  43. package/dist/agents/subagents/explore.js +1 -2
  44. package/dist/agents/subagents/plan.js +1 -2
  45. package/dist/agents/thread-caveman-state.js +1 -2
  46. package/dist/agents/tool-availability.js +1 -2
  47. package/dist/agents/tools.js +1 -2
  48. package/dist/agents/workflow-builder-agent.js +1 -2
  49. package/dist/agents/workspace.js +1 -2
  50. package/dist/analytics.js +1 -2
  51. package/dist/auth/account-rotation-processor.js +1 -2
  52. package/dist/auth/account-routing-context.js +1 -2
  53. package/dist/auth/authorization-input.js +1 -2
  54. package/dist/auth/device-code.js +1 -2
  55. package/dist/auth/pkce.js +1 -2
  56. package/dist/auth/provider-auth-error.d.ts +2 -0
  57. package/dist/auth/provider-auth-error.d.ts.map +1 -1
  58. package/dist/auth/provider-auth-error.js +8 -3
  59. package/dist/auth/provider-auth-error.js.map +1 -1
  60. package/dist/auth/providers/anthropic.js +1 -2
  61. package/dist/auth/providers/github-copilot.js +1 -2
  62. package/dist/auth/providers/kimi-coding.js +1 -2
  63. package/dist/auth/providers/openai-codex.js +1 -2
  64. package/dist/auth/providers/xai.js +1 -2
  65. package/dist/auth/storage.js +1 -2
  66. package/dist/clipboard/index.js +1 -2
  67. package/dist/constants.js +1 -2
  68. package/dist/error-classification.js +1 -2
  69. package/dist/evals/context-builder.js +1 -2
  70. package/dist/evals/scorers/classify-command.d.ts +1 -2
  71. package/dist/evals/scorers/classify-command.d.ts.map +1 -1
  72. package/dist/evals/scorers/classify-command.js +7 -17
  73. package/dist/evals/scorers/classify-command.js.map +1 -1
  74. package/dist/evals/scorers/efficiency.js +1 -2
  75. package/dist/evals/scorers/extract-tools.js +1 -2
  76. package/dist/evals/scorers/outcome.d.ts.map +1 -1
  77. package/dist/evals/scorers/outcome.js +36 -22
  78. package/dist/evals/scorers/outcome.js.map +1 -1
  79. package/dist/experimental-agent.js +1 -2
  80. package/dist/factory/client.js +1 -2
  81. package/dist/factory/remote-controller.js +1 -2
  82. package/dist/factory/remote-session.js +1 -2
  83. package/dist/goal-manager.js +1 -2
  84. package/dist/goal-signal.js +1 -2
  85. package/dist/headless/cli.js +1 -2
  86. package/dist/headless/flags.js +1 -2
  87. package/dist/headless/format.js +1 -2
  88. package/dist/headless/policy.js +1 -2
  89. package/dist/headless/run-mc.js +1 -2
  90. package/dist/headless/types.js +1 -2
  91. package/dist/hooks/config.js +1 -2
  92. package/dist/hooks/executor.js +1 -2
  93. package/dist/hooks/manager.js +1 -2
  94. package/dist/hooks/types.js +1 -2
  95. package/dist/index.js +1 -2
  96. package/dist/ipc/ipc-reporter.js +1 -2
  97. package/dist/knowledge-inspector.js +1 -2
  98. package/dist/knowledge-scope.js +1 -2
  99. package/dist/lsp/client.d.ts.map +1 -1
  100. package/dist/lsp/client.js +1 -2
  101. package/dist/lsp/client.js.map +1 -1
  102. package/dist/lsp/language.js +1 -2
  103. package/dist/lsp/manager.js +1 -2
  104. package/dist/lsp/server.js +1 -2
  105. package/dist/lsp/workspace.js +1 -2
  106. package/dist/mcp/config.js +1 -2
  107. package/dist/mcp/manager.js +1 -2
  108. package/dist/mcp/state.js +1 -2
  109. package/dist/onboarding/custom-packs.js +1 -2
  110. package/dist/onboarding/custom-providers.js +1 -2
  111. package/dist/onboarding/om-settings.js +1 -2
  112. package/dist/onboarding/pack-activation.js +1 -2
  113. package/dist/onboarding/packs.js +1 -2
  114. package/dist/onboarding/settings.js +1 -2
  115. package/dist/permissions.js +1 -2
  116. package/dist/platform/index.js +1 -2
  117. package/dist/plugin.js +1 -2
  118. package/dist/plugins/dependencies.js +1 -2
  119. package/dist/plugins/install.js +1 -2
  120. package/dist/plugins/loader.js +1 -2
  121. package/dist/plugins/manager.js +1 -2
  122. package/dist/plugins/manifest.js +1 -2
  123. package/dist/plugins/package-link.js +1 -2
  124. package/dist/plugins/paths.js +1 -2
  125. package/dist/plugins/registry.js +1 -2
  126. package/dist/plugins/scaffold.js +1 -2
  127. package/dist/plugins/signal-lane.js +1 -2
  128. package/dist/process-memory-diagnostics.js +1 -2
  129. package/dist/processors/plan-rejection-abort.js +1 -2
  130. package/dist/providers/amazon-bedrock-gateway.js +1 -2
  131. package/dist/providers/amazon-bedrock.js +1 -2
  132. package/dist/providers/anthropic-prompt-cache.js +1 -2
  133. package/dist/providers/anthropic-thinking.js +1 -2
  134. package/dist/providers/claude-max.d.ts.map +1 -1
  135. package/dist/providers/claude-max.js +4 -4
  136. package/dist/providers/claude-max.js.map +1 -1
  137. package/dist/providers/github-copilot-gateway.js +1 -2
  138. package/dist/providers/github-copilot.d.ts.map +1 -1
  139. package/dist/providers/github-copilot.js +5 -5
  140. package/dist/providers/github-copilot.js.map +1 -1
  141. package/dist/providers/google-thinking.js +1 -2
  142. package/dist/providers/kimi-coding.d.ts.map +1 -1
  143. package/dist/providers/kimi-coding.js +8 -7
  144. package/dist/providers/kimi-coding.js.map +1 -1
  145. package/dist/providers/model-ids.js +1 -2
  146. package/dist/providers/openai-codex.d.ts +15 -0
  147. package/dist/providers/openai-codex.d.ts.map +1 -1
  148. package/dist/providers/openai-codex.js +50 -11
  149. package/dist/providers/openai-codex.js.map +1 -1
  150. package/dist/providers/provider-thinking.js +1 -2
  151. package/dist/providers/thinking-request.js +1 -2
  152. package/dist/providers/xai.d.ts.map +1 -1
  153. package/dist/providers/xai.js +5 -5
  154. package/dist/providers/xai.js.map +1 -1
  155. package/dist/schedules/interval.js +1 -2
  156. package/dist/schedules/prompt.js +1 -2
  157. package/dist/schedules/run-script.js +1 -2
  158. package/dist/schedules/scheduler.js +1 -2
  159. package/dist/schedules/tools.js +1 -2
  160. package/dist/schema.js +1 -2
  161. package/dist/theme-palette.js +1 -2
  162. package/dist/thinking-catalog.js +1 -2
  163. package/dist/thinking.js +1 -2
  164. package/dist/tool-names.js +1 -2
  165. package/dist/tools/request-sandbox-access.js +1 -2
  166. package/dist/tools/utils.js +1 -2
  167. package/dist/tools/web-search.js +1 -2
  168. package/dist/tools/workflows/create-workflow.js +1 -2
  169. package/dist/tools/workflows/delete-workflow.js +1 -2
  170. package/dist/tools/workflows/ephemeral-memory.js +1 -2
  171. package/dist/tools/workflows/extract-json-schema.js +1 -2
  172. package/dist/tools/workflows/get-workflow.js +1 -2
  173. package/dist/tools/workflows/list-available-agents.js +1 -2
  174. package/dist/tools/workflows/list-available-classifiers.js +1 -2
  175. package/dist/tools/workflows/list-available-tools.js +1 -2
  176. package/dist/tools/workflows/list-available-workflows.js +1 -2
  177. package/dist/tools/workflows/list-workflows.js +1 -2
  178. package/dist/tools/workflows/run-workflow.js +1 -2
  179. package/dist/tools/workflows/save-workflow.js +1 -2
  180. package/dist/tools/workflows/tool-ids.js +1 -2
  181. package/dist/utils/binaries.js +1 -2
  182. package/dist/utils/debug-log.js +1 -2
  183. package/dist/utils/discarding-scores-storage.js +1 -2
  184. package/dist/utils/errors.js +1 -2
  185. package/dist/utils/gateway-sync.js +1 -2
  186. package/dist/utils/local-observability.js +1 -2
  187. package/dist/utils/maintenance-lock.js +1 -2
  188. package/dist/utils/notification-dispatch.js +1 -2
  189. package/dist/utils/open-url.js +1 -2
  190. package/dist/utils/path-security.js +1 -2
  191. package/dist/utils/plan-diff.js +1 -2
  192. package/dist/utils/plans.js +1 -2
  193. package/dist/utils/project.js +1 -2
  194. package/dist/utils/prune-cli.js +1 -2
  195. package/dist/utils/signals-pubsub.js +1 -2
  196. package/dist/utils/slash-command-loader.js +1 -2
  197. package/dist/utils/slash-command-processor.js +1 -2
  198. package/dist/utils/stdin-pipe.js +1 -2
  199. package/dist/utils/storage-factory.js +1 -2
  200. package/dist/utils/storage-maintenance.js +1 -2
  201. package/dist/utils/thread-lock.js +1 -2
  202. package/dist/utils/token-estimator.js +1 -2
  203. package/dist/utils/update-check.js +1 -2
  204. package/dist/utils/wake-session.js +1 -2
  205. package/dist/voice/stt-registry.js +1 -2
  206. package/dist/workflows/register-primitives.js +1 -2
  207. package/dist/workflows/service.js +1 -2
  208. package/package.json +36 -32
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":[],"sources":["../../src/lsp/client.ts"],"sourcesContent":["import type { ChildProcess } from 'node:child_process';\nimport { StreamMessageReader, StreamMessageWriter, createMessageConnection } from 'vscode-jsonrpc/node.js';\nimport type { MessageConnection } from 'vscode-jsonrpc/node.js';\nimport { TextDocumentIdentifier, Position } from 'vscode-languageserver-protocol';\nimport type { Diagnostic } from 'vscode-languageserver-protocol';\nimport type { LSPServerInfo } from './server.js';\n\n/**\n * LSP Client wrapper for JSON-RPC communication\n */\nexport class LSPClient {\n private connection: MessageConnection | null = null;\n private process: ChildProcess | null = null;\n private serverInfo: LSPServerInfo;\n private workspaceRoot: string;\n private diagnostics: Map<string, Diagnostic[]> = new Map();\n private initializationOptions: any = null;\n\n constructor(serverInfo: LSPServerInfo, workspaceRoot: string) {\n this.serverInfo = serverInfo;\n this.workspaceRoot = workspaceRoot;\n }\n\n /**\n * Initialize the LSP connection\n */\n async initialize(): Promise<void> {\n const spawnResult = await this.serverInfo.spawn(this.workspaceRoot);\n\n if (!spawnResult) {\n throw new Error('Failed to spawn LSP server');\n }\n\n // Handle both ChildProcess and { process: ChildProcess, initialization? } formats\n let initializationOptions: any = undefined;\n if ('process' in spawnResult) {\n this.process = spawnResult.process;\n initializationOptions = spawnResult.initialization;\n } else {\n this.process = spawnResult;\n }\n\n if (!this.process.stdin || !this.process.stdout) {\n throw new Error('Failed to create LSP process with proper stdio');\n }\n\n const reader = new StreamMessageReader(this.process.stdout);\n const writer = new StreamMessageWriter(this.process.stdin);\n this.connection = createMessageConnection(reader, writer);\n\n // Handle connection errors (e.g., ERR_STREAM_DESTROYED during shutdown)\n this.connection.onError(error => {\n // Silently ignore stream destroyed errors during shutdown\n const errorObj = error?.[0] as any;\n if (errorObj?.code !== 'ERR_STREAM_DESTROYED') {\n }\n });\n\n // Set up diagnostic listener before starting connection\n\n this.connection.onNotification('textDocument/publishDiagnostics', (params: any) => {\n if (params.diagnostics && params.diagnostics.length > 0) {\n }\n this.diagnostics.set(params.uri, params.diagnostics);\n });\n (this.connection as any).onNotification((_method: string, _params: any) => {});\n\n this.connection.listen();\n\n // Capture stderr for debugging\n if (this.process.stderr) {\n this.process.stderr.on('data', _data => {});\n }\n\n // Handle process errors\n this.process.on('error', _error => {});\n\n this.process.on('exit', (_code, _signal) => {});\n\n // Send initialize request matching OpenCode's structure\n const initParams: any = {\n processId: process.pid,\n rootUri: `file://${this.workspaceRoot}`,\n workspaceFolders: [\n {\n name: 'workspace',\n uri: `file://${this.workspaceRoot}`,\n },\n ],\n capabilities: {\n window: {\n workDoneProgress: true,\n },\n workspace: {\n configuration: true,\n },\n textDocument: {\n publishDiagnostics: {\n relatedInformation: true,\n tagSupport: {\n valueSet: [1, 2],\n },\n versionSupport: false,\n },\n synchronization: {\n didOpen: true,\n didChange: true,\n dynamicRegistration: false,\n willSave: false,\n willSaveWaitUntil: false,\n didSave: false,\n },\n completion: {\n dynamicRegistration: false,\n completionItem: {\n snippetSupport: false,\n commitCharactersSupport: false,\n documentationFormat: ['markdown', 'plaintext'],\n deprecatedSupport: false,\n preselectSupport: false,\n },\n },\n definition: {\n dynamicRegistration: false,\n linkSupport: true,\n },\n typeDefinition: {\n dynamicRegistration: false,\n linkSupport: true,\n },\n implementation: {\n dynamicRegistration: false,\n linkSupport: true,\n },\n references: {\n dynamicRegistration: false,\n },\n documentHighlight: {\n dynamicRegistration: false,\n },\n documentSymbol: {\n dynamicRegistration: false,\n hierarchicalDocumentSymbolSupport: true,\n },\n codeAction: {\n dynamicRegistration: false,\n codeActionLiteralSupport: {\n codeActionKind: {\n valueSet: [\n 'quickfix',\n 'refactor',\n 'refactor.extract',\n 'refactor.inline',\n 'refactor.rewrite',\n 'source',\n 'source.organizeImports',\n ],\n },\n },\n },\n hover: {\n dynamicRegistration: false,\n contentFormat: ['markdown', 'plaintext'],\n },\n },\n },\n };\n\n // Add initialization options if provided by the server\n if (initializationOptions) {\n initParams.initializationOptions = initializationOptions;\n this.initializationOptions = initializationOptions;\n }\n\n // Add workspace/configuration request handler like OpenCode\n this.connection.onRequest('workspace/configuration', (params: any) => {\n return params.items?.map(() => ({})) || [];\n });\n\n // Handle window/workDoneProgress/create requests\n this.connection.onRequest('window/workDoneProgress/create', (_params: any) => {\n return null;\n });\n\n await Promise.race([\n this.connection.sendRequest('initialize', initParams),\n new Promise((_, reject) => setTimeout(() => reject(new Error('LSP initialize request timed out')), 10000)),\n ]);\n\n // Send initialized notification with empty object like OpenCode\n this.connection.sendNotification('initialized', {});\n\n // Send workspace/didChangeConfiguration with initialization options like OpenCode\n if (this.initializationOptions) {\n this.connection.sendNotification('workspace/didChangeConfiguration', {\n settings: this.initializationOptions,\n });\n } else {\n this.connection.sendNotification('workspace/didChangeConfiguration', {\n settings: {},\n });\n }\n }\n\n /**\n * Notify the server that a document has been opened\n */\n notifyOpen(filePath: string, content: string, languageId: string): void {\n if (!this.connection) return;\n\n const uri = `file://${filePath}`;\n\n // Clear diagnostics for this file before sending didOpen (like OpenCode does)\n this.diagnostics.delete(uri);\n\n this.connection.sendNotification('textDocument/didOpen', {\n textDocument: {\n uri,\n languageId,\n version: 0,\n text: content,\n },\n });\n }\n\n /**\n * Notify the server that a document has changed\n */\n notifyChange(filePath: string, content: string, version: number): void {\n if (!this.connection) return;\n\n this.connection.sendNotification('textDocument/didChange', {\n textDocument: {\n uri: `file://${filePath}`,\n version,\n },\n contentChanges: [{ text: content }],\n });\n }\n\n /**\n * Wait for diagnostics to be available for a specific file\n * @param waitForChange If true, waits for diagnostics to change from their initial state\n */\n async waitForDiagnostics(\n filePath: string,\n timeoutMs: number = 5000,\n waitForChange: boolean = false,\n ): Promise<Diagnostic[]> {\n if (!this.connection) return [];\n\n const uri = `file://${filePath}`;\n const startTime = Date.now();\n const initialDiagnostics = this.diagnostics.get(uri);\n const initialCount = initialDiagnostics?.length || 0;\n\n // Poll for diagnostics to be updated\n while (Date.now() - startTime < timeoutMs) {\n const currentDiagnostics = this.diagnostics.get(uri);\n const currentCount = currentDiagnostics?.length || 0;\n\n // If waiting for change, check if diagnostics have changed\n if (waitForChange) {\n if (currentDiagnostics !== undefined && currentCount !== initialCount) {\n return currentDiagnostics;\n }\n } else {\n // Return if we have diagnostics (even if empty array)\n if (currentDiagnostics !== undefined) {\n return currentDiagnostics;\n }\n }\n\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n\n return waitForChange ? initialDiagnostics || [] : [];\n }\n\n /**\n * Get hover information for a position\n */\n async getHover(filePath: string, line: number, character: number): Promise<any> {\n if (!this.connection) return null;\n\n try {\n return await this.connection.sendRequest('textDocument/hover', {\n textDocument: TextDocumentIdentifier.create(`file://${filePath}`),\n position: Position.create(line, character),\n });\n } catch {\n return null;\n }\n }\n\n /**\n * Get diagnostics for a specific file\n */\n getDiagnostics(filePath: string): Diagnostic[] {\n const uri = `file://${filePath}`;\n return this.diagnostics.get(uri) || [];\n }\n\n /**\n * Get all diagnostics from all files\n */\n getAllDiagnostics(): Diagnostic[] {\n const allDiagnostics: Diagnostic[] = [];\n for (const diagnostics of this.diagnostics.values()) {\n allDiagnostics.push(...diagnostics);\n }\n return allDiagnostics;\n }\n\n /**\n * Notify server that a file was closed\n */\n notifyClose(filePath: string): void {\n if (!this.connection) return;\n\n const uri = `file://${filePath}`;\n\n // Clear diagnostics for this file\n this.diagnostics.delete(uri);\n\n // Send didClose notification\n this.connection.sendNotification('textDocument/didClose', {\n textDocument: TextDocumentIdentifier.create(uri),\n });\n }\n\n /**\n * Restart the LSP client\n */\n async restart(): Promise<void> {\n await this.shutdown();\n\n // Re-initialize (this will re-spawn the server)\n await this.initialize();\n }\n\n /**\n * Shutdown the connection\n */\n async shutdown(): Promise<void> {\n if (this.connection) {\n try {\n // Only send shutdown request if the process is still alive\n const processAlive = this.process && !this.process.killed;\n if (processAlive) {\n await Promise.race([\n this.connection.sendRequest('shutdown'),\n new Promise((_, reject) => setTimeout(() => reject(new Error('Shutdown request timed out')), 1000)),\n ]);\n this.connection.sendNotification('exit');\n }\n } catch {\n // Ignore shutdown errors (process may have already crashed)\n }\n try {\n this.connection.dispose();\n } catch {\n // Ignore dispose errors (stream may already be destroyed)\n }\n this.connection = null;\n }\n\n if (this.process) {\n try {\n if (!this.process.killed) {\n this.process.kill();\n }\n } catch {\n // Ignore kill errors\n }\n this.process = null;\n }\n\n this.diagnostics = new Map();\n }\n}\n"],"mappings":";;;;;;AAUA,IAAa,YAAb,MAAuB;CACrB,aAA+C;CAC/C,UAAuC;CACvC;CACA;CACA,8BAAiD,IAAI,IAAI;CACzD,wBAAqC;CAErC,YAAY,YAA2B,eAAuB;EAC5D,KAAK,aAAa;EAClB,KAAK,gBAAgB;CACvB;;;;CAKA,MAAM,aAA4B;EAChC,MAAM,cAAc,MAAM,KAAK,WAAW,MAAM,KAAK,aAAa;EAElE,IAAI,CAAC,aACH,MAAM,IAAI,MAAM,4BAA4B;EAI9C,IAAI,wBAA6B,KAAA;EACjC,IAAI,aAAa,aAAa;GAC5B,KAAK,UAAU,YAAY;GAC3B,wBAAwB,YAAY;EACtC,OACE,KAAK,UAAU;EAGjB,IAAI,CAAC,KAAK,QAAQ,SAAS,CAAC,KAAK,QAAQ,QACvC,MAAM,IAAI,MAAM,gDAAgD;EAGlE,MAAM,SAAS,IAAI,oBAAoB,KAAK,QAAQ,MAAM;EAC1D,MAAM,SAAS,IAAI,oBAAoB,KAAK,QAAQ,KAAK;EACzD,KAAK,aAAa,wBAAwB,QAAQ,MAAM;EAGxD,KAAK,WAAW,SAAQ,UAAS;GAG/B,KADiB,QAAQ,GAAA,EACX,SAAS,wBAAwB,CAC/C;EACF,CAAC;EAID,KAAK,WAAW,eAAe,oCAAoC,WAAgB;GACjF,IAAI,OAAO,eAAe,OAAO,YAAY,SAAS,GAAG,CACzD;GACA,KAAK,YAAY,IAAI,OAAO,KAAK,OAAO,WAAW;EACrD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,CAAC,KAAK,QAAQ,QACjC;KAChB,MAAM,QAAQ,KAAK,CACjB,KAAK,WAAW,YAAY,UAAU,GACtC,IAAI,SAAS,GAAG,WAAW,iBAAiB,uBAAO,IAAI,MAAM,4BAA4B,CAAC,GAAG,GAAI,CAAC,CACpG,CAAC;KACD,KAAK,WAAW,iBAAiB,MAAM;IACzC;GACF,QAAQ,CAER;GACA,IAAI;IACF,KAAK,WAAW,QAAQ;GAC1B,QAAQ,CAER;GACA,KAAK,aAAa;EACpB;EAEA,IAAI,KAAK,SAAS;GAChB,IAAI;IACF,IAAI,CAAC,KAAK,QAAQ,QAChB,KAAK,QAAQ,KAAK;GAEtB,QAAQ,CAER;GACA,KAAK,UAAU;EACjB;EAEA,KAAK,8BAAc,IAAI,IAAI;CAC7B;AACF"}
1
+ {"version":3,"file":"client.js","names":[],"sources":["../../src/lsp/client.ts"],"sourcesContent":["import type { ChildProcess } from 'node:child_process';\nimport { StreamMessageReader, StreamMessageWriter, createMessageConnection } from 'vscode-jsonrpc/node.js';\nimport type { MessageConnection } from 'vscode-jsonrpc/node.js';\nimport { TextDocumentIdentifier, Position } from 'vscode-languageserver-protocol';\nimport type { Diagnostic } from 'vscode-languageserver-protocol';\nimport type { LSPServerInfo } from './server.js';\n\n/**\n * LSP Client wrapper for JSON-RPC communication\n */\nexport class LSPClient {\n private connection: MessageConnection | null = null;\n private process: ChildProcess | null = null;\n private serverInfo: LSPServerInfo;\n private workspaceRoot: string;\n private diagnostics: Map<string, Diagnostic[]> = new Map();\n private initializationOptions: any = null;\n\n constructor(serverInfo: LSPServerInfo, workspaceRoot: string) {\n this.serverInfo = serverInfo;\n this.workspaceRoot = workspaceRoot;\n }\n\n /**\n * Initialize the LSP connection\n */\n async initialize(): Promise<void> {\n const spawnResult = await this.serverInfo.spawn(this.workspaceRoot);\n\n if (!spawnResult) {\n throw new Error('Failed to spawn LSP server');\n }\n\n // Handle both ChildProcess and { process: ChildProcess, initialization? } formats\n let initializationOptions: any = undefined;\n if ('process' in spawnResult) {\n this.process = spawnResult.process;\n initializationOptions = spawnResult.initialization;\n } else {\n this.process = spawnResult;\n }\n\n if (!this.process.stdin || !this.process.stdout) {\n throw new Error('Failed to create LSP process with proper stdio');\n }\n\n const reader = new StreamMessageReader(this.process.stdout);\n const writer = new StreamMessageWriter(this.process.stdin);\n this.connection = createMessageConnection(reader, writer);\n\n // Handle connection errors (e.g., ERR_STREAM_DESTROYED during shutdown)\n this.connection.onError(error => {\n // Silently ignore stream destroyed errors during shutdown\n const errorObj = error?.[0] as any;\n if (errorObj?.code !== 'ERR_STREAM_DESTROYED') {\n }\n });\n\n // Set up diagnostic listener before starting connection\n\n this.connection.onNotification('textDocument/publishDiagnostics', (params: any) => {\n if (params.diagnostics && params.diagnostics.length > 0) {\n }\n this.diagnostics.set(params.uri, params.diagnostics);\n });\n (this.connection as any).onNotification((_method: string, _params: any) => {});\n\n this.connection.listen();\n\n // Capture stderr for debugging\n if (this.process.stderr) {\n this.process.stderr.on('data', _data => {});\n }\n\n // Handle process errors\n this.process.on('error', _error => {});\n\n this.process.on('exit', (_code, _signal) => {});\n\n // Send initialize request matching OpenCode's structure\n const initParams: any = {\n processId: process.pid,\n rootUri: `file://${this.workspaceRoot}`,\n workspaceFolders: [\n {\n name: 'workspace',\n uri: `file://${this.workspaceRoot}`,\n },\n ],\n capabilities: {\n window: {\n workDoneProgress: true,\n },\n workspace: {\n configuration: true,\n },\n textDocument: {\n publishDiagnostics: {\n relatedInformation: true,\n tagSupport: {\n valueSet: [1, 2],\n },\n versionSupport: false,\n },\n synchronization: {\n didOpen: true,\n didChange: true,\n dynamicRegistration: false,\n willSave: false,\n willSaveWaitUntil: false,\n didSave: false,\n },\n completion: {\n dynamicRegistration: false,\n completionItem: {\n snippetSupport: false,\n commitCharactersSupport: false,\n documentationFormat: ['markdown', 'plaintext'],\n deprecatedSupport: false,\n preselectSupport: false,\n },\n },\n definition: {\n dynamicRegistration: false,\n linkSupport: true,\n },\n typeDefinition: {\n dynamicRegistration: false,\n linkSupport: true,\n },\n implementation: {\n dynamicRegistration: false,\n linkSupport: true,\n },\n references: {\n dynamicRegistration: false,\n },\n documentHighlight: {\n dynamicRegistration: false,\n },\n documentSymbol: {\n dynamicRegistration: false,\n hierarchicalDocumentSymbolSupport: true,\n },\n codeAction: {\n dynamicRegistration: false,\n codeActionLiteralSupport: {\n codeActionKind: {\n valueSet: [\n 'quickfix',\n 'refactor',\n 'refactor.extract',\n 'refactor.inline',\n 'refactor.rewrite',\n 'source',\n 'source.organizeImports',\n ],\n },\n },\n },\n hover: {\n dynamicRegistration: false,\n contentFormat: ['markdown', 'plaintext'],\n },\n },\n },\n };\n\n // Add initialization options if provided by the server\n if (initializationOptions) {\n initParams.initializationOptions = initializationOptions;\n this.initializationOptions = initializationOptions;\n }\n\n // Add workspace/configuration request handler like OpenCode\n this.connection.onRequest('workspace/configuration', (params: any) => {\n return params.items?.map(() => ({})) || [];\n });\n\n // Handle window/workDoneProgress/create requests\n this.connection.onRequest('window/workDoneProgress/create', (_params: any) => {\n return null;\n });\n\n await Promise.race([\n this.connection.sendRequest('initialize', initParams),\n new Promise((_, reject) => setTimeout(() => reject(new Error('LSP initialize request timed out')), 10000)),\n ]);\n\n // Send initialized notification with empty object like OpenCode\n this.connection.sendNotification('initialized', {});\n\n // Send workspace/didChangeConfiguration with initialization options like OpenCode\n if (this.initializationOptions) {\n this.connection.sendNotification('workspace/didChangeConfiguration', {\n settings: this.initializationOptions,\n });\n } else {\n this.connection.sendNotification('workspace/didChangeConfiguration', {\n settings: {},\n });\n }\n }\n\n /**\n * Notify the server that a document has been opened\n */\n notifyOpen(filePath: string, content: string, languageId: string): void {\n if (!this.connection) return;\n\n const uri = `file://${filePath}`;\n\n // Clear diagnostics for this file before sending didOpen (like OpenCode does)\n this.diagnostics.delete(uri);\n\n this.connection.sendNotification('textDocument/didOpen', {\n textDocument: {\n uri,\n languageId,\n version: 0,\n text: content,\n },\n });\n }\n\n /**\n * Notify the server that a document has changed\n */\n notifyChange(filePath: string, content: string, version: number): void {\n if (!this.connection) return;\n\n this.connection.sendNotification('textDocument/didChange', {\n textDocument: {\n uri: `file://${filePath}`,\n version,\n },\n contentChanges: [{ text: content }],\n });\n }\n\n /**\n * Wait for diagnostics to be available for a specific file\n * @param waitForChange If true, waits for diagnostics to change from their initial state\n */\n async waitForDiagnostics(\n filePath: string,\n timeoutMs: number = 5000,\n waitForChange: boolean = false,\n ): Promise<Diagnostic[]> {\n if (!this.connection) return [];\n\n const uri = `file://${filePath}`;\n const startTime = Date.now();\n const initialDiagnostics = this.diagnostics.get(uri);\n const initialCount = initialDiagnostics?.length || 0;\n\n // Poll for diagnostics to be updated\n while (Date.now() - startTime < timeoutMs) {\n const currentDiagnostics = this.diagnostics.get(uri);\n const currentCount = currentDiagnostics?.length || 0;\n\n // If waiting for change, check if diagnostics have changed\n if (waitForChange) {\n if (currentDiagnostics !== undefined && currentCount !== initialCount) {\n return currentDiagnostics;\n }\n } else if (currentDiagnostics !== undefined) {\n // Return if we have diagnostics (even if empty array)\n\n return currentDiagnostics;\n }\n\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n\n return waitForChange ? initialDiagnostics || [] : [];\n }\n\n /**\n * Get hover information for a position\n */\n async getHover(filePath: string, line: number, character: number): Promise<any> {\n if (!this.connection) return null;\n\n try {\n return await this.connection.sendRequest('textDocument/hover', {\n textDocument: TextDocumentIdentifier.create(`file://${filePath}`),\n position: Position.create(line, character),\n });\n } catch {\n return null;\n }\n }\n\n /**\n * Get diagnostics for a specific file\n */\n getDiagnostics(filePath: string): Diagnostic[] {\n const uri = `file://${filePath}`;\n return this.diagnostics.get(uri) || [];\n }\n\n /**\n * Get all diagnostics from all files\n */\n getAllDiagnostics(): Diagnostic[] {\n const allDiagnostics: Diagnostic[] = [];\n for (const diagnostics of this.diagnostics.values()) {\n allDiagnostics.push(...diagnostics);\n }\n return allDiagnostics;\n }\n\n /**\n * Notify server that a file was closed\n */\n notifyClose(filePath: string): void {\n if (!this.connection) return;\n\n const uri = `file://${filePath}`;\n\n // Clear diagnostics for this file\n this.diagnostics.delete(uri);\n\n // Send didClose notification\n this.connection.sendNotification('textDocument/didClose', {\n textDocument: TextDocumentIdentifier.create(uri),\n });\n }\n\n /**\n * Restart the LSP client\n */\n async restart(): Promise<void> {\n await this.shutdown();\n\n // Re-initialize (this will re-spawn the server)\n await this.initialize();\n }\n\n /**\n * Shutdown the connection\n */\n async shutdown(): Promise<void> {\n if (this.connection) {\n try {\n // Only send shutdown request if the process is still alive\n const processAlive = this.process && !this.process.killed;\n if (processAlive) {\n await Promise.race([\n this.connection.sendRequest('shutdown'),\n new Promise((_, reject) => setTimeout(() => reject(new Error('Shutdown request timed out')), 1000)),\n ]);\n this.connection.sendNotification('exit');\n }\n } catch {\n // Ignore shutdown errors (process may have already crashed)\n }\n try {\n this.connection.dispose();\n } catch {\n // Ignore dispose errors (stream may already be destroyed)\n }\n this.connection = null;\n }\n\n if (this.process) {\n try {\n if (!this.process.killed) {\n this.process.kill();\n }\n } catch {\n // Ignore kill errors\n }\n this.process = null;\n }\n\n this.diagnostics = new Map();\n }\n}\n"],"mappings":";;;;;;AAUA,IAAa,YAAb,MAAuB;CACrB,aAA+C;CAC/C,UAAuC;CACvC;CACA;CACA,8BAAiD,IAAI,IAAI;CACzD,wBAAqC;CAErC,YAAY,YAA2B,eAAuB;EAC5D,KAAK,aAAa;EAClB,KAAK,gBAAgB;CACvB;;;;CAKA,MAAM,aAA4B;EAChC,MAAM,cAAc,MAAM,KAAK,WAAW,MAAM,KAAK,aAAa;EAElE,IAAI,CAAC,aACH,MAAM,IAAI,MAAM,4BAA4B;EAI9C,IAAI,wBAA6B,KAAA;EACjC,IAAI,aAAa,aAAa;GAC5B,KAAK,UAAU,YAAY;GAC3B,wBAAwB,YAAY;EACtC,OACE,KAAK,UAAU;EAGjB,IAAI,CAAC,KAAK,QAAQ,SAAS,CAAC,KAAK,QAAQ,QACvC,MAAM,IAAI,MAAM,gDAAgD;EAGlE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,WAAW;EAEpC,OAAO;CACT;;;;CAKA,YAAY,UAAwB;EAClC,IAAI,CAAC,KAAK,YAAY;EAEtB,MAAM,MAAM,UAAU;EAGtB,KAAK,YAAY,OAAO,GAAG;EAG3B,KAAK,WAAW,iBAAiB,yBAAyB,EACxD,cAAc,uBAAuB,OAAO,GAAG,EACjD,CAAC;CACH;;;;CAKA,MAAM,UAAyB;EAC7B,MAAM,KAAK,SAAS;EAGpB,MAAM,KAAK,WAAW;CACxB;;;;CAKA,MAAM,WAA0B;EAC9B,IAAI,KAAK,YAAY;GACnB,IAAI;IAGF,IADqB,KAAK,WAAW,CAAC,KAAK,QAAQ,QACjC;KAChB,MAAM,QAAQ,KAAK,CACjB,KAAK,WAAW,YAAY,UAAU,GACtC,IAAI,SAAS,GAAG,WAAW,iBAAiB,uBAAO,IAAI,MAAM,4BAA4B,CAAC,GAAG,GAAI,CAAC,CACpG,CAAC;KACD,KAAK,WAAW,iBAAiB,MAAM;IACzC;GACF,QAAQ,CAER;GACA,IAAI;IACF,KAAK,WAAW,QAAQ;GAC1B,QAAQ,CAER;GACA,KAAK,aAAa;EACpB;EAEA,IAAI,KAAK,SAAS;GAChB,IAAI;IACF,IAAI,CAAC,KAAK,QAAQ,QAChB,KAAK,QAAQ,KAAK;GAEtB,QAAQ,CAER;GACA,KAAK,UAAU;EACjB;EAEA,KAAK,8BAAc,IAAI,IAAI;CAC7B;AACF"}
@@ -1,4 +1,4 @@
1
- //#region src/lsp/language.ts
1
+ // src/lsp/language.ts
2
2
  /**
3
3
  * Maps file extensions to LSP language identifiers
4
4
  */
@@ -38,7 +38,6 @@ function getLanguageId(filePath) {
38
38
  const ext = filePath.substring(filePath.lastIndexOf("."));
39
39
  return LANGUAGE_EXTENSIONS[ext];
40
40
  }
41
- //#endregion
42
41
  export { LANGUAGE_EXTENSIONS, getLanguageId };
43
42
 
44
43
  //# sourceMappingURL=language.js.map
@@ -1,6 +1,6 @@
1
1
  import { LSPClient } from "./client.js";
2
2
  import { getServersForFile } from "./server.js";
3
- //#region src/lsp/manager.ts
3
+ // src/lsp/manager.ts
4
4
  /**
5
5
  * Singleton LSP client manager that keeps clients alive and reuses them
6
6
  * across tool calls for better performance and accuracy
@@ -76,7 +76,6 @@ var LSPManager = class {
76
76
  }
77
77
  };
78
78
  const lspManager = new LSPManager();
79
- //#endregion
80
79
  export { lspManager };
81
80
 
82
81
  //# sourceMappingURL=manager.js.map
@@ -4,7 +4,7 @@ import path, { join } from "path";
4
4
  import { existsSync } from "fs";
5
5
  import { spawn } from "child_process";
6
6
  import { pathToFileURL } from "url";
7
- //#region src/lsp/server.ts
7
+ // src/lsp/server.ts
8
8
  /**
9
9
  * Find the nearest project root directory
10
10
  */
@@ -155,7 +155,6 @@ function getServersForFile(filePath, cwd) {
155
155
  if (!languageId) return [];
156
156
  return Object.values(BUILTIN_SERVERS).filter((server) => server.languageIds.includes(languageId) && server.root(cwd) !== null);
157
157
  }
158
- //#endregion
159
158
  export { BUILTIN_SERVERS, findNearestRoot, getServersForFile };
160
159
 
161
160
  //# sourceMappingURL=server.js.map
@@ -1,6 +1,6 @@
1
1
  import * as path$1 from "path";
2
2
  import * as fs$1 from "fs";
3
- //#region src/lsp/workspace.ts
3
+ // src/lsp/workspace.ts
4
4
  /**
5
5
  * Workspace markers that indicate the root of a project
6
6
  */
@@ -49,7 +49,6 @@ function findWorkspaceRoot(filePath) {
49
49
  }
50
50
  return path$1.dirname(path$1.resolve(filePath));
51
51
  }
52
- //#endregion
53
52
  export { findWorkspaceRoot };
54
53
 
55
54
  //# sourceMappingURL=workspace.js.map
@@ -3,7 +3,7 @@ import * as path$1 from "path";
3
3
  import * as fs$1 from "fs";
4
4
  import * as os$1 from "os";
5
5
  import { parse } from "smol-toml";
6
- //#region src/mcp/config.ts
6
+ // src/mcp/config.ts
7
7
  /**
8
8
  * MCP server configuration loading from filesystem.
9
9
  * Loads from, lowest to highest priority:
@@ -310,7 +310,6 @@ function mergeConfigs(...configs) {
310
310
  if (skippedMap.size > 0) result.skippedServers = Array.from(skippedMap.values());
311
311
  return result;
312
312
  }
313
- //#endregion
314
313
  export { DEFAULT_OAUTH_REDIRECT_URL, MASTRA_CODE_CLIENT_METADATA_URL, classifyServerEntry, expandEnvVars, getClaudeGlobalMcpPath, getClaudeSettingsPath, getCodexGlobalMcpPath, getGlobalMcpPath, getProjectMcpPath, getRootMcpPath, loadMcpConfig, resolveOAuthRedirectUrl, validateConfig };
315
314
 
316
315
  //# sourceMappingURL=config.js.map
@@ -4,7 +4,7 @@ import { DEFAULT_OAUTH_REDIRECT_URL, MASTRA_CODE_CLIENT_METADATA_URL, getClaudeS
4
4
  import { loadGlobalDisableState, loadProjectServerOverrides, saveGlobalDisableState, saveProjectServerOverrides } from "./state.js";
5
5
  import { dirname, join } from "path";
6
6
  import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
7
- //#region src/mcp/manager.ts
7
+ // src/mcp/manager.ts
8
8
  /**
9
9
  * MCP manager — orchestrates MCP server connections using MCPClient directly.
10
10
  * Created once at startup, provides tools from connected MCP servers.
@@ -656,7 +656,6 @@ function createMcpManager(projectDir, configDirName = DEFAULT_CONFIG_DIR, extraS
656
656
  }
657
657
  };
658
658
  }
659
- //#endregion
660
659
  export { createMcpManager };
661
660
 
662
661
  //# sourceMappingURL=manager.js.map
package/dist/mcp/state.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { getAppDataDir } from "../utils/project.js";
2
2
  import { dirname, join } from "path";
3
3
  import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
4
- //#region src/mcp/state.ts
4
+ // src/mcp/state.ts
5
5
  /**
6
6
  * Persisted MCP disable state — mastracode-owned so user config files
7
7
  * (mcp.json, .mcp.json, .claude/settings.local.json) are never mutated.
@@ -91,7 +91,6 @@ function saveGlobalDisableState(globalState) {
91
91
  }
92
92
  });
93
93
  }
94
- //#endregion
95
94
  export { getMcpStatePath, loadGlobalDisableState, loadProjectServerOverrides, saveGlobalDisableState, saveProjectServerOverrides };
96
95
 
97
96
  //# sourceMappingURL=state.js.map
@@ -1,4 +1,4 @@
1
- //#region src/onboarding/custom-packs.ts
1
+ // src/onboarding/custom-packs.ts
2
2
  function removeCustomPackFromSettings(settings, packId) {
3
3
  if (!packId.startsWith("custom:")) return;
4
4
  const packName = packId.slice(7);
@@ -14,7 +14,6 @@ function removeCustomPackFromSettings(settings, packId) {
14
14
  settings.models.packFallbacks = Object.fromEntries(Object.entries(fallbacks).filter(([sourcePackId, targetPackId]) => sourcePackId !== packId && targetPackId !== packId));
15
15
  delete settings.models.packAccountPreferences?.[packId];
16
16
  }
17
- //#endregion
18
17
  export { removeCustomPackFromSettings };
19
18
 
20
19
  //# sourceMappingURL=custom-packs.js.map
@@ -1,5 +1,5 @@
1
1
  import { getCustomProviderId } from "./settings.js";
2
- //#region src/onboarding/custom-providers.ts
2
+ // src/onboarding/custom-providers.ts
3
3
  /**
4
4
  * Pure `GlobalSettings` mutation helpers for custom OpenAI-compatible
5
5
  * providers. Shared by the TUI `/custom-providers` command and the web
@@ -24,7 +24,6 @@ function upsertCustomProviderInSettings(settings, provider, previousProviderId)
24
24
  function removeCustomProviderFromSettings(settings, providerId) {
25
25
  settings.customProviders = settings.customProviders.filter((provider) => getCustomProviderId(provider.name) !== providerId);
26
26
  }
27
- //#endregion
28
27
  export { removeCustomProviderFromSettings, upsertCustomProviderInSettings };
29
28
 
30
29
  //# sourceMappingURL=custom-providers.js.map
@@ -1,6 +1,6 @@
1
1
  import { resolveProviderOMDefault } from "./packs.js";
2
2
  import { loadSettings, saveSettings } from "./settings.js";
3
- //#region src/onboarding/om-settings.ts
3
+ // src/onboarding/om-settings.ts
4
4
  /**
5
5
  * Whether the user has already chosen any persisted OM model or pack.
6
6
  *
@@ -77,7 +77,6 @@ function persistOmObserveAttachments(value) {
77
77
  settings.models.omObserveAttachments = value;
78
78
  saveSettings(settings);
79
79
  }
80
- //#endregion
81
80
  export { applyOMDefaultIfUnconfigured, applyOmRoleAuto, applyOmRoleOverride, hasExplicitOMConfiguration, persistOmObserveAttachments, seedProviderOMDefault };
82
81
 
83
82
  //# sourceMappingURL=om-settings.js.map
@@ -1,6 +1,6 @@
1
1
  import { listBuiltinModePacks, resolveModePackFallbackChain } from "./packs.js";
2
2
  import { resolveModePackModels } from "./settings.js";
3
- //#region src/onboarding/pack-activation.ts
3
+ // src/onboarding/pack-activation.ts
4
4
  /**
5
5
  * Shared model-pack resolution and activation helpers.
6
6
  *
@@ -102,7 +102,6 @@ function activateModePackInSettings(settings, packId) {
102
102
  } else settings.models.modeDefaults = {};
103
103
  settings.models.subagentModels = {};
104
104
  }
105
- //#endregion
106
105
  export { activateModePackInSettings, listResolvableModePacks, listValidModePackIds, resolveModePackArg, resolvePackSelection };
107
106
 
108
107
  //# sourceMappingURL=pack-activation.js.map
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_OM_MODEL_ID } from "../constants.js";
2
2
  import { resolveAutoModelId } from "@mastra/memory";
3
- //#region src/onboarding/packs.ts
3
+ // src/onboarding/packs.ts
4
4
  /**
5
5
  * Onboarding "packs" — predefined model configurations for each mode.
6
6
  *
@@ -280,7 +280,6 @@ function selectPreferredOMPack(access, preferredProviderId) {
280
280
  }) ?? available[0];
281
281
  }
282
282
  const ONBOARDING_VERSION = 1;
283
- //#endregion
284
283
  export { MASTRACODE_AUTO_OM_MODELS, ONBOARDING_VERSION, getAvailableModePacks, getAvailableOmPacks, getBuiltinModePack, isKnownModePackId, listBuiltinModePacks, pruneUnknownModePackFallbacks, pruneUnknownPackAccountPreferences, resolveAutoOMModelId, resolveModePackFallbackChain, resolveProviderOMDefault, selectPreferredOMPack, toMemoryModelId };
285
284
 
286
285
  //# sourceMappingURL=packs.js.map
@@ -7,7 +7,7 @@ import { DEFAULT_STT_PROVIDER, resolveSTTModel } from "../voice/stt-registry.js"
7
7
  import { pruneUnknownModePackFallbacks, pruneUnknownPackAccountPreferences } from "./packs.js";
8
8
  import { dirname, join } from "path";
9
9
  import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
10
- //#region src/onboarding/settings.ts
10
+ // src/onboarding/settings.ts
11
11
  /**
12
12
  * Persistent global settings stored in the app data directory as settings.json.
13
13
  * This file persists onboarding state AND user preferences (model choices, yolo, etc.)
@@ -1082,7 +1082,6 @@ async function createBrowserFromSettings(settings, { chatModelId } = {}) {
1082
1082
  }
1083
1083
  throw new Error(`Unsupported browser provider: ${provider}`);
1084
1084
  }
1085
- //#endregion
1086
1085
  export { ExperimentalAgentSettingsError, GITHUB_POLL_INTERVAL_DEFAULT_MS, GITHUB_POLL_INTERVAL_MAX_MS, GITHUB_POLL_INTERVAL_MIN_MS, MASTRA_GATEWAY_DEFAULT_URL, MASTRA_GATEWAY_PROVIDER, MEMORY_GATEWAY_DEFAULT_URL, MEMORY_GATEWAY_PROVIDER, OBSERVABILITY_AUTH_PREFIX, STAGEHAND_PROVIDER_ENV_VARS, STORAGE_DEFAULTS, THINKING_LEVEL_VALUES, THREAD_ACTIVE_MODEL_PACK_ID_KEY, THREAD_FALLBACK_STATUS_KEY, VIEWPORT_PRESETS, WEB_SEARCH_PROVIDER_VALUES, checkProfileProviderMismatch, createBrowserFromSettings, defaultVoiceEngine, findModePackForModel, getCustomProviderId, getProfileProvider, getSettingsPath, isThinkingLevelSetting, loadSettings, migrateAccountPreferences, migrateLegacyVariedPack, parseCustomProviders, parseExperimentalAgentSetting, parseThreadSettings, parseViewportInput, pruneRemovedAccountPreferences, resolveDefaultThinkingLevel, resolveLspSetting, resolveModePackModels, resolveModelDefaults, resolveOmModel, resolveOmRoleModel, resolveStagehandModel, resolveThreadActiveModelPackId, saveSettings, setProfileProvider, stripMastraCodeCustomProviderPrefix, toActiveBrowserSettings, toCustomProviderModelId };
1087
1086
 
1088
1087
  //# sourceMappingURL=settings.js.map
@@ -1,5 +1,5 @@
1
1
  import { MC_TOOLS } from "./tool-names.js";
2
- //#region src/permissions.ts
2
+ // src/permissions.ts
3
3
  /**
4
4
  * Granular tool permission system.
5
5
  *
@@ -136,7 +136,6 @@ function resolveApproval(toolName, rules, sessionGrants) {
136
136
  if (categoryPolicy) return categoryPolicy;
137
137
  return DEFAULT_POLICIES[category] ?? "ask";
138
138
  }
139
- //#endregion
140
139
  export { DEFAULT_POLICIES, SessionGrants, TOOL_CATEGORIES, YOLO_POLICIES, createDefaultRules, getToolCategory, getToolsForCategory, resolveApproval };
141
140
 
142
141
  //# sourceMappingURL=permissions.js.map
@@ -3,7 +3,7 @@ import { execFile } from "child_process";
3
3
  import { homedir } from "os";
4
4
  import { chmod, mkdir, readFile, writeFile } from "fs/promises";
5
5
  import { createServer } from "http";
6
- //#region src/platform/index.ts
6
+ // src/platform/index.ts
7
7
  /**
8
8
  * Mastra Platform client for Mastra Code.
9
9
  *
@@ -196,7 +196,6 @@ function resolveFactoryUrl(env) {
196
196
  if (!env.instanceUrl) return null;
197
197
  return `https://${env.slug}.${FACTORY_DOMAIN}`;
198
198
  }
199
- //#endregion
200
199
  export { FACTORY_DOMAIN, MASTRA_PLATFORM_API_URL, fetchPlatformEnvironments, fetchPlatformOrgs, fetchPlatformProjects, getPlatformSession, loadPlatformCredentials, loginToPlatform, resolveFactoryUrl, savePlatformCredentials };
201
200
 
202
201
  //# sourceMappingURL=index.js.map
package/dist/plugin.js CHANGED
@@ -2,7 +2,7 @@ import { SignalProvider } from "@mastra/core/signals";
2
2
  import { createTool } from "@mastra/core/tools";
3
3
  import { z } from "zod";
4
4
  import { RequestContext } from "@mastra/core/di";
5
- //#region src/plugin.ts
5
+ // src/plugin.ts
6
6
  async function writeToolProgress(context, progress) {
7
7
  const toolCallId = context?.agent?.toolCallId;
8
8
  if (!toolCallId) return;
@@ -24,7 +24,6 @@ async function writeToolProgress(context, progress) {
24
24
  function defineMastraCodePlugin(plugin) {
25
25
  return plugin;
26
26
  }
27
- //#endregion
28
27
  export { RequestContext, SignalProvider, createTool, defineMastraCodePlugin, writeToolProgress, z };
29
28
 
30
29
  //# sourceMappingURL=plugin.js.map
@@ -1,7 +1,7 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
3
  import { execa } from "execa";
4
- //#region src/plugins/dependencies.ts
4
+ // src/plugins/dependencies.ts
5
5
  async function installPluginDependencies(pluginRoot, commandRoot = pluginRoot, options = {}) {
6
6
  const packageJsonPath = path.join(pluginRoot, "package.json");
7
7
  if (!fs.existsSync(packageJsonPath)) return false;
@@ -81,7 +81,6 @@ function readPackageJson(pluginRoot) {
81
81
  function hasFile(pluginRoot, fileName) {
82
82
  return fs.existsSync(path.join(pluginRoot, fileName));
83
83
  }
84
- //#endregion
85
84
  export { getEntryPackageRoot, getPluginDependencyRoots, installPluginDependencies, installPluginDependenciesForEntry };
86
85
 
87
86
  //# sourceMappingURL=dependencies.js.map
@@ -8,7 +8,7 @@ import { ensureMastraCodePackageLink } from "./package-link.js";
8
8
  import path from "path";
9
9
  import fs from "fs";
10
10
  import { execa } from "execa";
11
- //#region src/plugins/install.ts
11
+ // src/plugins/install.ts
12
12
  const ENTRY_CANDIDATES = ["src/index.ts", "index.ts"];
13
13
  const NON_INTERACTIVE_GIT_ENV = {
14
14
  ...process.env,
@@ -184,7 +184,6 @@ function parseGithubUrl(specifier) {
184
184
  ...ref ? { ref } : {}
185
185
  };
186
186
  }
187
- //#endregion
188
187
  export { NON_INTERACTIVE_GIT_ENV, detectEntry, discoverLocalPlugins, installGithubPlugin, installLocalPlugin };
189
188
 
190
189
  //# sourceMappingURL=install.js.map
@@ -4,7 +4,7 @@ import path from "path";
4
4
  import fs from "fs";
5
5
  import { pathToFileURL } from "url";
6
6
  import { isSignalProvider } from "@mastra/core/signals";
7
- //#region src/plugins/loader.ts
7
+ // src/plugins/loader.ts
8
8
  async function loadPlugins(options) {
9
9
  const globalRegistry = options.globalRegistry ?? loadPluginRegistry(path.join(getPluginRoot("global", options), "plugins.json"));
10
10
  const projectRegistry = options.projectRegistry ?? loadPluginRegistry(path.join(getPluginRoot("project", options), "plugins.json"));
@@ -256,7 +256,6 @@ function markToolConflicts(plugins) {
256
256
  } : plugin;
257
257
  });
258
258
  }
259
- //#endregion
260
259
  export { collectActivePluginTools, isInsideDirectory, loadPluginFromEntry, loadPluginRecord, loadPlugins, resolvePluginEntryPath, resolvePluginRoot };
261
260
 
262
261
  //# sourceMappingURL=loader.js.map
@@ -7,7 +7,7 @@ import { NON_INTERACTIVE_GIT_ENV, discoverLocalPlugins, installGithubPlugin, ins
7
7
  import path from "path";
8
8
  import fs from "fs";
9
9
  import { execa } from "execa";
10
- //#region src/plugins/manager.ts
10
+ // src/plugins/manager.ts
11
11
  const GITHUB_PLUGIN_POLL_INTERVAL_MS = 6e4;
12
12
  function gitExecOptions(cwd) {
13
13
  return {
@@ -451,7 +451,6 @@ var PluginManager = class {
451
451
  await this.reload();
452
452
  }
453
453
  };
454
- //#endregion
455
454
  export { PluginManager };
456
455
 
457
456
  //# sourceMappingURL=manager.js.map
@@ -1,6 +1,6 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
- //#region src/plugins/manifest.ts
3
+ // src/plugins/manifest.ts
4
4
  const PLUGIN_MANIFEST_FILE = ".mastracode-plugin.json";
5
5
  function loadPluginManifest(rootDir) {
6
6
  const manifestPath = path.join(rootDir, PLUGIN_MANIFEST_FILE);
@@ -44,7 +44,6 @@ function validateManifestEntry(entry, index) {
44
44
  ...candidate.name ? { name: candidate.name } : {}
45
45
  };
46
46
  }
47
- //#endregion
48
47
  export { PLUGIN_MANIFEST_FILE, getSingleManifestPlugin, loadPluginManifest, savePluginManifest, upsertPluginManifestEntry };
49
48
 
50
49
  //# sourceMappingURL=manifest.js.map
@@ -1,7 +1,7 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
3
  import { fileURLToPath } from "url";
4
- //#region src/plugins/package-link.ts
4
+ // src/plugins/package-link.ts
5
5
  const MODULE_DIR = path.dirname(fileURLToPath(import.meta.url));
6
6
  let cachedPackageRoot;
7
7
  function mastraCodePackageRoot() {
@@ -55,7 +55,6 @@ function declaresInstallableMastraCodeDependency(pluginDir) {
55
55
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
56
56
  return Boolean(packageJson.dependencies?.mastracode ?? packageJson.devDependencies?.mastracode ?? packageJson.optionalDependencies?.mastracode);
57
57
  }
58
- //#endregion
59
58
  export { ensureMastraCodePackageLink, findMastraCodePackageRoot };
60
59
 
61
60
  //# sourceMappingURL=package-link.js.map
@@ -1,7 +1,7 @@
1
1
  import "../constants.js";
2
2
  import path from "path";
3
3
  import os from "os";
4
- //#region src/plugins/paths.ts
4
+ // src/plugins/paths.ts
5
5
  function getPluginRoot(scope, options) {
6
6
  const configDir = options.configDir ?? ".mastracode";
7
7
  const baseDir = scope === "project" ? options.projectRoot : options.homeDir ?? os.homedir();
@@ -19,7 +19,6 @@ function getPluginScopePaths(scope, options) {
19
19
  sourcesPath: path.join(root, "sources")
20
20
  };
21
21
  }
22
- //#endregion
23
22
  export { getPluginRegistryPath, getPluginRoot, getPluginScopePaths };
24
23
 
25
24
  //# sourceMappingURL=paths.js.map
@@ -1,6 +1,6 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
- //#region src/plugins/registry.ts
3
+ // src/plugins/registry.ts
4
4
  const EMPTY_PLUGIN_REGISTRY = {
5
5
  plugins: {},
6
6
  disabledPlugins: []
@@ -106,7 +106,6 @@ function validatePluginConfigValues(raw) {
106
106
  }
107
107
  return values;
108
108
  }
109
- //#endregion
110
109
  export { EMPTY_PLUGIN_REGISTRY, loadPluginRegistry, mergePluginRegistries, removePluginRecord, savePluginRegistry, setPluginRecord };
111
110
 
112
111
  //# sourceMappingURL=registry.js.map
@@ -3,7 +3,7 @@ import { upsertPluginManifestEntry } from "./manifest.js";
3
3
  import { ensureMastraCodePackageLink } from "./package-link.js";
4
4
  import path from "path";
5
5
  import fs from "fs";
6
- //#region src/plugins/scaffold.ts
6
+ // src/plugins/scaffold.ts
7
7
  function resolveScaffoldTarget(target, options = {}) {
8
8
  if (isBarePluginName(target)) return path.join(options.projectRoot ?? process.cwd(), options.configDir ?? ".mastracode", "plugins", "sources", "local", target);
9
9
  return path.resolve(options.projectRoot ?? process.cwd(), target);
@@ -112,7 +112,6 @@ Open Mastra Code, run \`/plugins\`, and install this directory as a local plugin
112
112
  function humanizeName(value) {
113
113
  return value.split(/[-_.]+/g).filter(Boolean).map((part) => part[0]?.toUpperCase() + part.slice(1)).join(" ") || "Mastra Code Plugin";
114
114
  }
115
- //#endregion
116
115
  export { formatScaffoldSuccess, resolveScaffoldTarget, scaffoldPlugin };
117
116
 
118
117
  //# sourceMappingURL=scaffold.js.map
@@ -1,4 +1,4 @@
1
- //#region src/plugins/signal-lane.ts
1
+ // src/plugins/signal-lane.ts
2
2
  /**
3
3
  * Owns the lifecycle of signal providers contributed by plugins.
4
4
  *
@@ -160,7 +160,6 @@ var PluginSignalLane = class {
160
160
  this.#outputProcessors = output;
161
161
  }
162
162
  };
163
- //#endregion
164
163
  export { PluginSignalLane };
165
164
 
166
165
  //# sourceMappingURL=signal-lane.js.map
@@ -5,7 +5,7 @@ import { getHeapSpaceStatistics, getHeapStatistics } from "v8";
5
5
  import { Session } from "inspector/promises";
6
6
  import { PerformanceObserver } from "perf_hooks";
7
7
  import { arch as arch$1, platform as platform$1 } from "process";
8
- //#region src/process-memory-diagnostics.ts
8
+ // src/process-memory-diagnostics.ts
9
9
  const PROCESS_MEMORY_DIAGNOSTICS_DEFAULTS = {
10
10
  sampleIntervalMs: 1e4,
11
11
  captureIntervalMs: 3e5,
@@ -494,7 +494,6 @@ var ProcessMemoryDiagnostics = class {
494
494
  }
495
495
  }
496
496
  };
497
- //#endregion
498
497
  export { PROCESS_MEMORY_DIAGNOSTICS_DEFAULTS, PROCESS_MEMORY_DIAGNOSTICS_MINIMUMS, ProcessMemoryDiagnostics, ProcessMemoryDiagnosticsConfigError, createProcessMemoryDiagnosticsFromEnvironment, parseProcessMemoryDiagnosticsEnvironment, startConfiguredProcessMemoryDiagnostics, stopProcessMemoryDiagnosticsWithTimeout };
499
498
 
500
499
  //# sourceMappingURL=process-memory-diagnostics.js.map
@@ -1,4 +1,4 @@
1
- //#region src/processors/plan-rejection-abort.ts
1
+ // src/processors/plan-rejection-abort.ts
2
2
  const PLAN_REJECTED_PREFIX = "Plan was not approved";
3
3
  function resultText(result) {
4
4
  if (typeof result === "string") return result;
@@ -48,7 +48,6 @@ var PlanRejectionAbortProcessor = class {
48
48
  }
49
49
  }
50
50
  };
51
- //#endregion
52
51
  export { PlanRejectionAbortProcessor };
53
52
 
54
53
  //# sourceMappingURL=plan-rejection-abort.js.map
@@ -4,7 +4,7 @@ import { existsSync } from "fs";
4
4
  import { MastraModelGateway } from "@mastra/core/llm";
5
5
  import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock";
6
6
  import { fromNodeProviderChain } from "@aws-sdk/credential-providers";
7
- //#region src/providers/amazon-bedrock-gateway.ts
7
+ // src/providers/amazon-bedrock-gateway.ts
8
8
  const CLAUDE_3_CACHEABLE = /claude-3-7-sonnet|claude-3-5-sonnet-20241022|claude-3-5-haiku/;
9
9
  function supportsBedrockPromptCaching(modelId) {
10
10
  if (!modelId.includes("anthropic.claude")) return false;
@@ -139,7 +139,6 @@ var AmazonBedrockGateway = class extends MastraModelGateway {
139
139
  function createAmazonBedrockGateway() {
140
140
  return new AmazonBedrockGateway();
141
141
  }
142
- //#endregion
143
142
  export { AMAZON_BEDROCK_GATEWAY_ID, AmazonBedrockGateway, addBedrockCachePoints, createAmazonBedrockGateway, hasAwsCredentials, supportsBedrockPromptCaching, withBedrockCache };
144
143
 
145
144
  //# sourceMappingURL=amazon-bedrock-gateway.js.map
@@ -1,4 +1,4 @@
1
- //#region src/providers/amazon-bedrock.ts
1
+ // src/providers/amazon-bedrock.ts
2
2
  /**
3
3
  * Amazon Bedrock model catalog.
4
4
  *
@@ -96,7 +96,6 @@ async function getBedrockModelCatalog() {
96
96
  })();
97
97
  return inflightFetch;
98
98
  }
99
- //#endregion
100
99
  export { clearBedrockCatalogCache, getBedrockModelCatalog };
101
100
 
102
101
  //# sourceMappingURL=amazon-bedrock.js.map
@@ -1,11 +1,10 @@
1
- //#region src/providers/anthropic-prompt-cache.ts
1
+ // src/providers/anthropic-prompt-cache.ts
2
2
  /**
3
3
  * TTL for the main agent's Anthropic prompt-cache breakpoints.
4
4
  * Observational memory's idle activation for Anthropic is set to the same value,
5
5
  * so buffered observations don't activate while the cache is still warm.
6
6
  */
7
7
  const ANTHROPIC_PROMPT_CACHE_TTL = "1h";
8
- //#endregion
9
8
  export { ANTHROPIC_PROMPT_CACHE_TTL };
10
9
 
11
10
  //# sourceMappingURL=anthropic-prompt-cache.js.map
@@ -1,4 +1,4 @@
1
- //#region src/providers/anthropic-thinking.ts
1
+ // src/providers/anthropic-thinking.ts
2
2
  const ANTHROPIC_THINKING_BUDGET_TOKENS = {
3
3
  low: 4096,
4
4
  medium: 8192,
@@ -19,7 +19,6 @@ function getAnthropicThinkingCapability(modelId) {
19
19
  function supportsAnthropicXhighEffort(modelId) {
20
20
  return ANTHROPIC_XHIGH_EFFORT_RE.test(modelId);
21
21
  }
22
- //#endregion
23
22
  export { ANTHROPIC_THINKING_BUDGET_TOKENS, getAnthropicThinkingCapability, supportsAnthropicXhighEffort };
24
23
 
25
24
  //# sourceMappingURL=anthropic-thinking.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude-max.d.ts","sourceRoot":"","sources":["../../src/providers/claude-max.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,IAAI,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mB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