@mastra/code-sdk 1.15.1-alpha.4 → 1.16.0-alpha.6
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/acp/agent.js +1 -2
- package/dist/acp/errors.js +1 -2
- package/dist/acp/event-mapper.js +1 -2
- package/dist/acp/index.js +1 -2
- package/dist/acp/runtime.d.ts.map +1 -1
- package/dist/acp/runtime.js +5 -4
- package/dist/acp/runtime.js.map +1 -1
- package/dist/acp/server.js +1 -2
- package/dist/acp/skills.js +1 -2
- package/dist/agent-connections/messaging-processor.js +1 -2
- package/dist/agent-connections/ownership.js +1 -2
- package/dist/agent-connections/registry.js +1 -2
- package/dist/agent-connections/session-advertisement.js +1 -2
- package/dist/agent-connections/signal-provider.js +1 -2
- package/dist/agent-connections/state-processor.js +1 -2
- package/dist/agent-connections/thread-state.js +1 -2
- package/dist/agent-connections/tools.js +1 -2
- package/dist/agent-connections/types.js +1 -2
- package/dist/agent-connections/untrusted-text.js +1 -2
- package/dist/agents/background-completion-events.js +1 -2
- package/dist/agents/background-completion.js +1 -2
- package/dist/agents/context-audit.js +1 -2
- package/dist/agents/credential-resolver.js +1 -2
- package/dist/agents/custom-provider-source.js +1 -2
- package/dist/agents/instructions.js +1 -2
- package/dist/agents/mastracode-gateway.js +1 -2
- package/dist/agents/memory.js +1 -2
- package/dist/agents/model.js +1 -2
- package/dist/agents/modes/build.js +1 -2
- package/dist/agents/modes/explore.js +1 -2
- package/dist/agents/modes/plan.js +1 -2
- package/dist/agents/prompts/agent-instructions.js +1 -2
- package/dist/agents/prompts/build.js +1 -2
- package/dist/agents/prompts/fast.js +1 -2
- package/dist/agents/prompts/index.js +1 -2
- package/dist/agents/prompts/model.js +1 -2
- package/dist/agents/prompts/plan.js +1 -2
- package/dist/agents/prompts/tool-guidance.js +1 -2
- package/dist/agents/sandbox-filesystem.d.ts.map +1 -1
- package/dist/agents/sandbox-filesystem.js +9 -7
- package/dist/agents/sandbox-filesystem.js.map +1 -1
- package/dist/agents/subagents/execute.js +1 -2
- package/dist/agents/subagents/explore.js +1 -2
- package/dist/agents/subagents/index.d.ts +6 -0
- package/dist/agents/subagents/index.d.ts.map +1 -0
- package/dist/agents/subagents/index.js +17 -0
- package/dist/agents/subagents/index.js.map +1 -0
- package/dist/agents/subagents/plan.js +1 -2
- package/dist/agents/thread-caveman-state.js +1 -2
- package/dist/agents/tool-availability.js +1 -2
- package/dist/agents/tools.js +1 -2
- package/dist/agents/workflow-builder-agent.js +1 -2
- package/dist/agents/workspace.js +1 -2
- package/dist/analytics.js +1 -2
- package/dist/auth/account-rotation-processor.d.ts +6 -6
- package/dist/auth/account-rotation-processor.d.ts.map +1 -1
- package/dist/auth/account-rotation-processor.js +41 -51
- package/dist/auth/account-rotation-processor.js.map +1 -1
- package/dist/auth/account-routing-context.js +1 -2
- package/dist/auth/authorization-input.js +1 -2
- package/dist/auth/device-code.js +1 -2
- package/dist/auth/pkce.js +1 -2
- package/dist/auth/provider-auth-error.d.ts +2 -0
- package/dist/auth/provider-auth-error.d.ts.map +1 -1
- package/dist/auth/provider-auth-error.js +8 -3
- package/dist/auth/provider-auth-error.js.map +1 -1
- package/dist/auth/providers/anthropic.js +1 -2
- package/dist/auth/providers/github-copilot.js +1 -2
- package/dist/auth/providers/kimi-coding.js +1 -2
- package/dist/auth/providers/openai-codex.js +1 -2
- package/dist/auth/providers/xai.js +1 -2
- package/dist/auth/storage.js +1 -2
- package/dist/clipboard/index.js +1 -2
- package/dist/constants.js +1 -2
- package/dist/error-classification.js +1 -2
- package/dist/evals/context-builder.js +1 -2
- package/dist/evals/scorers/classify-command.d.ts +1 -2
- package/dist/evals/scorers/classify-command.d.ts.map +1 -1
- package/dist/evals/scorers/classify-command.js +7 -17
- package/dist/evals/scorers/classify-command.js.map +1 -1
- package/dist/evals/scorers/efficiency.js +1 -2
- package/dist/evals/scorers/extract-tools.js +1 -2
- package/dist/evals/scorers/outcome.d.ts.map +1 -1
- package/dist/evals/scorers/outcome.js +36 -22
- package/dist/evals/scorers/outcome.js.map +1 -1
- package/dist/experimental-agent.js +1 -2
- package/dist/factory/client.js +1 -2
- package/dist/factory/remote-controller.js +1 -2
- package/dist/factory/remote-session.js +1 -2
- package/dist/goal-manager.js +1 -2
- package/dist/goal-signal.js +1 -2
- package/dist/headless/cli.d.ts.map +1 -1
- package/dist/headless/cli.js +4 -3
- package/dist/headless/cli.js.map +1 -1
- package/dist/headless/flags.js +1 -2
- package/dist/headless/format.js +1 -2
- package/dist/headless/policy.js +1 -2
- package/dist/headless/run-mc.js +1 -2
- package/dist/headless/types.js +1 -2
- package/dist/hooks/config.js +1 -2
- package/dist/hooks/executor.js +1 -2
- package/dist/hooks/manager.js +1 -2
- package/dist/hooks/types.js +1 -2
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -15
- package/dist/index.js.map +1 -1
- package/dist/ipc/ipc-reporter.js +1 -2
- package/dist/knowledge-inspector.js +1 -2
- package/dist/knowledge-scope.js +1 -2
- package/dist/lsp/client.d.ts.map +1 -1
- package/dist/lsp/client.js +1 -2
- package/dist/lsp/client.js.map +1 -1
- package/dist/lsp/language.js +1 -2
- package/dist/lsp/manager.js +1 -2
- package/dist/lsp/server.js +1 -2
- package/dist/lsp/workspace.js +1 -2
- package/dist/mcp/config.js +1 -2
- package/dist/mcp/manager.js +1 -2
- package/dist/mcp/state.js +1 -2
- package/dist/onboarding/custom-packs.js +1 -2
- package/dist/onboarding/custom-providers.js +1 -2
- package/dist/onboarding/om-settings.js +1 -2
- package/dist/onboarding/pack-activation.js +1 -2
- package/dist/onboarding/packs.js +1 -2
- package/dist/onboarding/settings.js +1 -2
- package/dist/permissions.js +1 -2
- package/dist/platform/index.js +1 -2
- package/dist/plugin.js +1 -2
- package/dist/plugins/dependencies.js +1 -2
- package/dist/plugins/install.js +1 -2
- package/dist/plugins/loader.js +1 -2
- package/dist/plugins/manager.js +1 -2
- package/dist/plugins/manifest.js +1 -2
- package/dist/plugins/package-link.js +1 -2
- package/dist/plugins/paths.js +1 -2
- package/dist/plugins/registry.js +1 -2
- package/dist/plugins/scaffold.js +1 -2
- package/dist/plugins/signal-lane.js +1 -2
- package/dist/process-memory-diagnostics.js +1 -2
- package/dist/processors/plan-rejection-abort.js +1 -2
- package/dist/providers/amazon-bedrock-gateway.js +1 -2
- package/dist/providers/amazon-bedrock.js +1 -2
- package/dist/providers/anthropic-prompt-cache.js +1 -2
- package/dist/providers/anthropic-thinking.js +1 -2
- package/dist/providers/claude-max.d.ts.map +1 -1
- package/dist/providers/claude-max.js +4 -4
- package/dist/providers/claude-max.js.map +1 -1
- package/dist/providers/github-copilot-gateway.js +1 -2
- package/dist/providers/github-copilot.d.ts.map +1 -1
- package/dist/providers/github-copilot.js +5 -5
- package/dist/providers/github-copilot.js.map +1 -1
- package/dist/providers/google-thinking.js +1 -2
- package/dist/providers/kimi-coding.d.ts.map +1 -1
- package/dist/providers/kimi-coding.js +8 -7
- package/dist/providers/kimi-coding.js.map +1 -1
- package/dist/providers/model-ids.js +1 -2
- package/dist/providers/openai-codex.d.ts.map +1 -1
- package/dist/providers/openai-codex.js +7 -7
- package/dist/providers/openai-codex.js.map +1 -1
- package/dist/providers/provider-thinking.js +1 -2
- package/dist/providers/thinking-request.js +1 -2
- package/dist/providers/xai.d.ts.map +1 -1
- package/dist/providers/xai.js +5 -5
- package/dist/providers/xai.js.map +1 -1
- package/dist/schedules/interval.js +1 -2
- package/dist/schedules/prompt.js +1 -2
- package/dist/schedules/run-script.js +1 -2
- package/dist/schedules/scheduler.js +1 -2
- package/dist/schedules/tools.js +1 -2
- package/dist/schema.js +1 -2
- package/dist/theme-palette.js +1 -2
- package/dist/thinking-catalog.js +1 -2
- package/dist/thinking.js +1 -2
- package/dist/tool-names.js +1 -2
- package/dist/tools/request-sandbox-access.js +1 -2
- package/dist/tools/utils.js +1 -2
- package/dist/tools/web-search.js +1 -2
- package/dist/tools/workflows/create-workflow.js +1 -2
- package/dist/tools/workflows/delete-workflow.js +1 -2
- package/dist/tools/workflows/ephemeral-memory.js +1 -2
- package/dist/tools/workflows/extract-json-schema.js +1 -2
- package/dist/tools/workflows/get-workflow.js +1 -2
- package/dist/tools/workflows/list-available-agents.js +1 -2
- package/dist/tools/workflows/list-available-classifiers.js +1 -2
- package/dist/tools/workflows/list-available-tools.js +1 -2
- package/dist/tools/workflows/list-available-workflows.js +1 -2
- package/dist/tools/workflows/list-workflows.js +1 -2
- package/dist/tools/workflows/run-workflow.js +1 -2
- package/dist/tools/workflows/save-workflow.js +1 -2
- package/dist/tools/workflows/tool-ids.js +1 -2
- package/dist/utils/binaries.js +1 -2
- package/dist/utils/debug-log.js +1 -2
- package/dist/utils/discarding-scores-storage.js +1 -2
- package/dist/utils/errors.d.ts +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +99 -80
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/gateway-sync.js +1 -2
- package/dist/utils/local-observability.js +1 -2
- package/dist/utils/maintenance-lock.js +1 -2
- package/dist/utils/notification-dispatch.js +1 -2
- package/dist/utils/open-url.js +1 -2
- package/dist/utils/path-security.js +1 -2
- package/dist/utils/plan-diff.js +1 -2
- package/dist/utils/plans.js +1 -2
- package/dist/utils/project.js +1 -2
- package/dist/utils/prune-cli.js +1 -2
- package/dist/utils/signals-pubsub.js +1 -2
- package/dist/utils/slash-command-loader.js +1 -2
- package/dist/utils/slash-command-processor.js +1 -2
- package/dist/utils/stdin-pipe.js +1 -2
- package/dist/utils/storage-factory.js +1 -2
- package/dist/utils/storage-maintenance.js +1 -2
- package/dist/utils/thread-lock.js +1 -2
- package/dist/utils/token-estimator.js +1 -2
- package/dist/utils/update-check.js +1 -2
- package/dist/utils/wake-session.js +1 -2
- package/dist/voice/stt-registry.js +1 -2
- package/dist/workflows/register-primitives.js +1 -2
- package/dist/workflows/service.js +1 -2
- package/package.json +35 -31
package/dist/ipc/ipc-reporter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/ipc/ipc-reporter.ts
|
|
2
2
|
var IPCReporter = class {
|
|
3
3
|
enabled;
|
|
4
4
|
constructor() {
|
|
@@ -15,7 +15,6 @@ var IPCReporter = class {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
const ipcReporter = new IPCReporter();
|
|
18
|
-
//#endregion
|
|
19
18
|
export { ipcReporter };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=ipc-reporter.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveKnowledgeScopeIdentity } from "./knowledge-scope.js";
|
|
2
2
|
import { createKnowledgeNodeCursor, isKnowledgeScopeVisible, parseKnowledgeWikilinks } from "@mastra/core/storage";
|
|
3
|
-
|
|
3
|
+
// src/knowledge-inspector.ts
|
|
4
4
|
var KnowledgeInspectorError = class extends Error {
|
|
5
5
|
code;
|
|
6
6
|
constructor(code, message) {
|
|
@@ -510,7 +510,6 @@ async function createKnowledgeInspector(input) {
|
|
|
510
510
|
session: input.session
|
|
511
511
|
}) : void 0;
|
|
512
512
|
}
|
|
513
|
-
//#endregion
|
|
514
513
|
export { KnowledgeInspectorError, createKnowledgeInspector };
|
|
515
514
|
|
|
516
515
|
//# sourceMappingURL=knowledge-inspector.js.map
|
package/dist/knowledge-scope.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/knowledge-scope.ts
|
|
2
2
|
/**
|
|
3
3
|
* The organization rung local (TUI/studio) knowledge is curated under. A fixed
|
|
4
4
|
* literal on purpose: deriving it from a hostname, machine id, or path would
|
|
@@ -41,7 +41,6 @@ function resolveKnowledgeScopeIdentity(state) {
|
|
|
41
41
|
organizationId: LOCAL_KNOWLEDGE_ORG_ID
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { LOCAL_KNOWLEDGE_ORG_ID, resolveKnowledgeScopeIdentity };
|
|
46
45
|
|
|
47
46
|
//# sourceMappingURL=knowledge-scope.js.map
|
package/dist/lsp/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lsp/client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,qBAAqB,CAAa;gBAE9B,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM;IAK5D;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAkLjC;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAkBvE;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAYtE;;;OAGG;IACG,kBAAkB,CACtB,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,MAAa,EACxB,aAAa,GAAE,OAAe,GAC7B,OAAO,CAAC,UAAU,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lsp/client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,qBAAqB,CAAa;gBAE9B,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM;IAK5D;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAkLjC;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAkBvE;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAYtE;;;OAGG;IACG,kBAAkB,CACtB,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,MAAa,EACxB,aAAa,GAAE,OAAe,GAC7B,OAAO,CAAC,UAAU,EAAE,CAAC;IA8BxB;;OAEG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAa/E;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE;IAK9C;;OAEG;IACH,iBAAiB,IAAI,UAAU,EAAE;IAQjC;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAcnC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAO9B;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAoChC"}
|
package/dist/lsp/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StreamMessageReader, StreamMessageWriter, createMessageConnection } from "vscode-jsonrpc/node.js";
|
|
2
2
|
import { Position, TextDocumentIdentifier } from "vscode-languageserver-protocol";
|
|
3
|
-
|
|
3
|
+
// src/lsp/client.ts
|
|
4
4
|
/**
|
|
5
5
|
* LSP Client wrapper for JSON-RPC communication
|
|
6
6
|
*/
|
|
@@ -245,7 +245,6 @@ var LSPClient = class {
|
|
|
245
245
|
this.diagnostics = /* @__PURE__ */ new Map();
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
|
-
//#endregion
|
|
249
248
|
export { LSPClient };
|
|
250
249
|
|
|
251
250
|
//# sourceMappingURL=client.js.map
|
package/dist/lsp/client.js.map
CHANGED
|
@@ -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;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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
|
+
{"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,a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
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
|
package/dist/lsp/manager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LSPClient } from "./client.js";
|
|
2
2
|
import { getServersForFile } from "./server.js";
|
|
3
|
-
|
|
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
|
package/dist/lsp/server.js
CHANGED
|
@@ -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
|
-
|
|
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
|
package/dist/lsp/workspace.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as path$1 from "path";
|
|
2
2
|
import * as fs$1 from "fs";
|
|
3
|
-
|
|
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
|
package/dist/mcp/config.js
CHANGED
|
@@ -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
|
-
|
|
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
|
package/dist/mcp/manager.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
package/dist/onboarding/packs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_OM_MODEL_ID } from "../constants.js";
|
|
2
2
|
import { resolveAutoModelId } from "@mastra/memory";
|
|
3
|
-
|
|
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
|
-
|
|
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
|
package/dist/permissions.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MC_TOOLS } from "./tool-names.js";
|
|
2
|
-
|
|
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
|
package/dist/platform/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
package/dist/plugins/install.js
CHANGED
|
@@ -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
|
-
|
|
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
|
package/dist/plugins/loader.js
CHANGED
|
@@ -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
|
-
|
|
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
|
package/dist/plugins/manager.js
CHANGED
|
@@ -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
|
-
|
|
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
|
package/dist/plugins/manifest.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import fs from "fs";
|
|
3
|
-
|
|
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
|
-
|
|
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
|
package/dist/plugins/paths.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../constants.js";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import os from "os";
|
|
4
|
-
|
|
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
|
package/dist/plugins/registry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import fs from "fs";
|
|
3
|
-
|
|
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
|
package/dist/plugins/scaffold.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|