@mastra/code-sdk 1.15.1-alpha.4 → 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.
- 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.js +1 -2
- 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/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.js +1 -2
- 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.js +1 -2
- 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.js +1 -2
- 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.js +1 -2
- 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 +36 -32
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseExperimentalAgentSetting } from "./onboarding/settings.js";
|
|
2
2
|
import { createDurableAgent, createEventedAgent, isDurableAgent, isEventedAgent } from "@mastra/core/agent/durable";
|
|
3
|
-
|
|
3
|
+
// src/experimental-agent.ts
|
|
4
4
|
const ACCEPTED_VALUES = "\"durable\", \"evented\", or unset";
|
|
5
5
|
function parseExperimentalAgentEnvironment(env = process.env) {
|
|
6
6
|
const value = env.MASTRACODE_EXPERIMENTAL_AGENT;
|
|
@@ -30,7 +30,6 @@ function validateExperimentalAgent(agent, mastra, report = console.info) {
|
|
|
30
30
|
if (engineType !== expectedEngine) throw new Error(`Experimental agent "${selection}" resolved workflow engine ${JSON.stringify(engineType)} instead of "${expectedEngine}".`);
|
|
31
31
|
report(`Experimental agent: ${selection} (workflow engine: ${engineType})`);
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
33
|
export { parseExperimentalAgentEnvironment, resolveExperimentalAgent, validateExperimentalAgent, wrapExperimentalAgent };
|
|
35
34
|
|
|
36
35
|
//# sourceMappingURL=experimental-agent.js.map
|
package/dist/factory/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getPlatformSession } from "../platform/index.js";
|
|
2
2
|
import { MastraClient } from "@mastra/client-js";
|
|
3
|
-
|
|
3
|
+
// src/factory/client.ts
|
|
4
4
|
/** The agent controller every Factory serves its coding sessions under. */
|
|
5
5
|
const FACTORY_CONTROLLER_ID = "code";
|
|
6
6
|
const ORGANIZATION_ID_HEADER = "X-Mastra-Organization-Id";
|
|
@@ -92,7 +92,6 @@ function createFactoryClient(address) {
|
|
|
92
92
|
fetch: refreshingFetch(address)
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
//#endregion
|
|
96
95
|
export { FACTORY_CONTROLLER_ID, createFactoryClient, createFactoryUserSession, factoryHeaders, listFactoryProjects, refreshingFetch };
|
|
97
96
|
|
|
98
97
|
//# sourceMappingURL=client.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FACTORY_CONTROLLER_ID, createFactoryClient } from "./client.js";
|
|
2
|
-
|
|
2
|
+
// src/factory/remote-controller.ts
|
|
3
3
|
/**
|
|
4
4
|
* The Factory-side counterpart to the local agent controller. Modes, models, and
|
|
5
5
|
* provider auth come from the Factory, never from local settings or auth storage.
|
|
@@ -37,7 +37,6 @@ var RemoteController = class {
|
|
|
37
37
|
} : { hasAuth: true };
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
//#endregion
|
|
41
40
|
export { RemoteController };
|
|
42
41
|
|
|
43
42
|
//# sourceMappingURL=remote-controller.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createFactoryClient } from "./client.js";
|
|
2
2
|
import { randomUUID } from "crypto";
|
|
3
3
|
import { defaultDisplayState } from "@mastra/core/agent-controller";
|
|
4
|
-
|
|
4
|
+
// src/factory/remote-session.ts
|
|
5
5
|
const MAP_FIELDS = [
|
|
6
6
|
"activeTools",
|
|
7
7
|
"toolInputBuffers",
|
|
@@ -412,7 +412,6 @@ var RemoteSession = class {
|
|
|
412
412
|
this.abort();
|
|
413
413
|
}
|
|
414
414
|
};
|
|
415
|
-
//#endregion
|
|
416
415
|
export { RemoteSession };
|
|
417
416
|
|
|
418
417
|
//# sourceMappingURL=remote-session.js.map
|
package/dist/goal-manager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { loadSettings } from "./onboarding/settings.js";
|
|
2
2
|
import { getGoalActivityDurationMs } from "@mastra/core/agent";
|
|
3
|
-
|
|
3
|
+
// src/goal-manager.ts
|
|
4
4
|
/**
|
|
5
5
|
* GoalManager — persistent cross-turn goals, backed by the Agent's native goal
|
|
6
6
|
* mechanism.
|
|
@@ -348,7 +348,6 @@ var GoalManager = class {
|
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
350
|
};
|
|
351
|
-
//#endregion
|
|
352
351
|
export { DEFAULT_MAX_TURNS, GoalManager };
|
|
353
352
|
|
|
354
353
|
//# sourceMappingURL=goal-manager.js.map
|
package/dist/goal-signal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/goal-signal.ts
|
|
2
2
|
function createGoalReminderSignal(goal) {
|
|
3
3
|
return {
|
|
4
4
|
type: "system-reminder",
|
|
@@ -11,7 +11,6 @@ function createGoalReminderSignal(goal) {
|
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
//#endregion
|
|
15
14
|
export { createGoalReminderSignal };
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=goal-signal.js.map
|
package/dist/headless/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { FLAGS, buildParseArgsOptions, renderFlagUsage } from "./flags.js";
|
|
|
11
11
|
import { createMastraCode } from "../index.js";
|
|
12
12
|
import { existsSync } from "fs";
|
|
13
13
|
import { parseArgs } from "util";
|
|
14
|
-
|
|
14
|
+
// src/headless/cli.ts
|
|
15
15
|
/**
|
|
16
16
|
* CLI adapter for headless MastraCode runs.
|
|
17
17
|
*
|
|
@@ -250,7 +250,6 @@ async function runMCCli(predrainedInput, options) {
|
|
|
250
250
|
if (!stdoutFlushed && exitCode === 0) exitCode = 1;
|
|
251
251
|
process.exit(exitCode);
|
|
252
252
|
}
|
|
253
|
-
//#endregion
|
|
254
253
|
export { flushWritable, hasHeadlessFlag, parseHeadlessArgs, printHeadlessUsage, runMCCli };
|
|
255
254
|
|
|
256
255
|
//# sourceMappingURL=cli.js.map
|
package/dist/headless/flags.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VALID_MODES, VALID_PERMISSION_MODES, VALID_THINKING_LEVELS } from "./types.js";
|
|
2
|
-
|
|
2
|
+
// src/headless/flags.ts
|
|
3
3
|
const VALID_OUTPUTS = [
|
|
4
4
|
"human",
|
|
5
5
|
"json",
|
|
@@ -198,7 +198,6 @@ function renderFlagUsage() {
|
|
|
198
198
|
return [`${label.padEnd(width)}${lines[0]}`, ...lines.slice(1).map((line) => `${" ".repeat(width)}${line}`)].join("\n");
|
|
199
199
|
}).join("\n");
|
|
200
200
|
}
|
|
201
|
-
//#endregion
|
|
202
201
|
export { FLAGS, VALID_OUTPUTS, buildParseArgsOptions, renderFlagUsage };
|
|
203
202
|
|
|
204
203
|
//# sourceMappingURL=flags.js.map
|
package/dist/headless/format.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/headless/format.ts
|
|
2
2
|
/** Truncate a string to `max` characters, appending "..." if truncated. */
|
|
3
3
|
function truncate(s, max) {
|
|
4
4
|
return s.length > max ? s.slice(0, max) + "..." : s;
|
|
@@ -91,7 +91,6 @@ function renderJsonResult(result) {
|
|
|
91
91
|
exitCode: result.exitCode
|
|
92
92
|
}) + "\n";
|
|
93
93
|
}
|
|
94
|
-
//#endregion
|
|
95
94
|
export { createHumanFormatState, formatHuman, formatJsonl, isJsonlEvent, renderJsonResult, renderTextResult, truncate };
|
|
96
95
|
|
|
97
96
|
//# sourceMappingURL=format.js.map
|
package/dist/headless/policy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/headless/policy.ts
|
|
2
2
|
/**
|
|
3
3
|
* Default policy — reproduces the historical headless behavior:
|
|
4
4
|
* - approve every tool approval request,
|
|
@@ -36,7 +36,6 @@ function permissionModeToPolicy(mode) {
|
|
|
36
36
|
default: return autoApprovePolicy;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { autoApprovePolicy, denyPolicy, permissionModeToPolicy };
|
|
41
40
|
|
|
42
41
|
//# sourceMappingURL=policy.js.map
|
package/dist/headless/run-mc.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createGoalReminderSignal } from "../goal-signal.js";
|
|
|
4
4
|
import { MODEL_FALLBACK_STATE_KEY } from "../auth/account-rotation-processor.js";
|
|
5
5
|
import { autoApprovePolicy } from "./policy.js";
|
|
6
6
|
import { isSessionStartupCancelledError } from "@mastra/core/agent-controller";
|
|
7
|
-
|
|
7
|
+
// src/headless/run-mc.ts
|
|
8
8
|
/**
|
|
9
9
|
* Core programmatic runner for MastraCode headless runs.
|
|
10
10
|
*
|
|
@@ -430,7 +430,6 @@ function runMC(options) {
|
|
|
430
430
|
}
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
|
-
//#endregion
|
|
434
433
|
export { runMC };
|
|
435
434
|
|
|
436
435
|
//# sourceMappingURL=run-mc.js.map
|
package/dist/headless/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/headless/types.ts
|
|
2
2
|
const VALID_MODES = [
|
|
3
3
|
"build",
|
|
4
4
|
"plan",
|
|
@@ -13,7 +13,6 @@ const VALID_THINKING_LEVELS = [
|
|
|
13
13
|
"max"
|
|
14
14
|
];
|
|
15
15
|
const VALID_PERMISSION_MODES = ["auto", "deny"];
|
|
16
|
-
//#endregion
|
|
17
16
|
export { VALID_MODES, VALID_PERMISSION_MODES, VALID_THINKING_LEVELS };
|
|
18
17
|
|
|
19
18
|
//# sourceMappingURL=types.js.map
|
package/dist/hooks/config.js
CHANGED
|
@@ -2,7 +2,7 @@ import { DEFAULT_CONFIG_DIR } from "../constants.js";
|
|
|
2
2
|
import * as path$1 from "path";
|
|
3
3
|
import * as fs$1 from "fs";
|
|
4
4
|
import * as os$1 from "os";
|
|
5
|
-
|
|
5
|
+
// src/hooks/config.ts
|
|
6
6
|
/**
|
|
7
7
|
* Hook configuration loading from filesystem.
|
|
8
8
|
* Loads from global (~/.mastracode/hooks.json) and project (.mastracode/hooks.json).
|
|
@@ -74,7 +74,6 @@ function mergeConfigs(global, project) {
|
|
|
74
74
|
}
|
|
75
75
|
return merged;
|
|
76
76
|
}
|
|
77
|
-
//#endregion
|
|
78
77
|
export { VALID_EVENTS, getGlobalHooksPath, getProjectHooksPath, loadHooksConfig };
|
|
79
78
|
|
|
80
79
|
//# sourceMappingURL=config.js.map
|
package/dist/hooks/executor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isBlockingEvent } from "./types.js";
|
|
2
2
|
import { spawn } from "child_process";
|
|
3
|
-
|
|
3
|
+
// src/hooks/executor.ts
|
|
4
4
|
/**
|
|
5
5
|
* Hook process execution.
|
|
6
6
|
* Spawns shell commands, handles stdin/stdout/exit-code protocol.
|
|
@@ -125,7 +125,6 @@ async function runHooksForEvent(hooks, stdinPayload, matchContext = {}) {
|
|
|
125
125
|
warnings
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
//#endregion
|
|
129
128
|
export { executeHook, matchesHook, runHooksForEvent };
|
|
130
129
|
|
|
131
130
|
//# sourceMappingURL=executor.js.map
|
package/dist/hooks/manager.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DEFAULT_CONFIG_DIR } from "../constants.js";
|
|
2
2
|
import { getGlobalHooksPath, getProjectHooksPath, loadHooksConfig } from "./config.js";
|
|
3
3
|
import { runHooksForEvent } from "./executor.js";
|
|
4
|
-
|
|
4
|
+
// src/hooks/manager.ts
|
|
5
5
|
/**
|
|
6
6
|
* HookManager — high-level orchestration for the hooks system.
|
|
7
7
|
* Created once at startup, provides methods for each lifecycle event.
|
|
@@ -249,7 +249,6 @@ var HookManager = class {
|
|
|
249
249
|
return runHooksForEvent(hooks, stdin);
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
|
-
//#endregion
|
|
253
252
|
export { HookManager };
|
|
254
253
|
|
|
255
254
|
//# sourceMappingURL=manager.js.map
|
package/dist/hooks/types.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -87,7 +87,7 @@ import { DEFAULT_GOAL_JUDGE_PROMPT } from "@mastra/core/tools";
|
|
|
87
87
|
import { GithubSignals } from "@mastra/github-signals";
|
|
88
88
|
import { LibSQLStore, LibSQLVector } from "@mastra/libsql";
|
|
89
89
|
import { MastraPlatformExporter, MastraStorageExporter, Observability, SensitiveDataFilter } from "@mastra/observability";
|
|
90
|
-
|
|
90
|
+
// src/index.ts
|
|
91
91
|
const CODE_AGENT_ID = "code-agent";
|
|
92
92
|
const MASTRACODE_TRANSIENT_CONNECTION_MAX_RETRIES = 10;
|
|
93
93
|
const MASTRACODE_MAX_PROCESSOR_RETRIES = 64;
|
|
@@ -1365,7 +1365,6 @@ async function prepareAgentControllerMount(config) {
|
|
|
1365
1365
|
* case: `bootLocalAgentController` (local) or {@link mountAgentControllerOnMastra} (server).
|
|
1366
1366
|
*/
|
|
1367
1367
|
const createMastraCode = bootLocalAgentController;
|
|
1368
|
-
//#endregion
|
|
1369
1368
|
export { KnowledgeInspectorError, LOCAL_KNOWLEDGE_ORG_ID, autoApprovePolicy, bootLocalAgentController, createAuthStorage, createKnowledgeInspector, createMastraCode, createMastraCodeAgentController, denyPolicy, formatHuman, formatJsonl, hasHeadlessFlag, mountAgentControllerOnMastra, permissionModeToPolicy, prepareAgentControllerMount, renderJsonResult, renderTextResult, resolveCloudObservabilityConfig, runMC, runMCCli, wireSessionConcerns };
|
|
1370
1369
|
|
|
1371
1370
|
//# sourceMappingURL=index.js.map
|
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
|
+
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;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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,oBAAkC;EAChC,MAAM,iBAA+B,CAAC;EACtC,KAAK,MAAM,eAAe,KAAK,YAAY,OAAO,GAChD,eAAe,KAAK,GAAG,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
|
+
{"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;CACr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AI,CAAC,KAAK,QAAQ,QAChB,KAAK,QAAQ,KAAK;GAEtB,QAAQ,CAER;GACA,KAAK,UAAU;EACjB;EAEA,KAAK,8BAAc,IAAI,IAAI;CAC7B;AACF"}
|
package/dist/lsp/language.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
|
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
|